/* Tourwerk – Oberfläche. Dunkel als Standard, hell umschaltbar. Keine Inline-Styles (Content-Security-Policy). */

:root, [data-theme="dark"] {
  --bg: #111417; --surface: #1A1E22; --surface2: #22272C; --line: #2C3238; --line2: #252A2F;
  --ink: #E8EAEC; --muted: #9AA1A8; --muted2: #AEB4BA;
  --hdr: #0B0D0F; --hdr-ink: #F2F3F4; --hdr-link: #C9CED3; --hdr-active: #2C3238;
  --field: #111417; --field-bd: #3A4148;
  --brand: #1A5FC0; --brand-ink: #FFFFFF; --red: #FF4A3D;
  --ok-bg: #15281C; --ok-bd: #3F7A55; --ok-ink: #9FE0B8;
  --warn-bg: #33280C; --warn-bd: #C98A00; --warn-ink: #F2D58A;
  --bad-bg: #3A1614; --bad-bd: #FF4A3D; --bad-ink: #FFB3AD;
  --none-ink: #6E757C;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F3F4F1; --surface: #FFFFFF; --surface2: #F3F4F1; --line: #D9DCD4; --line2: #E6E8E2;
  --ink: #1B1F23; --muted: #5A6068; --muted2: #4A5058;
  --hdr: #1B1F23; --hdr-ink: #FFFFFF; --hdr-link: #D5D9DD; --hdr-active: #3A4148;
  --field: #FFFFFF; --field-bd: #C9CCC4;
  --brand: #0B4DA2; --brand-ink: #FFFFFF; --red: #D7261E;
  --ok-bg: #E4F0E7; --ok-bd: #9CC4A8; --ok-ink: #245F3C;
  --warn-bg: #FFF4D6; --warn-bd: #C98A00; --warn-ink: #6B4700;
  --bad-bg: #FCE6E4; --bad-bd: #D7261E; --bad-ink: #A51C15;
  --none-ink: #8A9096;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0; font-weight: 700; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
h3 { font-size: 14px; margin: 16px 0 8px; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.err { color: var(--bad-ink); margin: 8px 0 0; min-height: 1em; }
.err:empty { display: none; }

/* Knöpfe und Felder */
.btn {
  min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--field-bd); background: var(--surface2);
  color: var(--ink); font: 500 14px/1 inherit; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.danger { color: var(--bad-ink); border-color: var(--bad-bd); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.icon { width: 40px; padding: 0; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 46px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--muted2); }
input, select, textarea {
  min-height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--field-bd); background: var(--field);
  color: var(--ink); font: 400 14px/1.3 inherit; font-family: inherit; width: 100%;
}
textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--brand); }
input:disabled, select:disabled, textarea:disabled { opacity: .75; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; color: var(--ink); font-weight: 400; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }

/* Anmeldung */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 380px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login p { margin: 0; }
.brand-big { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 700; }

/* Kopfzeile */
.top { background: var(--hdr); color: var(--hdr-ink); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 26px; width: auto; display: block; }
.firm-name { font-weight: 600; font-size: 15px; }
.app-name { font-size: 11.5px; color: var(--hdr-link); padding-left: 12px; border-left: 1px solid var(--hdr-active); }
#nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
#nav a { padding: 9px 12px; border-radius: 6px; color: var(--hdr-link); text-decoration: none; font-size: 13.5px; }
#nav a[aria-current="page"] { background: var(--hdr-active); color: var(--hdr-ink); font-weight: 500; box-shadow: inset 0 -3px 0 var(--red); }
.top-right { display: flex; align-items: center; gap: 8px; }
.top .btn.ghost { color: var(--hdr-ink); }
.top .btn.ghost:hover { border-color: var(--hdr-active); }
.firm-pick select { min-height: 38px; background: var(--hdr-active); color: var(--hdr-ink); border-color: var(--hdr-active); max-width: 260px; }

/* Seiten */
main { padding: 20px; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.page-head .grow { flex: 1 1 auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"] { max-width: 260px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--field-bd); border-radius: 8px; overflow: hidden; background: var(--surface2); }
.seg button { min-height: 38px; padding: 0 12px; border: 0; background: transparent; color: var(--ink); font: 500 13px inherit; font-family: inherit; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg .count { color: var(--muted); font-weight: 400; margin-left: 4px; }
.seg button[aria-pressed="true"] .count { color: var(--bg); opacity: .7; }

/* Fristen-Übersicht */
.due-box { padding: 14px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.due-box.ok { border-color: var(--ok-bd); }
.due-list { display: flex; flex-wrap: wrap; gap: 8px; }
.due-item { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid; font-size: 13px; cursor: pointer; background: transparent; color: inherit; font-family: inherit; }
.due-item { text-align: left; }
.due-item b { font-weight: 600; white-space: nowrap; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: var(--surface2); }
table.list tr.archived td { opacity: .55; }
.plate { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.sub { display: block; font-size: 12px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); color: var(--muted2); white-space: nowrap; }
.tag.spare { border-color: var(--warn-bd); color: var(--warn-ink); }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* Ampel */
.dues { display: flex; flex-wrap: wrap; gap: 4px; }
.due { display: inline-flex; flex-direction: column; padding: 3px 7px; border-radius: 6px; border: 1px solid; font-size: 11px; line-height: 1.25; min-width: 62px; }
.due b { font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
.due.ok, .due-item.ok { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-ink); }
.due.soon, .due-item.soon { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-ink); }
.due.over, .due-item.over { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-ink); }
.due.none { border-color: var(--line); color: var(--none-ink); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid; display: inline-block; }
.legend i.ok { background: var(--ok-bg); border-color: var(--ok-bd); }
.legend i.soon { background: var(--warn-bg); border-color: var(--warn-bd); }
.legend i.over { background: var(--bad-bg); border-color: var(--bad-bd); }

/* Dialog */
.dlg { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 26px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-body { padding: 4px 18px 16px; overflow-y: auto; }
.dlg #dlgMsg { padding: 0 18px; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.dlg-foot .grow { flex: 1 1 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.grid .span2 { grid-column: span 2; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.secret { padding: 12px; border-radius: 8px; background: var(--warn-bg); border: 1px solid var(--warn-bd); color: var(--warn-ink); margin-top: 12px; }
.secret code { font-size: 16px; user-select: all; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 500; z-index: 10; }

/* Handy: Tabellen als Karten */
@media (max-width: 760px) {
  main { padding: 12px; }
  .top { padding: 10px 12px; gap: 8px 12px; }
  .app-name { display: none; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: var(--surface); }
  table.list td { border: 0; padding: 6px 12px; }
  table.list td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  .card.table-wrap { border: 0; background: transparent; }
  .grid .span2 { grid-column: auto; }
  .due-item { width: 100%; flex-wrap: wrap; gap: 2px 8px; }
  .toolbar input[type="search"] { max-width: none; }
}

@media print {
  .top, .toolbar, .due-box { display: none; }
  body { background: #fff; color: #000; }
}

.logo-preview { max-height: 60px; background: #0B0D0F; padding: 8px; border-radius: 6px; }

/* ---------------------------------------------------------------------------------------------
   Tagesdispo, Woche, Aufträge, Werkstatt (Stufe 2) */
:root, [data-theme="dark"] {
  --aus-bg: #2A2240; --aus-ink: #C9B8FF; --vor-bg: #12313A; --vor-ink: #8EDBEA;
  --blk1: #22272C; --blk2: #1A1E22;
  --o0-bg: #3A1614; --o0-ink: #FFB3AD; --o0-bd: #FF4A3D;
  --o1-bg: #142A47; --o1-ink: #9CC2F5; --o1-bd: #6FA3E8;
  --o2-bg: #15281C; --o2-ink: #9FE0B8; --o2-bd: #3F9A60;
  --o3-bg: #3A2410; --o3-ink: #FFC48A; --o3-bd: #F08A24;
  --o4-bg: #2A2240; --o4-ink: #C9B8FF; --o4-bd: #8E6FE0;
  --o5-bg: #12313A; --o5-ink: #8EDBEA; --o5-bd: #2FA3B8;
  --o6-bg: #3A1530; --o6-ink: #FFB0E0; --o6-bd: #E0559F;
  --o7-bg: #33300C; --o7-ink: #E8DC7A; --o7-bd: #B8A626;
}
[data-theme="light"] {
  --aus-bg: #E9E4F7; --aus-ink: #4B2E9A; --vor-bg: #DFF1F4; --vor-ink: #0E5C6B;
  --blk1: #ECEDEA; --blk2: #E0E2DD;
  --o0-bg: #FCE6E4; --o0-ink: #A51C15; --o0-bd: #D7261E;
  --o1-bg: #DCE8F7; --o1-ink: #0B4DA2; --o1-bd: #0B4DA2;
  --o2-bg: #E1F2E6; --o2-ink: #1F6B3A; --o2-bd: #2E8B4F;
  --o3-bg: #FDEBD9; --o3-ink: #8A4A0B; --o3-bd: #D97A1A;
  --o4-bg: #E9E4F7; --o4-ink: #4B2E9A; --o4-bd: #6A4FC9;
  --o5-bg: #DFF1F4; --o5-ink: #0E5C6B; --o5-bd: #1D8FA5;
  --o6-bg: #FBE3F1; --o6-ink: #8E1E5C; --o6-bd: #C93C8A;
  --o7-bg: #F4F0CF; --o7-ink: #5E560A; --o7-bd: #9C8D17;
}
.oc0 { --oc-bg: var(--o0-bg); --oc-ink: var(--o0-ink); --oc-bd: var(--o0-bd); }
.oc1 { --oc-bg: var(--o1-bg); --oc-ink: var(--o1-ink); --oc-bd: var(--o1-bd); }
.oc2 { --oc-bg: var(--o2-bg); --oc-ink: var(--o2-ink); --oc-bd: var(--o2-bd); }
.oc3 { --oc-bg: var(--o3-bg); --oc-ink: var(--o3-ink); --oc-bd: var(--o3-bd); }
.oc4 { --oc-bg: var(--o4-bg); --oc-ink: var(--o4-ink); --oc-bd: var(--o4-bd); }
.oc5 { --oc-bg: var(--o5-bg); --oc-ink: var(--o5-ink); --oc-bd: var(--o5-bd); }
.oc6 { --oc-bg: var(--o6-bg); --oc-ink: var(--o6-ink); --oc-bd: var(--o6-bd); }
.oc7 { --oc-bg: var(--o7-bg); --oc-ink: var(--o7-ink); --oc-bd: var(--o7-bd); }
.ord { display: inline-flex; align-items: center; justify-content: center; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--oc-bd); background: var(--oc-bg); color: var(--oc-ink); white-space: nowrap; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--oc-bd); background: var(--oc-bg); display: inline-block; flex: none; }

.page-head .day-title { display: flex; flex-direction: column; gap: 2px; }
.page-head .day-title .muted { font-size: 12.5px; }
.navgrp { display: flex; gap: 4px; }
.navgrp .btn { min-width: 40px; }
.seg a { min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; }
.seg a[aria-current="true"] { background: var(--ink); color: var(--bg); }
input.day-pick { width: auto; min-height: 40px; }

.disp { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.disp-main { flex: 999 1 820px; min-width: 0; overflow-x: auto; }
.disp-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.disp-cols, .unit { display: grid; grid-template-columns: 210px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.disp-cols { font-size: 12px; font-weight: 600; color: var(--muted); }
.disp-cols > span { padding: 10px 14px; }
.ln { display: grid; grid-template-columns: 22px 84px minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.25fr) 64px 118px; gap: 10px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line2); font-size: 13px; cursor: pointer; }
.disp-cols .ln { cursor: default; border: 0; font-size: 12px; }
.unit-body .ln:last-child { border-bottom: 0; }
.unit-body .ln:hover { background: var(--surface2); }
.ln.done .place b, .ln.done .mat { color: var(--muted); }
.ln.dragging { opacity: .4; }
.ln:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ln .nr { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); }
.ln .mat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place { display: flex; flex-direction: column; min-width: 0; }
.place b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-head { padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; border: 0; border-right: 1px solid var(--line2); background: transparent; color: var(--ink); font: inherit; text-align: left; }
button.unit-head { cursor: pointer; }
button.unit-head:hover { background: var(--surface2); }
.unit-head .plate { font-size: 15px; }
.unit-head .trailer { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; color: var(--muted2); }
.unit-head .driver { font-size: 13px; font-weight: 500; }
.unit-head .driver.none { color: var(--warn-ink); font-weight: 400; }
.unit-head .type { font-size: 11.5px; color: var(--muted); }
.unit-head .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.unit-body { min-width: 0; min-height: 52px; }
.unit-body.drop, .drop-zone.drop { background: var(--surface2); outline: 2px dashed var(--brand); outline-offset: -4px; }
.unit.has-warn .unit-head .plate { color: var(--warn-ink); }

.tag.t-fuhre { color: var(--muted2); }
.tag.t-aus { background: var(--aus-bg); color: var(--aus-ink); border-color: transparent; }
.tag.t-vor { background: var(--vor-bg); color: var(--vor-ink); border-color: transparent; }
.tag.warn { border-color: var(--warn-bd); color: var(--warn-ink); }
.st { display: inline-flex; align-items: center; gap: 6px; font: 600 12px inherit; font-family: inherit; padding: 3px 9px; min-height: 28px; border-radius: 999px; border: 1px solid; white-space: nowrap; justify-self: start; cursor: pointer; background: transparent; color: inherit; }
.st:disabled { cursor: default; opacity: 1; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-erledigt { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-ink); }
.st-unterwegs { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-ink); }
.st-offen { background: var(--surface2); border-color: var(--field-bd); color: var(--muted2); }
.st-morgen { background: var(--vor-bg); border-color: transparent; color: var(--vor-ink); }

.idle { display: flex; align-items: center; gap: 14px; padding: 12px; flex-wrap: wrap; }
.idle b, .werk b { font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.idle b { color: var(--muted2); }
.idle .grow, .werk .grow { flex: 1 1 auto; }
.werk { display: flex; align-items: center; gap: 14px; padding: 12px; margin: 8px; border-radius: 8px; background: repeating-linear-gradient(135deg, var(--blk1) 0 10px, var(--blk2) 10px 20px); border: 1px solid var(--warn-bd); flex-wrap: wrap; text-align: left; font: inherit; color: var(--ink); cursor: pointer; width: calc(100% - 16px); }
.werk .txt { display: flex; flex-direction: column; gap: 2px; }
.werk .txt span { font-size: 12.5px; color: var(--muted2); }
.pill-warn { font-size: 12.5px; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-bd); border-radius: 999px; padding: 3px 10px; }

.side-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.side-card.warn { border-color: var(--warn-bd); }
.side-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.side-card .hint { margin: 0; }
.ocard { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--oc-bd); background: var(--oc-bg); color: var(--ink); }
.ocard[draggable="true"] { cursor: grab; }
.ocard .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.ocard .sub { color: var(--muted2); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--oc-bd); }
.mini { display: flex; flex-direction: column; }
.mini .ln { grid-template-columns: 84px minmax(0, 1fr) 64px; padding: 6px 4px; }
.drop-zone { border-radius: 8px; min-height: 36px; }

.legend .tag, .legend .ord { margin-right: 2px; }
.print-only { display: none; }

/* Woche */
.week { display: grid; grid-template-columns: 180px repeat(6, minmax(130px, 1fr)); min-width: 980px; }
.week > div { border-bottom: 1px solid var(--line2); border-right: 1px solid var(--line2); padding: 8px; min-width: 0; }
.week .wk-day { display: flex; flex-direction: column; gap: 1px; font-size: 12px; color: var(--muted); background: transparent; border: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line2); text-align: left; cursor: pointer; font-family: inherit; padding: 10px 8px; }
.week .wk-day b { font-size: 13.5px; color: var(--ink); }
.week .wk-day.today { box-shadow: inset 0 -3px 0 var(--red); }
.week .wk-day:hover { background: var(--surface2); }
.week .wk-corner { font-size: 12px; font-weight: 600; color: var(--muted); border-bottom-color: var(--line); }
.week .wk-unit { display: flex; flex-direction: column; gap: 2px; }
.week .wk-unit .plate { font-size: 14px; }
.week .wk-unit .muted { font-size: 12px; }
.week .wk-cell { display: flex; flex-direction: column; gap: 6px; min-height: 64px; }
.week .wk-cell.today { background: var(--surface2); }
.week .wk-cell.drop { outline: 2px dashed var(--brand); outline-offset: -4px; }
.chip { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; text-align: left; color: var(--ink); cursor: pointer; font-family: inherit; }
.chip b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .meta { display: flex; align-items: center; gap: 6px; color: var(--muted); flex-wrap: wrap; }
.chip.st-erledigt { opacity: .7; }
.chip.st-unterwegs { border-color: var(--bad-bd); }
.chip.k-aus { border-left: 4px solid var(--aus-ink); }
.chip.k-vor { border-right: 4px solid var(--vor-ink); }
.wblock { padding: 6px 8px; border-radius: 6px; background: repeating-linear-gradient(135deg, var(--blk1) 0 8px, var(--blk2) 8px 16px); border: 1px solid var(--warn-bd); font-size: 12px; font-weight: 600; }

.conflicts { padding: 12px; border-radius: 8px; background: var(--warn-bg); border: 1px solid var(--warn-bd); color: var(--warn-ink); margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.conflicts ul { margin: 0; padding-left: 18px; }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.colors input { width: 16px; height: 16px; min-height: 0; }
.trip-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.trip-list > div { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

@media (max-width: 760px) {
  .disp-cols { display: none; }
  .unit { grid-template-columns: 1fr; }
  .unit-head { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; border-right: 0; border-bottom: 1px solid var(--line2); }
  .unit-body .ln { grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "nr lade st" "nr mat ord" "nr ent tag"; row-gap: 2px; }
  .unit-body .ln .nr { grid-area: nr; align-self: start; }
  .unit-body .ln > .tag { grid-area: tag; justify-self: end; }
  .unit-body .ln > .p-lade { grid-area: lade; }
  .unit-body .ln .mat { grid-area: mat; }
  .unit-body .ln > .p-ent { grid-area: ent; }
  .unit-body .ln .ordc { grid-area: ord; justify-self: end; }
  .unit-body .ln > .st { grid-area: st; justify-self: end; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .disp-side, .page-head, .legend, .no-print, .unit-head .tags, .toast { display: none !important; }
  .print-only { display: block; margin-bottom: 8px; }
  .print-only h1 { font-size: 18px; }
  main { padding: 0; max-width: none; }
  .card { border-color: #999; }
  .disp-main { overflow: visible; }
  .unit, .disp-cols { border-color: #999; break-inside: avoid; }
  .ln { cursor: default; font-size: 11.5px; padding: 4px 8px; border-color: #ccc; }
  .st, .tag, .ord { background: none !important; border-color: #666 !important; color: #000 !important; }
  .st::before { display: none; }
  .werk { background: none; border: 1px dashed #000; }
  .place span, .unit-head .type, .unit-head .trailer { color: #333; }
}

/* ---------------------------------------------------------------------------------------------
   Fahrer-App und Live-Karte (Stufe 3a) */
.fz { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.fz-hello { display: flex; flex-direction: column; gap: 2px; }
.fz-h2 { margin-top: 8px; }
.fz-vehicle { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.fz-vehicle p { margin: 0; flex-basis: 100%; }
.fz-plate { font-size: 24px; }
.fz-track { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.fz-track p { margin: 0; }
.fz-track-row { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.fz-big { min-height: 56px; font-size: 17px; }
.fz-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--none-ink); display: inline-block; flex: none; }
.fz-dot.live { background: #2EB872; box-shadow: 0 0 0 4px rgba(46, 184, 114, .25); }
.fz-dot.old { background: var(--warn-bd); }
.fz-dot.stale { background: var(--bad-bd); }
.fz-dot.off { background: var(--none-ink); }
.fz-trip { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.fz-trip p { margin: 0; }
.fz-trip.st-card-erledigt { opacity: .65; }
.fz-trip.st-card-unterwegs { border-color: var(--bad-bd); }
.fz-trip-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fz-trip-head .grow { flex: 1 1 auto; }
.fz-nr { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); font-weight: 600; }
.fz-route { display: grid; grid-template-columns: 1fr; gap: 8px; }
.fz-route > div { display: flex; flex-direction: column; }
.fz-route b { font-size: 17px; }
.fz-note { padding: 8px 10px; border-radius: 8px; background: var(--surface2); white-space: pre-wrap; }
.fz-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fz-actions .btn { flex: 1 1 160px; }
.fz-next { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.map-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.map-box { flex: 999 1 640px; min-width: 0; height: calc(100vh - 210px); min-height: 420px; overflow: hidden; }
.map-list { flex: 1 1 280px; min-width: 0; padding: 14px; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 210px); overflow-y: auto; }
.map-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.map-row:hover { background: var(--surface2); border-color: var(--line); }
.map-row-txt { display: flex; flex-direction: column; min-width: 0; }
.map-row-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-pin-wrap { background: none; border: 0; }
.tw-pin { position: absolute; transform: translate(-50%, calc(-100% - 8px)); display: flex; flex-direction: column; align-items: center; padding: 4px 8px; border-radius: 8px; background: #1A1E22; color: #F2F3F4; border: 2px solid #6E737A; font: 600 12px/1.2 system-ui, sans-serif; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.tw-pin b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.tw-pin span { font-weight: 400; font-size: 11px; color: #C9CED3; }
.tw-pin::after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 7px solid transparent; border-bottom: 0; border-top-color: inherit; }
.tw-pin.live { border-color: #2EB872; }
.tw-pin.live.moving { border-color: #FF4A3D; }
.tw-pin.old { border-color: #C98A00; }
.tw-pin.stale, .tw-pin.off { border-color: #6E737A; opacity: .8; }
.tw-pop { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.tw-pop .btn { margin-top: 6px; color: var(--ink); }
/* leaflet.css wird erst mit der Karte geladen (also später): darum mit .map-box davor, sonst gewinnt Leaflet */
.map-box.leaflet-container { font: inherit; background: var(--surface2); }
.map-box .leaflet-popup-content-wrapper, .map-box .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.map-box .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }

@media (max-width: 760px) {
  .map-box { height: 60vh; }
  .map-list { max-height: none; }
}
