:root {
  /* Rosa/Weiß, Schrift überall schwarz. Bewusst nur ein (helles) Erscheinungsbild. */
  --bg: #fff6f9;
  --surface: #ffffff;
  --surface-2: #fde8f0;
  --text: #000000;
  --muted: #333333;
  --line: #f4d3e0;
  --primary: #f27aa5;        /* Rosa für Flächen (Knöpfe, Auswahl) – schwarze Schrift darauf */
  --primary-ink: #000000;
  --primary-soft: #fcdbe7;
  --primary-line: #e05a8c;   /* kräftigeres Rosa für Rahmen und Markierungen */
  --doc: #c5a3ef;            /* Lila für die Ärzte */
  --doc-soft: #f1e8fd;
  --doc-line: #8f62cf;
  --drop: #ec4f8e;
  --accent: #e0457f;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --warn-soft: #fff3d6;
  --weekend: #fff27a;
  --weekend-ink: #000000;
  --field: #ffffff;
  --box-line: #d9a9bc;
  --grid-line: #e7c3d2;
  --na: #e6e6e6;
  --tag-bg: #fcdbe7;
  --tag-fg: #000000;
  --banner: #fde8f0;
  --bar: rgba(255, 246, 249, .94);
  --toast-bg: #000000;
  --toast-fg: #ffffff;
  --switch-off: #e3c6d2;
  --scrim: rgba(40, 10, 25, .45);
  --desk: #f6e9ee;
  --radius: 16px;
  --tap: 52px;
  --shadow: 0 1px 2px rgba(120, 30, 70, .06), 0 4px 14px rgba(120, 30, 70, .07);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

/* pwa-only */
:root { padding-top: env(safe-area-inset-top, 0px); }
/* end-pwa-only */

* { box-sizing: border-box; }
html, body { margin: 0; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--text); text-decoration-color: var(--primary-line); text-decoration-thickness: 2px; }

/* ---------- Grundlayout ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--bar);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.01em; color: var(--text); font-size: 18px; }
.brand img { border-radius: 8px; }
.topbar-title { font-weight: 600; color: var(--muted); font-size: 15px; }

main {
  max-width: 640px; margin: 0 auto;
  padding-block: 16px calc(110px + var(--safe-b));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  outline: none;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 62px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: -.01em; min-width: 0;
}
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--text); }
.tabbar a.active svg { background: var(--primary); border-radius: 12px; padding: 2px 10px; width: 46px; }

h1 { font-size: 26px; line-height: 1.15; margin: 4px 0 14px; letter-spacing: -.02em; }
h2 { font-size: 19px; margin: 0 0 10px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card > h2:first-child { margin-top: 0; }
.card.compact { padding: 12px; margin-bottom: 10px; }
.card.compact h2 { font-size: 17px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.card.compact h3 { margin: 12px 2px 6px; }
.card.compact .field { margin-bottom: 8px; }
.date-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.date-row input { min-height: 46px; font-size: 16px; padding: 8px 10px; }
.date-hint { margin: 4px 2px 8px; }
.pick-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 6px; }
.pick-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.chip.small { min-height: 42px; padding: 6px 12px; font-size: 15px; min-width: 0; }
.chip.tour { min-height: 46px; min-width: 64px; font-size: 18px; padding: 6px 12px; }
.km-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.km-col { min-width: 0; }
.km-col h2 { white-space: nowrap; }
.km-card input { min-height: 46px; padding: 8px 10px; }
.km-card input.mid { font-size: 20px; }
.km-card input.strong { border-color: var(--primary-line); }
.km-card input[type=time] { font-size: 16px; }
.lbl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin: 0 0 6px 2px; }
.lbl-row > span { font-size: 14px; font-weight: 600; color: var(--muted); }
.now-link { border: 0; background: var(--primary-soft); color: var(--text); font-weight: 800; font-size: 13px; border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.card.compact .calc { margin: 0 2px; }
.quick { display: grid; gap: 8px; margin-bottom: 10px; }
.quick-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--surface); border-radius: 14px; padding: 8px 10px; box-shadow: var(--shadow); }
.quick-label { font-size: 13px; font-weight: 800; margin-right: 4px; }
.quick-note { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.quick-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.quick-btn { display: flex; flex-direction: row; flex-wrap: wrap; column-gap: 10px; row-gap: 1px; align-items: center; align-content: center; text-align: left; min-height: 52px; padding: 8px 10px; border-radius: 14px; border: 0; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none; cursor: pointer; font: inherit; min-width: 0; }
.quick-btn b { font-size: 14px; }
.quick-btn span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.counter.final { margin: 0 0 10px; }

/* ---------- Formularelemente ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span, .field-label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; }
input[type=text], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: var(--tap);
  padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--field); font-size: 18px;
  -webkit-appearance: none; appearance: none;
}
input[type=date], input[type=time] { display: block; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-line); box-shadow: 0 0 0 3px var(--primary-soft); }
input.big { font-size: 28px; font-weight: 700; min-height: 64px; }
.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .row3 { grid-template-columns: 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 12px 18px; border-radius: 14px; border: 0;
  background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 17px;
  cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--text); text-decoration: underline; text-decoration-color: var(--primary-line); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 60px; font-size: 19px; }
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }

/* Chips (Tour, Fahrzeug, Datum) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: var(--tap); min-width: 64px; padding: 10px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--field); font-weight: 700; font-size: 17px; cursor: pointer;
}
.chip[aria-pressed=true] { background: var(--primary); border-color: var(--primary-line); color: var(--primary-ink); }
.chip.tour { font-size: 20px; min-width: 88px; border-radius: 14px; }
.chip .sub { display: block; font-size: 12px; font-weight: 600; opacity: .8; }

/* Ärzte-Checkboxen */
.doclist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.doclist:empty { display: none; }
.doc {
  display: flex; align-items: center; gap: 14px;
  min-height: 54px; padding: 8px 10px; border-radius: 12px; min-width: 0; gap: 10px;
  border: 1.5px solid var(--doc); background: var(--doc-soft); cursor: pointer; user-select: none;
}
.doc input { position: absolute; opacity: 0; pointer-events: none; }
.doc .box {
  flex: 0 0 28px; height: 28px; border-radius: 8px; border: 2px solid var(--doc-line); background: var(--field);
  display: grid; place-items: center; transition: background .12s, border-color .12s;
}
.doc .box svg { width: 18px; height: 18px; stroke: var(--primary-ink); stroke-width: 3.2; fill: none; opacity: 0; stroke-linecap: round; stroke-linejoin: round; }
.doc .name { font-weight: 600; font-size: 15px; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.doc-text { min-width: 0; flex: 1; }
.doc .note { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.doc.checked { border-color: var(--doc-line); background: var(--doc); }
.doc.checked .box { background: var(--field); border-color: var(--doc-line); }
.doc.checked .box svg { stroke: #000; }
.doc.checked .box svg { opacity: 1; }
.doc:focus-within { box-shadow: 0 0 0 3px var(--doc-soft); }
.doc.extra { cursor: default; padding-right: 4px; }
.x-btn { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--field); font-size: 22px; line-height: 1; cursor: pointer; color: var(--text); }
.extra-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.extra-add input { border-color: var(--doc); min-height: 48px; font-size: 16px; }
.extra-add .btn { min-height: 48px; background: var(--doc); }
.small-switch { font-size: 14px; min-height: 44px; }
.small-switch input { transform: scale(.85); }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--tag-bg); color: var(--tag-fg); vertical-align: 2px; margin-left: 6px; }

.counter.final { margin: 0 0 14px; padding: 16px; background: var(--primary-soft); border: 2px solid var(--primary-line); font-size: 18px; }
.counter.final b { font-size: 30px; }
.counter {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 700; margin-top: 10px;
}
.counter b { font-size: 22px; color: var(--text); }

details.more { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
details.more summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 700; color: var(--primary); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); margin-right: 10px; }
details.more[open] summary::before { content: "–"; }
.calc { font-size: 15px; color: var(--muted); margin: -4px 2px 8px; }
.calc b { color: var(--text); }

.savebar { padding: 4px 0 0; }
.running { border: 2px solid var(--primary-line); display: grid; gap: 8px; padding: 12px; margin-bottom: 10px; }
.running-head { display: flex; align-items: center; gap: 10px; }
.running-head { flex-wrap: wrap; }
.running-head .muted { margin-left: auto; }
.running-body { font-size: 15px; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(224, 86, 59, .5); } 70% { box-shadow: 0 0 0 10px rgba(224, 86, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(224, 86, 59, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.step h2 { display: flex; align-items: center; gap: 10px; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--text); font-size: 15px; font-weight: 800; flex: 0 0 auto; }
input.mid { font-size: 22px; font-weight: 700; }
label.field > span.with-now { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin: 0; font-size: inherit; font-weight: inherit; color: inherit; }
.with-now input { min-width: 0; padding-left: 10px; padding-right: 6px; }
.btn.now { min-height: var(--tap); padding: 8px 18px; font-size: 16px; }
.save-note { text-align: center; margin: 0 0 4px; min-height: 0; }
.save-note:empty { display: none; }
.badge-open { display: inline-block; font-size: 13px; font-weight: 800; padding: 4px 9px; border-radius: 999px; background: var(--tag-bg); color: var(--tag-fg); }
.hint { padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); font-size: 15px; margin-bottom: 10px; }
.hint.ok { background: var(--primary-soft); }
.editing-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--banner); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }

/* ---------- Startseite & Stunden ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hours-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--primary-line); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; cursor: pointer; }
.hours-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hours-big { text-align: center; padding: 10px 0 14px; }
.hours-big b { display: block; font-size: 44px; line-height: 1.1; }
.hours-big span { color: var(--muted); font-size: 15px; }
.hours-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.hours-grid div { background: var(--surface-2); border-radius: 12px; padding: 10px; text-align: center; }
.hours-grid b { display: block; font-size: 22px; }
.hours-grid span { font-size: 13px; color: var(--muted); }
.start-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; text-align: center; }
.start-btn { min-height: 76px; font-size: 22px; border-radius: 18px; }
.start-btn svg { width: 28px; height: 28px; stroke-width: 2.6; }
.start-card p { margin: 10px 0 0; }
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.form-head h1 { margin: 4px 0 10px; }

.swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px 6px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 2px; cursor: pointer; color: var(--text); font: inherit; min-width: 0; }
.swatch .dot { width: 44px; height: 44px; border-radius: 50%; background: var(--sw); border: 2px solid var(--sw-line); display: grid; place-items: center; }
.swatch .dot svg { width: 22px; height: 22px; fill: none; stroke: #000; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.swatch[aria-checked=true] .dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #000; }
.swatch[aria-checked=true] .dot svg { opacity: 1; }
.swatch .sw-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.dl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Monat ---------- */
.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.monthnav .label { font-size: 22px; font-weight: 800; text-align: center; flex: 1; }
.iconbtn { width: var(--tap); height: var(--tap); border-radius: 14px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 24px; font-weight: 700; cursor: pointer; color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: 14px; padding: 10px 8px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.entry {
  color: var(--text);
  display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 12px;
  width: 100%; text-align: left; background: var(--surface); border: 0; border-radius: 14px; padding: 12px;
  box-shadow: var(--shadow); margin-bottom: 8px; cursor: pointer; min-height: 70px;
}
.entry .date { text-align: center; background: var(--surface-2); border-radius: 10px; padding: 6px 0; }
.entry .date b { display: block; font-size: 20px; line-height: 1; }
.entry .date span { font-size: 12px; color: var(--muted); font-weight: 700; }
.entry .main b { font-size: 17px; }
.entry .main div { font-size: 14px; color: var(--muted); }
.entry .kmd { font-weight: 800; font-size: 18px; color: var(--text); white-space: nowrap; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; stroke: var(--box-line); fill: none; stroke-width: 1.5; }

.minigrid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.minigrid { border-collapse: collapse; font-size: 12px; background: var(--surface); }
table.minigrid th, table.minigrid td { border: 1px solid var(--grid-line); text-align: center; min-width: 24px; height: 26px; padding: 0 2px; }
table.minigrid th.dn, table.minigrid td.dn { position: sticky; left: 0; background: var(--surface); text-align: left; min-width: 150px; max-width: 170px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; font-weight: 600; }
table.minigrid .we { background: var(--weekend); color: var(--weekend-ink); }
table.minigrid .na { background: var(--na); }
table.minigrid .wd { font-size: 10px; color: var(--muted); }
table.minigrid td.x { font-weight: 800; }
table.minigrid tr.sum td { font-size: 10px; color: var(--muted); border-color: var(--line); }

/* ---------- Kalender ---------- */
.cal-card { padding: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head div { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 0 6px; }
.cal-cell {
  min-height: 64px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--field);
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 4px 3px; cursor: pointer; text-align: left; color: var(--text);
}
.cal-cell.empty { border: 0; background: transparent; cursor: default; }
.cal-cell.we { background: var(--surface-2); }
.cal-cell.today { border: 2px solid var(--primary-line); }
.cal-num { font-size: 13px; font-weight: 700; padding-left: 2px; display: flex; align-items: center; gap: 3px; }
.cal-note { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-line); display: inline-block; }
.cal-chip { display: block; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 2px 1px; letter-spacing: -.02em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1.5px solid var(--primary-line); color: var(--text); background: var(--field); }
.cal-chip.done { background: var(--primary); }
.cal-chip.running { background: var(--primary-soft); border-style: dashed; }
.cal-chip.missed { border-color: var(--box-line); color: var(--muted); text-decoration: line-through; }
.cal-chip.unplanned { border-style: dotted; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; color: var(--muted); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .cal-chip { display: inline-block; }
.plan-today { border: 2px dashed var(--primary-line); }
table.minigrid tr.extra-row td.dn { font-style: italic; }

/* ---------- Einstellungen ---------- */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.list-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 58px; padding: 8px 8px 8px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; color: var(--text);
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; font-weight: 600; }
.list-item .grow small { color: var(--muted); font-size: 13px; }
.list-item .chev { color: var(--box-line); font-size: 22px; padding-right: 8px; }
.mini { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--surface-2); font-size: 18px; cursor: pointer; color: var(--text); }
.mini:disabled { opacity: .3; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 4px 2px; cursor: pointer; }
.switch input { width: 52px; height: 32px; appearance: none; -webkit-appearance: none; background: var(--switch-off); border-radius: 999px; position: relative; cursor: pointer; flex: 0 0 auto; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- Blutstropfen beim Speichern ---------- */
.drops { position: fixed; width: 0; height: 0; z-index: 60; pointer-events: none; }
.drop { position: absolute; left: -9px; top: -12px; width: 18px; height: 24px; animation: drop-fly 1.1s cubic-bezier(.2, .7, .3, 1) forwards; opacity: 0; }
.drop svg { width: 100%; height: 100%; display: block; }
.drop svg path { fill: var(--drop); }
.drop svg path.shine { fill: none; stroke: rgba(255, 255, 255, .75); stroke-width: 2; stroke-linecap: round; }
@keyframes drop-fly {
  0% { opacity: 0; transform: translate(0, 0) scale(calc(var(--s) * .4)); }
  15% { opacity: 1; }
  60% { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(var(--s)); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 60px)) scale(var(--s)); }
}

/* ---------- Dialog & Toast ---------- */
dialog#modal {
  border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 24px));
  box-shadow: 0 20px 60px rgba(0,0,0,.25); background: var(--surface); color: var(--text);
}
dialog#modal::backdrop { background: var(--scrim); }
.modal-body { padding: 20px 18px 8px; }
.modal-body p { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; padding: 10px 18px 18px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 120px; }

#toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 64px); transform: translate(-50%, -16px);
  background: var(--toast-bg); color: var(--toast-fg); padding: 12px 18px; border-radius: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.has-action { display: flex; align-items: center; gap: 14px; pointer-events: auto; padding-right: 8px; white-space: nowrap; }
#toast:not(.show) { pointer-events: none; }
.toast-action { border: 0; border-radius: 10px; background: var(--primary); color: var(--primary-ink); font-weight: 800; font-size: 15px; padding: 8px 12px; min-height: 40px; cursor: pointer; }
.entry-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: stretch; margin-bottom: 8px; }
.entry-row .entry { margin-bottom: 0; }
.entry-actions { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.mini.del { background: var(--danger-soft); }
.add-later { margin-bottom: 12px; border: 1.5px dashed var(--primary-line); background: var(--surface); }
table.minigrid td.cell { cursor: pointer; }
table.minigrid td.cell:hover, table.minigrid td.cell:focus-visible { outline: 2px solid var(--primary-line); outline-offset: -2px; }

.backup-warn { border-left: 5px solid var(--accent); }

/* ---------- Druckansicht ---------- */
#print-view { background: var(--desk); min-height: 100vh; }
.print-toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.print-toolbar .btn { min-height: 46px; padding: 8px 14px; font-size: 16px; }
.print-toolbar select { width: auto; min-height: 46px; font-size: 16px; padding: 8px 12px; }
.print-pages { padding: 16px; overflow-x: auto; }
.sheet { background: #fff; color: #000; margin: 0 auto 20px; padding: 12mm 10mm; box-shadow: 0 2px 10px rgba(0,0,0,.12); font-family: Calibri, Carlito, Arial, sans-serif; }
.sheet-tour { width: 297mm; min-height: 160mm; }
.sheet-log { width: 210mm; min-height: 297mm; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.sheet-head h2 { font-size: 18px; margin: 0; }
.sheet .brand { font-size: 13px; color: #000; }
.sheet .legend { font-size: 11px; color: #444; margin: 8px 0 0; }
table.grid { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 12px; }
table.grid col.c-name { width: 52mm; }
table.grid th, table.grid td { border: 1px solid #000; height: 6.2mm; text-align: center; padding: 0; }
table.grid tr.wd th { border: 0; font-size: 8px; height: 4mm; vertical-align: bottom; }
table.grid tr.num th { font-size: 12px; border-top: 2px solid #000; }
table.grid tr.num th.tname { text-align: left; padding-left: 4px; font-size: 14px; }
table.grid td.dname { text-align: left; padding-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
table.grid th:first-child, table.grid td:first-child { width: 52mm; border-left: 2px solid #000; }
table.grid th.note, table.grid td.note { width: 20mm; font-size: 8px; font-style: italic; border-right: 2px solid #000; }
table.grid td:nth-child(2) { border-right: 2px solid #000; }
table.grid tr > :last-child { border-right: 2px solid #000; }
table.grid tbody tr:last-child td { border-bottom: 2px solid #000; height: 4mm; }
table.grid tr.blank td { height: 4mm; }
table.grid tbody td:not(.dname):not(.note) { font-weight: 700; font-size: 13px; }
table.grid .we { background: #fff27a; }
table.grid .na { background: #d9d9d9; }
table.grid tr.wd th.na { background: transparent; }
table.grid tfoot td { border: 0; font-size: 9px; height: 4.5mm; }
table.grid tfoot td:not(:empty):not(.lbl) { border: 1px solid #888; }
table.grid tfoot td.lbl { text-align: left; font-style: italic; color: #555; border: 0 !important; }
table.grid tfoot td.lbl.r { text-align: right; font-style: normal; font-weight: 700; color: #000; padding-right: 4px; }
table.grid tfoot tr td:first-child, table.grid tfoot tr > :last-child { border-left: 0; border-right: 0; }
.log-meta { margin: 10px 0 14px; display: grid; gap: 6px; font-size: 15px; }
.log-meta b { text-decoration: underline; display: inline-block; width: 64px; }
table.log { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 11.5px; }
table.log th { text-align: left; vertical-align: top; font-size: 10.5px; padding: 3px; background: #fce4ec; border: 1px solid #000; border-top: 2px solid #000; border-bottom: 2px solid #000; }
table.log td { border: 1px solid #000; height: 7mm; padding: 0 3px; }
table.log td.c { text-align: center; }
table.log tr > :first-child { border-left: 2px solid #000; }
table.log tr > :last-child { border-right: 2px solid #000; }
table.log tbody tr:last-child td { border-bottom: 2px solid #000; }
table.log tfoot td { border: 0 !important; font-weight: 700; height: 8mm; }

.signature { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12mm; margin-top: 12mm; font-size: 12px; }
.signature div { grid-column: 2; }
.signature div { display: flex; align-items: flex-end; gap: 6px; position: relative; }
.signature .sigline { flex: 1; border-bottom: 1px solid #000; height: 9mm; }
.signature small { position: absolute; right: 0; top: 100%; font-size: 9px; color: #555; }

@page tour { size: A4 landscape; margin: 8mm; }
@page log { size: A4 portrait; margin: 10mm; }
@media print {
  body { background: #fff; }
  #app, #toast, .print-toolbar, dialog { display: none !important; }
  #print-view { display: block !important; background: #fff; }
  .print-pages { padding: 0; overflow: visible; }
  .sheet { box-shadow: none; margin: 0; padding: 0; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet:last-child { break-after: auto; }
  .sheet-tour { page: tour; width: auto; min-height: 0; }
  .sheet-log { page: log; width: auto; min-height: 0; }
}
