:root {
  /* Stapel-Farben (aus dem Logo) */
  --bg: #f4f3f0;
  --card: #ffffff;
  --ink: #2b2b2b;
  --anth: #3f3f3f;
  --gray: #6f6f6f;
  --muted: #5f5f5f;
  --line: #e2e1dd;
  --accent: #f9b71b;
  --accent-ink: #1f1f1f;
  --red: #b3261e;    --red-bg: #fbe9e7;
  --amber: #8a5a00;  --amber-bg: #fdf1d6;
  --green: #2f7d4f;  --green-bg: #e5f3ea;
  --grey-bg: #eceae5;
  --radius: 4px;
  --cond: "Barlow Condensed", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 60px; }
h1 { font-family: var(--cond); font-stretch: condensed; font-weight: 400; text-transform: uppercase; letter-spacing: .04em; font-size: 1.9rem; margin: 6px 0 14px; color: var(--anth); }
h2 { font-family: var(--cond); font-stretch: condensed; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 1.2rem; margin: 28px 0 10px; color: var(--anth); }
h3 { font-size: 1rem; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Kopfzeile */
.top {
  background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: space-between;
  gap: 10px 24px; padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: flex-end; gap: 10px; text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-app { font-family: var(--cond); font-stretch: condensed; font-size: 1.05rem; color: var(--gray); letter-spacing: .06em; line-height: 1; padding-bottom: 1px; }
.stripe { height: 8px; background: var(--gray); display: flex; justify-content: flex-end; }
.stripe span { width: 72px; background: var(--accent); }
.desk-nav { display: flex; align-items: center; gap: 2px 4px; flex-wrap: wrap; font-size: .95rem; }
.desk-nav > a, .dd > summary { text-decoration: none; padding: 8px 10px; border-bottom: 3px solid transparent; cursor: pointer; list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.desk-nav > a:hover, .dd > summary:hover { border-bottom-color: var(--line); }
.desk-nav > a.on { border-bottom-color: var(--accent); font-weight: 600; }
.dd { position: relative; }
.dd-menu { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 230px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px 0; }
.dd-right .dd-menu { left: auto; right: 0; }
.dd-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; text-decoration: none; }
.dd-menu a:hover { background: var(--bg); }
.dd > summary .ico, .dd-menu .ico { color: var(--gray); }
.badge { background: var(--red); color: #fff; border-radius: 99px; padding: 0 7px; font-size: .78rem; font-weight: 700; }
.app-foot { margin-top: 40px; text-align: center; }

/* Leiste unten (Handy) */
.tabbar { display: none; }
@media (max-width: 820px) {
  .desk-nav { display: none; }
  .top { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .brand-logo { height: 26px; }
  body.has-tabbar main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--anth); padding: 4px 4px max(8px, env(safe-area-inset-bottom)); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 5px; min-height: 52px;
    color: #e6e6e6; text-decoration: none; font-size: .72rem; }
  .tabbar a.on { color: var(--accent); }
  .tb-badge { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--accent); color: var(--accent-ink); font-size: .68rem;
    min-width: 17px; height: 17px; line-height: 17px; text-align: center; padding: 0 3px; }
}
.more-title { margin-top: 22px; }
.more-list { background: #fff; border: 1px solid var(--line); }
.more-list a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; border-bottom: 1px solid var(--line); min-height: 52px; }
.more-list a:last-child { border-bottom: 0; }
.more-list .ico { color: var(--gray); }
.more-list span:first-of-type { flex: 1; }
.chev { color: var(--gray); font-size: 1.3rem; }

/* Begrüßung */
.greet { position: fixed; inset: 0; z-index: 90; background: var(--anth); color: #fff; display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: pointer; animation: greet-in .35s ease-out; }
.greet.out { animation: greet-out .38s ease-in forwards; }
.greet-inner { text-align: center; max-width: 520px; }
.greet-hello { font-family: var(--cond); font-stretch: condensed; font-weight: 300; text-transform: uppercase; letter-spacing: .05em; font-size: 2.6rem; line-height: 1.1; }
.greet-sub { margin-top: 10px; font-size: 1.1rem; color: #e6e6e6; }
.greet-skip { margin-top: 26px; color: #bdbdbd; }
.wave { display: inline-block; transform-origin: 70% 80%; animation: wave 1.1s ease-in-out .25s 2; }
@keyframes wave { 0%,100% { transform: rotate(0); } 25% { transform: rotate(18deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(14deg); } }
@keyframes greet-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes greet-out { to { opacity: 0; transform: scale(1.02); } }
@media (prefers-reduced-motion: reduce) { .greet, .greet.out, .wave { animation: none; } }

/* Karten & Raster */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3, .card > b:first-child { font-family: var(--cond); font-stretch: condensed; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

/* Status */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.dot.overdue { background: var(--red); } .dot.soon { background: var(--amber); }
.dot.ok { background: var(--green); } .dot.unknown { background: #b9b4aa; }
.pill { display: inline-block; border-radius: 2px; padding: 1px 10px; font-size: .82rem; font-weight: 600; }
.pill.overdue, .pill.dringend { background: var(--red-bg); color: var(--red); }
.pill.soon, .pill.normal, .pill.in_arbeit { background: var(--amber-bg); color: var(--amber); }
.pill.ok, .pill.erledigt { background: var(--green-bg); color: var(--green); }
.pill.unknown, .pill.gering, .pill.offen { background: var(--grey-bg); color: var(--muted); }
.vcard { border-left: 5px solid var(--green); }
.vcard.overdue { border-left-color: var(--red); } .vcard.soon { border-left-color: var(--amber); }
.plate {
  display: inline-block; border: 2px solid var(--ink); border-radius: 2px; font-family: var(--cond); font-stretch: condensed; padding: 0 6px;
  font-weight: 700; font-size: .85rem; letter-spacing: .03em; background: #fff; white-space: nowrap;
}
.big-km { font-size: 1.35rem; font-weight: 700; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 3px;
  padding: 9px 14px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c9c3b8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary, .btn.dark { font-family: var(--cond); font-stretch: condensed; text-transform: uppercase; letter-spacing: .05em; font-size: 1.02rem; }
.btn.primary:hover { background: #e9a90e; border-color: #e9a90e; }
.btn.dark { background: var(--anth); border-color: var(--anth); color: #fff; }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 10px; font-size: .87rem; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn-grid .btn { padding: 14px 8px; font-size: 1rem; white-space: normal; text-align: center; }
.linkbtn { background: none; border: 0; color: var(--red); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* Formulare */
form.card { max-width: 640px; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 4px; }
label.check { font-weight: 500; display: flex; gap: 8px; align-items: center; margin: 8px 0; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfc9bf; border-radius: 3px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--anth); outline-offset: 0; border-color: var(--anth); }
:focus-visible { outline: 2px solid var(--anth); outline-offset: 2px; }
textarea { min-height: 90px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.filebox {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 2px dashed #cfc9bf; border-radius: 3px; padding: 16px; font-weight: 600; cursor: pointer; background: #faf9f6;
}
.filebox input { display: none; }
.fname { font-weight: 400; font-size: .85rem; color: var(--muted); word-break: break-all; }
.actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.radio-cards { display: grid; gap: 8px; }
.radio-cards label { margin: 0; font-weight: 500; border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px;
  display: flex; gap: 10px; align-items: center; cursor: pointer; }
.radio-cards input:checked + span { font-weight: 700; }

/* Meldungen */
.flash { padding: 11px 14px; border-radius: 3px; margin-bottom: 12px; font-weight: 500; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); }
.flash.warn { background: var(--amber-bg); color: var(--amber); }

/* Tabellen */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #faf9f6; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 700; background: #faf9f6; }

/* Aufmerksamkeit-Liste */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.attn li:last-child { border-bottom: 0; }
.attn .what { font-weight: 600; }

/* Peilstab */
.dipstick-wrap { margin: 14px 0 4px; user-select: none; }
.dipstick { position: relative; height: 74px; }
.dipstick svg { width: 100%; height: 64px; display: block; }
.dipstick input[type=range] {
  position: absolute; inset: 0; width: 100%; height: 74px; margin: 0; opacity: 0; cursor: pointer; touch-action: none;
}
.dip-lbl { position: absolute; top: -2px; transform: translateX(-50%); font-size: .75rem; font-weight: 800; pointer-events: none; }
.knob {
  position: absolute; top: 14px; width: 6px; height: 36px; margin-left: -3px; border-radius: 3px;
  background: var(--ink); box-shadow: 0 0 0 2px #fff; pointer-events: none;
}
.knob::after {
  content: ""; position: absolute; left: 50%; top: 38px; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff;
}
.dip-readout { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; }
.dip-value { font-size: 1.6rem; font-weight: 800; }
.dip-value.low { color: var(--red); } .dip-value.mid { color: var(--amber); } .dip-value.good { color: var(--green); }

/* Fahrzeug-Detail */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 0; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 2px; background: #fff; border: 1px solid var(--line); font-size: .9rem; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); }
.oilchart { width: 100%; height: auto; background: #faf9f6; border-radius: 3px; border: 1px solid var(--line); }
.empty { color: var(--muted); padding: 14px; text-align: center; }

/* Unterschrift */
.sigpad { position: relative; height: 170px; border: 1px solid #cfc9bf; border-radius: 3px; background: #fff; touch-action: none; }
.sigpad canvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.sig-line { position: absolute; left: 18px; right: 18px; bottom: 40px; border-bottom: 1.5px dashed #b9b4aa; pointer-events: none; }
.sig-hint { position: absolute; left: 20px; bottom: 46px; color: #b9b4aa; font-size: .9rem; pointer-events: none; }
.sig-clear { position: absolute; right: 8px; bottom: 6px; }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-pair img { width: 100%; border-radius: 3px; border: 1px solid var(--line); display: block; }
.yn { display: flex; gap: 8px; flex-wrap: wrap; }
.yn label { margin: 0; font-weight: 600; border: 1px solid var(--line); border-radius: 3px; padding: 8px 14px; display: flex; gap: 8px; align-items: center; cursor: pointer; }
fieldset.paper { border: 1px solid var(--line); border-radius: 3px; padding: 4px 14px 14px; margin: 14px 0 0; }
fieldset.paper legend { font-weight: 700; padding: 0 6px; }

@media (max-width: 560px) {
  .photo-pair { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
  .two { grid-template-columns: 1fr; }
  th, td { padding: 8px; }
  .hide-sm { display: none; }
}

/* Version 3 */
.idle-warn { position: fixed; inset: 0; background: rgba(43,43,43,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.idle-warn[hidden] { display: none; }
.idle-warn .card { max-width: 340px; }
.checks { display: grid; gap: 10px; margin-top: 8px; }
.checks .yn label { padding: 7px 12px; font-weight: 500; }
.checks .yn input:checked + span { font-weight: 700; }
.check-row { border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; }
.check-row b { display: block; margin-bottom: 6px; }
.trailer-box { margin-top: 12px; padding: 10px 12px; border-radius: 3px; background: #faf9f6; border: 1px dashed #cfc9bf; }
.trailer-box form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.trailer-box select { flex: 1; min-width: 160px; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--card); }
.cal th { text-align: center; }
.cal td { height: 92px; vertical-align: top; padding: 4px; border: 1px solid var(--line); font-size: .8rem; }
.cal td.other { background: #f6f4ef; }
.cal td.today { outline: 3px solid var(--accent); outline-offset: -2px; }
.cal .dnum { font-weight: 700; color: var(--muted); }
.cal .ev { display: block; margin-top: 3px; padding: 2px 5px; border-radius: 3px; background: var(--amber-bg); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.done { background: var(--green-bg); }
.perm-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.perm-grid label { margin: 0; font-weight: 500; display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 3px; padding: 7px 10px; }
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.settings-nav a { text-decoration: none; padding: 6px 12px; border-radius: 2px; background: #fff; border: 1px solid var(--line); font-size: .9rem; }
@media (max-width: 560px) { .cal td { height: 64px; font-size: .7rem; } .cal .ev { white-space: normal; } }
.yn label.bad { color: var(--red); border-color: #f0c8c3; }

/* Version 4 */
.dev-code { font-family: var(--cond); font-stretch: condensed; font-size: 3rem; font-weight: 600; letter-spacing: .18em; text-align: center;
  background: var(--anth); color: #fff; padding: 14px 10px; margin: 10px 0 14px; border-bottom: 6px solid var(--accent); }
.passkey-btn { width: 100%; min-height: 54px; margin-bottom: 6px; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .87rem; margin: 14px 0 4px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.brief-list { margin: 0 0 12px; padding-left: 22px; }
.brief-list li { margin: 6px 0; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
