/* ═══════════════════════════════════════════════════════════════════════════
   ELkabel - Gestaltung

   Tokens und Bausteine aus dem Klickprototyp uebernommen. Helle und dunkle
   Darstellung folgen der Systemeinstellung; data-theme am Wurzelelement
   ueberschreibt sie.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #f2f5f4; --surface: #fff; --surface-2: #f7faf9; --surface-3: #eaefee;
  --ink: #111918; --ink-2: #3d4b49; --muted: #667875; --faint: #8fa09d;
  --line: #dbe3e1; --line-strong: #c3cfcc;
  --accent: #0b6e63; --accent-ink: #075049; --accent-soft: #e2f0ed;
  --copper: #a85b22; --copper-soft: #f6eae0;
  --ok: #2e7d51; --ok-soft: #e3f1e9;
  --warn: #9a6c08; --warn-soft: #f7eeda;
  --bad: #aa332b; --bad-soft: #f8e6e4;
  --rail-bg: #101817; --rail-ink: #9bafac; --rail-ink-hi: #f2f7f6; --rail-line: #22302e;
  --shadow: 0 1px 2px rgba(16, 30, 28, .05), 0 8px 24px -16px rgba(16, 30, 28, .28);
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "SF Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 4px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1211; --surface: #141c1b; --surface-2: #182120; --surface-3: #1f2a28;
    --ink: #e7efed; --ink-2: #c2d0cd; --muted: #8da09d; --faint: #6c7e7b;
    --line: #26312f; --line-strong: #354341;
    --accent: #3aa99b; --accent-ink: #8ad5c9; --accent-soft: #15302c;
    --copper: #d08d57; --copper-soft: #2e2119;
    --ok: #5fbe87; --ok-soft: #152a20;
    --warn: #d5a63c; --warn-soft: #2c2413;
    --bad: #e2796e; --bad-soft: #301a18;
    --rail-bg: #080d0c; --rail-ink: #849693; --rail-ink-hi: #eaf3f1; --rail-line: #1b2523;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .7);
  }
}

:root[data-theme="light"] {
  --bg: #f2f5f4; --surface: #fff; --surface-2: #f7faf9; --surface-3: #eaefee;
  --ink: #111918; --ink-2: #3d4b49; --muted: #667875; --faint: #8fa09d;
  --line: #dbe3e1; --line-strong: #c3cfcc;
  --accent: #0b6e63; --accent-ink: #075049; --accent-soft: #e2f0ed;
  --copper: #a85b22; --copper-soft: #f6eae0;
  --ok: #2e7d51; --ok-soft: #e3f1e9; --warn: #9a6c08; --warn-soft: #f7eeda;
  --bad: #aa332b; --bad-soft: #f8e6e4;
  --rail-bg: #101817; --rail-ink: #9bafac; --rail-ink-hi: #f2f7f6; --rail-line: #22302e;
  --shadow: 0 1px 2px rgba(16, 30, 28, .05), 0 8px 24px -16px rgba(16, 30, 28, .28);
}

:root[data-theme="dark"] {
  --bg: #0c1211; --surface: #141c1b; --surface-2: #182120; --surface-3: #1f2a28;
  --ink: #e7efed; --ink-2: #c2d0cd; --muted: #8da09d; --faint: #6c7e7b;
  --line: #26312f; --line-strong: #354341;
  --accent: #3aa99b; --accent-ink: #8ad5c9; --accent-soft: #15302c;
  --copper: #d08d57; --copper-soft: #2e2119;
  --ok: #5fbe87; --ok-soft: #152a20; --warn: #d5a63c; --warn-soft: #2c2413;
  --bad: #e2796e; --bad-soft: #301a18;
  --rail-bg: #080d0c; --rail-ink: #849693; --rail-ink-hi: #eaf3f1; --rail-line: #1b2523;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .7);
}

/* ── Grundlagen ───────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); font-weight: 600;
}
.muted { color: var(--muted); }
.warn-text { color: var(--warn); }
.tiny { font-size: 12px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ── Rahmen ───────────────────────────────────────────────────────────── */

.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.rail {
  background: var(--rail-bg); border-right: 1px solid var(--rail-line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 18px 16px; border-bottom: 1px solid var(--rail-line); }
.brand-mark { display: flex; align-items: baseline; gap: 7px; }
.brand-mark b { color: var(--rail-ink-hi); font-size: 17px; letter-spacing: -.02em; font-weight: 600; }
.brand-mark span {
  font-family: var(--mono); font-size: 9px; letter-spacing: .16em;
  color: var(--accent-ink); text-transform: uppercase;
}
.brand-sub {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: var(--rail-ink); margin-top: 5px; text-transform: uppercase;
}
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-group {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--faint); padding: 14px 8px 6px;
}
.nav-sep { height: 1px; background: var(--rail-line); margin: 12px 9px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--r);
  color: var(--rail-ink); font-size: 13.5px; border-left: 2px solid transparent; transition: .13s;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: var(--rail-ink-hi); }
.nav a.on {
  background: rgba(255, 255, 255, .07); color: var(--rail-ink-hi);
  border-left-color: var(--accent); font-weight: 500;
}
.nav a .ct { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.nav a.on .ct { color: var(--accent-ink); }
.rail-foot { padding: 12px; border-top: 1px solid var(--rail-line); display: flex; flex-direction: column; gap: 8px; }
/* Die anderen Oberflaechen - gleichrangig, je ein Fenster.

   Als Liste und nicht als Symbolreihe: vier Zeichen nebeneinander, deren
   Name nur im title steht, werden verwechselt - zumal zwei Paare bei 19
   Pixeln fast dieselbe Silhouette haben. Das Geraet rechts ist der
   wirkliche Unterschied zwischen den beiden Planern. */
.modul-leiste {
  display: flex; flex-direction: column; gap: 1px;
  padding-bottom: 8px; border-bottom: 1px solid var(--rail-line); margin-bottom: 4px;
}
.modul-leiste a {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border-radius: var(--r); color: var(--faint); transition: .13s;
}
.modul-leiste a:hover { background: rgba(255, 255, 255, .07); color: var(--rail-ink-hi); }
.modul-leiste svg { flex: none; }
.ml-name { font-size: 12.5px; color: var(--rail-ink); }
.modul-leiste a:hover .ml-name { color: var(--rail-ink-hi); }
/* Rechtsbuendig am Rand, damit die Geraete untereinander fluchten und sich
   als Spalte lesen lassen. */
.ml-geraet {
  margin-left: auto; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .06em; color: var(--faint); text-transform: uppercase;
}
.clock { padding: 2px 2px 6px; text-align: center; }
.clock-time {
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 21px;
  letter-spacing: -.02em; color: var(--rail-ink-hi); line-height: 1.1;
}
.clock-date { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; color: var(--rail-ink); margin-top: 3px; }
.rail-user { font-size: 12px; color: var(--rail-ink); line-height: 1.4; }
.rail-user b { color: var(--rail-ink-hi); font-weight: 500; display: block; }
.rail-user span {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-ink);
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 26px;
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
.crumb { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.subtitle { font-size: 12.5px; color: var(--muted); margin-top: 3px; max-width: 76ch; }
.page { padding: 24px 26px 64px; max-width: 1320px; width: 100%; }

/* ── Bedienelemente ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: .13s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--faint); }
/*
 * Gefuellte Knoepfe muessen ihren Hintergrund im Hover ausdruecklich
 * wiederholen. `.btn:hover` setzt sonst das helle Grau darueber, waehrend die
 * weisse Schrift bleibt - der Knopf wird unlesbar. Nur `filter` zu setzen
 * genuegt nicht, weil die Farbe selbst schon ueberschrieben wurde.
 */
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) {
  background: var(--accent); border-color: var(--accent); color: #fff; filter: brightness(1.1);
}
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover:not(:disabled) {
  background: var(--ok); border-color: var(--ok); color: #fff; filter: brightness(1.08);
}
.btn.bad { background: var(--surface); border-color: var(--bad); color: var(--bad); }
.btn.bad:hover:not(:disabled) { background: var(--bad-soft); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.input, select.input, textarea.input {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-family: inherit;
}
.input.num-in { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
textarea.input { resize: vertical; min-height: 62px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: .6; cursor: not-allowed; }
/* Uebernommen statt eingegeben: der ruhige Grund sagt, dass hier nichts zu
   tippen ist, ohne das Feld wie abgeschaltet aussehen zu lassen - der Wert
   gilt ja. */
.input[readonly] { background: var(--surface-2); color: var(--ink-2); cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.field .hint { font-size: 11.5px; color: var(--faint); }
/* Der Mengen-Waechter: eine Warnung faerbt den Hinweis, eine Sperre macht
   ihn rot. Der Umrechnungsknopf steht in derselben Zeile und bricht mit. */
.field .hint.mengen { color: var(--warn); display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px; margin-top: 6px; line-height: 1.45; }
.field .hint.mengen.sperre { color: var(--bad); }
/* display: flex schlaegt die Browserregel fuer [hidden] - ohne diese beiden
   Zeilen bliebe der leere Kasten stehen und der Umrechnungsknopf sichtbar,
   auch wenn es nichts umzurechnen gibt. */
.field .hint.mengen[hidden], .field .hint.mengen .btn[hidden] { display: none; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.suffixed { display: flex; align-items: stretch; }
.suffixed .input { border-radius: var(--r) 0 0 var(--r); }
/* Das Suffix als Schaltflaeche: CHF und EUR wechseln per Klick. Es sieht aus
   wie die feste Einheit daneben, verraet aber durch Zeiger und Hover, dass es
   eine ist. */
.suffixed .sfx.umschalter { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.suffixed .sfx.umschalter:hover { background: var(--accent-soft); color: var(--accent); }

.suffixed .sfx {
  display: flex; align-items: center; padding: 0 9px; border: 1px solid var(--line-strong);
  border-left: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--surface-3);
  font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap;
}

/* ── Karten ───────────────────────────────────────────────────────────── */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-hd {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-bd { padding: 16px; }

/* Erledigte Schritte klappen zu.
   Wer einen Fall oeffnet, will den aktiven Schritt sehen und nicht an drei
   abgeschlossenen Karten vorbeiscrollen. Der ganze Kopf ist der Anfasser
   fuer die Maus - ein 26-px-Pfeil allein waere ein Zielchen; der Pfeil
   rechts ist der Anfasser fuer Tastatur und Vorleseprogramm. */
.card-hd.klappbar { cursor: pointer; }
.card-hd.klappbar:hover { background: var(--surface-2); }
/* Zugeklappt traegt der Kopf keine Trennlinie mehr - darunter kommt nichts. */
.card.zu .card-hd { border-bottom-color: transparent; }

button.klapp {
  appearance: none; background: none; border: 0; padding: 0; margin: -4px -4px -4px 0;
  width: 26px; height: 26px; border-radius: var(--r); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
button.klapp:hover { color: var(--ink); background: var(--surface-3); }
/* Der Pfeil ist zwei Kanten eines gedrehten Quadrats - kein Zeichensatz,
   kein Bild, und er faerbt sich mit dem Text. */
button.klapp::before {
  content: ""; width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg); transition: transform .15s ease;
}
button.klapp[aria-expanded="true"]::before { transform: rotate(-135deg); margin-top: 3px; }
@media (prefers-reduced-motion: reduce) { button.klapp::before { transition: none; } }
.card-bd.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Angebotspreis, Uebernehmen-Knopf und Kontraktwert in einer Zeile - das Feld
   gehoert zu seinem Knopf, nicht zu den Stammdaten weiter oben. */
/* Ueberschrift des Rechenwegs mit dem Marktstand rechts: welcher Kupferwert
   in der ersten Zeile steckt, sieht man ihr sonst nicht an. */
.markt-zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.markt-zeile h3 { margin: 0; }

/* Der Verlauf der genannten Angebotspreise. Die geltende Zeile ist die
   letzte - sie traegt eine Kante und einen ruhigen Grund, damit sie sich
   beim Ueberfliegen von den frueheren abhebt. */
.preis-liste { margin-top: 18px; }
.preis-liste .eyebrow { margin-bottom: 8px; }
.preis-liste tbody tr.gueltig td { background: var(--ok-soft); }
.preis-liste tbody tr.gueltig td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.preis-liste .uhr { margin-left: 6px; color: var(--faint); font-size: 11px; }

/* Der Verlauf einer Absatzkondition.

   Eine Liste und keine Tabelle: sieben Spalten passen in eine Randspalte
   nicht, untereinander bleibt jeder Stand auch bei 320 Pixeln lesbar.

   Das Fenster begrenzt die Hoehe auf die des Rechenwegs daneben - ohne das
   zoege ein Abnehmer mit zwanzig Nachverhandlungen die ganze Zeile in die
   Laenge, und die beiden Karten links stuenden neben leerer Flaeche. */
.verlauf-fenster { max-height: 320px; overflow-y: auto; margin: -4px -4px -4px 0; padding: 4px 8px 4px 0; }

.k-verlauf { list-style: none; margin: 0; padding: 0; }
.k-verlauf li { padding: 9px 0 10px; border-bottom: 1px solid var(--line); }
.k-verlauf li:last-child { border-bottom: 0; padding-bottom: 2px; }
/* Der geltende Stand traegt Kante und ruhigen Grund - dieselbe Machart wie
   die Preisliste im Geschaeftsfall. */
.k-verlauf li.gueltig {
  background: var(--ok-soft); box-shadow: inset 3px 0 0 var(--ok);
  border-radius: 0 var(--r) var(--r) 0; padding-left: 10px; padding-right: 8px;
}
.k-kopf { display: flex; align-items: center; gap: 8px; }
.k-kopf b { font-size: 13px; }
.k-kopf .pill { font-size: 9px; padding: 1px 6px; }

/* Die Werte in einer Zeile, jeder mit seiner Beschriftung darueber - so
   bleibt lesbar, welche Zahl was ist, ohne dass eine Kopfzeile noetig waere. */
.k-werte { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; }
.k-werte .vw {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 12.5px; color: var(--muted);
}
.k-werte .vl {
  display: block; font-family: var(--sans); font-size: 9.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 1px;
}
.k-werte .ve { font-size: 10.5px; color: var(--faint); margin-left: 3px; }
/* Was sich gegenueber dem naechstaelteren Stand bewegt hat. Die Frage an
   einen Verlauf ist nie "welche Werte galten", sondern "was hat sich
   geaendert" - bei zwanzig Staenden sieht man es so mit einem Blick. */
.k-werte .vw.neu { color: var(--copper); font-weight: 600; }
.k-werte .vw.neu .vl { color: var(--copper); opacity: .85; }

.k-bem { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.4; }
.k-wer { font-size: 10.5px; color: var(--faint); margin-top: 4px; }

/* Soll-Ist der Auftragskosten.
   Zwei Einheiten, zwei Spalten: CHF/t und CHF stehen je fuer sich und
   fluchten an der Kommastelle. Die Kopfzeile sagt einmal, was wo steht -
   vorher trug jede Zeile ihre Einheit im Text und keine Zahl stand unter
   der anderen. */
.sollist { margin-top: 16px; }
.sollist table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sollist th, .sollist td { padding: 5px 0; vertical-align: baseline; }
.sollist th { font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); font-weight: 500; }
.sollist th.r, .sollist td.n { text-align: right; }
.sollist td.n { font-family: var(--mono); font-variant-numeric: tabular-nums;
  white-space: nowrap; width: 104px; }
/* Die Abweichungsspalte traegt das Urteil und darf leiser sein als die
   beiden Zahlen, die sie vergleicht. */
.sollist td.d, .sollist th.d { width: 112px; }
/* Die Herleitung unter der Bezeichnung - sie gehoert nicht in die
   Zahlenspalten, wo sie die Flucht broche. */
.sollist td .unter { display: block; font-size: 11px; color: var(--faint);
  margin-top: 2px; font-family: var(--sans); }

/* Die Richtung der Abweichung traegt Farbe.
   Die Klassen .pos und .neg setzt die Tabelle selbst; eingefaerbt wurden sie
   bisher nur innerhalb von .calc, weshalb sie hier ins Leere griffen. */
.sollist .pos { color: var(--ok); }
.sollist .neg { color: var(--bad); }
.sollist td:first-child { color: var(--muted); }
/* Die Gruppenzeile ordnet die Kette, statt das Wort in jeder Zeile zu
   wiederholen. */
.sollist tr.grp td { font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); padding-top: 14px; }
.sollist tr.zsum td { border-top: 1px solid var(--line); font-weight: 600; }
/* Die Preiszeile schliesst ihre Gruppe ab: sie ist keine Kostensumme,
   sondern das, was daraus fuer den Lieferanten folgt. */
.sollist tr.preis td { font-weight: 600; color: var(--copper); padding-top: 7px; }
.sollist tr.preis td:first-child { color: var(--copper); }
.sollist tr.zsum td:first-child { color: var(--ink); }

/* Das Ergebnis loest sich aus der Zahlenkolonne: zwei Felder in der Form,
   die die Anwendung sonst fuer Kennzahlen nutzt. */
.sollist .ergebnis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.sollist .feld { background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; }
.sollist .feld .v { font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 600; line-height: 1.2; }
.sollist .feld .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sollist .feld.gewinn { background: var(--ok-soft); }
.sollist .feld.gewinn .eyebrow, .sollist .feld.gewinn .v, .sollist .feld.gewinn .sub { color: var(--ok); }
.sollist .feld.verlust { background: var(--bad-soft); }
.sollist .feld.verlust .eyebrow, .sollist .feld.verlust .v, .sollist .feld.verlust .sub { color: var(--bad); }
.sollist .deutung { margin-top: 10px; line-height: 1.5; }

/* Die Preiskarte in Schritt 1.
   Sie traegt die eine Zahl, die gegenueber dem Lieferanten gilt - und zwar
   als groesste Zahl des Schritts. Der Rechenweg darueber ist ihre
   Herleitung, nicht ihr Konkurrent. */
.preis-karte {
  margin-top: 18px; padding: 16px 18px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.preis-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.preis-gross { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.preis-gross .wert {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 32px; font-weight: 600; letter-spacing: -.5px; line-height: 1.1;
}
/* Noch nicht festgeschrieben heisst: ein Vorschlag, keine Zusage. Ihn in
   der Farbe eines gebundenen Preises zu zeigen waere gelogen. */
.preis-gross .wert.vorlaeufig { color: var(--muted); }
.preis-gross .einheit { font-size: 14px; color: var(--muted); }
.preis-karte .abw {
  font-size: 12px; padding: 3px 8px; border-radius: 100px; white-space: nowrap;
}
.preis-karte .abw.ok { background: var(--ok-soft); color: var(--ok); }
.preis-karte .abw.warn { background: var(--warn-soft); color: var(--warn); }
.preis-wert { margin-top: 6px; font-size: 13px; color: var(--muted); }
.preis-aktionen { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.preis-aktionen .preis-feld { flex: 0 1 220px; min-width: 180px; }
.preis-fuss { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Der Storno am Seitenende, ohne Karte: er nimmt den ganzen Fall zurueck und
   soll nicht neben den taeglichen Aktionen stehen. */
.storno-zeile {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line);
}

.cols-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
/* Zwei Karten, rechte etwas breiter: der Rechenweg traegt lange Zeilen
   ("− Treatment 230 EUR × 0.921"), die Kennzahlen links kurze. */
.cols-2.rechts-breiter { grid-template-columns: minmax(0, 1fr) minmax(320px, 1.15fr); }
@media (max-width: 900px) { .cols-2.rechts-breiter { grid-template-columns: 1fr; } }

/* Tagesbasis, Rechenweg und Verlauf nebeneinander.

   Der Verlauf braucht die meiste Breite: er traegt Datum, Werte, Bemerkung
   und Namen. Die Tagesbasis kommt mit am wenigsten aus - vier Zeilen und ein
   Auswahlfeld. Unter 1180 px werden daraus zwei Spalten mit dem Verlauf
   unten ueber die ganze Breite, unter 900 px eine. */
.cols-3-verlauf {
  display: grid; gap: 16px;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1fr) minmax(0, 1.15fr);
}
@media (max-width: 1180px) {
  .cols-3-verlauf { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cols-3-verlauf > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) { .cols-3-verlauf { grid-template-columns: 1fr; } }

/* ── Statusmarken ─────────────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 100px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Die Zustandsfarben gelten fuer .pill UND .kuerzel - deshalb ohne Bindung an
   eine der beiden Formen. Waren sie an .pill geknuepft, blieben die Kuerzel in
   der Liste farblos. */
.s-angebot { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.s-auftragsbearbeitung { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.s-verarbeitung { background: var(--copper-soft); color: var(--copper); border-color: color-mix(in srgb, var(--copper) 25%, transparent); }
.s-abgeschlossen { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.s-verloren { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
/* Storniert ist keine Niederlage, sondern eine eigene Ruecknahme - deshalb
   gedeckt und nicht rot wie "verloren". */
.s-storniert { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
/* Zwei Farben, zwei Bedeutungen - quer durch die Anwendung gleich:
   kupfer = Metallwert, mit dem weitergerechnet wird;
   gruen  = Devisenankaufskurs, mit dem umgerechnet wird. */
td.cu, td.cu b { color: var(--copper); }
/* Cash/3-Monats-Spread: Contango ist der Normalzustand und bleibt leise.
   Backwardation ist die Ausnahme - sofortige Ware traegt eine Knappheits-
   praemie - und soll aus der Zahlenwand herausstechen. */
/*
 * Betriebskosten nicht gedeckt.
 *
 * Zwei Stufen in einer Marke: die Warnfarbe fuer "Fixkosten nur teilweise",
 * die Fehlerfarbe fuer "nicht einmal variabel". Ein Dreieck, kein Text -
 * die Spalte traegt schon die Fallnummer, und der Grund steht im Titel.
 */
.marke-kosten {
  margin-left: 6px; font-size: 10px; line-height: 1;
  color: var(--warn); cursor: help;
}
.marke-kosten.kritisch { color: var(--bad); }

/*
 * Ein Schritt, der Geld kostet, solange er liegenbleibt.
 *
 * Kein Rot: der Fall ist nicht falsch, er wartet nur. Der Akzent der
 * Anwendung sagt "hier ist etwas zu tun", ohne die Zeile zu einem
 * Fehler zu erklaeren - das bleibt dem abgelaufenen Angebot vorbehalten.
 */
/*
 * Aktionen in einer Tabellenzeile.
 *
 * Rechtsbuendig, damit sie eine Kante bilden statt in jeder Zeile an einer
 * anderen Stelle zu beginnen. Die Knoepfe sind kleiner als sonst: sie
 * teilen sich die Zeilenhoehe mit einer Textzeile und duerfen sie nicht
 * aufblaehen.
 */
.zeilen-tun { display: flex; gap: 5px; justify-content: flex-end; align-items: center; }
.zeilen-tun .btn { height: 26px; padding: 0 9px; font-size: 12px; }
.zeilen-tun .btn.ikon { padding: 0 7px; }

.marke-tun {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

td.spread { color: var(--muted); }
/* Zum Aufziehen eines Ausschnitts - das Fadenkreuz sagt: hier kann man ziehen. */
.chart-flaeche svg { cursor: crosshair; }
.chart-tip .tip-back { color: var(--bad); font-weight: 700; }
.chart-tip .tip-contango { color: var(--muted); }
td.spread .backwardation {
  color: var(--bad); background: var(--bad-soft); font-weight: 700;
  padding: 1px 7px; border-radius: 5px;
}
td.ak, td.ak b { color: var(--accent); }

.pill.plain { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.pill.plain::before { display: none; }

/* ── Tabellen ─────────────────────────────────────────────────────────── */

.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; text-align: left; padding: 9px 14px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--surface-2); }

/*
 * Nur Angebote bekommen einen eingefaerbten Zeilengrund.
 *
 * Sie sind die einzige Stufe, in der wir auf jemand anderen warten - der Kunde
 * hat noch nicht entschieden. Alle uebrigen Zustaende liegen in unserer Hand
 * und brauchen keine Flaeche; ihnen genuegt die Farbkante links.
 *
 * Faerbte man alle sechs, waere in der Ansicht "Offen" jede Zeile bunt und
 * keine faellt mehr auf - und in einer gefilterten Ansicht traegt eine
 * durchgehend gleiche Farbe ohnehin keine Information.
 */
tbody tr.k-angebot td { background: var(--warn-soft); }
tbody tr.k-angebot.clickable:hover td {
  background: color-mix(in srgb, var(--warn-soft) 88%, var(--ink));
}

tbody tr.sel td { background: var(--accent-soft); }

/*
 * Summenzeile in einer Tabelle.
 *
 * Eine kraeftigere Linie darueber statt eines eigenen Blocks darunter: die
 * Summe gehoert zu ihren Posten und soll in derselben Spaltenflucht stehen.
 * Ein Rahmen um die Zeile waere zu laut - was sie von den Posten trennt, ist
 * eine Linie und ein halber Schriftschnitt.
 */
tbody tr.summe td {
  border-top: 1px solid var(--line-strong);
  font-weight: 600; color: var(--ink);
}

/*
 * Farbkante am Zeilenanfang, eingefaerbt nach Zustand.
 *
 * Kostet keine Spaltenbreite und macht die Zeile auf Distanz einordenbar.
 * Sie ist nie der alleinige Traeger der Information - daneben steht das
 * Kuerzel, das man auch ohne Farbunterscheidung lesen kann.
 */
tbody tr[class*="k-"] td:first-child { box-shadow: inset 3px 0 0 var(--kante); }
tbody tr.k-angebot { --kante: var(--warn); }
tbody tr.k-auftragsbearbeitung { --kante: var(--accent); }
tbody tr.k-verarbeitung { --kante: var(--copper); }
tbody tr.k-abgeschlossen { --kante: var(--ok); }
tbody tr.k-verloren { --kante: var(--bad); }
tbody tr.k-storniert { --kante: var(--line-strong); }

/* Die Auswahl gewinnt gegen die Zustandskante - sie sagt "hier bist du". */
tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
td.r, th.r { text-align: right; }
thead th { vertical-align: bottom; }
/* Masseinheit als zweite Kopfzeile - gibt den Textspalten die Breite zurueck,
   die sonst der lange Spaltenname frisst. */
thead th .einheit {
  display: block; letter-spacing: .08em; color: var(--line-strong);
  font-weight: 500; margin-top: 2px; font-size: 9px;
}

/* Statuskuerzel: dieselbe Farbfamilie wie die Pille, nur schmal. */
.kuerzel {
  display: inline-block; min-width: 34px; text-align: center; padding: 2px 6px;
  border-radius: 999px; border: 1px solid; font-family: var(--mono);
  font-size: 10px; letter-spacing: .06em; font-weight: 600;
}

/* Textzelle, die kuerzt statt umzubrechen. Braucht table-layout: fixed und
   max-width: 0, sonst wachsen die Spalten trotzdem mit dem Inhalt. */
td.kurz { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }

/*
 * Zweite Zeile in einer Tabellenzelle - Preiskorrektur unter dem Endpreis,
 * "abgelaufen" unter dem Angebotsdatum.
 *
 * `display: block` ist hier nicht Kosmetik: als Inline-Element lief der Text
 * neben dem Hauptwert weiter und schob sich in einer Tabelle mit fester
 * Breite ueber die Nachbarspalte. Die Zelle klemmt ihn zusaetzlich ab, damit
 * ein langes Wort die Spaltenbreite nicht doch noch sprengt.
 */
.unter {
  display: block; margin-top: 1px;
  font-size: 11px; line-height: 1.25; font-weight: 400;
  color: var(--muted); letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Ein Name in einer Nummernspalte. Die Zelle ist mono, damit die Nummern
   fluchten - ein Kundenname darin sieht aus wie ein Kennzeichen. */
.unter.name { font-family: var(--sans); }

.legende {
  display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px;
  border-top: 1px solid var(--line); background: var(--surface-2);
  font-size: 11px; color: var(--muted);
}
.legende span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; letter-spacing: -.02em; }
.empty { padding: 34px 16px; text-align: center; color: var(--faint); font-size: 13px; }

/* ── Kennzahlen ───────────────────────────────────────────────────────── */

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 15px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px;
}
.kpi .v { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.kpi .u { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.kpi .sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.kpi.hi .v { color: var(--accent); }
.kpi.cu .v { color: var(--copper); }

/* Eine Kennzahl, die etwas verlangt - abgelaufene Angebote etwa. Sie faerbt
   sich nur, wenn wirklich etwas ansteht; eine dauerhaft rote Kachel liest
   nach zwei Tagen niemand mehr. */
.kpi.warnung { border-color: var(--bad); }
.kpi.warnung .v { color: var(--bad); }
.kpi.warnung .sub { color: var(--bad); opacity: .85; }

/* ── Diagramme ────────────────────────────────────────────────────────── */

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut {
  width: 132px; height: 132px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--ok) calc(var(--p, 0) * 1%), var(--bad) 0);
}
.donut::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: var(--surface); }
.donut .mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 1;
}
.donut .mid b { font-family: var(--mono); font-size: 23px; letter-spacing: -.03em; font-weight: 600; }
.legend { display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; flex: none; }

.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.bar-row .lbl { font-size: 13px; }
.bar-row .val { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: 7px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--bad); border-radius: 2px; transition: width .4s ease; }

.funnel { display: flex; flex-direction: column; gap: 2px; }
.fn { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r); background: var(--surface-2); }
.fn .fn-n { font-family: var(--mono); font-size: 9.5px; color: var(--faint); width: 16px; }
.fn .fn-l { flex: 1; font-size: 13px; }
.fn .fn-v { font-family: var(--mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fn .fn-b { width: 88px; height: 6px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.fn .fn-b i { display: block; height: 100%; background: var(--accent); }

/* ── Ablaufleiste ─────────────────────────────────────────────────────── */

.stepper {
  display: flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
}
.step {
  flex: 1; padding: 13px 16px; display: flex; gap: 11px; align-items: flex-start;
  position: relative; min-width: 0; border-right: 1px solid var(--line);
}
.step:last-child { border-right: 0; }
.step .idx {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none;
  display: flex; align-items: center; justify-content: center; font-family: var(--mono);
  font-size: 10.5px; color: var(--faint); font-weight: 600; margin-top: 1px;
}
.step .st-l { font-size: 13.5px; font-weight: 500; color: var(--muted); line-height: 1.3; }
.step .st-s {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint); margin-top: 3px;
}
.step.done .idx { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done .st-l { color: var(--ink-2); }
.step.now { background: var(--accent-soft); }
.step.now::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.step.now .idx { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.now .st-l { color: var(--ink); font-weight: 600; }
.step.now .st-s { color: var(--accent); }
.step.lost { background: var(--bad-soft); }
.step.lost .idx { background: var(--bad); border-color: var(--bad); color: #fff; }
.step.lost .st-l, .step.lost .st-s { color: var(--bad); font-weight: 600; }

/* ── Detailansicht ────────────────────────────────────────────────────── */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.aside { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13.5px; align-items: baseline; }
/*
 * Zusammenfassung am Fuss einer engen Karte.
 *
 * margin-top:auto schiebt sie an den unteren Rand - zwei Karten
 * nebeneinander schliessen damit auf derselben Hoehe, auch wenn die eine
 * mehr Positionen traegt. Die Linie darueber trennt die Summe von dem, was
 * sie summiert; ohne sie liest sich die letzte Position wie ein Teil des
 * Ergebnisses.
 */
.summenblock {
  /* 14 Pixel wie tbody td - der Text steht damit exakt unter der Spalte. */
  margin-top: auto; padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}
/*
 * Nur Karten mit Summenblock werden zur Spalte - :has() trifft genau die
 * beiden in der Kostenplanung. Ein globales flex auf .card-bd.tight
 * beruehrte sechzehn Karten, die davon nichts haben.
 */
.card:has(> .card-bd > .summenblock) { display: flex; flex-direction: column; }
.card-bd.tight:has(> .summenblock) { display: flex; flex-direction: column; flex: 1; }
.dl dt {
  font-family: var(--mono); font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; white-space: nowrap;
}
.dl dd { margin: 0; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dl dd.txt { font-family: var(--sans); letter-spacing: 0; }

.calc { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.calc .ln { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; align-items: baseline; }
.calc .ln span:first-child { color: var(--muted); font-family: var(--sans); font-size: 13px; }
.calc .ln span:last-child:not(.neg):not(.pos) { font-weight: 600; color: var(--ink); }
/*
 * Die Deckungszeile im Rechenweg: kein Betrag, sondern ein Urteil ueber
 * die beiden Zeilen darueber. Deshalb abgesetzt und in der Farbe des
 * Befunds - gruen genuegt hier als stiller Haken.
 */
/* Die Eingabe in einer Rechenzeile: so breit wie ihre Zahl, rechtsbuendig,
   damit die Spalte der Betraege nicht bricht. */
.calc .ln-eingabe { display: inline-flex; align-items: baseline; gap: 6px; }
.calc .ln-eingabe input {
  width: 92px; text-align: right; padding: 4px 8px; height: auto;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.calc .ln-eingabe .sfx-t { font-size: 11px; color: var(--faint); }

.calc .ln.deckung {
  margin: 4px 0 2px; padding: 6px 8px; border-radius: 5px;
  background: var(--ok-soft);
}
.calc .ln.deckung span { font-size: 12px !important; color: var(--ok) !important; font-weight: 500 !important; }
.calc .ln.deckung.fix { background: var(--warn-soft); }
.calc .ln.deckung.fix span { color: var(--warn) !important; }
.calc .ln.deckung.variabel { background: var(--bad-soft); }
.calc .ln.deckung.variabel span { color: var(--bad) !important; font-weight: 600 !important; }
.calc .ln.sum { border-top: 1px solid var(--line-strong); margin-top: 5px; padding-top: 9px; font-weight: 600; font-size: 15px; }
.calc .ln.sum span:first-child { color: var(--ink); font-weight: 600; }
.calc .neg { color: var(--bad); }
.calc .pos { color: var(--ok); }

.progress { height: 8px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }

.note {
  padding: 11px 13px; border-radius: var(--r); font-size: 13px; border: 1px solid var(--line);
  background: var(--surface-2); display: flex; gap: 10px; align-items: flex-start;
}
.note.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 26%, transparent); color: var(--warn); }
.note.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 26%, transparent); color: var(--bad); }
.note.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 26%, transparent); color: var(--ok); }
.note.acc { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--accent-ink); }
.note b { font-weight: 600; }

.log { display: flex; flex-direction: column; }
.log-i { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.log-i:last-child { border-bottom: 0; }
.log-i .ts { font-family: var(--mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; padding-top: 2px; }
/* Die Uhrzeit unter das Datum, damit die Spalte schmal bleibt. */
.log-i .ts .uhr { display: block; color: var(--muted); }
.log-i .tx { font-size: 13px; }
.log-i .who { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 2px; }

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.locked { opacity: .62; }

/* ── Ad-hoc-Kalkulator ────────────────────────────────────────────────── */

/* Das Ergebnis steht als letztes Feld in derselben Zeile wie die Eingaben. */
/* Eine Vorgabe im Rechner: gesetzt, nicht eingebbar. Kleiner als das
   Ergebnis, ruhiger als ein Eingabefeld - der Blick soll auf den Feldern
   bleiben, die man wirklich verstellen kann. */
.adhoc-vorgabe {
  font-size: 19px; font-weight: 600; color: var(--ink-2);
  padding: 7px 0 0; line-height: 1.2; font-variant-numeric: tabular-nums;
}
.adhoc-vorgabe .sfx-t { font-size: 12px; font-weight: 500; color: var(--faint); }

.adhoc-ergebnis {
  font-family: var(--mono); font-size: 21px; font-weight: 600; line-height: 1.25;
  letter-spacing: -.03em; color: var(--copper); font-variant-numeric: tabular-nums;
}

/* ── Arbeitsrapport ───────────────────────────────────────────────────── */

.w-zeile {
  display: flex; align-items: center; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.w-zeile:last-child { border-bottom: 0; }
.w-zeile .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.w-zeile > .mono:nth-child(2) { flex: 1; }

.frak {
  border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px;
  margin-bottom: 10px; background: var(--surface-2);
}
.frak:last-child { margin-bottom: 0; }
.frak-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13.5px; font-weight: 500; margin-bottom: 6px;
}
.frak-kopf .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.frak .w-zeile { border-bottom-color: var(--line); }

/* ── Filter ───────────────────────────────────────────────────────────── */

.filters { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 5px 11px; border-radius: 100px; border: 1px solid var(--line-strong); background: var(--surface);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  cursor: pointer; color: var(--muted); font-weight: 600; transition: .13s;
}
.chip:hover { border-color: var(--faint); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .c { opacity: .6; margin-left: 5px; }

/* ── Dialoge ──────────────────────────────────────────────────────────── */

dialog {
  border: 1px solid var(--line); border-radius: var(--r); padding: 0; background: var(--surface);
  color: var(--ink); max-width: min(680px, 94vw); width: 100%;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}
dialog::backdrop { background: rgba(8, 16, 15, .5); }
/* Ein Diagramm braucht Breite - in 680px zerdrueckt sich der Kursverlauf. */
dialog.weit { max-width: min(940px, 96vw); }
/* Anzeige-Dialoge haben keine Formularfelder: eine Spalte statt zwei. */
dialog.weit .m-bd { grid-template-columns: 1fr; }

/* ── Kursverlauf ──────────────────────────────────────────────────────── */

.chart-kopf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-legende {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin-top: 4px;
}
.chart-legende span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legende i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
/* Gestrichelt wie im Diagramm: die Legende muss die Linie wiedererkennbar machen. */
.chart-legende i.gestrichelt {
  background: none !important;
  background-image: repeating-linear-gradient(90deg, var(--copper) 0 5px, transparent 5px 9px) !important;
}
.chart-flaeche { color: var(--ink); position: relative; }
.chart-flaeche svg { width: 100%; height: auto; display: block; font-family: var(--mono); }
.chart-zeiger { pointer-events: none; transition: opacity .08s; }

/* Das Feld am Mauszeiger. `pointer-events: none`, sonst schoebe es sich unter
   den Zeiger und loeste ein Verlassen des SVG aus - es flackerte. */
.chart-tip {
  position: absolute; top: 12px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.5; white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .35); z-index: 2;
}
.chart-tip b { display: block; margin-bottom: 3px; font-family: var(--mono); }
.chart-tip span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.chart-tip i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

/* Der Datenstand steht unter der Kennzahl, kleiner und ruhiger als die
   Kursbewegung darueber. */
.kpi .sub.stand { opacity: .75; margin-top: 1px; }
.m-hd { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.m-bd {
  padding: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
  align-content: start; max-height: min(74vh, 680px); overflow-y: auto;
}
.m-bd > .note, .m-bd > .err, .m-bd > .field.wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .m-bd { grid-template-columns: 1fr; } }
.m-ft {
  padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 9px;
  justify-content: flex-end; background: var(--surface-2);
}
.err { color: var(--bad); font-size: 12px; font-family: var(--mono); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink);
  color: var(--bg); padding: 10px 17px; border-radius: var(--r); font-size: 13px; z-index: 99;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); display: flex; align-items: center; gap: 9px;
  max-width: min(560px, 92vw);
}
.toast.bad { background: var(--bad); color: #fff; }

/* ── Anmeldung ────────────────────────────────────────────────────────── */

.anmelde-seite {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--rail-bg);
}
.anmelde-karte {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); overflow: hidden;
}
.anmelde-kopf { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.anmelde-kopf .brand-mark b { color: var(--ink); }
.anmelde-kopf .brand-sub { color: var(--muted); }
.anmelde-leib { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }

/* ── Druck ────────────────────────────────────────────────────────────── */

#druckbereich { display: none; }
@media print {
  .app, dialog, .toast { display: none !important; }
  #druckbereich { display: block; color: #000; background: #fff; font-family: var(--sans); }
  @page { margin: 18mm; }
}
.pr-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 18px; }
.pr-head h1 { font-size: 19px; margin: 0; }
.pr-head .pr-meta { font-size: 11px; text-align: right; line-height: 1.7; }
.pr-sec { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; margin: 20px 0 7px; border-bottom: 1px solid #999; padding-bottom: 3px; }
.pr-tab { width: 100%; border-collapse: collapse; font-size: 12px; }
.pr-tab th { text-align: left; font-weight: 400; color: #444; padding: 4px 12px 4px 0; width: 38%; vertical-align: top; }
.pr-tab td { padding: 4px 0; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pr-tab td.txt { font-family: var(--sans); text-align: left; white-space: normal; }
.pr-tab tr.tot th, .pr-tab tr.tot td { border-top: 1px solid #000; font-weight: 700; color: #000; padding-top: 7px; font-size: 13px; }
.pr-foot { margin-top: 26px; padding-top: 8px; border-top: 1px solid #999; font-size: 10px; color: #555; }

/* ── Schmale Anzeigen ─────────────────────────────────────────────────── */

@media (max-width: 1080px) { .detail { grid-template-columns: 1fr; } .aside { position: static; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .nav-group { display: none; }
  .stepper { flex-wrap: wrap; }
  .step { min-width: 50%; border-bottom: 1px solid var(--line); }
  .page { padding: 18px 14px 48px; }
  .topbar { padding: 12px 14px; }
}

/* ── Verweise auf andere Module ───────────────────────────────────────── */

/*
 * Ein Eintrag in der Seitenleiste, der die Anwendung verlaesst. Er sieht
 * bewusst wie die uebrigen aus - der Unterschied steckt allein im Symbol.
 * Wer ihn anklickt, soll nicht ueberrascht sein, dass ein Fenster aufgeht,
 * aber auch nicht erst einen Hinweis lesen muessen.
 */

/* Die Modulliste in den Einstellungen. */
.module { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 12px; }
/*
 * Die Einstellungsbereiche nebeneinander statt untereinander gestapelt.
 *
 * auto-fit mit einer Mindestbreite entscheidet die Spaltenzahl selbst: auf
 * einem breiten Schirm drei, auf einem schmalen zwei, auf dem Telefon eine.
 * Feste Umbruchpunkte waeren eine Vermutung ueber Fenstergroessen - hier
 * entscheidet der Platz, den eine Karte zum Lesen braucht.
 *
 * 320 Pixel, nicht 258 wie bei den Modulen: diese Karten tragen zwei Saetze
 * Fliesstext und einen Knopf, nicht nur eine Zeile.
 */
.bereiche {
  display: grid; gap: 12px; align-items: start;
  /*
   * Die Untergrenze ist das Groessere aus 320 Pixeln und einem Drittel der
   * Breite. Damit ergeben sich hoechstens drei Spalten - ein Viertel des
   * Platzes waere immer schmaler als ein Drittel und faellt heraus - und
   * unter 320 Pixeln bricht es von selbst auf zwei und dann auf eine.
   * Die Rechnung kennt die tatsaechliche Breite; feste Umbruchpunkte
   * muessten die Breite der Seitenleiste erraten und driften, sobald sich
   * dort etwas aendert.
   */
  grid-template-columns: repeat(auto-fit, minmax(max(320px, (100% - 24px) / 3), 1fr));
}
.modul {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); text-decoration: none;
}
.modul:hover { border-color: var(--accent); background: var(--surface); }
.modul-kopf { display: flex; align-items: center; gap: 7px; }
.modul-kopf b { font-size: 15px; font-weight: 650; }
.modul-kopf svg { opacity: .6; }
.modul-geraet {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
.modul p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.modul code {
  margin-top: auto; padding-top: 8px; font-family: var(--mono);
  font-size: 12px; color: var(--faint);
}

/*
 * Segmentwahl - ein Satz sich ausschliessender Zeitfenster.
 *
 * Als Knopfgruppe und nicht als <select>: es sind fuenf kurze Begriffe, sie
 * werden oft gewechselt, und welcher gilt, soll man sehen ohne zu klicken.
 * Ein Auswahlfeld verlangte fuer dieselbe Information zwei Handgriffe.
 */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px;
  background: var(--surface-2); }
.seg-k { border: 0; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13px; padding: 6px 13px; border-radius: 7px;
  cursor: pointer; white-space: nowrap; }
.seg-k:hover { color: var(--ink); }
.seg-k.an { background: var(--surface); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / 18%); }
.seg-k:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/*
 * Monatskaestchen der Handauswahl.
 *
 * Sie stehen ueber der Tabelle und nicht in der Werkzeugleiste: es koennen
 * ueber ein Jahr hinweg zwoelf und mehr werden, und die Leiste traegt eine
 * Zeile. Sichtbar sind sie nur, solange die Handauswahl gilt.
 */
.monatswahl { display: flex; flex-wrap: wrap; gap: 7px; }
.monatswahl .mw { display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font-size: 13px;
  cursor: pointer; user-select: none; }
.monatswahl .mw:hover { border-color: var(--line-strong); color: var(--ink); }
.monatswahl .mw.an { border-color: var(--accent); color: var(--ink);
  font-weight: 600; }
.monatswahl .mw input { accent-color: var(--accent); margin: 0; }
.monatswahl .mw:has(input:focus-visible) { outline: 2px solid var(--accent);
  outline-offset: 2px; }

/*
 * Zwei Saetze gegeneinander - kalkuliert und tatsaechlich verkauft.
 *
 * Zwei Balken auf gemeinsamer Skala statt zweier Zahlen nebeneinander: der
 * Unterschied soll sichtbar sein, bevor man ihn liest. Der laengere Balken
 * fuellt die Breite, der andere steht im Verhaeltnis dazu - so faellt auch
 * ein Unterschied von zwei Prozent noch auf.
 */
.gegen { display: flex; flex-direction: column; gap: 12px; }
.gg { display: grid; grid-template-columns: 210px 1fr 104px; align-items: center;
  gap: 14px; }
.gg-t { color: var(--ink-2); font-size: 13.5px; }
.gg-b { background: var(--surface-2); border-radius: 4px; height: 14px;
  overflow: hidden; }
.gg-b i { display: block; height: 100%; border-radius: 4px; }
.gg-b i.soll { background: var(--ink-2); opacity: .45; }
.gg-b i.ist { background: var(--copper); }
.gg-w { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600;
  font-size: 16px; }
.gg-diff { border-top: 1px solid var(--line); padding-top: 12px; }
.gg-diff .gg-t { color: var(--ink); font-weight: 600; }

/*
 * Eng wird der Balken nach unten gelegt: Beschriftung und Zahl gehoeren
 * zusammen und bleiben in einer Zeile, der Balken darunter hat die ganze
 * Breite. Die feste Beschriftungsspalte von 210 px passte sonst nicht mehr
 * neben Balken und Betrag.
 */
@media (max-width: 560px) {
  .gg { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .gg-b { grid-column: 1 / -1; }
}

/*
 * Monatsgruppen in einer Auswertungstabelle.
 *
 * Die Ueberschrift traegt den Monat, die Zwischensumme wiederholt ihn - so
 * bleibt lesbar, wozu die Zahlen gehoeren, auch wenn die Gruppe lang ist
 * und die Ueberschrift aus dem Blick geraet. Die Zwischensumme ist leiser
 * gesetzt als die Gesamtsumme: sie ist eine Zwischenstation, nicht das
 * Ergebnis.
 */
tbody tr.grp { cursor: pointer; }
tbody tr.grp td { background: var(--surface-2); font-weight: 600;
  color: var(--ink); padding-top: 10px; padding-bottom: 10px; }
tbody tr.grp:hover td { background: var(--surface-3); }
tbody tr.grp:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tbody tr.grp .tiny { margin-left: 8px; font-weight: 400; }
/* Die Marke einer Gruppe mit offenen Lieferungen - sie steht neben der
   Zaehlung und darf nicht an ihr kleben. */
tbody tr.grp .pill { margin-left: 8px; vertical-align: middle; }

/* Das Dreieck dreht sich beim Aufklappen - die einzige Bewegung hier. */
.pfeil { display: inline-block; width: 0; height: 0; margin-right: 9px;
  vertical-align: middle; border-left: 5px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  color: var(--muted); transition: transform .12s ease; }
tbody tr.grp.auf .pfeil { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .pfeil { transition: none; } }

/*
 * Einzelpositionen einer offenen Gruppe. Leiser als die Gruppenzeile und
 * eingerueckt: sie sind die Herleitung, nicht das Ergebnis.
 */
tbody tr.pos td:first-child { padding-left: 26px; }
tbody tr.pos td { color: var(--ink-2); }

/*
 * Verlaufsdiagramm der Absatzauswertung.
 *
 * Farben ueber Klassen und nicht als Praesentationsattribut: var() loest in
 * fill="" und stroke="" nicht auf, die Linien blieben unsichtbar - im
 * dunklen Aufzug faellt das erst auf, wenn es zu spaet ist.
 */
.dg { width: 100%; height: auto; display: block; margin-top: 6px; }
.dg-netz { stroke: var(--line); stroke-width: 1; }
.dg-achse { fill: var(--ink-2); font-size: 11px; font-family: inherit; }
.dg-soll { fill: none; stroke: var(--ink-2); stroke-width: 2;
  stroke-dasharray: 5 4; opacity: .7; }
.dg-soll-pt { fill: var(--ink-2); opacity: .7; }
.dg-ist { fill: none; stroke: var(--copper); stroke-width: 2.5; }
.dg-ist-pt { fill: var(--copper); }

.dg-legende { display: flex; flex-wrap: wrap; gap: 20px; font-size: 13px;
  color: var(--ink-2); }
.dg-legende .lg { display: inline-flex; align-items: center; gap: 8px; }
.dg-legende i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.dg-legende i.soll { background: var(--ink-2); opacity: .7; }
.dg-legende i.ist { background: var(--copper); }
.dg-legende b { color: var(--ink); font-variant-numeric: tabular-nums; }

/*
 * Vorzeichenfarbe in der Unterzeile einer Kachel.
 *
 * Die Klassen `pos` und `neg` waren dort schon gesetzt, gefaerbt wurden
 * sie aber nur innerhalb eines Rechenwegs (.calc). In den Kacheln blieb
 * die Veraenderung deshalb grau - eine Richtungsangabe ohne Richtung.
 *
 * Gezielt auf .kpi .sub und nicht global auf .pos: `tr.pos` ist eine
 * Zeilenklasse in den Auswertungstabellen und hat mit Vorzeichen nichts
 * zu tun.
 */
.kpi .sub .pos { color: var(--ok); font-weight: 600; }
.kpi .sub .neg { color: var(--bad); font-weight: 600; }

/* Die Eyebrow als Quellenlink - unaufdringlich, bis man darauf zeigt. */
.kpi .eyebrow a { color: inherit; text-decoration: none;
  border-bottom: 1px dotted currentColor; }
.kpi .eyebrow a:hover { color: var(--accent); }
