/* Stellplatz — Stile. Token-Contract nach shadcn-tokens, neutral (Verwaltungswerkzeug), kein Dark-Mode. */
:root {
  --background: #F4F5F7; --foreground: #1F2328; --card: #FFFFFF; --border: #CBD1D8; --input: #CBD1D8;
  --primary: #1F4E79; --primary-foreground: #FFFFFF; --primary-hell: #E6EEF6;
  --muted: #E8EBEF; --muted-foreground: #5B6470; --ring: #1F4E79;
  --ok: #009E73; --warn: #B8770A; --fehler: #B3261E; --fehler-hell: #F9DEDC; --radius: 6px;
  --schrift: system-ui, "Segoe UI", Arial, sans-serif; --mono: ui-monospace, Consolas, monospace;
  --frei-bg: #DDF3E4; --frei-fg: #009E73; --belegt-bg: #DCE9F5; --belegt-fg: #0072B2;
  --reserviert-bg: #FBE9C6; --reserviert-fg: #B8770A; --gesperrt-bg: #E9E9E9; --gesperrt-fg: #5F5F5F;
  --frist: #D55E00; --auswahl: #1F4E79; --plan-linie: #9AA3AE; --plan-flaeche: #EEF0F3;
  --kopf-h: 48px; --panel-b: 420px;
}
* { box-sizing: border-box; }
html { font-family: var(--schrift); font-size: 15px; color: var(--foreground); background: var(--background); font-variant-numeric: tabular-nums; }
body { margin: 0; min-height: 100vh; }
h1 { font-size: 1.25rem; margin: 0 0 .5rem; } h2 { font-size: 1.05rem; margin: 1rem 0 .4rem; } h3 { font-size: .95rem; margin: .8rem 0 .3rem; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .03em; }
p { margin: .3rem 0 .6rem; } .leise { color: var(--muted-foreground); } small.hinweis { color: var(--muted-foreground); display: block; margin-top: .2rem; }
a { color: var(--primary); } code { font-family: var(--mono); font-size: .9em; background: var(--muted); padding: 0 .3em; border-radius: 3px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Kopf */
#app { display: flex; flex-direction: column; height: 100vh; }
.kopf { height: var(--kopf-h); display: flex; align-items: center; gap: .75rem; padding: 0 .75rem; background: var(--card); border-bottom: 1px solid var(--border); flex: none; }
.marke { font-weight: 700; text-decoration: none; color: var(--foreground); display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.marke-p { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--primary); color: #fff; font-size: .9rem; }
.tabs { display: flex; gap: .15rem; } .tabs a { padding: .35rem .7rem; border-radius: var(--radius); text-decoration: none; color: var(--foreground); }
.tabs a:hover { background: var(--muted); } .tabs a.aktiv { background: var(--primary-hell); color: var(--primary); font-weight: 600; }
.zahl { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 1em; background: var(--primary); color: #fff; font-size: .75rem; text-align: center; margin-left: .2rem; }
.suche-wrap { flex: 1; max-width: 26rem; } #suche { width: 100%; }
.sync { font-size: .8rem; color: var(--muted-foreground); white-space: nowrap; } .sync.fehler { color: var(--fehler); font-weight: 600; }
.nutzermenue { position: relative; margin-left: auto; }
.menue { position: absolute; right: 0; top: calc(100% + 4px); min-width: 14rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .3rem; z-index: 30; display: flex; flex-direction: column; }
.menue a, .menue button { text-align: left; padding: .5rem .7rem; border: 0; background: none; font: inherit; color: var(--foreground); text-decoration: none; border-radius: 4px; cursor: pointer; }
.menue a:hover, .menue button:hover { background: var(--muted); }

/* Körper */
.koerper { flex: 1; display: flex; min-height: 0; }
#main { flex: 1; min-width: 0; overflow: auto; display: flex; flex-direction: column; }
#main > section { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: .6rem .75rem; }
.banner { padding: .5rem .75rem; background: var(--fehler-hell); color: var(--fehler); font-weight: 600; border-bottom: 1px solid var(--border); }
.banner.hinweis { background: var(--primary-hell); color: var(--primary); }
.leiste { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-bottom: .5rem; }
.gruppe { display: inline-flex; gap: .2rem; }
.legende { display: flex; gap: .7rem; font-size: .8rem; color: var(--muted-foreground); flex-wrap: wrap; }
.leg::before { content: ""; display: inline-block; width: .8em; height: .8em; border-radius: 2px; margin-right: .3em; vertical-align: -1px; border: 1px solid var(--border); }
.leg.frei::before { background: var(--frei-bg); } .leg.belegt::before { background: var(--belegt-bg); } .leg.reserviert::before { background: var(--reserviert-bg); } .leg.gesperrt::before { background: var(--gesperrt-bg); } .leg.frist::before { background: var(--frist); border-color: var(--frist); }
.zaehler { margin-left: auto; font-size: .85rem; color: var(--muted-foreground); }
.plan-wrap { flex: 1; min-height: 320px; position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.plan-wrap svg { width: 100%; height: 100%; display: block; touch-action: none; }
.tooltip { position: absolute; z-index: 20; max-width: 18rem; background: var(--foreground); color: #fff; padding: .45rem .6rem; border-radius: 6px; font-size: .82rem; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.tooltip b { display: block; font-size: .9rem; }

/* Knöpfe, Felder */
.knopf { font: inherit; padding: .4rem .8rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: pointer; line-height: 1.2; }
.knopf:hover { background: var(--muted); } .knopf:disabled { opacity: .5; cursor: default; }
.knopf.primaer { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); } .knopf.primaer:hover { filter: brightness(1.1); }
.knopf.leise { border-color: transparent; background: transparent; } .knopf.leise:hover { background: var(--muted); }
.knopf.gefahr { color: var(--fehler); border-color: var(--fehler); background: #fff; } .knopf.gefahr:hover { background: var(--fehler-hell); }
.knopf.umschalter.aktiv { background: var(--primary-hell); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.knopf.klein { padding: .2rem .5rem; font-size: .85rem; }
input, select, textarea { font: inherit; color: inherit; padding: .4rem .55rem; border: 1px solid var(--input); border-radius: var(--radius); background: #fff; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ring); outline-offset: 0; border-color: var(--ring); }
textarea { min-height: 4.5rem; resize: vertical; width: 100%; }
.feld { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .7rem; } .feld-label { font-size: .85rem; color: var(--muted-foreground); font-weight: 600; }
.feld input, .feld select { width: 100%; }
.zeile { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; } .zeile-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.radios { display: flex; flex-wrap: wrap; gap: .3rem; }
.radios label { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: #fff; }
.radios input { margin: 0; } .radios label:has(input:checked) { border-color: var(--primary); background: var(--primary-hell); font-weight: 600; }
.radios label.frei:has(input:checked) { background: var(--frei-bg); border-color: var(--frei-fg); } .radios label.belegt:has(input:checked) { background: var(--belegt-bg); border-color: var(--belegt-fg); }
.radios label.reserviert:has(input:checked) { background: var(--reserviert-bg); border-color: var(--reserviert-fg); } .radios label.gesperrt:has(input:checked) { background: var(--gesperrt-bg); border-color: var(--gesperrt-fg); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .3rem .2rem .6rem; background: var(--muted); border-radius: 1rem; font-family: var(--mono); font-size: .9rem; }
.chip button { border: 0; background: transparent; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .3rem; color: var(--muted-foreground); } .chip button:hover { color: var(--fehler); }
.chip-eingabe { display: flex; gap: .3rem; } .chip-eingabe input { flex: 1; text-transform: uppercase; }
.fehlertext { color: var(--fehler); font-weight: 600; margin: .3rem 0; } .oktext { color: var(--ok); font-weight: 600; }

/* Status-Glyphen (CSS-Formen) */
.glyph { display: inline-block; width: .7em; height: .7em; border-radius: 50%; border: 1.5px solid currentColor; vertical-align: -1px; margin-right: .35em; box-sizing: border-box; }
.glyph.frei { display: none; } .glyph.belegt { background: currentColor; } .glyph.reserviert { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.glyph.gesperrt { border: 0; border-radius: 0; width: auto; height: auto; font-weight: 700; line-height: 1; }
.legende .leg { display: inline-flex; align-items: center; }

/* Tabellen */
.tabelle-wrap { flex: 1; overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
table.tabelle { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabelle th, .tabelle td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
.tabelle th { position: sticky; top: 0; background: var(--muted); font-weight: 600; cursor: pointer; user-select: none; z-index: 1; }
.tabelle th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; } .tabelle th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
.tabelle tbody tr { cursor: pointer; } .tabelle tbody tr:hover { background: var(--primary-hell); } .tabelle tbody tr.aktiv { background: var(--primary-hell); outline: 2px solid var(--primary); outline-offset: -2px; }
.tabelle tr.frist-bald td:first-child { box-shadow: inset 4px 0 0 var(--frist); } .tabelle tr.frist-vorbei td:first-child { box-shadow: inset 4px 0 0 var(--fehler); }
.status-pille { display: inline-block; padding: .1rem .5rem; border-radius: 1rem; font-size: .8rem; font-weight: 600; border: 1px solid transparent; }
.status-pille.frei { background: var(--frei-bg); color: #0b5d45; } .status-pille.belegt { background: var(--belegt-bg); color: #0b4c78; } .status-pille.reserviert { background: var(--reserviert-bg); color: #7a4d00; } .status-pille.gesperrt { background: var(--gesperrt-bg); color: #444; }
.badge-frist { display: inline-block; padding: 0 .4rem; border-radius: 3px; background: var(--frist); color: #fff; font-size: .75rem; font-weight: 700; margin-left: .3rem; } .badge-frist.vorbei { background: var(--fehler); }
.kz { font-family: var(--mono); }
.filter-leiste { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding-bottom: .5rem; } .filter-leiste label { display: inline-flex; align-items: center; gap: .3rem; }
.leer { padding: 2rem; text-align: center; color: var(--muted-foreground); }

/* Panel */
.panel { width: var(--panel-b); flex: none; background: var(--card); border-left: 1px solid var(--border); overflow: auto; padding: .9rem 1rem 2rem; }
@media (max-width: 1699px) { .panel { position: fixed; right: 0; top: var(--kopf-h); bottom: 0; box-shadow: -8px 0 24px rgba(0,0,0,.12); z-index: 25; } }
.panel-kopf { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .4rem; } .panel-kopf h1 { margin: 0; font-size: 1.5rem; }
.panel-kopf .zu { margin-left: auto; }
.panel-meta { font-size: .8rem; color: var(--muted-foreground); margin-bottom: .8rem; }
.panel-fuss { display: flex; gap: .4rem; align-items: center; margin-top: 1rem; position: sticky; bottom: 0; background: var(--card); padding: .6rem 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.panel-fuss .rechts { margin-left: auto; }
.karte { border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .8rem; margin: .6rem 0; background: var(--background); }
.karte.warn { border-color: var(--warn); background: #FFF7E6; } .karte.fehler { border-color: var(--fehler); background: var(--fehler-hell); }
.konflikt-zeile { display: grid; grid-template-columns: 1fr; gap: .3rem; padding: .4rem 0; border-top: 1px solid var(--border); }
.konflikt-zeile label { display: block; padding: .25rem .4rem; border-radius: 4px; cursor: pointer; } .konflikt-zeile label:has(input:checked) { background: var(--primary-hell); }
.verlauf { list-style: none; padding: 0; margin: 0; } .verlauf li { padding: .5rem 0; border-top: 1px solid var(--border); font-size: .9rem; } .verlauf .wann { color: var(--muted-foreground); font-size: .8rem; }
.diff { margin: .2rem 0 0; padding-left: 1rem; } .diff li { list-style: disc; } .diff .von { text-decoration: line-through; color: var(--muted-foreground); }
.fremd-banner { position: sticky; top: 0; z-index: 2; }

/* Tor (Login/Einrichtung) */
.tor { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(180deg, #E9EEF4, var(--background)); }
.tor-karte { width: 100%; max-width: 30rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.6rem 1.7rem; box-shadow: 0 12px 40px rgba(31,78,121,.12); }
.tor-karte h1 { display: flex; align-items: center; gap: .5rem; } .tor-karte .knopf.primaer { width: 100%; padding: .6rem; font-weight: 600; }
.tor-links { display: flex; gap: 1rem; justify-content: space-between; margin-top: 1rem; font-size: .9rem; flex-wrap: wrap; }
.tor-links button { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: dreh .8s linear infinite; vertical-align: -2px; margin-right: .4rem; }
@keyframes dreh { to { transform: rotate(360deg); } }
.recovery { font-family: var(--mono); font-size: 1.25rem; letter-spacing: .06em; line-height: 1.7; padding: 1rem; background: var(--muted); border-radius: var(--radius); text-align: center; word-break: break-all; user-select: all; }
.code-anzeige { font-family: var(--mono); font-size: 1.8rem; letter-spacing: .15em; text-align: center; padding: .8rem; background: var(--muted); border-radius: var(--radius); user-select: all; }
.pruefliste { list-style: none; padding: 0; margin: 1rem 0; } .pruefliste li { display: grid; grid-template-columns: 1.5rem 1fr; gap: .5rem; padding: .45rem 0; border-top: 1px solid var(--border); }
.pruefliste li::before { content: "…"; color: var(--muted-foreground); font-weight: 700; } .pruefliste li.ok::before { content: "✓"; color: var(--ok); } .pruefliste li.warn::before { content: "!"; color: var(--warn); } .pruefliste li.fehler::before { content: "✗"; color: var(--fehler); }
.pruefliste small { display: block; color: var(--muted-foreground); grid-column: 2; }
.ergebnis { margin-top: 1rem; padding: .75rem 1rem; border-radius: var(--radius); background: var(--muted); font-weight: 600; } .ergebnis.ok { background: var(--frei-bg); } .ergebnis.fehler { background: var(--fehler-hell); }
main.selbsttest { max-width: 40rem; margin: 3rem auto; padding: 1.5rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* Nutzer-Seite, Druckseite, Änderungen */
.spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; align-items: start; }
.box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; } .box h2 { margin-top: 0; }
.druck-optionen { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding-bottom: .6rem; }
.druck-vorschau { flex: 1; overflow: auto; background: #fff; border: 1px solid var(--border); padding: 1rem; }
.druck-vorschau svg { width: 100%; height: auto; max-height: 70vh; }
.aenderung { display: grid; grid-template-columns: 9rem 1fr; gap: .8rem; padding: .5rem .2rem; border-bottom: 1px solid var(--border); cursor: pointer; } .aenderung:hover { background: var(--primary-hell); }
.aenderung .wann { color: var(--muted-foreground); font-size: .85rem; }

/* Dialog, Toasts */
dialog.dialog { border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1.4rem; max-width: 28rem; box-shadow: 0 16px 48px rgba(0,0,0,.2); } dialog::backdrop { background: rgba(31,35,40,.35); }
.dialog-knoepfe { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.toasts { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4rem; z-index: 50; pointer-events: none; }
.toast { background: var(--foreground); color: #fff; padding: .55rem .9rem; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.25); font-size: .92rem; transition: opacity .4s; }
.toast.ok { background: #0b5d45; } .toast.fehler { background: var(--fehler); } .toast.weg { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .toast { transition: none; } }
