/* =========================================================================
   WebDevCore — Operator-Dashboard
   Marius May · Software & Webentwicklung

   Das EINZIGE Stylesheet der App. lib.php::page_head() bindet es ein, alle
   Seiten bauen darauf auf. Kein zweites Designsystem danebenstellen.

   Aufbau
     1  Schrift
     2  Tokens  (Farbe, Abstand, Typo, Radius, Schatten, Z-Index, Animation)
     3  Basis / Reset
     4  App-Gerüst  (Sidebar, Kopfleiste, Inhalt)
     5  Seitenkopf  (Breadcrumb, Titel, Aktion)
     6  Buttons
     7  Formulare
     8  Badges, Chips, Rollen
     9  Karten, Statistik-Karten
    10  Tabellen
    11  Segmente, Listen-Schienen, Split-Layout
    12  Leerzustand, Blättern, Skeleton
    13  Menüs, Dialoge, Schublade, Toast
    14  Hilfsklassen
    15  Login
    16  Bewegung, Druck, Umbrüche

   Alle Farben liegen als Token in :root. Die alten Variablennamen
   (--bg, --surface, --ink, --muted …) leben als Alias weiter, damit die
   seiteneigenen <style>-Blöcke der 32 Seiten unverändert funktionieren.
   ========================================================================= */

/* == 1  Schrift ========================================================== */
/* Selbst gehostet, keine externen Requests (DSGVO). Variabler Schnitt:
   eine Datei (48 kB) für alle Gewichte 100–900. */
@font-face {
  font-family: "InterVar";
  src: url("fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* == 2  Tokens =========================================================== */
/* Farbe, Typografie, Abstand, Radius, Schatten und Bewegung kommen aus dem
   Designsystem „Marius May“ bei claude.ai/design. Ändern heißt: dort ändern,
   dann /design-pull und npm run design:apply. */
:root {
/* == DS-BEGIN — generiert aus design/tokens, nicht von Hand ändern == */
  --brand: #0454fc;
  --brand-hover: #0346db;
  --brand-light: #EAF0FF;
  --brand-soft: #F3F7FF;
  --brand-navy: #0b1b3a;
  --text-on-brand: #FFFFFF;
  --app-bg: #F5F7FB;
  --card-bg: #FFFFFF;
  --subtle-bg: #F8FAFF;
  --head-bg: #F5F8FD;
  --hover-bg: #F1F5FB;
  --track-bg: #E7ECF4;
  --backdrop: rgba(11, 27, 58, .38);
  --text: #101828;
  --text-2: #475467;
  --text-3: #667487;
  --text-faint: #7B8798;
  --border: #E4E9F1;
  --border-strong: #D0D7E2;
  --success: #12A66A;
  --success-bg: #EAFAF3;
  --success-ink: #0B6B45;
  --success-line: #C7EEDC;
  --warning: #D68A00;
  --warning-bg: #FFF7E3;
  --warning-ink: #7A4F00;
  --warning-line: #F0DDB2;
  --danger: #DC3545;
  --danger-bg: #FFF0F1;
  --danger-ink: #9F2530;
  --danger-line: #F6CDD2;
  --info: #2475F5;
  --info-bg: #EDF4FF;
  --info-ink: #1550B8;
  --info-line: #CFE0FC;
  --soft: rgba(4, 84, 252, .12);
  --t-hover: 140ms;
  --t-panel: 200ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 16px;
  --r-full: 999px;
  --sh-card: 0 1px 2px rgba(16,24,40,.03), 0 8px 24px rgba(16,24,40,.04);
  --sh-raised: 0 1px 2px rgba(16,24,40,.04), 0 12px 28px rgba(16,24,40,.07);
  --sh-pop: 0 6px 14px -4px rgba(16,24,40,.08), 0 22px 44px -12px rgba(16,24,40,.16);
  --sh-modal: 0 12px 28px -8px rgba(16,24,40,.14), 0 40px 80px -24px rgba(11,27,58,.28);
  --sh-focus: 0 0 0 3px rgba(4,84,252,.12);
  --sh-focus-danger: 0 0 0 3px rgba(220,53,69,.14);
  --sh-lip: inset 0 1px 0 rgba(255,255,255,.9);
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --font: "InterVar", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --fs-page: 27px;
  --lh-page: 1.22;
  --fw-page: 700;
  --fs-section: 19px;
  --lh-section: 1.3;
  --fw-section: 650;
  --fs-card: 16px;
  --lh-card: 1.35;
  --fw-card: 600;
  --fs-base: 14px;
  --lh-base: 1.55;
  --fs-sm: 13px;
  --fs-xs: 12px;
  --track-tight: -0.021em;
  --track-flat: -0.006em;
/* == DS-ENDE == */
}

/* == 2b  Handgeschrieben — vom Designsystem unberührt ==================== */
:root {
  /* Native Bedienelemente (Select-Liste, Datumswähler, Zahlen-Spinner,
     Scrollbalken) folgen dem Farbschema des Dokuments — ohne das bleiben sie
     dunkel und stechen aus der hellen Oberfläche heraus. */
  color-scheme: light;

  /* -- Aus der Marke abgeleitet --
     Hier standen feste Werte, die aus dem alten Blau #0152FD gerechnet waren
     (#003BBE, #C9DBFF, #D6E3FF, #DBE6FF, #E9EFF7). Beim Farbwechsel zogen sie
     nicht mit — das Versprechen „eine Stelle ändern, alle folgen" galt für den
     Token-Block, aber nicht für diese sieben Fundstellen. Als color-mix
     abgeleitet folgen sie jeder künftigen Markenfarbe von selbst; die
     Prozentsätze treffen die alten Werte auf 1–4 Einheiten genau. */
  --brand-active:      color-mix(in srgb, var(--brand) 75%, #000);
  --brand-line-strong: color-mix(in srgb, var(--brand) 21%, #fff);
  --brand-line:        color-mix(in srgb, var(--brand) 16%, #fff);
  --brand-line-soft:   color-mix(in srgb, var(--brand) 14%, #fff);
  --ghost-active:      color-mix(in srgb, var(--brand) 5%, var(--hover-bg));

  /* -- Z-Index -- */
  --z-base: 1; --z-sticky: 20; --z-appbar: 30; --z-sidebar: 40; --z-scrim: 50;
  --z-drawer: 60; --z-pop: 70; --z-modal: 80; --z-toast: 90;

  /* -- Maße -- */
  --sidebar-w:      248px;
  --sidebar-rail-w:  68px;
  --appbar-h:        56px;
  --content-max:   1600px;
  --pad-x:           32px;   /* Desktop; Tablet 24, Mobil 16 (s. Abschnitt 16) */
  --control-h:       40px;   /* Buttons */
  --field-h:         42px;   /* Eingaben */

  /* -- Rückwärtskompatibilität --------------------------------------------
     Diese Namen benutzen die seiteneigenen <style>-Blöcke von 32 Seiten.
     Nicht entfernen.

     Drei davon kehren ihre Bedeutung um: im dunklen Set waren --surface2,
     --line2 und --accent2 jeweils die HELLERE Stufe, hell müssen sie die
     KRÄFTIGERE sein. Sonst verschwinden Tabellenköpfe, Zeilen-Hover,
     Speicherleisten und sämtliche Aktivzustände gleichzeitig.

     --ok/--warn/--err zeigen auf die Schrift-Variante: der Bestand benutzt sie
     überwiegend als Textfarbe in 11–14 px. Wer die Volltöne für Balken oder
     Punkte braucht, nimmt --ok-fill/--warn-fill/--err-fill. */
  --bg:       var(--app-bg);
  --sidebar:  var(--card-bg);
  --surface:  var(--card-bg);
  --surface2: var(--hover-bg);
  --line:     var(--border);
  --line2:    var(--border-strong);
  --ink:      var(--text);
  --fg:       var(--text);          /* war undefiniert (kickoff.php, project.php) */
  --panel:    var(--card-bg);       /* war undefiniert (kickoff-v2.php)           */
  --muted:    var(--text-2);
  --accent:   var(--brand);
  --accent2:  var(--brand-hover);
  --accent-hover: var(--brand-hover);
  --ok:       var(--success-ink);   --ok-fill:   var(--success);  --ok-tint:   var(--success-bg);
  --warn:     var(--warning-ink);   --warn-fill: var(--warning);  --warn-tint: var(--warning-bg);
  --err:      var(--danger-ink);    --err-fill:  var(--danger);   --err-tint:  var(--danger-bg);
  --field-bg: var(--card-bg);
  --track:    var(--track-bg);
  --radius:   var(--r-lg);
  --shadow:   var(--sh-card);
  --shadow-modal: var(--sh-modal);
}

/* == 3  Basis ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font: var(--fs-base) / var(--lh-base) var(--font);
  letter-spacing: var(--track-flat);
  font-variant-numeric: tabular-nums;
  /* Bewusst OHNE -webkit-font-smoothing:antialiased — das war eine Optimierung
     für den dunklen Grund. Auf Weiß dünnt es 13–14px-Text sichtbar aus. */
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

h1, h2, h3, h4 {
  margin: 0 0 var(--sp-4);
  letter-spacing: var(--track-tight);
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--fs-page);    line-height: var(--lh-page);    font-weight: var(--fw-page); }
h2 { font-size: var(--fs-section); line-height: var(--lh-section); font-weight: var(--fw-section); }
h3 { font-size: var(--fs-card);    line-height: var(--lh-card);    font-weight: var(--fw-card); }
h4 { font-size: var(--fs-base);    font-weight: 600; }

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: .92em; }
pre {
  background: var(--subtle-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  overflow: auto;
  color: var(--text-2);
}
code:not(pre code) {
  background: var(--subtle-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  color: var(--text-2);
}

::selection { background: var(--brand-light); color: var(--brand-navy); }

/* Ein einziger, überall gleicher Fokus-Ring. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Sprungmarke für Tastatur und Screenreader */
.skip {
  position: fixed; top: var(--sp-2); left: var(--sp-2);
  z-index: var(--z-toast);
  background: var(--card-bg); color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--r-md);
  padding: 10px 16px; font-weight: 600;
  box-shadow: var(--sh-pop);
  transform: translateY(-160%);
  transition: transform var(--t-panel) var(--ease-out);
}
.skip:focus { transform: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* == 4  App-Gerüst ======================================================= */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

/* -- 4.1  Sidebar -- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  z-index: var(--z-sidebar);
  transition: width var(--t-panel) var(--ease);
}

.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: var(--sp-1) var(--sp-2) var(--sp-4);
  color: var(--text);
  min-width: 0;
}
.sidebar .brand:hover { color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 9px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
  display: grid; place-items: center;
  overflow: hidden;
}
.brand-mark svg { width: 22px; height: 22px; display: block; }
.brand-txt { min-width: 0; line-height: 1.2; }
.brand-txt strong {
  display: block; font-size: 14.5px; font-weight: 650;
  letter-spacing: var(--track-tight); white-space: nowrap;
}
.brand-txt span {
  display: block; font-size: 11px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: .005em;
}

.sidebar nav {
  flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px;
  /* Scroll-Schatten: Mit 15 Einträgen passt die Navigation bei kleineren
     Fenstern nicht mehr vollständig hinein — ohne Hinweis übersieht man, dass
     unten noch etwas kommt. Die beiden `local`-Verläufe decken den Schatten ab,
     solange am jeweiligen Ende nichts abgeschnitten ist; die `scroll`-Verläufe
     bleiben stehen und werden dadurch nur sichtbar, wenn wirklich mehr da ist. */
  background:
    linear-gradient(var(--card-bg) 30%, rgba(255,255,255,0)) top    / 100% 22px no-repeat local,
    linear-gradient(rgba(255,255,255,0), var(--card-bg) 70%) bottom / 100% 22px no-repeat local,
    radial-gradient(farthest-side at 50% 0,   rgba(16,24,40,.10), rgba(16,24,40,0)) top    / 100% 7px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(16,24,40,.10), rgba(16,24,40,0)) bottom / 100% 7px no-repeat scroll;
}
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* Gruppenabstand: 16 statt 20 px. Mit 15 Einträgen in fünf Gruppen läuft die
   Navigation sonst über die Sidebar-Höhe hinaus und die letzten Einträge
   (Einstellungen, Designsystem) sind nur noch durch Scrollen erreichbar. Die
   Gruppen bleiben durch ihre Überschriften klar getrennt, dafür braucht es
   keine zusätzlichen 4 px. */
.navgroup + .navgroup { margin-top: var(--sp-4); }
/* Die erste Gruppe (Dashboard) trägt keine Überschrift. Ohne diesen kleineren
   Abstand stünde sie zu dicht unter der Wortmarke. */
.navgroup.nolabel { margin-bottom: var(--sp-2); }
.navgroup .lbl {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  padding: 0 10px var(--sp-2);
}

.navlink {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  /* 8 statt 9 px: siehe Gruppenabstand oben — 15 Einträge brauchen den Platz.
     Die Trefferfläche bleibt mit 37 px deutlich über den 24 px aus WCAG 2.5.8. */
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  margin: 1px 0;
  transition: background var(--t-hover) var(--ease),
              color var(--t-hover) var(--ease);
  white-space: nowrap;
}
.navlink:hover { background: var(--hover-bg); color: var(--text); }
.navlink svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .82; }

/* Externes Ziel (Designsystem bei claude.ai): kleiner Pfeil rechts, damit der
   Eintrag keinen Seitenwechsel innerhalb der App verspricht. Das zweite SVG im
   Link ist das Pfeilsymbol — das erste bleibt das Bereichs-Icon. */
.navlink.extern > svg:last-of-type { width: 13px; height: 13px; margin-left: auto; opacity: .45; }
.navlink.extern:hover > svg:last-of-type { opacity: .8; }
.navlink:hover svg { opacity: 1; }

.navlink.on {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}
.navlink.on svg { opacity: 1; }
/* Aktiv-Indikator: der Zweiklang der Bildmarke (Navy → Blau) als 3px-Kante. */
.navlink.on::before {
  content: "";
  position: absolute; left: calc(var(--sp-3) * -1);
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand-navy), var(--brand));
}

.navlink .n {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
  background: var(--subtle-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 0 7px; line-height: 17px;
}
.navlink.on .n { color: var(--brand); background: #fff; border-color: var(--brand-line); }

.sidebar-foot {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--r-md);
  min-width: 0;
}
.avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--brand-navy); color: #fff;
}
.avatar.blue { background: var(--brand); }
.avatar.soft {
  background: var(--brand-light); color: var(--brand);
  border: 1px solid var(--brand-line-soft);
}
.sidebar-user .who { min-width: 0; line-height: 1.25; }
.sidebar-user .who strong { display: block; font-size: 13px; font-weight: 600; }
.sidebar-user .who span { display: block; font-size: 11.5px; color: var(--text-3); }

.sidebar-foot form { margin: 0; }
.sidebar-foot .navlink { width: 100%; background: none; border: 0;
  cursor: pointer; font-family: inherit; text-align: left; }

/* Ein-/Ausklappen (Schienen-Modus) — Zustand liegt auf <html>. */
.collapse-btn {
  display: none;
  width: 100%; margin-top: 2px;
  align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; background: none;
  border-radius: var(--r-md);
  color: var(--text-3); font: inherit; font-size: 12.5px;
  cursor: pointer;
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.collapse-btn:hover { background: var(--hover-bg); color: var(--text); }
.collapse-btn svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform var(--t-panel) var(--ease); }
@media (min-width: 901px) { .collapse-btn { display: flex; } }

html.rail .sidebar { width: var(--sidebar-rail-w); padding-inline: 10px; }
html.rail .brand-txt,
html.rail .navgroup .lbl,
html.rail .navlink span,
html.rail .navlink .n,
html.rail .sidebar-user .who,
html.rail .collapse-btn span { display: none; }
html.rail .sidebar .brand { justify-content: center; padding-inline: 0; }
html.rail .navlink,
html.rail .collapse-btn { justify-content: center; padding-inline: 0; }
html.rail .navlink.on::before { left: -10px; }
html.rail .sidebar-user { justify-content: center; padding-inline: 0; }
html.rail .collapse-btn svg { transform: rotate(180deg); }
html.rail .navgroup + .navgroup {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

/* -- 4.2  Kopfleiste -- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.appbar {
  position: sticky; top: 0; z-index: var(--z-appbar);
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--appbar-h);
  padding: 0 var(--pad-x);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(4px)) { .appbar { background: #fff; } }

.burger {
  display: none;
  width: 36px; height: 36px; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-2); cursor: pointer;
  transition: background var(--t-hover) var(--ease);
}
.burger:hover { background: var(--hover-bg); color: var(--text); }
.burger svg { width: 20px; height: 20px; }

/* Breadcrumb */
.crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--text-3);
  min-width: 0; flex: 1;
}
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: var(--text-faint); flex-shrink: 0; }
.crumbs .here {
  color: var(--text); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumbs > :not(.here) { flex-shrink: 0; }

.appbar-tools { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

/* Globale Suche */
.gsearch { position: relative; width: 260px; }
.gsearch > svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}
.gsearch input {
  height: 36px; width: 100%;
  padding: 0 46px 0 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--subtle-bg);
  font: inherit; font-size: var(--fs-sm); color: var(--text);
  transition: background var(--t-hover) var(--ease),
              border-color var(--t-hover) var(--ease),
              box-shadow var(--t-hover) var(--ease);
}
.gsearch input::placeholder { color: var(--text-3); }
.gsearch input:focus {
  outline: none; background: #fff;
  border-color: var(--brand); box-shadow: var(--sh-focus);
}
.gsearch kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font); font-size: 11px; font-weight: 600;
  color: var(--text-3); background: #fff;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 6px;
  pointer-events: none;
}
.gsearch input:focus ~ kbd { opacity: 0; }

/* == 5  Seitenkopf ======================================================= */
main {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--pad-x) var(--sp-16);
  flex: 1;
}

.pagehead {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}
.pagehead .txt { flex: 1; min-width: 260px; }
.pagehead h1 { margin: 0; }
.pagehead .desc {
  margin: 6px 0 0;
  color: var(--text-2); font-size: var(--fs-sm);
  max-width: 74ch;
}
.pagehead .act { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.pagehead .count {
  display: inline-block; margin-left: 10px;
  vertical-align: 3px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-3);
  background: var(--subtle-bg); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 1px 10px;
  letter-spacing: 0;
}

/* Werkzeugzeile über Tabellen: Filter links, Werkzeuge rechts. */
.toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar .grow { flex: 1; }

/* == 6  Buttons ========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--control-h);
  padding: 0 16px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: var(--text-on-brand);
  border: 1px solid var(--brand);
  font: inherit; font-size: var(--fs-base); font-weight: 600;
  letter-spacing: var(--track-flat);
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-hover) var(--ease),
              border-color var(--t-hover) var(--ease),
              box-shadow var(--t-hover) var(--ease),
              color var(--t-hover) var(--ease);
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn:active { background: var(--brand-active); border-color: var(--brand-active); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn.ghost {
  background: var(--card-bg);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn.ghost:hover { background: var(--hover-bg); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:active { background: var(--ghost-active); }

.btn.quiet {
  background: transparent; border-color: transparent; color: var(--text-2);
}
.btn.quiet:hover { background: var(--hover-bg); color: var(--text); border-color: transparent; }

.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #C22C3B; border-color: #C22C3B; }
.btn.danger:focus-visible { outline-color: var(--danger); }
.btn.ghost.danger {
  background: var(--card-bg); color: var(--danger-ink); border-color: #F3C6CB;
}
.btn.ghost.danger:hover { background: var(--danger-bg); color: var(--danger-ink); }

.btn.sm { height: 32px; padding: 0 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn.sm svg { width: 15px; height: 15px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }

.btn[disabled], .btn:disabled, .btn.is-disabled {
  opacity: .5; pointer-events: none;
}

/* Reine Icon-Schaltfläche — braucht immer ein aria-label. */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.iconbtn:hover { background: var(--hover-bg); color: var(--text); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn.bordered { border-color: var(--border-strong); background: var(--card-bg); }
.iconbtn.sm { width: 30px; height: 30px; border-radius: var(--r-sm); }
.iconbtn.sm svg { width: 16px; height: 16px; }
.iconbtn.danger:hover { background: var(--danger-bg); color: var(--danger-ink); }

/* Zähler-Punkt an der Glocke */
.iconbtn .dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--danger);
  box-shadow: 0 0 0 2px #fff;
}
.iconbtn .dot.num {
  top: 2px; right: 1px;
  height: 16px; min-width: 16px; padding: 0 4px;
  font-size: 10px; font-weight: 700; line-height: 16px;
  color: #fff; text-align: center;
}

/* Button-Gruppe (verbundene Segmente) */
.btngroup { display: inline-flex; }
.btngroup > .btn { border-radius: 0; margin-left: -1px; }
.btngroup > .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.btngroup > .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btngroup > .btn:hover { z-index: 1; }

/* == 7  Formulare ======================================================== */
label { display: block; }

.field { margin-bottom: var(--sp-4); }
.field > label,
.flabel {
  display: block;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
.field .hint,
.fhint { font-size: var(--fs-xs); color: var(--text-3); margin-top: 5px; }
.field .err,
.ferr {
  display: flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); color: var(--danger-ink); margin-top: 5px; font-weight: 500;
}
.ferr svg { width: 14px; height: 14px; flex-shrink: 0; }

input, select, textarea {
  width: 100%;
  min-height: var(--field-h);
  padding: 9px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
  letter-spacing: var(--track-flat);
  transition: border-color var(--t-hover) var(--ease),
              box-shadow var(--t-hover) var(--ease),
              background var(--t-hover) var(--ease);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--text-3); }

input:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus) { border-color: #BCC7D8; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--sh-focus);
}
input[aria-invalid="true"], .is-error input, .is-error select, .is-error textarea {
  border-color: var(--danger);
}
input[aria-invalid="true"]:focus, .is-error input:focus {
  box-shadow: var(--sh-focus-danger);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--subtle-bg); color: var(--text-faint); cursor: not-allowed;
}
input[readonly] { background: var(--subtle-bg); }

select {
  appearance: none;
  padding-right: 36px;
  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='%23667487' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

input[type=checkbox], input[type=radio] {
  width: 17px; height: 17px; min-height: 0;
  padding: 0; margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: -3px;
}
input[type=file] { padding: 8px 10px; font-size: var(--fs-sm); }
input[type=color] { padding: 4px; height: var(--field-h); cursor: pointer; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

/* Suchfeld mit Lupe (Klassenname aus dem Bestand: .suche) */
.suche { position: relative; display: block; width: min(320px, 100%); }
.suche > svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}
.suche input { padding-left: 36px; }

/* Kontrollkästchen mit Beschriftung */
.check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); color: var(--text-2);
  cursor: pointer; user-select: none;
}
.check input { flex-shrink: 0; }

/* Feldraster */
.fgrid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fgrid .span2 { grid-column: 1 / -1; }
@media (max-width: 760px) { .fgrid, .fgrid.c3 { grid-template-columns: 1fr; } }

fieldset { border: 0; padding: 0; margin: 0 0 var(--sp-6); }
legend { padding: 0; font-size: var(--fs-section); font-weight: var(--fw-section);
  letter-spacing: var(--track-tight); margin-bottom: var(--sp-3); }

/* == 8  Badges, Chips, Rollen ============================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0;
}
/* Status wird nie allein über Farbe transportiert: jedes Badge trägt zusätzlich
   einen Punkt in eigener Form/Position plus seinen Text. */
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0; opacity: .75;
}
.badge.plain::before { display: none; }

.badge.ok, .badge.done, .badge.success, .badge.paid, .badge.live {
  background: var(--success-bg); color: var(--success-ink); border-color: #C7EEDC;
}
.badge.warn, .badge.warning, .badge.pending, .badge.draft {
  background: var(--warning-bg); color: var(--warning-ink); border-color: #F5E0B0;
}
.badge.err, .badge.error, .badge.danger, .badge.overdue {
  background: var(--danger-bg); color: var(--danger-ink); border-color: #F6CDD2;
}
.badge.info, .badge.running, .badge.deploying, .badge.requested, .badge.sent {
  background: var(--info-bg); color: var(--info-ink); border-color: #CFE0FC;
}
.badge.brand {
  background: var(--brand-light); color: var(--brand-hover); border-color: #D3E2FF;
}
.badge.muted, .badge.neutral, .badge.archived {
  background: var(--subtle-bg); color: var(--text-2); border-color: var(--border);
}
.badge.solid { background: var(--brand); color: #fff; border-color: var(--brand); }
.badge.solid::before { opacity: .85; }

/* Laufender Zustand bekommt zusätzlich einen Puls — Bewegung nur solange nötig. */
.badge.running::before, .badge.deploying::before { animation: puls 1.6s var(--ease) infinite; }
@keyframes puls { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* Rollen-/Merkmal-Pillen (Klassenname aus dem Bestand) */
.rolle, .tagpill {
  display: inline-block;
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
  background: var(--subtle-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 2px 9px; margin: 0 4px 3px 0;
  white-space: nowrap;
}

/* Filter-Chip (klickbar, umschaltbar) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  background: var(--card-bg);
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer;
  transition: background var(--t-hover) var(--ease),
              color var(--t-hover) var(--ease),
              border-color var(--t-hover) var(--ease);
}
.chip:hover { background: var(--hover-bg); color: var(--text); }
.chip.on, .chip[aria-pressed="true"] {
  background: var(--brand-light); color: var(--brand-hover);
  border-color: var(--brand-line-strong); font-weight: 600;
}
.chip .n { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.chip.on .n { color: var(--brand); }

/* Mehrfachauswahl-Chips (chips() aus lib.php) */
.chipset { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chipset label {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--card-bg);
  font-size: var(--fs-sm); color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease);
}
.chipset label:hover { background: var(--hover-bg); }
.chipset label:has(input:checked) {
  background: var(--brand-light); border-color: var(--brand-line-strong);
  color: var(--brand-hover); font-weight: 600;
}

/* Ein-/Ausschalter als Pille (Klassenname aus dem Bestand: .schalter) */
.schalter {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px;
  font-size: var(--fs-sm); color: var(--text-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: var(--card-bg);
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.schalter:hover { background: var(--hover-bg); color: var(--text); }
.schalter.an {
  background: var(--brand-light); color: var(--brand-hover);
  border-color: var(--brand-line-strong); font-weight: 600;
}

/* Warnhinweis-Pille (Klassenname aus dem Bestand: .mahnung) */
.mahnung {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px;
  font-size: var(--fs-sm); font-weight: 500;
  color: var(--warning-ink);
  background: var(--warning-bg);
  border: 1px solid #F0DDB2;
  border-radius: var(--r-full);
  cursor: help;
}
.mahnung svg { width: 15px; height: 15px; flex-shrink: 0; }

/* == 9  Karten =========================================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-card), var(--sh-lip);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.tight { padding: var(--sp-4); }

/* Statuskarten: getönte Fläche statt nur eines farbigen Randes. Ein 1px-Rand
   allein trägt auf Weiß zu wenig, um einen Zustand zu kommunizieren. */
.card.ok, .card.warn, .card.err, .card.info { box-shadow: none; }
.card.ok   { background: var(--success-bg); border-color: var(--success-line); color: var(--success-ink); }
.card.warn { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning-ink); }
.card.err  { background: var(--danger-bg);  border-color: var(--danger-line);  color: var(--danger-ink); }
.card.info { background: var(--info-bg);    border-color: var(--info-line);    color: var(--info-ink); }
.card.ok strong, .card.warn strong, .card.err strong, .card.info strong { color: inherit; }
.card.muted { background: var(--subtle-bg); box-shadow: none; }

/* Neutrale Bühne hinter Fremdgrafik: Logos, Assets, Belegfotos und
   PDF-Vorschauen sind fast immer weiß auf weiß. Ohne eigenen Grund
   verschwinden sie in der Karte. */
.media-backdrop {
  display: grid; place-items: center;
  padding: var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background-color: #EEF2F8;
  background-image:
    linear-gradient(45deg, rgba(16,24,40,.045) 25%, transparent 25% 75%, rgba(16,24,40,.045) 75%),
    linear-gradient(45deg, rgba(16,24,40,.045) 25%, transparent 25% 75%, rgba(16,24,40,.045) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.media-backdrop img, .media-backdrop object, .media-backdrop iframe {
  max-width: 100%; display: block;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 6px 18px rgba(16,24,40,.10);
}
.media-backdrop.plain { background-image: none; }

.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .act { margin-left: auto; display: flex; gap: var(--sp-2); }
.card-body { padding: var(--sp-5); }
.card-foot {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--subtle-bg);
  display: flex; align-items: center; gap: var(--sp-3);
}

/* Statistik-Karten */
.stats {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-bottom: var(--sp-5);
}
.stat {
  position: relative; overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--sh-card), var(--sh-lip);
  transition: box-shadow var(--t-hover) var(--ease),
              border-color var(--t-hover) var(--ease);
}
a.stat:hover, .stat.klick:hover { box-shadow: var(--sh-raised), var(--sh-lip); border-color: var(--border-strong); }
/* Diagonaler Anschnitt oben rechts — greift den Winkel der Bildmarke auf. */
.stat::after {
  content: "";
  position: absolute; top: 0; right: 0;
  width: 56px; height: 56px;
  background: linear-gradient(225deg, var(--brand-light) 0 52%, transparent 52%);
  opacity: .85;
  pointer-events: none;
}
.stat.ok::after     { background: linear-gradient(225deg, var(--success-bg) 0 52%, transparent 52%); }
.stat.warn::after   { background: linear-gradient(225deg, var(--warning-bg) 0 52%, transparent 52%); }
.stat.err::after    { background: linear-gradient(225deg, var(--danger-bg) 0 52%, transparent 52%); }
.stat.neutral::after{ background: linear-gradient(225deg, var(--subtle-bg) 0 52%, transparent 52%); }

.stat .lbl {
  display: block;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 6px;
  position: relative; z-index: 1;
}
.stat .val {
  display: block;
  font-size: 26px; font-weight: 700; line-height: 1.1;
  letter-spacing: var(--track-tight);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat .val.ok   { color: var(--success-ink); }
.stat .val.warn { color: var(--warning-ink); }
.stat .val.err  { color: var(--danger-ink); }
.stat .sub { display: block; margin-top: 5px; font-size: var(--fs-xs); color: var(--text-3); }
.stat .sub.link { color: var(--brand); font-weight: 600; }

/* == 10  Tabellen ========================================================
   border-collapse:separate + eigene Zellränder — so bleiben runde Ecken
   möglich, OHNE overflow:hidden (das würde den klebenden Kopf abschneiden). */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card), var(--sh-lip);
  font-size: var(--fs-base);
}

thead th {
  position: relative;
  text-align: left;
  padding: 11px 16px;
  background: var(--head-bg);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
thead th:first-child { border-top-left-radius: var(--r-lg); }
thead th:last-child  { border-top-right-radius: var(--r-lg); }

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
tbody tr:last-child td:last-child  { border-bottom-right-radius: var(--r-lg); }

tbody tr { transition: background var(--t-hover) var(--ease); }
tbody tr:hover { background: var(--subtle-bg); }
tbody tr.on, tbody tr[aria-selected="true"] { background: var(--brand-soft); }

/* Die Hauptangabe der Zeile dominiert — Links daneben treten zurück. */
tbody td strong, tbody td .haupt {
  color: var(--text); font-weight: 600; font-size: var(--fs-base);
}
tbody td a { color: var(--brand); }
/* Zurückgenommener Link: E-Mail-Adressen und Verweise dürfen den Namen der
   Zeile nicht überstrahlen. Höhere Spezifität als `tbody td a` — Buttons und
   Badges gewinnen weiterhin über ihre eigene Klasse. */
tbody td a.leise { color: var(--text-2); font-size: var(--fs-sm); }
tbody td a.leise:hover { color: var(--brand); text-decoration: underline; }
/* Zweitzeile unter der Hauptangabe (Klassenname aus dem Bestand: .unter) */
.unter, .zeile-sub {
  color: var(--text-3); font-size: var(--fs-xs);
  margin-top: 2px; line-height: 1.4;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap, th.nowrap { white-space: nowrap; }
td.tight, th.tight { width: 1%; white-space: nowrap; }
td.act { text-align: right; white-space: nowrap; }

/* Auswahlspalte */
td.pick, th.pick { width: 1%; padding-right: 0; }

/* Sortierbare Spaltenköpfe */
th.sortable { cursor: pointer; user-select: none; }
th.sortable > span { display: inline-flex; align-items: center; gap: 5px; }
th.sortable:hover { color: var(--text); background: #EFF3FA; }
th.sortable .arw { opacity: 0; transition: opacity var(--t-hover) var(--ease); }
th.sortable:hover .arw { opacity: .5; }
th[aria-sort] { color: var(--brand); }
th[aria-sort] .arw { opacity: 1; }
th[aria-sort="descending"] .arw { transform: rotate(180deg); }
th.sortable .arw svg { width: 13px; height: 13px; display: block; }

/* Klebender Kopf bei langen Listen */
.table-wrap { position: relative; }
.table-wrap.scroll { overflow-x: auto; border-radius: var(--r-lg); }
.table-wrap.scroll table { box-shadow: none; }
.sticky-head thead th {
  position: sticky; top: var(--appbar-h); z-index: var(--z-sticky);
  box-shadow: inset 0 -1px 0 var(--border);
  border-bottom-color: transparent;
}
/* Sicherheitsnetz: In einer Scroll-Huelle darf der Kopf NICHT kleben. `overflow-x`
   macht den Wrapper auch in y-Richtung zum Scroll-Container, sticky bezieht sich
   dann auf ihn statt auf den Viewport — der Kopf landet --appbar-h tief IN der
   Tabelle und verdeckt die erste Zeile (Projektliste ab 12 Zeilen, 2026-07-30).
   app.js setzt die Klassen bereits exklusiv; das hier haelt es auch dann korrekt,
   wenn eine Seite ihre Tabelle selbst mit .table-wrap.scroll ausliefert. */
.table-wrap.scroll table.sticky-head thead th { position: static; }

/* Kontextmenü-Knopf pro Zeile */
tbody tr .rowmenu { opacity: 0; transition: opacity var(--t-hover) var(--ease); }
tbody tr:hover .rowmenu,
tbody tr:focus-within .rowmenu,
.rowmenu[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { tbody tr .rowmenu { opacity: 1; } }

/* Fehlende Pflichtangabe in einer Zelle — dezentes Warn-Badge, kein Link-Gelb.
   (Klassenname aus dem Bestand: .fehlt) */
.fehlt {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-full);
  background: var(--warning-bg);
  border: 1px solid #F0DDB2;
  color: var(--warning-ink);
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.fehlt:hover { background: #FDF0D2; color: var(--warning-ink); }
.fehlt::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--warning); flex-shrink: 0;
}

/* == 11  Segmente, Schienen, Split ======================================= */
/* Segmentiertes Menü (Klassenname aus dem Bestand: .seg) */
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.seg a, .seg button {
  padding: 6px 13px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500;
  border: 0; background: none; cursor: pointer;
  font-family: inherit; line-height: 1.45; text-decoration: none;
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
  white-space: nowrap;
}
.seg a:hover, .seg button:hover { background: var(--hover-bg); color: var(--text); }
.seg a.on, .seg button.on {
  background: var(--brand-light); color: var(--brand-hover); font-weight: 600;
}

/* Vertikale Listen-Schiene (Klassenname aus dem Bestand: .vlist) */
.vlist { display: flex; flex-direction: column; gap: 2px; }
.vlist a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: 8px 11px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.vlist a:hover { background: var(--hover-bg); color: var(--text); }
.vlist a.on { background: var(--brand-light); color: var(--brand-hover); font-weight: 600; }
.vlist a .n {
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  background: var(--subtle-bg); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 0 8px; line-height: 18px;
  flex-shrink: 0;
}
.vlist a.on .n { color: var(--brand); background: #fff; border-color: var(--brand-line); }

/* Zweispalter: Schiene + Inhalt (Klassennamen aus dem Bestand) */
.split { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.rail { position: sticky; top: calc(var(--appbar-h) + var(--sp-4)); }
.rail .lbl {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  padding: 0 11px var(--sp-2);
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } .rail { position: static; } }

/* Reiter */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); }
.tabs a, .tabs button {
  position: relative;
  padding: 10px 14px; margin-bottom: -1px;
  border: 0; background: none; cursor: pointer; font-family: inherit;
  font-size: var(--fs-base); font-weight: 500; color: var(--text-2);
  border-bottom: 2px solid transparent;
  transition: color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease);
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.on, .tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* == 12  Leerzustand, Blättern, Skeleton ================================= */
.leer, .empty {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
}
.leer .ico, .empty .ico {
  width: 52px; height: 52px; margin: 0 auto var(--sp-4);
  border-radius: var(--r-lg);
  display: grid; place-items: center;
  background: var(--brand-soft);
  border: 1px solid var(--brand-light);
  color: var(--brand);
}
.leer .ico svg, .empty .ico svg { width: 24px; height: 24px; }
.leer strong, .empty strong { display: block; font-size: var(--fs-card); font-weight: 600; color: var(--text); }
.leer p, .empty p { max-width: 46ch; margin: 6px auto var(--sp-5); color: var(--text-2); }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  margin-top: var(--sp-4);
}
.pager .info { font-size: var(--fs-sm); color: var(--text-3); }
.pager .pages { display: flex; align-items: center; gap: 3px; }
.pager .pages a, .pager .pages span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 9px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
  transition: background var(--t-hover) var(--ease);
}
.pager .pages a:hover { background: var(--hover-bg); color: var(--text); }
.pager .pages .on { background: var(--brand-light); color: var(--brand-hover); font-weight: 600; }
.pager .pages .gap { color: var(--text-3); min-width: 20px; }

.skel {
  background: linear-gradient(90deg, #EEF1F7 25%, #F6F8FC 37%, #EEF1F7 63%);
  background-size: 400% 100%;
  border-radius: 6px;
  animation: skel 1.4s ease-in-out infinite;
}
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skel.line { height: 12px; margin-bottom: 8px; }
.skel.line.w60 { width: 60%; } .skel.line.w40 { width: 40%; }

/* == 13  Menüs, Dialoge, Schublade, Toast ================================ */
.menu { position: relative; display: inline-flex; }
/* Ein GESCHLOSSENES .menu-pop steht per position:absolute immer im Baum (nur
   opacity:0/pointer-events:none, kein display:none) - in einer .table-wrap
   schiebt es dieser so unsichtbar eine Scroll-Hoehe unter, die gar nicht
   gebraucht wird (leere Liste bekaeme eine Scrollbar). .menu clippt es lokal;
   menuFixieren() in app.js hebt das beim Oeffnen per position:fixed wieder
   auf (Containing Block = Viewport, entkommt dem Clip hier genauso wie der
   Scroll-Huelle selbst). */
.table-wrap .menu { overflow: hidden; }
.menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0;
  z-index: var(--z-pop);
  min-width: 220px; max-width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  padding: 6px;
  opacity: 0; transform: translateY(-4px) scale(.98);
  pointer-events: none;
  transition: opacity var(--t-hover) var(--ease), transform var(--t-hover) var(--ease-out);
}
.menu-pop.left { right: auto; left: 0; }
.menu.open .menu-pop { opacity: 1; transform: none; pointer-events: auto; }
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px;
  border: 0; background: none; cursor: pointer;
  border-radius: var(--r-sm);
  font: inherit; font-size: var(--fs-sm); color: var(--text-2);
  text-align: left; text-decoration: none;
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--hover-bg); color: var(--text); }
.menu-pop a svg, .menu-pop button svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.menu-pop .sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-pop .head {
  padding: 8px 10px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3);
}
.menu-pop .danger { color: var(--danger-ink); }
.menu-pop .danger:hover { background: var(--danger-bg); color: var(--danger-ink); }
.menu-pop .leerhinweis { padding: 18px 12px; text-align: center; font-size: var(--fs-sm); color: var(--text-3); }

/* Benachrichtigungen */
.notes { min-width: 330px; max-width: 380px; padding: 0; }
.notes .head { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notes .list { max-height: 380px; overflow-y: auto; padding: 6px; }
.notes .note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: var(--fs-sm);
  transition: background var(--t-hover) var(--ease);
}
.notes .note:hover { background: var(--hover-bg); }
.notes .note .pin {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
}
.notes .note .pin svg { width: 16px; height: 16px; }
.notes .note .pin.info { background: var(--info-bg); color: var(--info-ink); }
.notes .note .pin.warn { background: var(--warning-bg); color: var(--warning-ink); }
.notes .note .pin.err  { background: var(--danger-bg); color: var(--danger-ink); }
.notes .note .pin.ok   { background: var(--success-bg); color: var(--success-ink); }
.notes .note strong { display: block; color: var(--text); font-weight: 600; }

/* Dialog */
dialog.modal, .modal {
  border: 0; padding: 0;
  border-radius: var(--r-xl);
  background: var(--card-bg);
  box-shadow: var(--sh-modal);
  color: var(--text);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
}
dialog.modal.wide { width: min(880px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(6, 21, 62, .38); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modalauf var(--t-panel) var(--ease-out); }
@keyframes modalauf { from { opacity: 0; transform: translateY(8px) scale(.985); } }

.modal-head {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.modal-head h2, .modal-head h3 { margin: 0; }
.modal-head .desc { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-2); }
.modal-head .iconbtn { margin-left: auto; margin-top: -4px; }
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--subtle-bg);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.modal-foot .links { margin-right: auto; }

/* Toast */
.toasts {
  position: fixed; right: var(--sp-5); bottom: var(--sp-5);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px; max-width: 400px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-md);
  box-shadow: var(--sh-pop);
  font-size: var(--fs-sm); color: var(--text-2);
  pointer-events: auto;
  animation: toastauf 220ms var(--ease-out);
}
.toast strong { display: block; color: var(--text); font-weight: 600; }
.toast.ok   { border-left-color: var(--success); }
.toast.warn { border-left-color: var(--warning); }
.toast.err  { border-left-color: var(--danger); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.ok svg { color: var(--success); }
.toast.warn svg { color: var(--warning); }
.toast.err svg { color: var(--danger); }
@keyframes toastauf { from { opacity: 0; transform: translateY(10px); } }

/* Hinweisstreifen im Inhalt */
.hinweis {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--subtle-bg);
  color: var(--text-2);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}
.hinweis svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.hinweis strong { color: var(--text); font-weight: 600; }
.hinweis.ok   { background: var(--success-bg); border-color: #C7EEDC; color: var(--success-ink); }
.hinweis.warn { background: var(--warning-bg); border-color: #F0DDB2; color: var(--warning-ink); }
.hinweis.err  { background: var(--danger-bg);  border-color: #F6CDD2; color: var(--danger-ink); }
.hinweis.info { background: var(--info-bg);    border-color: #CFE0FC; color: var(--info-ink); }
.hinweis.ok strong, .hinweis.warn strong, .hinweis.err strong, .hinweis.info strong { color: inherit; }

/* Fortschritt */
.progress {
  height: 6px; border-radius: var(--r-full);
  background: var(--border); overflow: hidden;
}
.progress > i {
  display: block; height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand));
  transition: width var(--t-panel) var(--ease);
}

/* Kickoff-Stufen — was erledigt ist, was laeuft, was noch kommt.
   Ersetzt die reine Prozentanzeige: der Balken allein sagte nie, WAS gerade
   passiert (und stand bei V2/V3-Builds ohnehin die ganze Zeit auf 8%). */
.kstufen {
  list-style: none; margin: var(--sp-4) 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.kstufe {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 7px var(--sp-2); border-radius: var(--r-sm);
}
.kstufe .kmark {
  flex: none; width: 16px; height: 16px; margin-top: 2px;
  border-radius: var(--r-full); border: 2px solid var(--border-strong);
  position: relative;
}
.kstufe .ktext { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kstufe .klabel { font-size: var(--fs-sm); color: var(--text-2); }
.kstufe .khint { font-size: var(--fs-xs); color: var(--text-3); }
.kstufe .kstate {
  margin-left: auto; flex: none; align-self: center;
  font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums;
}

/* erledigt — Haken, gedaempft: es soll nicht mit dem aktiven Schritt konkurrieren */
.kstufe.done .kmark { border-color: var(--ok-fill); background: var(--ok-fill); }
.kstufe.done .kmark::after {
  content: ""; position: absolute; inset: 0;
  background: no-repeat center/9px 9px
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1.5 6.4l3 3 6-6.8' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.kstufe.done .klabel { color: var(--text-3); }
.kstufe.done .khint { display: none; }

/* laeuft — der einzige Schritt, der Aufmerksamkeit bekommt */
.kstufe.active { background: var(--brand-light); }
.kstufe.active .klabel { color: var(--text); font-weight: 600; }
.kstufe.active .kstate { color: var(--brand-hover); font-weight: 600; }
.kstufe.active .kmark { border-color: var(--brand); }
.kstufe.active .kmark::after {
  content: ""; position: absolute; inset: 2px;
  border-radius: var(--r-full); background: var(--brand);
  animation: kpuls 1.4s var(--ease) infinite;
}
@keyframes kpuls { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.kstufe.error { background: var(--err-tint); }
.kstufe.error .kmark { border-color: var(--err-fill); background: var(--err-fill); }
.kstufe.error .klabel, .kstufe.error .kstate { color: var(--err); font-weight: 600; }

.kstufe.todo .klabel, .kstufe.todo .khint { color: var(--text-3); }
.kstufe.todo .kmark { border-style: dashed; }

@media (prefers-reduced-motion: reduce) {
  .kstufe.active .kmark::after { animation: none; }
}

/* Kurzes Protokoll: nur die erzaehlenden Zeilen des Daemons, nicht die rohen
   Bash-Aufrufe des Agenten (die stehen abgeschnitten in derselben Spalte). */
.kfeed {
  margin-top: var(--sp-4); padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
  max-height: 190px; overflow-y: auto;
}
.kfeed-z { display: flex; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--text-2); }
.kfeed-t { flex: none; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* == 14  Hilfsklassen ==================================================== */
/* .sp wird auf 16 Seiten als Abstandhalter benutzt (bisher nur per
   style="flex:1" — die Klasse selbst war nie definiert). */
.sp { flex: 1; }

/* Balken für Kennzahlen und Auslastung */
.bar { height: 8px; border-radius: var(--r-full); background: var(--track-bg); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.bar > i.ok   { background: var(--success); }
.bar > i.warn { background: var(--warning); }
.bar > i.err  { background: var(--danger); }

/* Vorzeichenbehaftete Beträge — ersetzt die Farbwahl per PHP-Ternary. */
.pos { color: var(--success-ink); font-variant-numeric: tabular-nums; }
.neg { color: var(--danger-ink);  font-variant-numeric: tabular-nums; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.strong { color: var(--text); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.tright { text-align: right; }
.tcenter { text-align: center; }

.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row.tight { gap: var(--sp-2); }
.row .grow, .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack.tight { gap: var(--sp-2); }
.grid2 { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid3 { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.mt0 { margin-top: 0; }    .mb0 { margin-bottom: 0; }
.mt2 { margin-top: var(--sp-2); }  .mb2 { margin-bottom: var(--sp-2); }
.mt4 { margin-top: var(--sp-4); }  .mb4 { margin-bottom: var(--sp-4); }
.mt6 { margin-top: var(--sp-6); }  .mb6 { margin-bottom: var(--sp-6); }

/* Zwischenüberschrift und Kleintext. Standen bisher NUR in seiteneigenen
   <style>-Blöcken — .abschnitt gleich dreimal mit drei verschiedenen Werten
   (project.php 26px Abstand, client.php sp-8/sp-3, invoice.php als reine
   Schriftgröße). Hier steht jetzt die eine zentrale Fassung; die vier
   Bestandsblöcke stehen später im Dokument und übersteuern sie unverändert
   weiter, es ändert sich also keine bestehende Seite. Neue Seiten nehmen diese. */
.abschnitt {
  font-size: var(--fs-card); line-height: var(--lh-card); font-weight: 600;
  margin: var(--sp-8) 0 var(--sp-3);
}
.klein { font-size: var(--fs-xs); }
.bruch { word-break: break-all; }

/* Textlink mit kleinem Symbol. Stand bisher dreimal in seiteneigenen Blöcken
   (expense.php, expense-edit.php, expenses.php) — ohne diese Regel bekommt ein
   ui_icon() im Fließtext KEINE Größe und wird in voller Kastenbreite gerendert.
   Die drei Bestandsblöcke übersteuern sie unverändert weiter. */
.linkicon { display: inline-flex; align-items: center; gap: 5px; }
.linkicon svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Kopfzeile alten Zuschnitts (Klassenname aus dem Bestand: .kopf) */
.kopf {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap; margin-bottom: var(--sp-4);
}
.kopf h1 { margin: 0; }
.kopf .zahl {
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-3);
  background: var(--subtle-bg); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 1px 10px;
}
.filterzeile {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.treffer { margin-top: var(--sp-3); font-size: var(--fs-sm); }

/* == 15  Login =========================================================== */
.loginseite {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: var(--sp-6);
  position: relative; overflow: hidden;
  background: var(--app-bg);
}
/* Abstrakte Marken-Geometrie: dieselben Winkel wie die Bildmarke, sehr leise. */
.loginseite::before,
.loginseite::after {
  content: ""; position: absolute; pointer-events: none; z-index: 0;
}
.loginseite::before {
  top: -18vh; left: -12vw;
  width: 58vw; height: 78vh;
  background: linear-gradient(150deg, rgba(6,21,62,.055), rgba(6,21,62,0) 62%);
  clip-path: polygon(0 0, 100% 0, 46% 100%, 0 62%);
}
.loginseite::after {
  right: -14vw; bottom: -22vh;
  width: 62vw; height: 82vh;
  background: linear-gradient(310deg, rgba(1,82,253,.075), rgba(1,82,253,0) 60%);
  clip-path: polygon(100% 0, 100% 100%, 8% 100%, 62% 34%);
}
.loginkarte {
  position: relative; z-index: 1;
  width: 100%; max-width: 404px;
}
.loginkarte .marke {
  display: flex; justify-content: center;
  margin-bottom: var(--sp-6);
}
.loginkarte .marke img { width: 236px; height: auto; display: block; }
.loginkarte .box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 18px 48px -16px rgba(6,21,62,.16);
  padding: var(--sp-7);
}
.loginkarte h1 { font-size: 22px; margin: 0 0 6px; }
.loginkarte .willkommen { color: var(--text-2); font-size: var(--fs-sm); margin: 0 0 var(--sp-6); }
.loginkarte form { display: flex; flex-direction: column; gap: var(--sp-4); }
.loginkarte .fuss {
  margin-top: var(--sp-5); padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-3); text-align: center;
}
@media (max-width: 480px) {
  .loginkarte .box { padding: var(--sp-5); }
  .loginkarte .marke img { width: 200px; }
}

/* == 16  Bewegung, Druck, Umbrüche ======================================= */

/* -- Mobile Drawer / Scrim -- */
.scrim { display: none; }

/* Tablet: schmalere Ränder */
@media (max-width: 1200px) {
  :root { --pad-x: 24px; }
}

/* Mobil: Sidebar als Schublade */
@media (max-width: 900px) {
  :root { --pad-x: 16px; --appbar-h: 54px; }

  .sidebar {
    position: fixed; left: 0; top: 0;
    width: min(288px, 86vw);
    transform: translateX(-100%);
    transition: transform var(--t-panel) var(--ease-out);
    box-shadow: none;
    z-index: var(--z-drawer);
  }
  #navtoggle:checked ~ .app .sidebar { transform: none; box-shadow: var(--sh-modal); }
  #navtoggle:checked ~ .app .scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(6, 21, 62, .32);
    z-index: var(--z-scrim);
    animation: scrimauf var(--t-panel) var(--ease);
  }
  @keyframes scrimauf { from { opacity: 0; } }

  .burger { display: inline-flex; }
  /* Eingeklappt zur reinen Lupe — sieht aus wie die anderen Icon-Schaltflächen
     und wächst beim Fokus zum vollen Feld. */
  .gsearch { width: 36px; }
  .gsearch > svg { left: 50%; transform: translate(-50%, -50%); }
  .gsearch input { padding: 0; color: transparent; background: transparent; border-color: transparent; cursor: pointer; }
  .gsearch input::placeholder { color: transparent; }
  .gsearch input:hover { background: var(--hover-bg); }
  .gsearch input:focus {
    width: min(260px, 60vw); position: absolute; right: 0;
    padding: 0 12px 0 34px; color: var(--text); cursor: text;
    background: #fff; border-color: var(--brand); z-index: 2;
  }
  .gsearch input:focus::placeholder { color: var(--text-3); }
  .gsearch:focus-within > svg { left: 11px; transform: translate(0, -50%); z-index: 3; }
  .gsearch kbd { display: none; }

  html.rail .sidebar { width: min(288px, 86vw); padding-inline: var(--sp-3); }
  html.rail .brand-txt, html.rail .navgroup .lbl, html.rail .navlink span,
  html.rail .navlink .n, html.rail .sidebar-user .who { display: revert; }
  html.rail .sidebar .brand, html.rail .navlink, html.rail .sidebar-user {
    justify-content: flex-start; padding-inline: var(--sp-2);
  }
  html.rail .navlink.on::before { left: calc(var(--sp-3) * -1); }

  main { padding-bottom: var(--sp-12); }
  .pagehead { gap: var(--sp-3); }
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
  .stat { padding: var(--sp-3) var(--sp-4); }
  .stat .val { font-size: 22px; }
  .toasts { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 640px) {
  :root { --fs-page: 23px; }
  .table-wrap.scroll { margin-inline: calc(var(--pad-x) * -1); padding-inline: var(--pad-x); border-radius: 0; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
}

/* -- Bewegung nur, wenn erwünscht -- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* -- Druck -- */
@media print {
  .sidebar, .appbar, .scrim, .toasts, .skip, .pagehead .act, .toolbar { display: none !important; }
  body { background: #fff; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  .card, table, .stat { box-shadow: none; border-color: #D0D7E2; }
  a { color: var(--text); }
}
