/* ============ Werkstatt – mobile first ============ */
:root {
  --bg: #eceef2; --card: #ffffff; --card-2: #f6f7f9; --text: #141820; --muted: #687083; --line: #e1e4ea;
  --accent: #f26b1d; --accent-2: #ff8a3d; --accent-ink: #ffffff; --accent-soft: #fff1e8;
  --bar: #11151c; --bar-text: #e9ecf1; --bar-muted: #8c95a6;
  --ok: #138a43; --ok-bg: #e5f5eb; --warn: #a15c00; --warn-bg: #fff2d6; --bad: #c4291c; --bad-bg: #fde7e5;
  --blue: #2563eb; --amber: #d97706; --green: #16a34a; --red: #dc2626; --purple: #7c3aed; --cyan: #0891b2; --slate: #64748b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --radius: 14px;
  --nav-h: 64px;
}
/* Dunkel: automatisch nach Systemeinstellung, außer der Benutzer hat "Hell" gewählt – oder fest "Dunkel" */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e13; --card: #161a22; --card-2: #1d222c; --text: #e8ebf0; --muted: #949cab; --line: #272d38;
    --accent-soft: #3a2113; --bar: #07090d;
    --ok: #4ade80; --ok-bg: #0f2a1a; --warn: #fbbf24; --warn-bg: #33260b; --bad: #f87171; --bad-bg: #3a1513;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0e13; --card: #161a22; --card-2: #1d222c; --text: #e8ebf0; --muted: #949cab; --line: #272d38;
  --accent-soft: #3a2113; --bar: #07090d;
  --ok: #4ade80; --ok-bg: #0f2a1a; --warn: #fbbf24; --warn-bg: #33260b; --bad: #f87171; --bad-bg: #3a1513;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
html { transition: background-color .2s; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-padding-top: 70px; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.lg { width: 26px; height: 26px; }

/* ---------- Kopfzeile ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bar); color: var(--bar-text);
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); }
.topbar .in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--bar-text); font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.brandlogo { display: inline-flex; align-items: center; background: #fff; border-radius: 9px; padding: 4px 8px; }
.brandlogo img { height: 26px; width: auto; max-width: 160px; object-fit: contain; }
.login .brandlogo img { height: 44px; max-width: 240px; }
.topnav { display: none; gap: 4px; flex: 1; }
.topnav a { color: var(--bar-muted); font-weight: 600; padding: 7px 12px; border-radius: 9px; display: flex; gap: 7px; align-items: center; }
.topnav a:hover { color: var(--bar-text); background: rgba(255,255,255,.06); }
.topnav a.active { color: #fff; background: rgba(255,255,255,.1); }
.usermenu { margin-left: auto; position: relative; }
.usermenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--bar-muted); font-size: 14px; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #2a313d; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.usermenu .menu { position: absolute; right: 0; top: 44px; background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 210px; padding: 6px; z-index: 30;
  max-height: calc(100dvh - 56px - var(--nav-h) - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 860px) { .usermenu .menu { max-height: calc(100dvh - 60px); } }
.usermenu .menu .who { padding: 8px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu .menu a, .usermenu .menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px; border-radius: 8px;
  color: var(--text); font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer; text-align: left; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--card-2); }
.card.roles { display: grid; gap: 10px; }
.card.roles > div { display: grid; gap: 2px; padding-left: 10px; border-left: 3px solid var(--accent-soft); }
@media (min-width: 700px) { .card.roles { grid-template-columns: 1fr 1fr; } }
.usermenu .menu .themepick { padding: 8px 10px 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
.themepick .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.themepick .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; }
.usermenu .menu .themepick .seg button { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 12px; justify-content: center;
  text-align: center; color: var(--muted); border-radius: 7px; transition: background .15s, color .15s; }
.usermenu .menu .themepick .seg button .i { width: 18px; height: 18px; }
.usermenu .menu .themepick .seg button.on { background: var(--card); color: var(--accent); box-shadow: var(--shadow); font-weight: 600; }

/* ---------- Navigationsleiste unten (Handy) ---------- */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,.05); }
.bottomnav a { height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; }
.bottomnav a.active { color: var(--accent); }
.bottomnav a.active .i { stroke-width: 2.4; }

@media (min-width: 860px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  body { padding-bottom: 40px; }
}

/* ---------- Layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 16px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 15px; }
.section { margin: 26px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section h2 { display: flex; align-items: center; gap: 8px; }
.section h2 .count { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; padding: 1px 8px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.grid > * { min-width: 0; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid.cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 640px) and (max-width: 999px) { .grid.cards { grid-template-columns: 1fr 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: 12px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, details.more > summary { display: flex; align-items: center; gap: 8px; }
.item .meta .i, .muted.small .i { width: 15px; height: 15px; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.hidden { display: none !important; }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; }
.empty .i { width: 34px; height: 34px; margin: 0 auto 8px; opacity: .5; }

/* ---------- Kennzahlen ---------- */
.kpis { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 14px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.kpi .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.accent { background: linear-gradient(135deg, var(--accent), #e2520c); border-color: transparent; color: #fff; }
.kpi.accent .lbl, .kpi.accent .hint { color: rgba(255,255,255,.85); }
.kpi.bad .val { color: var(--bad); } .kpi.warn .val { color: var(--warn); } .kpi.ok .val { color: var(--ok); }
a.kpi { color: inherit; }

/* ---------- Status-Kacheln ---------- */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; box-shadow: var(--shadow); border-top: 4px solid var(--slate); }
.tile.ok { border-top-color: var(--ok); } .tile.warn { border-top-color: var(--amber); } .tile.bad { border-top-color: var(--bad); } .tile.muted { border-top-color: var(--line); }
.tile .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tile .val { font-size: 16.5px; font-weight: 800; margin-top: 3px; line-height: 1.2; }
.tile.bad .val { color: var(--bad); } .tile.warn .val { color: var(--warn); }
@media (max-width: 420px) { .tile .val { font-size: 14.5px; } }

/* ---------- Pills / Chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.muted { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Nummernschild (EU) ---------- */
.plate { display: inline-flex; align-items: stretch; background: #fff; color: #111; border: 2px solid #111; border-radius: 5px;
  font: 700 15px/1 "DIN Alternate", "Bahnschrift", ui-monospace, Consolas, monospace; letter-spacing: .04em; overflow: hidden; white-space: nowrap; }
.plate::before { content: "D"; background: #1f47b8; color: #fff; font: 700 10px/1 system-ui, sans-serif; padding: 0 4px; display: flex; align-items: flex-end; padding-bottom: 3px; }
.plate span { padding: 5px 8px 4px; }
.plate.lg { font-size: 22px; border-width: 2.5px; }
.plate.lg::before { font-size: 12px; padding: 0 6px 4px; }
.plate.lg span { padding: 6px 11px 5px; }

/* ---------- Listen-Karten ---------- */
.list { display: grid; gap: 10px; }
.list > * { min-width: 0; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; color: inherit; position: relative; }
a.item:hover { border-color: var(--accent); }
.item .thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: var(--card-2); display: grid; place-items: center; color: var(--muted); }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item .meta { color: var(--muted); font-size: 13.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .side { text-align: right; display: grid; gap: 4px; justify-items: end; flex: 0 1 auto; max-width: 42%; }
.item .title .plate, .item .thumb { flex: none; }
.item .side .pill { white-space: normal; text-align: right; line-height: 1.25; }
.item .title .plate { font-size: 13px; }
.item.wrap { flex-wrap: wrap; }
.item.wrap .side { flex-basis: 100%; max-width: none; display: flex; justify-content: space-between; align-items: center;
  border-top: 1px dashed var(--line); padding-top: 10px; }
.item .chev { color: var(--muted); }
.item.bad { border-left: 5px solid var(--bad); } .item.warn { border-left: 5px solid var(--amber); }

/* ---------- Fahrzeugkarte mit Foto ---------- */
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: inherit; display: flex; flex-direction: column; }
a.vcard:hover { border-color: var(--accent); }
/* Feste Bildgröße: jedes Foto füllt denselben 16:9-Rahmen, egal ob hoch- oder querformat */
.vcard .photo { aspect-ratio: 16 / 9; width: 100%; height: auto; min-height: 0; overflow: hidden; flex: none;
  background: linear-gradient(135deg, var(--card-2), var(--line)); display: grid; place-items: center; color: var(--muted); position: relative; }
.vcard .photo img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center; }
.vcard .photo .plate { position: absolute; left: 10px; bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.vcard .info { padding: 12px 14px 14px; display: grid; gap: 8px; }
.vcard .name { font-weight: 800; font-size: 17px; }
.kv-mini { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 14px; align-items: center; }
.kv-mini dt { color: var(--muted); }
.kv-mini dd { margin: 0; text-align: right; }

/* ---------- Fahrzeug-Kopf ---------- */
.hero { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bar); color: #fff; box-shadow: var(--shadow); margin-bottom: 12px; }
.hero .bg { aspect-ratio: 16 / 8; max-height: 360px; width: 100%; height: auto; object-fit: cover; opacity: .9; }
@supports (aspect-ratio: 1) { .hero .bg { height: min(360px, calc((100vw - 32px) / 2)); max-height: none; } }
.hero .noimg { aspect-ratio: 16 / 6; display: grid; place-items: center; color: #4b5563; background: linear-gradient(135deg, #1c222c, #11151c); }
.hero .noimg .i { width: 60px; height: 60px; }
.hero .over { position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px; background: linear-gradient(transparent, rgba(0,0,0,.78)); }
.hero h1 { color: #fff; font-size: 24px; margin-top: 8px; }
.hero .sub { color: rgba(255,255,255,.8); }
.hero .sub a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.hero .tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.hero .tools .btn { background: rgba(0,0,0,.5); border-color: transparent; color: #fff; backdrop-filter: blur(6px); }

/* ---------- Aktionsleiste ---------- */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 13px 6px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); }
.action .i { width: 24px; height: 24px; color: var(--accent); }
.action.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.action.primary .i { color: #fff; }
.action:active { transform: scale(.98); }

/* ---------- Geld ---------- */
.money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.money > div { background: var(--card-2); padding: 8px 10px; }
.money .lbl { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.money .val { font-weight: 800; font-size: 15.5px; white-space: nowrap; }
.money .val.pos { color: var(--ok); } .money .val.neg { color: var(--bad); }
.money.four { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .money.four { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Wartungs-Historie (Timeline) ---------- */
.timeline { display: grid; gap: 12px; }
.entry { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--tc, var(--slate)); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; }
.entry .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.entry .type { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.entry .when { color: var(--muted); font-size: 14px; margin-top: 2px; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.entry .when span { display: inline-flex; gap: 5px; align-items: center; }
.entry .when .i { width: 15px; height: 15px; }
.entry .desc { white-space: pre-line; }
.entry .foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 10px; }
.tc-blue { --tc: var(--blue); } .tc-amber { --tc: var(--amber); } .tc-green { --tc: var(--green); } .tc-red { --tc: var(--red); }
.tc-purple { --tc: var(--purple); } .tc-cyan { --tc: var(--cyan); } .tc-slate { --tc: var(--slate); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tc, var(--slate)); flex: none; }

/* ---------- Fotos ---------- */
.photos { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.photos.sm { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--card-2); border: 0; padding: 0; cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .badge { position: absolute; left: 5px; top: 5px; background: rgba(0,0,0,.65); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.ph .badge.star { left: auto; right: 5px; background: var(--accent); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--line); border-radius: 12px;
  padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: var(--card-2); font-weight: 600; }
.drop .i { width: 30px; height: 30px; color: var(--accent); }
.drop input { display: none; }
.drop.has { border-color: var(--accent); color: var(--text); }

/* ---------- Formulare ---------- */
.fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.fields .full { grid-column: 1 / -1; }
@media (min-width: 760px) { .fields.wide { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 380px) { .fields { grid-template-columns: 1fr; } }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); width: 100%; min-height: 46px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); font-weight: 600; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.legend { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.legend::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.calc { font-size: 14px; color: var(--muted); }
.calc b { color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 700; font-size: 15px;
  min-height: 44px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: 13.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn .i { width: 18px; height: 18px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 6px; display: inline-flex; gap: 5px; align-items: center; }
.linkbtn:hover { color: var(--bad); }
form.inline { display: inline; }
.search { position: relative; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 40px; }

/* ---------- Meldungen ---------- */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- Bottom-Sheet (Dialog) ---------- */
dialog.sheet { border: 0; padding: 0; background: var(--card); color: var(--text); width: 100%; max-width: 620px; max-height: 92vh;
  border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.sheet::backdrop { background: rgba(9, 12, 18, .55); backdrop-filter: blur(2px); }
dialog.sheet .sheet-head { position: sticky; top: 0; background: var(--card); z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); }
dialog.sheet .sheet-body { padding: 16px; overflow: auto; }
dialog.sheet .close { background: var(--card-2); border: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text); }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0 0; max-width: none; border-radius: 18px 18px 0 0; max-height: 94vh; }
  dialog.sheet .sheet-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
dialog.lightbox::backdrop { background: rgba(0,0,0,.9); }
dialog.lightbox img { max-width: 96vw; max-height: 78vh; border-radius: 8px; margin: 0 auto; }
dialog.lightbox .lb-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
dialog.lightbox .lb-cap { color: #ddd; text-align: center; margin-top: 8px; font-size: 14px; }

/* ---------- Tabellen (Desktop/Finanzen) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.scroll-x { overflow-x: auto; }
.bar-mini { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; margin-top: 4px; }
.bar-mini span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

details.more > summary { cursor: pointer; list-style: none; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }

/* ---------- Finanzen je Person ---------- */
.people { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 14px; }
.person { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--card);
  box-shadow: var(--shadow); color: inherit; text-decoration: none; min-width: 0; }
.person:hover { border-color: var(--accent); }
.person.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.person .who { display: flex; align-items: center; gap: 8px; }
.person .who .muted { margin-left: auto; }
.person .avatar { width: 30px; height: 30px; font-size: 13px; background: var(--accent-soft); color: var(--accent); }
.person.free .avatar { background: var(--card-2); color: var(--muted); }
.person.free .avatar .i { width: 16px; height: 16px; }

/* ---------- Schnell anlegen (+) ---------- */
.bottomnav .plus { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
  height: var(--nav-h); padding: 0 0 9px; background: none; border: 0; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.bottomnav .plus > span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 6px 16px rgba(242, 107, 29, .45), 0 0 0 4px var(--card); }
.bottomnav .plus > span .i { width: 28px; height: 28px; stroke-width: 2.6; }
.bottomnav .plus:active > span { transform: translateX(-50%) scale(.94); }
.topplus { display: none; }
@media (min-width: 860px) { .topplus { display: inline-flex; margin-left: auto; } .topplus + .usermenu { margin-left: 12px; } }
.quick-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.quick { display: grid; justify-items: start; gap: 4px; padding: 14px; border-radius: var(--radius); border: 1.5px solid var(--line);
  background: var(--card-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.quick:hover { border-color: var(--accent); }
.quick .i { color: var(--accent); margin-bottom: 4px; }
.quick b { font-size: 15.5px; }
.quick span { font-size: 12.5px; color: var(--muted); }
[data-quick-list] { max-height: 52vh; overflow: auto; }
@media (prefers-reduced-motion: no-preference) { .quick { transition: transform .12s ease, border-color .15s; } .quick:active { transform: scale(.97); } }

/* ---------- Kosten-Zeitleiste ---------- */
.tl-chart { position: relative; }
.tl-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.tl-grid { stroke: var(--line); stroke-width: 1; }
.tl-ylab, .tl-xlab { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tl-area { fill: var(--accent); opacity: .12; }
.tl-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.tl-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.tl-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tl-hit { fill: transparent; cursor: crosshair; }
.tl-tip { position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 13px; white-space: nowrap; z-index: 2; }
.tl-tip b { display: block; font-size: 15px; }
.tl-tip .muted { font-size: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .tl-line { stroke-dasharray: 3000; animation: draw 1.4s cubic-bezier(.2, .8, .2, 1) .2s both; }
  .tl-area, .tl-dot { animation: fade .6s ease .9s both; }
}
@keyframes draw { from { stroke-dashoffset: 3000; } to { stroke-dashoffset: 0; } }

/* ---------- Anfragen ---------- */
.nbadge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; }
.bottomnav .ni { position: relative; display: inline-flex; }
.bottomnav .ni .nbadge { position: absolute; top: -6px; right: -12px; margin: 0; }
a.chip { text-decoration: none; padding: 6px 12px; font-size: 13.5px; }
a.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.topics .svc span { padding: 11px 14px; }
h1.row { gap: 10px; }
.item .thumb.picon { width: 52px; height: 52px; border-radius: 12px; }

input.rec, select.rec { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Fahrzeugschein ---------- */
.schein-data { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.schein-data > div { background: var(--card-2); padding: 8px 11px; display: grid; gap: 2px; min-width: 0; }
.schein-data span { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.schein-data b { font-size: 15px; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .03em; }
.ph.pdf { display: grid; place-items: center; align-content: center; gap: 4px; color: var(--accent); text-decoration: none;
  font-weight: 700; font-size: 12.5px; border: 1.5px dashed var(--line); cursor: pointer; }

/* ---------- Symbol-Bubbles ---------- */
.i.xl { width: 38px; height: 38px; }
.ticon, .picon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--tc, var(--accent)) 14%, transparent); color: var(--tc, var(--accent)); }
.picon.sm { width: 28px; height: 28px; border-radius: 8px; }
.picon.sm .i { width: 16px; height: 16px; }
.entry .type { gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; padding: 3px 9px 3px 7px;
  border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--text); }
.chip .i { width: 14px; height: 14px; color: var(--accent); }

/* ---------- Tacho / Kombiinstrument ---------- */
.cluster { --glow: var(--ok); display: flex; gap: 18px; align-items: center; margin: 12px 0; padding: 16px 18px; border-radius: var(--radius);
  color: #e8edf5; background: radial-gradient(120% 140% at 0% 0%, #1d2633 0%, #0d1117 55%, #07090c 100%);
  border: 1px solid #1f2733; box-shadow: var(--shadow), inset 0 0 40px rgba(0,0,0,.5); position: relative; overflow: hidden; }
.cluster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.05) 50%, transparent 60%);
  pointer-events: none; }
.cluster.warn { --glow: #fbbf24; } .cluster.bad { --glow: #f87171; } .cluster.muted { --glow: #94a3b8; }
.gauge { position: relative; width: 118px; height: 118px; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 9; }
.gauge .track { stroke: rgba(255,255,255,.08); }
.gauge .val { stroke: var(--glow); stroke-linecap: round; stroke-dasharray: 326.73; stroke-dashoffset: var(--off, 0);
  filter: drop-shadow(0 0 6px var(--glow)); }
.gauge .center { position: absolute; inset: 0; display: grid; place-items: center; color: var(--glow); }
.gauge .code { font: 800 44px/1 "Bahnschrift", "DIN Alternate", system-ui, sans-serif; text-shadow: 0 0 14px var(--glow); }
.readout { min-width: 0; flex: 1; }
.readout .lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #8a96a8; display: flex; gap: 6px; align-items: center; }
.readout .lbl .i { width: 14px; height: 14px; }
.readout .name { font-size: 20px; font-weight: 800; margin: 2px 0 8px; }
.readout .nums { display: flex; gap: 20px; flex-wrap: wrap; }
.readout .nums b { display: block; font: 700 28px/1 "Bahnschrift", "DIN Alternate", ui-monospace, Consolas, monospace; color: var(--glow);
  text-shadow: 0 0 12px color-mix(in srgb, var(--glow) 55%, transparent); font-variant-numeric: tabular-nums; }
.readout .nums span { font-size: 12px; color: #8a96a8; font-weight: 600; }
.readout .due { margin-top: 8px; font-size: 13.5px; color: #b8c2d0; }
@media (max-width: 420px) {
  .cluster { gap: 14px; padding: 14px; }
  .gauge { width: 96px; height: 96px; }
  .gauge .code { font-size: 36px; }
  .readout .name { font-size: 17px; }
  .readout .nums b { font-size: 23px; }
}

/* ---------- Serviceplan ---------- */
.plan { display: grid; gap: 10px; }
@media (min-width: 760px) { .plan { grid-template-columns: 1fr 1fr; } }
.pitem { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; --tc: var(--ok); min-width: 0; }
.pitem.warn { --tc: var(--amber); } .pitem.bad { --tc: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); } .pitem.muted { --tc: var(--slate); }
.pbody { flex: 1; min-width: 0; display: grid; gap: 5px; }
.phead { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.phead .pill { white-space: normal; }
.bar { height: 8px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--w); border-radius: 99px; background: linear-gradient(90deg, var(--ok), #4ade80); }
.bar.warn span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar.bad span { background: linear-gradient(90deg, #dc2626, #f87171); }
.bar.muted span { background: var(--slate); }

/* ---------- Vorlagen ---------- */
.presets { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .presets { grid-template-columns: 1fr 1fr; } }
.presets form { display: contents; }
.preset { display: grid; gap: 6px; justify-items: start; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card-2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; transition: border-color .15s, transform .15s; }
.preset:hover { border-color: var(--accent); transform: translateY(-2px); }
.preset b { font-size: 16px; }
.preset .picon { width: 44px; height: 44px; border-radius: 12px; }

/* ---------- Serviceplan-Haken ---------- */
.svc-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.svc input { position: absolute; opacity: 0; pointer-events: none; }
.svc span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card-2); font-weight: 700; font-size: 14px; color: var(--text); cursor: pointer; transition: all .15s; user-select: none; }
.svc span .i { width: 17px; height: 17px; color: var(--muted); }
.svc input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.svc input:checked + span .i { color: #fff; }
.svc input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.svc-row.new { border-style: dashed; }

/* ---------- Animationen ---------- */
@media (prefers-reduced-motion: no-preference) {
  main > * { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
  main > *:nth-child(2) { animation-delay: .04s; } main > *:nth-child(3) { animation-delay: .08s; }
  main > *:nth-child(4) { animation-delay: .12s; } main > *:nth-child(5) { animation-delay: .16s; }
  main > *:nth-child(6) { animation-delay: .2s; } main > *:nth-child(n+7) { animation-delay: .24s; }
  .list > *, .plan > *, .timeline > *, .grid.cards > * { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
  .list > *:nth-child(2), .plan > *:nth-child(2), .timeline > *:nth-child(2), .grid.cards > *:nth-child(2) { animation-delay: .05s; }
  .list > *:nth-child(3), .plan > *:nth-child(3), .timeline > *:nth-child(3), .grid.cards > *:nth-child(3) { animation-delay: .1s; }
  .list > *:nth-child(4), .plan > *:nth-child(4), .timeline > *:nth-child(4), .grid.cards > *:nth-child(4) { animation-delay: .15s; }
  .list > *:nth-child(n+5), .plan > *:nth-child(n+5), .timeline > *:nth-child(n+5), .grid.cards > *:nth-child(n+5) { animation-delay: .2s; }
  .bar span { animation: fill 1.1s cubic-bezier(.2, .8, .2, 1) .25s both; }
  .gauge .val { animation: sweep 1.3s cubic-bezier(.2, .8, .2, 1) .15s both; }
  .cluster.bad .gauge, .pitem.bad .picon, .kpi.bad .val { animation: pulse 2s ease-in-out infinite; }
  .cluster::after { animation: shine 3.5s ease-in-out 1s infinite; }
  dialog.sheet[open] { animation: sheetup .28s cubic-bezier(.2, .8, .2, 1); }
  dialog.sheet[open]::backdrop { animation: fade .2s ease; }
  dialog.lightbox[open] img { animation: zoomin .25s ease; }
  .flash { animation: rise .35s ease both; }
  .btn, .action, .item, .vcard, .kpi { transition: transform .12s ease, filter .12s ease, border-color .15s; }
  .btn:active, .action:active, a.item:active, a.vcard:active, a.kpi:active { transform: scale(.97); }
  a.vcard:hover, a.kpi:hover { transform: translateY(-2px); }
  .bottomnav a.active .i { animation: pop .35s ease; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fill { from { width: 0; } }
@keyframes sweep { from { stroke-dashoffset: 326.73; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes shine { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes sheetup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes zoomin { from { transform: scale(.94); opacity: 0; } }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }

.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login { width: 100%; max-width: 400px; }
.login .brand { color: var(--text); justify-content: center; margin-bottom: 18px; font-size: 22px; }
.login .brand .logo { width: 44px; height: 44px; border-radius: 12px; }
.contact-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
