/* Buchung – Kanzlei. Arbeitswerkzeug: dichte Tabellen am Arbeitsplatz, bedienbar am Handy.
   Farben: Kanzlei-Blau, Status ohne Grün (blau = in Ordnung, Bernstein = Hinweis, Rot = Fehler, Schiefer = ausgelassen). */
:root {
  --grund: #f3f6fb; --flaeche: #ffffff; --flaeche2: #eef2f8; --linie: #d6dde8; --linie2: #e6ebf2;
  --text: #15233a; --leise: #5b6b83; --blau: #1f5fbf; --blau-dunkel: #173a6b; --blau-hell: #e3edfb; --auf-blau: #ffffff;
  --ok: #1f5fbf; --ok-hell: #e3edfb; --hinweis: #a35a00; --hinweis-hell: #fdf0dc; --fehler: #b42318; --fehler-hell: #fde7e5;
  --offen: #7a4bb3; --offen-hell: #f1e9fb; --aus: #66758c; --aus-hell: #eef1f5;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --kopf: #173a6b; --radius: 8px; --leiste-b: 210px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0e1522; --flaeche: #151f30; --flaeche2: #1b2639; --linie: #2b3850; --linie2: #232f44;
    --text: #e3e9f3; --leise: #9aa9c0; --blau: #6ea3f0; --blau-dunkel: #0b1a30; --blau-hell: #1b2c48; --auf-blau: #0e1522;
    --ok: #6ea3f0; --ok-hell: #1b2c48; --hinweis: #f0b35c; --hinweis-hell: #3a2c17; --fehler: #f08c80; --fehler-hell: #3c1d1a;
    --offen: #c4a2ef; --offen-hell: #2a2040; --aus: #9aa9c0; --aus-hell: #1f2a3c; --kopf: #0b1a30; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { background: var(--grund); color: var(--text); font: 15px/1.45 var(--schrift); overflow-x: clip; }
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: var(--kopf); z-index: 60; }
#app { position: fixed; top: env(safe-area-inset-top, 0px); left: var(--leiste-b); right: 0; bottom: 0; overflow-y: auto; overscroll-behavior: contain; }
body.ohne-leiste #app { left: 0; }
main { max-width: 1320px; margin: 0 auto; padding: 22px 28px 60px; }
a { color: var(--blau); }
h1 { font-size: 1.45rem; margin: 0 0 4px; font-weight: 650; text-wrap: balance; }
h2 { font-size: 1.08rem; margin: 0 0 10px; font-weight: 650; }
h3 { font-size: .95rem; margin: 0 0 6px; font-weight: 650; }
p { margin: 0 0 8px; }
.leise { color: var(--leise); }
.klein { font-size: .85rem; }
.mono { font-family: var(--mono); }
.zahl { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.leer { color: var(--leise); padding: 24px 0; }

/* Leiste: am Arbeitsplatz links, am Handy unten */
.leiste { position: fixed; z-index: 50; top: env(safe-area-inset-top, 0px); bottom: 0; left: 0; width: var(--leiste-b);
  background: var(--kopf); display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; }
.leiste a { display: flex; align-items: center; gap: 10px; color: #cfdcf1; text-decoration: none; padding: 9px 10px; border-radius: 7px; font-size: .95rem; }
.leiste a:hover { background: rgba(255,255,255,.07); color: #fff; }
.leiste a.an { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; }
.leiste svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.leiste .marke { font-weight: 700; color: #fff; font-size: 1.05rem; margin-bottom: 12px; padding-left: 6px; }
.leiste .marke img { width: 28px; height: 28px; }
.leiste .marke:hover { background: none; }

.kopfzeile { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.kopfzeile .aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.zurueck { display: inline-block; font-size: .88rem; color: var(--leise); text-decoration: none; margin-bottom: 6px; }
.zurueck:hover { color: var(--blau); }

/* Flächen */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px 18px; }
.raster { display: grid; gap: 16px; }
.raster.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.raster > * { min-width: 0; }
.stapel { display: grid; gap: 16px; }
.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kennzahl { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 10px 14px; }
.kennzahl b { display: block; font-size: 1.45rem; font-variant-numeric: tabular-nums; font-weight: 650; }
.kennzahl span { font-size: .82rem; color: var(--leise); }
.kennzahl.warn b { color: var(--hinweis); } .kennzahl.rot b { color: var(--fehler); } .kennzahl.lila b { color: var(--offen); }

/* Knöpfe und Felder */
.knopf { font: inherit; font-weight: 550; border: 1px solid var(--blau); background: var(--blau); color: var(--auf-blau); border-radius: 7px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; touch-action: manipulation; }
.knopf:hover { filter: brightness(1.08); }
.knopf.zweit { background: var(--flaeche); color: var(--blau); }
.knopf.leicht { background: transparent; border-color: transparent; color: var(--blau); padding: 6px 8px; }
.knopf.gefahr { background: var(--flaeche); border-color: var(--fehler); color: var(--fehler); }
.knopf.klein { padding: 4px 9px; font-size: .85rem; }
.knopf:disabled { opacity: .5; cursor: default; filter: none; }
.knopf:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }
label.feld { display: grid; gap: 4px; font-size: .86rem; color: var(--leise); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 7px; padding: 8px 10px; min-width: 0; touch-action: manipulation; }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; }
textarea { resize: vertical; min-height: 70px; }
.formular { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; align-items: end; }
.formular .breit { grid-column: 1 / -1; }
.haken { display: flex; gap: 8px; align-items: center; font-size: .92rem; color: var(--text); }
.fehlertext { color: var(--fehler); font-size: .88rem; }
.erklaerung { font-size: .82rem; color: var(--leise); min-height: 1.1em; }
.erklaerung.rot { color: var(--fehler); }

/* Tabellen */
.tabelle-huelle { overflow-x: auto; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--linie2); vertical-align: top; }
th { font-weight: 600; color: var(--leise); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; background: var(--flaeche2); position: sticky; top: 0; z-index: 1; }
tr:last-child td { border-bottom: 0; }
tr.klick { cursor: pointer; }
tr.klick:hover td { background: var(--flaeche2); }
td.text { max-width: 380px; overflow-wrap: anywhere; }

/* Status */
.pille { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pille::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-ok { color: var(--ok); background: var(--ok-hell); }
.st-hinweis { color: var(--hinweis); background: var(--hinweis-hell); }
.st-fehler { color: var(--fehler); background: var(--fehler-hell); }
.st-offen { color: var(--offen); background: var(--offen-hell); }
.st-ausgelassen, .st-ignoriert, .st-exportiert { color: var(--aus); background: var(--aus-hell); }
.st-bereit { color: var(--ok); background: var(--ok-hell); }
tr.z-fehler td:first-child { box-shadow: inset 3px 0 0 var(--fehler); }
tr.z-offen td:first-child { box-shadow: inset 3px 0 0 var(--offen); }
tr.z-hinweis td:first-child { box-shadow: inset 3px 0 0 var(--hinweis); }
tr.z-ausgelassen td, tr.z-ignoriert td { color: var(--aus); }
.meldungen { font-size: .8rem; color: var(--leise); margin-top: 2px; }

/* Reiter */
.reiter { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin: 4px 0 14px; overflow-x: auto; }
.reiter button { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--leise); cursor: pointer; white-space: nowrap; }
.reiter button.an { color: var(--blau); border-bottom-color: var(--blau); font-weight: 600; }
.reiter .anz { font-size: .75rem; background: var(--flaeche2); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filter input[type=search] { flex: 1 1 220px; }

/* Restliste: Liste links, Einzelmaske rechts */
.restliste { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.restliste .liste { max-height: calc(100vh - 260px); overflow-y: auto; }
.offen-zeile { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 12px; border-bottom: 1px solid var(--linie2); cursor: pointer; }
.offen-zeile:hover { background: var(--flaeche2); }
.offen-zeile.an { background: var(--blau-hell); box-shadow: inset 3px 0 0 var(--blau); }
.offen-zeile.erledigt { opacity: .45; }
.offen-zeile .wert { font-family: var(--mono); font-size: .88rem; overflow-wrap: anywhere; }
.offen-zeile .neben { font-size: .8rem; color: var(--leise); grid-column: 1 / -1; }
.maske { position: sticky; top: 12px; display: grid; gap: 12px; }
.ebene { display: inline-flex; border: 1px solid var(--linie); border-radius: 7px; overflow: hidden; }
.ebene button { font: inherit; font-size: .88rem; border: 0; background: var(--flaeche); color: var(--leise); padding: 6px 12px; cursor: pointer; }
.ebene button.an { background: var(--blau); color: var(--auf-blau); }
.beispiele { font-size: .82rem; color: var(--leise); display: grid; gap: 2px; }
.schnell { display: flex; gap: 6px; flex-wrap: wrap; }

/* Zeilen-Liste allgemein */
.zeilenliste { display: grid; }
.zeilenliste a, .zeilenliste .z { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--linie2); text-decoration: none; color: inherit; align-items: center; }
.zeilenliste a:hover { color: var(--blau); }
.zeilenliste a:last-child { border-bottom: 0; }

/* Anmeldung */
.anmelden { max-width: 420px; margin: 8vh auto 40px; }
.anmelden .karte { display: grid; gap: 14px; padding: 24px; }
.anmelden .logo { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 1.2rem; }
.anmelden .logo img { width: 36px; height: 36px; }
.qr { background: #fff; padding: 10px; border-radius: 8px; width: max-content; max-width: 100%; }
.qr svg { display: block; width: 220px; height: 220px; max-width: 100%; }
.geheim { font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; background: var(--flaeche2); padding: 6px 8px; border-radius: 6px; }
.startpw { font-family: var(--mono); font-size: 1.1rem; background: var(--hinweis-hell); color: var(--text); padding: 8px 12px; border-radius: 6px; user-select: all; }

/* Ablage für Dateien */
.ablage { border: 1.5px dashed var(--blau); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; background: var(--flaeche); position: relative; }
.ablage.ueber { background: var(--blau-hell); }
.ablage input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.melder { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--text); color: var(--flaeche); padding: 10px 16px; border-radius: 8px; font-size: .92rem; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.melder.rot { background: var(--fehler); color: #fff; }
.melder button { font: inherit; color: inherit; background: none; border: 1px solid currentColor; border-radius: 6px; margin-left: 10px; padding: 2px 8px; cursor: pointer; }

.anleitung section { margin-bottom: 18px; }
.anleitung li { margin-bottom: 4px; }
.feldtabelle td { vertical-align: middle; }
.feldtabelle input { width: 100%; }
.drehen { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--linie); border-top-color: var(--blau); border-radius: 50%; animation: d 0.8s linear infinite; vertical-align: -3px; }
@keyframes d { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
  .restliste { grid-template-columns: 1fr; }
  .restliste .liste { max-height: none; }
  .maske { position: static; }
  .raster.drei { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  :root { --leiste-b: 0px; }
  #app { left: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .leiste { top: auto; width: auto; right: 0; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .leiste .marke { display: none; }
  .leiste a { flex-direction: column; gap: 2px; font-size: .68rem; padding: 6px 4px; flex: 1; text-align: center; }
  main { padding: 16px 16px 40px; }
  .raster.zwei, .raster.drei { grid-template-columns: 1fr; }
  td.text { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
[hidden] { display: none !important; }
.abstand { margin-top: 18px; }
.maske .ebene, .maske .schnell { justify-self: start; }
input:disabled { background: var(--flaeche2); color: var(--leise); border-style: dashed; }
