/* ==========================================================
   Design-System – abgestimmt auf das Verwaltungsportal
   ARD Grenchen: Archivo + Azeret Mono, Blau/Gelb, warmes Grau,
   Pillen, Haarlinien. Hell (Standard) und Dunkel.
   ========================================================== */
:root {
  /* Portal-Palette */
  --blau: #2c529d;
  --blau-tief: #1f3d73;
  --blau-hauch: #edf1f9;
  --gelb: #efea62;
  --gelb-tief: #4a4a2f;

  --bg: #f1f1ef;            /* grund */
  --surface: #ffffff;       /* bühne */
  --surface-2: #f1f1ef;
  --surface-3: #e6e6e1;     /* tinte-zart */
  --input-bg: #ffffff;
  --hover: #f1f1ef;
  --text: #16181a;          /* tinte */
  --text-2: #5a5f66;        /* tinte-leise */
  --muted: #6c7178;
  --border: #d8d8d3;        /* haarlinie */
  --border-strong: #b9b9b2;
  --ink: #16181a;           /* aktive Pillen */
  --on-ink: #ffffff;

  --brand: var(--blau);
  --brand-hover: var(--blau-tief);
  --brand-soft: var(--blau-hauch);
  --brand-ink: var(--blau);
  --on-brand: #ffffff;

  --danger: #b03a2b;        /* hoch */
  --danger-soft: #fbefed;
  --ok: #3f7a55;            /* ruhig */
  --ok-soft: #eef5f0;
  --warn: var(--gelb-tief);
  --warn-soft: #f7f4b8;
  --info: var(--blau);
  --info-soft: var(--blau-hauch);
  --violet: var(--blau-tief);
  --violet-soft: #e4e9f3;

  --shadow-sm: 0 1px 2px rgba(22, 24, 26, .05);
  --shadow: 0 1px 2px rgba(22, 24, 26, .05);
  --shadow-lg: 0 6px 24px -12px rgba(22, 24, 26, .22);
  --ring: var(--blau-hauch);

  --r-xl: 28px;   /* bühne */
  --r-lg: 18px;   /* blatt */
  --r: 10px;      /* feld */
  --r-sm: 8px;
  --pill: 999px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --skala-major: #c6c6c0;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a5f66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  --font: "Archivo", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Azeret Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111314; --surface: #1a1c1e; --surface-2: #151719; --surface-3: #25282b; --input-bg: #141618; --hover: #222528;
    --text: #ececea; --text-2: #a8acb1; --muted: #8c9096; --border: #2e3134; --border-strong: #44484c;
    --ink: #ececea; --on-ink: #16181a;
    --brand: #4a72c4; --brand-hover: #5d84d4; --brand-soft: rgba(110, 145, 220, .15); --brand-ink: #9bb4ea; --on-brand: #ffffff;
    --danger: #e58877; --danger-soft: rgba(229, 136, 119, .14);
    --ok: #7cc496; --ok-soft: rgba(124, 196, 150, .13);
    --warn: #e9e36a; --warn-soft: rgba(239, 234, 98, .14);
    --info: #9bb4ea; --info-soft: rgba(110, 145, 220, .15);
    --violet: #b3c4ec; --violet-soft: rgba(150, 175, 230, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 34px -12px rgba(0, 0, 0, .6);
    --ring: rgba(110, 145, 220, .25); --skala-major: #4a4e52;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8acb1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111314; --surface: #1a1c1e; --surface-2: #151719; --surface-3: #25282b; --input-bg: #141618; --hover: #222528;
  --text: #ececea; --text-2: #a8acb1; --muted: #8c9096; --border: #2e3134; --border-strong: #44484c;
  --ink: #ececea; --on-ink: #16181a;
  --brand: #4a72c4; --brand-hover: #5d84d4; --brand-soft: rgba(110, 145, 220, .15); --brand-ink: #9bb4ea; --on-brand: #ffffff;
  --danger: #e58877; --danger-soft: rgba(229, 136, 119, .14);
  --ok: #7cc496; --ok-soft: rgba(124, 196, 150, .13);
  --warn: #e9e36a; --warn-soft: rgba(239, 234, 98, .14);
  --info: #9bb4ea; --info-soft: rgba(110, 145, 220, .15);
  --violet: #b3c4ec; --violet-soft: rgba(150, 175, 230, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 34px -12px rgba(0, 0, 0, .6);
  --ring: rgba(110, 145, 220, .25); --skala-major: #4a4e52;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8acb1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--brand) var(--bg); scrollbar-width: thin; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); text-underline-offset: .2em; text-decoration: none; transition: color .12s ease-out; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1 { font-size: clamp(1.9rem, 3.6vw, 2.625rem); font-weight: 380; letter-spacing: -.035em; margin: 0; line-height: 1; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 500; margin: 0 0 .75rem; letter-spacing: -.015em; }
h3 { font-size: .95rem; font-weight: 500; margin: 0 0 .5rem; }
code { background: var(--surface-3); border-radius: 6px; padding: .05rem .35rem; font-family: var(--font-mono); font-size: .82em; color: var(--text); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: .84em; letter-spacing: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.icon { flex-shrink: 0; vertical-align: middle; }
td, .num, .num-cell, input[type=number] { font-variant-numeric: tabular-nums; }
::selection { background: var(--brand-soft); }
input, textarea, select { caret-color: var(--brand); }

/* Etikett: Azeret Mono, Grossbuchstaben – für Feldnamen, Tabellenköpfe, Rubriken */
.etikett, label, th, .form-section-title, .nav-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2);
}

/* Massstab-Leiste («Skala») wie im Portal */
.skala {
  height: 11px; flex: none;
  background-image:
    repeating-linear-gradient(90deg, var(--skala-major) 0 1px, transparent 1px 70px),
    repeating-linear-gradient(90deg, var(--surface-3) 0 1px, transparent 1px 14px);
  background-size: 70px 11px, 14px 6px; background-repeat: repeat-x, repeat-x; background-position: top left, top left;
}

/* ---------- Rahmen: Kopf mit Marke, Navigation, Konto ---------- */
.rumpf { max-width: 1440px; margin: 0 auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; min-height: 100vh; }
.kopf { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden; flex: none; position: sticky; top: 10px; z-index: 30; }
.kopf-band { display: flex; align-items: center; gap: 16px; padding: 9px 16px 11px 22px; }

.marke { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none !important; flex: none; }
.marke-stern { width: 28px; height: 28px; color: var(--brand); flex: none; }
.marke-stern .stab { stroke: var(--surface); }
.marke-text { display: flex; flex-direction: column; line-height: 1.08; }
.marke-kurz { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.marke-ort { font-size: 13px; color: var(--text-2); }

.navigation { display: flex; gap: 2px; flex: 1 1 auto; flex-wrap: wrap; align-items: center; }
.navigation a {
  min-height: 42px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: var(--pill);
  font-size: 13.5px; color: var(--text-2); text-decoration: none; white-space: nowrap;
  transition: background-color .12s ease-out, color .12s ease-out;
}
.navigation a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.navigation a.active { background: var(--bg); color: var(--text); font-weight: 500; }
.navigation .trenner { width: 1px; height: 22px; background: var(--border); margin: 0 6px; flex: none; }
.navigation .count { font-size: 11px; font-weight: 600; line-height: 18px; min-width: 18px; padding: 0 5px; border-radius: var(--pill); text-align: center; background: var(--brand); color: var(--on-brand); }
.navigation .count.handlung { background: var(--gelb); color: #16181a; outline: 1px solid rgba(22, 24, 26, .25); }
.navigation .count.neutral { background: var(--surface-3); color: var(--text-2); }

.kopf-ende { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
.konto { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none !important; border-radius: var(--pill); padding: 4px 12px 4px 4px; transition: background-color .12s ease-out; }
.konto:hover { background: var(--bg); }
.konto-text { display: flex; flex-direction: column; line-height: 1.2; }
.konto-name { font-size: 13px; font-weight: 500; white-space: nowrap; }
.konto-rolle { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: var(--pill); background: var(--bg); border: 1px solid var(--border); color: var(--text-2); display: grid; place-items: center; font-weight: 600; font-size: 11px; flex-shrink: 0; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--text-2); cursor: pointer; width: 38px; height: 38px; border-radius: var(--pill); display: grid; place-items: center; transition: background-color .12s, color .12s, border-color .12s; }
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* Umschalter (Hell/Auto/Dunkel) */
.theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--border); }
.theme-switch button { border: 0; background: transparent; color: var(--text-2); width: 30px; height: 28px; border-radius: var(--pill); cursor: pointer; display: grid; place-items: center; transition: background-color .18s var(--ease), color .18s var(--ease); }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--ink); color: var(--on-ink); }

.content { width: 100%; padding: 6px 0 3rem; }

/* ---------- Titelzeile ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin: 10px 0 22px; padding: 0 6px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 9px; }
.page-head .sub { font-size: 14px; color: var(--text-2); max-width: 68ch; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-2); font-size: 12.5px; margin: 4px 6px 0; }
.back-link:hover { color: var(--text); text-decoration: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Karten («Blatt») ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 15px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.card.flush .card-head { padding: 18px 22px 0; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.card-head h2 .icon { color: var(--text-2); }
.card-head .link { font-size: 12.5px; display: inline-flex; align-items: center; gap: .25rem; }
.card-foot { border-top: 1px solid var(--border); padding: 14px 22px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 15px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.section { margin-bottom: 15px; }
.split { display: grid; gap: 15px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.split-wide { display: grid; gap: 15px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.split > *, .split-wide > *, .grid > *, .bento > * { min-width: 0; }
@media (max-width: 1100px) { .split, .split-wide { grid-template-columns: 1fr; } }

/* ---------- Übersicht ---------- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 15px; margin-bottom: 15px; }
.bento > .card { margin-bottom: 0; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.row-2 { grid-row: span 2; }
@media (max-width: 1180px) { .span-3 { grid-column: span 6; } .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; } .span-6 { grid-column: span 6; } }
@media (max-width: 680px) { .bento > * { grid-column: span 12 !important; } .span-3.tile { grid-column: span 6 !important; } }

.hero { position: relative; overflow: hidden; background: var(--blau); color: #fff; padding: 0; display: flex; flex-direction: column; min-height: 210px; }
.hero::before { content: ""; display: block; height: 11px; flex: none; opacity: .5;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.7) 0 1px, transparent 1px 70px), repeating-linear-gradient(90deg, rgba(255,255,255,.35) 0 1px, transparent 1px 14px);
  background-size: 70px 11px, 14px 6px; background-repeat: repeat-x; }
.hero > div, .hero > .actions { padding-left: 24px; padding-right: 24px; position: relative; z-index: 1; }
.hero > div:first-of-type { padding-top: 18px; }
.hero h1 { color: #fff; padding-right: 80px; }
.hero .sub { color: rgba(255, 255, 255, .82); margin-top: .6rem; font-size: 14px; }
.hero .actions { margin-top: auto; padding-top: 1.4rem; padding-bottom: 22px; }
.hero .btn { background: #fff; color: var(--blau-tief); border-color: #fff; }
.hero .btn:hover { background: var(--gelb); border-color: var(--gelb); color: #16181a; }
.hero .btn.glass { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.hero .btn.glass:hover { border-color: #fff; background: rgba(255, 255, 255, .1); color: #fff; }
.hero-pulse { position: absolute; right: 24px; top: 30px; z-index: 1; width: 58px; height: 58px; color: var(--gelb); }
.hero-pulse .stab { stroke: var(--blau); }

.tile { display: flex; flex-direction: column; justify-content: space-between; gap: .9rem; color: var(--text); text-decoration: none !important; transition: box-shadow .18s var(--ease), transform .18s var(--ease); min-height: 140px; }
a.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile .tile-top { display: flex; justify-content: space-between; align-items: center; }
.tile .tile-icon { width: 38px; height: 38px; border-radius: var(--pill); display: grid; place-items: center; background: var(--bg); color: var(--text-2); }
.tile .tile-arrow { color: var(--text-2); opacity: 0; transition: opacity .15s, transform .15s; }
a.tile:hover .tile-arrow { opacity: 1; transform: translateX(2px); }
.tile .num { font-size: 30px; font-weight: 420; letter-spacing: -.03em; line-height: 1.05; }
.tile .lbl { color: var(--text-2); font-size: 12.5px; margin-top: .35rem; }
.tile.danger .tile-icon { background: var(--danger-soft); color: var(--danger); } .tile.danger .num { color: var(--danger); }
.tile.warn .tile-icon { background: var(--gelb); color: #16181a; }
.tile.info .tile-icon { background: var(--info-soft); color: var(--info); }
.tile.ok .tile-icon { background: var(--ok-soft); color: var(--ok); }
.tile.violet .tile-icon { background: var(--violet-soft); color: var(--violet); }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 15px; margin-bottom: 18px; }
.stat { display: flex; gap: .9rem; align-items: center; color: var(--text); text-decoration: none !important; background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); transition: box-shadow .18s var(--ease); }
a.stat:hover { box-shadow: var(--shadow-lg); }
.stat .stat-icon { width: 38px; height: 38px; border-radius: var(--pill); display: grid; place-items: center; background: var(--bg); color: var(--text-2); }
.stat .num { font-size: 26px; font-weight: 420; line-height: 1.1; letter-spacing: -.03em; }
.stat .lbl { color: var(--text-2); font-size: 12.5px; }
.stat.danger .stat-icon { background: var(--danger-soft); color: var(--danger); } .stat.danger .num { color: var(--danger); }
.stat.warn .stat-icon { background: var(--gelb); color: #16181a; }
.stat.info .stat-icon { background: var(--info-soft); color: var(--info); }
.stat.ok .stat-icon { background: var(--ok-soft); color: var(--ok); }

/* Listen */
.list-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 13px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: none; padding-top: 0; }
.list-row:last-child { padding-bottom: 0; }
.list-row .title { font-weight: 500; }
.item-row { display: flex; gap: .85rem; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.card-head + .item-row, .item-row:first-child { border-top: none; padding-top: 0; }
.item-row .lead { width: 36px; height: 36px; border-radius: var(--pill); display: grid; place-items: center; background: var(--bg); color: var(--text-2); flex-shrink: 0; font-family: var(--font-mono); font-weight: 600; font-size: 10.5px; letter-spacing: .04em; }
.item-row .lead.red { background: var(--danger-soft); color: var(--danger); }
.item-row .lead.orange { background: var(--gelb); color: #16181a; }
.item-row .lead.blue { background: var(--info-soft); color: var(--info); }
.item-row .lead.violet { background: var(--violet-soft); color: var(--violet); }
.item-row .body { flex: 1; min-width: 0; }
.item-row .body strong { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .body .sub { font-size: 12.5px; color: var(--text-2); }
.item-row .end { text-align: right; flex-shrink: 0; }

/* ---------- Tabellen: Haarlinien, Kopf mit dunkler Linie ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; text-align: left; vertical-align: middle; }
td { border-top: 1px solid var(--border); font-size: 13.5px; }
th { padding-top: 15px; padding-bottom: 11px; border-bottom: 1px solid var(--text); background: none; vertical-align: bottom; white-space: nowrap; }
thead + tbody tr:first-child td { border-top: none; }
.card:not(.flush) th:first-child, .card:not(.flush) td:first-child { padding-left: 0; }
.card:not(.flush) th:last-child, .card:not(.flush) td:last-child { padding-right: 0; }
.card.flush th:first-child, .card.flush td:first-child, .supplier-group th:first-child, .supplier-group td:first-child { padding-left: 22px; }
.card.flush th:last-child, .card.flush td:last-child, .supplier-group th:last-child, .supplier-group td:last-child { padding-right: 22px; }
tbody tr { transition: background-color .12s ease-out; }
tbody tr:hover td { background: var(--surface-2); }
tr.inactive td { color: var(--text-2); }
td .sub { font-size: 12.5px; color: var(--text-2); }
td strong { font-weight: 500; }
td form { display: inline-flex; vertical-align: middle; margin: 0; }

/* ---------- Formulare ---------- */
label { display: block; margin-bottom: 6px; }
.field { margin-bottom: 16px; display: block; }
.field .hint { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: var(--r);
  font-family: inherit; font-size: 13.5px; line-height: 1.5; color: var(--text); background: var(--input-bg);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
/* Eigener Pfeil mit gleichem Abstand rechts wie der Text links */
select { appearance: none; -webkit-appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 13px center; background-size: 14px; padding-right: 40px; text-overflow: ellipsis; cursor: pointer; }
select::-ms-expand { display: none; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
input:disabled { background: var(--surface-2); color: var(--text-2); }
input[type=search] { border-radius: var(--pill); }
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); flex: none; cursor: pointer; }
.checkbox { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-family: var(--font); font-size: 13.5px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text); margin: 0; }
.switch-row { display: flex; gap: .8rem; align-items: flex-start; padding: 13px 15px; border-radius: var(--r); background: var(--surface-2); border: 1px solid transparent; cursor: pointer; transition: border-color .15s, background .15s; }
.switch-row:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.switch-row input { margin-top: .15rem; }
.switch-row label { margin: 0; cursor: pointer; font-family: var(--font); font-size: 13.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0 15px; }
.form-section { padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { margin-bottom: 14px; color: var(--text); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.qty-input { width: 86px !important; text-align: right; }
.dispose-form { display: flex; flex-direction: column; gap: 6px; }
.dispose-form .ppu[hidden] { display: none; }
.unit-select { width: auto !important; min-width: 0; padding-right: 34px; background-position: right 11px center; }
.unit-fixed { font-size: 13px; color: var(--text-2); min-width: 3.5rem; }
.error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 15px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-2); }
.search input { padding-left: 40px; border-radius: var(--pill); }
/* Live-Suche: dezenter Ladezustand */
#article-results { transition: opacity .15s; }
#article-results.loading { opacity: .55; }
.search-spin { position: absolute; right: 16px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; opacity: 0; transition: opacity .15s; pointer-events: none; }
.loading .search-spin { opacity: 1; animation: drehen .7s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
.toolbar select, .page-head select { border-radius: var(--pill); padding-left: 16px; padding-right: 42px; background-position: right 16px center; }
.cat-add { display: flex; gap: 9px; padding: 16px 22px; }
.cat-add input { flex: 1; min-width: 0; }
.cat-edit input { max-width: 340px; }
.cat-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: 12px; color: var(--text-2); }

/* ---------- Pillen-Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 12px 22px; border-radius: var(--pill); border: 1px solid var(--brand);
  font-family: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; line-height: 1.2;
  background: var(--brand); color: var(--on-brand); cursor: pointer; white-space: nowrap; text-decoration: none !important; vertical-align: middle;
  transition: background-color .12s ease-out, color .12s ease-out, border-color .12s ease-out, transform .18s var(--ease);
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand-ink); background: transparent; }
.btn.ghost { background: none; color: var(--text-2); border-color: transparent; min-height: 36px; padding: 8px 12px; }
.btn.ghost:hover { background: var(--bg); color: var(--text); }
.btn.ghost.danger:hover { color: var(--danger); background: var(--danger-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(.92); }
.btn.small { min-height: 36px; padding: 8px 15px; font-size: 11.5px; }
.btn.ghost.small { padding: 7px 10px; }
.btn.large { min-height: 48px; padding: 14px 26px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Umschalter (z.B. Handlungsbedarf / Alle) */
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--border); }
.seg a { padding: 8px 15px; border-radius: var(--pill); color: var(--text-2); font-size: 12.5px; white-space: nowrap; transition: background-color .18s var(--ease), color .18s var(--ease); }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.active { background: var(--ink); color: var(--on-ink); font-weight: 600; }

/* Reiter (Einstellungen) */
.tabs { display: flex; gap: 4px; row-gap: 6px; flex-wrap: wrap; margin: 0 0 18px; padding: 0 2px; }
.tabs a { display: inline-flex; align-items: center; gap: .45rem; padding: 9px 17px; color: var(--text-2); font-size: 13px; border-radius: var(--pill); white-space: nowrap; transition: background-color .18s var(--ease), color .18s var(--ease); }
.tabs a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.tabs a.active { background: var(--ink); color: var(--on-ink); font-weight: 500; }
.tabs a .icon { opacity: .8; }

/* ---------- Status-Pillen ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--pill); font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.orange { background: var(--gelb); color: #16181a; }
.badge.orange::before { background: #16181a; }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }

/* ---------- Meldungen (dunkle Fahne wie im Portal) ---------- */
.flash { display: flex; gap: 11px; align-items: flex-start; padding: 13px 18px; border-radius: var(--r-lg); margin-bottom: 15px; font-size: 13.5px; line-height: 1.5; background: #16181a; color: #fff; box-shadow: var(--shadow-lg); animation: einfahren .26s var(--ease) both; }
.flash .icon { margin-top: 1px; }
.flash a { color: inherit; text-decoration: underline; }
.flash.success .icon { color: #8fd3a7; }
.flash.error { background: var(--blau-tief); }
.flash.warning { background: var(--gelb); color: #16181a; }
.flash.info { background: var(--blau-hauch); color: var(--blau-tief); box-shadow: none; }
@keyframes einfahren { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; color: var(--text-2); padding: 34px 16px 30px; font-size: 13.5px; }
.empty .icon { color: var(--border-strong); }
.empty strong { display: block; color: var(--text); font-size: 19px; font-weight: 450; letter-spacing: -.02em; }

/* ---------- Scanner ---------- */
.scanbox { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 14px 18px; margin-bottom: 15px; transition: border-color .2s, box-shadow .2s; }
.scanbox .scan-icon { width: 42px; height: 42px; border-radius: var(--pill); background: var(--bg); color: var(--text-2); display: grid; place-items: center; flex-shrink: 0; transition: background .2s, color .2s; }
.scanbox input { border: none !important; box-shadow: none !important; padding: .3rem 0; font-size: 15px; background: transparent; min-height: 0; }
.scanbox .scan-state { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.scanbox .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.scanbox.active { border-style: solid; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.scanbox.active .scan-icon { background: var(--brand); color: #fff; }
.scanbox.active .dot { background: var(--brand); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

#toast-area { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: 420px; }
.toast { background: #16181a; color: #fff; padding: 13px 18px; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: einfahren .26s var(--ease); font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast.ok::before { background: #8fd3a7; }
.toast.err { background: var(--blau-tief); }
.toast.err::before { background: var(--gelb); }

/* ---------- Warenkorb ---------- */
.supplier-group { border-radius: var(--r-lg); margin-bottom: 15px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow); transition: opacity .15s; }
.supplier-group.off { opacity: .5; }
.supplier-group .head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 16px 22px 4px; flex-wrap: wrap; }
.supplier-group .head .checkbox { font-weight: 500; font-size: 15px; letter-spacing: -.01em; }
.checkout-bar { position: sticky; bottom: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: var(--r-lg); box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); padding: 12px 14px 12px 22px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
/* ---------- Popup (Dialog) ---------- */
.modal { width: min(640px, calc(100vw - 24px)); max-height: min(780px, calc(100vh - 32px)); padding: 0; border: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: 0 24px 70px -20px rgba(22, 24, 26, .45); overflow: hidden; }
.modal[open] { display: flex; flex-direction: column; animation: einfahren .26s var(--ease); }
.modal::backdrop { background: rgba(22, 24, 26, .42); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 20px 22px 12px; }
.modal-head h2 { font-size: 22px; font-weight: 400; letter-spacing: -.025em; margin: 0 0 4px; }
.modal-tools { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 22px 10px; }
.modal-tools .search { flex: 1 1 220px; min-width: 0; }
.modal-tools select { width: auto; flex: 0 1 170px; min-width: 0; border-radius: var(--pill); padding-left: 16px; padding-right: 42px; background-position: right 16px center; }
.modal-all { padding: 10px 22px; border-bottom: 1px solid var(--text); font-weight: 500 !important; }
.modal-list { overflow-y: auto; flex: 1; min-height: 120px; padding: 0 10px; }
.pick-row { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border-top: 1px solid var(--border); cursor: pointer; margin: 0; font-family: var(--font); font-size: 13.5px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text); border-radius: 0; transition: background-color .12s; }
.pick-row:first-child { border-top: 0; }
.pick-row[hidden] { display: none; }
.pick-row:hover { background: var(--surface-2); }
.pick-row.picked { background: var(--brand-soft); }
.pick-main { display: flex; flex-direction: column; min-width: 0; }
.pick-main strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-main .sub { font-size: 12px; color: var(--text-2); }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface); }
.btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
@media (max-width: 720px) { .modal { max-height: calc(100vh - 16px); border-radius: 20px; } .modal-tools select { flex: 1 1 140px; } }
.add-panel summary { cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: .5rem; list-style: none; }
.add-panel summary::-webkit-details-marker { display: none; }

/* ---------- Unterschrift (bleibt «Papier»-weiss) ---------- */
.sig-wrap { border: 1px solid var(--border-strong); border-radius: var(--r); background: #fff; position: relative; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 200px; cursor: crosshair; }
.sig-wrap .sig-line { position: absolute; left: 6%; right: 6%; bottom: 42px; border-bottom: 1px dashed #c6c6c0; pointer-events: none; }
.sig-wrap .sig-hint { position: absolute; left: 6%; bottom: 16px; font-family: "Azeret Mono", monospace; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #8a8f96; pointer-events: none; }
.sig-tools { display: flex; justify-content: flex-end; margin-top: 6px; }

/* ---------- Anmeldung (Karte wie im Portal) ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; }
.login-card { width: 100%; max-width: 516px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg), var(--shadow); overflow: hidden; }
.login-stage { background: var(--blau); color: #fff; padding: 22px 24px 26px; position: relative; overflow: hidden; }
.login-stage .claim { font-size: 26px; font-weight: 380; letter-spacing: -.03em; line-height: 1.12; max-width: 360px; margin-top: 30px; }
.login-stage ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.login-stage li { display: inline-flex; gap: 6px; align-items: center; border: 1px solid rgba(255, 255, 255, .45); border-radius: var(--pill); padding: 6px 12px; font-size: 12px; }
.login-stage .stern-gross { position: absolute; right: -36px; top: -30px; width: 190px; height: 190px; color: rgba(255, 255, 255, .1); }
.login-stage .stern-gross .stab { stroke: var(--blau); }
.login-body { padding: 22px 24px 26px; border-top: 1px solid var(--border); }
.login-body h1 { font-size: 34px; margin: 14px 0 20px; }
.login-body .foot { font-size: 12.5px; color: var(--text-2); margin-top: 16px; }
.login-theme { position: absolute; top: 16px; right: 16px; }

/* ---------- Wareneingang / Bestandsaufnahme ---------- */
.receive-form { display: none; box-shadow: 0 0 0 1px var(--brand), 0 0 0 5px var(--ring); }
.receive-form.show { display: block; animation: einfahren .26s var(--ease); }
.progress { height: 6px; background: var(--surface-3); border-radius: var(--pill); overflow: hidden; min-width: 90px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: var(--pill); }

/* ---------- Diagramme ---------- */
:root { --series-1: #2c529d; --series-2: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-1: #5b82d2; --series-2: #d95926; } }
:root[data-theme="dark"] { --series-1: #5b82d2; --series-2: #d95926; }

.chart { position: relative; padding-left: 36px; }
.chart-plot { position: relative; height: var(--h, 220px); }
.chart-grid { position: absolute; inset: 0; pointer-events: none; }
.chart-grid .gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--surface-3); }
.chart-grid .gl.base { border-top-color: var(--border-strong); }
.chart-grid .gl span { position: absolute; left: -36px; width: 30px; text-align: right; top: -.6em; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-cols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: default; outline: none; border-radius: 8px; }
.chart-col:hover, .chart-col:focus-visible { background: color-mix(in srgb, var(--text) 4%, transparent); }
.chart-col .group { display: flex; align-items: flex-end; gap: 2px; height: 100%; width: 100%; justify-content: center; }
.chart-col .bar { width: min(28px, 34%); border-radius: 4px 4px 0 0; min-height: 0; transition: filter .15s; }
.chart-col .bar.zero { height: 0 !important; }
.chart-col:hover .bar { filter: brightness(1.08); }
.bar.s1 { background: var(--series-1); }
.bar.s2 { background: var(--series-2); }
.chart-x { display: flex; margin-top: 7px; }
.chart-x span { flex: 1; text-align: center; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-2); white-space: nowrap; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.s1 { background: var(--series-1); } .legend i.s2 { background: var(--series-2); }
.chart-table summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); margin-top: 14px; list-style: none; display: inline-flex; gap: .35rem; align-items: center; }
.chart-table summary::-webkit-details-marker { display: none; }
.chart-table table { margin-top: 6px; }

.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; vertical-align: middle; }
.spark i { width: 6px; background: var(--series-1); border-radius: 2px 2px 0 0; min-height: 2px; display: block; }
.spark i.zero { background: var(--surface-3); height: 2px !important; }

.hbars { display: grid; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 1.1fr) 2fr auto; gap: 13px; align-items: center; font-size: 13.5px; }
.hbar .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hbar .track, .hbar .fill { display: block; }
.hbar .track { height: 8px; background: var(--surface-3); border-radius: var(--pill); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--series-1); border-radius: var(--pill); }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 4.5rem; text-align: right; }

.delta { display: inline-flex; align-items: center; gap: .25rem; font-size: 12px; color: var(--text-2); }
.delta .icon { color: var(--text-2); }

.export-menu { position: relative; }
.export-menu summary { list-style: none; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 290px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); padding: 6px; }
.export-pop a { display: flex; gap: .7rem; align-items: flex-start; padding: 10px; border-radius: var(--r); color: var(--text); }
.export-pop a:hover { background: var(--bg); text-decoration: none; }
.export-pop a .icon { color: var(--text-2); margin-top: 2px; }
.export-pop strong { display: block; font-size: 13.5px; font-weight: 500; }
.export-pop small { display: block; color: var(--text-2); font-size: 12px; }

#chart-tip { position: fixed; z-index: 70; pointer-events: none; background: #16181a; color: #fff; border-radius: 10px; padding: 8px 11px; font-size: 12.5px; line-height: 1.45; white-space: pre-line; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; max-width: 260px; box-shadow: var(--shadow-lg); }
#chart-tip.show { opacity: 1; transform: none; }
#chart-tip b { font-weight: 600; }

/* ---------- Kärtchen-Druck (immer hell) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 4mm; }
.lager-card { border: 1px solid #333; border-radius: 3mm; padding: 3mm; display: flex; gap: 3mm; align-items: center; background: #fff; color: #111; page-break-inside: avoid; break-inside: avoid; min-height: 32mm; font-family: "Archivo", sans-serif; }
.lager-card img { width: 26mm; height: 26mm; flex-shrink: 0; }
.lager-card .name { font-weight: 600; font-size: 10pt; line-height: 1.2; }
.lager-card .meta { font-size: 8pt; color: #444; margin-top: 1mm; }
.lager-card .num { font-family: "Azeret Mono", ui-monospace, monospace; font-size: 11pt; font-weight: 600; margin-top: 1mm; }

/* ---------- Öffentliche Seiten (Visum) ---------- */
.public-wrap { max-width: 900px; margin: 0 auto; padding: 18px 16px 4rem; }
.public-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 10px 14px 12px 22px; margin-bottom: 22px; flex-wrap: wrap; }

@page { size: A4; margin: 12mm; }
@media print {
  .cards { grid-template-columns: repeat(2, 90mm); gap: 4mm; }
  .kopf, .no-print, #toast-area, .flash, .theme-switch { display: none !important; }
  .rumpf { padding: 0; max-width: none; }
  body { background: #fff !important; color: #111; }
  .content { padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
}

/* ---------- Schmalere Bildschirme ---------- */
@media (max-width: 1500px) { .konto-text { display: none; } .konto { padding: 3px; } }
@media (max-width: 1340px) {
  .kopf-band { flex-wrap: wrap; row-gap: 4px; }
  .navigation { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding: 0 0 2px; }
  .navigation::-webkit-scrollbar { display: none; }
}
@media (max-width: 720px) {
  .rumpf { padding: 10px; gap: 12px; }
  .kopf { border-radius: 20px; top: 6px; }
  .kopf-band { padding: 8px 10px 9px 16px; gap: 10px; }
  .konto-text, .kopf-ende .theme-switch { display: none; }
  .konto { padding: 3px; }
  .card { border-radius: 14px; padding: 16px; }
  .card.flush .card-head { padding: 16px 16px 0; }
  .card.flush th:first-child, .card.flush td:first-child, .supplier-group th:first-child, .supplier-group td:first-child { padding-left: 16px; }
  .card.flush th:last-child, .card.flush td:last-child, .supplier-group th:last-child, .supplier-group td:last-child { padding-right: 16px; }
  .card-foot { padding: 12px 16px; }
  .page-head { align-items: flex-start; padding: 0 2px; margin-bottom: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; gap: .7rem; }
  .stat .stat-icon { width: 32px; height: 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero h1 { padding-right: 56px; }
  .login-theme { position: static; display: flex; justify-content: flex-end; margin-bottom: 12px; }
  .login-page { place-items: start center; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
