/* Carbox · Mitarbeiterbereich
 *
 * Farben und Abstände sind aus dem Klickprototyp (Carbox-Intranet.dc.html)
 * übernommen. Dort standen alle Werte als style="..." direkt an den Elementen -
 * hier liegen sie als Klassen, damit die PHP-Seiten lesbar bleiben.
 *
 * Schriften: der Prototyp lädt Archivo und IBM Plex Mono von Google. Das
 * blockiert die Content-Security-Policy (und es meldet jede Mitarbeiter-IP an
 * Google), deshalb steht hier eine Kaskade mit denselben Schriften zuerst -
 * wer sie lokal installiert oder später unter assets/fonts/ einbindet, sieht
 * die Originaltypografie, alle anderen eine passende Systemschrift.
 */

:root {
  --bg: oklch(0.975 0.004 85);
  --surface: oklch(1 0 0);
  --surface2: oklch(0.985 0.003 85);
  --line: oklch(0.9 0.006 260);
  --line-soft: oklch(0.93 0.006 260);
  --line-strong: oklch(0.86 0.008 260);
  --ink: oklch(0.24 0.012 260);
  --body: oklch(0.4 0.015 260);
  --muted: oklch(0.5 0.015 260);
  --muted3: oklch(0.55 0.015 260);
  --accent: oklch(0.52 0.14 295);
  --accent-soft: oklch(0.96 0.02 295);
  --accent-line: oklch(0.85 0.05 295);
  --on-accent: oklch(1 0 0);
  --ok: oklch(0.52 0.12 155);
  --ok-soft: oklch(0.95 0.04 155);
  --warn: oklch(0.6 0.13 65);
  --warn-soft: oklch(0.96 0.05 65);
  --stop: oklch(0.55 0.16 25);
  --stop-soft: oklch(0.96 0.04 25);
  --sidebar: oklch(0.24 0.012 260);
  --sidebar-ink: oklch(0.97 0.006 260);
  --sidebar-muted: oklch(0.72 0.015 260);
  --sidebar-line: oklch(0.32 0.014 260);
  --stripe: oklch(0.93 0.006 260);
  --selection: oklch(0.9 0.05 295);
  /* Balken, die im Diagramm NICHT hervorgehoben sind. Eigener Ton statt
     --accent-line: der ist gegen Weiss zu blass (1,6:1) und fällt unter die
     Mindestgrenze für Diagrammflächen. Dieser Ton liegt bei 2,3:1 und bleibt
     trotzdem klar heller als der hervorgehobene Balken in --accent. */
  --chart-rest: oklch(0.74 0.08 295);

  --sans: 'Archivo', 'Segoe UI', Helvetica, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'Cascadia Mono', Consolas, 'Courier New', monospace;
}

html[data-theme="dark"] {
  --bg: oklch(0.17 0.008 265);
  --surface: oklch(0.215 0.009 265);
  --surface2: oklch(0.235 0.009 265);
  --line: oklch(0.3 0.012 265);
  --line-soft: oklch(0.28 0.012 265);
  --line-strong: oklch(0.38 0.014 265);
  --ink: oklch(0.95 0.006 265);
  --body: oklch(0.84 0.01 265);
  --muted: oklch(0.7 0.012 265);
  --muted3: oklch(0.66 0.012 265);
  --accent: oklch(0.74 0.13 295);
  --accent-soft: oklch(0.27 0.05 295);
  --accent-line: oklch(0.42 0.08 295);
  --on-accent: oklch(0.16 0.01 265);
  --ok: oklch(0.75 0.13 155);
  --ok-soft: oklch(0.28 0.05 155);
  --warn: oklch(0.8 0.13 70);
  --warn-soft: oklch(0.3 0.05 70);
  --stop: oklch(0.72 0.15 25);
  --stop-soft: oklch(0.3 0.06 25);
  --sidebar: oklch(0.13 0.008 265);
  --sidebar-ink: oklch(0.96 0.006 265);
  --sidebar-muted: oklch(0.68 0.012 265);
  --sidebar-line: oklch(0.26 0.012 265);
  --stripe: oklch(0.3 0.012 265);
  --selection: oklch(0.42 0.09 295);
  /* Gegen die dunkle Fläche nachgemessen (2,55:1), nicht aus dem hellen Ton
     umgerechnet. */
  --chart-rest: oklch(0.47 0.08 295);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--ink); }
::selection { background: var(--selection); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-line); outline-offset: -1px; }

/* --------------------------------------------------------------------------
   Grundgerüst: Seitenleiste + Hauptbereich
   -------------------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 22px 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px 22px;
  border-bottom: 1px solid var(--sidebar-line);
}

.logo-mark {
  width: 28px; height: 28px; flex: 0 0 28px;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--mono); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
}
.logo-word { font-weight: 700; font-size: 14px; letter-spacing: 0.1em; display: block; }
.logo-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--sidebar-muted); display: block; }

/* Kein flex: 1 - sonst füllt das Menü die ganze Höhe der Seitenleiste, und die
   wächst mit dem Seiteninhalt. Der Block mit Passwort und Abmelden rutschte
   dadurch auf langen Seiten ganz nach unten. Jetzt steht er direkt unter dem
   letzten Menüpunkt. */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; }
.sidebar-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-radius: 3px; padding: 10px 12px;
  font-size: 14px; font-weight: 500;
  color: var(--sidebar-ink);
}
.sidebar-nav a:hover { background: var(--sidebar-line); color: var(--sidebar-ink); }
.sidebar-nav a.active { background: var(--accent); color: var(--on-accent); }
.nav-badge { font-family: var(--mono); font-size: 11px; color: var(--sidebar-muted); }
.sidebar-nav a.active .nav-badge { color: var(--on-accent); }

.sidebar-foot { padding: 18px 22px 0; border-top: 1px solid var(--sidebar-line); }
.sidebar-user { font-size: 14px; font-weight: 600; }
.sidebar-role { font-family: var(--mono); font-size: 11px; color: var(--sidebar-muted); margin-top: 3px; }
.sidebar-actions { display: flex; gap: 8px; margin-top: 14px; }
.sidebar-actions a,
.sidebar-logout button {
  flex: 1; text-align: center;
  border: 1px solid var(--sidebar-line); background: transparent;
  color: var(--sidebar-ink);
  border-radius: 3px; padding: 9px;
  font-size: 13px; font-weight: 600;
}
.sidebar-logout { margin-top: 8px; }
.sidebar-logout button { width: 100%; }

.main { min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 20px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.topbar h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.015em; }
.topbar p { margin: 5px 0 0; font-size: 14px; color: var(--muted); }
.topbar-side { display: flex; align-items: center; gap: 10px; }
.topbar-date { font-family: var(--mono); font-size: 11px; color: var(--muted3); white-space: nowrap; }

.content { padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 16px; }

/* --------------------------------------------------------------------------
   Anmeldung / Registrierung / Ersteinrichtung
   -------------------------------------------------------------------------- */

/* min() in der Spaltenbreite: Ohne das bliebe die Spalte auch auf einem 375px
   breiten Telefon 380px breit - die Seite liesse sich dann seitlich schieben. */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.auth-side {
  display: flex; flex-direction: column; justify-content: center;
  padding: 64px 72px;
  background: var(--sidebar); color: var(--sidebar-ink);
}
.auth-side .sidebar-brand { border-bottom: none; padding: 0; }
.auth-headline { margin: 40px 0 0; font-size: 38px; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; max-width: 420px; }
.auth-lead { margin: 18px 0 0; max-width: 400px; font-size: 16px; line-height: 1.65; color: var(--sidebar-muted); }
.auth-facts {
  margin-top: 44px; display: flex; flex-direction: column; gap: 12px;
  font-family: var(--mono); font-size: 12px; color: var(--sidebar-muted);
  border-top: 1px solid var(--sidebar-line); padding-top: 24px;
}
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 40px; }
.auth-inner { width: 100%; max-width: 420px; }
.auth-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.auth-tabs { display: flex; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.auth-tabs a {
  flex: 1; text-align: center; padding: 12px 0;
  font-size: 14px; font-weight: 600;
  background: var(--surface); color: var(--muted);
}
.auth-tabs a.active { background: var(--accent); color: var(--on-accent); }
.auth-inner h2 { margin: 24px 0 4px; font-size: 22px; font-weight: 700; }
.auth-inner .hint { margin: 0 0 18px; font-size: 13px; line-height: 1.6; color: var(--muted); }

/* --------------------------------------------------------------------------
   Bausteine
   -------------------------------------------------------------------------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.panel-pad { padding: 24px; }
.panel-head {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.panel-head p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.panel-empty { padding: 22px 24px; font-size: 14px; color: var(--muted); }
.panel-empty p { margin: 0; }

/* Einklappbares Panel: <details class="panel panel-collapsible"> mit dem
   Kopf als <summary class="panel-head">. Zugeklappt fällt die Trennlinie unter
   dem Kopf weg, rechts steht "Anzeigen" bzw. "Ausblenden". */
.panel-collapsible > summary { cursor: pointer; list-style: none; }
.panel-collapsible > summary::-webkit-details-marker { display: none; }
.panel-collapsible:not([open]) > summary { border-bottom: 0; }
.panel-collapsible > summary::after {
  content: 'Anzeigen ▾'; font-family: var(--mono); font-size: 12px; color: var(--accent); white-space: nowrap;
}
.panel-collapsible[open] > summary::after { content: 'Ausblenden ▴'; }

.kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted3);
}
.kicker-stop { color: var(--stop); }
.kicker-warn { color: var(--warn); }
.kicker-ok { color: var(--ok); }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.stop { color: var(--stop); }
.nowrap { white-space: nowrap; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.grid-halves { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

/* Kachel als Spalte, damit die Beschriftung unten kleben kann (margin-top:auto
   an .kpi-note). Ohne das sitzt die Beschriftung direkt unter ihrem Wert, und
   weil die Werte unterschiedlich hoch ausfallen, steht sie in jeder Kachel
   einer Reihe auf einer anderen Höhe. */
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 20px;
  display: flex; flex-direction: column;
}
/* nowrap: Beträge kommen aus formatMoney() als "61.475.007 $". Ohne das bricht
   der Browser in einer schmalen Kachel am Leerzeichen um, und das
   Währungszeichen rutscht allein in die nächste Zeile.

   Die Schriftgrösse dazu etwas kleiner als früher (30px): Mit sechs Kacheln
   in einer Reihe ist eine achtstellige Summe samt " $" bei 30px rund zehn
   Pixel zu breit. 27px passt und ist im Schriftbild kaum zu unterscheiden. */
.kpi-value {
  font-family: var(--mono); font-size: 27px; font-weight: 500; margin-top: 10px;
  white-space: nowrap;
}
.kpi-value.is-accent { color: var(--accent); }
.kpi-value.is-warn { color: var(--warn); }
/* margin-top:auto schiebt die Beschriftung an den unteren Rand der Kachel -
   dadurch stehen alle Beschriftungen einer Reihe auf gleicher Höhe, egal wie
   viele Zeilen der Wert darüber braucht. padding-top hält den Mindestabstand,
   den vorher das margin gab. */
.kpi-note { font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 6px; }

/* Tabellen: im Prototyp Grid-Zeilen statt <table>. Hier bleibt es bei
   echten Tabellen - das ist für Screenreader und fürs Kopieren besser und
   sieht mit denselben Linien identisch aus. */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted3); font-weight: 400;
}
tbody td { padding: 14px 24px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.is-blocked { background: var(--stop-soft); }
tbody tr.is-open { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 13px; }
.cell-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; display: block; }

.status {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 2px; padding: 5px 8px; display: inline-block; white-space: nowrap;
}
.status-ok { color: var(--ok); background: var(--ok-soft); }
.status-warn { color: var(--warn); background: var(--warn-soft); }
.status-stop { color: var(--stop); background: var(--stop-soft); }
.status-accent { color: var(--accent); background: var(--accent-soft); }
.status-muted { color: var(--muted); background: var(--surface2); }

/* Formulare */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
label { display: block; }
label > span.field-label,
.field-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted3); display: block; margin-bottom: 7px;
}
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
input[type="datetime-local"], select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 11px 12px;
  font-size: 14px;
}
textarea { line-height: 1.55; resize: vertical; }
input.mono, select.mono { font-family: var(--mono); }
input.plate { font-family: var(--mono); font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
input.compact, select.compact { padding: 8px 9px; font-size: 13px; }

.btn {
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 3px;
  padding: 14px 22px; font-size: 15px; font-weight: 700;
  display: inline-block; text-align: center;
}
.btn:hover { color: var(--on-accent); }
.btn-block { width: 100%; }
.btn-small { padding: 9px 14px; font-size: 13px; font-weight: 600; }

.ghost-btn {
  background: transparent; border: 1px solid var(--line-strong); color: var(--ink);
  border-radius: 3px; padding: 9px 12px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--accent); }

.btn-outline {
  background: transparent; border: 1px solid var(--line-strong); color: var(--ink);
  border-radius: 3px; padding: 8px 12px; font-size: 13px; font-weight: 600;
}
.btn-danger { color: var(--stop); }
.btn-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }

.btn-compact { padding: 7px 10px; font-size: 12px; }

/* Rückgabe-Dialog mit Kofferraum-Abfrage (returnDialog() in helpers.php).
   Ein natives <dialog>: liegt über allem, auch über Tabellen, die am Telefon
   in einem scrollenden Kasten stehen - ein Aufklapp-Menü in der Zeile würde
   dort am Rand abgeschnitten. */
.return-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--ink);
}
.return-dialog::backdrop { background: oklch(0 0 0 / 0.5); }
.return-dialog > form { padding: 24px; }
.return-dialog h2 { margin: 6px 0 0; font-size: 19px; font-weight: 700; }

.choice {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  padding: 12px 14px; font-size: 14px; line-height: 1.45; cursor: pointer;
}
.choice input { margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* Punkteshop, Kontaktabfrage: Das Feld für den neuen Namen bzw. die neue
   Nummer erscheint erst, wenn "hat sich geändert" gewählt ist. */
.contact-new { display: none; margin-top: 8px; }
.contact-check:has(input[value="neu"]:checked) .contact-new { display: block; }

/* Kartencode der Kundenkarte: gesperrt gesetzt, damit man ihn ablesen kann. */
.card-code { letter-spacing: 0.18em; font-weight: 600; }

/* Das Notizfeld erscheint erst, wenn "Gegenstände gefunden" gewählt ist. Bei
   "leer" gibt es nichts zu notieren - ein offenes Feld würde nur verunsichern. */
.return-note { display: none; }
.return-dialog form:has(input[name="trunk_check"][value="fund"]:checked) .return-note { display: block; }

.inline-form { display: inline-block; margin: 0; }
.btn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* Umschalter (Features, Rechte): gedrückt = Akzentfarbe */
.toggle-chip {
  border: 1px solid var(--line-strong); background: transparent; color: var(--body);
  border-radius: 3px; padding: 9px 13px; font-size: 13px; font-weight: 500;
}
.toggle-chip.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* Die Feature-Auswahl sind versteckte Checkboxen mit sichtbarem Label - so
   sieht sie aus wie die Umschalter im Prototyp, funktioniert aber ohne
   JavaScript und bleibt per Tastatur bedienbar. */
.chip-row input[type="checkbox"]:checked + label.toggle-chip {
  border-color: var(--accent); background: var(--accent); color: var(--on-accent);
}
.chip-row input[type="checkbox"]:focus-visible + label.toggle-chip { outline: 2px solid var(--accent-line); outline-offset: 2px; }

.chip {
  font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--accent-line); border-radius: 2px;
  padding: 4px 7px; color: var(--body); display: inline-block;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Meldungen */
.alert { border-radius: 3px; padding: 14px 16px; font-size: 14px; line-height: 1.55; border: 1px solid; }
.alert p { margin: 7px 0 0; }
.alert-error { border-color: var(--stop); background: var(--stop-soft); }
.alert-success { border-color: var(--ok); background: var(--ok-soft); }
.alert-warn { border-color: var(--warn); background: var(--warn-soft); }
.alert-info { border-color: var(--accent-line); background: var(--accent-soft); }

/* Rechnungsgrund nach dem Verbuchen (rentals.php).
   Die Akzentkante links markiert ihn als Handlungsaufforderung: Dieser Text
   muss noch irgendwohin uebertragen werden, im Gegensatz zu allem anderen
   auf der Seite. */
.beleg-box { border-left: 3px solid var(--accent); margin-bottom: 18px; }
.beleg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Der Text selbst: gross genug zum Vorlesen am Schalter, umbruchsicher fuer
   lange Kennzeichen, und per Doppelklick als Ganzes markierbar - falls die
   Zwischenablage im Browser einmal blockiert ist. */
.beleg-text {
  margin: 16px 0 0; padding: 14px 16px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 3px;
  font-size: 15px; line-height: 1.5; color: var(--ink);
  overflow-wrap: anywhere; user-select: all;
}

.beleg-daten {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 20px; margin-top: 16px;
}
.beleg-daten > div { display: flex; flex-direction: column; gap: 4px; }
.beleg-daten span:last-child { font-size: 14px; }

@media (max-width: 640px) {
  .beleg-head { flex-direction: column; }
  .beleg-head .btn { width: 100%; }
}

.note-box {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 3px;
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}

/* Balken (Wochenumsatz, Flottenstatus) */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 150px; margin-top: 22px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 8px; }
.bar-value { font-family: var(--mono); font-size: 10px; color: var(--muted3); text-align: center; }
.bar { border-radius: 2px 2px 0 0; background: var(--accent-line); }
.bar.is-today { background: var(--accent); }
.bar-day { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; }

/* Zeitraum-Umschalter über einem Auswertungsabschnitt (statistics.php). */
.filter-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; scroll-margin-top: 110px; }
/* flex-wrap: Drei Beschriftungen wie "Neuester Vertrag · Rückgabe zuerst ·
   Am längsten draußen" sind am Telefon breiter als der Bildschirm. Ohne das
   Umbrechen schöbe der Umschalter die ganze Seite seitlich raus. */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.segmented a {
  padding: 9px 14px; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--muted);
}
.segmented a:hover { color: var(--ink); }
.segmented a.active { background: var(--accent); color: var(--on-accent); }

/* Uhrzeiten-Diagramm: 24 Spalten, eine je Stunde.
   Balken höchstens 24px breit mit 4px runder Oberkante und gerader Kante an
   der Grundlinie; zwischen den Spalten 2px Luft. Die ganze Spalte ist die
   Trefferfläche für den Hinweis, der schmale Balken allein wäre am Telefon
   kaum zu treffen. */
.hour-chart {
  display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px;
  margin-top: 14px; padding-top: 22px; /* Platz für die Zahl über der Spitze */
}
.hour-col { display: flex; flex-direction: column; align-items: stretch; outline: none; border-radius: 3px; }
.hour-plot {
  position: relative; height: 170px;
  display: flex; align-items: flex-end; justify-content: center;
  border-bottom: 1px solid var(--line);
}
.hour-bar {
  display: block; width: 100%; max-width: 24px; height: var(--h);
  background: var(--chart-rest); border-radius: 4px 4px 0 0;
}
.hour-col.is-peak .hour-bar { background: var(--accent); }

/* Die Zahl steht auf der Spitze, in Textfarbe - nie in der Balkenfarbe. */
.hour-cap {
  position: absolute; left: 50%; bottom: calc(var(--h) + 5px); transform: translateX(-50%);
  font-family: var(--mono); font-size: 11px; color: var(--ink); white-space: nowrap;
}
.hour-label {
  font-family: var(--mono); font-size: 10px; color: var(--muted3);
  text-align: center; padding-top: 6px; font-variant-numeric: tabular-nums;
}
.hour-axis-note { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; margin-top: 6px; }

/* Hover und Tastaturfokus zeigen dasselbe: leichte Fläche hinter der Spalte
   und den Hinweis mit Wert. Der Hinweis sitzt oben IM Diagramm und nicht
   darüber - am Telefon läge er sonst ausserhalb des Kastens und würde
   abgeschnitten. */
.hour-col:hover .hour-plot, .hour-col:focus-visible .hour-plot { background: var(--surface2); }
.hour-col:focus-visible { box-shadow: 0 0 0 2px var(--accent-line); }
.hour-tip {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: none; flex-direction: column; gap: 1px;
  background: var(--ink); color: var(--bg);
  border-radius: 3px; padding: 7px 9px;
  font-size: 12px; line-height: 1.35; white-space: nowrap; pointer-events: none;
}
.hour-tip strong { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.hour-col:hover .hour-tip, .hour-col:focus-visible .hour-tip { display: flex; }
/* Am linken und rechten Rand bündig statt mittig, sonst ragt der Hinweis
   bei den ersten und letzten Stunden aus dem Kasten. */
.hour-col:nth-child(-n+3) .hour-tip { left: 0; transform: none; }
.hour-col:nth-last-child(-n+3) .hour-tip { left: auto; right: 0; transform: none; }

.hour-table { margin-top: 18px; }
.hour-table summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.hour-table table { margin-top: 12px; }
.hour-table thead th, .hour-table tbody td { padding: 8px 12px; }

.meter { height: 6px; background: var(--line-soft); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.meter > div { height: 6px; }
.meter-ok > div { background: var(--ok); }
.meter-accent > div { background: var(--accent); }
.meter-stop > div { background: var(--stop); }

.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; }
.stat-row + .stat-row { margin-top: 10px; }
.stat-row .mono { font-size: 14px; }

/* auto-fit statt fester vier Spalten: Das Kassenbuch zeigt fünf Werte, die
   Kundenakte vier - beide sollen auf breiten Bildschirmen eine Zeile füllen. */
.split-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 3px; }
.split-4 > div { background: var(--surface); padding: 16px 18px; }
.split-4 .mono { font-size: 22px; margin-top: 8px; display: block; }

.list-row {
  padding: 16px 24px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.list-row:last-child { border-bottom: none; }
/* Text oben, Aktionen darunter - auch am Desktop.

   Für Listen mit vielen Knöpfen in schmalen Spalten. Die laufenden Verträge im
   Buchungstool stehen nur in der halben Seitenbreite (grid-halves) und tragen
   bis zu vier Aktionen. Nebeneinander brachen die Knöpfe dort in drei Reihen
   um, und für Kennzeichen, Mieter und Zeitraum blieben rund 300px - die
   Zeile daneben lief über zwei Zeilen und jede Vertragszeile war anders hoch.

   Untereinander bekommt der Text die volle Breite und passt in eine Zeile, die
   Knöpfe stehen in einer Reihe. Am Telefon macht die Media Query weiter unten
   dasselbe ohnehin schon für jede .list-row. */
.list-row.is-stacked { flex-direction: column; align-items: stretch; gap: 12px; }
.list-title { font-size: 15px; font-weight: 600; }
.list-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 5px; }

/* Editor-Layout (Rollen, Website) */
.editor { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.editor-3 { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.side-list { display: flex; flex-direction: column; gap: 6px; }
.side-list a {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 3px; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px; font-weight: 600;
}
.side-list a.active { border-color: var(--accent); background: var(--accent-soft); }
.side-list .count { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.side-list a.active .count { color: var(--accent); }

/* Bild-Upload im Website-Editor: hängt optisch am Feld für die
   Bildbeschriftung darüber, deshalb eingerückt und leicht abgesetzt. */
.image-slot {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-line);
  border-radius: 3px;
  background: var(--surface2);
  padding: 16px 18px;
  margin-top: -6px;
}
.image-slot input[type="file"] { font-size: 13px; max-width: 100%; }
.image-slot-preview { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.image-slot-preview img {
  width: 96px; height: 72px; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: 3px; background: var(--surface);
}

/* Eine Zeile einer Inhaltsliste (Tarif, Stelle, FAQ-Eintrag ...). */
.block-row { padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.block-row:last-of-type { border-bottom: none; }
.block-row-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.block-row .form-stack { gap: 12px; }

.permission-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 24px; border-bottom: 1px solid var(--line-soft);
}
.permission-row:last-of-type { border-bottom: none; }
.permission-row strong { display: block; font-size: 15px; }
.permission-row span.desc { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.permission-row button {
  min-width: 104px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 3px; padding: 9px 14px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted);
}
.permission-row button.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* --------------------------------------------------------------------------
   Mobile Ansicht
   --------------------------------------------------------------------------
   Der Mitarbeiterbereich wird auch am Telefon benutzt (Fahrzeug rausgeben,
   schnell eine Buchung verbuchen). Drei Dinge sind dafür nötig:

   1. Die Seitenleiste wird zur Schublade hinter einem Menüknopf. Gestapelt
      hätte sie sonst den halben Bildschirm belegt, bevor der Inhalt anfängt.
   2. Tabellen scrollen waagerecht in ihrem Panel statt die ganze Seite
      breitzuziehen. Eine echte Kartenansicht würde jede Tabelle in jeder
      Datei einzeln betreffen - der Nutzen wäre den Umbau nicht wert.
   3. Eingabefelder bekommen 16px Schriftgröße. Alles darunter lässt Safari
      auf dem iPhone beim Antippen in das Feld hineinzoomen.
   -------------------------------------------------------------------------- */

/* Knopf und Hintergrund gibt es nur in der schmalen Ansicht. */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  /* Schublade: liegt über dem Inhalt und ist erst nach dem Antippen da.
     Eigenes Scrollen, damit auch bei vielen Navigationspunkten der
     Abmelden-Knopf erreichbar bleibt. */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 264px; max-width: 84vw;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }

  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: oklch(0 0 0 / 0.45);
    opacity: 0; pointer-events: none;
    transition: opacity 0.22s ease;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 40px; height: 40px;
    background: transparent; border: 1px solid var(--line-strong); color: var(--ink);
    border-radius: 3px; font-size: 17px; line-height: 1;
  }

  .topbar { padding: 14px 16px; gap: 12px; }
  .topbar h1 { font-size: 19px; }
  .topbar p { font-size: 13px; margin-top: 3px; }
  .content { padding: 16px 16px 40px; }

  .editor { grid-template-columns: minmax(0, 1fr); }
  .split-4 { grid-template-columns: repeat(2, 1fr); }
  /* Bei ungerader Anzahl stünde neben dem letzten Wert eine leere, graue Zelle. */
  .split-4 > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .auth-side { padding: 40px 28px; }

  /* Zwei enge Spalten nebeneinander sind auf dem Telefon unlesbar - lieber
     etwas mehr Breite je Feld und dafür seltener zwei nebeneinander. */
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

  /* Nur Panels mit Tabelle scrollen - Formularpanels sollen weiter ganz
     normal umbrechen. Ohne das schiebt eine breite Tabelle die ganze Seite
     seitlich weg, und die Kopfzeile läuft mit aus dem Bild. */
  .panel:has(table) { overflow-x: auto; }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }

  table { min-width: 560px; }
  /* Schmale Tabellen mit zwei, drei Zahlenspalten passen ohne Mindestbreite. */
  table.table-compact { min-width: 0; }
  thead th, tbody td { padding-left: 16px; padding-right: 16px; }

  /* Uhrzeiten-Diagramm: Jede Spalte ist hier nur gut 12px breit. Die Stunden
     stehen deshalb nur an jeder dritten Spalte (0, 3, 6 ...) - der Platz der
     übrigen bleibt frei, damit die Beschriftung unter ihrem Balken bleibt. */
  .hour-plot { height: 140px; }
  .hour-col:not(:nth-child(3n+1)) .hour-label { visibility: hidden; }
  .segmented { width: 100%; }
  .segmented a { flex: 1; text-align: center; padding: 11px 6px; }

  /* Gegen das Hineinzoomen beim Antippen (siehe oben). */
  input[type="text"], input[type="password"], input[type="number"], input[type="search"],
  input[type="datetime-local"], select, textarea { font-size: 16px; padding: 12px; }
  input.compact, select.compact { font-size: 16px; padding: 10px; }

  /* Fingerkuppengrösse statt Mauszeigergrösse. */
  .btn { width: 100%; padding: 15px 20px; }
  .btn-outline, .ghost-btn, .toggle-chip { min-height: 40px; }
  .btn-row .btn, .btn-row .btn-outline { flex: 1 1 auto; }

  /* Nebeneinander wird untereinander: Diese Zeilen haben links einen Text
     und rechts eine Aktion - am Telefon fehlt dafür die Breite. */
  .list-row, .permission-row, .note-box, .panel-head, .block-row-head {
    flex-direction: column; align-items: flex-start;
  }
  .permission-row button { width: 100%; }
  .actions { justify-content: flex-start; }
  .stat-row { gap: 8px; }

  .bars { height: 120px; gap: 5px; }
  .bar-value { font-size: 9px; }

  .auth-side { padding: 32px 20px; }
  .auth-headline { font-size: 28px; margin-top: 28px; }
  .auth-lead { font-size: 15px; }
  .auth-facts { margin-top: 28px; padding-top: 18px; }
  .auth-main { padding: 32px 20px; }
}

@media (max-width: 420px) {
  .split-4 { grid-template-columns: minmax(0, 1fr); }
  .topbar-date { display: none; }
}

/* Doppelklick-Schutz (layout_bottom.php): Das Formular ist abgeschickt, die
   Antwort ist unterwegs - Knöpfe sichtbar gedämpft, damit klar ist, dass der
   erste Klick angekommen ist. */
form[data-sending] button:not([type="button"]) { opacity: .6; cursor: progress; }

/* Info-Symbol mit Bild (Buchungstool: Wo steht die Fahrzeug-ID?). Reines CSS:
   beim Darüberfahren oder - am Handy - beim Antippen (Fokus) klappt das Bild
   auf. Es öffnet nach rechts oben, damit es am linken Rand nicht abgeschnitten
   wird. */
.info-tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 6px; padding: 0; vertical-align: middle;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface);
  color: var(--muted); font: italic 600 11px/1 Georgia, 'Times New Roman', serif;
  text-transform: none; letter-spacing: 0; cursor: help;
}
.info-tip:hover, .info-tip:focus-visible { color: var(--accent); border-color: var(--accent); }
.info-tip-box {
  position: absolute; left: -8px; bottom: calc(100% + 8px); z-index: 30;
  display: none; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  font: 400 12px/1.4 var(--sans); font-style: normal; color: var(--ink); white-space: nowrap;
}
.info-tip:hover .info-tip-box, .info-tip:focus .info-tip-box { display: flex; }
.info-tip-box img { display: block; max-width: none; border-radius: 3px; }

/* ---------------------------------------------------------------------------
   Wettbüro
   --------------------------------------------------------------------------- */
.ok-text { color: var(--ok); }

/* Kundenansicht (index.php): eine Spalte ohne Seitenleiste. */
.public-content { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
.public-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.public-head .sidebar-brand { padding: 0; border: 0; margin: 0; }

/* Die Spiele im Scheinformular. */
.leg-rows { display: flex; flex-direction: column; gap: 10px; counter-reset: leg; }
.leg-row {
  display: grid; grid-template-columns: 118px minmax(0, 2fr) minmax(0, 1.2fr) 92px 38px;
  gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2);
}
.leg-row[hidden], .leg-free[hidden] { display: none; }
.leg-row .leg-free { grid-column: 2 / 5; }
.leg-row label { display: block; min-width: 0; }
.leg-row input, .leg-row select { width: 100%; }
.leg-remove {
  height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.leg-remove:hover { color: var(--stop); border-color: var(--stop); }

/* Gesamtquote und mögliche Auszahlung. */
.slip-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.slip-sum > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.slip-sum .mono { display: block; margin-top: 4px; font-size: 20px; color: var(--ink); }

/* Ein Schein mit seinen Tipps. */
.slip-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--surface); }
.slip-card + .slip-card { margin-top: 12px; }
.slip-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.slip-code { letter-spacing: 0.14em; font-weight: 600; }
.leg-list { display: flex; flex-direction: column; }
.leg-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); }
.leg-line:last-child { border-bottom: 0; }
.rank-badge {
  display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase;
}
.tip-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.tip-row:last-of-type { border-bottom: 0; }
.plus { color: var(--ok); }
.minus { color: var(--stop); }

@media (max-width: 900px) {
  .leg-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px; }
  .leg-row .leg-game { grid-column: 1 / -1; }
  .leg-row .leg-free { grid-column: 1 / -1; }
}

.public-head .logo-sub { color: var(--muted); }
