/*
 * KitchenHive CRM, Küchenspezialist. Arbeitsfläche für das Studio-Team.
 * Tokens aus "01 Küchenspezialist Design System/tokens". Hell und ruhig, Dunkelmodus folgt dem System.
 * Rot (--red) nur für Überfälliges und Abweichungen. Ziele mindestens 44px (--tap).
 *
 * Bereiche bringen eigene Zusätze als assets/<bereich>.css mit (render(..., ['css' => ['<bereich>.css']]))
 * und nutzen dort nur die Variablen und Klassen unten. Diese Datei bleibt gemeinsam.
 *
 * KOMPONENTENKLASSEN
 *  Hülle         .app .shell .side .side-brand .side-logo .side-product .side-user .side-me .main .skip
 *  Navigation    .nav .nav-list .nav-link[aria-current] .nav-group
 *  Seitenkopf    .page-head .page-title .page-lead .page-meta .page-actions .kicker .crumbs
 *  Raster        .grid .grid--2 .grid--3 .grid--4 .layout-aside (Inhalt + 20rem Spalte) .stack .cluster
 *  Karten        .card .card--quiet .card--flush .card-head .card-title .card-meta .card-lead .card-note
 *                .stat .stat-label .stat-value .stat-sub (Kennzahl)
 *  Fakten        .facts .facts--stack (dl mit div > dt + dd)
 *  Tabellen      .table-wrap .table .num .cell-action .row-link tr.is-inactive tr.is-overdue tr.is-new
 *  Listen        .list .list-item .list-main .list-title .list-meta .list-side (Aufgaben, Termine)
 *  Stufenleiste  .stufen .stufen-item.is-done/.is-current .stufen-nr .stufen-label .stufen--verloren (ui_stufenleiste)
 *  Badges        .badge .badge--blau .badge--neu .badge--rot .badge--still .badge--ok (ui_badge), .kz (ui_kuerzel)
 *  Person        .person .person-sub
 *  Buttons       .btn .btn--primary .btn--ghost .btn--quiet .btn--sm .btn--block .btn-row
 *  Formulare     .form .form-row .form-section .form-actions .form-foot .field .field--short .has-error
 *                .label .label-row .input .input--caps .input-unit .hint .field-error .check .segmented .segmented-item
 *                [data-show-when="feld=wert"] (crm.js)
 *  Reiter        .tabs .tabs-list .tab[aria-current]; ohne Neuladen: [data-tabs] [role=tab] [role=tabpanel] (crm.js)
 *  Upload        .drop [data-drop] .drop-list .is-dragover (crm.js)
 *  Zustände      .empty .empty-title .empty-text .empty-action, .flash .flash--ok/.flash--fehler/.flash--hinweis
 *                .is-overdue (rote Frist), .abweichung (rote Soll/Ist-Zelle), .checklist li.is-ok/.is-fail
 *  Login         .gate .gate-shell .gate-brand .gate-logo .gate-main .gate-card .gate-title .gate-lead .claim .claim-accent
 *  Hilfen        .muted .sr-only .nowrap .link-quiet .divider
 */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --blue: #0079B6;
  --blue-d: #005A8A;
  --blue-soft: #E3F0F7;
  --blue-text: #005A8A;
  --red: #C82038;
  --red-soft: #FBEAEC;

  --ground: #f1f2f2;
  --stone: #e4e7e8;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --ink: #131618;
  --ink-2: #3a4147;
  --muted: #646c73;
  --line: rgba(19, 22, 24, 0.12);
  --line-strong: rgba(19, 22, 24, 0.22);
  --hover: rgba(19, 22, 24, 0.04);
  --on-blue: #ffffff;

  --font: "Archivo", "Segoe UI", system-ui, sans-serif;
  --fs-body: 0.975rem;
  --fs-small: 0.875rem;
  --fs-xs: 0.78rem;
  --lh: 1.5;
  --tracking-display: -0.035em;

  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.25rem;
  --s6: 1.5rem; --s8: 2rem; --s10: 2.5rem; --s12: 3rem; --s16: 4rem;

  --r-sm: 0.25rem;
  --r-md: 0.45rem;
  --r-lg: 0.75rem;
  --r-pill: 999px;

  --tap: 44px;
  --side-w: 15.5rem;
  --main-max: 84rem;
  --gutter: clamp(1.25rem, 3.2vw, 2.75rem);
  --focus: 2px solid var(--blue);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --shadow: 0 1px 2px rgba(19, 22, 24, 0.04), 0 8px 24px -16px rgba(19, 22, 24, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #0079B6;
    --blue-d: #006699;
    --blue-soft: rgba(126, 196, 230, 0.12);
    --blue-text: #7ec4e6;
    --red: #ef5a6f;
    --red-soft: rgba(239, 90, 111, 0.13);

    --ground: #0f1214;
    --stone: #20262a;
    --surface: #161a1d;
    --surface-2: #1b2024;
    --ink: #eef1f2;
    --ink-2: #c9d0d4;
    --muted: #a3acb3;
    --line: rgba(238, 241, 242, 0.1);
    --line-strong: rgba(238, 241, 242, 0.2);
    --hover: rgba(238, 241, 242, 0.04);
    --focus: 2px solid #7ec4e6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* ---------- Grundlagen ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.15; letter-spacing: -0.015em; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; }
a { color: var(--blue-text); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
strong { font-weight: 600; }
::selection { background: var(--blue-soft); color: var(--blue-text); }
[hidden] { display: none !important; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}
main:focus { outline: none; }

.skip {
  position: absolute; left: var(--s4); top: -100px; z-index: 50;
  padding: var(--s3) var(--s4);
  background: var(--ink); color: var(--ground);
  border-radius: var(--r-md); font-weight: 600; text-decoration: none;
}
.skip:focus { top: var(--s4); }

/* ---------- Hülle und Navigation ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}
.side {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  gap: var(--s6);
  padding: var(--s6) var(--s4) var(--s4);
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.side-brand {
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s1) var(--s3) var(--s2);
  color: var(--ink); text-decoration: none;
}
.side-logo { width: 148px; height: auto; }
.side-product {
  font-size: var(--fs-xs);
  font-weight: 600;
  font-stretch: 125%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav { flex: 1; display: flex; flex-direction: column; gap: var(--s1); }
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-group {
  margin: var(--s5) 0 var(--s1);
  padding: 0 var(--s3);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em;
  color: var(--muted);
}
.nav-link {
  position: relative;
  display: flex; align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s3);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-link:hover { background: var(--hover); color: var(--ink); }
.nav-link[aria-current="page"] {
  background: var(--blue-soft);
  color: var(--blue-text);
  font-weight: 600;
}
.nav-link[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 3px; border-radius: 3px; background: var(--blue);
}

.side-user {
  display: flex; flex-direction: column; gap: var(--s2);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}
.side-me {
  display: flex; align-items: center; gap: var(--s3);
  min-height: var(--tap);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  color: var(--ink); text-decoration: none;
}
.side-me:hover, .side-me[aria-current="page"] { background: var(--hover); }
.side-me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-me-meta { font-size: var(--fs-xs); color: var(--muted); }
.side-logout { width: 100%; }

.main {
  width: 100%;
  max-width: var(--main-max);
  padding: var(--s10) var(--gutter) var(--s16);
}
.main > * + * { margin-top: var(--s6); }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; z-index: 20;
    height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: var(--s2) var(--s4);
    padding: var(--s3) var(--gutter) 0;
    border-right: 0; border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .side-brand { flex-direction: row; align-items: center; gap: var(--s3); padding: 0; min-height: var(--tap); }
  .side-logo { width: 116px; }
  .side-product { display: none; }
  .side-user { flex-direction: row; align-items: center; margin-left: auto; padding: 0; border: 0; }
  .side-me-text { display: none; }
  .side-me { padding: var(--s1); }
  .side-logout { width: auto; }
  .nav {
    order: 3; flex: 1 0 100%;
    flex-direction: row; align-items: center; gap: var(--s1);
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) var(--s2);
    overflow-x: auto; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-list { flex-direction: row; gap: var(--s1); }
  .nav-group { display: none; }
  .nav-list + .nav-list { padding-left: var(--s2); margin-left: var(--s1); border-left: 1px solid var(--line); }
  .nav-link { white-space: nowrap; }
  .nav-link[aria-current="page"]::before { left: 12px; right: 12px; top: auto; bottom: 4px; width: auto; height: 2px; }
  .main { padding-top: var(--s8); }
}

/* ---------- Seitenkopf ---------- */

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--s4) var(--s8);
  padding-bottom: var(--s2);
}
.page-title {
  font-size: clamp(1.85rem, 3.1vw, 2.6rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: var(--tracking-display);
}
.page-lead { margin-top: var(--s3); max-width: 46rem; color: var(--ink-2); font-size: 1.05rem; }
.page-meta { margin-bottom: var(--s3); color: var(--muted); font-size: var(--fs-small); font-weight: 500; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.kicker {
  margin-bottom: var(--s3);
  font-size: var(--fs-xs); font-weight: 600;
  font-stretch: 125%; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
}
.crumbs { font-size: var(--fs-small); color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs span[aria-hidden] { margin: 0 var(--s2); opacity: 0.6; }

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--surface);
  --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap);
  padding: 0 1.25rem;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600; font-size: var(--fs-body); line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.1s;
}
.btn:hover { --btn-bg: var(--blue-d); --btn-fg: #fff; }
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.btn--primary { --btn-bg: var(--blue); --btn-fg: var(--on-blue); }
.btn--primary:hover { --btn-bg: var(--blue-d); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line-strong); }
.btn--ghost:hover { --btn-bg: var(--hover); --btn-fg: var(--ink); --btn-bd: var(--ink); }
.btn--quiet { --btn-bg: transparent; --btn-fg: var(--blue-text); padding: 0 var(--s3); }
.btn--quiet:hover { --btn-bg: var(--blue-soft); --btn-fg: var(--blue-text); }
.btn--sm { padding: 0 var(--s4); font-size: var(--fs-small); }
.btn--sm.btn--quiet { padding: 0 var(--s3); }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* ---------- Raster ---------- */

.grid { display: grid; gap: var(--s5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.layout-aside { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
@media (max-width: 1100px) { .layout-aside { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: var(--s4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }

/* ---------- Karten ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s6);
  box-shadow: var(--shadow);
}
.card > * + * { margin-top: var(--s4); }
.card--quiet { background: var(--surface-2); box-shadow: none; }
.card--flush { padding: 0; overflow: hidden; }
.card--flush > * + * { margin-top: 0; }
.card-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4);
  padding: var(--s5) var(--s6);
}
.card--flush > .card-head { border-bottom: 1px solid var(--line); }
.card-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
.card-meta { font-size: var(--fs-small); color: var(--muted); }
.card-lead { color: var(--ink-2); max-width: 42rem; }
.card-note { font-size: var(--fs-small); color: var(--muted); }

.stat { display: flex; flex-direction: column; gap: var(--s1); }
.stat-label { font-size: var(--fs-small); color: var(--muted); font-weight: 500; }
.stat-value { font-size: clamp(1.8rem, 2.6vw, 2.3rem); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1.05; }
.stat-sub { font-size: var(--fs-small); color: var(--ink-2); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--s4) var(--s6); }
.facts--stack { grid-template-columns: 1fr; gap: var(--s3); }
.facts dt { font-size: var(--fs-small); color: var(--muted); margin-bottom: 2px; }
.facts dd { font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.table th {
  padding: var(--s3) var(--s4);
  text-align: left; white-space: nowrap;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.table td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; height: 56px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.12s; }
.table tbody tr:hover { background: var(--hover); }
.table th:first-child, .table td:first-child { padding-left: var(--s6); }
.table th:last-child, .table td:last-child { padding-right: var(--s6); }
.table .num { text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }
.table .cell-action { text-align: right; width: 1%; white-space: nowrap; }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--blue-text); text-decoration: underline; }
.table tr.is-inactive td { color: var(--muted); }
.table tr.is-inactive .row-link { color: var(--muted); font-weight: 500; }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--blue); }

/* ---------- Listen (Aufgaben, Termine) ---------- */

.list { list-style: none; }
.list-item {
  display: flex; align-items: center; gap: var(--s4);
  min-height: 60px;
  padding: var(--s3) var(--s6);
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; color: var(--ink); text-decoration: none; }
a.list-title:hover { color: var(--blue-text); text-decoration: underline; }
.list-meta { font-size: var(--fs-small); color: var(--muted); margin-top: 2px; }
.list-side { display: flex; align-items: center; gap: var(--s3); flex-shrink: 0; font-size: var(--fs-small); }

/* ---------- Stufenleiste ---------- */

.stufen {
  list-style: none;
  display: flex; gap: 2px;
  padding: 3px;
  background: var(--stone);
  border-radius: var(--r-pill);
  overflow-x: auto; scrollbar-width: none;
  counter-reset: none;
}
.stufen::-webkit-scrollbar { display: none; }
.stufen-item { flex: 1 0 auto; }
.stufen-item > a, .stufen-item > span {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 38px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: var(--fs-small); font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.stufen-item > a { min-height: var(--tap); }
.stufen-item > a:hover { background: var(--hover); color: var(--ink); }
.stufen-nr {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 0.7rem; font-weight: 600;
  border: 1px solid var(--line-strong);
}
.stufen-item.is-done > a, .stufen-item.is-done > span { color: var(--ink-2); }
.stufen-item.is-done .stufen-nr { background: var(--blue-soft); border-color: transparent; color: var(--blue-text); }
.stufen-item.is-current > a, .stufen-item.is-current > span {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(19, 22, 24, 0.12);
}
.stufen-item.is-current .stufen-nr { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.stufen--verloren .stufen-item > a, .stufen--verloren .stufen-item > span { opacity: 0.55; }
@media (max-width: 720px) {
  .stufen-item:not(.is-current) .stufen-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stufen-item:not(.is-current) > a, .stufen-item:not(.is-current) > span { padding: 0 var(--s2); }
}

/* ---------- Badges, Kürzel, Person ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 0.35em;
  min-height: 24px;
  padding: 0 0.6rem;
  border-radius: var(--r-pill);
  background: var(--stone);
  color: var(--ink-2);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1;
  white-space: nowrap; vertical-align: middle;
}
.badge--blau { background: var(--blue-soft); color: var(--blue-text); }
.badge--neu { background: var(--blue); color: var(--on-blue); font-stretch: 125%; letter-spacing: 0.1em; text-transform: uppercase; }
.badge--rot { background: var(--red-soft); color: var(--red); }
.badge--still { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.badge--ok { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.badge--ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }

.kz {
  display: inline-grid; place-items: center;
  min-width: 32px; height: 32px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--ink); color: var(--surface);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
  flex-shrink: 0;
}
.person { display: flex; align-items: center; gap: var(--s3); }
.person > span:not(.kz) { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.person-sub { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- Formulare ---------- */

.form > * + * { margin-top: var(--s5); }
.form-row { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.form-row > .field + .field { margin-top: 0; }
.form-row:has(.field--short) { grid-template-columns: minmax(0, 1fr) 9rem; }
.form-section { font-size: 1rem; font-weight: 600; padding-top: var(--s2); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s2); padding-top: var(--s2); }
.form-foot { text-align: center; font-size: var(--fs-small); }
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field--short { max-width: 14rem; }
.form-row .field--short { max-width: none; }
.label { font-size: var(--fs-small); font-weight: 600; color: var(--ink); padding: 0; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { min-height: 7rem; resize: vertical; line-height: var(--lh); }
select.input {
  appearance: none;
  padding-right: 2.4rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.input:hover { border-color: var(--ink-2); }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.input:focus-visible { outline: none; }
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input[disabled] { background: var(--surface-2); color: var(--muted); }
.input--caps { text-transform: uppercase; letter-spacing: 0.06em; }
.input-unit { display: flex; align-items: center; gap: var(--s3); }
.input-unit .input { max-width: 8rem; }
.input-unit span { color: var(--muted); }
.hint { font-size: var(--fs-small); color: var(--muted); }
.has-error .input { border-color: var(--ink); border-width: 2px; padding: calc(0.6rem - 1px) calc(0.85rem - 1px); }
.field-error {
  display: flex; gap: var(--s2); align-items: flex-start;
  font-size: var(--fs-small); font-weight: 600; color: var(--ink);
}
.field-error::before {
  content: "!"; flex-shrink: 0;
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  background: var(--ink); color: var(--surface); font-size: 0.7rem;
}
.check { display: flex; align-items: flex-start; gap: var(--s3); min-height: var(--tap); padding: var(--s2) 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--blue); flex-shrink: 0; }
.check input[disabled] + span { color: var(--muted); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--stone); border-radius: var(--r-pill); align-self: flex-start; }
.segmented-item { position: relative; }
.segmented-item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented-item span {
  display: flex; align-items: center; min-height: 38px; padding: 0 var(--s5);
  border-radius: var(--r-pill); font-weight: 500; color: var(--ink-2);
}
.segmented-item input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(19, 22, 24, 0.12); }
.segmented-item input:focus-visible + span { outline: var(--focus); outline-offset: 2px; }
.segmented-item input:disabled + span { opacity: 0.45; }
.segmented-item input:disabled { cursor: not-allowed; }

/* ---------- Reiter ---------- */

.tabs { border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs-list { list-style: none; display: flex; gap: var(--s1); }
.tab {
  position: relative;
  display: flex; align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 0; background: none;
  color: var(--muted); font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tab[aria-current="page"]::after, .tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: var(--s4); right: var(--s4); bottom: -1px;
  height: 2px; background: var(--blue); border-radius: 2px;
}
.tab:focus-visible { outline-offset: -2px; }
[role="tabpanel"][hidden] { display: none; }

/* ---------- Upload ---------- */

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 9rem; padding: var(--s6);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  text-align: center; color: var(--ink-2);
  transition: border-color 0.15s, background-color 0.15s;
}
.drop.is-dragover { border-color: var(--blue); background: var(--blue-soft); }
.drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-list { list-style: none; font-size: var(--fs-small); color: var(--muted); }

/* ---------- Zustände ---------- */

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); padding: var(--s10) var(--s6); max-width: 36rem; }
.empty-title { font-size: 1.15rem; font-weight: 600; }
.empty-text { color: var(--ink-2); }
.empty-action { margin-top: var(--s3); }

.flash {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  background: var(--surface);
  font-weight: 500;
}
.flash + .flash { margin-top: var(--s2); }
.flash--hinweis { border-left-color: var(--muted); background: var(--surface-2); }
.flash--fehler { border-left-color: var(--ink); font-weight: 600; }

.is-overdue { color: var(--red); font-weight: 600; }
.abweichung { color: var(--red); font-weight: 600; background: var(--red-soft); }

.checklist { list-style: none; display: flex; flex-direction: column; gap: var(--s2); font-size: var(--fs-small); }
.checklist li { display: flex; align-items: center; gap: var(--s2); }
.checklist li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.checklist li.is-fail { font-weight: 600; }
.checklist li.is-fail::before { background: var(--red); }

/* ---------- Login und Installation ---------- */

.gate-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.gate-brand {
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--s12);
  padding: clamp(2rem, 5vw, 4.5rem);
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.gate-logo { width: 176px; height: auto; }
.claim {
  display: flex; flex-direction: column;
  font-size: clamp(2.6rem, 5.4vw, 5.4rem);
  font-weight: 500; line-height: 0.98; letter-spacing: -0.045em;
}
.claim-accent { color: var(--blue); }
.gate-foot { display: flex; flex-direction: column; gap: var(--s4); }
.gate-product { font-size: var(--fs-xs); font-weight: 600; font-stretch: 125%; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.gate-houses { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s3) var(--s10); font-size: var(--fs-small); font-weight: 600; }
.gate-houses span { font-weight: 400; color: var(--muted); }
.gate-main { display: grid; place-items: center; padding: var(--s10) var(--gutter); }
.gate-card { width: 100%; max-width: 25rem; }
.gate-card > * + * { margin-top: var(--s5); }
.gate-title { font-size: clamp(1.9rem, 3vw, 2.4rem); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1.05; }
.gate-card .gate-title + .gate-lead { margin-top: var(--s3); }
.gate-lead { color: var(--ink-2); }
@media (max-width: 860px) {
  .gate-shell { grid-template-columns: 1fr; }
  .gate-brand { gap: var(--s6); padding: var(--s6) var(--gutter); border-right: 0; border-bottom: 1px solid var(--line); }
  .gate-logo { width: 132px; }
  .claim { font-size: 2.1rem; }
  .gate-foot { display: none; }
  .gate-main { place-items: start center; padding-top: var(--s8); }
}

/* ---------- Hilfen ---------- */

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.link-quiet { color: var(--muted); font-size: var(--fs-small); }
.link-quiet:hover { color: var(--ink); }
.divider { height: 1px; background: var(--line); border: 0; margin: var(--s6) 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

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

@media print {
  .side, .skip, .page-actions, .form-actions { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
