:root {
  --bg: #f4f7fb;
  --bg-accent: #e8f0f8;
  --surface: #ffffff;
  --ink: #1e2a3a;
  --muted: #5f738a;
  --placeholder: #b0becc;
  --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;
}
.btn .muted {
  color: inherit;
  opacity: 0.78;
  font-weight: 500;
}

.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); }

.job-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.75rem;
}

.job-photo {
  display: block;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.job-photo:hover {
  text-decoration: none;
  filter: brightness(1.02);
}

.job-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-accent);
}

.job-photo span {
  display: block;
  padding: 0.55rem 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.job-photo strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}

.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;
}

/* Platzhalter sollen Hinweise bleiben, keine ausgefüllten Werte vortäuschen. */
::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
::-webkit-input-placeholder { color: var(--placeholder); opacity: 1; }
::-moz-placeholder { color: var(--placeholder); opacity: 1; }
:-ms-input-placeholder { color: var(--placeholder); opacity: 1; }

.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-trend {
  display: inline-block;
  margin-right: 0.25rem;
  font-weight: 700;
}

.diff-up {
  color: var(--warn);
}

.diff-down {
  color: var(--ok);
}

.diff-delta {
  font-weight: 600;
  margin-left: 0.35rem;
  white-space: nowrap;
}

.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;
}
.sched-act .stop-split {
  display: inline-block;
  vertical-align: middle;
  max-width: 14rem;
}
.sched-act .stop-split > summary {
  list-style: none;
  cursor: pointer;
}
.sched-act .stop-split-form {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-accent);
  white-space: normal;
}
.sched-act .stop-split-form label {
  display: grid;
  gap: 0.1rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.sched-act .stop-role select {
  max-width: 8.5rem;
  font-size: 0.78rem;
  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;
  line-height: 1.2;
}

.daybar-revenue {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ok, #3d7a9e);
  margin-top: 0.1rem;
}

.deck.is-show-revenue .daybar-revenue {
  display: block;
}

.deck.is-show-revenue .daybar-name {
  white-space: normal;
}

/* --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; }
/* Flex auf td zerstört table-cell (Rahmen/Ausrichtung springen). */
td.actions {
  display: table-cell;
  vertical-align: middle;
  white-space: nowrap;
  width: 1%;
}

/* 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); }
a.stat.is-active {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 55%, var(--line));
}

.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-mail {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.prep-mail:hover {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}
.prep-mail svg { flex: 0 0 auto; }
.prep-mail.is-sent { color: var(--ok); }
.prep-mail-sent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.95rem;
  height: 0.95rem;
  margin-left: 0.05rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 18%, #fff);
  color: var(--ok);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.bb-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(36rem, calc(100vw - 2rem));
  width: 100%;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.bb-dialog::backdrop {
  background: rgba(30, 42, 58, 0.35);
}
.bb-dialog-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.2rem 1.2rem;
}
.bb-dialog-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
}
.bb-dialog-card label { margin: 0; }
.bb-dialog-card textarea {
  min-height: 12rem;
  resize: vertical;
  font-family: var(--font);
  line-height: 1.4;
}
.job-excl-dialog { max-width: min(42rem, calc(100vw - 2rem)); }
.job-excl-open {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.job-excl-open:hover { color: var(--ink); }
.job-excl-facts {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.job-excl-h {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.job-excl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 38vh;
  overflow-y: auto;
}
.job-excl-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  flex-wrap: wrap;
}
.job-excl-list code { margin-left: 0.3rem; font-size: 0.8em; color: var(--muted); }
.job-excl-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}
.job-excl-qty {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.job-excl-qty input {
  width: 4.4rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.calendar-write-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.calendar-write-mark {
  display: grid;
  place-items: center;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--warn-bg);
  color: var(--ink);
  font-weight: 800;
}
.calendar-write-dialog.is-success .calendar-write-mark {
  background: color-mix(in srgb, var(--ok) 18%, #fff);
  color: var(--ok);
}
.calendar-write-dialog.is-error .calendar-write-mark {
  background: color-mix(in srgb, var(--danger) 14%, #fff);
  color: var(--danger);
}
.calendar-write-tours {
  display: grid;
  gap: 0.4rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  max-height: min(48vh, 24rem);
  overflow: auto;
}
.calendar-write-tours > li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
}
.calendar-write-tours > li.is-error { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.calendar-write-tour-head { font-weight: 650; }
.calendar-write-detail { display: block; margin-left: 1.2rem; font-size: 0.86rem; }
.calendar-write-warning { color: var(--warn-ink, #795700); }
.calendar-write-blocks {
  padding: 0.45rem 0.55rem;
  border-radius: 0.4rem;
  background: var(--bg-accent);
  font-size: 0.86rem;
}
.cross-day-list { list-style: none; padding-left: 0; }
.cross-day-bundle {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cross-day-bundle.is-reciprocal {
  margin: 0.55rem 0;
  padding: 0.45rem 0.65rem 0.35rem;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-left: 3px solid var(--brand);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--brand) 5%, #fff);
}
.cross-day-bundle-note {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.cross-day-bundle.is-reciprocal .cross-day-item + .cross-day-item {
  border-top: 1px dashed color-mix(in srgb, var(--brand) 22%, var(--line));
  margin-top: 0.2rem;
  padding-top: 0.45rem;
}
.cross-day-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.35rem 0;
}
.cross-day-copy,
.cross-day-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.cross-day-copy { flex: 1 1 36rem; }
.cross-day-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  width: 100%;
  font-size: 0.95rem;
}
.cross-day-leg {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}
.cross-day-with {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: lowercase;
}
.cross-day-actions { flex: 0 0 auto; gap: 0.25rem; }
.cross-day-actions form { margin: 0; }
.cross-day-shift { white-space: nowrap; }
.cross-day-accepted {
  background: color-mix(in srgb, var(--ok) 18%, #fff);
  color: var(--ok);
}
.cross-day-places {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: var(--bg-accent);
  white-space: nowrap;
  font-size: 0.84rem;
}
.cross-day-pair-km {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cross-day-pair-km::before {
  content: '·';
  margin-right: 0.28rem;
  color: var(--muted);
}
.cross-day-map-dialog {
  width: min(88rem, calc(100vw - 1rem));
  max-width: min(88rem, calc(100vw - 1rem));
}
.cross-day-map-dialog .bb-dialog-card { padding: 0.9rem; }
.cross-day-map {
  width: 100%;
  height: min(78vh, 54rem);
  min-height: 32rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--bg-accent);
}
.cross-day-map .leaflet-tooltip {
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 650;
}
.cross-day-map .leaflet-popup-content {
  margin: 0.7rem 1.8rem 0.7rem 0.8rem;
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 650;
}
@media (max-width: 760px) {
  .cross-day-item { align-items: flex-start; flex-direction: column; }
  .cross-day-places { align-items: flex-start; flex-wrap: wrap; white-space: normal; }
  .cross-day-map { min-height: 22rem; height: 72vh; }
}
.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; }
.prep-done-toggle { margin: 0.45rem 0 0; font-size: 0.88rem; }
.job-prepare { margin-top: 1rem; }
.job-prepare-hints { margin-top: 0.35rem; font-size: 0.85rem; }
.job-prepare-hints > div + div { margin-top: 0.15rem; }
.job-prepare-hints .prep-choice {
  margin: 0.45rem 0 0;
  padding: 0.4rem 0.6rem;
}
#job-transport { scroll-margin-top: 1.25rem; }
#job-transport.is-review {
  box-shadow: inset 3px 0 0 var(--warn, #c48a00);
}

/* 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,
.prep-row.is-blocking td,
.prep-row.is-finding td { box-shadow: inset 2px 0 0 var(--danger); }
.prep-row.is-finding td { background: color-mix(in srgb, var(--warn-bg) 70%, transparent); }

.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-Detail: weniger Luft, damit Adresse/Transport/Disposition ohne Scrollen greifbar sind. */
.job-abgleich .job-related {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.job-abgleich .job-related li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.55rem;
  font-size: 0.9rem;
}
.prep-successor {
  font-weight: 600;
  white-space: nowrap;
}
.job-detail-head {
  align-items: center;
  margin-bottom: 0.85rem;
}
.job-head-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  min-width: 0;
}
.job-head-line h1 {
  font-size: 1.45rem;
  line-height: 1.15;
}
.job-head-meta {
  color: var(--muted);
  font-size: 0.92rem;
}
.job-head-sync {
  color: var(--placeholder);
  font-size: 0.8rem;
  white-space: nowrap;
}
.job-stack .panel {
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
}
.job-stack .panel > h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}
.job-addr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 0.35rem 1.1rem;
  font-size: 0.92rem;
}
.job-addr p { margin: 0.15rem 0; }
.job-addr .job-addr-block { margin: 0; line-height: 1.35; }
.job-addr .muted { margin-top: 0.2rem; }
.job-mv-rows {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.job-mv-row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 0.7fr) minmax(8rem, 1.1fr) minmax(12rem, 1.35fr) 3.4rem auto;
  gap: 0.4rem 0.65rem;
  align-items: end;
}
.job-mv-row > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 0.45rem;
}
.job-mv-row label { margin: 0; gap: 0.2rem; font-size: 0.78rem; }
.job-mv-row input[type="number"] {
  width: 3.2rem;
  padding: 0.4rem 0.35rem;
  text-align: center;
}
.job-mv-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  padding-bottom: 0.4rem;
  white-space: nowrap;
}
.job-mv-check input { margin: 0; }
.job-window-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(5.2rem, 1fr));
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.job-window-fields legend {
  padding: 0;
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  color: var(--ink);
}
.job-window-fields label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
}
.job-window-fields input[type="time"] {
  min-width: 0;
  padding: 0.38rem 0.35rem;
  font-variant-numeric: tabular-nums;
}
.job-live-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.9rem;
  margin-top: 0.45rem;
}
.job-live-status {
  font-size: 0.8rem;
  color: var(--muted);
}
.job-live-status[data-state="saved"] { color: var(--ok, #237a4b); }
.job-live-status[data-state="error"] { color: var(--danger, #b42318); font-weight: 600; }
.job-dispo-top {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(18rem, 1.45fr);
  gap: 0.65rem;
  align-items: stretch;
  margin-bottom: 0.65rem;
}
.job-dispo-field {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}
.job-option-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  cursor: pointer;
}
.job-option-card input { flex: 0 0 auto; margin: 0; }
.job-option-card span { display: grid; gap: 0.15rem; }
.job-option-card strong { font-size: 0.88rem; }
.job-option-card small { color: var(--muted); font-size: 0.78rem; line-height: 1.25; }

.job-minutes {
  margin: 0.65rem 0 0;
  padding: 0.5rem 0.65rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}
.job-minutes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.job-minutes-head .muted { font-weight: 400; font-size: 0.78rem; }
.job-minutes-cols {
  display: grid;
  grid-template-columns: minmax(7.2rem, auto) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  align-items: start;
}
.job-minutes-col { min-width: 0; }
.job-minutes-col-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}
.job-minutes-kind {
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  padding: 0.02rem 0.32rem;
  border-radius: 3px;
  background: var(--warn-bg);
  color: var(--warn);
}
.job-minutes-col-input {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}
.job-minutes input[type="text"],
.job-minutes input[type="number"] {
  width: 3.4rem;
  max-width: 100%;
  padding: 0.22rem 0.35rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.job-minutes-unit {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}
.job-minutes-src {
  margin: 0.18rem 0 0;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.25;
}

.job-split-cards {
  display: grid;
  gap: 0.65rem;
}
.job-split-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.job-split-card.is-cargo {
  background: #fbf8f0;
  border-color: #e4d5b0;
}
.job-split-card.is-over {
  border-color: var(--danger);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 35%, transparent);
}
.job-split-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.job-split-card-head strong {
  display: block;
  font-size: 0.95rem;
}
.job-split-card-head .muted {
  font-size: 0.78rem;
}
.badge-soft {
  background: #eef3f8;
  border-color: #c5d4e4;
  color: var(--ink);
}
.job-split-gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.job-split-gauge {
  display: grid;
  gap: 0.15rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.job-split-gauge-track {
  height: 0.45rem;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
}
.job-split-gauge-track > i {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  max-width: 100%;
  border-radius: inherit;
  background: #3d7ea6;
}
.job-split-gauge.is-tight .job-split-gauge-track > i { background: #c48a1a; }
.job-split-gauge.is-over .job-split-gauge-track > i {
  background: var(--danger);
  max-width: none;
}
.job-split-gauge.is-unknown .job-split-gauge-track > i { background: #9aa8b5; width: 0; }
.job-split-free {
  margin: 0;
  font-size: 0.82rem;
}
.job-split-free strong { font-variant-numeric: tabular-nums; }
.job-split-need {
  margin: 0;
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  background: #fdf0d5;
  color: #6a4a10;
}
.job-split-room { margin: 0; font-size: 0.78rem; }
.job-split-must {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #eef5fb;
  border: 1px solid #cfe0f1;
}
.job-split-fields {
  display: grid;
  grid-template-columns: 5.5rem 5.5rem minmax(7rem, 1fr);
  gap: 0.4rem;
  align-items: end;
}
.job-split-fields label {
  margin: 0;
  gap: 0.15rem;
  font-size: 0.75rem;
}
.job-split-fields input,
.job-split-fields select {
  width: 100%;
  font: inherit;
  padding: 0.25rem 0.35rem;
}

.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; }
  .job-addr { grid-template-columns: 1fr; }
  .job-mv-row {
    grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr);
  }
  .job-mv-row .job-mv-check {
    align-self: center;
  }
  .job-window-fields { grid-column: 1 / -1; }
  .job-dispo-top { grid-template-columns: 1fr; }
  .prep-detail .form-grid,
  .prep-detail .prep-addr-grid { grid-template-columns: 1fr; }
  .job-minutes-cols { grid-template-columns: 1fr 1fr; }
  .job-minutes-cols .job-minutes-col:first-child { grid-column: 1 / -1; }
  .job-split-fields {
    grid-template-columns: 1fr 1fr;
  }
  .job-split-fields label:last-child {
    grid-column: 1 / -1;
  }
  .job-split-gauges { grid-template-columns: 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-filter-bar { margin-bottom: 1rem; }
.pack-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: end;
}
.pack-day-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: end;
}
.pack-day-pick,
.pack-search {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted, #5a6b60);
}
.pack-day-pick input[type="date"],
.pack-search input[type="search"] {
  font: inherit;
  font-size: 0.95rem;
  color: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line, #c5d0c8);
  border-radius: 0.45rem;
  background: #fff;
  min-height: 2.15rem;
}
.pack-search input[type="search"] {
  min-width: 14rem;
}
.pack-filter-meta {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
}
.pack-section-title {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}
.pack-job-pick {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.pack-job-pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line, #c5d0c8);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--bg-accent, #f4f1ea) 55%, #fff);
}
.pack-job-pick-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.pack-job-pick-info strong { font-size: 1.05rem; }
.pack-job-cap { font-size: 0.85rem; }
.pack-job-pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.pack-job-dir-form { display: inline; margin: 0; }
/* Katalog-Formulare: L/B/H/kg sind kurze Zahlen – kompakte Felder in einer Zeile statt
   seitenbreiter Inputs, die das Formular auseinanderziehen. */
.pack-cat-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  align-items: flex-end;
}
.pack-cat-form label { flex: 0 1 auto; }
.pack-cat-form input[type="number"] { width: 6.5rem; }
.pack-cat-form .pack-cat-wide input,
.pack-cat-form select { min-width: 14rem; }
.pack-cat-form .check {
  flex-direction: row;
  align-items: center;
  padding-bottom: 0.45rem;
  white-space: nowrap;
}
.pack-cat-form .full { width: 100%; }
.pack-cat-form textarea { width: 100%; }
/* Paar-Zuordnung „Stück je Träger“: ein kurzes Feld je Träger, in einer Reihe. */
.pack-cat-form .pack-carrier-qty {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.75rem 0.65rem;
}
.pack-cat-form .pack-carrier-qty legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.25rem;
}

/* Bulk: Stück je Träger – Karten, fingerfreundlich */
.pack-matrix-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}
@media (min-width: 720px) {
  .pack-matrix-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .pack-matrix-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.pack-matrix-card {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel, #fff);
}
.pack-matrix-card h3 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
}
.pack-matrix-card h3 code {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}
.pack-matrix-fields {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.pack-matrix-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}
.pack-matrix-field span {
  flex: 1 1 auto;
  min-width: 0;
}
.pack-matrix-field input {
  width: 5.5rem;
  flex: 0 0 auto;
  font-size: 1.2rem;
  padding: 0.55rem 0.45rem;
  text-align: center;
  border-radius: 8px;
}
.pack-matrix-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: sticky;
  bottom: 0.5rem;
  padding: 0.65rem 0 0.15rem;
  background: linear-gradient(to top, var(--bg, #f6f4ef) 55%, transparent);
}
.pack-matrix-actions .btn {
  flex: 1 1 10rem;
  justify-content: center;
  min-height: 2.75rem;
}

/* Katalog: Schnellbearbeitung (inline AJAX) */
.pack-bulk-wrap {
  overflow-x: auto;
  margin: 0.5rem 0 1rem;
}
.pack-bulk-table th,
.pack-bulk-table td {
  white-space: nowrap;
  vertical-align: middle;
}
.pack-bulk-table td:nth-child(2) {
  white-space: normal;
  min-width: 12rem;
}
.pack-bulk-in {
  width: 4.25rem;
  padding: 0.2rem 0.3rem;
  font-size: 0.85rem;
  text-align: right;
}
.pack-bulk-in-kg { width: 4.75rem; }
.pack-bulk-check { text-align: center; }
.pack-bulk-in.is-saving,
.pack-bulk-check input.is-saving { outline: 1px solid var(--muted); }
.pack-bulk-in.is-saved,
.pack-bulk-check input.is-saved {
  outline: 1px solid color-mix(in srgb, var(--ok, #2f6f4e) 70%, transparent);
}
.pack-bulk-in.is-error,
.pack-bulk-check input.is-error { outline: 1px solid var(--danger); }
.pack-bulk-table tr.pack-bulk-suggest td:nth-child(2) {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--warn, #b8860b) 80%, transparent);
}
.pack-bulk-table tr.pack-bulk-skip td {
  background: color-mix(in srgb, var(--ok, #2f6f4e) 8%, transparent);
}

.pack-status-draft { background: #e8e4dc; }
.pack-status-packed { background: #d7e8d4; }
.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; }
}
