/* ==========================================================================
   appac – Design-System für den Klick-Dummy
   Marke: Teal #16A788 → Cyan #14A4BF (aus logo.png)
   Schriften: Outfit (Display), Inter (UI) – lokal eingebunden, kein Google-CDN
   ========================================================================== */

@font-face { font-family: 'Inter'; src: url('../fonts/inter-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('../fonts/outfit-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Marke */
  --brand: #0f9a82;
  --brand-2: #14a4bf;
  --brand-ink: #0a7463;          /* Marke als Text auf hell (AA) */
  --brand-soft: #e2f5f0;
  --brand-soft-2: #c9ece3;
  --brand-grad: linear-gradient(135deg, #16a788 0%, #14a4bf 100%);
  --brand-glow: 0 6px 20px -6px rgba(20, 164, 191, .55);

  /* Flächen */
  --bg: #f2f6f7;
  --surface: #ffffff;
  --surface-2: #f7fafa;
  --surface-3: #edf2f3;
  --border: #e0e8ea;
  --border-2: #cdd8db;
  --overlay: rgba(9, 22, 26, .45);

  /* Text */
  --text: #0f1f24;
  --text-2: #43565c;
  --text-3: #5b6f74;
  --text-4: #9fb0b4;

  /* Sidebar (immer dunkel) */
  --side-bg: #0c191d;
  --side-bg-2: #122328;
  --side-border: rgba(255,255,255,.07);
  --side-text: #b9c9cd;
  --side-muted: #7a9298;
  --side-hover: rgba(255,255,255,.055);
  --side-active: rgba(22,167,136,.18);

  /* Status (reserviert – nie als Serienfarbe) */
  --ok: #12805c;      --ok-soft: #e1f4ea;
  --warn: #a35f00;    --warn-soft: #fdf1d8;   --warn-mark: #eda100;
  --danger: #c93636;  --danger-soft: #fde7e7;
  --info: #2563c4;    --info-soft: #e5eefc;
  --violet: #5a48c9;  --violet-soft: #ece9fb;
  --neutral-soft: #edf2f3;

  /* Diagramm-Serien (validiert: dataviz validate_palette, light) */
  --s1: #0f9a82; --s2: #eb6834; --s3: #2a78d6; --s4: #eda100; --s5: #e87ba4; --s6: #6250d6;
  --grid: #e6ecee;

  --r-xs: 6px; --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(15,31,36,.05), 0 1px 1px rgba(15,31,36,.03);
  --sh-2: 0 4px 14px -4px rgba(15,31,36,.10), 0 2px 4px rgba(15,31,36,.04);
  --sh-3: 0 24px 60px -12px rgba(15,31,36,.28), 0 8px 20px -8px rgba(15,31,36,.12);
  --ring: 0 0 0 3px rgba(20,164,191,.25);
  --side-w: 264px;
  --top-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-ink: #3fd0b2; --brand-soft: rgba(22,167,136,.16); --brand-soft-2: rgba(22,167,136,.28);
    --bg: #0b1518; --surface: #111e22; --surface-2: #15252a; --surface-3: #1a2d32;
    --border: #213840; --border-2: #2b4750; --overlay: rgba(0,0,0,.6);
    --text: #e8f0f2; --text-2: #b4c5c9; --text-3: #839ba1; --text-4: #5a7279;
    --side-bg: #08110f; --side-bg-2: #0e1b1f;
    --ok: #4cc795; --ok-soft: rgba(76,199,149,.14);
    --warn: #f0b34a; --warn-soft: rgba(240,179,74,.14); --warn-mark: #c98500;
    --danger: #f07474; --danger-soft: rgba(240,116,116,.14);
    --info: #6ea3f0; --info-soft: rgba(110,163,240,.14);
    --violet: #a59bf0; --violet-soft: rgba(165,155,240,.15);
    --neutral-soft: #1a2d32;
    --s1: #18a589; --s2: #d95926; --s3: #3987e5; --s4: #c98500; --s5: #d55181; --s6: #9085e9;
    --grid: #1d3238;
    --sh-1: 0 1px 2px rgba(0,0,0,.3); --sh-2: 0 6px 18px -6px rgba(0,0,0,.5); --sh-3: 0 24px 60px -12px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-ink: #3fd0b2; --brand-soft: rgba(22,167,136,.16); --brand-soft-2: rgba(22,167,136,.28);
  --bg: #0b1518; --surface: #111e22; --surface-2: #15252a; --surface-3: #1a2d32;
  --border: #213840; --border-2: #2b4750; --overlay: rgba(0,0,0,.6);
  --text: #e8f0f2; --text-2: #b4c5c9; --text-3: #839ba1; --text-4: #5a7279;
  --side-bg: #08110f; --side-bg-2: #0e1b1f;
  --ok: #4cc795; --ok-soft: rgba(76,199,149,.14);
  --warn: #f0b34a; --warn-soft: rgba(240,179,74,.14); --warn-mark: #c98500;
  --danger: #f07474; --danger-soft: rgba(240,116,116,.14);
  --info: #6ea3f0; --info-soft: rgba(110,163,240,.14);
  --violet: #a59bf0; --violet-soft: rgba(165,155,240,.15);
  --neutral-soft: #1a2d32;
  --s1: #18a589; --s2: #d95926; --s3: #3987e5; --s4: #c98500; --s5: #d55181; --s6: #9085e9;
  --grid: #1d3238;
  --sh-1: 0 1px 2px rgba(0,0,0,.3); --sh-2: 0 6px 18px -6px rgba(0,0,0,.5); --sh-3: 0 24px 60px -12px rgba(0,0,0,.7);
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
svg.i-sm { width: 15px; height: 15px; }
svg.i-lg { width: 22px; height: 22px; }
svg.i-xl { width: 28px; height: 28px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
::selection { background: var(--brand-soft-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App-Layout ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; border-right: 1px solid var(--side-border); z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.side-brand .logo-word { font-family: var(--font-display); font-weight: 300; font-size: 26px; letter-spacing: .01em; color: #fff; line-height: 1; }
.side-brand .logo-tag { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); margin-top: 3px; }
.branch-switch {
  margin: 4px 12px 10px; display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  background: var(--side-bg-2); border: 1px solid var(--side-border); border-radius: var(--r-sm);
  color: #fff; text-align: left; width: calc(100% - 24px);
}
.branch-switch:hover { border-color: rgba(255,255,255,.16); }
.branch-switch .bs-label { font-size: 10px; color: var(--side-muted); text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-switch .bs-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-switch .bs-text { flex: 1; min-width: 0; }

.side-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: #24393f transparent; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); padding: 0 10px 6px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; margin: 1px 0;
  border-radius: var(--r-sm); color: var(--side-text); font-size: 13.5px; font-weight: 500; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.nav-item svg.i { width: 17px; height: 17px; opacity: .8; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; }
.nav-item.active svg.i { opacity: 1; color: #3fd0b2; }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-grad); }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: rgba(255,255,255,.08); color: #d7e3e6; font-variant-numeric: tabular-nums; }
.nav-badge.alert { background: rgba(240,116,116,.18); color: #ff9c9c; }
.nav-badge.brand { background: rgba(22,167,136,.25); color: #6fe3c9; }
.side-foot { padding: 12px; border-top: 1px solid var(--side-border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); width: 100%; text-align: left; color: #fff; }
.user-chip:hover { background: var(--side-hover); }
.user-chip .uc-name { font-size: 13px; font-weight: 600; }
.user-chip .uc-role { font-size: 11.5px; color: var(--side-muted); }

.main { min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border);
}
.icon-btn.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); min-width: 0; white-space: nowrap; }
.crumbs b { color: var(--text); font-weight: 600; }
.crumbs svg.i { width: 14px; height: 14px; }
.gsearch { position: relative; margin-left: auto; width: min(420px, 40vw); }
.gsearch input {
  width: 100%; height: 38px; padding: 0 64px 0 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); outline: none; font-size: 13.5px; transition: border-color .15s, box-shadow .15s;
}
.gsearch input:focus { border-color: var(--brand-2); box-shadow: var(--ring); }
.gsearch > svg.i { position: absolute; left: 12px; top: 10px; color: var(--text-3); }
.gsearch .kbd { position: absolute; right: 10px; top: 9px; }
.gsearch-results {
  position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-3); padding: 6px; max-height: 70vh; overflow: auto; display: none;
}
.gsearch-results.open { display: block; }
.gs-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 8px 10px 4px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.gs-item:hover, .gs-item.sel { background: var(--surface-3); }
.gs-item .gs-sub { font-size: 12px; color: var(--text-3); }
.top-actions { display: flex; align-items: center; gap: 6px; }

.view { padding: 26px 28px 60px; max-width: 1480px; width: 100%; margin: 0 auto; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ph-text { flex: 1; min-width: 240px; }
.page-head h1 { font-size: 28px; font-weight: 600; }
.page-head .ph-sub { color: var(--text-3); margin-top: 4px; font-size: 14px; }
.page-head .ph-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--brand-ink); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.page-head .ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }

/* ---------- Layout-Helfer ---------- */
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-9 { grid-column: span 9; } .span-12 { grid-column: 1 / -1; }
.row { display: flex; align-items: center; gap: 10px; }
.row-top { display: flex; align-items: flex-start; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.muted { color: var(--text-3); } .muted-2 { color: var(--text-2); }
.small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); } .text-danger { color: var(--danger); } .text-brand { color: var(--brand-ink); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.hidden { display: none !important; }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-head h3, .card-title { font-size: 15px; font-weight: 600; font-family: var(--font-display); }
.card-head .card-sub { font-size: 12.5px; color: var(--text-3); }
.card-head .ch-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 16px 18px 18px; }
.card-body.flush { padding: 8px 0 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.card.pad { padding: 18px; }
.card.hover { transition: box-shadow .2s, transform .2s, border-color .2s; cursor: pointer; }
.card.hover:hover { box-shadow: var(--sh-2); transform: translateY(-1px); border-color: var(--border-2); }
.card.brand { background: var(--brand-grad); color: #fff; border: 0; box-shadow: var(--brand-glow); }
.card.brand .muted { color: rgba(255,255,255,.8); }
.card.tint { background: var(--brand-soft); border-color: transparent; }

/* ---------- KPI-Kacheln ---------- */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.kpi-icon.warn { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.info { background: var(--info-soft); color: var(--info); }
.kpi-icon.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi-value { font-family: var(--font-ui); font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--text-3); background: var(--neutral-soft); }
.hero-num { font-size: 52px; font-weight: 650; letter-spacing: -.03em; line-height: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; font-size: 13.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn svg.i { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--brand-glow); }
.btn-primary:hover { filter: brightness(1.05) saturate(1.1); }
.btn-secondary { background: var(--surface); border-color: var(--border-2); color: var(--text); box-shadow: var(--sh-1); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-4); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-soft:hover { background: var(--brand-soft-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--text-2); position: relative; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .pip { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid > .field { grid-column: span 12; }
.form-grid > .field.span-6 { grid-column: span 6; } .form-grid > .field.span-4 { grid-column: span 4; }
.form-grid > .field.span-3 { grid-column: span 3; } .form-grid > .field.span-8 { grid-column: span 8; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface); outline: none; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f8287' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-2); box-shadow: var(--ring); }
.input-lg { height: 52px; font-size: 18px; border-radius: 14px; padding: 0 16px; }
.input-wrap { position: relative; }
.input-wrap > svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-wrap > .input { padding-left: 38px; }
.input-wrap > .input-lg { padding-left: 48px; }
.input-wrap > .input-lg + svg.i, .input-wrap.lg > svg.i { left: 16px; width: 22px; height: 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 99px; background: var(--border-2); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* ---------- Toolbar / Filter ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { width: auto; height: 36px; }
.toolbar .input-wrap { flex: 1; min-width: 220px; max-width: 420px; }
.toolbar .input-wrap .input { width: 100%; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--border-2); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer;
}
.chip:hover { border-color: var(--text-4); color: var(--text); }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .count { font-size: 11px; opacity: .7; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--text-2);
}
.badge svg.i { width: 13px; height: 13px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.outline { background: transparent; border: 1px solid var(--border-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-4); flex-shrink: 0; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn-mark); } .dot.danger { background: var(--danger); } .dot.info { background: var(--info); }
.dot.pulse { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; color: rgba(18,128,92,.4); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(18,128,92,.45); } 70% { box-shadow: 0 0 0 7px rgba(18,128,92,0); } 100% { box-shadow: 0 0 0 0 rgba(18,128,92,0); } }
.kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-family: var(--font-mono); color: var(--text-3); background: var(--surface-3); border: 1px solid var(--border); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.sel { background: var(--brand-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .t-title { font-weight: 600; color: var(--text); }
.table .t-sub { font-size: 12px; color: var(--text-3); }
.table .t-actions { text-align: right; white-space: nowrap; }
.table.compact td { padding: 8px 12px; }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 18px; }
.card > .table-wrap .table th:last-child, .card > .table-wrap .table td:last-child { padding-right: 18px; }
.card > .table-wrap:first-child .table th { border-top-left-radius: var(--r-lg); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-3); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.tab .count { font-size: 11px; background: var(--surface-3); padding: 0 6px; border-radius: 99px; color: var(--text-2); }
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 10px; gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }

/* ---------- Listen ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--surface-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.li-icon.ok { background: var(--ok-soft); color: var(--ok); } .li-icon.warn { background: var(--warn-soft); color: var(--warn); }
.li-icon.danger { background: var(--danger-soft); color: var(--danger); } .li-icon.info { background: var(--info-soft); color: var(--info); }
.li-icon.brand { background: var(--brand-soft); color: var(--brand-ink); } .li-icon.violet { background: var(--violet-soft); color: var(--violet); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { font-weight: 500; min-width: 0; }

/* ---------- Avatare & Cover ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #fff; flex-shrink: 0; letter-spacing: .02em; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }
.cover {
  position: relative; flex-shrink: 0; width: 44px; aspect-ratio: 2 / 3; border-radius: 4px 7px 7px 4px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; padding: 6%; color: #fff;
  box-shadow: inset 3px 0 0 rgba(0,0,0,.18), 0 2px 6px rgba(15,31,36,.18);
}
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,.18), transparent 40%); }
.cover .cv-t { font-family: var(--font-display); font-weight: 600; line-height: 1.05; font-size: 7px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.cover .cv-a { font-size: 5px; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.cover .cv-type { position: absolute; right: 5%; bottom: 5%; opacity: .55; }
.cover.sm { width: 34px; } .cover.sm .cv-t, .cover.sm .cv-a { display: none; }
.cover.md { width: 72px; } .cover.md .cv-t { font-size: 10px; } .cover.md .cv-a { font-size: 7px; }
.cover.lg { width: 140px; padding: 12px; } .cover.lg .cv-t { font-size: 17px; } .cover.lg .cv-a { font-size: 10px; }
.cover.xl { width: 180px; padding: 16px; } .cover.xl .cv-t { font-size: 21px; } .cover.xl .cv-a { font-size: 11px; }

/* ---------- Meter / Fortschritt ---------- */
.meter { height: 8px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.meter.warn { background: var(--warn-soft); } .meter.warn > span { background: var(--warn-mark); }
.meter.danger { background: var(--danger-soft); } .meter.danger > span { background: var(--danger); }
.meter.sm { height: 5px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-item.warn::before { border-color: var(--warn-mark); } .tl-item.danger::before { border-color: var(--danger); } .tl-item.muted::before { border-color: var(--text-4); }
.tl-time { font-size: 12px; color: var(--text-3); }
.tl-text { font-size: 13.5px; }

/* ---------- Leerzustand ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty .em-icon { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty h4 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.placeholder-page { max-width: 560px; margin: 60px auto; text-align: center; }

/* ---------- Callouts ---------- */
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--info-soft); color: var(--text); font-size: 13.5px; align-items: flex-start; }
.callout > svg.i { color: var(--info); margin-top: 1px; }
.callout.warn { background: var(--warn-soft); } .callout.warn > svg.i { color: var(--warn); }
.callout.danger { background: var(--danger-soft); } .callout.danger > svg.i { color: var(--danger); }
.callout.ok { background: var(--ok-soft); } .callout.ok > svg.i { color: var(--ok); }
.callout.brand { background: var(--brand-soft); } .callout.brand > svg.i { color: var(--brand-ink); }

/* ---------- Modal / Drawer / Toast ---------- */
.backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .2s cubic-bezier(.2,.9,.3,1.2); }
.modal.lg { width: min(820px, 100%); } .modal.sm { width: min(420px, 100%); } .modal.xl { width: min(1080px, 100%); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 0; }
.modal-head h2 { font-size: 19px; flex: 1; }
.modal-head .mh-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; font-family: var(--font-ui); font-weight: 400; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); }
.drawer-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 90; animation: fadeIn .15s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 95; box-shadow: var(--sh-3); display: flex; flex-direction: column; animation: slideIn .22s cubic-bezier(.2,.8,.2,1); }
.drawer.lg { width: min(760px, 100vw); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 18px; flex: 1; }
.drawer-body { flex: 1; overflow: auto; padding: 20px 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: #0f1f24; color: #fff;
  font-size: 13.5px; box-shadow: var(--sh-3); animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2); max-width: 420px;
}
.toast svg.i { color: #3fd0b2; }
.toast.warn svg.i { color: #f0b34a; } .toast.danger svg.i { color: #ff8a8a; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.popover { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh-3); padding: 6px; min-width: 220px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13.5px; width: 100%; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.active { color: var(--brand-ink); font-weight: 600; }

/* ---------- Diagramme ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart text.axis { fill: var(--text-3); font-size: 11px; font-family: var(--font-ui); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 7px 10px;
  border-radius: 8px; box-shadow: var(--sh-2); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 5; display: none;
}
.chart-tip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 2px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-wrap .legend { flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 64px; align-items: center; gap: 12px; font-size: 13px; padding: 5px 0; }
.hbar .hb-track { height: 10px; position: relative; }
.hbar .hb-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--s1); }
.hbar .hb-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* ---------- Kalender ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .cal-h { font-size: 11px; font-weight: 600; color: var(--text-3); text-align: center; padding: 4px 0; text-transform: uppercase; }
.cal .cal-d { aspect-ratio: 1.3; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12.5px; background: var(--surface-2); border: 1px solid transparent; cursor: pointer; font-variant-numeric: tabular-nums; }
.cal .cal-d:hover { border-color: var(--border-2); }
.cal .cal-d.open { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.cal .cal-d.closed { background: var(--danger-soft); color: var(--danger); }
.cal .cal-d.short { background: var(--warn-soft); color: var(--warn); }
.cal .cal-d.today { box-shadow: inset 0 0 0 2px var(--brand-2); }
.cal .cal-d.out { opacity: .3; }
.cal .cal-d small { font-size: 9.5px; font-weight: 500; }

/* ---------- Telefon-Mockup (Bürger-App) ---------- */
.phone { width: 320px; height: 660px; border-radius: 46px; padding: 12px; background: #0b1416; box-shadow: var(--sh-3), inset 0 0 0 2px #2a3a3f; flex-shrink: 0; position: relative; }
.phone::before { content: ''; position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 92px; height: 26px; border-radius: 20px; background: #000; z-index: 3; }
.phone-screen { width: 100%; height: 100%; border-radius: 36px; overflow: hidden; background: #f4f8f8; color: #0f1f24; position: relative; display: flex; flex-direction: column; font-size: 13px; color-scheme: light; }
.phone-status { height: 46px; flex-shrink: 0; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 26px 6px; font-size: 12px; font-weight: 600; }
.phone-body { flex: 1; overflow-y: auto; scrollbar-width: none; }
.phone-body::-webkit-scrollbar { display: none; }
.phone-tabbar { height: 64px; flex-shrink: 0; display: flex; justify-content: space-around; align-items: flex-start; padding-top: 8px; background: #fff; border-top: 1px solid #e4ecee; }
.phone-tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: #7b8e93; font-weight: 600; }
.phone-tabbar button.active { color: #0a7463; }

/* ---------- Scan-Feld (Theke) ---------- */
.scan-box { border: 2px dashed var(--border-2); border-radius: var(--r-lg); padding: 18px; background: var(--surface-2); }
.scan-box.active { border-color: var(--brand-2); background: var(--brand-soft); }
.big-stat { font-family: var(--font-ui); font-size: 22px; font-weight: 650; }

/* ---------- Schritte ---------- */
.steps { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); }
.step.done .n { background: var(--brand); color: #fff; } .step.active { color: var(--text); font-weight: 600; }
.step.active .n { background: var(--brand-grad); color: #fff; box-shadow: var(--brand-glow); }
.step-sep { width: 24px; height: 2px; background: var(--border); }

/* ---------- Demo-Hinweis ---------- */
.demo-badge { margin-right: 4px; }
.demo-ribbon { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; font-size: 12px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text-3); box-shadow: var(--sh-2); display: flex; gap: 8px; align-items: center; }

/* ---------- Responsive ---------- */
.side-scrim { display: none; }
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3, .span-4, .span-5, .span-7, .span-8, .span-9 { grid-column: span 12; }
  .g-12 > .span-6 { grid-column: span 12; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .25s ease; }
  .app.side-open .sidebar { transform: none; box-shadow: var(--sh-3); }
  .app.side-open .side-scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .view { padding: 20px 16px 70px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .crumbs { display: none; }
  .gsearch { width: auto; flex: 1; }
  .gsearch .kbd { display: none; }
}
@media (max-width: 600px) {
  .g-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .page-head h1 { font-size: 23px; }
  .form-grid > .field.span-6, .form-grid > .field.span-4, .form-grid > .field.span-3, .form-grid > .field.span-8 { grid-column: span 12; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .kpi-value { font-size: 23px; }
  .card-head { flex-wrap: wrap; }
  .card-head .ch-actions { margin-left: 0; max-width: 100%; flex-wrap: wrap; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .demo-ribbon, .demo-badge { display: none; }
  .phone { transform: scale(.9); transform-origin: top center; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
