:root {
  --bg: #f4f7fb;
  --bg-accent: #e8f0f8;
  --surface: #ffffff;
  --ink: #1e2a3a;
  --muted: #5f738a;
  --line: #d5e2ef;
  --brand: #4a7eb5;
  --brand-soft: #dceaf7;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --danger: #b42318;
  --ok: #3d7a9e;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(30, 42, 58, 0.06);
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9e8f6 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #eef3fa 0%, transparent 50%),
    var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 1.5rem 1.1rem;
  background: linear-gradient(180deg, #5b8fc4 0%, #7aabdb 100%);
  color: #f7fbff;
}

.brand {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 0.25rem;
}

.brand-sub {
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav a {
  color: #f0f7fc;
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-weight: 500;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.14);
  text-decoration: none;
}

.main {
  padding: 1.5rem 1.75rem 2.5rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-head h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.8rem;
  margin: 0;
}

.page-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
}

.btn:hover { filter: brightness(1.05); }
.btn-ghost {
  background: var(--brand-soft);
  color: var(--brand);
}
.btn-danger {
  background: #fde8e6;
  color: var(--danger);
}
.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}
.flash.ok { background: #e8f2fa; color: var(--ok); }
.flash.error { background: #fde8e6; color: var(--danger); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.form-grid .full { grid-column: 1 / -1; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="time"],
input[type="date"],
select,
textarea {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: #fff;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.disp-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.2fr);
  gap: 1rem;
  align-items: start;
}

.disp-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.disp-section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
}

.stop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.stop-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: var(--bg-accent);
}

.stop-card-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: baseline;
  margin-bottom: 0.55rem;
}

.stop-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-start;
}

.inline-form {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.mini-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.new-tour-details summary {
  list-style: none;
  cursor: pointer;
}
.new-tour-details summary::-webkit-details-marker { display: none; }

/* Panel, das zugeklappt nur eine Zeile ist – für Ansichten, die man bei Bedarf
   öffnet und die nicht wie eine offene Aufgabe aussehen sollen. */
.panel-fold > summary {
  cursor: pointer;
  font-weight: 600;
}

.panel-sub {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}
.panel-sub summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}

.tour-panel.tour-focus {
  outline: 2px solid var(--brand-soft);
}
.tour-panel.tour-warn {
  border-color: #f0b4ae;
}

.tour-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.tour-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
}

.cap-stats {
  display: flex;
  gap: 1rem;
}
.cap-stats span {
  display: block;
  font-size: 0.75rem;
}
.cap-stats strong {
  font-family: var(--display);
  font-size: 1.15rem;
}

.text-danger { color: var(--danger); }

/* Fahrerwechsel an der Tour: eine Zeile, die aussieht wie eine Auswahl und keine ist –
   jeder Name ist ein Absenden. Der eingeteilte Fahrer steht vorn und ist nicht anklickbar,
   damit der Klick nie „nichts tun“ bedeutet. */
.driver-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.6rem;
}

.driver-pick-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.driver-chip {
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.driver-chip:hover,
.driver-chip:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.driver-chip.is-now {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  cursor: default;
}
.driver-chip.is-now .muted { font-size: 0.78rem; }

/* Frei, aber es gibt etwas zu wissen – der Punkt lädt zum Zeigen ein, ohne zu warnen. */
.driver-chip.has-note { border-style: dashed; }

.driver-clash {
  font-size: 0.82rem;
  color: var(--warn);
  font-weight: 600;
}

.crew2-input {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  min-width: 12rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

/* „Wer fährt heute“ – dieselben Kacheln, aber als Vorentscheidung vor dem Vorschlag. */
.crew-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
}
.crew-list form { display: inline-flex; }
.crew-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}
.crew-chip.is-set { border-color: var(--brand); }
.crew-chip.is-off { background: var(--bg-accent); color: var(--muted); }
.crew-chip.is-off .crew-name { text-decoration: line-through; }
.crew-chip em { font-style: normal; font-size: 0.75rem; color: var(--muted); }

/* Eigene Zeile unter den Kacheln: die Gründe sind Sätze, in einer Kachelreihe wären sie
   ein Textbrocken zwischen Knöpfen. */
.driver-taken {
  flex: 1 1 100%;
  font-size: 0.82rem;
  color: var(--muted);
}

.driver-link {
  font: inherit;
  border: 0;
  padding: 0;
  background: none;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline dotted;
}
.driver-link:hover { text-decoration: underline; }

/* Alt/Neu-Vergleich in der Sync-Freigabe */
table.data table.diff {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  background: var(--bg-accent);
}

table.data table.diff th,
table.data table.diff td {
  padding: 0.35rem 0.5rem;
}

table.diff tr:last-child td {
  border-bottom: none;
}

.diff-old {
  color: var(--muted);
  text-decoration: line-through;
}

.diff-new {
  font-weight: 600;
}

.diff-items {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}

.depot-line {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.5rem 0;
}

/* Kalender-Vorlage: die Felder stehen nebeneinander wie im Google-Formular, damit beim
   Abschreiben klar ist, was wohin gehört. */
.export-block + .export-block {
  margin-top: 0.75rem;
}

.export-fields {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.2rem 0.75rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}
.export-fields dt {
  color: var(--muted);
}
.export-fields dd {
  margin: 0;
  word-break: break-word;
}

.export-text {
  background: var(--bg-accent);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
}

@media (max-width: 700px) {
  .export-fields {
    grid-template-columns: 1fr;
  }
  .export-fields dd {
    margin-bottom: 0.4rem;
  }
}

.timeline-meta {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
}

.timeline-line {
  font-size: 0.9rem;
  margin: 0.15rem 0 0.1rem;
}

/* Notiz aus dem Kalender bzw. Lieferhinweis: soll ins Auge fallen, ohne wie ein Fehler zu wirken */
.stop-note {
  flex-basis: 100%;
  font-size: 0.85rem;
  line-height: 1.35;
  margin: 0.3rem 0 0;
  padding: 0.3rem 0.5rem;
  border-left: 3px solid var(--warn);
  background: var(--warn-bg);
  border-radius: 0 4px 4px 0;
}

.tour-stops > li.stop-late {
  outline: 1px solid var(--danger);
}

.tour-stops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tour-stops > li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.55rem 0.65rem;
  background: var(--bg-accent);
  border-radius: 8px;
}

.tour-stop-body strong { margin-right: 0.15rem; }

/* Fahrplan einer Tour: eine Zeile je Abschnitt, von oben nach unten wie der Tag verläuft.
   Fahrten und Lagerzeiten treten zurück, die Kunden treten hervor – man soll die Stops beim
   Überfliegen zählen können, ohne zu lesen. */
.tour-plan {
  width: 100%;
  border-collapse: collapse;
  margin: 0.25rem 0 0.5rem;
}

.tour-plan td {
  padding: 0.3rem 0.5rem;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.tour-plan tr:last-child td { border-bottom: 0; }

.sched-time {
  width: 6.5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sched-time .muted { display: block; font-size: 0.8rem; }

.sched-dur {
  width: 7rem;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sched-dur .muted { display: block; font-size: 0.78rem; }

.sched-act { width: 1%; white-space: nowrap; }
.sched-act .inline-form { display: inline; }
.sched-act .stop-move-tour select {
  max-width: 9.5rem;
  font-size: 0.8rem;
  vertical-align: middle;
}

.tour-plan .sched-drive td,
.tour-plan .sched-back td,
.tour-plan .sched-load td,
.tour-plan .sched-unload td,
.tour-plan .sched-wait td {
  color: var(--muted);
  font-size: 0.88rem;
}

.tour-plan .sched-wait td { background: var(--warn-bg); color: var(--warn); }

.tour-plan .sched-stop td {
  background: var(--bg-accent);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.tour-plan .sched-stop.stop-late td { box-shadow: inset 2px 0 0 var(--danger); }

.tour-plan .sched-home td {
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
}

.sched-sum {
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}

/* Tagesübersicht: alle Fahrzeuge auf einer Zeitachse, wie im Google-Kalender.
   Beantwortet die Frage, die eine Tabelle nicht beantwortet – ist der Tag voll? */
.daybar { margin-top: 0.5rem; }

.daybar-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.daybar-name {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --hour setzt die Seite: wie breit eine Stunde auf dieser Achse ist. Die Achse spannt nur so
   weit, wie an dem Tag gefahren wird, deshalb kann das nicht im Stylesheet stehen. */
.daybar-track {
  position: relative;
  height: calc(var(--lanes, 1) * 1.7rem + 0.2rem);
  border-radius: 6px;
  background:
    repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px var(--hour, 8.3333%)),
    var(--bg-accent);
}

.daybar-axis .daybar-track {
  height: 1.1rem;
  background: none;
}

.daybar-hour {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.daybar-bar {
  position: absolute;
  top: calc(var(--lane, 0) * 1.7rem + 3px);
  height: 1.5rem;
  border-radius: 5px;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  line-height: 1.5rem;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
}

.daybar-bar.is-tour { background: var(--brand); }
.daybar-bar.is-block { background: #8ba3bb; }
.daybar-bar.is-plan {
  background: repeating-linear-gradient(45deg, #cfe0f1 0 6px, #e6eff8 6px 12px);
  border: 1px dashed var(--brand);
  color: var(--ink);
}

.daybar-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.85);
}
.daybar-bar.is-plan .daybar-mark { background: var(--brand); }

/* Auf-/Abbau: eigene Farbe, weil es die Fahrt von einer halben Stunde zu einem halben Tag macht. */
.badge-setup {
  background: #fdf0d5;
  border-color: #e8c98a;
  color: #7a5a12;
}

/* Jobnummer als Link: erkennbar, aber ohne die Zeile blau zu zerreißen. */
.job-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}
.job-link:hover,
.job-link:focus {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.daybar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.7rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}
.daybar-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  color: var(--muted);
}
.daybar-key input { margin: 0; }
.daybar-key:has(input:checked) { color: var(--ink); }
.daybar-swatch {
  width: 1.6rem;
  height: 0.75rem;
  border-radius: 3px;
  background: var(--line);
}
.daybar-swatch.is-tour { background: var(--brand); }
.daybar-swatch.is-block { background: #8ba3bb; }
.daybar-swatch.is-plan {
  background: repeating-linear-gradient(45deg, #cfe0f1 0 6px, #e6eff8 6px 12px);
  border: 1px dashed var(--brand);
}

@media (max-width: 900px) {
  .daybar-row { grid-template-columns: 4.5rem 1fr; }
  .daybar-text { display: none; }
}

.tour-edit {
  margin-top: 0.85rem;
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
}
.tour-edit summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand-soft);
  border-color: var(--brand);
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.4rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.off {
  background: #eee;
  color: #777;
}

/* Was die Planung verhindert, nicht nur einfärbt: eine fehlende Adresse ist kein Hinweis. */
.badge.bad {
  background: #fde8e6;
  color: var(--danger);
}

.hours-row {
  display: grid;
  grid-template-columns: 2rem 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.4rem;
}

.muted { color: var(--muted); }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Kachelreihe: so viele Zahlen wie nötig, mindestens 9rem breit – drei feste Spalten hätten die
   vierte Zahl in eine zweite, halb leere Reihe geschoben. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
}

.stat {
  background: var(--bg-accent);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

/* Zahlen, die weiterführen: als Kachel gleich aussehend, aber anklickbar. */
a.stat {
  color: inherit;
  text-decoration: none;
  display: block;
}
a.stat:hover { background: var(--brand-soft); }

.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 1.6rem;
  margin-top: 0.2rem;
}

/* Vorbereiten: eine Zeile je Fahrt, das Nachtragbare direkt in der Zeile. Eng gesetzt, weil eine
   Woche auf einen Blick passen muss – wer scrollt, vergleicht nicht mehr. */
.prep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.prep-table th,
.prep-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.prep-table thead th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.prep-table .num,
.prep-table th.num { text-align: right; }

.prep-day th {
  background: var(--bg-accent);
  font-family: var(--display);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  padding-top: 0.6rem;
}
.prep-day a { margin-left: 0.6rem; font-size: 0.82rem; }

.prep-sub { font-size: 0.8rem; margin-top: 0.15rem; }
.prep-win { white-space: nowrap; font-variant-numeric: tabular-nums; }
.prep-win .muted { font-size: 0.78rem; }
.prep-gaps { font-size: 0.82rem; max-width: 22rem; }
.prep-ready { text-align: center; width: 1%; white-space: nowrap; }
.prep-all { display: inline-flex; flex-direction: row; gap: 0.25rem; font-size: 0.72rem; }

/* Freigegebene Zeilen treten zurück: die Seite soll kürzer wirken, je weiter man kommt. */
.prep-row.is-ready td,
.prep-row.is-disposed td { background: color-mix(in srgb, var(--bg-accent) 55%, transparent); }
.prep-row.is-ready .prep-sub,
.prep-row.is-disposed .prep-sub { display: none; }
.prep-row.is-stale td { box-shadow: inset 2px 0 0 var(--danger); }

.prep-in {
  width: 5.5rem;
  padding: 0.25rem 0.35rem;
  font-size: 0.9rem;
  text-align: right;
}
.prep-in-sm { width: 4.25rem; }
.prep-in.is-saving { outline: 1px solid var(--muted); }
.prep-in.is-saved { outline: 1px solid color-mix(in srgb, var(--ok, #2f6f4e) 70%, transparent); }
.prep-in.is-error { outline: 1px solid var(--danger); }

/* „auch für AB 12.09.“ unter dem Lademeter: klein, aber es verhindert die Suche nach dem
   zweiten Feld, das es nicht gibt. */
.prep-also {
  font-size: 0.72rem;
  white-space: nowrap;
  margin-top: 0.1rem;
}

.prep-more {
  background: none;
  border: 0;
  padding: 0 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline dotted;
}
.prep-more:hover { color: var(--brand); }

/* Materialliste: mehrspaltig, weil zwanzig Posten sonst die halbe Seite hoch sind und die
   Eingabefelder darunter aus dem Blick schieben. */
.prep-material { margin: 0 0 0.85rem; }
.prep-material .muted { font-size: 0.82rem; margin-left: 0.4rem; }

.prep-items {
  columns: 3 14rem;
  column-gap: 1.5rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}
.prep-items li {
  break-inside: avoid;
  padding: 0.05rem 0;
}
.prep-qty {
  display: inline-block;
  min-width: 2.4rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.prep-items .badge { font-size: 0.68rem; }

.prep-detail > td { background: var(--bg-accent); }
.prep-detail .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.prep-detail .prep-addr-grid {
  grid-template-columns: minmax(10rem, 2.2fr) 5.5rem minmax(7rem, 1.2fr) minmax(7rem, 1fr);
  gap: 0.5rem 0.65rem;
  align-items: end;
}
.prep-detail .prep-zip input {
  width: 100%;
  max-width: 5.5rem;
  font-variant-numeric: tabular-nums;
}
.prep-detail .prep-window input { max-width: 8rem; }
.prep-detail .prep-note { margin-top: 0.6rem; }
.prep-dwell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: end;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}
.prep-dwell strong { font-size: 0.88rem; }
.prep-dwell .muted { font-size: 0.82rem; flex: 1 1 12rem; }
.prep-dwell-input { margin: 0; font-size: 0.82rem; }
.prep-dwell-input input { display: block; margin-top: 0.2rem; }
/* Drei Zahlen brauchen keine drei halben Seiten. Das Feld ist so breit wie die Zahl, und unter
   jedem steht dieselbe Art Angabe: welche Zahl gilt und woher sie kommt. Feste Spalten, damit
   nicht ein längerer Hinweis das dritte Feld in die nächste Zeile schiebt. */
.job-minutes {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}
.job-minutes-head { margin: 0 0 0.5rem; font-size: 0.88rem; font-weight: 600; }
.job-minutes-head .muted { font-weight: 400; font-size: 0.8rem; }
.job-minutes-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  align-items: start;
}
.job-minutes-row label { margin: 0; gap: 0.2rem; font-size: 0.82rem; }
.job-minutes-row input {
  width: 5rem;
  padding: 0.3rem 0.45rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.job-minutes-row small { font-weight: 400; font-size: 0.78rem; color: var(--muted); }
/* Das Ergebnis als zwei Zeilen mit gleicher Kante – die Frage lautet „hin oder zurück?“, und
   eine Antwort im Fließtext beantwortet sie nicht. */
.job-minutes-out {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
  font-size: 0.85rem;
}
.job-minutes-out dt { font-weight: 600; }
.job-minutes-out dd { margin: 0; }

.prep-title { margin: 0 0 0.6rem; font-size: 0.85rem; }
.prep-hints { margin: 0.6rem 0 0; font-size: 0.82rem; }
.prep-choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
}
.prep-choice legend { font-size: 0.82rem; color: var(--warn); padding: 0 0.3rem; }
.prep-choice label { flex-direction: row; align-items: center; gap: 0.35rem; font-weight: 400; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 1rem; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .grid-2, .form-grid, .stat-row, .disp-grid { grid-template-columns: 1fr; }
  .prep-detail .form-grid,
  .prep-detail .prep-addr-grid { grid-template-columns: 1fr; }
  .job-minutes-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prep-detail .prep-zip input { max-width: none; }
  .tour-stops > li { grid-template-columns: auto 1fr; }
  .tour-stops .actions { grid-column: 1 / -1; }
}

.plan-tour-tweak {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: end;
  margin: 0.55rem 0 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-accent) 55%, transparent);
}
.plan-tour-tweak label {
  margin: 0;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.plan-tour-tweak select,
.plan-tour-tweak input[type="time"] {
  min-width: 9rem;
}
.plan-tour-tweak-reset {
  margin: 0 0 0.75rem 0.15rem;
}
.plan-tour-tweaked {
  outline: 1px solid color-mix(in srgb, var(--accent, #3a6) 45%, var(--line));
}
.plan-tour-bad {
  outline: 1px solid color-mix(in srgb, #b44 55%, var(--line));
}
.pack-head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pack-pin-form { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: end; }
.pack-pin-form input[type="password"] { min-width: 8rem; }
.pack-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.75rem 0 1rem; }
.pack-create-plan { grid-template-columns: 2fr 1fr auto; }
.pack-status-draft { background: #e8e4dc; }
.pack-status-packing { background: #d9e6ef; }
.pack-status-packed { background: #d7e8d4; }
.pack-status-loaded { background: #c9ddd0; }
.pack-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 1rem;
  align-items: start;
}
.pack-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 1rem;
}
.pack-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.pack-demand { list-style: none; padding: 0; margin: 0; }
.pack-demand li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.pack-demand li.pack-done { opacity: 0.55; }
.pack-unit {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  background: #fff;
}
.pack-unit-nested { margin-left: 1rem; border-style: dashed; }
.pack-unit header { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: baseline; }
.pack-unit-items { list-style: none; padding: 0.35rem 0 0; margin: 0; font-size: 0.88rem; }
.pack-unit-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.pack-stage {
  display: block;
  background: #e8e4dc;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.pack-stage-floor { fill: #ddd7cb; }
.pack-stage-unit { fill: #3d6e8c; fill-opacity: 0.85; stroke: #1f3d4f; stroke-width: 1; }
.pack-stage-label { fill: #fff; font-size: 11px; font-family: inherit; }
@media (max-width: 1100px) {
  .pack-grid { grid-template-columns: 1fr; }
}
