/* Fuhrpark App – Layout & Design (nach Fuhrpark App.dc.html) */
:root {
  --accent: #5B93D3;
  --accent-soft: oklch(93% 0.03 230);
  --accent-strip: oklch(94% 0.035 230);
  --accent-strip-border: oklch(85% 0.05 230);
  --text: oklch(22% 0.005 250);
  --text-muted: oklch(48% 0.006 250);
  --border: oklch(90% 0.004 250);
  --border-soft: oklch(92% 0.004 250);
  --bg: oklch(97.5% 0.002 250);
  --bg-sidebar: oklch(96% 0.003 250);
  --bg-input: oklch(98% 0.002 250);
  --st-aktiv: oklch(62% 0.13 150);
  --st-werkstatt: oklch(68% 0.14 70);
  --st-inaktiv: oklch(58% 0.01 250);
  /* Bereichs-Farbcodes (KFZ-23): dezente, transparente Flächentöne + kräftigere Linie */
  --area-fahrzeug: rgba(91, 147, 211, 0.09);
  --area-fahrzeug-strong: rgba(91, 147, 211, 0.20);
  --area-fahrzeug-line: rgba(91, 147, 211, 0.65);
  --area-vertrag: rgba(198, 161, 94, 0.14);
  --area-vertrag-strong: rgba(198, 161, 94, 0.28);
  --area-vertrag-line: rgba(190, 150, 80, 0.75);
  --area-einstellungen: rgba(104, 184, 108, 0.13);
  --area-einstellungen-strong: rgba(104, 184, 108, 0.26);
  --area-einstellungen-line: rgba(88, 168, 92, 0.75);
  --area-bestellung: rgba(160, 120, 205, 0.13);
  --area-bestellung-strong: rgba(160, 120, 205, 0.26);
  --area-bestellung-line: rgba(140, 96, 195, 0.75);
  /* Auswertungen: Türkis (KFZ-100) */
  --area-auswertung: rgba(32, 178, 170, 0.13);
  --area-auswertung-strong: rgba(32, 178, 170, 0.28);
  --area-auswertung-line: rgba(20, 150, 145, 0.85);
  /* Hilfsprogramme: Orange (KFZ-86) */
  --area-hilfsprogramme: rgba(240, 140, 40, 0.16);
  --area-hilfsprogramme-strong: rgba(240, 140, 40, 0.32);
  --area-hilfsprogramme-line: rgba(215, 110, 25, 0.88);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
}
a { color: inherit; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: oklch(85% 0.004 250); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* App-Shell */
.app-shell { width: 100%; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Header */
.app-header {
  flex: none; height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: #fff; border-bottom: 1px solid var(--border); z-index: 20;
}
.app-header .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-header .brand .title { font-size: 14px; font-weight: 600; letter-spacing: .1px; white-space: nowrap; }
.app-header .brand .mandant-logo { height: 30px; max-width: 120px; object-fit: contain; flex: none; }
.hamburger {
  width: 30px; height: 30px; border: none; background: transparent; border-radius: 7px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; flex: none;
}
.hamburger span { display: block; width: 16px; height: 2px; background: oklch(35% 0.006 250); border-radius: 2px; }
.app-header .user { display: flex; align-items: center; gap: 9px; flex: none; }
.app-header .user .meta { text-align: right; line-height: 1.25; }
.app-header .user .meta .n { font-size: 12.5px; font-weight: 600; }
.app-header .user .meta .r { font-size: 11px; color: var(--text-muted); }
.app-header .user .avatar {
  width: 32px; height: 32px; border-radius: 999px; background: oklch(90% 0.02 230);
  display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700;
  color: oklch(35% 0.09 230); flex: none;
}

/* Meldungsstreifen (Flash) */
.msg-strip {
  flex: none; padding: 8px 20px; background: var(--accent-strip);
  border-bottom: 1px solid var(--accent-strip-border);
  font-size: 12.5px; font-weight: 500;
}
.msg-strip.danger { background: oklch(94% 0.05 25); border-bottom-color: oklch(85% 0.08 25); color: oklch(40% 0.12 25); }
.msg-strip.warning { background: oklch(95% 0.06 85); border-bottom-color: oklch(85% 0.09 85); color: oklch(42% 0.1 70); }
.msg-strip.success { background: oklch(94% 0.05 150); border-bottom-color: oklch(84% 0.08 150); color: oklch(40% 0.11 150); }
.msg-strip .m + .m { margin-top: 3px; }

/* Body */
.app-body { flex: 1; display: flex; min-height: 0; overflow: hidden; }

/* Sidebar */
.sidebar {
  flex: none; width: 212px; display: flex; flex-direction: column; background: var(--bg-sidebar);
  border-right: 1px solid var(--border); transition: width .18s ease; min-height: 0;
}
.app-shell.collapsed .sidebar { width: 56px; }
.sidebar .items { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.menu-row {
  display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 8px;
  cursor: pointer; color: oklch(32% 0.006 250); text-decoration: none; transition: background .12s ease;
}
.menu-row:hover { background: oklch(93% 0.006 250); }
.menu-row.active { background: var(--accent-soft); color: oklch(30% 0.06 230); }
.app-shell.collapsed .menu-row { padding: 0; justify-content: center; }
.menu-row .ico { width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; }
.menu-row .lbl { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.app-shell.collapsed .menu-row .lbl { display: none; }
.menu-row .chev { font-size: 11px; color: oklch(55% 0.006 250); transition: transform .15s ease; }
.app-shell.collapsed .menu-row .chev { display: none; }
.submenu { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 4px; }
.app-shell.collapsed .submenu { display: none; }
.submenu a { font-size: 12.5px; color: var(--text-muted); padding: 7px 10px 7px 41px; border-radius: 7px; text-decoration: none; }
.submenu a:hover { background: oklch(93% 0.006 250); }
.submenu a.active { color: oklch(30% 0.06 230); font-weight: 600; }
/* Vertragsende + Restlaufzeit im Vertragskopf (KFZ-71) */
.vertrag-ende { font-weight: 600; }
.vertrag-ende.urgent { color: oklch(55% 0.19 25); }
/* Vertragsende neben der Gruppen-Überschrift auf dem Fahrzeug (KFZ-73) */
.vertrag-ende-inline { flex: none; font-size: 11.5px; font-weight: 600; color: var(--text-muted); background: var(--bg-input); padding: 2px 8px; border-radius: 999px; }
.vertrag-ende-inline.urgent { color: oklch(55% 0.19 25); background: color-mix(in srgb, oklch(55% 0.19 25) 12%, white); }

/* Abmelden unten in der Sidebar (KFZ-70) */
.sidebar .logout-row { flex: none; margin: 4px 8px; }
.sidebar .foot { flex: none; padding: 10px 14px; font-size: 10.5px; color: oklch(60% 0.006 250); border-top: 1px solid var(--border); }
.app-shell.collapsed .sidebar .foot { display: none; }

/* Fahrzeugliste (KFZ-8: ~30% schmaler, 272px -> 190px) */
.vehicle-list {
  flex: none; width: 190px; display: flex; flex-direction: column; background: #fff;
  border-right: 1px solid var(--border); min-height: 0;
}
.vehicle-list .head { padding: 12px 12px 10px; }

/* Status-Filter (Multiselect, oben & einklappbar – KFZ-11) */
.status-filter { border-bottom: 1px solid var(--border); background: #fff; }
.status-filter .sf-head {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: transparent; border: none; cursor: pointer; font: inherit; text-align: left;
}
.status-filter .sf-head:hover { background: oklch(97% 0.004 250); }
.status-filter .sf-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); flex: none; }
.status-filter .sf-summary { flex: 1; min-width: 0; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-filter .sf-chevron { flex: none; font-size: 12px; color: var(--text-muted); transition: transform .15s ease; }
.status-filter.collapsed .sf-chevron { transform: rotate(-90deg); }
.status-filter .sf-body { padding: 0 10px 9px; }
.status-filter.collapsed .sf-body { display: none; }
.status-filter .sf-options { display: flex; flex-direction: column; gap: 2px; }
.sf-chip { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text); cursor: pointer; padding: 3px 5px; border-radius: 6px; }
.sf-chip:hover { background: oklch(96% 0.004 250); }
.sf-chip.on { background: var(--accent-soft); }
.sf-chip input { margin: 0; flex: none; }
.sf-chip .v-dot { width: 7px; height: 7px; }
.vehicle-list .head .cap { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px; }
.vehicle-list .search {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid oklch(88% 0.004 250); border-radius: 7px;
  font-size: 12.5px; background: var(--bg-input); color: var(--text);
}
.vehicle-list .rows { flex: 1; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.v-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; text-decoration: none; color: inherit; }
.v-row:hover { background: oklch(96% 0.004 250); }
.v-row.active { background: var(--accent-soft); }
.v-dot { width: 7px; height: 7px; border-radius: 999px; flex: none; }
.v-dot.aktiv { background: var(--st-aktiv); }
.v-dot.werkstatt { background: var(--st-werkstatt); }
.v-dot.inaktiv { background: var(--st-inaktiv); }
.v-row .plate { font-size: 12.5px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.v-row .name { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vehicle-list .empty { padding: 20px 8px; text-align: center; font-size: 12px; color: oklch(55% 0.006 250); }
.vehicle-list .count { flex: none; padding: 9px 14px; border-top: 1px solid var(--border-soft); font-size: 11.5px; color: var(--text-muted); }

/* Hauptbereich */
.main { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px 32px; min-width: 0; }
.main .wrap { max-width: 760px; }
.main .wrap.wrap-wide { max-width: 1180px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 4px; gap: 16px; }
.detail-head .plate { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.detail-head .sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.detail-head .head-verwendung { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
/* Fahrzeugbild klein im Kopf (links neben dem Status) – KFZ-12 */
/* Kopf-Bild über beide Zeilen (Kennzeichen + Bezeichnung), oben bündig mit dem Status – KFZ-14 */
.detail-head .head-bild { width: 74px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); flex: none; }
/* Vorschau neben dem „Bild öffnen“-Link */
.bild-preview { width: 160px; max-width: 100%; height: 104px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.status-badge { font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; color: #fff; white-space: nowrap; flex: none; }
.status-badge.aktiv { background: var(--st-aktiv); }
.status-badge.werkstatt { background: var(--st-werkstatt); }
.status-badge.inaktiv { background: var(--st-inaktiv); }
.rule { height: 1px; background: var(--border); margin: 18px 0 22px; }

/* Fluent/responsives Feld-Raster: mehr Breite -> mehr Spalten */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.field .control {
  height: 36px; padding: 0 10px; border-radius: 7px; border: 1px solid oklch(88% 0.004 250);
  font-size: 13px; background: #fff; color: var(--text); width: 100%;
}
.field textarea.control { height: auto; padding: 8px 10px; min-height: 72px; }
/* Berechnete, schreibgeschützte Felder (z. B. KM-Prognose, KFZ-80) */
.field .control.ro { display: flex; align-items: center; background: var(--bg-input); color: var(--text-muted); }
.field .control.ro.neg { color: oklch(52% 0.16 25); font-weight: 600; }
.field .control.ro.pos { color: oklch(50% 0.13 150); font-weight: 600; }
/* Mehrkilometer-Warnung (KFZ-42) */
.km-warn { color: oklch(68% 0.17 65); }
.km-warn[hidden] { display: none; }
.km-warn-ic { vertical-align: -2px; }
.km-warn-sm { display: inline-flex; vertical-align: -1px; }
.km-warn-lg { vertical-align: -3px; }
.field .err { color: oklch(52% 0.16 25); font-size: 11.5px; }

/* Einklappbare Feldgruppen (Fluent) */
.fgroup { border: 1px solid var(--border); border-radius: 10px; background: #fff; margin-bottom: 12px; overflow: hidden; }
.fgroup-head {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  background: var(--bg-sidebar); border: none; cursor: pointer; text-align: left; font: inherit;
}
.fgroup-head:hover { background: oklch(94% 0.004 250); }
.fgroup-title { font-size: 12.5px; font-weight: 700; letter-spacing: .01em; color: var(--text); flex: none; }
.fgroup-summary { flex: 1; min-width: 0; text-align: right; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fgroup-summary.urgent { color: oklch(52% 0.16 25); font-weight: 600; }
.fgroup-chevron { flex: none; font-size: 12px; color: var(--text-muted); transition: transform .15s ease; }
.fgroup.collapsed .fgroup-chevron { transform: rotate(-90deg); }
.fgroup-body { padding: 16px 14px; }
.fgroup.collapsed .fgroup-body { display: none; }
/* Kurzinfo nur im eingeklappten Zustand zeigen */
.fgroup:not(.collapsed) .fgroup-summary { display: none; }

/* Monate bis TÜV */
.tuev-badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: oklch(35% 0.09 230); margin-left: 6px; }
.tuev-badge.urgent { background: oklch(93% 0.05 25); color: oklch(52% 0.16 25); }
/* TÜV Monat/Jahr-Auswahl nebeneinander */
.tuev-select { display: flex; gap: 8px; }
.tuev-select .control { flex: 1; min-width: 0; }

/* Autocomplete (Fahrzeug-Suche im Vertrag – KFZ-9) */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: 40px; z-index: 40; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; overflow-y: auto; max-height: 240px;
  box-shadow: 0 8px 24px oklch(50% 0.02 250 / .14); display: none;
}
.ac-item { padding: 8px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item:hover { background: var(--accent-soft); }
.ac-clear { color: var(--text-muted); border-top: 1px solid var(--border-soft); }

.actions { display: flex; gap: 10px; margin-top: 26px; align-items: center; }
.btn-accent { height: 36px; padding: 0 18px; border-radius: 7px; border: none; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-ghost { height: 36px; padding: 0 18px; border-radius: 7px; border: 1px solid oklch(85% 0.004 250); background: transparent; color: oklch(35% 0.006 250); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn-danger { height: 36px; padding: 0 16px; border-radius: 7px; border: 1px solid oklch(80% 0.08 25); background: transparent; color: oklch(52% 0.16 25); font-size: 13px; font-weight: 600; cursor: pointer; margin-left: auto; }

.veh-image { margin-top: 22px; }
.veh-image img { max-width: 320px; border-radius: 10px; border: 1px solid var(--border); }
.placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); font-size: 13px; }

/* Einfache Tabellen (Admin) */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--bg-sidebar); }
.tbl tr:last-child td { border-bottom: none; }
/* Excel-Export-Leiste über Tabellen (KFZ-85) */
.tbl-export { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.btn-export { height: 32px; padding: 0 12px; gap: 7px; font-size: 12.5px; }
.btn-export:hover { border-color: oklch(62% 0.13 150); color: oklch(45% 0.12 150); }
.btn-export:disabled { opacity: .55; cursor: default; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 4px; }
.page-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: oklch(35% 0.09 230); }

/* Warnung bei ungespeicherten Änderungen (KFZ-16) */
.guard-overlay { position: fixed; inset: 0; background: oklch(20% 0.02 250 / .45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.guard-box { background: #fff; border-radius: 12px; padding: 22px 22px 18px; width: 440px; max-width: calc(100% - 32px); box-shadow: 0 20px 60px oklch(20% 0.02 250 / .3); }
.guard-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.guard-text { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 18px; }
.guard-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn-guard-leave { color: oklch(52% 0.16 25); border-color: oklch(80% 0.08 25); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 340px; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 28px 26px; box-shadow: 0 8px 30px oklch(50% 0.02 250 / .08); }
.login-card h1 { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.login-card p.sub { font-size: 12.5px; color: var(--text-muted); margin: 0 0 20px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn-accent { width: 100%; }
.login-card .checkbox { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 16px; }

/* --------------------------------------------------------------------- */
/* Bereichs-Farbcodes (KFZ-23): Hintergrund der Masken + Menüeinträge     */
/* --------------------------------------------------------------------- */
/* Masken-Hintergrund je Bereich */
.area-fahrzeug .main,
.area-fahrzeug .vehicle-list { background: var(--area-fahrzeug); }
.area-vertrag .main,
.area-vertrag .vehicle-list { background: var(--area-vertrag); }
.area-einstellungen .main { background: var(--area-einstellungen); }
.area-bestellung .main,
.area-bestellung .vehicle-list { background: var(--area-bestellung); }
.area-hilfsprogramme .main { background: var(--area-hilfsprogramme); }

/* Menü links: dauerhaft farbcodiert je Bereich (Legende) */
.menu-row.m-fahrzeug { background: var(--area-fahrzeug); box-shadow: inset 3px 0 0 var(--area-fahrzeug-line); }
.menu-row.m-fahrzeug:hover,
.menu-row.m-fahrzeug.active { background: var(--area-fahrzeug-strong); color: oklch(30% 0.06 230); }

.menu-row.m-vertrag { background: var(--area-vertrag); box-shadow: inset 3px 0 0 var(--area-vertrag-line); }
.menu-row.m-vertrag:hover,
.menu-row.m-vertrag.active { background: var(--area-vertrag-strong); color: oklch(34% 0.05 75); }

.menu-row.m-bestellung { background: var(--area-bestellung); box-shadow: inset 3px 0 0 var(--area-bestellung-line); }
.menu-row.m-bestellung:hover,
.menu-row.m-bestellung.active { background: var(--area-bestellung-strong); color: oklch(34% 0.09 300); }

.menu-row.m-einstellungen { background: var(--area-einstellungen); box-shadow: inset 3px 0 0 var(--area-einstellungen-line); }
.menu-row.m-einstellungen:hover,
.menu-row.m-einstellungen.active { background: var(--area-einstellungen-strong); color: oklch(34% 0.08 150); }
.menu-group.m-einstellungen .submenu a:hover { background: var(--area-einstellungen); }
.menu-group.m-einstellungen .submenu a.active { background: var(--area-einstellungen-strong); color: oklch(34% 0.08 150); }

/* Auswertungen: Türkis (KFZ-100) */
.area-auswertung .main { background: var(--area-auswertung); }
.menu-row.m-auswertung { background: var(--area-auswertung); box-shadow: inset 3px 0 0 var(--area-auswertung-line); }
.menu-row.m-auswertung:hover,
.menu-row.m-auswertung.active { background: var(--area-auswertung-strong); color: oklch(38% 0.09 195); }
.menu-group.m-auswertung .submenu a:hover { background: var(--area-auswertung); }
.menu-group.m-auswertung .submenu a.active { background: var(--area-auswertung-strong); color: oklch(38% 0.09 195); }
.app-shell.collapsed .menu-row.m-auswertung { border-radius: 8px; }

/* Auswertungs-Bausteine */
.aw-filter {
  display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end;
  padding: 14px 16px; margin: 6px 0 18px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px;
}
.aw-fld { display: flex; flex-direction: column; gap: 7px; }
.aw-fld-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.aw-select { height: 34px; padding: 0 10px; border: 1px solid oklch(88% 0.004 250); border-radius: 7px;
  font-size: 12.5px; background: var(--bg-input); color: var(--text); min-width: 190px; cursor: pointer; }
.aw-karte { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.aw-karte-titel { font-size: 13px; font-weight: 700; color: oklch(36% 0.06 195); margin: 0 0 12px; }
/* Diagramme flacher (KFZ-102) */
.aw-chart { position: relative; height: 210px; }

/* Einklappbare Karten für Filter, Diagramme und Pivot (KFZ-102) */
.aw-klapp {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 14px; overflow: hidden;
}
.aw-klapp-kopf {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  background: transparent; border: none; border-bottom: 1px solid var(--border-soft);
  cursor: pointer; font: inherit; text-align: left;
}
.aw-klapp-kopf:hover { background: color-mix(in srgb, var(--area-auswertung-line) 7%, white); }
.aw-klapp-titel { font-size: 13px; font-weight: 700; color: oklch(36% 0.06 195); flex: none; }
.aw-klapp-info {
  flex: 1; min-width: 0; text-align: right; font-size: 11.5px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aw-klapp-chev { flex: none; font-size: 12px; color: var(--text-muted); transition: transform .15s ease; }
.aw-klapp.zu .aw-klapp-chev { transform: rotate(-90deg); }
.aw-klapp-body { padding: 14px; }
.aw-klapp.zu .aw-klapp-body { display: none; }
.aw-klapp.zu .aw-klapp-kopf { border-bottom: none; }

.aw-filter-grid { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; }
.aw-fld-weit { flex: 1; min-width: 320px; }
.aw-range { display: flex; flex-direction: column; gap: 4px; }
.aw-range-zeile { display: flex; align-items: center; gap: 9px; }
.aw-range-zeile span { font-size: 11.5px; color: var(--text-muted); width: 26px; flex: none; }
.aw-range-zeile .lz-range { flex: 1; min-width: 220px; }
#awAnwenden:disabled { opacity: .45; cursor: default; }
.aw-hinweis {
  display: flex; gap: 9px; align-items: flex-start; padding: 10px 13px; margin: 0 0 16px;
  background: color-mix(in srgb, var(--area-auswertung-line) 10%, white);
  border: 1px solid color-mix(in srgb, var(--area-auswertung-line) 30%, white);
  border-radius: 9px; font-size: 12.5px; color: var(--text);
}
/* Pivot-Tabellen */
.pivot th, .pivot td { white-space: nowrap; }
.pivot td.zahl, .pivot th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.pivot .gruppe { background: var(--area-auswertung); font-weight: 600; }
.pivot tr.summe td, .pivot td.summe, .pivot th.summe {
  font-weight: 700; background: var(--area-auswertung); border-top: 2px solid var(--area-auswertung-line);
}
.pivot td.summe, .pivot th.summe { border-top: none; border-left: 2px solid var(--area-auswertung-line); }
.pivot tbody tr:hover td { background: color-mix(in srgb, var(--area-auswertung-line) 7%, white); }

.menu-row.m-hilfsprogramme { background: var(--area-hilfsprogramme); box-shadow: inset 3px 0 0 var(--area-hilfsprogramme-line); }
.menu-row.m-hilfsprogramme:hover,
.menu-row.m-hilfsprogramme.active { background: var(--area-hilfsprogramme-strong); color: oklch(45% 0.14 55); }
.menu-group.m-hilfsprogramme .submenu a:hover { background: var(--area-hilfsprogramme); }
.menu-group.m-hilfsprogramme .submenu a.active { background: var(--area-hilfsprogramme-strong); color: oklch(45% 0.14 55); }
/* „Imports"-Zwischenüberschrift im Untermenü (KFZ-69) */
.submenu-cap { padding: 6px 10px 3px 41px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }

/* Eingeklapptes Menü: nur der farbige Balken bleibt sichtbar */
.app-shell.collapsed .menu-row.m-fahrzeug,
.app-shell.collapsed .menu-row.m-vertrag,
.app-shell.collapsed .menu-row.m-einstellungen,
.app-shell.collapsed .menu-row.m-hilfsprogramme { border-radius: 8px; }

/* --------------------------------------------------------------------- */
/* Vertragslaufzeiten – Gantt-Ansicht (KFZ-24)                            */
/* --------------------------------------------------------------------- */
.lz-gantt { --lz-grid: rgba(60, 90, 130, 0.10); }
.lz-filter {
  display: flex; flex-wrap: wrap; gap: 22px 32px; align-items: flex-end;
  padding: 14px 16px; margin: 6px 0 18px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px;
}
.lz-fld { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.lz-fld-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.lz-abt { display: flex; flex-wrap: wrap; gap: 7px; }
.lz-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; background: var(--bg-input); user-select: none;
}
.lz-chip input { accent-color: var(--accent); }
.lz-none { color: var(--text-muted); font-size: 13px; }
.lz-range { width: 260px; accent-color: var(--accent); cursor: pointer; }
.lz-fld-label b { color: var(--accent); }

/* Filter: Abteilungs-Dropdown (durchsuchbar, Mehrfachauswahl) + Bestellung (KFZ-92) */
.lz-select {
  height: 34px; padding: 0 10px; border: 1px solid oklch(88% 0.004 250); border-radius: 7px;
  font-size: 12.5px; background: var(--bg-input); color: var(--text); min-width: 200px; cursor: pointer;
}
.lz-dd { position: relative; min-width: 240px; }
.lz-dd-btn {
  width: 100%; height: 34px; padding: 0 10px; display: flex; align-items: center; gap: 8px;
  justify-content: space-between; border: 1px solid oklch(88% 0.004 250); border-radius: 7px;
  background: var(--bg-input); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer;
}
.lz-dd-btn:hover { border-color: var(--accent); }
.lz-dd.open .lz-dd-btn { border-color: var(--accent); }
.lz-dd-chev { flex: none; font-size: 12px; color: var(--text-muted); transition: transform .15s ease; }
.lz-dd.open .lz-dd-chev { transform: rotate(180deg); }
.lz-dd-panel {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; width: 300px; max-width: 90vw;
  background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 8px;
  box-shadow: 0 10px 30px oklch(50% 0.02 250 / .18);
}
.lz-dd-search {
  width: 100%; height: 32px; padding: 0 9px; border: 1px solid oklch(88% 0.004 250);
  border-radius: 6px; font-size: 12.5px; background: var(--bg-input); color: var(--text);
}
.lz-dd-actions { display: flex; gap: 6px; margin: 7px 0; }
.lz-dd-actions button {
  flex: 1; height: 27px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text-muted); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.lz-dd-actions button:hover { border-color: var(--accent); color: var(--accent); }
.lz-dd-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.lz-dd-opt {
  display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 6px;
  font-size: 12.5px; cursor: pointer; user-select: none;
}
.lz-dd-opt:hover { background: oklch(96% 0.004 250); }
.lz-dd-opt input { accent-color: var(--accent); flex: none; }
.lz-dd-opt span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lz-dd-leer { padding: 10px 7px; font-size: 12px; color: var(--text-muted); text-align: center; }

.lz-gantt { display: flex; flex-direction: column; gap: 4px; }
.lz-row { display: flex; align-items: center; height: 38px; }
.lz-row.lz-axis { height: 22px; margin-bottom: 2px; }
.lz-rowlabel {
  flex: none; width: 168px; padding-right: 12px; font-size: 12.5px; font-weight: 600;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lz-track { position: relative; flex: 1; height: 100%; min-width: 0; }
.lz-axis .lz-track { border-bottom: 1px solid var(--border); }
.lz-tick {
  position: absolute; top: 2px; transform: translateX(-50%);
  font-size: 10.5px; color: var(--text-muted);
}
.lz-tick::after {
  content: ""; position: absolute; left: 50%; top: 16px; height: 6px; width: 1px;
  background: var(--border);
}

/* Verstrichener Teil (Strich) – animiert von 0 auf Zielbreite */
.lz-elapsed {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 7px; border-radius: 5px; background: var(--accent);
  transition: width 1.1s cubic-bezier(.22, .61, .36, 1);
}
/* Marker (Dokument + Vertragsnummer) am Anfang des Pfeils */
.lz-marker {
  position: absolute; left: 100%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 9px 2px 7px; font-size: 11px; font-weight: 700; color: var(--accent);
  box-shadow: 0 1px 4px rgba(20, 40, 70, 0.14); z-index: 3;
  text-decoration: none; cursor: pointer; transition: box-shadow .12s ease, transform .12s ease;
}
.lz-marker:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(20, 40, 70, 0.22);
  transform: translate(-50%, -50%) translateY(-1px);
}
.lz-marker .lz-num { color: var(--text); }

/* Pfeil (Restlaufzeit) – erscheint nach der Animation */
.lz-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); height: 0;
  border-top: 2px dashed color-mix(in srgb, var(--accent) 55%, white);
  opacity: 0; transition: opacity .45s ease; z-index: 1;
}
.lz-arrow.show { opacity: 1; }
.lz-arrow::after {
  content: ""; position: absolute; right: -1px; top: 50%; transform: translateY(-50%);
  border-left: 8px solid color-mix(in srgb, var(--accent) 55%, white);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.lz-car {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: #1b7a3d; opacity: 0; transition: opacity .45s ease; z-index: 2;  /* immer dunkelgrün (KFZ-36) */
  display: inline-flex; align-items: center;
}
.lz-car.show { opacity: 1; }

/* Kennzeichen-Link in der Y-Achse (KFZ-36) */
.lz-rowlabel .lz-kennzeichen { color: var(--text); text-decoration: none; }
.lz-rowlabel .lz-kennzeichen:hover { color: var(--accent); text-decoration: underline; }

.lz-empty { color: var(--text-muted); font-size: 13px; padding: 20px 4px; }

/* Verlinkung im Detailkopf (z. B. Vertrag → Fahrzeug, KFZ-26) */
.detail-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.detail-link:hover { text-decoration: underline; }

/* DKV-Import-Staging-Tabelle (KFZ-76) */
.dkv-tbl td { vertical-align: middle; }
.dkv-tbl .ctl-sm { height: 30px; font-size: 12px; padding: 0 6px; }
.dkv-tbl td input.ctl-sm { min-width: 90px; }
.dkv-row.st-prüfen { background: color-mix(in srgb, oklch(80% 0.16 85) 16%, white); }
.dkv-row.st-nicht-importieren { background: color-mix(in srgb, oklch(58% 0.19 25) 8%, white); }
.dkv-aktionen { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* Schönes „Datei auswählen"-Feld (KFZ-78) */
.filepick { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fp-native { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.btn-file {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid oklch(86% 0.02 250);
  background: linear-gradient(180deg, #fff, oklch(97% 0.004 250));
  color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: border-color .12s, background .12s, box-shadow .12s;
}
.btn-file:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.btn-file:active { transform: translateY(1px); }
.btn-file svg { color: var(--accent); flex: none; }
.fp-name { font-size: 13px; color: var(--text-muted); }
.fp-name.has { color: var(--text); font-weight: 600; }

/* Kilometerstände-Tabelle (KFZ-52) */
.km-tbl td { vertical-align: middle; }
.km-tbl .km-neu { background: var(--accent-soft); }
.km-tbl .km-neu .control { width: 100%; }

/* Usersperre – Heftklammer, Button, Schloss (KFZ-58) */
.wrap { position: relative; }
/* KFZ-65: tiefer + weiter links, damit die Infos oben rechts (Status/Verwendung) frei bleiben */
.sperre-clip { position: absolute; top: 50px; left: 150px; z-index: 6; transform: rotate(var(--rot, -3deg)); transform-origin: top center; }
.sperre-schild {
  background: #fff9e6; border: 1px solid #ece0b3; border-radius: 3px;
  padding: 4px 14px 6px; box-shadow: 1px 3px 7px rgba(0,0,0,.18);
  font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive;
  text-align: center; min-width: 96px;
}
.sperre-label { display: block; font-size: 9px; color: #b8860b; text-transform: uppercase; letter-spacing: .08em; }
.sperre-name { display: block; font-size: 15px; font-weight: 700; color: #3a3320; line-height: 1.15; }
.sperre-datum { display: block; font-size: 9.5px; color: #9a8c60; margin-top: 1px; }
.sperre-x {
  position: absolute; top: 1px; right: 2px; width: 18px; height: 18px;
  border: none; background: transparent; color: oklch(55% 0.2 25);
  font-size: 19px; font-weight: 700; line-height: 1;
  cursor: pointer; display: none; align-items: center; justify-content: center; padding: 0;
}
.sperre-clip:hover .sperre-x { display: inline-flex; }
.btn-sperre { display: inline-flex; align-items: center; gap: 5px; }
.btn-sperre.is-locked { color: var(--text-muted); cursor: default; opacity: .8; }
.v-lock { color: oklch(58% 0.16 60); vertical-align: -1px; }
/* Filter „Meine Gesperrten" über der Liste (KFZ-68) */
.lock-filter {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--text-muted); font-size: 12px; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.lock-filter:hover { border-color: oklch(58% 0.16 60); color: var(--text); }
.lock-filter.on { background: oklch(58% 0.16 60); border-color: oklch(58% 0.16 60); color: #fff; }

/* Durchsuchbare Auswahlfelder Fahrer/Abteilung (KFZ-61) */
.ss-wrap { position: relative; }
.ss-native { display: none !important; }
.ss-input { width: 100%; cursor: text; }
.ss-wrap.open .ss-input { border-color: var(--accent); }
.ss-panel {
  position: fixed; z-index: 1000; max-height: 260px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px;
}
.ss-item { padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-item.hi, .ss-item:hover { background: var(--accent-soft); }
.ss-item.sel { font-weight: 600; }
.ss-empty { padding: 8px 10px; font-size: 12.5px; color: var(--text-muted); }

/* KM-Erfassung in der Fahrzeug-Gruppe „Aktuelles" (KFZ-55) */
.km-erfassung .km-eingabe { display: flex; gap: 8px; align-items: center; }
.km-erfassung .km-eingabe input[type="date"] { flex: 0 0 150px; max-width: 160px; }
.km-erfassung .km-eingabe input[type="number"] { flex: 1 1 auto; min-width: 0; }
/* +-Button zur Direkt-Speicherung des KM-Standes (KFZ-56) */
.km-add-btn {
  flex: 0 0 auto; width: 36px; height: 36px; padding: 0;
  font-size: 20px; line-height: 1; font-weight: 600; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
}
.km-add-btn:disabled { opacity: .5; cursor: default; }
.km-verlauf {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px;
  margin-top: 2px; font-size: 12px; color: var(--text-muted);
}
.km-verlauf-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.km-verlauf .km-item strong { color: var(--text); font-weight: 600; }
.km-verlauf .km-sep { opacity: .5; }

/* --------------------------------------------------------------------- */
/* Leerzustände Fahrzeug/Vertrag – Comic-Grafik + Hand (KFZ-25)          */
/* --------------------------------------------------------------------- */
.es {
  position: relative;
  height: 100%; min-height: 320px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; text-align: center;
  padding: 24px; animation: es-in .5s ease both;
}
@keyframes es-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.es-hint { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.es-text { font-size: 16px; font-weight: 700; color: var(--text); }
.es-sub { font-size: 12.5px; color: var(--text-muted); }
/* Hand direkt an der Filterspalte (linker Rand), zeigt nach links (KFZ-27) */
.es-hand { position: absolute; left: 16px; top: 50%; width: 116px; height: auto;
  filter: drop-shadow(0 3px 5px rgba(20, 40, 70, 0.15)); animation: es-point 1.3s ease-in-out infinite; }
@keyframes es-point {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-12px); }
}

/* Auto */
.es-car { width: min(320px, 66%); overflow: visible; animation: es-bob 1.8s ease-in-out infinite; }
@keyframes es-bob { 0%, 100% { transform: translateY(0) rotate(-.5deg); } 50% { transform: translateY(-9px) rotate(.5deg); } }
.es-wheel { transform-box: fill-box; transform-origin: center; animation: es-spin 1.15s linear infinite; }
@keyframes es-spin { to { transform: rotate(360deg); } }
.es-shadow { transform-box: fill-box; transform-origin: center; animation: es-shadow 1.8s ease-in-out infinite; }
@keyframes es-shadow { 0%, 100% { transform: scaleX(1); opacity: .18; } 50% { transform: scaleX(.86); opacity: .12; } }

/* Dokument */
.es-doc { width: min(220px, 48%); overflow: visible; animation: es-float 2.6s ease-in-out infinite; }
@keyframes es-float { 0%, 100% { transform: translateY(0) rotate(-1.6deg); } 50% { transform: translateY(-10px) rotate(1.6deg); } }

@media (prefers-reduced-motion: reduce) {
  .es, .es-car, .es-wheel, .es-shadow, .es-doc, .es-hand { animation: none; }
}

/* ===== KFZ-81: Optik-Politur der Vertragsansicht (scoped auf .area-vertrag) ===== */
/* Auswahlliste links: Vertrags-Ton für aktive/hover-Zeile + Akzentbalken */
.area-vertrag .vehicle-list .head .cap { color: var(--area-vertrag-line); }
.area-vertrag .v-row { padding: 9px 8px; transition: background .12s ease, box-shadow .12s ease; }
.area-vertrag .v-row:hover:not(.active) { background: var(--area-vertrag); }
.area-vertrag .v-row.active {
  background: var(--area-vertrag-strong);
  box-shadow: inset 3px 0 0 var(--area-vertrag-line);
}
.area-vertrag .v-row.active .plate { color: oklch(34% 0.06 80); }
.area-vertrag .v-row .v-dot { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent); }

/* Kopfbereich: Monogramm-Badge, Ende-Angabe als Pille */
.area-vertrag .detail-head .plate { display: inline-flex; align-items: center; gap: 11px; }
.area-vertrag .v-monogram {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  background: var(--area-vertrag-strong); color: var(--area-vertrag-line);
}
.area-vertrag .detail-head .sub .detail-link:hover { color: var(--area-vertrag-line); }
.area-vertrag .vertrag-ende {
  display: inline-block; margin-top: 9px; padding: 3px 11px; border-radius: 999px;
  background: var(--area-vertrag); color: oklch(38% 0.06 80); font-weight: 600; font-size: 12px;
}
.area-vertrag .vertrag-ende.urgent {
  background: color-mix(in srgb, oklch(55% 0.19 25) 12%, white); color: oklch(52% 0.19 25);
}
.area-vertrag .rule {
  background: linear-gradient(to right, var(--area-vertrag-line), var(--border) 42%, var(--border));
  margin-top: 16px;
}

/* Formular-Gruppen: Akzentbalken, weicher Schatten, Hover-Hebung */
.area-vertrag .fgroup {
  border-left: 3px solid var(--area-vertrag-line);
  box-shadow: 0 1px 2px rgba(35, 30, 15, .04);
  transition: box-shadow .16s ease, transform .16s ease;
}
.area-vertrag .fgroup:hover { box-shadow: 0 3px 12px rgba(35, 30, 15, .09); }
.area-vertrag .fgroup-title { color: oklch(36% 0.05 80); }
/* KFZ-84: Bei Mehrkilometer-Warnung Gruppentitel „KM Prognose" dunkelrot */
.area-vertrag .fgroup.km-alert .fgroup-title { color: oklch(42% 0.18 27); }

/* Berechnete Felder (KM-Prognose) im Vertrags-Ton hervorheben */
.area-vertrag .field .control.ro {
  background: var(--area-vertrag); border-color: var(--area-vertrag-strong);
  color: oklch(38% 0.02 80); font-variant-numeric: tabular-nums;
}
.area-vertrag .field .control.ro.neg { color: oklch(52% 0.16 25); }
.area-vertrag .field .control.ro.pos { color: oklch(48% 0.13 150); }
