/* Lympha Dashboard – Designsystem nach dem Desktop-UX-Prototyp.
   Die Content-Security-Policy erlaubt keine Inline-Styles: alles Visuelle steht hier. */

:root {
  color-scheme: light;
  --navy: #0B2F4A; --navy2: #10233F; --aqua: #19B6C3; --aqua2: #0B8F9B;
  --warm: #FBFAF7; --sand: #F6F1E8; --sage: #A6B7A0; --muted: #667789; --border: #E4EAED;
  --bg: #F3F6F7; --surface: #fff; --surface2: #F8FAFA; --text: #10233F; --sidebar: #08283F;
  --ok: #18866F; --okbg: #E4F4EF; --warn: #A97118; --warnbg: #FFF1D7; --bad: #B54D48; --badbg: #FBE8E6;
  --info: #397B9F; --infobg: #E6F1F7;
  --shadow: 0 14px 38px rgba(11,47,74,.08); --shadow2: 0 4px 16px rgba(11,47,74,.06);
  --r: 20px; --rc: 10px; --side: 252px;
  --head: "Poppins", "Aptos Display", "Segoe UI", sans-serif;
  --ui: "Inter", "Segoe UI", Arial, sans-serif;
  /* Schriftstufen: gegenüber dem Prototyp um zwei Punkt angehoben, damit echte Daten lesbar bleiben. */
  --t1: 11px; --t2: 12px; --t3: 13px; --t4: 14px;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #081720; --surface: #102631; --surface2: #152F3A; --text: #EAF4F7; --muted: #9BAFB9; --border: #2A434E; --sidebar: #061E2D;
  --navy: #D9F2F4; --navy2: #EAF4F7; --warm: #102631; --sand: #18323B; --ok: #5BC9AF; --okbg: #153D38;
  --warn: #F0B85E; --warnbg: #46391E; --bad: #EF8983; --badbg: #492C2C; --info: #7BBDE0; --infobg: #173A4A;
  --shadow: 0 14px 38px rgba(0,0,0,.24); --shadow2: 0 4px 16px rgba(0,0,0,.17);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 14px var(--ui); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { display: block; }
a { color: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Seitenleiste ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--sidebar); color: #D9E8ED; padding: 23px 15px 17px; display: flex; flex-direction: column; z-index: 40; border-right: 1px solid rgba(255,255,255,.06); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 18px; text-decoration: none; }
.brandmark, .brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(140deg, var(--aqua), #62D0D6); color: #073044; font: 700 16px var(--head); box-shadow: 0 8px 22px rgba(25,182,195,.23); flex: 0 0 auto; }
.brandcopy { display: grid; line-height: 1.1; }
.brandcopy b { color: #fff; font: 600 16px var(--head); }
.brandcopy span { font-size: var(--t1); color: #82A1AC; margin-top: 3px; }
.nav { display: grid; gap: 3px; }
.navgroup { padding: 10px 11px 5px; color: #618491; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.nav a { position: relative; width: 100%; color: #AEC3CA; border-radius: 11px; padding: 9px 11px; display: flex; align-items: center; gap: 11px; text-align: left; text-decoration: none; font-size: var(--t3); line-height: 1.25; transition: .18s; }
.nav a:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(25,182,195,.21), rgba(25,182,195,.07)); color: #fff; box-shadow: inset 3px 0 0 var(--aqua); }
.badgecount { margin-left: auto; min-width: 21px; height: 19px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; background: #E5A33E; color: #17313C; font-size: 10px; font-weight: 700; }
.navtag { margin-left: auto; padding: 2px 6px; border: 1px solid rgba(255,255,255,.16); border-radius: 6px; color: #7F9DA8; font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sidefoot { margin-top: auto; padding-top: 14px; }
.systemstate { margin: 9px 5px 13px; padding: 11px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.035); font-size: var(--t1); color: #BFD2D7; }
.systemstate small { display: block; color: #71909B; font-size: 10px; margin-top: 5px; line-height: 1.45; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #58D2AE; margin-right: 6px; box-shadow: 0 0 0 4px rgba(88,210,174,.1); }
.user { display: flex; align-items: center; gap: 9px; padding: 13px 8px 2px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #DDF1F0; color: #0D5961; font-weight: 700; font-size: var(--t1); flex: 0 0 auto; }
.avatar.sm { width: 24px; height: 24px; font-size: 9px; }
.usercopy { display: grid; min-width: 0; flex: 1; }
.usercopy b { font-size: var(--t2); color: #F0F7F8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usercopy span { font-size: 10px; color: #7897A2; margin-top: 2px; }
.user form { margin: 0; }
.logout { width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: transparent; color: #AEC3CA; display: grid; place-items: center; }
.logout:hover { border-color: var(--aqua); color: #fff; }
.logout .icon { width: 15px; height: 15px; }

/* ---------- Rahmen und Kopfzeile ---------- */
.shell { padding-left: var(--side); min-height: 100vh; }
.topbar { position: sticky; top: 0; height: 74px; display: grid; grid-template-columns: minmax(300px, 500px) 1fr auto; align-items: center; gap: 18px; padding: 0 30px; background: color-mix(in srgb, var(--bg) 91%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); z-index: 30; }
.search { position: relative; margin: 0; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input[type="search"] { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); padding: 0 62px 0 41px; outline: none; }
.search input[type="search"]:focus { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(25,182,195,.11); }
.key { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; background: var(--surface2); }
.crumb { font-size: var(--t2); color: var(--muted); }
.crumb b { color: var(--text); }
.topactions, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iconbtn, .icon-button { position: relative; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); display: grid; place-items: center; text-decoration: none; font-size: 20px; line-height: 1; flex: 0 0 auto; }
.iconbtn:hover, .icon-button:hover { border-color: var(--aqua); color: var(--aqua2); }
.alertdot { position: absolute; right: 8px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: #E4A03D; border: 2px solid var(--surface); box-sizing: content-box; }

/* ---------- Schaltflächen ---------- */
.btn, .button { min-height: 40px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: var(--t2); font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn:hover, .button:hover { border-color: var(--aqua); color: var(--aqua2); }
.btn.primary, .button-primary { background: var(--navy2); border-color: var(--navy2); color: #fff; }
.btn.primary:hover, .button-primary:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.aqua { background: var(--aqua); border-color: var(--aqua); color: #073044; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: var(--t1); border-radius: 8px; }
.button-secondary { background: var(--surface); }
.button-danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.button-danger:hover { background: var(--badbg); color: var(--bad); border-color: var(--bad); }
.btn:disabled, .button:disabled { opacity: .55; cursor: not-allowed; }
html[data-theme="dark"] .btn.primary, html[data-theme="dark"] .button-primary { background: var(--aqua); border-color: var(--aqua); color: #073044; }
.linkbtn, .text-link { border: 0; background: transparent; color: var(--aqua2); font-size: var(--t2); font-weight: 700; padding: 4px 0; text-decoration: none; }
.linkbtn:hover, .text-link:hover { text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--aqua2); font-size: var(--t2); font-weight: 700; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(25,182,195,.35); outline-offset: 1px; }

/* ---------- Seiteninhalt ---------- */
main.workspace { padding: 27px 30px 56px; max-width: 1900px; margin: auto; }
main.workspace.narrow-content { max-width: 980px; }
.pagehead, .page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.pagehead h1, .page-header h1, .detail-hero h1 { margin: 0; font: 600 28px/1.15 var(--head); letter-spacing: -.025em; }
.pagehead p, .lead { margin: 7px 0 0; color: var(--muted); font-size: var(--t4); max-width: 760px; line-height: 1.5; }
.eyebrow { display: block; color: var(--aqua2); font-size: var(--t1); font-weight: 700; letter-spacing: .11em; text-transform: uppercase; margin: 0 0 6px; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.dashgrid { grid-template-columns: minmax(0, 1.7fr) minmax(330px, .8fr); align-items: start; }
.twocol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.threecol { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.workgrid { grid-template-columns: minmax(370px, 1.15fr) minmax(330px, 1fr) minmax(300px, .82fr); align-items: start; }
.split { grid-template-columns: minmax(0, 1.55fr) minmax(320px, .72fr); align-items: start; }
.mailgrid { grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); align-items: start; }
.settingsgrid { grid-template-columns: 230px minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 16px; }
.section-gap { margin-top: 16px; }
.section-gap-bottom { margin-bottom: 16px; }

.card, .data-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow2); }
.pad { padding: 19px; }
.cardhead, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.cardhead h2, .section-heading h2 { margin: 0; font: 600 16px var(--head); }
.cardhead p, .section-heading p { margin: 5px 0 0; color: var(--muted); font-size: var(--t2); line-height: 1.45; }
.cardhead .tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Kennzahlen ---------- */
.kpi { position: relative; overflow: hidden; padding: 17px 18px; min-height: 124px; display: block; text-decoration: none; color: inherit; }
.kpi::after { content: ""; position: absolute; right: -28px; bottom: -37px; width: 108px; height: 108px; border-radius: 50%; background: rgba(25,182,195,.065); }
a.kpi:hover { border-color: var(--aqua); }
.kpitop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpiicon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--infobg); color: var(--info); }
.kpiicon.ok { background: var(--okbg); color: var(--ok); }
.kpiicon.warn { background: var(--warnbg); color: var(--warn); }
.kpiicon.bad { background: var(--badbg); color: var(--bad); }
.kpiicon.aqua { background: rgba(25,182,195,.12); color: var(--aqua2); }
.delta { font-size: var(--t1); color: var(--ok); background: var(--okbg); padding: 4px 7px; border-radius: 6px; font-weight: 700; }
.delta.warn { color: var(--warn); background: var(--warnbg); }
.delta.bad { color: var(--bad); background: var(--badbg); }
.delta.neutral { color: var(--muted); background: var(--surface2); border: 1px solid var(--border); }
.kpivalue { display: block; font: 600 24px var(--head); margin: 11px 0 3px; }
.kpilabel { font-size: var(--t2); color: var(--muted); }

/* ---------- Diagramme ---------- */
.period { display: inline-flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.period button, .period a { height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 0 9px; font-size: var(--t1); font-weight: 700; display: inline-flex; align-items: center; text-decoration: none; }
.period button.active, .period a.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(11,47,74,.08); }
.chartcard { padding: 19px; }
.chartsummary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chartsummary strong { font: 600 28px var(--head); }
.chartsummary span { font-size: var(--t1); color: var(--ok); font-weight: 700; }
.chart { height: 238px; margin-top: 7px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.gridline { stroke: var(--border); stroke-width: 1; }
.chartarea { fill: url(#grad); }
.chartline { fill: none; stroke: var(--aqua); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chartdot { fill: var(--surface); stroke: var(--aqua); stroke-width: 3; }
.chartlabel { fill: var(--muted); font: 10px var(--ui); }
.chartvalue { fill: var(--text); font: 600 11px var(--ui); }
.barchart { width: 100%; height: 230px; overflow: visible; }
.barchart .bar { fill: var(--aqua); }
.barchart .bar.service { fill: var(--sage); }
.barchart .bar.overdue { fill: var(--bad); }
.barchart .baseline { stroke: var(--border); stroke-width: 1; }
.chartlegend { display: flex; justify-content: center; gap: 14px; margin-top: 10px; font-size: var(--t1); color: var(--muted); }
.chartlegend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--aqua); }
.chartlegend i.service { background: var(--sage); }
.chartlegend i.overdue { background: var(--bad); }

.moneylayout { display: grid; grid-template-columns: 140px 1fr; gap: 17px; align-items: center; }
.donut { position: relative; width: 136px; height: 136px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .track { fill: none; stroke: var(--warn); stroke-width: 22; }
.donut .track.empty { stroke: var(--border); }
.donut .value { fill: none; stroke: var(--aqua); stroke-width: 22; }
.donuttext { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donuttext b { display: block; font: 600 17px var(--head); }
.donuttext span { font-size: 10px; color: var(--muted); }
.moneylines { display: grid; gap: 9px; }
.moneyline { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; text-decoration: none; }
.legend { width: 8px; height: 8px; border-radius: 50%; background: var(--aqua); }
.legend.open, .legend.warn { background: var(--warn); }
.legend.info { background: var(--info); }
.legend.ok { background: var(--ok); }
.legend.bad { background: var(--bad); }
.legend.sage { background: var(--sage); }
.moneyline span { font-size: var(--t2); color: var(--muted); }
.moneyline b { font-size: var(--t2); }
progress.progress { display: block; width: 100%; height: 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); overflow: hidden; appearance: none; -webkit-appearance: none; color: var(--aqua); }
progress.progress::-webkit-progress-bar { background: var(--surface2); }
progress.progress::-webkit-progress-value { background: var(--aqua); border-radius: 8px; }
progress.progress::-moz-progress-bar { background: var(--aqua); border-radius: 8px; }
progress.progress.warn::-webkit-progress-value, progress.progress.open::-webkit-progress-value { background: var(--warn); }
progress.progress.warn::-moz-progress-bar, progress.progress.open::-moz-progress-bar { background: var(--warn); }
progress.progress.info::-webkit-progress-value { background: var(--info); }
progress.progress.info::-moz-progress-bar { background: var(--info); }
progress.progress.ok::-webkit-progress-value { background: var(--ok); }
progress.progress.ok::-moz-progress-bar { background: var(--ok); }
progress.progress.bad::-webkit-progress-value { background: var(--bad); }
progress.progress.bad::-moz-progress-bar { background: var(--bad); }
progress.progress.sage::-webkit-progress-value { background: var(--sage); }
progress.progress.sage::-moz-progress-bar { background: var(--sage); }

/* ---------- Schnellaktionen ---------- */
.quick { padding: 17px; background: linear-gradient(135deg, #10233F, #114C66); color: #fff; border-color: transparent; }
.quick .cardhead h2 { color: #fff; }
.quick .cardhead p { color: #B9CDD5; }
.quickgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quicktile { min-height: 88px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.075); color: #fff; border-radius: 14px; padding: 12px; display: grid; align-content: space-between; gap: 8px; text-align: left; text-decoration: none; }
.quicktile:hover { background: rgba(255,255,255,.13); }
.quicktile svg { color: #5AD2D9; }
.quicktile b { font-size: var(--t2); }
.quicktile small { font-size: 10px; color: #ACC3CC; line-height: 1.35; }

/* ---------- Listen ---------- */
.list { display: grid; }
.listitem { display: grid; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.listitem:last-child { border-bottom: 0; }
a.listitem:hover .copy b { color: var(--aqua2); }
.listitem.agenda { grid-template-columns: 78px auto 1fr auto; }
.listitem.activity { grid-template-columns: auto 1fr auto; }
.time { font-size: var(--t2); font-weight: 700; line-height: 1.3; }
.time small { display: block; color: var(--muted); font-size: 10px; font-weight: 600; }
.mark { width: 9px; height: 9px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 0 4px rgba(25,182,195,.11); }
.copy { display: grid; gap: 2px; min-width: 0; }
.copy b { font-size: var(--t3); }
.copy span { font-size: var(--t1); color: var(--muted); overflow-wrap: anywhere; }
.miniicon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; background: var(--surface2); color: var(--aqua2); }
.miniicon svg { width: 14px; height: 14px; }
.miniicon.bad { background: var(--badbg); color: var(--bad); }
.miniicon.warn { background: var(--warnbg); color: var(--warn); }
.listitem time, .listitem .when { font-size: var(--t1); color: var(--muted); white-space: nowrap; }
.empty-state { color: var(--muted); font-size: var(--t2); margin: 6px 0; padding: 14px 0; }
td.empty-state { padding: 22px 13px; }

/* ---------- Statusmarken ---------- */
.status, .status-badge { display: inline-flex; align-items: center; width: max-content; max-width: 100%; border-radius: 7px; padding: 5px 8px; font-size: var(--t1); font-weight: 700; white-space: nowrap; line-height: 1.2; background: var(--surface2); color: var(--muted); }
.status.ok, .status-confirmed, .status-scheduled { background: var(--okbg); color: var(--ok); }
.status.warn, .status-customer-contact-required, .status-planning-required, .status-dispatch-required { background: var(--warnbg); color: var(--warn); }
.status.bad, .status-overdue, .status-customer-declined, .status-appointment-declined, .status-no-service { background: var(--badbg); color: var(--bad); }
.status.info, .status-customer-response-pending, .status-confirmation-pending { background: var(--infobg); color: var(--info); }
.status.neutral, .status-completed, .status-cancelled { background: var(--surface2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.status.demo { background: var(--sand); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); text-transform: uppercase; letter-spacing: .05em; font-size: 9px; }
.status-badge { white-space: normal; }

/* ---------- Hinweise ---------- */
.notice { display: flex; align-items: flex-start; gap: 8px; background: var(--infobg); color: var(--info); border-radius: 10px; padding: 10px 12px; font-size: var(--t2); line-height: 1.45; }
.notice svg { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px; }
.notice.demo { background: var(--sand); color: var(--muted); border: 1px solid var(--border); margin-bottom: 16px; }
.notice.demo b { color: var(--text); }
.notice.spaced { margin-top: 13px; }
.alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid transparent; border-radius: 12px; font-size: var(--t3); }
.alert-success { background: var(--okbg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.alert-error { background: var(--badbg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
#notification.alert { position: sticky; top: 86px; z-index: 25; box-shadow: var(--shadow2); }

/* ---------- Assistent ---------- */
.assistant { padding: 17px; border-color: rgba(25,182,195,.28); background: linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--aqua) 5%, var(--surface))); }
.assisthead { display: flex; align-items: center; gap: 9px; }
.assistmark { width: 36px; height: 36px; border-radius: 11px; background: var(--navy2); color: #fff; display: grid; place-items: center; }
html[data-theme="dark"] .assistmark { background: var(--aqua); color: #073044; }
.assisthead div { display: grid; flex: 1; }
.assisthead b { font: 600 14px var(--head); }
.assisthead span { font-size: var(--t1); color: var(--muted); }
.assistinput { display: flex; gap: 7px; margin-top: 13px; }
.assistinput input { min-width: 0; flex: 1; height: 38px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); padding: 0 10px; }
.assistinput button { width: 38px; border: 0; border-radius: 9px; background: var(--aqua); color: #073044; display: grid; place-items: center; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.chips button { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 7px; padding: 6px 8px; font-size: var(--t1); }
.assistantcol { display: grid; gap: 16px; }

/* ---------- Werkzeugleiste, Formularfelder ---------- */
.toolbar { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card.toolbar { border-bottom: 1px solid var(--border); }
.filters, .filter-bar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 0; }
.field, .select, select, input:not([type]), input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="date"], input[type="datetime-local"], input[type="number"], input[type="search"], textarea { min-height: 38px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); padding: 8px 10px; outline: none; width: 100%; }
.field:focus, .select:focus, select:focus, input:focus, textarea:focus { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(25,182,195,.11); }
.filters .field { width: auto; min-width: 230px; flex: 1 1 230px; }
.filters .select { width: auto; min-width: 150px; font-size: var(--t3); }
.filters .field.short { min-width: 150px; flex: 0 1 170px; }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--aqua2); }
input[readonly] { background: var(--surface2); color: var(--muted); }
textarea { resize: vertical; line-height: 1.5; }

/* ---------- Tabellen ---------- */
.tablecard { overflow: hidden; }
.tablewrap, .table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
.table { min-width: 800px; }
.table.compact { min-width: 0; }
.customer-list-table { min-width: 680px; }
.customer-list-table th, .customer-list-table td { padding-left: 11px; padding-right: 11px; }
th { text-align: left; background: var(--surface2); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 13px; border-bottom: 1px solid var(--border); font-size: var(--t3); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--aqua) 3%, var(--surface)); }
tbody tr.selected { background: color-mix(in srgb, var(--aqua) 6%, var(--surface)); box-shadow: inset 3px 0 0 var(--aqua); }
td small, .cell span, .cell-secondary { display: block; margin-top: 3px; font-size: var(--t1); color: var(--muted); font-weight: 400; }
.cell { display: grid; gap: 2px; }
.cell b { font-size: var(--t3); }
.cell a { text-decoration: none; }
.cell a:hover b { color: var(--aqua2); }
.rowactions { text-align: right; white-space: nowrap; }
.rowactions > * + * { margin-left: 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.record-id { color: var(--muted); font-family: Consolas, monospace; font-size: var(--t1); }

/* ---------- Detailspalte ---------- */
.detail { position: sticky; top: 96px; padding: 18px; }
.detailhero { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.detailhero h2 { margin: 0; font: 600 16px var(--head); }
.detailhero p { margin: 3px 0 0; color: var(--muted); font-size: var(--t1); }
.block { padding: 12px 0; border-top: 1px solid var(--border); }
.block h3 { margin: 0 0 8px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.dline { display: flex; justify-content: space-between; gap: 12px; margin: 7px 0; font-size: var(--t2); }
.dline span { color: var(--muted); }
.dline b { text-align: right; overflow-wrap: anywhere; }
.detail .actions { margin-bottom: 12px; }

/* ---------- Anlagen ---------- */
.systemgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.systemcard { padding: 16px; transition: .18s; }
.systemcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.systemtop { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.device { width: 45px; height: 55px; border-radius: 13px; background: linear-gradient(160deg, #E9F3F5, #D7E5E9); position: relative; box-shadow: inset 0 -7px 15px rgba(11,47,74,.07); flex: 0 0 auto; }
html[data-theme="dark"] .device { background: linear-gradient(160deg, #35515E, #1B3743); }
.device::after { content: ""; position: absolute; left: 13px; top: 12px; width: 19px; height: 3px; border-radius: 3px; background: var(--aqua); }
.systemcard h3 { margin: 12px 0 2px; font: 600 14px var(--head); }
.systemcard > p { margin: 0; color: var(--muted); font-size: var(--t1); }
.systemmeta { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.systemmeta div { padding: 8px; background: var(--surface2); border-radius: 9px; }
.systemmeta span { display: block; color: var(--muted); font-size: 10px; }
.systemmeta b { display: block; font-size: var(--t2); margin-top: 3px; }
.systemactions { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }

/* ---------- Servicefluss und Aufgaben ---------- */
.pipeline, .taskboard { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 11px; overflow: auto; }
.column { min-width: 220px; }
.colhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 3px 8px; }
.colhead b { font-size: var(--t2); }
.colhead > span.count { min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center; background: var(--surface2); border: 1px solid var(--border); font-size: 10px; }
.case { display: block; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; margin-bottom: 7px; box-shadow: var(--shadow2); text-decoration: none; color: inherit; }
a.case:hover { border-color: var(--aqua); }
.case.selected { box-shadow: inset 3px 0 0 var(--aqua), var(--shadow2); }
.case h3 { margin: 8px 0 3px; font-size: var(--t3); }
.case p { margin: 0; color: var(--muted); font-size: var(--t1); line-height: 1.45; }
.casefoot { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: var(--t1); }
.casefoot span { color: var(--aqua2); font-weight: 700; white-space: nowrap; }
.column-empty { padding: 14px 12px; border: 1px dashed var(--border); border-radius: 13px; color: var(--muted); font-size: var(--t1); }
.metricrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.metricrow.four { grid-template-columns: repeat(4, 1fr); }
.metric { padding: 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; }
.card > .metricrow .metric, main > .metricrow .metric { background: var(--surface); }
.metric span { font-size: var(--t1); color: var(--muted); }
.metric b { display: block; font: 600 17px var(--head); margin-top: 4px; }
.metric b.bad { color: var(--bad); }
.taskcol { min-width: 220px; background: var(--surface2); border: 1px solid var(--border); border-radius: 15px; padding: 10px; }
.task { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 10px; margin-bottom: 7px; text-decoration: none; color: inherit; }
a.task:hover { border-color: var(--aqua); }
.task label, .task .tasktype { font-size: 10px; color: var(--aqua2); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.task h3 { margin: 6px 0 4px; font-size: var(--t2); line-height: 1.4; }
.task p { margin: 0; color: var(--muted); font-size: var(--t1); }
.taskmeta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--border); font-size: 10px; color: var(--muted); }
.viewpanel[hidden] { display: none; }

/* ---------- E-Mail ---------- */
.mail { display: grid; grid-template-columns: 205px 1fr; min-height: 600px; overflow: hidden; }
.templaterail { padding: 16px; border-right: 1px solid var(--border); }
.templaterail h3 { margin: 0 0 11px; font: 600 13px var(--head); }
.templatebtn { width: 100%; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 9px; padding: 9px; text-align: left; margin-bottom: 4px; }
.templatebtn.active, .templatebtn:hover { background: var(--surface2); border-color: var(--border); color: var(--text); }
.templatebtn b { display: block; font-size: var(--t2); }
.templatebtn span { display: block; font-size: 10px; margin-top: 3px; }
.composer { padding: 21px; }
.formrow { display: grid; grid-template-columns: 95px 1fr; gap: 11px; align-items: center; margin-bottom: 12px; }
.formrow.top { align-items: start; }
.formrow label { font-size: var(--t2); color: var(--muted); }
.formrow textarea { min-height: 240px; }
.composerfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.composerfoot small { font-size: var(--t1); color: var(--muted); }

/* ---------- Einstellungen ---------- */
.settingsnav { padding: 11px; position: sticky; top: 96px; }
.settingsnav a { display: block; color: var(--muted); padding: 10px; border-radius: 9px; font-size: var(--t2); margin-bottom: 2px; text-decoration: none; }
.settingsnav a.active, .settingsnav a:hover { background: var(--surface2); color: var(--text); }
.settingspanel { padding: 21px; }
.settingsection { padding-bottom: 21px; margin-bottom: 21px; border-bottom: 1px solid var(--border); scroll-margin-top: 96px; }
.settingsection:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.settingsection h2 { margin: 0 0 4px; font: 600 15px var(--head); display: flex; align-items: center; gap: 8px; }
.settingsection > p { margin: 0 0 14px; color: var(--muted); font-size: var(--t2); }
.settingline { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 0; }
.settingline > div { display: grid; gap: 2px; }
.settingline b { font-size: var(--t3); }
.settingline span { font-size: var(--t1); color: var(--muted); }
.switch { position: relative; width: 38px; height: 22px; border: 0; border-radius: 12px; background: var(--border); flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 5px rgba(0,0,0,.17); }
.switch.on { background: var(--aqua); }
.switch.on::after { transform: translateX(16px); }
.permlist { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }

/* ---------- Dialoge ---------- */
dialog.form-dialog, dialog.modal { width: min(700px, calc(100% - 30px)); max-height: 88vh; padding: 0; overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 21px; box-shadow: 0 30px 90px rgba(3,20,30,.3); }
dialog.form-dialog::backdrop, dialog.modal::backdrop, dialog.drawer::backdrop { background: rgba(3,20,30,.45); }
dialog.drawer { margin: 0 0 0 auto; width: min(510px, 92vw); height: 100vh; max-height: 100vh; padding: 0; border: 0; background: var(--surface); color: var(--text); box-shadow: -18px 0 55px rgba(3,20,30,.2); }
.layerhead, .dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.layerhead { padding: 19px 21px; border-bottom: 1px solid var(--border); }
.layerhead h2, .dialog-heading h2 { margin: 0; font: 600 18px var(--head); }
.modalbody, .drawerbody { padding: 21px; }
.layerfoot { padding: 14px 21px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modalgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formfield { display: grid; gap: 5px; }
.formfield.full { grid-column: 1 / -1; }
.formfield label, .stack-form label, .field-label { font-size: var(--t1); color: var(--muted); font-weight: 700; }
.formfield textarea { min-height: 125px; }
.readonly-value { min-height: 38px; display: flex; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface2); font-size: var(--t3); overflow-wrap: anywhere; }
.stack-form { display: grid; gap: 12px; padding: 24px; }
.stack-form label { display: grid; gap: 6px; }
.stack-form.compact-form { padding: 12px 0 0; }
.address-fieldset, .standard-filter-picker { display: grid; gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; }
.address-fieldset legend, .standard-filter-picker legend { padding: 0 6px; color: var(--text); font-size: var(--t2); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.checkbox-label { grid-template-columns: auto 1fr !important; align-items: center; color: var(--text) !important; font-weight: 500 !important; }
.field-help { color: var(--muted); font-size: var(--t1); font-weight: 400; line-height: 1.45; }
.field-label { display: block; margin-bottom: 3px; }
.field-label-spaced { margin-top: 14px; }
.createlist { display: grid; gap: 8px; padding: 21px; }
.createlist a { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--border); border-radius: 13px; text-decoration: none; }
.createlist a:hover { border-color: var(--aqua); background: var(--surface2); }
.createlist b { display: block; font-size: var(--t3); }
.createlist small { display: block; color: var(--muted); font-size: var(--t1); margin-top: 2px; }
.subtle { color: var(--muted); font-size: var(--t1); }

/* ---------- Meldung unten rechts ---------- */
.toast { position: fixed; right: 23px; bottom: 23px; display: flex; align-items: center; gap: 8px; background: #10233F; color: #fff; border-radius: 11px; padding: 11px 14px; box-shadow: var(--shadow); z-index: 140; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { transform: none; opacity: 1; }
.toast span { font-size: var(--t2); font-weight: 600; }
.demobadge, .demo-data-banner { position: fixed; right: 17px; bottom: 17px; z-index: 20; background: var(--sand); color: var(--muted); border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; box-shadow: var(--shadow2); }

/* ---------- Kundendetail und Partner ---------- */
.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow2); }
.detail-hero p { margin: 8px 0 0; color: var(--muted); font-size: var(--t3); }
.detail-hero p.eyebrow { margin: 0 0 6px; color: var(--aqua2); font-size: var(--t1); }
.customer-hero-status { display: grid; justify-items: end; gap: 8px; }
.tab-nav { position: sticky; top: 74px; z-index: 5; display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; padding: 8px 0; background: var(--bg); }
.tab-nav a { padding: 8px 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; font-size: var(--t2); font-weight: 700; text-decoration: none; }
.tab-nav a:hover { color: var(--text); border-color: var(--aqua); }
.tab-nav a.active { color: #fff; background: var(--navy2); border-color: var(--navy2); }
html[data-theme="dark"] .tab-nav a.active { background: var(--aqua); border-color: var(--aqua); color: #073044; }
.detail-section, .work-section { padding: 21px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow2); scroll-margin-top: 132px; }
.detail-section > h2, .work-section > h2 { margin: 0 0 6px; font: 600 16px var(--head); }
.section-intro { color: var(--muted); font-size: var(--t2); margin: 4px 0 14px; line-height: 1.5; }
.facts-list { margin: 16px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 13px 20px; }
.facts-list div { min-width: 0; }
.facts-list dt, .asset-facts dt, .compact-facts dt, .confirmation-facts dt { color: var(--muted); font-size: var(--t1); }
.facts-list dd, .asset-facts dd, .compact-facts dd { margin: 3px 0 0; font-weight: 600; font-size: var(--t3); overflow-wrap: anywhere; }
.simple-list { display: grid; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.simple-list > * { padding: 13px 15px; color: inherit; text-decoration: none; margin: 0; }
.simple-list > * + * { border-top: 1px solid var(--border); }
.simple-list a:hover { background: var(--surface2); }
.simple-list strong { font-size: var(--t3); }
.simple-list span, .assignment-row span { display: block; margin-top: 3px; color: var(--muted); font-size: var(--t1); }
.assignment-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.2fr); gap: 20px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 13px; margin-bottom: 8px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0; }
.inline-action-form { display: inline; margin: 0; }
.customer-status-form { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface2); }
.customer-status-form p { max-width: 760px; margin: 4px 0 0; color: var(--muted); font-size: var(--t2); }
.device-list { display: grid; gap: 12px; }
.device-row { padding: 18px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface2); }
.device-row h3 { margin: 0 0 4px; font: 600 15px var(--head); }
.device-row > .device-heading p { margin: 0; color: var(--muted); font-size: var(--t2); }
.device-heading { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 320px); gap: 24px; align-items: start; }
.device-due-dates { padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; }
.device-due-dates strong { font-size: var(--t3); }
.asset-facts { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 0; }
.asset-facts div { min-width: 120px; }
.asset-notes { margin-top: 14px; color: var(--muted); font-size: var(--t2); }
.asset-notes summary, .filter-history > summary, .manual-confirmation summary, .planning-editor > summary { cursor: pointer; color: var(--aqua2); font-weight: 700; font-size: var(--t2); }
.asset-notes p { margin: 8px 0 0; white-space: pre-wrap; }
.device-partner-editor, .filter-section-heading, .filter-history { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.device-partner-editor > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: var(--t1); font-weight: 700; }
.filter-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--t3); }
.filter-history > summary span { margin-left: 6px; color: var(--muted); font-weight: 600; }
.filter-history .data-panel { margin-top: 12px; box-shadow: none; border-radius: 13px; overflow: hidden; }
.installed-filter-list { display: grid; gap: 8px; margin-top: 12px; }
.installed-filter { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(340px, 1.25fr); gap: 18px; align-items: end; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.installed-filter-main { display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: baseline; }
.installed-filter-main strong { flex-basis: 100%; font-size: var(--t3); }
.installed-filter-main span { color: var(--muted); font-size: var(--t1); }
.installed-filter-invalid { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); background: var(--badbg); }
.invalid-date-warning { display: grid; gap: 3px; color: var(--bad); font-size: var(--t1); }
.filter-action-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 8px; align-items: end; margin: 0; }
.filter-action-form label { display: grid; gap: 5px; color: var(--muted); font-size: var(--t1); font-weight: 700; }
[data-standard-filter-options] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.standard-filter-option { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface2); }
.entity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.entity-card { display: block; padding: 18px; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow2); text-decoration: none; transition: .18s; }
.entity-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.entity-card h2 { margin: 12px 0 4px; font: 600 15px var(--head); }
.entity-card > p { color: var(--muted); font-size: var(--t2); margin: 0; }
.card-topline { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: var(--t1); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.status-dot.active { background: var(--ok); }
.compact-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.compact-facts div { padding: 8px; background: var(--surface2); border-radius: 9px; }
.inactive-customer-section { margin-top: 16px; }
.inactive-customer-section > summary { display: flex; align-items: center; gap: 10px; width: fit-content; color: var(--bad); cursor: pointer; font: 600 14px var(--head); padding: 6px 0; }
.inactive-customer-section > summary strong { min-width: 26px; padding: 3px 8px; border-radius: 999px; background: var(--badbg); text-align: center; font-size: var(--t1); }
.inactive-customer-section .tablecard { margin-top: 10px; }
.summary-count, .device-count { color: var(--muted); font-size: var(--t2); white-space: nowrap; }

/* ---------- Servicevorgang im Detail ---------- */
.case-table td { vertical-align: top; min-width: 120px; }
.case-table td:nth-child(2) { min-width: 190px; }
.case-table td:nth-child(6) { min-width: 170px; }
.case-link { display: block; width: fit-content; color: var(--aqua2); font-weight: 700; text-decoration: none; }
.case-link:hover { text-decoration: underline; }
.case-customer-link { display: inline-block; color: var(--text); font-size: var(--t4); font-weight: 700; text-decoration: none; }
.case-customer-link:hover { color: var(--aqua2); }
.case-row .status-badge { margin-top: 5px; }
.case-row td > .status-badge:first-child { margin-top: 0; }
.filter-summary { display: grid; gap: 3px; margin-top: 5px; color: var(--muted); font-size: var(--t1); }
.next-action { display: block; font-size: var(--t2); }
.case-reason { display: inline-block; padding: 4px 7px; border-radius: 7px; background: var(--surface2); color: var(--muted); font-size: var(--t1); font-weight: 700; box-shadow: inset 0 0 0 1px var(--border); }
.case-reason-request { background: var(--infobg); color: var(--info); box-shadow: none; }
.compact-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.compact-actions .button, .case-table .button { min-height: 32px; padding: 0 10px; font-size: var(--t1); border-radius: 8px; }
.inline-button { margin-top: 9px; }
.workflow-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 4px 0 18px; padding: 0; list-style: none; }
.workflow-steps li { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: start; min-width: 0; padding-right: 14px; color: var(--muted); }
.workflow-steps li::after { content: ""; position: absolute; top: 14px; left: 30px; right: 0; height: 2px; background: var(--border); }
.workflow-steps li:last-child::after { display: none; }
.workflow-steps li > span { position: relative; z-index: 1; width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid var(--border); border-radius: 50%; background: var(--surface); font-size: var(--t1); font-weight: 800; }
.workflow-steps li div { min-width: 0; background: var(--surface); position: relative; z-index: 1; padding-right: 6px; width: fit-content; max-width: 100%; }
.workflow-steps li strong, .workflow-steps li small { display: block; }
.workflow-steps li strong { color: var(--text); font-size: var(--t2); }
.workflow-steps li small { margin-top: 3px; font-size: 10px; line-height: 1.35; }
.workflow-steps li.done > span { border-color: var(--aqua); background: var(--aqua); color: #073044; }
.workflow-steps li.done::after { background: var(--aqua); }
.workflow-steps li.current > span { border-color: var(--warn); color: var(--warn); }
.selected-status { display: grid; grid-template-columns: 1fr 1fr auto; gap: 18px; align-items: center; margin-bottom: 14px; padding: 15px 17px; border-radius: 13px; background: var(--warnbg); box-shadow: inset 4px 0 0 var(--warn); }
.selected-status > div { display: grid; gap: 3px; }
.selected-status span { color: var(--muted); font-size: var(--t1); font-weight: 700; }
.selected-status strong { font-size: var(--t4); }
.selected-status.status-panel-confirmed { background: var(--okbg); box-shadow: inset 4px 0 0 var(--ok); }
.selected-status.status-panel-confirmation-pending, .selected-status.status-panel-customer-response-pending { background: var(--infobg); box-shadow: inset 4px 0 0 var(--info); }
.selected-status.status-panel-appointment-declined, .selected-status.status-panel-customer-declined { background: var(--badbg); box-shadow: inset 4px 0 0 var(--bad); }
.planning-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); border: 1px solid var(--border); border-radius: 15px; overflow: hidden; }
.planning-context, .planning-form { padding: 20px; min-width: 0; }
.planning-form { border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; background: var(--surface2); }
.planning-form label { color: var(--muted); font-size: var(--t1); font-weight: 700; }
.planning-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.planning-title-row h3 { margin: 0 0 3px; font: 600 16px var(--head); }
.planning-editor-fields { display: grid; gap: 8px; margin-top: 14px; }
.case-filter-list { border-top: 1px solid var(--border); padding-top: 14px; }
.case-filter-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--t3); }
.case-filter-list > div:last-child { border-bottom: 0; }
.case-filter-list small, .facts-list .record-id { display: block; margin-top: 3px; }
.device-partner-suggestion { margin-top: 4px; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--t2); }
.planning-note { margin: 5px 0; padding: 10px 12px; border-radius: 10px; background: var(--warnbg); color: var(--warn); font-size: var(--t2); }
.planning-blocked { padding: 14px; border-radius: 12px; background: var(--badbg); color: var(--bad); font-size: var(--t3); }
.planning-blocked p { margin: 6px 0 0; }
.confirmation-panel { margin-top: 12px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.confirmation-panel h4 { margin: 0 0 12px; font: 600 14px var(--head); }
.confirmation-status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.confirmation-status-grid div { display: grid; gap: 2px; padding: 8px; background: var(--surface2); border-radius: 9px; }
.confirmation-status-grid span { color: var(--muted); font-size: 10px; }
.confirmation-status-grid strong { font-size: var(--t2); }
.manual-confirmation { margin-top: 12px; }
.link-panel { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-bottom: 12px; padding: 17px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow2); }
.link-panel label { display: grid; gap: 7px; color: var(--muted); font-size: var(--t1); font-weight: 700; }
.link-panel .compact-actions { margin-top: 0; }
.privacy-note { color: var(--muted); font-size: var(--t1); line-height: 1.5; }

/* ---------- Anmeldung und öffentliche Bestätigung ---------- */
.login-layout, .public-confirmation { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 18% 12%, rgba(25,182,195,.2), transparent 34rem), linear-gradient(135deg, #08283F, #114C66); }
.login-panel, .confirmation-card { width: min(100%, 420px); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 21px; box-shadow: 0 30px 90px rgba(3,20,30,.3); }
.confirmation-card { width: min(100%, 560px); }
.login-panel .brand-mark, .confirmation-card .brand-mark { margin-bottom: 22px; }
.login-panel h1, .confirmation-card h1 { margin: 0 0 8px; font: 600 26px/1.15 var(--head); letter-spacing: -.02em; }
.login-panel > p:not(.eyebrow):not(.alert), .confirmation-card > p:not(.eyebrow) { color: var(--muted); font-size: var(--t3); line-height: 1.5; }
.login-form { display: grid; gap: 8px; margin-top: 20px; }
.login-form label { margin-top: 7px; color: var(--muted); font-size: var(--t1); font-weight: 700; }
.login-form .button { margin-top: 14px; }
.login-panel .alert { margin: 14px 0 0; }
.confirmation-facts { margin: 20px 0; display: grid; gap: 8px; }
.confirmation-facts div { display: grid; grid-template-columns: 100px 1fr; gap: 12px; padding: 9px 11px; background: var(--surface2); border-radius: 10px; }
.confirmation-facts dd { margin: 0; font-weight: 700; font-size: var(--t3); }
.confirmation-card .stack-form { padding: 0; }
.confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

/* ---------- Anpassung an schmalere Fenster ---------- */
@media (max-width: 1280px) {
  :root { --side: 220px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .workgrid { grid-template-columns: 1.15fr 1fr; }
  .assistantcol { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .systemgrid, .entity-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .detail, .settingsnav { position: static; }
  .dashgrid { grid-template-columns: 1.4fr .85fr; }
}
@media (max-width: 980px) {
  :root { --side: 76px; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .brandcopy, .nav a > span:not(.badgecount), .navgroup, .systemstate, .usercopy, .navtag { display: none; }
  .nav a { justify-content: center; padding: 12px; }
  .badgecount { position: absolute; right: 3px; top: 2px; }
  .sidebar { padding-left: 9px; padding-right: 9px; }
  .user { flex-direction: column; padding-left: 0; padding-right: 0; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 18px; }
  .crumb { display: none; }
  main.workspace { padding: 20px 18px 56px; }
  .dashgrid, .twocol, .threecol, .mailgrid, .workgrid, .settingsgrid { grid-template-columns: 1fr; }
  .assistantcol { grid-template-columns: 1fr; }
  .pipeline, .taskboard { grid-template-columns: repeat(4, 255px); }
  .settingsnav { display: flex; overflow: auto; }
  .settingsnav a { white-space: nowrap; }
  .mail { grid-template-columns: 175px 1fr; }
  .planning-layout, .device-heading, .installed-filter, .assignment-row { grid-template-columns: 1fr; }
  .planning-form { border-left: 0; border-top: 1px solid var(--border); }
  .workflow-steps { grid-template-columns: 1fr; gap: 10px; }
  .workflow-steps li::after { display: none; }
  .selected-status { grid-template-columns: 1fr 1fr; }
  .pagehead, .page-header, .detail-hero { flex-direction: column; align-items: stretch; }
  .customer-hero-status { justify-items: start; }
  .tab-nav { flex-wrap: nowrap; overflow-x: auto; }
  .tab-nav a { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 640px) {
  :root { --side: 0px; }
  .sidebar { position: static; width: 100%; flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; overflow-x: auto; }
  .brand { padding: 0; }
  .brandmark { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
  .nav { display: flex; gap: 2px; }
  .nav a { padding: 9px; }
  .sidefoot { margin: 0 0 0 auto; padding: 0; }
  .user { border: 0; padding: 0; flex-direction: row; }
  .user .avatar { display: none; }
  .topbar { position: static; height: auto; padding: 10px 12px; grid-template-columns: 1fr; }
  .topactions { justify-content: flex-end; }
  main.workspace { padding: 16px 12px 70px; }
  .pagehead h1, .page-header h1, .detail-hero h1 { font-size: 23px; }
  .kpis, .systemgrid, .entity-grid, .metricrow, .metricrow.four, .quickgrid, .modalgrid, .facts-list, .form-grid, .inline-form, .filter-action-form, .moneylayout, .confirmation-actions, .confirmation-status-grid, .selected-status, .link-panel, [data-standard-filter-options] { grid-template-columns: 1fr; }
  .mail { grid-template-columns: 1fr; }
  .cardhead, .section-heading { flex-wrap: wrap; }
  .demobadge { right: 8px; bottom: 8px; font-size: 9px; }
  .templaterail { border-right: 0; border-bottom: 1px solid var(--border); }
  .formrow { grid-template-columns: 1fr; gap: 5px; }
  .listitem.agenda { grid-template-columns: 64px auto 1fr; }
  .listitem.agenda .status { grid-column: 3; }
  .customer-status-form, .filter-section-heading, .device-partner-suggestion { flex-direction: column; align-items: stretch; }
  dialog.form-dialog, dialog.modal { width: 100%; max-width: none; max-height: 100dvh; min-height: 100dvh; margin: 0; border-radius: 0; }
  .tab-nav, #notification.alert, .detail-section { top: 0; scroll-margin-top: 60px; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody { display: block; }
  .responsive-table tbody { display: grid; gap: 10px; padding: 10px; }
  .responsive-table tr { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
  .responsive-table td { display: grid; grid-template-columns: minmax(105px, .42fr) minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0 !important; padding: 0; border: 0; overflow-wrap: anywhere; text-align: left; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
  .responsive-table td.rowactions::before, .responsive-table td[colspan]::before { display: none; }
  .responsive-table td.rowactions { display: block; padding-top: 6px; border-top: 1px solid var(--border); }
  .table { min-width: 0; }
  .table.compact th { white-space: normal; }
  .table.compact th, .table.compact td { padding-left: 6px; padding-right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
