/* ============================================================
   S+K EINKAUF — Design-Tokens & Komponenten
   Abgeleitet aus der S+K-Website (docs/design-adaption.md):
   "Dunkler Rahmen, helles Blatt" — Charcoal-Chrome, Paper-Arbeitsfläche,
   Gold ausschließlich als Interaktionsfarbe.
   ============================================================ */

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

:root {
  /* Markenpalette (1:1 von der Website) */
  --c-ink: #111010;
  --c-charcoal: #1a1815;
  --c-charcoal-2: #221f1b;
  --c-charcoal-3: #2b2722;
  --c-charcoal-4: #383128;
  --c-paper: #efe9de;
  --c-sand: #e4dacb;
  --c-gold: #c4a574;
  --c-gold-bright: #dcbd8a;
  --c-khaki-deep: #5f594a;

  /* App-Semantik: helle Arbeitsfläche */
  --app-bg: #efe9de;
  --surface: #faf7f0;
  --surface-head: #e9e2d3;
  --surface-hover: #f1ecdf;
  --text: #16140f;
  --text-muted: #5c5648;
  --accent-ui: #8a6b3f;      /* Gold wird auf Hell zu Bronze */
  --accent-text: #6f5527;
  --focus-ring: #8a6b3f;
  --hairline: rgba(22, 20, 15, 0.14);
  --hairline-2: rgba(22, 20, 15, 0.28);

  /* Status-Akzentfarben — EIN Ort, genutzt von Badges UND Timeline (sauber & etwas reicher) */
  --st-neutral: #645c4d;  /* Entwurf */
  --st-amber:   #986809;  /* Bedarf / Wartet auf Freigabe */
  --st-blue:    #305a82;  /* Bestellt */
  --st-azure:   #3f7bab;  /* AB erhalten — eigener, hellerer Blauton (nicht wie Bestellt) */
  --st-teal:    #1e7d67;  /* Anfrage / Teilgeliefert */
  --st-green:   #407a32;  /* Geliefert / Abgeschlossen / Freigegeben */
  --st-terra:   #9a3c22;  /* Storniert */
  --st-gold:    #7c5d2c;  /* „deine Anforderung" */

  /* Chrome (Sidebar/Topbar) — dauerhaft dunkel */
  --chrome-bg: #1a1815;
  --chrome-raised: #221f1b;
  --chrome-text: #ede7db;
  --chrome-muted: #b5ac99;
  --chrome-hairline: rgba(237, 231, 219, 0.13);

  /* Typografie */
  --font-display: 'Archivo Variable', 'Archivo', 'Helvetica Neue', sans-serif;
  --font-body: 'Inter Variable', 'Inter', system-ui, sans-serif;
  --fs-page-title: 1.375rem;
  --fs-h2: 1.0625rem;
  --fs-body: 0.875rem;
  --fs-small: 0.8125rem;
  --fs-micro: 0.6875rem;
  --lh-ui: 1.45;
  --ls-eyebrow: 0.14em;

  /* Dichte & Form */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem;
  --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem;
  --row-h: 44px;
  --input-h: 38px;
  --r-sm: 6px; --r-md: 8px; --r-pill: 999px;
  --sidebar-w: 232px;

  --dur-fast: 120ms;
  --dur-normal: 200ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1); /* an ~10 Stellen referenziert — war nie definiert */

  --shadow-sm: 0 1px 2px rgba(22, 20, 15, 0.08);
  --shadow-md: 0 10px 30px -14px rgba(22, 20, 15, 0.25);
  --shadow-lg: 0 40px 90px -40px rgba(22, 20, 15, 0.5);
  --surface-field: #fdfcf8; /* Eingabefelder: ein Hauch wärmer als reines Weiß, Teil des „Blatts" */
}

/* ---- Reset & Grundlagen -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* hidden-Attribut gewinnt immer — auch gegen display-Regeln wie .btn { display:inline-flex } */
[hidden] { display: none !important; }
/* Visuell versteckt, aber fokussierbar (z. B. File-Input hinter einem Label) */
.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;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-ui);
  color: var(--text);
  background: var(--app-bg);
}
::selection { background: var(--c-gold); color: var(--c-ink); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.01em; }
img { max-width: 100%; }

/* Zahlen fluchten IMMER — wichtigster Typo-Token der App */
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---- Chevron (K-Flagge) als Interpunktion --------------------------- */
.chev {
  display: inline-block; width: 0.62em; height: 0.85em; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 864 1166'%3E%3Crect width='26' height='1166'/%3E%3Cpath d='M340 0 H864 L586 385 L847 781 H322 L61 385 Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 864 1166'%3E%3Crect width='26' height='1166'/%3E%3Cpath d='M340 0 H864 L586 385 L847 781 H322 L61 385 Z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.eyebrow {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-micro); font-weight: 650;
  text-transform: uppercase; letter-spacing: var(--ls-eyebrow);
  color: var(--text-muted);
}
.eyebrow .chev { color: var(--accent-ui); }

/* ---- App-Gerüst: Sidebar (Messebau) + Arbeitsfläche (Design-Blatt) --- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--chrome-bg); color: var(--chrome-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.35), 8px 0 28px -18px rgba(0, 0, 0, 0.5); /* Rahmen wirft Schatten aufs Blatt */
  z-index: 60;
}
.sidebar__brand { transition: background var(--dur-fast) var(--ease-out); }
.sidebar__brand:hover { background: var(--chrome-raised); text-decoration: none; }
.sidebar__brand {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4);
  font-family: var(--font-display); font-weight: 850; font-size: 1rem;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--chrome-text);
}
.sidebar__brand .chev { color: var(--c-gold); width: 0.8em; height: 1.05em; }
.sidebar__brand small {
  display: block; font-family: var(--font-body); font-weight: 500;
  font-size: var(--fs-micro); letter-spacing: var(--ls-eyebrow); color: var(--chrome-muted);
}
.sidebar nav { flex: 1; padding: var(--sp-2) 0; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.62rem var(--sp-4);
  color: var(--chrome-muted); font-size: var(--fs-body); font-weight: 500;
  border-left: 3px solid transparent;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-left-color var(--dur-fast) var(--ease-out);
}
.sidebar nav a:hover { color: var(--chrome-text); background: var(--chrome-raised); border-left-color: rgba(196, 165, 116, 0.4); text-decoration: none; }
.sidebar nav a.is-active {
  color: var(--c-gold-bright); background: var(--chrome-raised);
  border-left-color: var(--c-gold); font-weight: 600;
}
.sidebar nav .nav-sep {
  margin: var(--sp-3) var(--sp-4) var(--sp-1);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--chrome-hairline);
  font-size: var(--fs-micro); text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow); color: var(--chrome-muted); opacity: 0.7;
}
.sidebar__cta { padding: var(--sp-3) var(--sp-4); }
.sidebar__footer {
  padding: var(--sp-4);
  border-top: 1px solid var(--chrome-hairline);
  font-size: 10px; text-transform: uppercase; letter-spacing: var(--ls-eyebrow);
  color: var(--chrome-muted);
}
.sidebar__footer img { height: 15px; display: block; margin-top: 6px; opacity: 0.55; transition: opacity var(--dur-fast); }
.sidebar__footer a:hover img { opacity: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: var(--fs-page-title); font-weight: 800; white-space: nowrap; }
.topbar__user { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-muted); font-size: var(--fs-small); }
/* Globale Suche mittig im Topbar */
.topbar__search { flex: 1; max-width: 420px; margin: 0 auto; }
.topbar__search input { width: 100%; height: var(--input-h); }
@media (max-width: 820px) { .topbar__search { display: none; } }

/* Handy-Menü-Button (Hamburger) — auf dem Desktop versteckt */
.nav-toggle {
  display: none; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border: 1px solid var(--hairline-2); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out);
}
.nav-toggle:hover { border-color: var(--accent-ui); }
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-open .nav-toggle__bars { background: transparent; }
.nav-open .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-open .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Verdunklung hinter dem Menü-Drawer — nur bei offenem Menü aktiv */
.nav-backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgba(17, 16, 16, 0.5);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-normal) var(--ease-out), visibility var(--dur-normal);
}
.nav-open .nav-backdrop { opacity: 1; visibility: visible; pointer-events: auto; }

/* Nur am PC sichtbar (auf dem Handy ausgeblendet) */
@media (max-width: 820px) { .pc-only { display: none !important; } }

/* Volle Breite neben der Sidebar — der Content füllt den Monitor.
   Formulare bleiben über ihre eigene Karten-max-width schmal. */
.content { padding: var(--sp-5); width: 100%; }

/* ---- Karten & Abschnitte -------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(233, 226, 211, 0.4); /* Kopf als eigene Bande, nicht nur eine Linie */
  border-bottom: 1px solid var(--hairline);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.card__head h2 { font-size: var(--fs-h2); font-weight: 700; }
/* „Nächster sinnvoller Schritt"-Karte: Gold-getönter Kopf (Grün bleibt echter Freigabe vorbehalten) */
.card--highlight { border-color: rgba(138, 107, 63, 0.4); }
.card--highlight .card__head { background: rgba(196, 165, 116, 0.16); }
.card--highlight .card__head h2 { color: var(--accent-text); }
.card__body { padding: var(--sp-4); }
.card--flush .card__body { padding: 0; }
/* Alarmkarte: Eskalationen (Rückfrage an GL/Zeichnung) müssen sofort ins Auge fallen */
.card--alert { border-color: #a8432a; }
.card--alert .card__head h2 { color: #a8432a; }

/* „Lieferung annehmen": große Kachel auf der Hallen-Startseite (Gold — der eine große Knopf) */
a.kpi--go {
  display: flex; flex-direction: column; justify-content: center; text-decoration: none;
  background: linear-gradient(160deg, #cfae7c, var(--c-gold, #c4a574));
  border-color: rgba(138, 107, 63, 0.55); color: #241c10;
  transition: transform var(--dur-normal) var(--ease-out-expo), box-shadow var(--dur-normal) var(--ease-out-expo);
}
a.kpi--go:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 10px 26px -12px rgba(28,25,19,.35)); text-decoration: none; }
a.kpi--go .kpi__value { color: #241c10; }
a.kpi--go .kpi__label { color: rgba(36, 28, 16, 0.75); font-weight: 800; }

/* Lieferliste: große Touch-Ziele — Lieferung auswählen und annehmen */
.deliveries { display: flex; flex-direction: column; gap: var(--sp-3); }
.delivery {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--sp-4); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit;
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-normal) var(--ease-out-expo);
}
.delivery:hover { border-color: var(--accent-ui); text-decoration: none; transform: translateY(-1px); }
.delivery__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.delivery__main strong { font-size: 1.05rem; }
.delivery__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.delivery__due { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.delivery__due.is-today { color: var(--st-green); }
.delivery__due.is-late { color: var(--st-terra); }
.delivery__due.is-open { color: var(--text-muted); font-weight: 600; }
.delivery__go { flex: none; }
@media (max-width: 640px) {
  .delivery { flex-wrap: wrap; }
  .delivery__meta { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .delivery__go { width: 100%; text-align: center; }
}

/* Recherche-Track: eigener Teal-Farbton, damit er sich klar von den Beschaffungen abhebt */
.card--research { border-color: rgba(30, 125, 103, 0.38); }
.card--research .card__head {
  background: rgba(30, 125, 103, 0.10);
  border-bottom-color: rgba(30, 125, 103, 0.22);
}
.card--research .card__head h2 { color: var(--st-teal); }

/* KPI-Kacheln */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
/* Kachel-Raster innerhalb einer Karte (z. B. Top-Kunden) — ohne Außenabstand */
.kpis--flat { margin-bottom: 0; }
/* Klickbare KPI-Kachel (z. B. "Offene Bedarfe" → gefilterte Liste) */
a.kpi--link { display: block; text-decoration: none; color: inherit;
  transition: border-color var(--dur-normal) var(--ease-out-expo), box-shadow var(--dur-normal) var(--ease-out-expo), transform var(--dur-normal) var(--ease-out-expo); }
a.kpi--link:hover { border-color: var(--accent-ui); transform: translateY(-2px); box-shadow: var(--shadow-md); }
a.kpi--link:hover .kpi__label { color: var(--accent-text); }

/* ---- Direkt-Aktionen auf der GL-Übersicht (groß, sofort erreichbar) ----- */
.quick-actions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-5);
}
.quick-action {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-5); border-radius: var(--r-md); text-decoration: none;
  border: 1px solid var(--hairline-2, rgba(22, 20, 15, 0.28)); background: var(--surface);
  transition: transform var(--dur-normal) var(--ease-out-expo),
              box-shadow var(--dur-normal) var(--ease-out-expo),
              border-color var(--dur-normal) var(--ease-out-expo);
}
.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -20px rgba(0, 0, 0, 0.45);
  border-color: var(--accent-ui);
}
.quick-action--primary {
  background: linear-gradient(135deg, var(--c-gold-bright, #dcbd8a), var(--c-gold, #c4a574));
  border-color: transparent; color: #111010;
}
.quick-action--primary:hover { box-shadow: 0 18px 40px -18px rgba(196, 165, 116, 0.6); }
.quick-action__plus {
  font-family: var(--font-display); font-weight: 900; font-size: 2.4rem; line-height: 1;
  color: #111010; flex: none;
}
.quick-action__icon { font-size: 1.9rem; flex: none; }
.quick-action__title {
  display: block; font-family: var(--font-display); font-weight: 800;
  font-size: 1.25rem; letter-spacing: -0.01em; color: var(--text);
}
.quick-action--primary .quick-action__title { color: #111010; }
.quick-action__sub { display: block; font-size: var(--fs-small); color: var(--text-muted); margin-top: 2px; }
.quick-action--primary .quick-action__sub { color: rgba(17, 16, 16, 0.7); }

/* ---- Freistehende Abschnitts-Überschrift (außerhalb von Karten) -------- */
.section-head {
  display: flex; align-items: baseline; gap: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-3);
}
.section-head h2 { margin: 0; font-size: 1.0625rem; }

/* ---- Top-Kunden: Marken-Kacheln (Charcoal-Chrome auf heller Fläche) ----
   Die Dualität der S+K-Marke als Blickfang: dunkle Kachel, Gold-Akzente,
   große Rang-Ziffer. Hover nur mit transform/shadow (compositor-friendly). */
.customer-tiles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
@media (max-width: 900px) { .customer-tiles { grid-template-columns: 1fr; } }
.customer-tile {
  position: relative; display: block; overflow: hidden; text-decoration: none;
  background: linear-gradient(145deg, #221f1b 0%, #1a1815 70%);
  color: #ede7db; border: 1px solid rgba(237, 231, 219, 0.13);
  border-radius: var(--r-md); padding: var(--sp-5) var(--sp-4) var(--sp-4);
  transition: transform var(--dur-normal) var(--ease-out-expo),
              box-shadow var(--dur-normal) var(--ease-out-expo),
              border-color var(--dur-normal) var(--ease-out-expo);
}
.customer-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(196, 165, 116, 0.55);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.55), 0 0 46px -14px rgba(196, 165, 116, 0.4);
}
.customer-tile__rank {
  position: absolute; top: -18px; right: 6px; line-height: 1;
  font-size: 108px; font-weight: 900; font-family: var(--font-display, inherit);
  color: rgba(196, 165, 116, 0.14); user-select: none; pointer-events: none;
}
.customer-tile__name {
  display: block; position: relative; font-family: var(--font-display, inherit);
  font-weight: 800; font-size: 1.4rem; letter-spacing: -0.01em; margin-bottom: var(--sp-2);
}
.customer-tile__stats { display: block; position: relative; color: #b5ac99; font-size: var(--fs-small); }
.customer-tile__volume {
  display: block; position: relative; margin-top: var(--sp-3);
  font-family: var(--font-display, inherit); font-weight: 700; font-size: 1.2rem;
  font-variant-numeric: tabular-nums; color: #dcbd8a;
}
.customer-tile__volume small { font-size: var(--fs-small); font-weight: 500; color: #b5ac99; }
.customer-tile__cta {
  display: block; position: relative; margin-top: var(--sp-3);
  font-size: var(--fs-small); font-weight: 600; color: #c4a574;
  opacity: 0; transform: translateX(-6px);
  transition: opacity var(--dur-fast) var(--ease-out-expo), transform var(--dur-fast) var(--ease-out-expo);
}
.customer-tile:hover .customer-tile__cta { opacity: 1; transform: none; }

/* ---- EILT: rote Zeilenmarkierung in Listen ------------------------------ */
/* Recherche-Zeilen: "hier muss noch rausgesucht werden" — teal, EILT (unten) gewinnt */
tr.row--research { background: rgba(46, 107, 92, 0.07); }
tr.row--research > td:first-child { box-shadow: inset 3px 0 0 #2e6b5c; }

tr.row--urgent { background: rgba(168, 67, 42, 0.06); }
tr.row--urgent > td:first-child { box-shadow: inset 3px 0 0 #a8432a; }

/* ---- Katalog-Maske: gebaut für hunderte Artikel ------------------------- */
.catalog-head { margin-bottom: var(--sp-3); }

/* Suche steht vor allem anderen — Tippen schlägt Blättern */
.catalog-search { position: relative; display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.catalog-search input { flex: 1; font-size: 1rem; padding: 12px var(--sp-4); }

.catalog-tabs { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.catalog-tab { cursor: pointer; font: inherit; font-size: var(--fs-small); font-weight: 600; }

/* Abschnitte: zusammengeklappt passt eine Gruppe auf eine Bildschirmhöhe */
.catalog-section { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); margin-bottom: var(--sp-3); overflow: hidden; }
.catalog-section > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; background: var(--surface-head);
  border-bottom: 1px solid transparent; }
.catalog-section[open] > summary { border-bottom-color: var(--hairline); }
.catalog-section > summary::-webkit-details-marker { display: none; }
.catalog-section > summary::before { content: ""; width: .5em; height: .5em; flex: none; margin-right: 2px;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg); transition: transform var(--dur-fast); }
.catalog-section[open] > summary::before { transform: rotate(45deg); }
.catalog-section__title { font-weight: 700; color: var(--text); }
.catalog-section__meta { display: inline-flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.catalog-section__picked { font-size: var(--fs-small); font-weight: 700; color: var(--accent-text); }
.catalog-section.has-picked > summary { background: rgba(138, 107, 63, 0.1); }
/* Gruppe ohne benannte Abschnitte: reine Liste, kein Kopf */
.catalog-section--plain > summary { display: none; }

/* Gruppen-Editor: Suchkopf und Sammelaktion für große Gruppen */
.pflege-kopf { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--hairline); }
.pflege-kopf input[type="search"] { flex: 1; min-width: 12rem; }
.pflege-kopf__zahl { font-size: var(--fs-small); font-weight: 700; color: var(--accent-text); margin-left: auto; }
.pflege-aktion { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--hairline); background: var(--surface-head); }
.pflege-aktion__feld { display: flex; gap: var(--sp-2); align-items: center; }
.pflege-aktion__feld input { width: 10rem; }
.pflege-aktion__weg { margin-left: auto; color: var(--st-terra, #9a3c22); }
.pflege-aktion button:disabled { opacity: .45; cursor: not-allowed; }

/* Bei aktiver Suche: woher stammt der Treffer? */
.catalog-group__label { font-size: var(--fs-small); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-text); margin: 0 0 var(--sp-2); }

@media (max-width: 700px) {
  /* Am Handy zählt jede Zeile: Kopf und Leiste schrumpfen, damit Artikel sichtbar bleiben */
  .catalog-head .card__body { padding: var(--sp-3); }
  .catalog-head .form-grid { gap: var(--sp-2); }
  .catalog-bar { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
  /* Notiz rutscht in eine eigene Zeile — bewusst dasselbe Feld, kein zweites (gleichnamige
     Felder überschreiben sich beim Absenden gegenseitig). */
  .catalog-bar__actions { flex-wrap: wrap; }
  .catalog-bar__note { flex-basis: 100%; width: auto; order: 2; }
}

/* Der Korb bleibt am unteren Rand stehen — man sieht immer, was zusammenkommt */
.catalog-bar { position: sticky; bottom: 0; z-index: 5; margin-top: var(--sp-4);
  background: var(--c-charcoal); color: var(--c-paper); border-radius: var(--r-md);
  box-shadow: 0 -6px 24px -12px rgba(22, 20, 15, .5); padding: var(--sp-3) var(--sp-4);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.catalog-bar__toggle { background: none; border: 0; color: inherit; font: inherit; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: baseline; gap: var(--sp-2); padding: 0; }
.catalog-bar__hint { font-size: var(--fs-small); font-weight: 500; opacity: .7; text-decoration: underline; }
.catalog-bar__list { flex-basis: 100%; order: 3; max-height: 34vh; overflow: auto;
  border-top: 1px solid rgba(255,255,255,.14); padding-top: var(--sp-2); }
.catalog-bar__item { display: flex; justify-content: space-between; gap: var(--sp-3);
  padding: 6px 0; font-size: var(--fs-small); border-bottom: 1px solid rgba(255,255,255,.08); }
.catalog-bar__item .linklike { color: var(--c-gold); }
.catalog-bar__actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }
.catalog-bar__note { width: 15rem; }
.catalog-bar__actions .btn--gold:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 700px) {
  .catalog-bar { padding: var(--sp-3); }
  .catalog-bar__actions { margin-left: 0; flex-basis: 100%; }
  .catalog-bar__note { flex: 1; width: auto; }
}

/* Katalog-Maske: die ganze Zeile ist die Trefferfläche — das Label füllt seine Zelle inklusive
   Innenabstand, der Rest der Zeile schaltet per Klick um (JS). */
.catalog tr { cursor: pointer; }
.catalog td:has(> label) { padding: 0; }
.catalog td > label { display: flex; align-items: center; min-height: var(--row-h); padding: 11px var(--sp-3); cursor: pointer; }
.catalog input[type="checkbox"], .catalog input[type="number"] { cursor: auto; }
/* Ankreuzfeld in Hausfarbe statt Browser-Blau. min-height muss zurückgesetzt werden, sonst zieht
   die Touch-Regel (min-height: 44px) das Kästchen zu einem Rechteck. Die Trefferfläche ist ohnehin
   die ganze Zeile. */
.catalog input[type="checkbox"] {
  width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--accent-ui);
}

/* Katalog-Maske: ausgewählte Zeile bekommt denselben Balken wie die Status-Zeilen —
   nötig, weil die Checkbox am Handy links aus dem Sichtfeld gescrollt sein kann. */
.catalog tr.is-selected { background: rgba(138, 107, 63, 0.08); }
.catalog tr.is-selected > td:first-child { box-shadow: inset 3px 0 0 var(--accent-ui); }

/* Klickbare Tabellenzeilen (data-href) — ganze Zeile führt zur Detailseite.
   Hover legt einen leisen Bronze-Balken links an (dieselbe Sprache wie row--urgent/research). */
tr[data-href] { cursor: pointer; }
tr[data-href]:not(.row--urgent):not(.row--research):hover > td:first-child { box-shadow: inset 3px 0 0 var(--accent-ui); }

/* Prominente Gesamtsumme im Freigabe-/Auslöse-Kontext */
.approve-total {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--sp-4); margin-bottom: var(--sp-4);
  background: var(--surface-head, #e9e2d3); border-radius: var(--r-md);
}
.approve-total__label {
  font-size: var(--fs-micro); text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow); color: var(--text-muted);
}
.approve-total__value {
  font-family: var(--font-display); font-weight: 850; font-variant-numeric: tabular-nums;
  font-size: 2.4rem; line-height: 1.05; letter-spacing: -0.01em; color: var(--text);
}
.approve-total--sm { padding: var(--sp-3); margin-bottom: var(--sp-3); }
.approve-total--sm .approve-total__value { font-size: 1.6rem; }
.approve-summary { margin-top: 0; }

/* Karte "Freigabe erteilt" — positiv/grün, klar sichtbar für den Einkauf */
.card--approved { border-color: rgba(61, 99, 48, 0.5); }
.card--approved .card__head { background: #e2ecd8; }
.card--approved .card__head h2 { color: #3d6330; }

.btn--lg { padding: 0.85rem 1.2rem; font-size: 1.0625rem; }

/* Betragsfeld mit €-Suffix */
.input-euro { position: relative; }
.input-euro input { padding-right: 2rem; }
.input-euro span {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-weight: 600;
}
/* Geldbetrag: der native Zahlen-Spinner läge genau unter dem €-Zeichen — ausblenden */
.input-euro input::-webkit-outer-spin-button,
.input-euro input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-euro input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* Such-Beleg in der Lieferantenliste ("warum gefunden") */
.match-reason { color: var(--accent-text) !important; }

/* ---- Sortierbare Spaltenköpfe ------------------------------------------ */
th .sort-link {
  color: inherit; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  transition: color var(--dur-fast) var(--ease-out-expo);
}
th .sort-link:hover { color: var(--accent-text); }
th .sort-link .sort-arrow { font-size: 9px; opacity: 0.4; }
th .sort-link.is-active { color: var(--accent-text); }
th .sort-link.is-active .sort-arrow { opacity: 1; }

/* ---- Segment-Schalter (Verbindlichkeit): grün ↔ rot, gleitender Daumen -- */
.seg-switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  min-height: 40px; padding: 3px;
  background: var(--surface-head, #e9e2d3);
  border: 1px solid var(--hairline-2, rgba(22, 20, 15, 0.28));
  border-radius: var(--r-pill, 999px);
  transition: opacity var(--dur-fast) var(--ease-out-expo);
}
.seg-switch input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.seg-switch__opt {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 10px; border-radius: var(--r-pill, 999px);
  font-size: var(--fs-small); font-weight: 600; text-align: center;
  color: var(--text-muted); cursor: pointer; user-select: none;
  transition: color var(--dur-fast) var(--ease-out-expo);
}
/* Gleitender Daumen — Farbe folgt der Auswahl (grün = Alternative, rot = verbindlich) */
.seg-switch__thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px); border-radius: var(--r-pill, 999px);
  background: #e2ecd8; border: 1px solid rgba(61, 99, 48, 0.4);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.15));
  transition: transform var(--dur-normal) var(--ease-out-expo),
              background-color var(--dur-normal) var(--ease-out-expo),
              border-color var(--dur-normal) var(--ease-out-expo);
}
#binding-exact:checked ~ .seg-switch__thumb {
  transform: translateX(100%);
  background: #f4ded4; border-color: rgba(140, 58, 36, 0.45);
}
#binding-alt:checked ~ label[for="binding-alt"] { color: #3d6330; }
#binding-exact:checked ~ label[for="binding-exact"] { color: #8c3a24; }
.seg-switch:has(input:focus-visible) { outline: 2px solid var(--focus-ring, #8a6b3f); outline-offset: 2px; }

/* Dreier-Variante (Priorität): Normal neutral · Hoch amber · EILT gefüllt rot */
.seg-switch--3 { grid-template-columns: repeat(3, 1fr); }
.seg-switch--3 .seg-switch__thumb {
  width: calc((100% - 6px) / 3);
  background: #fff; border-color: var(--hairline-2, rgba(22, 20, 15, 0.28));
}
#prio-normal:checked ~ label[for="prio-normal"] { color: var(--text); }
#prio-hoch:checked ~ .seg-switch__thumb {
  transform: translateX(100%);
  background: #f3e6c8; border-color: rgba(122, 90, 16, 0.4);
}
#prio-hoch:checked ~ label[for="prio-hoch"] { color: #7a5a10; }
#prio-eilt:checked ~ .seg-switch__thumb {
  transform: translateX(200%);
  background: #a8432a; border-color: #a8432a; /* EILT: einziger gefüllter Zustand = Alarm */
}
#prio-eilt:checked ~ label[for="prio-eilt"] { color: #f7ece6; }
.seg-switch.is-disabled { opacity: 0.45; pointer-events: none; }
/* Gesperrt (keine Firma eingetragen): Daumen neutral grau — erst mit Firma wird's grün/rot */
.seg-switch.is-disabled .seg-switch__thumb {
  background: rgba(22, 20, 15, 0.07);
  border-color: var(--hairline, rgba(22, 20, 15, 0.14));
}
.seg-switch.is-disabled .seg-switch__opt,
.seg-switch.is-disabled #binding-alt:checked ~ label[for="binding-alt"],
.seg-switch.is-disabled #binding-exact:checked ~ label[for="binding-exact"] {
  color: var(--text-muted);
}
.kpi {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.kpi__value { font-family: var(--font-display); font-weight: 800; font-size: 1.85rem; line-height: 1.05;
  letter-spacing: -0.015em; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi__label { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: var(--ls-eyebrow); color: var(--text-muted); margin-top: var(--sp-1); }
/* Alarm: getönte Fläche statt nur roter Rahmen — integrierter, editorialer */
.kpi--alert { border-color: rgba(168, 67, 42, 0.5); background: rgba(168, 67, 42, 0.05); }
.kpi--alert .kpi__value { color: #a8432a; }
/* KPI-Kachel als Aktionsfläche (Melder-Startseite: großer Melde-Button) */
.kpi--cta { display: flex; align-items: center; justify-content: center; }
.mt-2 { margin-top: var(--sp-4); }

/* ---- Tabellen: Hairlines, kein Zebra, Hover-Row ---------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
table.data th {
  text-align: left; font-size: var(--fs-micro); font-weight: 650;
  text-transform: uppercase; letter-spacing: var(--ls-eyebrow);
  color: var(--text-muted); padding: var(--sp-2) var(--sp-3);
  background: var(--surface-head); position: sticky; top: 0;
  border-bottom: 1px solid var(--hairline-2); white-space: nowrap;
}
table.data td {
  padding: 11px var(--sp-3); height: var(--row-h);
  border-bottom: 1px solid var(--hairline); vertical-align: middle;
}
table.data tbody tr { transition: background var(--dur-fast); }
table.data tbody tr:hover { background: var(--surface-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data a { font-weight: 600; }
/* Spalten-Hierarchie: primäre Identifikation fett, Meta gedämpft */
table.data td.primary { font-weight: 600; color: var(--text); }
table.data td.meta { color: var(--text-muted); }
td .sub { display: block; font-size: var(--fs-small); color: var(--text-muted); margin-top: 2px; }

.empty {
  padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--text-muted);
}
.empty .chev { color: var(--hairline-2); width: 1.4em; height: 1.9em; margin-bottom: var(--sp-2); }
.empty h3 { font-size: var(--fs-h2); color: var(--text); margin-bottom: var(--sp-1); }

/* ---- Status-Badges: Dot + Label, nie Farbe allein -------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-small); font-weight: 600; white-space: nowrap;
  border: 1px solid;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--neutral { color: var(--st-neutral); background: rgba(22, 20, 15, 0.06); border-color: rgba(92, 86, 72, 0.35); }
.badge--amber   { color: var(--st-amber); background: #f5e7c6; border-color: rgba(152, 104, 9, 0.32); }
.badge--blue    { color: var(--st-blue); background: #dce7f1; border-color: rgba(48, 90, 130, 0.32); }
.badge--azure   { color: var(--st-azure); background: #dbebf7; border-color: rgba(63, 123, 171, 0.34); }
.badge--teal    { color: var(--st-teal); background: #d6ebe3; border-color: rgba(30, 125, 103, 0.32); }
.badge--green   { color: var(--st-green); background: #e0eed3; border-color: rgba(64, 122, 50, 0.32); }
.badge--terra   { color: var(--st-terra); background: #f5ddd2; border-color: rgba(154, 60, 34, 0.34); }
.badge--alert   { color: #f7ece6; background: #a8432a; border-color: #a8432a; } /* einziger gefüllter Badge = Alarm */
.badge--gold    { color: var(--st-gold); background: rgba(196, 165, 116, 0.18); border-color: rgba(138, 107, 63, 0.45); } /* "deine Anforderung" */

/* ---- Buttons: Gold = Interaktion, ein Gold pro Screen ----------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--input-h); padding: 0 1rem;
  font-family: var(--font-body); font-size: var(--fs-body); font-weight: 650;
  border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0.5px) scale(0.985); }
.btn--gold { background: var(--c-gold); color: var(--c-ink); box-shadow: 0 1px 2px rgba(196, 165, 116, 0.4); }
.btn--gold:hover { background: var(--c-gold-bright); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(196, 165, 116, 0.7); }
.btn--gold:active { box-shadow: 0 1px 2px rgba(196, 165, 116, 0.4); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--hairline-2); }
.btn--ghost:hover { border-color: var(--accent-ui); color: var(--accent-text); background: rgba(138, 107, 63, 0.05); }
/* Ghost-Buttons auf dem dunklen Sidebar-Chrome brauchen helle Farben */
.sidebar .btn--ghost { color: #ede7db; border-color: rgba(237, 231, 219, 0.28); }
.sidebar .btn--ghost:hover { color: #dcbd8a; border-color: #c4a574; background: rgba(237, 231, 219, 0.06); }
.btn--danger { background: transparent; color: #8c3a24; border-color: rgba(140, 58, 36, 0.4); }
.btn--danger:hover { background: #f4ded4; border-color: rgba(140, 58, 36, 0.6); }
.btn--sm { height: 30px; padding: 0 0.65rem; font-size: var(--fs-small); }
.btn--block { width: 100%; }

/* ---- Formulare -------------------------------------------------------- */
.field { margin-bottom: var(--sp-4); }
.field label {
  display: block; margin-bottom: var(--sp-1);
  font-size: var(--fs-small); font-weight: 600; color: var(--text);
}
.field .hint { font-size: var(--fs-small); color: var(--text-muted); margin-top: var(--sp-1); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="url"], input[type="search"],
select, textarea {
  width: 100%; height: var(--input-h); padding: 0 var(--sp-3);
  font: inherit; color: var(--text);
  background: var(--surface-field); border: 1px solid var(--hairline-2); border-radius: var(--r-sm);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
textarea { height: auto; min-height: 84px; padding: var(--sp-2) var(--sp-3); resize: vertical; }
/* Eigener Select-Pfeil (Chevron-Ton) statt OS-Default */
select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%238a6b3f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--sp-3) center;
}
::placeholder { color: var(--text-muted); opacity: 0.6; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.5; cursor: pointer; }
/* Native Zahlen-Spinner (hoch/runter-Pfeile) überall entfernen — benutzt eh niemand */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-ui); outline: none;
  box-shadow: 0 0 0 3px rgba(138, 107, 63, 0.13);
}
.field .error { color: #a8432a; font-size: var(--fs-small); margin-top: var(--sp-1); }
/* Pflichtfeld-Indikator als gestaltetes Element statt Roh-Sternchen */
.req { color: var(--accent-ui); margin-left: 3px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--sp-4); }
.form-actions { display: flex; gap: var(--sp-3); align-items: center; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--hairline); }
.checkbox { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-body); }
.checkbox input { width: auto; height: auto; accent-color: var(--accent-ui); }

/* Button, der wie ein Link aussieht (z. B. „Schnell anlegen“ im Formular) */
.linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent-text); font: inherit; text-decoration: underline;
}
.linklike:hover { color: var(--accent-ui); }
/* Destruktiver Link (z. B. „löschen") — Terra statt reserviertem Alarm-Rot */
.linklike--danger { color: #8c3a24; }
.linklike--danger:hover { color: #a8432a; }

/* ---- Dialog (Popup, natives <dialog>) --------------------------------- */
.dialog {
  border: 1px solid var(--hairline-2); border-radius: var(--r-md); padding: 0;
  background: var(--surface); color: var(--text);
  width: min(680px, calc(100vw - 2 * var(--sp-4))); box-shadow: var(--shadow-lg, 0 40px 90px -40px rgba(0,0,0,.5));
}
.dialog::backdrop { background: rgba(17, 16, 16, 0.55); }
.dialog__inner { display: block; }
.dialog__actions {
  display: flex; gap: var(--sp-3); align-items: center;
  padding: var(--sp-4); border-top: 1px solid var(--hairline);
}
.form-grid--2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3) var(--sp-4); }
.field--full { grid-column: 1 / -1; }

/* ---- Lieferant-Auswahl-Popup: Suche + Kategorie-Filter ------------------ */
.dialog--picker[open] {
  display: flex; flex-direction: column;
  width: min(600px, calc(100vw - 2 * var(--sp-4)));
  max-height: min(92vh, 900px);
  max-height: min(92dvh, 900px); /* dvh: Bildschirmtastatur wird eingerechnet */
}
.dialog--picker .card__head { flex: none; }
.picker__count { font-size: var(--fs-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.picker__tools {
  flex: none; display: grid; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--hairline);
}
.picker__cats { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.cat-chip {
  padding: 5px 12px; border-radius: var(--r-pill); cursor: pointer;
  font: inherit; font-size: var(--fs-small); font-weight: 600; color: var(--text-muted);
  background: #fff; border: 1px solid var(--hairline-2);
  transition: color var(--dur-fast), border-color var(--dur-fast), background-color var(--dur-fast);
}
.cat-chip:hover { color: var(--text); border-color: var(--accent-ui); }
.cat-chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.cat-chip.is-active { background: var(--c-charcoal); color: var(--c-paper); border-color: var(--c-charcoal); }
.picker__list {
  list-style: none; margin: 0; padding: var(--sp-2);
  overflow-y: auto; flex: 1;
  /* Mindesthöhe: auch auf kleinen Fenstern mehrere Zeilen sichtbar, nie Kopf/Fuß verdrängen */
  min-height: min(340px, 45vh);
  min-height: min(340px, 45dvh);
  overscroll-behavior: contain; /* kein Scroll-Chaining auf die Seite dahinter */
}
.picker__item {
  display: grid; grid-template-columns: 1fr auto; column-gap: var(--sp-3);
  align-items: center; width: 100%; padding: var(--sp-2) var(--sp-3);
  text-align: left; background: none; border: none; border-radius: var(--r-sm);
  cursor: pointer; font: inherit;
  transition: background-color var(--dur-fast);
}
.picker__item:hover { background: var(--surface-hover); }
.picker__item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; background: var(--surface-hover); }
.picker__item .badge { grid-column: 2; grid-row: 1 / 3; }
.picker__name { font-weight: 600; }
.picker__meta { font-size: var(--fs-small); color: var(--text-muted); }
/* Lange Komposita ohne Leerzeichen dürfen die Liste nicht horizontal aufreißen */
.picker__name, .picker__meta { min-width: 0; overflow-wrap: anywhere; }
.picker__item.is-selected { background: rgba(196, 165, 116, 0.16); box-shadow: inset 3px 0 0 var(--accent-ui); }
.picker__empty { padding: var(--sp-5) var(--sp-4); text-align: center; color: var(--text-muted); }
.dialog--picker .dialog__actions { flex: none; justify-content: space-between; }

/* ---- Bestätigungs-Dialog (gebrandet, ersetzt das native confirm) ------- */
.dialog--confirm {
  width: min(430px, calc(100vw - 2 * var(--sp-4)));
  box-shadow: 0 44px 100px -34px rgba(22, 20, 15, 0.6);
}
.dialog--confirm::backdrop { background: rgba(17, 16, 16, 0.5); }
.dialog--confirm[open] {
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity var(--dur-normal) var(--ease-out), transform var(--dur-normal) var(--ease-out);
}
.dialog--confirm.is-open { opacity: 1; transform: none; }
.confirm { padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.confirm__mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(196, 165, 116, 0.20); color: var(--accent-ui);
  font-size: 19px; margin-bottom: var(--sp-3);
}
.confirm__mark.is-danger { background: rgba(140, 58, 36, 0.13); color: #8c3a24; }
.confirm__msg {
  margin: 0; font-size: 1.12rem; font-weight: 640; line-height: 1.45;
  letter-spacing: -0.01em; color: var(--text); text-wrap: balance;
}
.confirm__sub { margin: var(--sp-2) 0 0; color: var(--text-muted); font-size: var(--fs-small); line-height: 1.5; }
.confirm__actions { display: flex; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-5); }
.confirm__actions .btn { min-width: 112px; justify-content: center; }
@media (prefers-reduced-motion: reduce) {
  .dialog--confirm[open], .dialog--confirm.is-open { transition: none; opacity: 1; transform: none; }
  /* Keine Bewegungs-Transforms bei reduzierter Bewegung — nur Farb-/Schatten-Feedback bleibt */
  .btn, .quick-action, .customer-tile, a.kpi--link { transition-property: background-color, color, border-color, box-shadow; }
  .btn:hover, .btn:active, .quick-action:hover, .customer-tile:hover, a.kpi--link:hover { transform: none; }
}

/* ---- Flash & Hilfen ---------------------------------------------------- */
.flash {
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
  background: #e2ecd8; color: #3d6330; border: 1px solid rgba(61, 99, 48, 0.35);
  border-radius: var(--r-md); font-weight: 500;
}
.flash--error { background: #f4ded4; color: #8c3a24; border-color: rgba(140, 58, 36, 0.35); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-small); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-5); }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
/* Rechtsbündige, schmale Aktions-Spalte in Tabellen (nicht .num zweckentfremden) */
td.col-action, th.col-action { text-align: right; width: 1%; white-space: nowrap; }
.flex { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); align-items: start; }
/* Grid-Kinder dürfen unter ihre Inhaltsbreite schrumpfen — sonst sprengt eine breite
   Tabelle die Spalte (statt dass .table-wrap intern scrollt) und die Seite wackelt seitlich. */
.grid-2 > * { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Phasen-Chips der Vorgangsliste */
.chip { display: inline-flex; align-items: center; gap: var(--sp-1); text-decoration: none;
  border: 1px solid var(--hairline-2); background: var(--surface); color: var(--text-muted);
  border-radius: var(--r-pill); padding: 6px 13px; font-size: var(--fs-small); font-weight: 600; }
.chip:hover { border-color: var(--accent-ui); color: var(--text); text-decoration: none; }
.chip.is-on { background: var(--c-charcoal); color: var(--c-paper); border-color: var(--c-charcoal); }
.chip__n { opacity: .7; font-weight: 500; }
.chip.is-on .chip__n { opacity: .85; }

/* Gebrandeter Paginator */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }
.pagination__info { font-size: var(--fs-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pagination__pages { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.pagination__pages .chip { min-width: 34px; justify-content: center; }
.pagination__gap { color: var(--text-muted); padding: 0 var(--sp-1); }
.btn.is-disabled { opacity: 0.4; pointer-events: none; box-shadow: none; }

/* ---- Dezenter Aufklapper (z. B. „Projekt übernehmen") ------------------ */
.disclosure { border-bottom: 1px solid var(--hairline); }
.disclosure > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-small); font-weight: 600; color: var(--accent-text);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
  content: ''; width: 0.55em; height: 0.7em; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath d='M1.5 1 6.5 6 1.5 11' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath d='M1.5 1 6.5 6 1.5 11' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform var(--dur-fast) var(--ease-out);
}
.disclosure[open] > summary::before { transform: rotate(90deg); }
.disclosure > summary:hover { color: var(--accent-ui); background: rgba(138, 107, 63, 0.05); }
.disclosure > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; border-radius: 2px; }
.disclosure__panel { padding: 0 var(--sp-4) var(--sp-4); animation: disclosure-in var(--dur-normal) var(--ease-out); }
@keyframes disclosure-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .disclosure__panel { animation: none; }
  .disclosure > summary::before { transition: none; }
}

/* ---- Datei-Upload (Beleg): gestylt + Kamera-Scan auf Touch --------------- */
.file-field { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.file-field__row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
/* Labels sind hier Buttons — die .field-label-Regel (display:block, margin) darf nicht durchschlagen */
.file-field label { margin: 0; }
.file-field .btn { display: inline-flex; cursor: pointer; }
.file-field input.sr-only:focus-visible + label { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.file-field__name { font-size: var(--fs-small); color: var(--text-muted); overflow-wrap: anywhere; }
.file-field__name.has-file { color: var(--accent-text); font-weight: 600; }
.file-field .file-field__cam { display: none; gap: 6px; } /* Kamera-Button nur auf Touch-Geräten (Handy/Tablet) */
.file-field__hint { font-size: var(--fs-small); color: var(--text-muted); }
/* Rückmeldung der Link-Erkennung: Treffer in Bestätigungsfarbe, Konflikt in Warnfarbe */
.hint--ok { color: var(--accent-text); font-weight: 600; }
.hint--warn { color: var(--st-terra, #9a3c22); font-weight: 600; }
/* Kurz aufleuchten, was die Erkennung selbst gesetzt hat */
.is-autofilled { animation: sk-autofill 2.4s ease-out; }
@keyframes sk-autofill {
  0%, 55% { background: rgba(138, 107, 63, 0.16); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .is-autofilled { animation: none; box-shadow: inset 0 0 0 2px var(--accent-ui); } }
.file-field.is-dropping { outline: 2px dashed var(--accent-ui); outline-offset: 6px; border-radius: 8px; }
.file-field__cam-icon {
  width: 15px; height: 13px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20'%3E%3Cpath fill-rule='evenodd' d='M8.2 0 6.8 2H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-4.8L15.8 0zM12 6a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 2.2a2.8 2.8 0 1 1 0 5.6 2.8 2.8 0 0 1 0-5.6z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20'%3E%3Cpath fill-rule='evenodd' d='M8.2 0 6.8 2H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-4.8L15.8 0zM12 6a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 2.2a2.8 2.8 0 1 1 0 5.6 2.8 2.8 0 0 1 0-5.6z'/%3E%3C/svg%3E") center/contain no-repeat;
}
/* „Foto scannen" auf Touch-Geräten ODER schmalem Viewport (Handy) zeigen */
@media (pointer: coarse), (max-width: 820px) { .file-field .file-field__cam { display: inline-flex; } }

/* ---- Status-Timeline (Statusprotokoll) --------------------------------- */
/* Editorial: farbiger Knoten je Status auf einer durchgehenden Linie, farbiges Label,
   Kommentar als leichte Notiz, aktueller (oberster) Schritt betont. --st = Statusfarbe. */
.timeline { list-style: none; margin: 0; padding: var(--sp-5) var(--sp-4) var(--sp-5) var(--sp-5); }
.timeline__item { --st: var(--text-muted); position: relative; padding: 0 0 var(--sp-5) calc(var(--sp-4) + 6px); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { content: ''; position: absolute; left: 6px; top: 9px; bottom: 0; width: 2px; background: var(--hairline); }
.timeline__item:last-child::before { display: none; }
.timeline__node {
  position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--st); box-shadow: 0 0 0 3px var(--surface); /* Halo trennt Knoten von der Linie */
}
.timeline__item.is-current .timeline__node { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px rgba(138, 107, 63, 0.22); }
.timeline__body { display: flex; flex-direction: column; gap: 2px; }
.timeline__label { font-weight: 650; font-size: var(--fs-body); color: var(--st); letter-spacing: -0.005em; }
.timeline__item.is-current .timeline__label { font-weight: 750; }
.timeline__meta { font-size: var(--fs-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline__comment {
  margin: 5px 0 0; padding-left: var(--sp-3); border-left: 2px solid var(--hairline-2);
  color: var(--text-muted); font-size: var(--fs-small); line-height: 1.5;
}
/* Statusfarben aus den zentralen Tokens (Badge + Timeline synchron) */
.timeline__item.st-neutral { --st: var(--st-neutral); }
.timeline__item.st-amber   { --st: var(--st-amber); }
.timeline__item.st-blue    { --st: var(--st-blue); }
.timeline__item.st-azure   { --st: var(--st-azure); }
.timeline__item.st-teal    { --st: var(--st-teal); }
.timeline__item.st-green   { --st: var(--st-green); }
.timeline__item.st-terra   { --st: var(--st-terra); }
.timeline__item.st-alert   { --st: #a8432a; }
.timeline__item.st-gold    { --st: var(--st-gold); }

/* Filterleiste */
.filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--sp-4); }
.filters select, .filters input { width: auto; min-width: 140px; }
/* Checkbox-Filter ("nur offene"): kompakte Pille statt gestrecktem 140px-Kasten */
.filters .checkbox {
  min-height: var(--input-h); padding: 0 var(--sp-3);
  background: #fff; border: 1px solid var(--hairline-2); border-radius: var(--r-sm);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.filters .checkbox:hover { border-color: var(--accent-ui); }
.filters .checkbox input { min-width: 0; min-height: 0; width: 16px; height: 16px; flex: none; }

/* ---- Login: die einzige Fläche mit voller Marken-Dramaturgie ----------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--c-charcoal); color: var(--chrome-text); padding: var(--sp-5);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; inset: -10% -30% auto auto;
  width: 55vmin; height: 74vmin; opacity: 0.05;
  background: var(--c-gold);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 864 1166'%3E%3Crect width='26' height='1166'/%3E%3Cpath d='M340 0 H864 L586 385 L847 781 H322 L61 385 Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 864 1166'%3E%3Crect width='26' height='1166'/%3E%3Cpath d='M340 0 H864 L586 385 L847 781 H322 L61 385 Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.login-card { width: 100%; max-width: 380px; position: relative; }
.login-card .eyebrow { color: var(--c-gold); margin-bottom: var(--sp-2); }
.login-card .eyebrow .chev { color: var(--c-gold); }
.login-card h1 {
  font-size: 2rem; font-weight: 850; text-transform: uppercase;
  letter-spacing: -0.01em; margin-bottom: var(--sp-5); color: var(--chrome-text);
}
.login-card label { color: var(--chrome-muted); }
.login-card input {
  background: var(--chrome-raised); border-color: rgba(237, 231, 219, 0.22); color: var(--chrome-text);
}
.login-card input:focus { border-color: var(--c-gold-bright); }
.login-card .error { color: #e08d77; }
.login-card footer {
  margin-top: var(--sp-6); padding-top: var(--sp-4);
  border-top: 1px solid var(--chrome-hairline);
  font-size: 10px; text-transform: uppercase; letter-spacing: var(--ls-eyebrow); color: var(--chrome-muted);
}
.login-card footer img { height: 15px; display: block; margin-top: 6px; opacity: 0.55; }

/* ---- Handy: Off-Canvas-Menü + kompaktes Layout -------------------------- */
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .topbar { position: sticky; top: 0; z-index: 100; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
  .topbar h1 { flex: 1; min-width: 0; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; }
  .topbar__user > span { display: none; } /* Nutzername weg — der „Abmelden"-Knopf bleibt */

  /* Sidebar wird zum Drawer, der von links einschiebt — Inhalt bleibt vertikal (wie am PC) */
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 200;
    width: min(280px, 86vw); height: 100vh; height: 100dvh; overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--dur-normal) var(--ease-out);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.55);
  }
  .nav-open .sidebar { transform: none; }
  .nav-open { overflow: hidden; } /* Body-Scroll sperren, solange das Menü offen ist */

  .content { padding: var(--sp-4); }
  /* Touch-Targets + iOS-Zoom-Schutz (16px) fürs 30-Sekunden-Formular */
  input, select, textarea, .btn { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .form-grid { grid-template-columns: 1fr; }

  /* Kacheln kompakt, Marken-Kacheln & Direkt-Aktionen einspaltig */
  .kpis { grid-template-columns: 1fr 1fr; }
  .customer-tiles, .quick-actions { grid-template-columns: 1fr; }
}

/* Gruppen-Editor: schmale Displays zeigen Abschnitt und Menge unter dem Artikelnamen,
   damit die Tabelle nicht seitlich aus dem Bild läuft. */
.pflege-meta { display: none; }

@media (max-width: 640px) {
    .pflege-spalte { display: none; }
    .pflege-meta {
        display: block;
        margin-top: 0.15rem;
        font-size: 0.8rem;
        color: var(--text-muted);
    }
}

/* Deaktivierte Knöpfe: ohne eigenen Stil sieht ein gesperrter Gold-Knopf voll bedienbar aus */
.btn[disabled], .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Kontokatalog: lange Anmeldenamen umbrechen lassen und die beiden Aktionen stapeln,
   damit die Tabelle in der halben Seite bleibt statt seitlich wegzulaufen. */
.konten__login { overflow-wrap: anywhere; min-width: 8rem; }
.konten__meta { display: none; }

@media (max-width: 640px) {
    .konten__login { display: none; }
    .konten__meta {
        display: block;
        margin-top: 0.15rem;
        font-size: 0.8rem;
        color: var(--text-muted);
        overflow-wrap: anywhere;
    }
}
.konten__aktionen {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

/* Beleg-Viewer: Rechnung im System ansehen statt herunterladen (Krey 29.08.2026) */
.beleg-viewer {
    width: min(1100px, 94vw);
    height: min(88vh, 1000px);
    height: min(88dvh, 1000px); /* iOS: vh meint den Viewport ohne Leisten */
    max-width: none;
    max-height: 100dvh;
    padding: 0;
    border: 1px solid var(--hairline-2);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    overflow: hidden;
}
.beleg-viewer::backdrop { background: rgba(17, 16, 16, 0.55); } /* gleicher Ton wie die anderen Dialoge */
.beleg-viewer[open] { display: flex; flex-direction: column; }

.beleg-viewer__kopf,
.beleg-viewer__fuss {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-head);
    flex: 0 0 auto;
}
.beleg-viewer__kopf { border-bottom: 1px solid var(--hairline-2); }
.beleg-viewer__fuss { border-top: 1px solid var(--hairline-2); flex-wrap: wrap; }
.beleg-viewer__titel { min-width: 0; }
/* .sub ist projektweit nur innerhalb von Tabellenzellen gestaltet — hier ausschreiben */
.beleg-viewer__titel .sub {
    display: block;
    font-size: var(--fs-small);
    color: var(--text-muted);
    margin-top: 2px;
}
.beleg-viewer__meldung {
    margin: 0;
    padding: var(--sp-2) var(--sp-4);
    background: var(--surface-head);
    border-bottom: 1px solid var(--hairline-2);
    font-size: var(--fs-small);
}
.beleg-viewer__kopfaktionen,
.beleg-viewer__blaettern,
.beleg-viewer__werkzeuge {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.beleg-viewer__buehne {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: block;
    background: var(--app-bg);
    padding: var(--sp-3);
    text-align: center;
}
/* margin:auto statt Flex-Zentrierung: ein gezoomter Beleg bleibt so nach LINKS und OBEN
   scrollbar — bei zentrierten Flex-Kindern schneidet der Browser diese Seite ab. */
.beleg-viewer__bild,
.beleg-viewer__pdf { margin: auto; }
.beleg-viewer__bild {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 150ms ease;
}
.beleg-viewer__bild.is-zoom {
    max-width: none;
    max-height: none;
    width: auto;
    cursor: zoom-out;
}
.beleg-viewer__pdf { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.beleg-viewer__hinweis { margin: 0; padding: var(--sp-4); color: var(--text-muted); }
/* Der Ladehinweis steht mitten auf der Bühne, ohne den Rahmen darunter zu verdrängen */
.beleg-viewer__hinweis--laedt {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.beleg-viewer__buehne { position: relative; }

@media (max-width: 820px), (max-height: 560px) {
    .beleg-viewer {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        border: 0;
    }
    .beleg-viewer__fuss { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .beleg-viewer__bild { transition: none; }
}

/* Rechnungsliste: Ansehen und Freigeben untereinander statt nebeneinander —
   nebeneinander sprengen sie die Tabelle. */
.rechnung-aktionen {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}
.rechnung-aktionen .btn { white-space: nowrap; }
/* Erledigte Schritte im Rechnungs-Ablauf: stille Zeile mit Haken statt Knopf */
.ablauf-schritt {
    font-size: var(--fs-small);
    color: var(--text-muted);
    white-space: nowrap;
}
.ablauf-schritt::before {
    content: '✓ ';
    color: var(--st-green);
}

/* Kategorien & Einheiten (Systemverwaltung): zwei ruhige Listen mit je EINEM Speichern.
   Die Spaltenüberschrift trägt die Bedeutung, die Zeile nur noch den Haken. */
.listen-hinweis {
    margin: 0;
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-small);
    color: var(--text-muted);
    line-height: 1.55;
    border-bottom: 1px solid var(--hairline);
}
.listen-hinweis strong { color: var(--text); font-weight: 600; }
.listen-fehler { margin: var(--sp-3) var(--sp-4) 0; }

.liste-pflege input[type="text"] { margin: 0; }
.liste-pflege__schalter { text-align: center; white-space: normal; width: 3.5rem; }
/* min-height:0 muss sein: die Touch-Regel des Projekts (44 px ab 820 px) zöge den Haken
   sonst zu einem hohen schmalen Streifen in die Länge. */
.liste-pflege__schalter input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    min-height: 0;
    margin: 0;
    accent-color: var(--accent-ui);
}
/* Stillgelegt: gedämpft, aber ohne opacity — die frisst sonst auch den Kontrast der
   Bedienelemente und des Fokusrings. */
.liste-pflege tr.is-stillgelegt { background: var(--surface-head); }
.liste-pflege tr.is-stillgelegt td { color: var(--text-muted); }
.liste-pflege tr.is-stillgelegt input[type="text"] { font-style: italic; color: var(--text-muted); }

/* Gesperrte Felder sollen auch aussehen wie gesperrt (Grundeinheit „Stk") */
.liste-pflege input[readonly] {
    background: var(--surface-head);
    border-style: dashed;
    color: var(--text-muted);
    cursor: default;
}

/* Wie oft die Kategorie/Einheit schon gebucht ist — ruhiger als eine nackte Zahl */
.verwendung {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--surface-hover);
    font-size: var(--fs-small);
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

.listen-neu {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--hairline);
}
.listen-neu > label { display: block; margin-bottom: var(--sp-1); font-weight: 600; font-size: var(--fs-small); }
.listen-neu input[type="text"] { margin: 0; }

.listen-fuss {
    display: flex;
    justify-content: flex-end;
    padding: var(--sp-3) var(--sp-4);
}

/* Kopfzeilen der Schalterspalten: lang auf dem Schreibtisch, kurz auf dem Handy —
   sonst nimmt „In der Auswahl" mehr Platz als der Name, um den es geht. */
.liste-pflege .kurz { display: none; }

@media (max-width: 760px) {
    .liste-pflege .lang { display: none; }
    .liste-pflege .kurz { display: inline; }
    .liste-pflege__zahl { display: none; }
    .liste-pflege__schalter { width: 3rem; }
}

/* Betriebsblick (Airoflex): Statusampel und Fehlerbuch */
.ampel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1px;
    background: var(--hairline);
    border-top: 1px solid var(--hairline);
}
.ampel__feld { padding: var(--sp-3) var(--sp-4); background: var(--surface); }
/* Die Ampel ist letztes Kind der Karte und malt flächig — sonst stünden ihre Kanten
   über die abgerundeten Kartenecken hinaus. */
.ampel { border-radius: 0 0 var(--r-md) var(--r-md); overflow: hidden; }
.ampel__kopf { display: flex; align-items: center; gap: 0.5rem; }
.ampel__punkt {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--st-neutral);
}
.ampel__feld--gut .ampel__punkt { background: var(--st-green); }
.ampel__feld--warnung .ampel__punkt { background: var(--st-amber); }
.ampel__feld--stoerung .ampel__punkt { background: var(--st-terra); }
.ampel__feld--stoerung { background: color-mix(in srgb, var(--st-terra) 7%, var(--surface)); }
.ampel__feld--warnung { background: color-mix(in srgb, var(--st-amber) 7%, var(--surface)); }
.ampel__wert {
    margin-top: 0.35rem;
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}
.ampel__hinweis {
    margin: 0.35rem 0 0;
    font-size: var(--fs-small);
    color: var(--text-muted);
    line-height: 1.5;
}

.zahl--warn { color: var(--st-terra); }
tr.is-erledigt td { color: var(--text-muted); }
.fehler__spur summary { cursor: pointer; color: var(--accent-text); }
.fehler__spur pre {
    margin: var(--sp-2) 0 0;
    padding: var(--sp-2);
    background: var(--surface-head);
    border-radius: var(--r-sm, 6px);
    font-size: 0.75rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
}

/* Speicher-Karte auf der Betriebsseite */
.speicher { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--hairline); }
.speicher__balken {
    height: 0.6rem;
    border-radius: 999px;
    background: var(--surface-head);
    overflow: hidden;
}
.speicher__fuellung { display: block; height: 100%; background: var(--st-green); }
.speicher__fuellung--warnung { background: var(--st-amber); }
.speicher__fuellung--stoerung { background: var(--st-terra); }
.speicher__fuellung--unbekannt { background: var(--st-neutral); }
.speicher__zeile { margin: var(--sp-2) 0 var(--sp-3); font-size: var(--fs-small); color: var(--text-muted); }
.speicher__zeile strong { color: var(--text); font-size: var(--fs-body); }
.speicher__form {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.speicher__form label { font-size: var(--fs-small); font-weight: 600; }
.speicher__form input { width: 8rem; margin: 0; }

/* Beanstanden in der Rechnungsliste: zusammengeklappt nur ein Wort, offen ein Mini-Formular */
.beanstanden summary { list-style: none; cursor: pointer; }
.beanstanden summary::-webkit-details-marker { display: none; }
.beanstanden__form {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.35rem;
    align-items: center;
}
.beanstanden__form input { margin: 0; width: 11rem; font-size: var(--fs-small); }

/* Einmal-Kennwort nach Anlegen/Zurücksetzen: auffällig, kopierbar, einmalig */
.einmal-kennwort { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.einmal-kennwort code {
    font-size: 1.15rem;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.6rem;
    background: var(--surface);
    border: 1px dashed var(--accent-ui);
    border-radius: var(--r-sm, 6px);
    cursor: copy;
    user-select: all;
}
