:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --surface-2: #f1f1f1;
  --text: #212121;
  --muted: #666666;
  --border: #dcdcdc;
  --primary: #cc071e;
  --primary-ink: #ffffff;
  --primary-soft: #fbe3e6;
  --danger: #a30018;
  --danger-soft: #fde7e9;
  --warn: #a15c07;
  --warn-soft: #fdf0d5;
  --ok: #1a7f37;
  --ok-soft: #dcf5e4;
  --info: #1f5fa8;
  --info-soft: #e4eef9;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}


* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hide-deposit .dep { display: none !important; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }

.page { max-width: 1200px; margin: 0 auto; padding: 20px 16px 80px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }

/* ---------- Bausteine ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow);
}
a.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat-n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-l { color: var(--muted); font-size: .88rem; }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 16px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: #a30018; border-color: #a30018; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 5px 10px; font-size: .88rem; }
.btn.icon { padding: 6px 9px; }
.btn.toggle[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.neu { background: var(--info-soft); color: var(--info); }
.badge.packen { background: var(--warn-soft); color: var(--warn); }
.badge.gepackt { background: var(--primary-soft); color: var(--primary); }
.badge.unterwegs { background: var(--warn-soft); color: var(--warn); }
.badge.geliefert, .badge.verfuegbar { background: var(--ok-soft); color: var(--ok); }
.badge.storniert, .badge.werkstatt { background: var(--danger-soft); color: var(--danger); }
.badge.kasten { background: var(--info-soft); color: var(--info); }
.badge.einzeln { background: var(--surface-2); color: var(--muted); }

.notice { padding: 10px 14px; border-radius: 8px; background: var(--info-soft); color: var(--info); margin-bottom: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.field .hint { font-size: .78rem; font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.checkbox-field { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-field input { width: 18px; height: 18px; }
.checkbox-field > span { font-size: .95rem; color: var(--text); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 8px; margin-top: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { width: auto; min-width: 140px; }
.filters input[type="search"] { flex: 1; min-width: 200px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; }

.items-table td { padding: 6px 8px; }
.items-table input, .items-table select { min-height: 34px; padding: 5px 8px; }
.items-table .w-qty { width: 84px; }
.items-table .w-unit { width: 70px; }
.items-table .w-pack { width: 110px; }
.items-table .w-money { width: 90px; }
.items-table .w-rule { min-width: 250px; }
.items-table .w-name { min-width: 200px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.add-row select, .add-row input { width: auto; min-width: 200px; flex: 1; max-width: 340px; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 70px; }
.progress > i { display: block; height: 100%; background: var(--primary); }

/* ---------- Anmeldung ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { display: flex; align-items: center; gap: 10px; }
.login-card form { display: grid; gap: 12px; margin-top: 14px; }

/* ---------- Dialog ---------- */
dialog.dlg {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
dialog.dlg::backdrop { background: rgba(10, 15, 22, .55); }
.dlg form { padding: 18px; }
.dlg h2 { margin-bottom: 14px; }
.dlg .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 12px; bottom: 12px; z-index: 100; display: grid; gap: 8px; width: min(380px, calc(100vw - 24px)); }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-weight: 500;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }

/* ---------- Listen / Karten ---------- */
.mini-order {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text); border: 1px solid var(--border); background: var(--surface);
}
.mini-order:hover { text-decoration: none; border-color: var(--primary); }
.mini-order .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.fleet-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.fleet-card dl { margin: 10px 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.fleet-card dt { color: var(--muted); }
.fleet-card dd { margin: 0; }
.fleet-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 0 0 auto; }
.warn-text { color: var(--warn); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }

/* ---------- Packliste (Touch-freundlich) ---------- */
.pack-card { display: block; color: var(--text); }
.pack-card:hover { text-decoration: none; border-color: var(--primary); }
.pack-card h3 { margin-bottom: 4px; }
.pack-card .progress { margin-top: 10px; }
.group-title { margin: 22px 0 8px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.pack-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.pack-item.done { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.pack-item.done .pi-name { text-decoration: line-through; color: var(--muted); }
.pack-check {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); font-size: 1.5rem; line-height: 1; cursor: pointer; color: transparent;
  display: grid; place-items: center; padding: 0;
}
.pack-item.done .pack-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.pack-check:disabled { cursor: default; opacity: .7; }
.pi-body { flex: 1; min-width: 0; }
.pi-name { font-weight: 600; font-size: 1.02rem; }
.pi-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 3px; color: var(--muted); font-size: .9rem; }
.pi-qty { font-size: 1.25rem; font-weight: 700; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1.3rem; cursor: pointer; line-height: 1;
}
.stepper button:disabled { opacity: .4; cursor: default; }
.stepper .count { min-width: 56px; text-align: center; font-weight: 700; }
.pack-footer {
  position: sticky; bottom: 0; margin-top: 16px; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}
.btn.big { padding: 13px 22px; font-size: 1.05rem; }

.driver-card h3 { font-size: 1.1rem; }
.driver-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.driver-card details { margin-top: 10px; }
.driver-card summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.driver-card ul { margin: 8px 0 0; padding-left: 20px; }

.info-box { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; font-size: .9rem; color: var(--muted); margin-bottom: 14px; }

/* ---------- Druck ---------- */
.print-sheet { background: #fff; color: #000; padding: 24px; border-radius: var(--radius); max-width: 820px; margin: 0 auto; }
.print-sheet h1 { font-size: 1.4rem; }
.print-sheet table th { background: #f0f0f0; color: #333; }
.print-sheet td, .print-sheet th { border-bottom: 1px solid #bbb; }
.print-sheet .box { display: inline-block; width: 18px; height: 18px; border: 2px solid #000; border-radius: 3px; }
.print-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin: 12px 0 18px; }

@media (max-width: 640px) {
  .page { padding: 14px 12px 90px; }
  th, td { padding: 8px; }
}

@media print {
  body { background: #fff; }
  .sidebar, .mobilebar, .scrim, .no-print, #toasts, .pack-footer { display: none !important; }
  .page { max-width: none; padding: 0; }
  .print-sheet { padding: 0; border-radius: 0; max-width: none; }
}

/* =====================================================================
   Modernes Design (überschreibt die Basis oben)
   ===================================================================== */
:root {
  --bg: #f6f7f9;
  --border: #e6e8ec;
  --border-strong: #dfe2e8;
  --track: #eceef2;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --text: #16181d;
  --muted: #6b7280;
  --primary: #d6122b;
  --primary-soft: #fdecee;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .06);
}
body { font-family: Inter, "Segoe UI Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: -.005em; }
h1 { font-size: 1.75rem; font-weight: 750; letter-spacing: -.02em; }
h2 { font-weight: 700; letter-spacing: -.01em; }

/* Karten, Kacheln */
.card, .stat, .table-wrap, .mini-order, .pack-item { border-color: var(--border); border-radius: var(--radius); }
.card { padding: 20px; }
.stat { padding: 18px 20px; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16, 24, 40, .10); border-color: transparent; }
.stat-n { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.stat-l { font-size: .85rem; }
.mini-order { transition: box-shadow .15s, border-color .15s; }
.mini-order:hover { box-shadow: var(--shadow); border-color: var(--primary); }

/* Buttons & Eingaben */
.btn { border-radius: 12px; padding: 9px 16px; font-weight: 600; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, #e0152f, #c80f26); border-color: #c80f26; box-shadow: 0 2px 8px rgba(214, 18, 43, .30); }
.btn.primary:hover { background: linear-gradient(180deg, #d6122b, #b80d22); border-color: #b80d22; }
.btn.small { border-radius: 10px; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  border-radius: 12px; border-color: var(--border-strong); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(214, 18, 43, .12); }
.field > span { text-transform: none; letter-spacing: 0; }
.badge { padding: 3px 11px; font-weight: 650; }

/* Tabellen */
.table-wrap { overflow: hidden auto; }
th { background: var(--surface-2); font-size: .72rem; border-bottom: 1px solid var(--border); }
td { border-bottom-color: var(--border); }
tbody tr.clickable:hover { background: var(--surface-2); }

/* Dialoge, Toasts */
dialog.dlg { border-radius: 20px; border: 0; box-shadow: 0 30px 80px rgba(16, 24, 40, .35); }
dialog.dlg::backdrop { backdrop-filter: blur(3px); }
.toast { border-radius: 14px; }

/* Packen: große, ruhige Kacheln */
.pack-item { padding: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.pack-check { border-radius: 14px; width: 50px; height: 50px; }
.progress { height: 10px; background: var(--track); }
.progress > i { background: linear-gradient(90deg, #ef4458, var(--primary)); border-radius: 99px; }
.stepper button { border-radius: 12px; }
.pack-footer { background: linear-gradient(transparent, var(--bg) 35%); }

/* Anmelden / Einrichtung: zweigeteilt */
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; padding: 0; place-items: stretch; }
.login-hero {
  display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 56px;
  color: #fff; background: radial-gradient(900px 500px at 10% 0%, #ff5a6e 0%, transparent 60%), linear-gradient(135deg, #d6122b, #8f0a1c);
}
.hero-logo { display: flex; align-items: center; gap: 12px; font-size: 1.6rem; font-weight: 800; }
.hero-logo img { width: 44px; height: 44px; border-radius: 12px; background: #fff; padding: 3px; }
.login-hero h2 { font-size: 2rem; line-height: 1.15; max-width: 460px; margin: 10px 0 0; letter-spacing: -.02em; }
.login-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; opacity: .92; }
.login-hero li::before { content: "✓"; display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; margin-right: 10px; border-radius: 50%; background: rgba(255, 255, 255, .22); font-size: .8rem; }
.login-panel { display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { max-width: 400px; border: 0; box-shadow: none; background: transparent; padding: 0; }
.login-card h1 { font-size: 2rem; margin-bottom: 6px; color: var(--text); }
.login-card form { gap: 14px; margin-top: 22px; }
@media (max-width: 820px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 24px; }
  .login-hero h2, .login-hero ul { display: none; }
  .login-panel { align-items: start; padding-top: 28px; }
}

.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type="search"] { flex: 1; min-width: 220px; }
.inline-date { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; }
.btn.toggle.off { background: var(--surface); color: var(--text); border-color: var(--border); }

/* =====================================================================
   Seitenmenü, Tabs, Dunkelmodus
   ===================================================================== */
:root { --sb-w: 264px; color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115; --surface: #181b21; --surface-2: #1f232b; --text: #e8eaee; --muted: #9aa3b2;
  --border: #2a2f39; --border-strong: #353b47; --track: #2a2f39;
  --primary: #ff4d62; --primary-soft: #3a1a1f;
  --danger: #ff7b86; --danger-soft: #3b1b20; --warn: #f2b04b; --warn-soft: #3a2c10;
  --ok: #4cc272; --ok-soft: #15321f; --info: #7fb0ff; --info-soft: #172a47;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
}
:root[data-theme="dark"] .btn.primary { background: linear-gradient(180deg, #e0152f, #c80f26); color: #fff; }
:root[data-theme="dark"] .toast.error, :root[data-theme="dark"] .toast.warn { color: #111; }
:root[data-theme="dark"] .login-hero { filter: brightness(.85); }
:root[data-theme="dark"] dialog.dlg { background: var(--surface); color: var(--text); }
.print-sheet { color-scheme: light; }

.shell { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 14px 12px;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; z-index: 40;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; font-weight: 800; font-size: 1.2rem; color: var(--text); white-space: nowrap; }
.sidebar .brand img { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.sb-nav { display: grid; gap: 2px; }
.sb-title { margin: 14px 10px 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }
.sb-link, .sb-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 0; background: none;
  color: var(--muted); font: inherit; font-weight: 600; font-size: .93rem; cursor: pointer; text-align: left; white-space: nowrap;
}
.sb-link:hover, .sb-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sb-link.active { background: var(--primary-soft); color: var(--primary); }
.sb-link svg, .sb-btn svg { width: 20px; height: 20px; flex: none; }
.sb-spacer { flex: 1; }
.sb-foot { display: grid; gap: 2px; border-top: 1px solid var(--border); padding-top: 10px; }
.sb-user { padding: 6px 12px 8px; font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user b { display: block; color: var(--text); font-size: .93rem; }
.content { min-width: 0; }
.mobilebar { display: none; }
.scrim { display: none; }
.collapse-btn svg { transition: transform .2s; }

@media (min-width: 901px) {
  .shell.collapsed { grid-template-columns: 76px minmax(0, 1fr); }
  .shell.collapsed .sidebar { padding: 14px 10px; }
  .shell.collapsed .sb-label, .shell.collapsed .sb-user, .shell.collapsed .sb-title { display: none; }
  .shell.collapsed .sb-link, .shell.collapsed .sb-btn { justify-content: center; padding: 11px 0; }
  .shell.collapsed .sidebar .brand { justify-content: center; padding: 4px 0 12px; }
  .shell.collapsed .brand-name { display: none; }
  .shell.collapsed .collapse-btn svg { transform: rotate(180deg); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; max-width: 86vw; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .shell.open .sidebar { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 35; }
  .collapse-btn { display: none; }
  .mobilebar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 8px 12px;
    background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 800;
  }
  .mobilebar .sb-btn { width: auto; padding: 8px; }
  .mobilebar img { width: 28px; height: 28px; border-radius: 8px; }
}

/* Tabs im Auftragsformular */
[hidden] { display: none !important; }
.tabbar { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--surface-2); border-radius: 14px; overflow-x: auto; }
.tabbar button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border: 0; border-radius: 11px;
  background: none; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.tabbar button:hover { color: var(--text); }
.tabbar button[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.tab-count { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: .78rem; }
.tab-next { display: flex; justify-content: flex-end; margin-top: 14px; }

/* Mehrfach-Rollen */
.checkgroup { display: flex; gap: 8px; flex-wrap: wrap; }
.check-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; background: var(--surface); font-weight: 600; font-size: .9rem; }
.check-pill:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.check-pill input { width: auto; min-height: 0; margin: 0; accent-color: var(--primary); }

/* Kundenauswahl im Auftrag */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; width: fit-content; }
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 9px; font: inherit; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.cust-box { display: grid; gap: 6px; }
.cust-box .field { gap: 6px; }

/* Fuhrpark: Kacheln, Liste, Filter */
.fleet-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fleet-toolbar input[type="search"] { flex: 1; min-width: 180px; width: auto; }
.fleet-toolbar select { width: auto; }
.fleet-toolbar .seg { margin-left: auto; }
.fleet-toolbar .seg:first-child { margin-left: 0; }
.fleet-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.fleet-tile { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-left: 4px solid var(--border-strong); }
.fleet-tile.st-verfuegbar { border-left-color: var(--ok); }
.fleet-tile.st-unterwegs { border-left-color: var(--warn); }
.fleet-tile.st-werkstatt { border-left-color: var(--danger); }
.ft-top { display: flex; align-items: center; gap: 12px; }
.ft-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.ft-icon svg { width: 22px; height: 22px; }
.ft-title { flex: 1; min-width: 0; }
.ft-plate { font-size: 1.15rem; font-weight: 800; letter-spacing: .02em; }
.ft-use { font-size: .92rem; min-height: 1.3em; }
.ft-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 600; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.ft-note { border-top: 1px dashed var(--border); padding-top: 8px; }
.ft-actions { display: flex; gap: 8px; margin-top: auto; align-items: center; }
.ft-mini { display: inline-grid; place-items: center; width: 26px; margin-right: 8px; color: var(--muted); vertical-align: middle; }
.ft-mini svg { width: 18px; height: 18px; }
.fleet-table td { vertical-align: middle; }
.more { position: relative; display: inline-block; }
.more summary { list-style: none; cursor: pointer; display: inline-grid; place-items: center; padding: 6px 8px; }
.more summary::-webkit-details-marker { display: none; }
.more summary svg { width: 18px; height: 18px; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; min-width: 200px; display: grid; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.more-menu button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; }
.more-menu button:hover { background: var(--surface-2); }
.more-menu .danger-text { color: var(--danger); }
.table-wrap:has(.more[open]) { overflow: visible; }
.grid > .card + .card { margin-top: 0; }
.seg svg { width: 18px; height: 18px; display: block; }
.seg button { display: inline-flex; align-items: center; justify-content: center; }
.fleet-table td:nth-child(4) { min-width: 220px; }
.fleet-table { min-width: 0; }
.table-wrap:has(.fleet-table) { overflow-x: auto; }
.fleet-table td:last-child { width: 1%; }

/* Tagesplanung */
.plan-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.plan-nav input[type="date"] { width: auto; }
.plan-day { margin-left: 6px; font-size: 1.05rem; }
.plan-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.plan-col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; border: 2px solid transparent; min-height: 140px; }
.plan-col.unassigned { background: var(--warn-soft); }
.plan-col.over { border-color: var(--primary); }
.pc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px 8px; }
.pc-tour { display: grid; gap: 6px; margin-bottom: 8px; }
.pc-sel { padding: 6px 8px; min-height: 34px; font-size: .88rem; }
.pc-list { display: grid; gap: 8px; }
.pc-empty { text-align: center; padding: 18px 6px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; cursor: grab; display: grid; gap: 3px; box-shadow: var(--shadow); }
.plan-card.dragging { opacity: .45; }
.plan-card.st-gepackt { border-left-color: var(--primary); }
.plan-card.st-unterwegs { border-left-color: var(--warn); }
.plan-card.st-geliefert { border-left-color: var(--ok); }
.pc-top { display: flex; align-items: center; gap: 8px; }
.pc-title { flex: 1; min-width: 0; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-stop { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.pc-warn { color: var(--warn); font-size: .8rem; background: var(--warn-soft); border-radius: 8px; padding: 4px 8px; }
.pc-move { display: flex; gap: 6px; margin-top: 4px; }
.pc-move .btn { padding: 2px 10px; }
.plan-undated { display: grid; gap: 8px; }
.plan-undated-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.plan-undated-row a { font-weight: 600; }
@media (max-width: 900px) { .plan-board { grid-auto-flow: row; grid-auto-columns: auto; } }

/* Unterschrift */
.sig-dlg { width: min(640px, 96vw); }
.sig-body { display: grid; gap: 12px; }
.sig-wrap { position: relative; border: 2px dashed var(--border-strong); border-radius: 14px; background: #fff; overflow: hidden; }
.sig-canvas { display: block; width: 100%; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: #999; }
.sig-body .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.mb { margin-bottom: 12px; }

/* Ersatz / nicht lieferbar */
.badge.ersatz { background: var(--warn-soft); color: var(--warn); }
.pack-item.issue.nicht_lieferbar .pi-name { text-decoration: line-through; }
.pack-item.issue { border-left: 4px solid var(--warn); }
.pi-sub { font-size: .85rem; color: var(--muted); }
.pi-issue { margin-left: .25rem; flex: none; }
li.struck { text-decoration: line-through; color: var(--muted); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Auswertung */
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-ax { fill: var(--muted); font-size: 11px; }
.bar-open { fill: color-mix(in srgb, var(--primary) 28%, var(--surface)); }
.bar-done { fill: var(--primary); }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.lg::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-done::before { background: var(--primary); }
.lg-open::before { background: color-mix(in srgb, var(--primary) 28%, var(--surface)); }
.barlist { display: flex; flex-direction: column; gap: 12px; }
.bl-top { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; }
.bl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 4px; }
.bl-fill { height: 100%; border-radius: 99px; background: var(--primary); }
.bl-top strong { white-space: nowrap; }

/* Offline-Hinweis */
#offline-banner { position: sticky; top: 0; z-index: 60; background: var(--warn); color: #fff; text-align: center; padding: 8px 14px; font-size: .88rem; font-weight: 600; }
