/* Bereschit – Designsystem (2026-10-10, "Glow-up"). Desktop-Dichte, ruhig,
   eine Schrift für die Oberfläche; die Gestaltung liegt im Buch. Akzentfarbe
   je Mandant kommt aus /m/<id>/schrift.css (--akzent), kein Inline-Stil (CSP). */
:root {
  --bg: #f4f3ef; --flaeche: #ffffff; --flaeche-2: #faf9f6; --linie: #e4e1da; --linie-stark: #cfcac1;
  --tinte: #1c1b19; --leise: #6b665f; --sehr-leise: #9a958c;
  --akzent: #2f4f6f; --akzent-tinte: #ffffff; --akzent-weich: #e7eef4;
  --gruen: #1d6b3a; --gruen-weich: #e3f1e7; --gelb: #8a5a1a; --gelb-weich: #fbf0d9; --rot: #9b2c2c; --rot-weich: #fbe9e7;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px; --schatten: 0 1px 2px rgba(0,0,0,0.06), 0 1px 1px rgba(0,0,0,0.04);
  --kopf-h: 44px; --rail-w: 200px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* schlägt jedes display der Komponenten - sonst steht Ausgeblendetes im Weg */
html, body { margin: 0; height: 100%; }
body { font-family: var(--ui); font-size: 14px; line-height: 1.45; color: var(--tinte); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 20px; } h2 { font-size: 14px; color: var(--leise); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; } h3 { font-size: 14px; }
p { margin: 0 0 0.8em; }
.leise { color: var(--leise); } .sehr-leise { color: var(--sehr-leise); } .fehler { color: var(--rot); }
.mono { font-family: var(--mono); font-size: 12.5px; }
kbd { font-family: var(--ui); font-size: 11px; color: var(--leise); border: 1px solid var(--linie-stark); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; }
svg.i { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- App-Hülle ---------------------------------------------------------------- */
.app { display: grid; grid-template-rows: var(--kopf-h) 1fr; grid-template-columns: var(--rail-w) 1fr; height: 100vh; }
.app.ohne-rail { grid-template-columns: 1fr; }
.kopf { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.marke { font-family: var(--serif); font-size: 17px; color: var(--tinte); letter-spacing: 0.02em; }
.marke:hover { text-decoration: none; }
.brotkrumen { display: flex; align-items: center; gap: 8px; color: var(--leise); min-width: 0; }
.brotkrumen a { color: var(--tinte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
.brotkrumen .trenn { color: var(--sehr-leise); }
.kopf .rechts { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.kopf .person { color: var(--leise); font-size: 13px; }
.umschalter { display: inline-flex; border: 1px solid var(--linie-stark); border-radius: var(--radius); padding: 2px; background: var(--flaeche-2); }
.umschalter a, .umschalter span { padding: 3px 12px; border-radius: 4px; color: var(--leise); font-size: 13px; }
.umschalter a:hover { text-decoration: none; color: var(--tinte); }
.umschalter .aktiv { background: var(--tinte); color: #fff; }
.rail { border-right: 1px solid var(--linie); background: var(--flaeche); display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; }
.rail a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius); color: var(--tinte); }
.rail a:hover { background: var(--flaeche-2); text-decoration: none; }
.rail a.aktiv { background: var(--akzent-weich); color: var(--akzent); font-weight: 600; }
.rail .unten { margin-top: auto; padding: 8px 10px; color: var(--leise); font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.inhalt { overflow: auto; padding: 24px 28px 48px; }
.inhalt.schmal { max-width: 760px; }
.zentriert { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; box-shadow: var(--schatten); padding: 20px 24px; }
.karte.login { width: 380px; }
.karte.login .marke { display: block; margin-bottom: 16px; }

/* --- Seitenkopf, Werkzeuge ------------------------------------------------------ */
.seitenkopf { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.seitenkopf .titel { min-width: 0; }
.seitenkopf .titel h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seitenkopf .meta { color: var(--leise); font-size: 13px; margin-top: 2px; }
.seitenkopf .aktionen { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.knopf, button.knopf { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--linie-stark); background: var(--flaeche); color: var(--tinte); cursor: pointer; text-decoration: none; line-height: 1.3; }
.knopf:hover { background: var(--flaeche-2); text-decoration: none; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-tinte); }
.knopf.primaer:hover { filter: brightness(1.08); }
.knopf.gefahr { color: var(--rot); border-color: #e3b9b9; }
.knopf.gefahr:hover { background: var(--rot-weich); }
.knopf.leise-knopf, .leise-knopf { background: none; border: 0; padding: 0; color: var(--leise); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; }
.knopf[disabled], button[disabled] { opacity: 0.5; cursor: not-allowed; }
.zeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.zeile label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--tinte); }
.zeile label input[type=number] { width: 5.5rem; }
.inline { display: inline; }
.trenner { width: 1px; height: 20px; background: var(--linie); margin: 0 4px; }

/* --- Formulare ---------------------------------------------------------------- */
label { display: block; font-size: 12px; color: var(--leise); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 13.5px; padding: 6px 9px; border: 1px solid var(--linie-stark); border-radius: var(--radius); background: var(--flaeche); color: var(--tinte); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: 1px; border-color: transparent; }
select { width: auto; min-width: 10rem; }
input[type=file] { border: 1px dashed var(--linie-stark); padding: 10px; background: var(--flaeche-2); }
input[type=checkbox] { width: auto; }
textarea { min-height: 4.5em; }
button[type=submit]:not(.leise-knopf):not(.knopf):not(.schritt) { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border: 1px solid var(--akzent); border-radius: var(--radius); background: var(--akzent); color: var(--akzent-tinte); cursor: pointer; }
fieldset { border: 1px solid var(--linie); border-radius: var(--radius); margin: 10px 0 0; padding: 6px 10px; }
legend { color: var(--leise); font-size: 12px; padding: 0 4px; }
.kasten { display: inline-flex; align-items: center; gap: 6px; margin: 2px 12px 2px 0; color: var(--tinte); font-size: 13px; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); column-gap: 14px; }
.raster label { margin-top: 8px; }
.raster .voll { grid-column: 1 / -1; }
.feld-hinweis { font-size: 12px; color: var(--leise); margin-top: 4px; }

/* --- Tabellen, Listen, Badges ------------------------------------------------- */
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; }
.tabelle th, .tabelle td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
.tabelle th { font-size: 12px; font-weight: 600; color: var(--leise); background: var(--flaeche-2); }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover { background: var(--flaeche-2); }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.tabelle td.aktion { text-align: right; white-space: nowrap; }
.tabelle a.zeilenlink { color: var(--tinte); font-weight: 500; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--flaeche-2); color: var(--leise); border: 1px solid var(--linie); white-space: nowrap; }
.badge.manuskript { } .badge.satzreife { background: var(--gelb-weich); color: var(--gelb); border-color: transparent; }
.badge.umbruch, .badge.korrektur { background: var(--akzent-weich); color: var(--akzent); border-color: transparent; }
.badge.freigabe { background: var(--gelb-weich); color: var(--gelb); border-color: transparent; }
.badge.abgeschlossen, .badge.ok, .badge.gruen { background: var(--gruen-weich); color: var(--gruen); border-color: transparent; }
.badge.error, .badge.rot { background: var(--rot-weich); color: var(--rot); border-color: transparent; }
.badge.queued, .badge.running { background: var(--gelb-weich); color: var(--gelb); border-color: transparent; }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: 8px 0; border-bottom: 1px solid var(--linie); display: flex; gap: 10px; align-items: baseline; }
.liste.klein li { padding: 5px 0; font-size: 13px; }
.liste li .inline { margin-left: auto; }
.leer { color: var(--leise); padding: 28px; text-align: center; border: 1px dashed var(--linie-stark); border-radius: 8px; background: var(--flaeche-2); }
.leer .knopf { margin-top: 10px; }
.kennzahlen { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.kennzahl { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 10px 14px; min-width: 140px; }
.kennzahl .wert { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kennzahl .name { font-size: 12px; color: var(--leise); }

/* --- Phasen-Stepper ------------------------------------------------------------- */
.stepper { display: flex; gap: 0; margin: 14px 0 18px; border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; background: var(--flaeche); }
.stepper .schritt { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-right: 1px solid var(--linie); font-size: 13px; color: var(--leise); background: none; border-top: 0; border-bottom: 0; border-left: 0; font-family: inherit; text-align: left; cursor: default; }
.stepper .schritt:last-child { border-right: 0; }
.stepper .schritt .nr { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--linie-stark); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.stepper .schritt.erledigt .nr { background: var(--gruen-weich); border-color: transparent; color: var(--gruen); }
.stepper .schritt.aktiv { color: var(--tinte); font-weight: 600; background: var(--akzent-weich); }
.stepper .schritt.aktiv .nr { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.stepper button.schritt { cursor: pointer; margin: 0; }
.stepper button.schritt:hover { background: var(--flaeche-2); }

/* --- Reiter, Dialoge, Karten ---------------------------------------------------- */
.reiter { display: flex; gap: 2px; border-bottom: 1px solid var(--linie); margin-bottom: 18px; }
.reiter button { font: inherit; font-size: 13.5px; padding: 8px 12px; border: 0; background: none; color: var(--leise); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.reiter button:hover { color: var(--tinte); }
.reiter button.aktiv { color: var(--tinte); font-weight: 600; border-bottom-color: var(--akzent); }
.reiter button .zaehler { margin-left: 6px; font-size: 11px; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 999px; padding: 0 6px; }
[data-panel] { display: none; } [data-panel].aktiv { display: block; }
.abschnitt { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; }
.abschnitt h3 { margin-bottom: 8px; }
.abschnitt .kopfzeile { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.abschnitt .kopfzeile .inline, .abschnitt .kopfzeile form { margin-left: auto; }
.spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .spalten { grid-template-columns: 1fr; } }
dialog { border: 1px solid var(--linie-stark); border-radius: 10px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,0.18); width: min(640px, 92vw); }
dialog::backdrop { background: rgba(28,27,25,0.35); }
dialog .dialog-kopf { display: flex; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--linie); }
dialog .dialog-kopf h3 { font-size: 15px; }
dialog .dialog-kopf button { margin-left: auto; }
dialog .dialog-inhalt { padding: 6px 20px 20px; max-height: 70vh; overflow: auto; }
dialog .dialog-fuss { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--linie); background: var(--flaeche-2); }
dialog .dialog-fuss button[type=submit] { margin: 0; }
.hinweisbox { border-left: 3px solid var(--akzent); background: var(--akzent-weich); padding: 8px 12px; border-radius: 4px; font-size: 13px; margin: 8px 0 12px; }
.hinweisbox.warn { border-color: var(--gelb); background: var(--gelb-weich); }
.hinweisbox.fehl { border-color: var(--rot); background: var(--rot-weich); }
.hinweisbox.gut { border-color: var(--gruen); background: var(--gruen-weich); }
details.gefahr summary { color: var(--rot); cursor: pointer; }
.status-error td:nth-child(3) { color: var(--rot); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tasten { position: fixed; right: 16px; bottom: 12px; font-size: 12px; color: var(--sehr-leise); }
.tasten kbd { margin-right: 2px; }
.knopf.primaer kbd { background: rgba(255,255,255,0.18); color: #fff; border-color: rgba(255,255,255,0.35); }
.sprite { position: absolute; }
