/* tsf Markenrichtlinie (Juli 2026): Navy trägt den Inhalt, Grün setzt den Akzent.
   Schrift: Gluch (Bold = Überschriften/Kennzahlen, Regular = Text, Italic = Hervorhebungen). */
@font-face { font-family: "Gluch"; src: url("/static/fonts/gluch-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Gluch"; src: url("/static/fonts/gluch-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Gluch"; src: url("/static/fonts/gluch-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  /* Markenfarben – dunkle Variante: Navy Dunkel als Grund, Navy für Karten, Weiß für Text */
  --green: #00C185;        /* Primärgrün: Akzente, Buttons (auf Navy auch als Text lesbar) */
  --btn-text: #1D2F49;     /* Navy auf grünen Buttons */
  --navy-dark: #111A34;    /* Seitenhintergrund, Kopfzeile */
  --card: #1D2F49;         /* Navy: Karten */
  --surface: #16243E;      /* Kacheln/Panels innerhalb einer Karte */
  --text: #FFFFFF;
  --line: #2E4260;         /* Trennlinien */
  --field: #3E5575;        /* Rahmen von Eingabefeldern */
  --field-bg: #111A34;
  --muted: #A9B6C8;        /* Grau-Blau, abgedunkelt für Nebentext */
  --green-soft: rgba(0,193,133,0.14);
  --green-text: #00C185;
  --warn: #FFB756;         /* Akzent Orange */
  --warn-soft: rgba(255,183,86,0.14);
  --warn-text: #FFB756;
  --danger: #FF7C79;       /* Akzent Koralle */
  --danger-soft: rgba(255,124,121,0.14);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--navy-dark);
  color: var(--text);
  font-family: "Gluch", Calibri, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--text); text-decoration-color: var(--green); text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }

/* Kopfzeile / Navigation */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--navy-dark); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; margin-right: auto; font-weight: 700; }
.brand img { height: 28px; width: auto; display: block; }
.brand span { padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.25); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: rgba(255,255,255,0.8); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 0.92rem;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav a.on { color: #fff; border-bottom-color: var(--green); border-radius: 8px 8px 0 0; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 16px; }
.subnav a {
  padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--field);
  color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.subnav a.on { border-color: var(--green); background: var(--green-soft); font-weight: 700; }

.wrap { display: flex; justify-content: center; padding: 16px; }
.card {
  background: var(--card); border-radius: 12px; padding: 22px; width: 100%; max-width: 480px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.card.wide { max-width: 1040px; }
h1 { font-size: 1.45rem; margin: 0 0 14px; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
label { display: block; margin: 12px 0 6px; font-size: 0.88rem; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--field);
  background: var(--field-bg); color: var(--text); font-size: 1rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.hint { color: var(--muted); font-size: 0.88rem; }
.hint.warn, .readout.warn { color: var(--warn-text); }
.hint.ok { color: var(--green-text); }
.hidden { display: none !important; }
code { background: var(--surface); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

/* Meldungen */
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 0.92rem; border-left: 4px solid; }
.flash.ok { background: var(--green-soft); border-color: var(--green); }
.flash.err { background: var(--danger-soft); border-color: var(--danger); }
.flash.warn { background: var(--warn-soft); border-color: var(--warn); }

/* Erfassung */
.driver-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.driver-btn {
  padding: 12px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; text-align: left; display: flex; gap: 10px; align-items: center;
  font-family: inherit;
}
.driver-btn .k { font-weight: 700; font-size: 1.05rem; display: block; }
.driver-btn .kz { font-size: 0.8rem; color: var(--muted); display: block; }
.driver-btn.selected { border-color: var(--green); background: var(--green-soft); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.file-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 20px;
  border: 2px dashed var(--field); border-radius: 12px; cursor: pointer; margin-top: 16px;
  color: var(--text); font-weight: 700; background: var(--surface);
}
.file-btn svg { width: 26px; height: 26px; flex: none; }
.file-btn input { display: none; }
.step { margin-top: 16px; }
#cropWrap { touch-action: none; margin-top: 10px; border-radius: 12px; overflow: hidden; }
#cropCanvas { width: 100%; display: block; touch-action: none; }
#cropPreview { max-width: 100%; border-radius: 10px; margin-bottom: 6px; }
.success { color: var(--text); font-size: 1.05rem; background: var(--green-soft); border-left: 4px solid var(--green); padding: 12px 14px; border-radius: 10px; }
.footer-link { margin-top: 24px; text-align: center; }
input.check { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(255,183,86,0.45); }
#valueInput {
  font-size: 2rem; text-align: center; letter-spacing: 0.12em; padding: 12px;
  font-variant-numeric: tabular-nums; font-weight: 700;
}
.readout { text-align: center; font-size: 1.15rem; font-weight: 700; margin-top: 8px; min-height: 1.4em; }

/* Buttons – Primär: Grün mit Navy-Schrift (Weiß auf Grün wäre zu kontrastarm) */
.row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; font-size: 1rem; cursor: pointer;
  font-family: inherit; text-decoration: none; text-align: center; display: inline-block;
}
.btn.primary { background: var(--green); color: var(--btn-text); font-weight: 700; }
.btn.primary:active { filter: brightness(0.92); }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--field); }
.btn.secondary:active, .driver-btn:active { background: var(--surface); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(198,40,40,0.5); }
.btn.sm { flex: none; padding: 6px 10px; font-size: 0.85rem; border-radius: 8px; }
.btn:disabled { opacity: 0.6; }

/* Touch: kein Doppeltipp-Zoom, kein grauer Tipp-Blitz */
a, button, input, select, textarea, summary, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Tabellen */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 2px solid var(--field); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.sum td { font-weight: 700; border-top: 2px solid var(--field); }
tr.inactive td { color: var(--muted); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem;
  border: 1px solid var(--field); color: var(--muted); background: var(--card); white-space: nowrap;
}
.badge.warn { border-color: var(--warn); background: var(--warn-soft); color: var(--warn-text); }
.badge.err { border-color: rgba(198,40,40,0.5); background: var(--danger-soft); color: var(--danger); }
.badge.ok { border-color: var(--green); background: var(--green-soft); color: var(--green-text); }

/* Formulare im Admin */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; align-items: end; }
.form-grid .btn { margin-top: 12px; }
td input[type=text], td input[type=number] { padding: 6px 8px; font-size: 0.9rem; min-width: 70px; }
.inline { display: inline; }
.panel { background: var(--surface); border-radius: 12px; padding: 14px 16px; margin: 12px 0; }

/* Auswertung */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 18px; }
.filters .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.filters .seg a {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--field); color: var(--text);
  text-decoration: none; font-size: 0.88rem; background: var(--card);
}
.filters .seg a.on { border-color: var(--green); background: var(--green-soft); font-weight: 700; }
.filters form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.filters input[type=date] { width: auto; padding: 6px 8px; font-size: 0.88rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border-radius: 12px; padding: 14px 16px; }
.tile .lbl { color: var(--muted); font-size: 0.82rem; }
.tile .val { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -0.01em; }
.tile .val small { font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.share-bar { height: 6px; border-radius: 3px; background: var(--line); min-width: 60px; overflow: hidden; }
.share-bar span { display: block; height: 100%; border-radius: 3px; }

.chart-box { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 6px; }
.chart-box svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 0.85rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.grid line { stroke: var(--line); stroke-width: 1; }
.hit { fill: transparent; cursor: default; }
.hit:hover { fill: rgba(255,255,255,0.05); }
.tooltip {
  position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font-size: 0.82rem; min-width: 170px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4); z-index: 5;
}
.tooltip .t { font-weight: 700; margin-bottom: 4px; }
.tooltip .r { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tooltip .r span:first-child { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.tooltip .r b { font-variant-numeric: tabular-nums; font-weight: 700; }
.tooltip hr { border: none; border-top: 1px solid var(--line); margin: 5px 0; }

details summary { cursor: pointer; margin: 8px 0; }
.check-list { margin: 0; padding-left: 18px; }
.check-list li { margin: 3px 0; }

/* Finger statt Maus (iPhone/Android): Tippflächen mind. 44 px, Eingabefelder 16 px
   (kleiner zoomt iOS beim Antippen ungefragt in die Seite) */
@media (pointer: coarse) {
  .nav a, .subnav a, .filters .seg a { min-height: 44px; display: inline-flex; align-items: center; }
  .btn { min-height: 48px; }
  .btn.sm { min-height: 44px; padding: 10px 14px; display: inline-flex; align-items: center; justify-content: center; }
  input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
  select, textarea, td input[type=text], td input[type=number], .filters input[type=date] {
    font-size: 16px; min-height: 44px;
  }
  details summary { padding: 10px 0; }
  .footer-link a { display: inline-block; padding: 12px; }
}

.only-mob { display: none; }
@media (max-width: 560px) {
  .only-mob { display: block; }
  .only-desk { display: none; }
  .card { padding: 16px; }
  .wrap { padding: 10px; }
  .filters form { margin-left: 0; }
  .hide-sm { display: none; }
  .brand span { display: none; }
  .subnav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .subnav a { flex: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px; }
  .tile .val { font-size: 1.3rem; }
}

/* Belegt-Anzeige */
.chargebox { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; border-left: 4px solid; background: var(--surface); }
.chargebox.free { border-color: var(--green); }
.chargebox.busy { border-color: var(--warn); }
.chargebox .row { margin-top: 10px; }

/* Fahrzeugbilder */
.driver-btn .dbody { display: flex; gap: 10px; align-items: center; }
.driver-btn.has-img { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; gap: 0; }
.driver-btn.has-img .dbody { padding: 10px; }
.driver-btn .vimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.vthumb { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid; vertical-align: middle; }
.vimg-form { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; vertical-align: middle; margin: 4px 0; }
.vcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.vcard { background: var(--surface); border-radius: 12px; overflow: hidden; }
.vcard .vimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.vcard .vimg-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--field-bg); }
.vcard-body { padding: 10px 12px; }

.appfoot { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 4px 16px 20px; }

/* Textlink als Button (z. B. "Ohne Foto eingeben") */
.linkbtn {
  background: none; border: none; padding: 8px 4px; color: var(--text); font: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 3px;
}

/* Fahrer-Verwaltung */
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0; color: var(--text); font-size: 0.95rem; }
label.check input { width: 20px; height: 20px; accent-color: var(--green); }
label.check.inactive { color: var(--muted); }
.panel.driver.inactive { opacity: 0.6; }
.driver-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.driver-head input { flex: 1 1 200px; font-weight: 700; }
.invite { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; border-left: 4px solid var(--green); }
.invite-qr svg { width: 180px; height: 180px; display: block; border-radius: 8px; }
.invite-qr { flex: none; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; word-break: break-all; }
.edit-own { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.edit-own input { width: auto; flex: 1 1 140px; }

/* QR-Aushang: auf Papier hell (grünes Logo auf Weiß laut Markenrichtlinie) */
body.print-page { background: #fff; color: #1D2F49; }
.print-actions { display: flex; gap: 8px; justify-content: center; padding: 12px; background: var(--navy-dark); }
.print-actions .btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.poster { max-width: 680px; margin: 0 auto; padding: 32px 24px; text-align: center; color: #1D2F49; }
.poster-logo { width: 160px; height: auto; margin-bottom: 18px; }
.poster h1 { font-size: 2rem; margin: 0 0 8px; }
.poster-lede { font-size: 1.2rem; font-style: italic; margin: 0 0 20px; }
.poster-qr svg { width: 300px; height: 300px; display: block; margin: 0 auto; }
.poster-url { font-size: 1rem; color: #5B6B80; margin: 4px 0 24px; word-break: break-all; }
.poster-steps { text-align: left; font-size: 1.1rem; line-height: 1.6; max-width: 520px; margin: 0 auto; padding-left: 24px; }
.poster-steps li { margin-bottom: 8px; }
.poster-note { margin-top: 24px; color: #5B6B80; }
@media print {
  .print-actions { display: none; }
  .poster { padding-top: 0; }
  @page { size: A4; margin: 18mm; }
}
