/* ============================================================
   NovaCare Office — Designsystem
   Richtung: "Klinisch frisch" — Schmelzweiß, Petrol, NovaMint.
   Signatur: Kapsel-Motiv (Pipeline, Badges, Buttons).
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Marke */
  --mint-050: #EAF7F3;
  --mint-100: #D9F2EC;
  --mint-300: #7AD6C2;
  --mint-500: #0FA88E;
  --mint-600: #0B8A73;
  --mint-700: #0A6F5E;
  --petrol-900: #0C2325;
  --petrol-800: #10393C;
  --petrol-700: #14494D;
  --koralle-500: #E8604C;
  --koralle-600: #C74534;

  /* Fläche & Text (Light) */
  --bg: #F7FAFB;
  --surface: #FFFFFF;
  --surface-2: #F0F5F6;
  --surface-3: #E4ECEE;
  --line: #DDE7E9;
  --line-strong: #C3D2D5;
  --ink: #17272A;
  --ink-2: #45585C;
  --ink-3: #6E8287;
  --ink-invert: #F2F7F7;

  /* Status (reserviert — nie als Datenserie) */
  --ok: #22824A;
  --ok-bg: #E2F3E8;
  --warn: #A96A0A;
  --warn-bg: #FBEEDDA0;
  --bad: #C74534;
  --bad-bg: #FBE7E3;
  --info: #2F6DA8;
  --info-bg: #E3EEF8;
  --neutral-bg: #EAF0F1;

  /* Datenserien (validiert, feste Reihenfolge, nie rotieren) */
  --serie-1: #0B8A73;
  --serie-2: #3E6DC4;
  --serie-3: #B8791A;
  --serie-4: #9D64BC;
  --serie-5: #C9566B;
  --serie-6: #2287B8;

  /* Typografie */
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Geometrie */
  --radius: 10px;
  --radius-lg: 16px;
  --radius-capsule: 999px;
  --shadow-1: 0 1px 2px rgba(12, 35, 37, .05), 0 1px 6px rgba(12, 35, 37, .06);
  --shadow-2: 0 4px 14px rgba(12, 35, 37, .10), 0 2px 4px rgba(12, 35, 37, .06);
  --shadow-3: 0 16px 40px rgba(12, 35, 37, .18);

  --sidebar-w: 248px;
  --sidebar-w-slim: 68px;
  --topbar-h: 60px;

  --focus-ring: 0 0 0 3px rgba(15, 168, 142, .35);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0D191B;
  --surface: #122225;
  --surface-2: #172B2E;
  --surface-3: #1E3639;
  --line: #21393C;
  --line-strong: #2F4D51;
  --ink: #E4EEEE;
  --ink-2: #A9BEC0;
  --ink-3: #7D9497;
  --ink-invert: #10262A;

  --mint-050: #10312F;
  --mint-100: #123B37;

  --ok: #4CC07E;
  --ok-bg: #143526;
  --warn: #E0A63F;
  --warn-bg: #3A2D12;
  --bad: #F08A77;
  --bad-bg: #40201A;
  --info: #6FA7DC;
  --info-bg: #16304A;
  --neutral-bg: #1E3336;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .4);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- Reset & Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--mint-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
::selection { background: var(--mint-300); color: var(--petrol-900); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- App-Gerüst ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app.is-slim { grid-template-columns: var(--sidebar-w-slim) 1fr; }

/* Sidebar — dunkles Petrol, Markenanker */
.sidebar {
  background: linear-gradient(178deg, var(--petrol-900) 0%, var(--petrol-800) 100%);
  color: #BFD6D4;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--petrol-700) transparent;
}
.sidebar__brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.05rem 1.1rem .95rem;
  color: #fff;
}
.sidebar__logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 12px;
  background: radial-gradient(120% 120% at 20% 15%, var(--mint-300), var(--mint-600) 70%);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: #06302A;
}
.sidebar__title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: -.01em; white-space: nowrap; }
.sidebar__title small { display: block; font-family: var(--font-body); font-weight: 500; font-size: .68rem; color: #7FA8A3; letter-spacing: .14em; text-transform: uppercase; }

.nav { padding: .4rem .65rem 1rem; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav__group { margin: .9rem .5rem .3rem; font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #6E9691; white-space: nowrap; }
.nav__link {
  display: flex; align-items: center; gap: .7rem;
  padding: .52rem .75rem;
  border-radius: var(--radius-capsule);
  color: #BFD6D4; font-weight: 500; font-size: .875rem;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav__link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav__link.is-active { background: var(--mint-500); color: #04241F; font-weight: 600; }
.nav__link.is-active .nav__ico { color: #04241F; }
.nav__ico { width: 19px; height: 19px; flex: 0 0 19px; color: #8FB5B0; }
.nav__badge { margin-left: auto; background: rgba(255,255,255,.14); color: #E8F4F2; font-size: .7rem; font-weight: 600; padding: .05rem .5rem; border-radius: var(--radius-capsule); }
.nav__link.is-active .nav__badge { background: rgba(0,0,0,.18); color: #04241F; }

.sidebar__foot { padding: .8rem 1.1rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .75rem; color: #6E9691; white-space: nowrap; }

.app.is-slim .sidebar__title, .app.is-slim .nav__group, .app.is-slim .nav__badge,
.app.is-slim .nav__label, .app.is-slim .sidebar__foot { display: none; }
.app.is-slim .nav__link { justify-content: center; padding: .55rem; }
.app.is-slim .sidebar__brand { justify-content: center; padding-inline: .5rem; }

/* Topbar */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: .9rem;
  padding: 0 1.4rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar__burger { display: none; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: transparent; color: var(--ink-2); cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }

.searchbox {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: .55rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-capsule);
  padding: .42rem .95rem;
  color: var(--ink-3); font-size: .86rem;
  cursor: pointer;
}
.searchbox:hover { border-color: var(--line-strong); }
.searchbox svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--ink-3); }
.searchbox span:not(.sw) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchbox kbd {
  margin-left: auto; font-family: var(--font-mono); font-size: .68rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 5px;
  padding: .1rem .4rem; color: var(--ink-3);
}
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--mint-100); color: var(--mint-700);
  display: grid; place-items: center;
  font-weight: 700; font-size: .8rem; font-family: var(--font-display);
}
.topbar__username { font-size: .84rem; font-weight: 600; }
.topbar__userrole { font-size: .7rem; color: var(--ink-3); display: block; line-height: 1.1; }

/* Inhalt */
.content { padding: 1.5rem 1.6rem 3rem; max-width: 1600px; width: 100%; margin-inline: auto; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-bottom: 1.2rem; }
.pagehead__text { margin-right: auto; }
.pagehead h1 { margin: 0; }
.pagehead .sub { color: var(--ink-3); font-size: .84rem; margin-top: .15rem; }
.breadcrumb { font-size: .78rem; color: var(--ink-3); margin-bottom: .3rem; }
.breadcrumb a { color: var(--ink-3); }
.breadcrumb a:hover { color: var(--mint-600); }

/* ---------- Karten ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card__head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem .4rem; }
.card__head h2, .card__head h3 { margin: 0; margin-right: auto; }
.card__body { padding: 1rem 1.25rem 1.25rem; }
.card__body--flush { padding: 0; }
.card__foot { padding: .8rem 1.25rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--ink-2); }

/* ---------- Signatur: Kapsel-Pipeline ---------- */
.pipeline { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: .25rem 0; }
.pipeline__step {
  position: relative;
  flex: 1 1 0; min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: .8rem 1.1rem .75rem 1.5rem;
  display: flex; flex-direction: column; gap: .1rem;
  transition: border-color .15s, box-shadow .15s;
}
.pipeline__step:first-child { border-radius: var(--radius-capsule) 0 0 var(--radius-capsule); padding-left: 1.4rem; }
.pipeline__step:last-child { border-radius: 0 var(--radius-capsule) var(--radius-capsule) 0; }
.pipeline__step + .pipeline__step { border-left: none; }
.pipeline__step::after {
  content: ""; position: absolute; top: 50%; right: -9px; z-index: 2;
  width: 16px; height: 16px;
  background: inherit;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
}
.pipeline__step:last-child::after { display: none; }
a.pipeline__step:hover { text-decoration: none; border-color: var(--mint-500); box-shadow: var(--shadow-1); z-index: 3; }
.pipeline__label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pipeline__value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.pipeline__meta { font-size: .75rem; color: var(--ink-3); }
.pipeline__step.is-alert .pipeline__value { color: var(--bad); }

/* Stepper (Belegkette auf Detailseiten) */
.docsteps { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.docstep {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--line); border-radius: var(--radius-capsule);
  padding: .3rem .85rem; font-size: .8rem; font-weight: 600; color: var(--ink-3);
  background: var(--surface);
}
.docstep.is-done { color: var(--mint-700); border-color: var(--mint-300); background: var(--mint-050); }
.docstep.is-current { color: #fff; background: var(--petrol-800); border-color: var(--petrol-800); }
[data-theme="dark"] .docstep.is-current { background: var(--mint-500); color: #04241F; border-color: var(--mint-500); }
.docsteps__link { color: var(--ink-3); }
a.docstep:hover { text-decoration: none; border-color: var(--mint-500); }

/* ---------- KPI-Kacheln ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: .95rem 1.15rem; box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: .15rem; min-width: 0;
}
.kpi__label { font-size: .74rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: .4rem; }
.kpi__value { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi__delta { font-size: .78rem; font-weight: 600; display: inline-flex; align-items: center; gap: .25rem; }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--bad); }
.kpi__delta .ctx { color: var(--ink-3); font-weight: 500; }

/* ---------- Badges (Kapsel-Status) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .68rem;
  border-radius: var(--radius-capsule);
  font-size: .74rem; font-weight: 600; line-height: 1.45;
  background: var(--neutral-bg); color: var(--ink-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--mint { background: var(--mint-100); color: var(--mint-700); }
.badge--plain::before { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-capsule);
  padding: .5rem 1.15rem;
  font-family: var(--font-body); font-size: .85rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  background: var(--mint-600); color: #fff;
}
.btn:hover { background: var(--mint-700); text-decoration: none; color: #fff; }
.btn svg { width: 16px; height: 16px; }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
.btn--ghost { background: transparent; color: var(--mint-700); }
.btn--ghost:hover { background: var(--mint-050); color: var(--mint-700); }
[data-theme="dark"] .btn--ghost { color: var(--mint-300); }
.btn--danger { background: var(--koralle-600); }
.btn--danger:hover { background: #A33628; }
.btn--sm { padding: .32rem .8rem; font-size: .78rem; }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }

/* ---------- Tabellen ---------- */
.tablewrap { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
table.data { width: 100%; border-collapse: collapse; font-size: .855rem; }
table.data th {
  text-align: left; font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); padding: .6rem .9rem;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.data td { padding: .62rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--mint-050) 55%, transparent); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num { text-align: right; }
table.data .docnr { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; }
table.data a.rowlink { color: var(--ink); font-weight: 600; }
table.data a.rowlink:hover { color: var(--mint-600); }
table.data .actions { text-align: right; white-space: nowrap; }
table.data .actions .iconbtn { width: 30px; height: 30px; }
tr.is-clickable { cursor: pointer; }

/* Listen-Toolbar */
.listbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.listbar .searchinput { flex: 1 1 220px; max-width: 340px; }
.listbar__count { font-size: .78rem; color: var(--ink-3); margin-left: auto; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .95rem; min-width: 0; }
.field label { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .74rem; color: var(--ink-3); }
.field .error { font-size: .76rem; color: var(--bad); font-weight: 500; }
.input, .select, .textarea {
  font-family: var(--font-body); font-size: .875rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: .5rem .75rem;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--mint-500); box-shadow: var(--focus-ring); }
.input.is-invalid { border-color: var(--bad); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236E8287' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.1rem; }
.formgrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 1.1rem; }
.formgrid > * { grid-column: span 12; }
@media (min-width: 720px) {
  .formgrid .col-6 { grid-column: span 6; }
  .formgrid .col-4 { grid-column: span 4; }
  .formgrid .col-3 { grid-column: span 3; }
  .formgrid .col-8 { grid-column: span 8; }
}
.checkbox { display: inline-flex; gap: .5rem; align-items: center; font-size: .85rem; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--mint-600); }
.searchinput { position: relative; }
.searchinput .input { padding-left: 2.1rem; border-radius: var(--radius-capsule); }
.searchinput svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tab {
  padding: .55rem .95rem; font-size: .84rem; font-weight: 600; color: var(--ink-3);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--mint-700); border-bottom-color: var(--mint-500); }
[data-theme="dark"] .tab.is-active { color: var(--mint-300); }

/* ---------- Dropdown ---------- */
.menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 190px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: .35rem; z-index: 50;
}
.menu a, .menu button {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .48rem .65rem; border: none; background: none;
  font-size: .84rem; color: var(--ink); border-radius: 7px; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .danger { color: var(--bad); }
.menu hr { border: none; border-top: 1px solid var(--line); margin: .3rem 0; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7, 24, 26, .55);
  display: grid; place-items: center; z-index: 90; padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
}
.modal__head { display: flex; align-items: center; padding: 1.1rem 1.3rem .6rem; }
.modal__head h3 { margin: 0; margin-right: auto; font-size: 1.02rem; }
.modal__body { padding: .5rem 1.3rem 1.2rem; }
.modal__foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.3rem; border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: .55rem; z-index: 100; }
.toast {
  background: var(--petrol-900); color: #E8F4F2;
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: .7rem 1rem; font-size: .84rem; font-weight: 500;
  display: flex; align-items: center; gap: .6rem;
  max-width: 380px;
  animation: toast-in .25s ease;
}
.toast--ok { border-left: 4px solid var(--mint-500); }
.toast--bad { border-left: 4px solid var(--koralle-500); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Command-Palette ---------- */
.palette-backdrop { position: fixed; inset: 0; background: rgba(7,24,26,.45); z-index: 95; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 1rem 0; backdrop-filter: blur(2px); }
.palette { width: 100%; max-width: 620px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden; }
.palette__input { display: flex; align-items: center; gap: .7rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--line); }
.palette__input input { flex: 1; border: none; background: none; font-size: 1rem; color: var(--ink); font-family: var(--font-body); }
.palette__input input:focus { outline: none; box-shadow: none; }
.palette__results { max-height: 46vh; overflow-y: auto; padding: .4rem; }
.palette__group { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); padding: .55rem .8rem .25rem; }
.palette__item { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 8px; color: var(--ink); font-size: .88rem; }
.palette__item:hover, .palette__item.is-active { background: var(--mint-050); text-decoration: none; }
[data-theme="dark"] .palette__item:hover, [data-theme="dark"] .palette__item.is-active { background: var(--surface-2); }
.palette__item .mono { color: var(--ink-3); font-size: .74rem; margin-left: auto; }
.palette__empty { padding: 1.4rem; text-align: center; color: var(--ink-3); font-size: .86rem; }
.palette__input svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ink-3); }
/* Sicherheitsnetz: bare Inline-Icons (nicht in Buttons) bekommen eine sinnvolle Größe */
p svg, .small svg, .muted svg, .deflist dd svg { width: 15px; height: 15px; vertical-align: -2px; }
.card__body > svg, .card__head > svg, .row > svg, .field > svg { width: 18px; height: 18px; flex: 0 0 18px; }
.badge svg { width: 12px; height: 12px; }
/* bare Icons in Links (Buttons/Iconbtns überschreiben dies dank höherer Spezifität) */
a svg { width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Sonstiges ---------- */
.grid { display: grid; gap: 1rem; }
@media (min-width: 1100px) {
  .grid--2 { grid-template-columns: 1fr 1fr; }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--sidebar { grid-template-columns: 2fr 1fr; }
  .grid--8-4 { grid-template-columns: 8fr 4fr; }
}
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: .8rem; }
.strong { font-weight: 600; }
.mint { color: var(--mint-600); }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: .5rem; } .mb-1 { margin-bottom: .5rem; }
.mt-2 { margin-top: 1rem; } .mb-2 { margin-bottom: 1rem; }

.empty { text-align: center; padding: 2.6rem 1rem; color: var(--ink-3); }
.empty svg { width: 42px; height: 42px; margin: 0 auto .6rem; color: var(--line-strong); }
.empty .btn { margin-top: .9rem; }

.deflist { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; font-size: .86rem; margin: 0; }
.deflist dt { color: var(--ink-3); font-weight: 500; }
.deflist dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.pagination { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; padding: .8rem 1.25rem; }
.pagination a, .pagination span.cur {
  min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 .5rem; border-radius: var(--radius-capsule); font-size: .8rem; font-weight: 600;
  color: var(--ink-2);
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination span.cur { background: var(--petrol-800); color: #fff; }
[data-theme="dark"] .pagination span.cur { background: var(--mint-500); color: #04241F; }
.pagination .dots { color: var(--ink-3); }

/* Timeline (History) */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.timeline li { position: relative; padding: 0 0 1.05rem 2rem; }
.timeline li::before {
  content: ""; position: absolute; left: 3px; top: 5px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--mint-500);
}
.timeline .t-when { font-size: .72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.timeline .t-what { font-size: .86rem; }

/* Chart-Container */
.chartbox { position: relative; width: 100%; }
.chartbox--tall { height: 320px; }
.chartbox--mid { height: 250px; }
.chartbox--donut { height: 220px; }
.chartbox canvas { position: absolute; inset: 0; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .78rem; color: var(--ink-2); margin-top: .6rem; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

/* Login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(60rem 40rem at 110% -10%, rgba(15,168,142,.16), transparent 60%),
    radial-gradient(50rem 36rem at -20% 110%, rgba(20,73,77,.22), transparent 60%),
    var(--bg);
  padding: 1.2rem;
}
.login-card { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.4rem; justify-content: center; }
.login-brand .sidebar__logo { width: 46px; height: 46px; border-radius: 15px; font-size: 1.35rem; }

/* Druck */
@media print {
  .sidebar, .topbar, .listbar, .pagination, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; }
  body { background: #fff; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .app, .app.is-slim { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(82vw, 300px);
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-3);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; background: rgba(7,24,26,.5); z-index: 39; }
  .topbar__burger { display: inline-flex; }
  .content { padding: 1rem .9rem 2.4rem; }
  .topbar { padding: 0 .9rem; }
  .topbar__username, .topbar__userrole { display: none; }
  .pipeline { scroll-snap-type: x mandatory; }
  .pipeline__step { scroll-snap-align: start; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi__value { font-size: 1.35rem; }
  .pagehead { flex-direction: column; align-items: flex-start; }
  .pagehead .row { width: 100%; }
}

@media (max-width: 1023px) { .hide-mobile { display: none !important; } }
[x-cloak] { display: none !important; }

/* ---------- Sortierbare Tabellenköpfe ---------- */
th.th-sort { padding: 0; }
th.th-sort > a {
  display: flex; align-items: center; gap: .3rem;
  padding: .6rem .9rem; color: var(--ink-3);
  font: inherit; text-transform: inherit; letter-spacing: inherit;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color .12s, background .12s;
}
th.th-sort > a:hover { color: var(--ink); background: color-mix(in srgb, var(--mint-050) 60%, transparent); text-decoration: none; }
th.th-sort.is-active > a { color: var(--mint-700); }
[data-theme="dark"] th.th-sort.is-active > a { color: var(--mint-300); }
th.th-sort.num > a { justify-content: flex-end; }
.th-arrow { font-size: .82em; line-height: 1; opacity: .9; min-width: .7em; display: inline-block; }
th.th-sort:not(.is-active) > a:hover .th-arrow::after { content: '↕'; opacity: .45; }
