/* ==========================================================================
   E2Stotax – Design-System (hell/dunkel, ruhig, datenorientiert)
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --flaeche: #ffffff;
  --flaeche-2: #f8fafc;
  --flaeche-3: #eef2f7;
  --rand: #e2e8f0;
  --rand-stark: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --gedimmt: #64748b;
  --akzent: #2563eb;
  --akzent-hover: #1d4ed8;
  --akzent-weich: #eff6ff;
  --akzent-text: #ffffff;
  --erfolg: #15803d;
  --erfolg-weich: #ecfdf3;
  --warnung: #b45309;
  --warnung-weich: #fffbeb;
  --fehler: #dc2626;
  --fehler-weich: #fef2f2;
  --lila: #7c3aed;
  --lila-weich: #f3e8ff;
  --zeile-lila: #f1e7fc;
  --zeile-rot: #c62828;
  --zeile-aus: #94a3b8;
  --auswahl: #dbeafe;
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: #1e293b;
  --sidebar-aktiv: #1e3a8a;
  --schatten: 0 1px 2px rgb(15 23 42 / .06), 0 1px 3px rgb(15 23 42 / .08);
  --schatten-gross: 0 10px 30px rgb(15 23 42 / .16), 0 2px 6px rgb(15 23 42 / .08);
  --radius: 10px;
  --radius-klein: 7px;
  --schrift: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220; --flaeche: #131c2e; --flaeche-2: #18233a; --flaeche-3: #1e2a42; --rand: #263349; --rand-stark: #334561;
    --text: #e2e8f0; --text-2: #cbd5e1; --gedimmt: #94a3b8; --akzent: #3b82f6; --akzent-hover: #60a5fa; --akzent-weich: #172554;
    --erfolg: #4ade80; --erfolg-weich: #052e1a; --warnung: #fbbf24; --warnung-weich: #2a1f05; --fehler: #f87171; --fehler-weich: #2a1010;
    --lila: #c084fc; --lila-weich: #2e1a47; --zeile-lila: #2a1f44; --zeile-rot: #f87171; --zeile-aus: #5b6b82; --auswahl: #1e3a8a;
    --sidebar: #070c17; --sidebar-hover: #131c2e; --sidebar-aktiv: #1e3a8a;
    --schatten: 0 1px 2px rgb(0 0 0 / .4); --schatten-gross: 0 12px 32px rgb(0 0 0 / .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --flaeche: #131c2e; --flaeche-2: #18233a; --flaeche-3: #1e2a42; --rand: #263349; --rand-stark: #334561;
  --text: #e2e8f0; --text-2: #cbd5e1; --gedimmt: #94a3b8; --akzent: #3b82f6; --akzent-hover: #60a5fa; --akzent-weich: #172554;
  --erfolg: #4ade80; --erfolg-weich: #052e1a; --warnung: #fbbf24; --warnung-weich: #2a1f05; --fehler: #f87171; --fehler-weich: #2a1010;
  --lila: #c084fc; --lila-weich: #2e1a47; --zeile-lila: #2a1f44; --zeile-rot: #f87171; --zeile-aus: #5b6b82; --auswahl: #1e3a8a;
  --sidebar: #070c17; --sidebar-hover: #131c2e; --sidebar-aktiv: #1e3a8a;
  --schatten: 0 1px 2px rgb(0 0 0 / .4); --schatten-gross: 0 12px 32px rgb(0 0 0 / .55);
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--schrift); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .6em; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.zahl { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.gedimmt { color: var(--gedimmt); }
.klein { font-size: .86rem; }
.fett { font-weight: 600; }
.ok { color: var(--erfolg); }
.warn { color: var(--warnung); }
.err { color: var(--fehler); }
.versteckt { display: none !important; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
h1:focus, h1:focus-visible { outline: none; } /* Fokus nach Seitenwechsel (Barrierefreiheit) ohne Rahmen */
::selection { background: var(--auswahl); }

/* ---------- App-Rahmen ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.seitenleiste {
  background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column;
  padding: 14px 10px; gap: 2px; overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: #fff; font-weight: 700; font-size: 1.12rem; cursor: default; user-select: none; }
.logo-zeichen { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #1e40af); display: grid; place-items: center; font-size: .8rem; letter-spacing: -.02em; }
.nav-titel { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 12px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--sidebar-text);
  font-weight: 500; text-decoration: none !important; transition: background .12s;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--sidebar-aktiv); color: #fff; }
.nav-link .icon { opacity: .9; }
.zaehler { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #ef4444; color: #fff; font-size: .74rem; font-weight: 700; display: inline-grid; place-items: center; }
.nav-job { margin: 4px 0 4px 12px; padding-left: 10px; border-left: 1px solid #263349; display: flex; flex-direction: column; gap: 2px; }
.nav-job .nav-link { padding: 6px 10px; font-size: .92rem; }
.nav-job-titel { font-size: .8rem; color: #94a3b8; padding: 2px 10px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seitenleiste-fuss { margin-top: auto; padding: 12px 10px 2px; font-size: .75rem; color: #64748b; }
.herz-klein { color: #ef4444; }
.fusszeile { margin-top: 18px; text-align: center; font-size: .78rem; color: var(--gedimmt); }

.haupt { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.kopfleiste {
  display: flex; align-items: center; gap: 12px; padding: 10px 22px; min-height: 58px;
  background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.kopfleiste .titel { font-weight: 650; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopfleiste .platz { flex: 1; }
.btn.menue-knopf { display: none; }
.inhalt { flex: 1; overflow: auto; padding: 22px; }
.inhalt.voll { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.statusleiste {
  display: flex; align-items: center; gap: 10px; padding: 6px 22px; font-size: .84rem; color: var(--gedimmt);
  background: var(--flaeche); border-top: 1px solid var(--rand); min-height: 32px;
}
.statusleiste .ok, .statusleiste .warn, .statusleiste .err { font-weight: 500; }
.seite { max-width: 1240px; margin: 0 auto; }
.seite-schmal { max-width: 820px; margin: 0 auto; }
.seitenkopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.seitenkopf p { margin: 4px 0 0; color: var(--gedimmt); }

/* ---------- Bausteine ---------- */
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten); }
.karte-inhalt { padding: 18px 20px; }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--rand); }
.karte-kopf h2, .karte-kopf h3 { display: flex; align-items: center; gap: 8px; }
.raster { display: grid; gap: 16px; }
.raster-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.raster-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.raster-haupt { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); align-items: start; }
.zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spalte { display: flex; flex-direction: column; gap: 10px; }
.abstand { height: 16px; }
.trenner { height: 1px; background: var(--rand); margin: 14px 0; border: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; min-height: 36px;
  border-radius: var(--radius-klein); border: 1px solid var(--rand-stark); background: var(--flaeche); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.btn:hover { background: var(--flaeche-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); box-shadow: 0 1px 2px rgb(37 99 235 / .3); }
.btn-primaer:hover { background: var(--akzent-hover); border-color: var(--akzent-hover); }
.btn-erfolg { background: var(--erfolg); border-color: var(--erfolg); color: #fff; }
.btn-gefahr { color: var(--fehler); border-color: color-mix(in srgb, var(--fehler) 40%, var(--rand)); }
.btn-gefahr:hover { background: var(--fehler-weich); }
.btn-gefahr-voll { background: var(--fehler); border-color: var(--fehler); color: #fff; }
.btn-leise { border-color: transparent; background: transparent; }
.btn-leise:hover { background: var(--flaeche-3); }
.btn-gross { min-height: 46px; padding: 11px 22px; font-size: 1.02rem; border-radius: 9px; }
.btn-klein { min-height: 30px; padding: 4px 10px; font-size: .86rem; }
.btn-icon { padding: 0; width: 36px; }
.btn-icon.btn-klein { width: 30px; }
.btn-gruppe { display: inline-flex; }
.btn-gruppe .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-gruppe .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-gross { width: 28px; height: 28px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--flaeche-3); color: var(--text-2); white-space: nowrap;
}
.chip-ok { background: var(--erfolg-weich); color: var(--erfolg); }
.chip-warn { background: var(--warnung-weich); color: var(--warnung); }
.chip-err { background: var(--fehler-weich); color: var(--fehler); }
.chip-akzent { background: var(--akzent-weich); color: var(--akzent); }
.chip-lila { background: var(--lila-weich); color: var(--lila); }

.hinweis { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-klein); background: var(--akzent-weich); color: var(--text); border: 1px solid color-mix(in srgb, var(--akzent) 25%, transparent); }
.hinweis .icon { color: var(--akzent); margin-top: 2px; }
.hinweis-ok { background: var(--erfolg-weich); border-color: color-mix(in srgb, var(--erfolg) 30%, transparent); }
.hinweis-ok .icon { color: var(--erfolg); }
.hinweis-warn { background: var(--warnung-weich); border-color: color-mix(in srgb, var(--warnung) 30%, transparent); }
.hinweis-warn .icon { color: var(--warnung); }
.hinweis-err { background: var(--fehler-weich); border-color: color-mix(in srgb, var(--fehler) 30%, transparent); }
.hinweis-err .icon { color: var(--fehler); }

/* ---------- Formulare ---------- */
.feld { display: flex; flex-direction: column; gap: 5px; }
.feld > span, .feld > label { font-weight: 550; font-size: .88rem; color: var(--text-2); }
.feld small { color: var(--gedimmt); font-size: .8rem; }
.eingabe, input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--rand-stark); border-radius: var(--radius-klein);
  padding: 8px 11px; min-height: 38px; width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 22%, transparent); }
input.invalid, textarea.invalid, select.invalid { border-color: var(--fehler); }
input.code { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .35em; text-align: center; }
.haken { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.haken input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--akzent); flex: none; }
.validation-message, .feld-fehler { color: var(--fehler); font-size: .82rem; }
.formular { display: flex; flex-direction: column; gap: 14px; }
.suche { position: relative; }
.suche .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gedimmt); width: 16px; }
.suche input { padding-left: 33px; }

/* ---------- Kennzahlen ---------- */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-wert { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-text { color: var(--gedimmt); font-size: .86rem; display: flex; align-items: center; gap: 6px; }

/* ---------- Begrüßung ---------- */
.begruessung {
  border-radius: 14px; padding: 26px 28px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, #3b82f6 0%, #1e40af 45%, #172554 100%);
  box-shadow: var(--schatten-gross);
}
.begruessung h1 { font-size: 1.75rem; }
.begruessung p { color: #dbeafe; margin: 6px 0 0; }
.begruessung .btn { background: rgb(255 255 255 / .14); border-color: rgb(255 255 255 / .25); color: #fff; }
.begruessung .btn:hover { background: rgb(255 255 255 / .24); }
.begruessung .btn-primaer { background: #fff; color: #1e3a8a; border-color: #fff; }
.begruessung .btn-primaer:hover { background: #e0ecff; }

/* ---------- Ablagefeld (Upload) ---------- */
.ablagefeld {
  display: block; position: relative; border: 2px dashed var(--rand-stark); border-radius: 12px; padding: 30px 20px; text-align: center;
  background: var(--flaeche-2); transition: border-color .15s, background .15s; cursor: pointer;
}
.ablagefeld:hover, .ablagefeld.aktiv { border-color: var(--akzent); background: var(--akzent-weich); }
.ablagefeld input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.ablagefeld .icon-gross { color: var(--akzent); margin-bottom: 6px; }
.ablagefeld strong { display: block; font-size: 1.02rem; }

/* ---------- Fortschritt ---------- */
.balken { height: 7px; border-radius: 99px; background: var(--flaeche-3); overflow: hidden; }
.balken > div { height: 100%; background: var(--akzent); border-radius: 99px; transition: width .3s; }
.balken.fertig > div { background: var(--erfolg); }

/* Phasen eines Jobs (horizontal) */
.phasen { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.phase {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; color: var(--gedimmt);
  font-weight: 550; text-decoration: none !important; border: 1px solid transparent;
}
.phase:hover { background: var(--flaeche-3); }
.phase-nr { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; background: var(--flaeche-3); color: var(--gedimmt); }
.phase.aktiv { color: var(--text); border-color: var(--rand); background: var(--flaeche); box-shadow: var(--schatten); }
.phase.aktiv .phase-nr { background: var(--akzent); color: #fff; }
.phase.erledigt .phase-nr { background: var(--erfolg); color: #fff; }
.phase-pfeil { color: var(--rand-stark); }

/* Schritte (vertikal) */
.schritte { list-style: none; margin: 0; padding: 0; }
.schritt { position: relative; display: flex; gap: 11px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.schritt:hover { background: var(--flaeche-3); }
.schritt.gewaehlt { background: var(--akzent-weich); }
.schritt:not(:last-child)::after { content: ""; position: absolute; left: 19px; top: 33px; bottom: -7px; width: 2px; background: var(--rand); }
.schritt-punkt {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; z-index: 1;
  background: var(--flaeche-3); color: var(--gedimmt); font-size: .76rem; font-weight: 700; border: 2px solid var(--flaeche);
}
.schritt.erledigt .schritt-punkt { background: var(--erfolg); color: #fff; }
.schritt.naechster .schritt-punkt { background: var(--akzent); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 25%, transparent); }
.schritt.laeuft .schritt-punkt { animation: puls 1s infinite; background: var(--akzent); color: #fff; }
.schritt-titel { padding-top: 2px; font-size: .92rem; line-height: 1.35; }
.schritt.erledigt .schritt-titel { color: var(--gedimmt); }
.schritt.naechster .schritt-titel { font-weight: 650; }
@keyframes puls { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--akzent) 15%, transparent); } }

/* ---------- Tabellen ---------- */
.tabelle-rahmen { overflow: auto; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); }
table.tabelle { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.tabelle th {
  position: sticky; top: 0; z-index: 2; background: var(--flaeche-2); color: var(--gedimmt); font-weight: 600; text-align: left;
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 9px 10px; border-bottom: 1px solid var(--rand); white-space: nowrap;
}
.tabelle td { padding: 7px 10px; border-bottom: 1px solid var(--rand); vertical-align: middle; }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover td { background: var(--flaeche-2); }
.tabelle td.aktion { width: 1%; white-space: nowrap; text-align: right; }
.tabelle tr.klickbar { cursor: pointer; }

/* Buchungstabelle (dicht, virtualisiert) */
.raster-tabelle { flex: 1; min-height: 0; overflow: auto; background: var(--flaeche); user-select: none; }
.raster-tabelle table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: .86rem; table-layout: fixed; }
.raster-tabelle th {
  position: sticky; top: 0; z-index: 2; background: var(--flaeche-2); color: var(--gedimmt); font-weight: 600; text-align: left; height: 34px;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; padding: 0 8px; border-bottom: 1px solid var(--rand); white-space: nowrap;
}
.raster-tabelle td { height: 32px; padding: 0 8px; border-bottom: 1px solid var(--rand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.raster-tabelle tr.z:hover td { background: var(--flaeche-2); }
.raster-tabelle tr.z.lila td { background: var(--zeile-lila); }
.raster-tabelle tr.z.rot td { color: var(--zeile-rot); }
.raster-tabelle tr.z.aus td { color: var(--zeile-aus); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--zeile-aus) 50%, transparent); }
.raster-tabelle tr.z.gewaehlt td { background: var(--auswahl) !important; }
.raster-tabelle tr.z.blitz td { animation: blitz 1.6s ease-out; }
@keyframes blitz { 0%, 40% { background: color-mix(in srgb, var(--akzent) 30%, transparent); } }
.raster-tabelle td.edit { cursor: text; }
.raster-tabelle td.edit:hover { box-shadow: inset 0 0 0 1px var(--rand-stark); }
.raster-tabelle td.bearbeitung { padding: 0; overflow: visible; }
.raster-tabelle td.bearbeitung input { height: 31px; min-height: 0; border-radius: 0; border: 2px solid var(--akzent); padding: 0 6px; font-size: .86rem; box-shadow: none; }
.raster-tabelle .st { text-align: center; padding: 0; }
.raster-tabelle .manuell { font-style: italic; }
.punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

.ansicht-leiste { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--rand); background: var(--flaeche); flex-wrap: wrap; }
.reiter { display: inline-flex; background: var(--flaeche-3); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.reiter button, .reiter a {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--gedimmt); font: inherit; font-weight: 550; font-size: .88rem; padding: 5px 12px;
  border-radius: 7px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.reiter button:hover, .reiter a:hover { color: var(--text); }
.reiter .aktiv { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }
.reiter .anzahl { font-size: .74rem; color: var(--gedimmt); margin-left: 4px; }
.summenleiste { display: flex; align-items: center; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--rand); background: var(--flaeche); font-size: .85rem; flex-wrap: wrap; }
.summenleiste .sum { display: flex; gap: 6px; align-items: baseline; }
.summenleiste .sum b { font-variant-numeric: tabular-nums; }

/* Bearbeiten-Seite */
.arbeitsflaeche { display: grid; grid-template-columns: 264px 1fr; flex: 1; min-height: 0; }
.arbeitsflaeche.eingeklappt { grid-template-columns: 0 1fr; }
.arbeitsflaeche.eingeklappt .schrittspalte { display: none; }
.schrittspalte { border-right: 1px solid var(--rand); background: var(--flaeche); display: flex; flex-direction: column; min-height: 0; }
.schrittspalte .oben { padding: 16px; border-bottom: 1px solid var(--rand); display: flex; flex-direction: column; gap: 10px; }
.schrittspalte .liste { padding: 10px 8px; overflow-y: auto; flex: 1; }
.schrittspalte .anleitung { border-top: 1px solid var(--rand); padding: 14px 16px; font-size: .84rem; color: var(--text-2); max-height: 38%; overflow-y: auto; white-space: pre-line; background: var(--flaeche-2); }
.tabellenspalte { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.jobkopf { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--rand); background: var(--flaeche); flex-wrap: wrap; }
.jobkopf .jobname { font-weight: 650; font-size: 1.02rem; }
.jobkopf .jobmeta { color: var(--gedimmt); font-size: .84rem; }

/* ---------- Dialoge ---------- */
.dialog-hintergrund {
  position: fixed; inset: 0; background: rgb(2 6 23 / .55); backdrop-filter: blur(2px); z-index: 50;
  display: grid; place-items: center; padding: 16px; animation: einblenden .15s ease-out; overscroll-behavior: contain;
}
.dialog {
  background: var(--flaeche); border-radius: 14px; box-shadow: var(--schatten-gross); width: min(640px, 100%);
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); /* dvh: echte sichtbare Höhe (iPhone-Adressleiste) */
  display: flex; flex-direction: column; animation: hochkommen .18s ease-out; border: 1px solid var(--rand);
}
.dialog.breit { width: min(920px, 100%); }
.dialog-kopf { padding: 18px 22px 12px; display: flex; gap: 12px; align-items: flex-start; }
.dialog-kopf .symbol { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--warnung-weich); color: var(--warnung); flex: none; }
.dialog-kopf .symbol.info { background: var(--akzent-weich); color: var(--akzent); }
.dialog-kopf .symbol.gefahr { background: var(--fehler-weich); color: var(--fehler); }
.dialog-inhalt { padding: 4px 22px 16px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.dialog-fuss { padding: 14px 22px; border-top: 1px solid var(--rand); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; background: var(--flaeche-2); border-radius: 0 0 14px 14px; }
.optionen { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.option { display: flex; gap: 11px; padding: 11px 13px; border: 1px solid var(--rand); border-radius: 9px; cursor: pointer; transition: border-color .12s, background .12s; }
.option:hover { border-color: var(--rand-stark); }
.option.gewaehlt { border-color: var(--akzent); background: var(--akzent-weich); }
.option input { accent-color: var(--akzent); margin-top: 3px; }
.option .vorschlag { font-size: .74rem; font-weight: 700; color: var(--akzent); background: var(--akzent-weich); padding: 1px 7px; border-radius: 99px; margin-left: 6px; }
@keyframes einblenden { from { opacity: 0; } }
@keyframes hochkommen { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Kontextmenü */
.kontextmenue {
  position: fixed; z-index: 60; min-width: 230px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px;
  box-shadow: var(--schatten-gross); padding: 5px; animation: einblenden .1s;
}
.kontextmenue button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: .9rem; border-radius: 6px; cursor: pointer; text-align: left;
}
.kontextmenue button:hover { background: var(--flaeche-3); }
.kontextmenue button.gefahr { color: var(--fehler); }
.kontextmenue kbd { margin-left: auto; font: .74rem var(--mono); color: var(--gedimmt); }
.kontextmenue hr { border: 0; height: 1px; background: var(--rand); margin: 4px 2px; }
.klappmenue { position: relative; }
.klappmenue .kontextmenue { position: absolute; right: 0; top: calc(100% + 6px); }

/* Läuft-Overlay */
.laeuft-band {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--akzent-weich); border-bottom: 1px solid var(--rand);
  font-weight: 550;
}
.kreisel { width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, var(--akzent) 25%, transparent); border-top-color: var(--akzent); border-radius: 50%; animation: drehen .7s linear infinite; flex: none; }
@keyframes drehen { to { transform: rotate(360deg); } }

/* ---------- Konto-Seiten (Anmeldung) ---------- */
.konto-rahmen {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--akzent) 14%, transparent), transparent 70%), var(--bg);
}
.konto-karte {
  width: min(464px, 100%); background: var(--flaeche); border: 1px solid var(--rand); border-radius: 16px;
  box-shadow: var(--schatten-gross); padding: 32px 32px 34px; display: flex; flex-direction: column; gap: 22px;
}
.konto-logo { color: var(--text); padding: 0; justify-content: center; font-size: 1.2rem; }
.konto-karte:has(.konto-breit) { width: min(584px, 100%); }
.konto-box { width: 100%; display: flex; flex-direction: column; gap: 18px; }
.konto-box h2 { font-size: 1.45rem; }
.qr { background: #fff; padding: 10px; border-radius: 10px; width: 200px; height: 200px; border: 1px solid var(--rand); image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; font-family: var(--mono); font-size: 1rem; padding: 14px; background: var(--flaeche-2); border-radius: 9px; border: 1px solid var(--rand); }

/* ---------- Leere Zustände ---------- */
.leer { text-align: center; padding: 40px 20px; color: var(--gedimmt); }
.leer .icon-gross { margin-bottom: 8px; opacity: .6; }
.leer strong { display: block; color: var(--text); font-size: 1.02rem; margin-bottom: 4px; }

/* Jobliste */
.jobliste { display: flex; flex-direction: column; }
.jobeintrag { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 12px 20px; border-bottom: 1px solid var(--rand); color: inherit; text-decoration: none !important; }
.jobeintrag:last-child { border-bottom: 0; }
.jobeintrag:hover { background: var(--flaeche-2); }
.jobeintrag .name { font-weight: 600; }
.jobeintrag .meta { color: var(--gedimmt); font-size: .84rem; }

/* Herz-Überraschung */
.herz { position: fixed; z-index: 100; pointer-events: none; font-size: 26px; animation: herzflug 2.6s ease-in forwards; }
@keyframes herzflug { to { transform: translateY(-110vh) rotate(25deg); opacity: 0; } }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 1100px) {
  .raster-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .raster-haupt { grid-template-columns: 1fr; }
  .arbeitsflaeche { grid-template-columns: 250px 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .seitenleiste { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.menue-offen .seitenleiste { transform: none; box-shadow: var(--schatten-gross); }
  .btn.menue-knopf { display: inline-flex; }
  .nur-breit { display: none; }
  .inhalt { padding: 16px; }
  .kopfleiste { padding: 10px 16px; }
  .raster-2, .raster-3 { grid-template-columns: 1fr; }
  .arbeitsflaeche { grid-template-columns: 1fr; }
  .schrittspalte { display: none; }
  .arbeitsflaeche.schritte-offen .schrittspalte { display: flex; position: fixed; inset: 58px 0 0 0; z-index: 30; }
  .statusleiste { padding: 6px 16px; }
}
@media (max-width: 520px) {
  .raster-4 { grid-template-columns: 1fr 1fr; }
  .begruessung { padding: 20px; }
  .begruessung h1 { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .seitenleiste, .kopfleiste, .statusleiste, .ansicht-leiste, .schrittspalte { display: none !important; }
}

/* ---------- Handy: Dialoge, Tabellen, Statuszeile ---------- */
@media (max-width: 760px) {
  /* Dialog als Blatt von unten, volle Breite, scrollt auch in Safari */
  .dialog-hintergrund { padding: 0; place-items: end stretch; }
  .dialog, .dialog.breit { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .dialog-kopf { padding: 16px 18px 10px; }
  .dialog-inhalt { padding: 4px 18px 14px; }
  .dialog-fuss { padding: 12px 18px 18px; border-radius: 0; }
  .dialog-fuss .btn { flex: 1; }
  .rueckmeldung-dialog .reiter { display: flex; }
  .rueckmeldung-dialog .reiter button { flex: 1; justify-content: center; padding: 6px 8px; }

  /* Tabellen werden zu Karten: eine Zeile = ein Block mit Beschriftungen */
  .tabelle.responsiv thead { display: none; }
  .tabelle.responsiv, .tabelle.responsiv tbody, .tabelle.responsiv tr, .tabelle.responsiv td { display: block; width: 100%; }
  .tabelle.responsiv tr { padding: 10px 14px; border-bottom: 1px solid var(--rand); }
  .tabelle.responsiv tbody tr:last-child { border-bottom: 0; }
  .tabelle.responsiv td { border: 0; padding: 2px 0; max-width: none !important; text-align: left; white-space: normal; }
  .tabelle.responsiv td.zahl { text-align: left; }
  .tabelle.responsiv td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 92px; color: var(--gedimmt); font-size: .78rem; font-weight: 500; }
  .tabelle.responsiv td.aktion { text-align: right; width: auto; margin-top: -26px; }
  .tabelle.responsiv td.titelzelle { font-size: 1rem; margin-bottom: 4px; }
  .tabelle.responsiv tbody tr:hover td { background: transparent; }

  /* Statuszeile einzeilig */
  .statusleiste .status-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .statusleiste .nur-breit-status { display: none; }
  .inhalt { overflow-x: hidden; }

  /* iOS zoomt bei Eingabefeldern unter 16 px automatisch hinein */
  input, select, textarea { font-size: 16px !important; }
}

/* ---------- Verbindung kurz weg (Update/Netz) ---------- */
.wiederverbinden { display: none; }
.wiederverbinden.components-reconnect-show, .wiederverbinden.components-reconnect-retrying,
.wiederverbinden.components-reconnect-failed, .wiederverbinden.components-reconnect-rejected,
.wiederverbinden.components-reconnect-paused, .wiederverbinden.components-reconnect-resume-failed {
  display: grid; position: fixed; inset: 0; z-index: 200; place-items: center; padding: 16px;
  background: rgb(2 6 23 / .35); backdrop-filter: blur(2px); animation: einblenden .2s ease-out .4s both;
}
.wiederverbinden-karte {
  display: flex; align-items: center; gap: 14px; background: var(--flaeche); color: var(--text); border: 1px solid var(--rand);
  border-radius: 14px; padding: 16px 20px; box-shadow: var(--schatten-gross); max-width: 420px;
}
.wiederverbinden .wv-neu, .wiederverbinden .wv-fehler { display: none; }
.wiederverbinden.components-reconnect-rejected .wv-laeuft, .wiederverbinden.components-reconnect-failed .wv-laeuft,
.wiederverbinden.components-reconnect-resume-failed .wv-laeuft { display: none; }
.wiederverbinden.components-reconnect-rejected .wv-neu { display: block; }
.wiederverbinden.components-reconnect-failed .wv-fehler, .wiederverbinden.components-reconnect-resume-failed .wv-fehler { display: inline-flex; }
.wiederverbinden.components-reconnect-failed .kreisel, .wiederverbinden.components-reconnect-resume-failed .kreisel { display: none; }

/* ---------- Diagramme (Statistik) ---------- */
.diagramm { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.diagramm-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.diagramm-raster { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.d-yachse { display: flex; flex-direction: column; justify-content: space-between; text-align: right; padding: 4px 0 0; min-width: 18px; font-variant-numeric: tabular-nums; }
.diagramm-flaeche { position: relative; height: 140px; }
.diagramm-flaeche svg { width: 100%; height: 100%; display: block; overflow: visible; }
.d-saeule { fill: var(--akzent); transition: opacity .12s; }
.diagramm-flaeche:hover .d-saeule:not(.aktiv) { opacity: .55; }
.d-raster { stroke: var(--rand); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.d-achse { stroke: var(--rand-stark); stroke-width: 1; vector-effect: non-scaling-stroke; }
.d-wert { position: absolute; transform: translate(-50%, -125%); font-size: .78rem; font-weight: 600; color: var(--text-2); pointer-events: none; font-variant-numeric: tabular-nums; }
.d-tipp {
  position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--flaeche); border: 1px solid var(--rand);
  box-shadow: var(--schatten-gross); border-radius: 8px; padding: 6px 10px; white-space: nowrap; pointer-events: none; z-index: 5; font-size: .86rem;
}
.d-xachse { display: flex; justify-content: space-between; padding-left: 26px; }
.kpi-unter { font-size: .78rem; color: var(--gedimmt); }
.d-tipp.rechts { transform: translate(-100%, -100%); }
.d-tipp.links { transform: translate(0, -100%); }
