/* DKVD-Portal. Farben und Schriften wie auf dkvd.de (Navy, Markierungsgelb, Kennzeichen-Rot). */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 200 900; font-display: swap; src: url("fonts/source-sans-3-latin-wght-normal.woff2") format("woff2"); }

:root {
  --navy: #243061;
  --navy-deep: #19224a;
  --ink: #161b2e;
  --ink-2: #4a5268;
  --ink-3: #596074;
  --paper: #f4f5f8;
  --white: #ffffff;
  --line: #d8dce6;
  --line-2: #c3c9d6;
  --signal: #f2b31f;
  --signal-ink: #1a1f36;
  --signal-soft: #fdf1d3;
  --plate-red: #c4122f;
  --red-soft: #fbe7ea;
  --ok: #2b7a4b;
  --ok-soft: #e2f1e8;
  --info-soft: #e4e8f5;
  --warn-soft: #fbeedd;
  --focus: #1b5fd1;
  --f-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(22, 27, 46, .06), 0 6px 18px rgba(22, 27, 46, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--f-body); min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; height: auto; }
a { color: var(--navy); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: .01em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--white); padding: 8px 12px; }
.muted { color: var(--ink-3); }
.small { font-size: .9rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf */
.top { background: var(--navy); color: var(--white); padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.brand { color: var(--white); text-decoration: none; font: 700 1.6rem/1 var(--f-display); letter-spacing: .05em; display: flex; align-items: baseline; gap: 8px; }
.brand small { font: 700 1.5rem/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--white); padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .35); }
.brand { align-items: center; gap: 14px; }
.brand img { display: block; height: 40px; width: auto; }
@media (max-width: 420px) { .brand img { height: 34px; } .brand small { font-size: 1.2rem; padding-left: 10px; } .brand { gap: 10px; } }
@media (max-width: 340px) { .brand img { height: 30px; } .brand small { font-size: 1rem; padding-left: 8px; } .brand { gap: 8px; } }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: #dfe4f6; text-decoration: none; padding: 7px 11px; border-radius: var(--radius); font-weight: 600; font-size: .98rem; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: var(--white); }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: var(--white); }
.who { display: flex; align-items: center; gap: 12px; font-size: .9rem; color: #c9d1ef; }
.who form { margin: 0; }
.linkbtn { background: none; border: 1px solid rgba(255, 255, 255, .4); color: var(--white); border-radius: var(--radius); padding: 5px 10px; font: 600 .88rem var(--f-body); cursor: pointer; }

.main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); display: grid; gap: 24px; align-content: start; }
.main.narrow { max-width: 560px; }
.foot { border-top: 1px solid var(--line); padding: 18px max(16px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); color: var(--ink-3); font-size: .88rem; text-align: center; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.pagehead .sub { color: var(--ink-3); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Meldungen */
.flash { border-radius: var(--radius); padding: 12px 14px; border-left: 4px solid var(--navy); background: var(--white); box-shadow: var(--shadow); }
.flash.ok { border-color: var(--ok); }
.flash.error { border-color: var(--plate-red); }
.flash.info { border-color: var(--signal); }

/* Karten und Flächen */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: -2px; }
.grid2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); align-items: start; }
.grid3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); align-items: start; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; text-decoration: none; color: inherit; display: grid; gap: 2px; }
.kpi b { font: 700 2rem/1 var(--f-display); }
.kpi span { color: var(--ink-3); font-size: .9rem; }
a.kpi:hover { border-color: var(--navy); }

/* Tabellen */
.tablewrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; background: var(--paper); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.rowlink { cursor: pointer; }
tbody tr.rowlink:hover td { background: #f8f9fb; }
td .sub { display: block; color: var(--ink-3); font-size: .86rem; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Status */
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .82rem; border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-new { background: #eceef4; color: var(--ink-2); }
.st-confirmed { background: var(--info-soft); color: var(--navy); }
.st-assigned { background: var(--signal-soft); color: var(--signal-ink); }
.st-picked_up { background: var(--warn-soft); color: #7a3e00; }
.st-delivered { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--red-soft); color: var(--plate-red); }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: #eceef4; color: var(--ink-2); }
.badge.warn { background: var(--signal-soft); color: var(--signal-ink); }
.badge.off { background: var(--red-soft); color: var(--plate-red); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.ordno { font-weight: 700; white-space: nowrap; }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 1rem var(--f-body); border-radius: var(--radius); padding: 9px 16px; border: 1px solid var(--navy); background: var(--navy); color: var(--white); cursor: pointer; text-decoration: none; min-height: 42px; }
.btn:hover { background: var(--navy-deep); }
.btn.ghost { background: var(--white); color: var(--navy); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--navy); }
.btn.sig { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.sig:hover { background: #e3a512; }
.btn.danger { background: var(--white); border-color: #e6a9b3; color: var(--plate-red); }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Formulare */
form.stack, .stack { display: grid; gap: 14px; }
.fields { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.field { display: grid; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
label, .label { font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.hint { font-size: .86rem; color: var(--ink-3); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=tel], input[type=search], select, textarea {
  font: 400 1rem var(--f-body); color: var(--ink); background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 9px 11px; width: 100%; min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--plate-red); background: #fff8f9; }
.err { color: var(--plate-red); font-size: .88rem; font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 16px; margin: 0; display: grid; gap: 14px; min-width: 0; background: var(--white); }
legend { font: 700 1.2rem var(--f-display); padding: 0 6px; letter-spacing: .02em; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); }
.check input { width: 20px; height: 20px; accent-color: var(--navy); }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px 12px; font-weight: 600; color: var(--ink); cursor: pointer; background: var(--white); }
.choice input { accent-color: var(--navy); width: 18px; height: 18px; }
.choice label:has(input:checked) { border-color: var(--navy); background: var(--info-soft); }
.formfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 160px; }
.filters .grow { flex: 1; min-width: 200px; }

/* Verlauf */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); margin-top: 5px; margin-left: 4px; position: relative; z-index: 1; }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.internal::before { background: var(--signal); }
.timeline time { display: block; color: var(--ink-3); font-size: .86rem; }

/* Protokoll-Ansicht */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.thumbs a { display: grid; gap: 4px; text-decoration: none; color: var(--ink-2); font-size: .8rem; }
.thumbs img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); }
.sigimg { max-width: 260px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.damage-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.damage-list li { display: flex; gap: 8px; align-items: flex-start; }
.dot { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--plate-red); color: var(--white); font-weight: 700; font-size: .78rem; }

/* Anmeldung */
.authbox { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 26px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.authbox .authlogo { display: block; height: 72px; width: auto; margin-bottom: 10px; }
.authbox .contact { display: grid; gap: 2px; }
.secret { font: 600 1.15rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 10px 12px; overflow-wrap: anywhere; }
.qr { justify-self: start; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.qr img { display: block; width: 216px; height: 216px; image-rendering: pixelated; }
.applinks { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .only-touch { display: inline-flex; justify-self: start; } }

/* Fahrer-App */
.role-driver .main { max-width: 640px; padding-top: 18px; gap: 16px; }
.tour { display: grid; gap: 6px; text-decoration: none; color: inherit; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.tour:hover { border-color: var(--navy); }
.tour .r { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour .when { font: 700 1.25rem var(--f-display); }
.stop { display: grid; gap: 8px; }
.stop .actions .btn { flex: 1; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.slot { position: relative; border: 2px dashed var(--line-2); border-radius: 8px; background: var(--white); min-height: 120px; display: grid; place-items: center; text-align: center; padding: 8px; cursor: pointer; overflow: hidden; }
.slot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.slot.done { border-style: solid; border-color: var(--ok); padding: 0; }
.slot.done img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; display: block; }
.slot .cap { font-weight: 600; font-size: .9rem; }
.slot.done .cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(22, 27, 46, .72); color: var(--white); padding: 4px 6px; font-size: .8rem; }
.slot.missing { border-color: var(--plate-red); }
.sketch { width: 100%; height: auto; display: block; background: var(--paper); border-radius: 8px; touch-action: manipulation; cursor: crosshair; }
.sigpad { width: 100%; height: 170px; display: block; background: var(--white); border: 1px solid var(--line-2); border-radius: 8px; touch-action: none; }
.damage-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.damage-row .photo { grid-column: 2 / -1; }
.stickybar { position: sticky; bottom: 0; background: var(--paper); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 8px; }
.netstate { font-size: .88rem; border-radius: var(--radius); padding: 8px 10px; background: var(--signal-soft); }
.netstate.ok { background: var(--ok-soft); }
.netstate[hidden] { display: none; }
.big-number { font: 700 1.6rem var(--f-display); }

@media (max-width: 700px) {
  .top { gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
  .who .name { display: none; }
  .main { padding-top: 20px; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.cards td { border: 0; padding: 0; }
  table.cards td[data-l]::before { content: attr(data-l) ": "; color: var(--ink-3); font-size: .85rem; }
  table.cards td.st-cell { grid-column: 2; grid-row: 1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Aufklappbereiche */
details > summary { cursor: pointer; padding: 2px 0; }
details.card > summary { list-style-position: inside; }
details[open] > summary { margin-bottom: 4px; }
.slot input[type=file] { z-index: 2; }
.slot img { position: relative; z-index: 1; }
#extras .stack { gap: 4px; }
#extras img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 4px; }
.tour .r .st { flex-shrink: 0; }
