/* ASTORIX Designsystem ------------------------------------------------------------------------------
   Schwarz und Weiß bilden die Identität, Graphit gibt Tiefe (KI). Sanftes Rot, Grün und Gelb nur für Zustände.
   Systemschrift (keine externen Fonts, damit keine Daten an Dritte gehen). Zahlen tabellarisch.
   Große, runde Aktionsknöpfe für unterwegs. Farben ausschließlich über die Variablen in :root. */
:root {
  /* ASTORIX – Monochrome. Intelligent. Präzise. Alle Farben nur hier definieren. */
  --black: #171717;          /* Navigation, Primäraktionen, starke Kontraste */
  --graphite: #292929;       /* KI-Bereiche, dunkle Karten */
  --graphite-2: #333333;     /* Hover/aktiv auf dunklem Grund */
  --white: #ffffff;          /* Karten, Eingabefelder */
  --canvas: #f3f3f3;         /* Seitenhintergrund */
  --subtle: #fafafa;         /* dezente Flächen in Karten (Fußleisten) */
  --hover: #ededed;          /* neutrale Badges, Hover, Segmente */
  --line: #e5e5e5;           /* Rahmen, Trennlinien */
  --line-strong: #d4d4d4;    /* Eingabeumrandung */
  --muted: #737373;          /* sekundäre Informationen */
  --faint: #a3a3a3;          /* inaktive Elemente */
  --neutral-text: #525252;   /* Text auf neutralen Badges */
  --ink: var(--black);
  --on-dark: #ffffff;
  --on-dark-muted: #a3a3a3;
  --on-dark-line: #3d3d3d;
  /* Signalfarben – nur für Zustände, nie als Markenfarbe */
  --red-bg: #f2dedc; --red: #a34f4a; --red-line: #e6c4c0;
  --green-bg: #dcebdd; --green: #426a4b;
  --yellow-bg: #f5e9c9; --yellow: #92712d; --yellow-line: #e6d39f;
  /* etwas dunklere Textvarianten, damit kleine Schrift auf den Signalflächen mind. 4,5:1 Kontrast hat */
  --red-text: #96463f; --yellow-text: #7d6127;
  --blue-bg: #dfe7f3; --blue: #5577a6; --blue-text: #3b5a85;

  /* Gezielte Akzente – unabhängig voneinander einstellbar */
  --brand: #5cc4ab;          /* ASTORIX-Akzent auf dunklem Grund (Logo „IX“, aktive Navigation, KI-Symbol) */
  --brand-deep: #1d7562;     /* ASTORIX-Akzent auf hellem Grund */
  --brand-soft: #e3f1ec;
  --ref: var(--brand-deep);  /* Auftragsnummern */
  --route-from: #1d7562;     /* Abholpunkt */
  --route-line-start: #1d7562;
  --route-line-end: #b8c9c3; /* Verlauf zur Abgabe */
  --route-to: #8a8a8a;       /* Abgabepunkt (neutral; bei Abschluss/Problem in Statusfarbe) */
  --plate-band: #3b5a96;     /* EU-Streifen am Kennzeichen */
  --plate-border: var(--black);
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 12px rgba(0, 0, 0, .04);
  --overlay: rgba(23, 23, 23, .45);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side: 236px;
  --tabbar: 64px;
  --mobilebar: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); }
body { font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--ink); }
.num { font-variant-numeric: tabular-nums; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 750; }
h2 { font-size: 17px; line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 14px; }
p.sub { margin: 2px 0 0; }
.small-print { font-size: 12.5px; margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.sidebar :focus-visible, .tabbar :focus-visible, .selbar :focus-visible { outline-color: var(--white); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* --- Bedienelemente ------------------------------------------------------------------------------ */
button, .btn, .pill {
  font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); background: var(--white);
  border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 9px 16px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
button:hover, .pill:hover { border-color: var(--black); }
button:disabled { opacity: .5; cursor: default; }
button.primary, .pill.primary { background: var(--black); border-color: var(--black); color: var(--white); }
button.primary:hover, .pill.primary:hover { background: var(--graphite); }
/* Team speichern: rot pulsierend bei ungespeicherten Änderungen, kurz grün nach dem Speichern, dann wieder schwarz */
button.primary { transition: background-color .4s, border-color .4s; }
button.primary.unsaved { background: var(--red); border-color: var(--red); animation: save-pulse 1.6s ease-out infinite; }
button.primary.saved { background: var(--green); border-color: var(--green); }
button.primary.unsaved:hover, button.primary.saved:hover { filter: brightness(1.1); }
@keyframes save-pulse { from { box-shadow: 0 0 0 0 var(--red); } to { box-shadow: 0 0 0 9px transparent; } }
.pill.inverse, button.inverse { background: var(--white); border-color: var(--white); color: var(--black); }
.pill.inverse:hover { background: var(--hover); }
.pill.ghost { background: transparent; border-color: var(--line-strong); }
.pill.ghost-dark { background: transparent; border-color: var(--on-dark-line); color: var(--on-dark); }
button.small, .pill.small { min-height: 34px; padding: 5px 13px; font-size: 13.5px; }
button.link { border: 0; background: none; padding: 4px 0; min-height: 0; color: var(--ink); border-radius: 4px; }
button.small-link { font-size: 12.5px; padding: 2px 0; display: block; }
button.danger, .pill.danger { background: var(--red-bg); border-color: var(--red-line); color: var(--red-text); }
button.danger:hover, .pill.danger:hover { border-color: var(--red-text); }
.icon-btn { min-height: 38px; min-width: 38px; padding: 6px 10px; border-color: transparent; background: transparent; }
.icon-btn.warn { background: var(--red-bg); color: var(--red-text); border-color: transparent; }
.pill-select { border-radius: 999px; min-height: 34px; padding: 4px 12px; font-size: 13.5px; width: auto; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--white); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-s); padding: 9px 11px; min-width: 0; width: 100%; min-height: 42px;
}
/* Felder in einer Beschriftung erben sonst deren kleine, fette Schrift; am Handy 16 px, sonst zoomt iOS beim Antippen */
label.field > :is(input, select, textarea) { font-size: 15px; font-weight: 400; }
@media (max-width: 899px) { label.field > :is(input, select, textarea) { font-size: 16px; } }
/* Bricht eine Beschriftung um, bleiben die Felder einer Reihe trotzdem auf einer Linie */
.grid-fields > label.field > :is(input, select, textarea):last-child { margin-top: auto; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--black); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }

/* --- Status ------------------------------------------------------------------------------------- */
.status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; line-height: 1;
  padding: 6px 10px; border-radius: 999px; white-space: nowrap;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tone-neutral { background: var(--hover); color: var(--neutral-text); }
.tone-pending { background: var(--yellow-bg); color: var(--yellow-text); }
.tone-plan, .tone-assigned, .tone-go { background: var(--blue-bg); color: var(--blue-text); }
.tone-done { background: var(--green-bg); color: var(--green); }
.tone-bad { background: var(--red-bg); color: var(--red-text); }
.tone-neutral .status-dot { background: var(--faint); }
.tone-pending .status-dot { background: var(--yellow); }
.tone-plan .status-dot, .tone-assigned .status-dot, .tone-go .status-dot { background: var(--blue); }
.tone-done .status-dot { background: var(--green); }
.tone-bad .status-dot { background: var(--red); }
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 6px;
  background: var(--hover); color: var(--ink); margin-left: 6px; vertical-align: 1px;
}
.badge.test { background: var(--yellow-bg); color: var(--yellow-text); }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.gone { background: var(--hover); color: var(--faint); }
.badge.mode { background: var(--hover); color: var(--muted); }

.plate {
  display: inline-flex; align-items: stretch; font-weight: 750; font-size: 14px; letter-spacing: .03em; color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 6px; background: var(--white); overflow: hidden; line-height: 1; white-space: nowrap;
}
.plate-eu { width: 9px; background: var(--plate-band); margin-right: 7px; }
.plate { padding-right: 8px; }
.plate > :not(.plate-eu) { padding: 5px 0; }
.plate { padding-top: 5px; padding-bottom: 5px; }
.plate-eu { margin-top: -5px; margin-bottom: -5px; }

/* Hinweise */
.notice { border-radius: var(--radius-s); padding: 11px 14px; font-size: 14px; margin: 0 0 14px; }
ul.notice { padding-left: 32px; }
.notice.warn-box { background: var(--yellow-bg); color: var(--yellow-text); }
.notice.bad-box { background: var(--red-bg); color: var(--red-text); }
.notice.good-box { background: var(--green-bg); color: var(--green); }
.notice.ok-box { background: var(--green-bg); color: var(--green); }
.notice.bad { background: var(--red-bg); color: var(--red-text); padding-left: 32px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: var(--radius-s); margin-bottom: 14px; font-size: 14px; }
.banner.info { background: var(--hover); color: var(--ink); }
.banner.warn { background: var(--yellow-bg); color: var(--yellow-text); }
.banner.error { background: var(--red-bg); color: var(--red-text); }
.banner.ok { background: var(--green-bg); color: var(--green); }
.empty, .empty-state { padding: 28px 16px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--white); }
.empty-state { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.empty-state b { color: var(--ink); }
.empty.small { padding: 12px; margin-bottom: 10px; }
.skeleton-list { display: grid; gap: 12px; }
.skeleton-list div { height: 150px; border-radius: var(--radius); background: linear-gradient(90deg, var(--hover), var(--subtle), var(--hover)); background-size: 200% 100%; animation: sk 1.4s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }

/* --- Rahmen: Seitenleiste, Handy-Kopf, untere Navigation ---------------------------------------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--black); color: var(--on-dark);
  display: flex; flex-direction: column; padding: 18px 12px; z-index: 30;
}
.brand { font-weight: 800; letter-spacing: .05em; font-size: 19px; color: var(--white); text-decoration: none; padding: 4px 12px 18px; }
.brand span { color: var(--brand); font-weight: 800; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--on-dark-muted);
  text-decoration: none; font-weight: 600;
}
.side-nav a:hover { color: var(--white); background: var(--graphite); }
.side-nav a.active { color: var(--white); background: var(--graphite-2); }
.side-nav a.ai { color: var(--on-dark); }
.side-nav a.ai svg { color: var(--brand); }
.side-nav a.active { box-shadow: inset 3px 0 0 var(--brand); }
.side-nav a.ai.active { background: var(--graphite-2); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; }
.account-name { color: var(--white); font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-mail { color: var(--on-dark-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { background: transparent; color: var(--on-dark-muted); border-color: var(--on-dark-line); min-height: 36px; font-size: 13.5px; justify-content: flex-start; }
.mode-pill { font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 999px; align-self: flex-start; white-space: nowrap; }
.mode-pill.ki { background: var(--hover); color: var(--ink); }
.mode-pill.einfach { background: var(--yellow-bg); color: var(--yellow-text); }
.sidebar .mode-pill.ki { background: var(--graphite-2); color: var(--on-dark); }
.sidebar .mode-pill.einfach { background: var(--graphite-2); color: var(--yellow-bg); }
.mobilebar, .tabbar { display: none; }
main { margin-left: var(--side); padding: 28px 32px 64px; max-width: calc(1320px + var(--side)); }
.fab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }

@media (max-width: 1023px) {
  .sidebar { display: none; }
  main { margin-left: 0; padding: 18px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom, 0px)); }
  .mobilebar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    height: calc(var(--mobilebar) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0 4px; background: var(--white); border-bottom: 1px solid var(--line); box-shadow: inset 0 -2px 0 var(--brand);
  }
  .mobilebar .brand { padding: 0 12px; color: var(--black); }
  .mobilebar .brand span { color: var(--brand-deep); }
  .mobilebar .pill { color: var(--black); border-color: var(--line-strong); background: var(--white); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--black); border-top: 1px solid var(--on-dark-line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--on-dark-muted);
    text-decoration: none; font-size: 11.5px; font-weight: 650; min-height: 48px;
  }
  .tabbar a.active { color: var(--white); }
  .tabbar a.active svg { color: var(--brand); }
  .tabbar a.active:not(.ai) .tab-icon::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 18px; height: 2px; margin-left: -9px; border-radius: 2px; background: var(--brand); }
  .tab-icon { position: relative; display: flex; }
  .tab-icon .fab-dot { position: absolute; right: -6px; top: -2px; }
  .tabbar a.ai .tab-icon .fab-dot { right: -3px; top: -3px; width: 12px; height: 12px; border: 2px solid var(--black); }
  .tabbar a.ai .tab-icon { background: var(--white); color: var(--brand-deep); width: 46px; height: 46px; border-radius: 50%; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); border: 3px solid var(--black); }
  .tabbar a.ai.active svg { color: var(--ink); }
  .tabbar a.ai { color: var(--on-dark); }
}

/* --- Seitenkopf, Werkzeugleisten ---------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.srcbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.src-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.live { background: var(--green); }
.dot.test { background: var(--yellow); }
.segmented { display: inline-flex; background: var(--hover); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; min-height: 34px; padding: 5px 14px; font-size: 14px; color: var(--muted); }
.segmented button.on { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { min-height: 36px; padding: 5px 14px; font-size: 14px; background: var(--white); border-color: var(--line); }
.qchip span { color: var(--faint); font-weight: 600; margin-left: 4px; }
.qchip.on { background: var(--black); border-color: var(--black); color: var(--white); }
.qchip.on span { color: var(--on-dark-muted); }
.qchip.alert:not(.on) { border-color: var(--red-line); color: var(--red-text); }
.toolbar-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px 180px auto; gap: 10px; align-items: center; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; color: var(--faint); }
.search input { padding-left: 38px; border-radius: 999px; }
.toolbar-row select { border-radius: 999px; }
@media (max-width: 899px) {
  .toolbar-row { grid-template-columns: 1fr 1fr; }
  .toolbar-row .search { grid-column: 1 / -1; }
  .only-wide { display: none; }
  .quick { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .quick::-webkit-scrollbar { display: none; }
  .qchip { flex: none; }
}

/* --- Fahrtkarten -------------------------------------------------------------------------------- */

.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.trip-stack { display: flex; flex-direction: column; gap: 10px; }
.trip-stack > .pill { align-self: flex-start; }
@media (max-width: 420px) { .trip-grid { grid-template-columns: 1fr; } }
.trip {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.trip.picked { border-color: var(--black); box-shadow: 0 0 0 1px var(--black), var(--shadow); }
.trip.gone { opacity: .7; }
.trip-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 6px; }
.trip-check { margin-top: 3px; flex: none; }
.trip-title { flex: 1; min-width: 0; border: 0; background: none; padding: 0; min-height: 0; border-radius: 6px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; white-space: normal; }
.trip-vehicle { font-weight: 750; font-size: 16px; letter-spacing: -.005em; color: var(--ink); }
.trip-vehicle.big { font-size: 20px; }
.trip-ref, .ref { color: var(--ref); font-size: 13px; font-weight: 650; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.trip-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.trip-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 4px 16px 14px; font-size: 14px; color: var(--muted); }
.trip-facts b { color: var(--ink); font-size: 16px; }
.trip-driver { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; }
.trip-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--subtle); border-top: 1px solid var(--line); flex-wrap: wrap; }
.trip-source { font-size: 13px; color: var(--muted); }
.trip-foot-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.trip.compact .trip-head { padding: 12px 14px 4px; }
.trip.compact .trip-facts { padding: 2px 14px 12px; }

/* Abholung → Abgabe */
.rail { list-style: none; margin: 0; padding: 6px 16px 8px; }
.rail-stop { position: relative; display: flex; gap: 14px; padding-bottom: 12px; }
.rail-stop:last-child { padding-bottom: 6px; }
.rail-dot { position: relative; flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: 2px; z-index: 1; }
.rail-stop.from .rail-dot { background: var(--route-from); box-shadow: inset 0 0 0 5px var(--route-from), inset 0 0 0 9px var(--white); }
.rail-stop.to .rail-dot { background: var(--white); border: 4px solid var(--route-to); }
.rail.st-abgeschlossen .rail-stop.to .rail-dot { border-color: var(--green); }
.rail.st-problem .rail-stop.to .rail-dot { border-color: var(--red); }
.rail-stop.from::before { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: -4px; width: 3px; background: linear-gradient(var(--route-line-start), var(--route-line-end)); border-radius: 2px; }
.rail-body { flex: 1; min-width: 0; }
.rail-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rail-kind { font-weight: 750; font-size: 15px; }
.rail-time { font-size: 13px; font-weight: 600; color: var(--ink); }
.rail-place { font-weight: 650; font-size: 15px; }
.rail-addr { color: var(--muted); font-size: 14px; }
.rail.compact .rail-stop { padding-bottom: 8px; }
.rail.compact .rail-kind { font-size: 13px; color: var(--muted); font-weight: 650; }

/* Auftragsdetail (Blatt) */
.sheet-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.sheet { background: var(--white); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden; }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; padding: 18px 18px 8px; }
.sheet-body { overflow-y: auto; padding: 4px 18px 12px; display: flex; flex-direction: column; gap: 12px; }
.sheet-body .rail { padding: 6px 0; }
.sheet-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.sheet-foot .pill { flex: 1; min-height: 46px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 18px 18px 0 0; max-height: 92vh; }
}

.selbar {
  position: sticky; bottom: 16px; z-index: 15; margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--black); color: var(--white); padding: 10px 12px; border-radius: 18px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25);
}
.selbar b { margin: 0 6px; }
.selbar .pill:not(.inverse) { background: var(--graphite); color: var(--white); border-color: var(--on-dark-line); }
@media (max-width: 1023px) { .selbar { bottom: calc(var(--tabbar) + 10px + env(safe-area-inset-bottom, 0px)); } }

/* Tabellen (nur auf großen Bildschirmen als Option) */
.table-wrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 650; color: var(--muted); background: var(--subtle); padding: 10px 10px; white-space: nowrap; }
td { padding: 10px 10px; border-top: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
tr.gone td { color: var(--faint); }
tr.picked td { background: var(--hover); }
.jobs-table tbody tr { cursor: pointer; }
.jobs-table tbody tr:hover td { background: var(--subtle); }
.jobs-table .plate { font-size: 11.5px; margin-left: 4px; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.cell-warn { font-size: 12.5px; color: var(--yellow-text); margin-top: 2px; }
td.sel, th.sel { width: 40px; }
.scroll-x { overflow-x: auto; }

/* --- Leitstelle --------------------------------------------------------------------------------- */
.kpi-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi-tile {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 0; white-space: normal; box-shadow: none;
}
button.kpi-tile:hover { border-color: var(--black); }
.kpi-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-tile.tone-bad { background: var(--red-bg); border-color: var(--red-line); }
.kpi-tile.tone-bad .kpi-value { color: var(--red-text); }

@media (max-width: 1279px) { .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row .kpi-tile:last-child { grid-column: 1 / -1; }
  .kpi-value { font-size: 22px; }
}
.dash-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-two { grid-template-columns: 1fr; } }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; }
.panel-head.spread { justify-content: space-between; flex-wrap: wrap; }
.ai-panel { background: var(--graphite); color: var(--on-dark); border-color: var(--graphite); }
.ai-panel h2 { color: var(--white); }
.ai-panel .sub { color: var(--on-dark-muted); }
.ai-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--black); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ai-lage { margin: 0; font-size: 17px; line-height: 1.5; color: var(--white); max-width: 62ch; }
.ai-ask { display: flex; gap: 8px; }
.ai-ask input { border-radius: 999px; background: var(--white); border-color: transparent; min-height: 48px; padding-left: 18px; }
.ai-ask .pill { min-width: 48px; min-height: 48px; padding: 0; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-panel .quick-actions .pill { background: var(--graphite-2); border-color: var(--on-dark-line); color: var(--white); }
.ai-panel .quick-actions .pill:hover { border-color: var(--on-dark-muted); }

/* --- Touren ------------------------------------------------------------------------------------- */
.plans { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tour-card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.tour-card.focus { border-color: var(--ink); box-shadow: 0 0 0 2px var(--hover); }
.tour-card-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px 8px; }
.tour-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tour-value { font-size: 22px; font-weight: 750; }
.flow { list-style: none; display: flex; gap: 4px; margin: 4px 18px 10px; padding: 0; }
.flow li { flex: 1; font-size: 11.5px; font-weight: 650; color: var(--faint); padding-top: 7px; border-top: 4px solid var(--line); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow li.done { border-color: var(--green); color: var(--green); }
.flow li.now { border-color: var(--black); color: var(--ink); }
.tour-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0 18px 10px; font-size: 14px; color: var(--muted); }
.tour-facts b { color: var(--ink); }
.tour-drivers { list-style: none; margin: 0; padding: 0 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.tour-drivers li { display: flex; gap: 12px; align-items: flex-start; }
.tour-route { display: block; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--black); color: var(--white); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.avatar.big { width: 40px; height: 40px; font-size: 16px; }
.tour-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--subtle); }
.tour-actions .primary { margin-left: auto; }
.tour-card .notice { margin: 0 18px 12px; }
.tour-detail { padding: 0 18px 14px; }
.confirm-bar { margin: 0 18px 12px; padding: 12px 14px; border: 2px solid var(--yellow-line); background: var(--yellow-bg); border-radius: 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.confirm-actions { display: flex; gap: 8px; }
@media (max-width: 640px) {
  .tour-actions .pill { flex: 1 1 calc(50% - 4px); }   /* zwei je Reihe statt „Löschen“ allein über die ganze Breite */
  .tour-actions .primary { flex-basis: 100%; min-height: 46px; margin-left: 0; order: -1; }
  .flow li { font-size: 0; }
  .flow li.now { font-size: 11.5px; flex: 3; }
}

/* Tour bearbeiten */
.editor { border: 2px solid var(--ink); border-radius: 16px; background: var(--white); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tour-card .editor { margin: 0 18px 14px; }
.editor-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-sum { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; align-items: center; }
.editor .notice { margin: 0; }
.editor-delta { white-space: normal; }
.editor-drivers { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.editor-driver { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.editor-driver-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.editor-driver-head select { width: auto; margin-left: auto; min-height: 34px; border-radius: 999px; font-size: 13px; }
.editor-stops { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.editor-stop { display: flex; gap: 8px; font-size: 14px; }
.editor-stop .ref { white-space: nowrap; }
.editor-time { color: var(--muted); font-weight: 600; }
.editor-stop-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.editor-stop-actions select { width: auto; min-height: 34px; border-radius: 999px; font-size: 13px; padding: 4px 10px; }
.editor-add { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 10px; align-items: end; }
.editor-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
@media (max-width: 640px) { .editor-add { grid-template-columns: 1fr; } .editor-foot .pill { flex: 1; } }

/* --- Team --------------------------------------------------------------------------------------- */
.section { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 16px; }
.section h2 { margin-bottom: 14px; }
.driver-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-bottom: 12px; }
@media (max-width: 420px) {
  .driver-grid { grid-template-columns: 1fr; } .add-card { min-height: 96px; }
  .driver-head { flex-wrap: wrap; row-gap: 6px; } .driver-head .switch { flex-basis: 100%; padding-left: 50px; }
}
.driver-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 14px; min-width: 0; background: var(--white); }
.driver-card.off { background: var(--subtle); }
.driver-card.off .avatar { background: var(--faint); }
.driver-head { display: flex; align-items: center; gap: 10px; }
.driver-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.driver-summary { font-size: 12.5px; color: var(--muted); padding-left: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name-input { font-weight: 700; font-size: 16px; border-color: transparent; background: transparent; padding: 2px 6px; min-height: 30px; }
.name-input:hover, .name-input:focus { border-color: var(--line-strong); background: var(--white); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.driver-block { display: flex; flex-direction: column; gap: 7px; }
.driver-block.today { border-top: 1px solid var(--line); padding-top: 12px; gap: 10px; }
.block-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.week { display: flex; flex-direction: column; gap: 4px; }
.week-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; border-radius: var(--radius-s); }
.week-row input[type="time"] { min-height: 36px; padding: 5px 8px; font-size: 14px; }
.week-row.today button.day-chip:not(.on) { border-color: var(--ink); }
.week-row.today button.day-chip.on { box-shadow: 0 0 0 2px var(--brand); }
.week-free { grid-column: 2 / -1; font-size: 13px; color: var(--faint); padding: 0 4px; }
button.day-chip { min-height: 36px; padding: 0; font-size: 13px; border-radius: var(--radius-s); color: var(--muted); background: var(--subtle); border-color: var(--line-strong); }
button.day-chip.on { background: var(--black); border-color: var(--black); color: var(--white); }
button.day-chip.on:hover { background: var(--graphite); }
.day-presets { display: inline-flex; gap: 12px; }
.day-presets button.small-link, button.copy-times { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; display: inline; }
.day-presets button.small-link:hover, button.copy-times:hover { color: var(--ink); }
button.copy-times { align-self: flex-start; text-align: left; white-space: normal; }
.time-dash { color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--red); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.hint.bad { color: var(--red-text); font-weight: 600; }
.load-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 5px; gap: 8px; }
.load-bar { height: 8px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.load-bar span { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.load-bar span.high { background: var(--yellow); }
.driver-tours ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.driver-tours li { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 14px; flex-wrap: wrap; }
.driver-tours .notice { margin: 8px 0 0; font-size: 13px; }
.driver-tours ul.notice { padding: 8px 12px; gap: 2px; }   /* sonst greift die Listen-Regel oben und der Text klebt am Rand */
.driver-bottom { display: flex; align-items: flex-start; gap: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.driver-more { flex: 1; min-width: 0; }
button.icon-btn { min-height: 32px; padding: 4px 10px; font-size: 13px; border-color: transparent; background: transparent; color: var(--muted); }
button.icon-btn.danger-ghost:hover { color: var(--red-text); background: var(--red-bg); border-color: var(--red-line); }
.driver-summary.bad { color: var(--red-text); font-weight: 600; }
.driver-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.driver-more[open] summary { margin-bottom: 8px; }
.driver-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .driver-contact { grid-template-columns: 1fr; } }
.add-card { flex-direction: column; gap: 4px; min-height: 160px; border: 1.5px dashed var(--line-strong); border-radius: 16px; background: transparent; font-size: 15px; }
.add-card:hover { background: var(--white); }
.add-card.full { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; font-weight: 600; min-height: 96px; }
.add-plus { width: 36px; height: 36px; border-radius: 50%; background: var(--hover); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.section-intro { margin: -6px 0 12px; }
.section > label.check + p.sub { margin-top: 10px; }
.empty-action { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
/* Kopfzeile mit Speichern bleibt beim Scrollen sichtbar */
.sticky-head { position: sticky; top: 0; z-index: 15; background: var(--canvas); margin: -28px -32px 20px; padding: 28px 32px 14px; border-bottom: 1px solid transparent; }
@media (max-width: 1023px) {
  .sticky-head { top: calc(var(--mobilebar) + env(safe-area-inset-top, 0px)); margin: -18px -16px 16px; padding: 12px 16px 10px; align-items: center; flex-wrap: nowrap; }
  .sticky-head .sub { display: none; }
}
.row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr 80px auto auto; align-items: center; margin-bottom: 10px; }
.grid-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-fields .actions { display: flex; align-items: flex-end; }
.grid-fields .actions:has(.submit-hint) { flex-wrap: wrap; align-items: center; gap: 6px 12px; grid-column: 1 / -1; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }

/* Nutzer & Rechte (Team-Seite, nur Admins) */
.user-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.user-row { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px;
  grid-template-columns: minmax(180px, 1fr) minmax(200px, 1fr) minmax(0, 1.5fr); align-items: center; }
.user-row.off { background: var(--subtle); }
.user-row .confirm-bar { grid-column: 1 / -1; margin: 0; }
.user-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.user-mail { overflow-wrap: anywhere; }
.user-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.user-tags .badge { margin-left: 0; }
.user-perms, .perm-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.perm-checks { gap: 6px 16px; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user-pw { flex: 1 1 260px; }
.user-pw-row { display: flex; gap: 6px; }
.user-pw-row input { flex: 1; min-width: 0; }
.user-new-title { font-size: 15px; margin: 4px 0 10px; }
@media (max-width: 899px) {
  .user-row { grid-template-columns: 1fr; }
  .user-actions { justify-content: flex-start; }
}
.seats { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.seats input { width: 64px; padding: 9px 6px; text-align: center; }
details.more { margin-top: 14px; }
details.more summary, .more-filters summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
@media (max-width: 700px) { .row { grid-template-columns: 1fr 1fr; } }

/* --- Planungsansicht ---------------------------------------------------------------------------- */
.plan-headbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filters {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end;
  background: var(--white); padding: 16px; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 16px;
}
.filters .actions { display: flex; gap: 8px; }
.more-filters { grid-column: 1 / -1; }
.more-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-top: 10px; }
.resultbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.ai-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.planning-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1279px) { .planning-grid { grid-template-columns: 1fr; } }
.planning-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.side-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.side-card h2 { font-size: 15px; margin-bottom: 10px; }
.side-jobs, .side-drivers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.side-jobs li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 2px 8px; font-size: 13.5px; align-items: start; }
.side-jobs li .status { grid-column: 2; justify-self: start; }
.side-time { color: var(--muted); font-weight: 600; }
.side-route { overflow-wrap: anywhere; }
.side-drivers li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.side-drivers li.off { opacity: .6; }
.combos { margin-bottom: 16px; }
.combos summary { cursor: pointer; margin-bottom: 8px; }
.combos table td, .combos table th { text-align: center; }
.combos td.no { color: var(--faint); }
.combos td.yes { font-weight: 600; }
.combos td.top { background: var(--hover); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font-size: 13px; font-weight: 550; padding: 6px 11px; min-height: 32px; border-radius: 999px; background: var(--white); border: 1px solid var(--line-strong); text-align: left; white-space: normal; }
.notes { margin-top: 24px; font-size: 13px; color: var(--muted); }
.notes li { margin-bottom: 4px; }
.plan-wrap { display: flex; flex-direction: column; gap: 8px; }
.plan-wrap > .ai-confirm, .plan-wrap > .notice { margin: 0; }

/* Vorschlagskarte (PlanCard) */
.plan { background: var(--white); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.plan.best { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--shadow); }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 4px; }
.plan-title { display: flex; flex-direction: column; gap: 2px; }
.plan-title .label { font-size: 13px; font-weight: 700; color: var(--ink); }
.plan-profit { text-align: right; }
.plan-profit .value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
.plan-profit .cap { font-size: 12.5px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); padding: 8px 18px 12px; }
.kpi { padding: 6px 0; }
.kpi .k { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-weight: 650; }
.routeline { padding: 0 18px 12px; font-size: 14px; color: var(--muted); }
.routeline b { color: var(--ink); font-weight: 650; }
.warnings { margin: 0; padding: 10px 18px 12px 36px; background: var(--yellow-bg); color: var(--yellow-text); font-size: 13.5px; }
.plan-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--subtle); gap: 8px; flex-wrap: wrap; }
.plan-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.crew { border-top: 1px solid var(--line); padding: 14px 18px; }
.crew-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.crew-head .who { font-weight: 650; }
.crew-head .meta { font-size: 13px; color: var(--muted); }
.crew-stats { text-align: right; }
@media (max-width: 640px) { .crew-stats { text-align: left; } }
.stops td { padding: 7px 10px; }
.handoffs { list-style: none; margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--hover); color: var(--ink); font-size: 13.5px; }
.handoffs li + li { margin-top: 4px; }
.handoffs li::before { content: "⇄ "; font-weight: 700; }
.only-mobile { display: none; }
@media (max-width: 700px) {
  .plan-actions { justify-content: flex-start; }
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-top: 1px solid var(--line); padding: 10px 12px; }
  table.responsive tr:first-child { border-top: 0; }
  table.responsive td { border: 0; padding: 2px 0; text-align: right; overflow: hidden; }
  table.responsive td::before { content: attr(data-label); float: left; margin-right: 12px; color: var(--muted); font-size: 12.5px; line-height: 21px; }
  table.responsive td.empty-cell { display: none; }
  table.responsive td.main { display: block; text-align: left; font-weight: 650; padding-bottom: 4px; }
  table.responsive td.main::before { content: none; }
  table.responsive td.hide-mobile { display: none; }
  .only-mobile { display: inline; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .actions { grid-column: 1 / -1; }
  .filters .actions button { flex: 1; }
}

/* --- Anmeldung ---------------------------------------------------------------------------------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--black); margin: 0; max-width: none; }
.login-card { width: 100%; max-width: 400px; background: var(--white); border-radius: 20px; padding: 30px 26px; display: flex; flex-direction: column; gap: 14px; }
.brand.big { font-size: 30px; color: var(--ink); padding: 0; }
.brand.big span { color: var(--brand-deep); }
.login-card .sub { margin: -8px 0 6px; }
.login-card button.primary { min-height: 48px; }
.center { min-height: 60vh; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; }

/* --- AI / Disposition --------------------------------------------------------------------------- */
main:has(.dispo) { padding-bottom: 16px; max-width: none; }
main:has(.dispo.view-ki) { height: 100vh; display: flex; flex-direction: column; padding-bottom: 16px; }
.dispo { display: flex; flex-direction: column; gap: 14px; }
.dispo.view-ki { flex: 1; min-height: 0; }
.dispo.view-ki .ai-center { flex: 1; min-height: 0; }
.dispo-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.dispo-title { display: flex; align-items: center; gap: 12px; }
.dispo-title h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dispo-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 1023px) {
  main:has(.dispo.view-ki) {
    height: calc(100dvh - var(--mobilebar) - env(safe-area-inset-top, 0px));
    padding: 10px 12px calc(var(--tabbar) + 10px + env(safe-area-inset-bottom, 0px));
  }
  .dispo { gap: 10px; }
  .dispo-title .sub { display: none; }
  .dispo-title h1 { font-size: 20px; }
  .dispo-title .ai-mark { width: 32px; height: 32px; border-radius: 10px; }
}
@media (max-width: 560px) {
  .dispo-head { gap: 8px; }
  .dispo-tools { width: 100%; flex-wrap: nowrap; }
  .dispo-tools .mode-pill.head-pill { display: none; }
  .dispo-tools .segmented { flex: 1; }
  .dispo-tools .segmented button { flex: 1; padding: 5px 8px; }
}
.dispo-title .mode-pill.inline-pill { display: none; font-size: 11.5px; }
@media (max-width: 560px) { .dispo-title .mode-pill.inline-pill { display: inline-block; } }

.ai-center { container-type: inline-size; display: flex; flex-direction: column; min-height: 0; }
.ai-tabs { display: none; }
.ai-body {
  flex: 1; min-height: 0; display: grid; gap: 12px;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr) minmax(250px, 290px);
  grid-template-areas: "chat results context";
}
.ai-col { background: var(--white); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ai-chat { grid-area: chat; }
.ai-results { grid-area: results; }
.ai-context { grid-area: context; }
.ai-mid-switch { display: none; grid-area: switch; }
.ai-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 46px; }
.ai-col-head .ai-q { flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-scroll { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ai-chat-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ai-intro p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.ai-demo-hint { background: var(--yellow-bg); color: var(--yellow-text) !important; padding: 8px 10px; border-radius: 10px; }
.ai-history { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.ai-turn { display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; flex-direction: column; gap: 6px; }
.chat-msg.user { align-items: flex-end; }
.bubble { padding: 10px 13px; border-radius: 16px; max-width: 90%; white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.chat-msg.user .bubble { background: var(--black); color: var(--white); border-bottom-right-radius: 5px; }
.chat-msg.assistant .bubble { background: var(--hover); border-bottom-left-radius: 5px; }
.ai-bubble-tag { margin-bottom: 4px; }
.bubble.ai-err { background: var(--red-bg) !important; color: var(--red-text); }
.bubble.ai-err button { margin-top: 6px; }
.bubble.ai-ok { background: var(--green-bg) !important; color: var(--green); }
.ai-ctx-tag { font-size: 12px; color: var(--muted); background: var(--hover); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; align-self: flex-end; }
.ai-chat-cards { display: flex; flex-direction: column; gap: 6px; max-width: 94%; }
.ai-chat-cards.active .ai-mini { border-color: var(--ink); }
.ai-chat-cards > button { align-self: flex-start; }
.ai-mini { border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 13px; background: var(--white); }
.ai-mini-top { display: flex; justify-content: space-between; gap: 8px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; flex: none; max-height: 112px; overflow-y: auto; border-top: 1px solid var(--line); }
.ai-suggest .chip { max-width: 100%; font-size: 12.5px; padding: 5px 10px; min-height: 30px; }
.ai-input { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; flex: none; }
.ai-input .ai-ctx-tag { flex-basis: 100%; align-self: flex-start; flex-grow: 0; }
.ai-input textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; border-radius: 16px; }
.ai-input button { min-height: 46px; }
.ai-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ai-steps li { padding-left: 20px; position: relative; color: var(--muted); }
.ai-steps li.done::before { content: "✓"; position: absolute; left: 2px; color: var(--ink); font-weight: 700; }
.ai-steps li.run { color: var(--ink); font-weight: 600; }
.ai-steps li.run::before { content: ""; position: absolute; left: 2px; top: 4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-working { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1.5px dashed var(--line-strong); border-radius: 12px; }
.ai-spinner { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 3px solid var(--hover); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.ai-trace summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.ai-trace .ai-steps { margin-top: 6px; }
.ai-empty { padding: 18px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: 12px; font-size: 14px; }
.ai-empty.big { padding: 40px 18px; }
.ai-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ai-block-title { font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-block > .sub { margin-top: -6px; }
.origin { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: 1px; }
.origin-engine { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.origin-data { background: var(--hover); color: var(--ink); }
.origin-ki { background: var(--hover); color: var(--ink); }
.origin-demo { background: var(--yellow-bg); color: var(--yellow-text); }
.origin-assumption { background: var(--hover); color: var(--muted); border: 1px dashed var(--line-strong); }
.origin-missing { background: var(--yellow-bg); color: var(--yellow-text); }
.badge.warn-badge { background: var(--yellow-bg); color: var(--yellow-text); margin-left: 0; }
.badge.err-badge { background: var(--red-bg); color: var(--red-text); margin-left: 0; }
.ai-tour { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--white); box-shadow: var(--shadow); }
.ai-tour-head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; }
.ai-tour-head h3 { margin: 2px 0 0; font-size: 17px; }
.ai-kicker { font-size: 13px; font-weight: 700; color: var(--ink); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ai-money { text-align: right; }
.ai-money .num { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.ai-money .sub { font-size: 12.5px; }
.ai-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 6px 16px 10px; }
.ai-kpis div { display: flex; flex-direction: column; min-width: 0; }
.ai-kpis span { font-size: 12px; color: var(--muted); }
.ai-kpis b { font-size: 15px; }
.ai-drivers { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 10px; }
.ai-driver { border-top: 1px solid var(--line); padding-top: 8px; }
.ai-driver-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 14px; }
.ai-joblist { margin: 6px 0 0; padding-left: 20px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.ai-joblist.plain { list-style: none; padding-left: 0; }
.jl-route { font-weight: 650; display: block; }
.jl-meta { color: var(--muted); display: block; overflow-wrap: anywhere; }
.ai-handoffs { margin: 0 16px 10px; }
.ai-warn { margin: 0 0 10px; }
.ai-why { margin: 0 16px 10px; padding: 10px 12px; background: var(--hover); border-radius: 10px; font-size: 13.5px; }
.ai-block > .ai-why { margin: 0; }
.ai-why p { margin: 4px 0 0; }
.ai-why.hint { background: var(--hover); color: var(--ink); }
.ai-why.bad { background: var(--red-bg); color: var(--red-text); }
.ai-why.missing { background: var(--white); border: 1.5px dashed var(--red-line); }
.ai-why-head { font-weight: 650; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.ai-list { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; }
.ai-list li + li { margin-top: 3px; }
.ai-list.tight { padding-left: 16px; }
.ai-assume { margin: 0 16px 10px; font-size: 12.5px; color: var(--muted); }
.ai-block > .ai-assume { margin: 0; }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ai-tour > .ai-actions { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--subtle); }
.ai-tour > .ai-actions .primary { margin-left: auto; }
.ai-inline { margin: 0 16px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.ai-inline-wide { padding: 12px 16px; }
.ai-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.ai-details { padding: 0 16px 14px; }
.ai-details .plan { box-shadow: none; border-style: dashed; }
.ai-discarded { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px dashed var(--line-strong); border-radius: 14px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.ai-confirm { margin: 0 16px 14px; border: 2px solid var(--yellow-line); background: var(--yellow-bg); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-block > .ai-confirm, .ai-card .ai-confirm { margin: 4px 0 0; }
.ai-confirm-head { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.ai-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ai-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--white); display: flex; flex-direction: column; gap: 6px; font-size: 14px; min-width: 0; }
.ai-card-top { display: flex; justify-content: space-between; gap: 10px; }
.ai-card-top b { overflow-wrap: anywhere; }
.ai-compare { table-layout: fixed; }
.ai-compare th, .ai-compare td { padding: 8px; font-size: 13.5px; overflow-wrap: anywhere; }
.ai-compare td.k { color: var(--muted); }
.ai-question { padding: 12px; border: 1px solid var(--line); background: var(--hover); border-radius: 12px; }
.ai-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 9px 11px; border-radius: 10px; background: var(--hover); }
.ai-note-error { background: var(--red-bg); color: var(--red-text); }
.ai-note-missing, .ai-note-demo { background: var(--yellow-bg); color: var(--yellow-text); }
.ai-ctx-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }
.ai-ctx-box p { margin: 4px 0; }
.ai-ctx-box.warn { background: var(--yellow-bg); border-color: var(--yellow-line); color: var(--yellow-text); }
.ai-ctx-title { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.ai-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
.ai-dl dt { color: var(--muted); }
.ai-dl dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.ai-dl dd.ai-dl-full { grid-column: 1 / -1; text-align: left; margin-top: -2px; }
.ai-tabs .fab-dot { margin-left: 6px; vertical-align: middle; }
.ai-count { font-size: 11px; background: var(--ink); color: var(--white); border-radius: 999px; padding: 0 6px; margin-left: 6px; }
.kpi-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi-mini .kpi-tile { padding: 10px; }
.kpi-mini .kpi-value { font-size: 20px; }

@container (max-width: 1080px) {
  .ai-body { grid-template-columns: minmax(290px, 330px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "chat switch" "chat main"; }
  .ai-results, .ai-context { grid-area: main; }
  .ai-mid-switch { display: flex; gap: 4px; background: var(--hover); border-radius: 999px; padding: 3px; }
  .ai-mid-switch button { flex: 1; border: 0; background: none; min-height: 34px; padding: 4px 8px; color: var(--muted); }
  .ai-mid-switch button.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
  .mid-results .ai-context { display: none; }
  .mid-context .ai-results { display: none; }
}
@container (max-width: 700px) {
  .ai-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--hover); border-radius: 999px; padding: 3px; margin-bottom: 8px; flex: none; }
  .ai-tabs button { border: 0; background: none; min-height: 38px; padding: 6px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 4px; }
  .ai-tabs button.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
  .ai-body { display: flex; flex-direction: column; gap: 0; }
  .ai-mid-switch { display: none !important; }
  .ai-col { flex: 1; }
  .ai-body .ai-chat, .ai-body .ai-results, .ai-body .ai-context { display: none !important; }
  .ai-body.pane-chat .ai-chat, .ai-body.pane-results .ai-results, .ai-body.pane-context .ai-context { display: flex !important; }
  .ai-col-head { display: none; }
  .ai-scroll, .ai-chat-list { padding: 12px; }
  .ai-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-cards { grid-template-columns: 1fr; }
  .ai-tour-head { flex-wrap: wrap; }
  .ai-tour > .ai-actions .pill { flex: 1 1 auto; }
  .ai-tour > .ai-actions .primary { flex-basis: 100%; min-height: 44px; order: -1; margin-left: 0; }
  .ai-compare th, .ai-compare td { padding: 6px 4px; font-size: 12px; }
}
@container (max-width: 700px) { .ai-money { text-align: left; } }

/* --- Startseite (Dispositionszentrale) ------------------------------------------------------------ */

.ai-mark.small { width: 28px; height: 28px; border-radius: 9px; }

.ai-panel .ai-mark { background: var(--white); color: var(--brand-deep); }

/* Fahrer-Zeitleiste (Übersicht) */
.dtl { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.dtl-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 10px; }
.dtl-name { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtl-track { position: relative; height: 22px; background: var(--subtle); border-radius: 6px; }
.dtl-axis .dtl-track { height: 14px; background: none; }
.dtl-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.dtl-tick:first-child { transform: none; }
.dtl-tick.end { transform: translateX(-100%); }
.dtl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.dtl-free { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--green); font-weight: 650; }
.dtl-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; min-width: 3px; }
.dtl-seg:hover .dtl-bar { outline: 2px solid var(--black); outline-offset: 1px; }
.k-auftrag, .k-auftrag .dtl-bar { background: var(--brand-deep); }
.k-faehrt, .k-faehrt .dtl-bar { background: var(--muted); }
.k-mitfahrt, .k-mitfahrt .dtl-bar { background: var(--line-strong); }
.dtl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 2px; }
.dtl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 640px) {
  .dtl { padding: 8px; }
  .dtl-row { grid-template-columns: 64px minmax(0, 1fr); gap: 6px; }
  .dtl-name { font-size: 12.5px; }
}

/* ------------------------------------------------------------------
   Startseite (hm-): ruhig – eine Kopfzeile, eine Tagesauswahl, eine Inhaltskarte ohne verschachtelte Rahmen
   ------------------------------------------------------------------ */
.hm { display: flex; flex-direction: column; gap: 14px; max-width: 1180px; }
.hm-head h1 { font-size: 24px; margin: 0; }
.hm-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.hm-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; }
.hm-link:hover { text-decoration: underline; }
.hm-link:disabled { color: var(--muted); }
.hm-new { color: var(--green); font-weight: 650; text-decoration: none; }
.hm-new:hover { text-decoration: underline; }

/* Tagesauswahl: eine Leiste, drei Felder, gewählter Tag mit Strich unten */
.hm-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.hm-day { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 16px 9px; min-height: 0; border: 0; border-radius: 0;
  background: none; color: var(--muted); text-align: left; box-shadow: inset 0 -3px 0 transparent; }
.hm-day + .hm-day { border-left: 1px solid var(--line); }
.hm-day:hover { background: var(--hover); }
.hm-day.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--black); }
.hm-day-name { font-weight: 700; font-size: 14.5px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.hm-day-date { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.hm-day-sum { font-size: 13.5px; }
.hm-day-sum b { color: var(--ink); }
.hm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

/* Inhalt links, KI rechts */
.hm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.hm-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 4px 18px 8px; min-width: 0; }
.hm-section { padding: 14px 0 10px; }
.hm-section + .hm-section { border-top: 1px solid var(--line); }
.hm-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.hm-section-head h2 { font-size: 16px; margin: 0; }
.hm-count { font-weight: 500; font-size: 13.5px; color: var(--muted); margin-left: 4px; }
.hm-more { font-size: 13.5px; font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; }
.hm-more:hover { text-decoration: underline; }
.hm-empty { margin: 4px 0 6px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.hm-sub { color: var(--muted); font-size: 13px; }

/* Zu klären: eine kompakte Liste oben in der Karte */
.hm-alerts { margin: 12px 0 2px; display: flex; flex-direction: column; gap: 6px; }
.hm-alert-group { list-style: none; margin: 0; padding: 0 12px; border-radius: 10px; font-size: 13.5px; }
.hm-alert-group li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; }
.hm-alert-group li + li { border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 18%, transparent); }
.hm-alert-group svg { flex: none; margin-top: 1px; }
.hm-alert-group a { color: inherit; text-decoration: none; }
.hm-alert-group a:hover { text-decoration: underline; }
.hm-alert-group.tone-bad { background: var(--red-bg); color: var(--red-text); }
.hm-alert-group.tone-warn { background: var(--yellow-bg); color: var(--yellow-text); }
.hm-alert-group.tone-info { background: var(--hover); color: var(--muted); }

/* Touren: flache Zeilen mit Trennlinie, keine eigenen Kästen */
.hm-tours { list-style: none; margin: 0 0 10px; padding: 0; }
.hm-tour { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; color: inherit; text-decoration: none; }
.hm-tours li + li .hm-tour { border-top: 1px solid var(--line); }
.hm-tour:hover b { text-decoration: underline; }
.hm-tour-main { display: flex; flex-direction: column; min-width: 0; }
.hm-tour-side { display: flex; align-items: center; gap: 10px; flex: none; font-size: 14px; }

/* Offene Aufträge: eine Zeile je Auftrag */
.hm-jobs { list-style: none; margin: 0; padding: 0; }
.hm-jobs li + li { border-top: 1px solid var(--line); }
.hm-job { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 9px 4px; margin: 0 -4px;
  min-height: 0; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; font: inherit; }
.hm-job:hover { background: var(--hover); }
.hm-job-time { font-size: 13px; color: var(--muted); }
.hm-job-route { display: flex; flex-direction: column; min-width: 0; }
.hm-job-route b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-job-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-job-meta .hm-new { margin-right: 6px; }
.hm-job-price { font-weight: 700; font-size: 14.5px; }
.hm-narrow { display: none; }
@media (max-width: 640px) { .hm-narrow { display: inline; } }

/* Zeitleiste in der Karte ohne eigenen Rahmen */
.hm-card .dtl { border: 0; padding: 4px 0 0; }

/* KI-Einstieg: schmal, ohne Fülltext */
.hm-ai { background: var(--graphite); color: var(--white); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; }
.hm-ai :focus-visible { outline-color: var(--white); }
.hm-ai .ai-mark { background: var(--white); color: var(--brand-deep); }
.hm-ai-head { display: flex; align-items: center; gap: 8px; }
.hm-ai-head b { font-size: 15px; }
.hm-ai-open { margin-left: auto; color: var(--on-dark); font-size: 13px; font-weight: 600; text-decoration: none; }
.hm-ai-open:hover { text-decoration: underline; }
.hm-ask { display: flex; align-items: center; background: var(--white); border-radius: 999px; padding: 3px 3px 3px 14px; }
.hm-ask input { border: 0; min-height: 36px; padding: 6px 4px; background: transparent; font-size: 15px; min-width: 0; flex: 1; }
.hm-ask input:focus { outline: none; }
.hm-ask:focus-within { box-shadow: 0 0 0 2px var(--on-dark-muted); }
.hm-ask button { min-height: 36px; min-width: 36px; padding: 0; border: 0; background: var(--black); color: var(--white); flex: none; }
.hm-ask button:disabled { background: var(--line-strong); opacity: 1; color: var(--faint); }
.hm-ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hm-ai-actions .pill { background: var(--graphite-2); border-color: var(--on-dark-line); color: var(--white); }
.hm-ai-actions .pill:hover { border-color: var(--on-dark-muted); }

@media (max-width: 1100px) {
  .hm-grid { grid-template-columns: 1fr; }
  .hm-ai { position: static; }
}
@media (max-width: 640px) {
  .hm { gap: 12px; }
  .hm-head h1 { font-size: 21px; }
  .hm-day { padding: 8px 10px 7px; }
  .hm-day-value { display: none; }
  .hm-card { padding: 2px 14px 6px; border-radius: 14px; }
  .hm-job { grid-template-columns: minmax(0, 1fr) auto; }
  .hm-job-time { display: none; }
  .hm-day-date { display: none; }
  .hm-tour { flex-wrap: wrap; }
  .hm-ai-actions .pill { flex: 1 1 0; }
}
.dtl-now { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--red); z-index: 2; pointer-events: none; }
.dtl-now-label { position: absolute; top: -1px; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--red);
  background: var(--white); padding: 0 3px; border-radius: 4px; z-index: 2; }
.hm-job-price { display: flex; flex-direction: column; align-items: flex-end; }
.hm-job-rate { font-weight: 500; font-size: 12px; color: var(--muted); }
.hm-section-head h2 { margin-right: auto; }
.hm-sort { display: inline-flex; background: var(--hover); border-radius: 999px; padding: 2px; gap: 2px; }
.hm-sort button { border: 0; background: transparent; min-height: 26px; padding: 2px 10px; font-size: 12.5px; color: var(--muted); border-radius: 999px; }
.hm-sort button.on { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
@media (max-width: 640px) {
  .hm-section-head { flex-wrap: wrap; row-gap: 8px; }
  .hm-sort { order: 3; flex-basis: 100%; }
  .hm-sort button { flex: 1; }
}
.hm-jobs li { display: flex; align-items: center; gap: 6px; }
.hm-jobs li .hm-job { flex: 1; min-width: 0; }
.hm-jobs li.picked .hm-job { background: var(--hover); }
.hm-pick { display: flex; align-items: center; justify-content: center; width: 28px; height: 40px; flex: none; cursor: pointer; }
.hm-pick input { width: 17px; height: 17px; accent-color: var(--black); cursor: pointer; }
.hm-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; min-width: 0; }
.hm-side .hm-ai { position: static; }
.hm-ai-actions { display: grid; grid-template-columns: 1fr 1fr; }
.hm-team { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; }
.hm-team ul { list-style: none; margin: 0; padding: 0; }
.hm-team li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.hm-team li + li { border-top: 1px solid var(--line); }
.hm-team li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.hm-team-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bg); box-shadow: inset 0 0 0 2px var(--green); }
.hm-team-dot.busy { background: var(--brand-deep); box-shadow: none; }
.hm-loading { height: 64px; }
@media (max-width: 640px) { .hm-loading { height: 60px; } }
.hm-loading span { background: linear-gradient(90deg, var(--hover), var(--white), var(--hover)); background-size: 200% 100%; animation: hm-shimmer 1.2s infinite; }
.hm-loading span + span { border-left: 1px solid var(--line); }
@keyframes hm-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .hm-loading span { animation: none; } }
@media (max-width: 1100px) {
  .hm-side { position: static; }
  .hm-team { display: none; }   /* schmal: Zeitleiste und „N Fahrer verfügbar“ im Inhalt genügen */
}
@media (max-width: 640px) { .hm-wide { display: none; } }

/* --- Nutzer & Rollen ------------------------------------------------------------------------------ */
.user-perms { flex-direction: column; align-items: flex-start; gap: 6px; }
select.role-select { width: auto; min-width: 170px; min-height: 34px; padding: 4px 10px; font-size: 13.5px; font-weight: 600; }
.role-extra.compact { display: inline-flex; align-items: center; gap: 6px; }
.role-extra.compact select { width: auto; min-width: 170px; min-height: 34px; padding: 4px 10px; font-size: 13.5px; }
label.check.role-extra { font-size: 13px; color: var(--muted); }
.badge.role-admin { background: var(--black); color: var(--white); }
.badge.role-disponent { background: var(--blue-bg); color: var(--blue-text); }
.badge.role-fahrer { background: var(--green-bg); color: var(--green); }
.field.role-field { grid-column: 1 / -1; gap: 10px; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); font-weight: 600; }
.role-picker { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
button.role-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; white-space: normal; text-align: left;
  border-radius: var(--radius-s); padding: 10px 12px; min-height: 0; font-weight: 500; color: var(--ink); }
button.role-card b { font-size: 14.5px; }
button.role-card ul { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
button.role-card.on { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); background: var(--subtle); }

/* --- Fahrer-Ansicht „Meine Fahrten“ ---------------------------------------------------------------- */
.driver-shell main { max-width: calc(760px + var(--side)); }
@media (max-width: 1023px) { .driver-shell main { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); } }
.my-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.my-tour { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.my-tour.live { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.my-tour.done { background: var(--subtle); }
button.my-tour-head { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
button.my-tour-head:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.my-day { font-weight: 750; font-size: 17px; }
.my-span { font-weight: 600; font-variant-numeric: tabular-nums; flex: 1; }
.my-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.my-step { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.my-step-time { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: 14px; }
.my-step-time span { color: var(--muted); font-size: 13px; }
.my-step-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.my-step-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.my-kind { font-weight: 700; font-size: 14px; }
.k-job .my-kind { color: var(--brand-deep); }
.k-ride .my-kind { color: var(--muted); }
.my-vehicle { font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.my-route { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.my-route svg { margin-top: 3px; color: var(--muted); flex: none; }
a.my-place { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); font-size: 14px; min-width: 0; }
a.my-place b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a.my-place span { font-size: 12.5px; color: var(--muted); }
.my-note { font-size: 13px; background: var(--yellow-bg); color: var(--yellow-text); border-radius: 8px; padding: 6px 9px; }
button.my-action { align-self: stretch; min-height: 48px; font-size: 15px; margin-top: 4px; }
button.my-action.done-btn { background: var(--green); border-color: var(--green); }
.my-done-title { margin: 8px 0 10px; font-size: 15px; color: var(--muted); }

/* --- Abwesenheiten (Fahrerkarte) ------------------------------------------------------------------- */
.absence-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.absence { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; padding: 6px 6px 6px 10px; border-radius: var(--radius-s);
  background: var(--subtle); border: 1px solid var(--line); }
.absence b { font-weight: 650; }
.absence.r-urlaub { background: var(--blue-bg); border-color: transparent; color: var(--blue-text); }
.absence.r-krank { background: var(--red-bg); border-color: transparent; color: var(--red-text); }
.absence.now { box-shadow: inset 3px 0 0 currentColor; }
button.absence-x { margin-left: auto; min-height: 26px; width: 26px; padding: 0; border: 0; background: transparent; color: inherit; font-size: 18px; line-height: 1; }
button.absence-x:hover { background: var(--white); }
.absence-form { display: grid; grid-template-columns: 100px 1fr 1fr; gap: 6px; align-items: center; }
.absence-form select, .absence-form input { min-height: 36px; padding: 5px 8px; font-size: 14px; }
.absence-form .absence-hourly, .absence-form .absence-times { grid-column: 1 / -1; }
.absence-times { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.absence-times input { width: auto; flex: 0 0 auto; }
.absence-times .hint { flex-basis: 100%; }
.absence.r-termin { background: var(--yellow-bg); border-color: transparent; color: var(--yellow-text); }
.work-rules { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.work-rules > .check { align-items: flex-start; }
.work-rules > .check input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; }
.absence-actions { grid-column: 1 / -1; display: flex; gap: 6px; }
@media (max-width: 420px) { .absence-form { grid-template-columns: 1fr 1fr; } .absence-form select { grid-column: 1 / -1; } }
.badge.absent.r-urlaub { background: var(--blue-bg); color: var(--blue-text); }
.badge.absent.r-krank { background: var(--red-bg); color: var(--red-text); }
.driver-summary .away.r-urlaub { color: var(--blue-text); }
.driver-summary .away.r-krank { color: var(--red-text); }

/* --- Fahrer-Zugang an der Fahrerkarte ------------------------------------------------------------- */
.access-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.access-line svg { color: var(--green); }
.access-mail { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
a.access-manage { margin-left: auto; color: var(--muted); }
.access-box { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; font-size: 13.5px; background: var(--subtle); }
.access-box.ok { background: var(--green-bg); border-color: transparent; color: var(--green); }
.access-form { display: grid; gap: 6px; }
.access-form input { min-height: 36px; padding: 5px 9px; font-size: 14px; }
.access-actions { display: flex; gap: 6px; flex-wrap: wrap; }
pre.access-creds { margin: 0; padding: 8px 10px; background: var(--white); color: var(--ink); border-radius: 8px; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* --- Übergabeprotokolle --------------------------------------------------------------------------- */
.protocol-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.protocol-buttons .pill.done { background: var(--green-bg); border-color: transparent; color: var(--green); }
.protocol-form { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px; margin-top: 6px; background: var(--subtle); }
.protocol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.protocol-form textarea { min-height: 0; resize: vertical; }
.protocol-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.protocol-actions button.primary { flex: 1; min-height: 46px; }
.photo-row { display: flex; gap: 6px; flex-wrap: wrap; }
.photo-thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--hover); flex: none; display: block; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; border-radius: 50%;
  background: var(--overlay); color: var(--white); font-size: 16px; line-height: 1; }
label.photo-add { width: 72px; height: 72px; border: 1.5px dashed var(--line-strong); border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 12.5px; color: var(--muted); cursor: pointer; background: var(--white); }
label.photo-add span { font-size: 22px; line-height: 1; }
label.photo-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.photo-add:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.protocols { margin-bottom: 14px; }
.protocols h3 { font-size: 15px; margin: 0 0 8px; }
.protocol-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.protocol { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: var(--white); }
.protocol-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.protocol-when { margin-left: auto; }
.protocol-facts { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13.5px; }
.protocol-facts .ok { color: var(--green); font-weight: 600; }
.protocol-facts .bad { color: var(--red-text); font-weight: 600; }
.protocol-notes { margin: 0; font-size: 13.5px; color: var(--muted); }
.protocol-form div.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* --- Fahrer hinzufügen (Formular im Raster) ------------------------------------------------------- */
.add-card.form { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; padding: 14px;
  border-style: solid; border-color: var(--line-strong); background: var(--white); font-size: 14px; text-align: left; }
.add-card.form > b { font-size: 16px; }
a.user-schedule { color: var(--muted); }

/* --- Bedienbarkeits-Durchgang ---------------------------------------------------------------------- */
.hm-team li.away b { color: var(--muted); font-weight: 600; }
.hm-team-dot.off { background: transparent; border: 1.5px dashed var(--faint); box-shadow: none; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 96px; }
button.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); min-height: 32px; padding: 4px 10px; font-size: 13px;
  border: 0; background: var(--hover); color: var(--ink); }
.login-help { text-align: center; margin: 0; }
/* Aufträge: Tagesüberschrift mit Abstand, bleibt beim Scrollen stehen */
h2.day-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; position: sticky; top: 0; z-index: 6;
  background: var(--canvas); margin: 0 0 10px; padding: 10px 0 8px; }
h2.day-title .sub { font-size: 13.5px; font-weight: 600; }
@media (max-width: 1023px) { h2.day-title { top: calc(var(--mobilebar) + env(safe-area-inset-top, 0px)); } }
.notice.dismissable { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
@media (max-width: 640px) { .notice.dismissable { flex-direction: column; align-items: flex-start; } }
/* Team: Wochenstreifen (zugeklappter Wochenplan) und Sprungmarken */
.week-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.week-strip li { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px; border-radius: 8px; font-size: 11.5px;
  font-variant-numeric: tabular-nums; background: var(--hover); color: var(--ink); min-width: 0; }
.week-strip li b { font-size: 12px; }
.week-strip li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.week-strip li.on { background: var(--black); color: var(--white); }
.week-strip li.off { background: var(--subtle); color: var(--faint); border: 1px dashed var(--line-strong); }
.week-strip li.today { box-shadow: 0 0 0 2px var(--brand); }
.jump-nav { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; margin: 0; }
.jump-nav a { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 5px 11px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); }
.jump-nav a:hover { color: var(--ink); border-color: var(--ink); }
.jump-nav a.on { background: var(--black); border-color: var(--black); color: var(--white); }
.sticky-head:has(.jump-nav) { flex-wrap: wrap; row-gap: 12px; }
@media (max-width: 1023px) {
  .sticky-head:has(.jump-nav) { flex-wrap: wrap; row-gap: 8px; }
  .jump-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .jump-nav::-webkit-scrollbar { display: none; }
  .jump-nav a { flex: none; }
}
/* Sprungziele nicht unter der mitlaufenden Kopfzeile verstecken */
.section[id] { scroll-margin-top: 170px; }
@media (max-width: 1023px) { .section[id] { scroll-margin-top: calc(var(--mobilebar) + 120px); } }
.hm-sub.conflict { color: var(--red-text); font-weight: 650; }
.list-more { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 18px 0 8px; }

/* Aufträge von Hand erfassen und importieren */
.sheet.wide-sheet { width: min(760px, 100%); }
.mj-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mj-group legend { font-weight: 650; font-size: 14px; margin-bottom: 6px; padding: 0; }
.sheet-foot .submit-hint { flex-basis: 100%; font-size: 13px; }
.import-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.import-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.import-pick input[type="file"] { width: auto; max-width: 100%; }
.import-result { display: flex; flex-direction: column; gap: 10px; }
.import-errors { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--red-text); display: flex; flex-direction: column; gap: 4px; }
.import-table { font-size: 13.5px; }

/* Benachrichtigungen */
.notify-card h2 { display: flex; align-items: center; gap: 8px; }
.notify-count { background: var(--red-bg); color: var(--red-text); }
.notify-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.notify-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--radius-s); border: 1px solid var(--line); font-size: 14px; }
.notify-list li.unread { border-color: var(--brand-deep); box-shadow: inset 3px 0 0 var(--brand-deep); }
.notify-ways { display: flex; flex-direction: column; gap: 12px; }
.notify-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.notify-toggle { align-items: flex-start; margin-top: 12px; }
.notify-toggle input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; }
.driver-notify { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
