/* Layout: feste Navigation links (mobil unten), Arbeitsfläche rechts.
   Farben angelehnt an Verkehrsschilder: Parkschild-Blau als Akzent,
   Fahrbahnmarkierungs-Gelb für "jetzt / als Nächstes". */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --line: #d6dce5;
  --fg: #1d2429;
  --muted: #676c72;       /* Medical-Eins-Grau */
  --accent: #246681;      /* Medical-Eins-Petrol */
  --accent-ink: #ffffff;
  --accent-soft: #e2eef2;
  --brand-grey: #676c72;
  --nav-accent: #7cc0d6;
  --signal: #f2b705;      /* Markierungsgelb */
  --signal-ink: #2b2200;
  --phone: #7b4bb3;
  --phone-soft: #efe7f8;
  --ok: #1f7a4d; --ok-soft: #e2f3ea;
  --warn: #a35a00; --warn-soft: #fbefdc;
  --bad: #b3261e; --bad-soft: #fbe4e2;
  --nav-bg: #173a48; --nav-fg: #cfdde3; --nav-active: #ffffff;
  --shadow: 0 1px 2px rgba(23, 58, 72, .08), 0 4px 16px rgba(23, 58, 72, .06);
  --f-display: 'Barlow Semi Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --f-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1619; --surface: #172126; --surface-2: #1d2a30; --line: #2b3b42; --fg: #e5ecef; --muted: #a3a8ad;
    --accent: #6fb3cb; --accent-ink: #06171d; --accent-soft: #15313b; --brand-grey: #a3a8ad; --signal: #f5c533; --signal-ink: #2b2200;
    --phone: #b48ce6; --phone-soft: #2a2140; --ok: #5cc48e; --ok-soft: #173326; --warn: #f0a64a; --warn-soft: #3a2a14;
    --bad: #f08a80; --bad-soft: #3d1c1a; --nav-bg: #0b1d24; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1619; --surface: #172126; --surface-2: #1d2a30; --line: #2b3b42; --fg: #e5ecef; --muted: #a3a8ad;
  --accent: #6fb3cb; --accent-ink: #06171d; --accent-soft: #15313b; --brand-grey: #a3a8ad; --signal: #f5c533; --signal-ink: #2b2200;
  --phone: #b48ce6; --phone-soft: #2a2140; --ok: #5cc48e; --ok-soft: #173326; --warn: #f0a64a; --warn-soft: #3a2a14;
  --bad: #f08a80; --bad-soft: #3d1c1a; --nav-bg: #0b1d24; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--f-body); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: .005em; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--accent); }
.mono, .time { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* App-Rahmen */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); height: 100%; }
.nav { background: var(--nav-bg); color: var(--nav-fg); display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; font-family: var(--f-display); font-size: 22px; font-weight: 700; color: #fff; line-height: 1.05; }
.brand-logo { width: 40px; height: 40px; border-radius: 8px; background: #fff; display: grid; place-items: center; flex: none; }
.brand-logo img { width: 26px; height: auto; display: block; }
.brand-text small { display: block; font-family: var(--f-body); font-size: 11.5px; font-weight: 500; color: var(--nav-fg); letter-spacing: .01em; margin-top: 2px; }
.nav nav { display: flex; flex-direction: column; gap: 2px; }
.nav nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 6px; color: var(--nav-fg); text-decoration: none; font-weight: 500; }
.nav nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav nav a.active { background: rgba(255,255,255,.12); color: var(--nav-active); box-shadow: inset 3px 0 0 var(--nav-accent); }
.nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-sync { width: 100%; justify-content: center; margin-bottom: 8px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.nav-sync:hover { border-color: var(--nav-accent); }
.nav-install { display: none; background: var(--accent); border-color: var(--nav-accent); }
body.can-install .nav-install { display: flex; }
.nav-foot { margin-top: auto; font-size: 12px; padding: 0 8px; color: #9fb4bd; }
.nav-foot .copy { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.12); color: #b9c9cf; }
.m-brand { display: none; }
.l-short { display: none; }
main { overflow: auto; min-width: 0; outline: none; }
.view > * { min-width: 0; }
.view { padding-block: 22px 40px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; max-width: 1500px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view-head .sub { color: var(--muted); margin-top: 3px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Bausteine */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel > h2, .panel > h3 { margin-bottom: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }

button, .btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 6px; padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.3; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; border-color: transparent; color: var(--accent); padding-inline: 6px; }
button.danger { color: var(--bad); }
button:disabled { opacity: .55; cursor: default; }
button.sm, .btn.sm { padding: 4px 8px; font-size: 12.5px; }

input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; width: 100%; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.A { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.B { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.C { background: var(--surface-2); color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.phone { background: var(--phone-soft); color: var(--phone); border-color: transparent; }
.chip.visit { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.park-line { display: inline-flex; gap: 7px; align-items: flex-start; }
.park-line .p-sign { margin-top: 1px; }
.park-line b { font-weight: 500; }
.park-note { color: var(--muted); }
.next-card .park-note { color: inherit; opacity: .8; }
.p-sign { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; background: #1559b0; color: #fff; font: 700 12px/1 var(--f-display); border: 1.5px solid #fff; box-shadow: 0 0 0 1px #1559b0; flex: none; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* KPI-Kacheln */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.kpi .v { font-family: var(--f-display); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 2px; }

/* Zeitstrahl (Tour + Infobildschirm) */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 52px 26px minmax(0, 1fr); gap: 0 8px; align-items: start; position: relative; }
.tl-item .time { font-size: 13px; padding-top: 9px; color: var(--muted); text-align: right; }
.tl-item .dot { width: 26px; display: flex; justify-content: center; position: relative; align-self: stretch; }
.tl-item .dot::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-item .dot i { position: relative; margin-top: 8px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11.5px/1 var(--f-body); font-style: normal; background: var(--surface); border: 2px solid var(--line); color: var(--muted); }
.tl-item .body { padding: 6px 0 8px; min-width: 0; }
.tl-visit .dot i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tl-visit.fixed .dot i { background: var(--fg); border-color: var(--fg); color: var(--surface); }
.tl-phone .dot i { background: var(--phone); border-color: var(--phone); color: #fff; }
.tl-drive .body, .tl-idle .body, .tl-lunch .body { color: var(--muted); font-size: 12.5px; padding-top: 9px; }
.tl-drive .dot i, .tl-idle .dot i, .tl-lunch .dot i { width: 10px; height: 10px; margin-top: 13px; }
.tl-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.tl-visit .tl-card { border-left: 3px solid var(--accent); }
.tl-visit.fixed .tl-card { border-left-color: var(--fg); }
.tl-phone .tl-card { border-left: 3px solid var(--phone); background: var(--phone-soft); }
.tl-suggest .tl-card { border: 1px dashed var(--phone); background: transparent; }
.tl-block .tl-card { border-left: 3px solid var(--muted); }
.tl-title { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tl-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* Karte */
.map { height: 620px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); z-index: 0; }
.map.small { height: 280px; }
.marker-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 13px/1 var(--f-body); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.marker-num.fixed { background: #676c72; }
.marker-num.cand { background: #fff; color: #5b6878; border-color: #9aa7b6; width: 16px; height: 16px; font-size: 0; }
.marker-num.cand.due { border-color: #b3261e; }
.marker-home { width: 32px; height: 32px; border-radius: 6px; background: #f2b705; border: 2px solid #17212e; display: grid; place-items: center; font: 700 14px/1 var(--f-display); color: #17212e; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.marker-home.end { background: #fff; }
.marker-p { width: 20px; height: 20px; border-radius: 3px; background: #1559b0; color: #fff; display: grid; place-items: center; font: 700 13px/1 var(--f-display); border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.marker-p.alt { background: #fff; color: #1559b0; border-color: #1559b0; }
.leaflet-popup-content { font: 13px/1.45 var(--f-body); }
.leaflet-container { font-family: var(--f-body); }

/* Infobildschirm */
.info { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 16px; }
.info-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 4px 0 6px; border-bottom: 3px solid var(--fg); }
.info-hero .clock { font-family: var(--f-display); font-size: 64px; font-weight: 600; line-height: .95; font-variant-numeric: tabular-nums; }
.info-hero .date { font-family: var(--f-display); font-size: 24px; font-weight: 500; }
.next-card { background: var(--signal); color: var(--signal-ink); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.next-card .label { color: var(--signal-ink); opacity: .75; }
.next-card h2 { font-size: 26px; }
.next-card .count { font-family: var(--f-display); font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.next-card a { color: inherit; }
.agenda-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); align-items: start; }
.agenda-row:last-child { border-bottom: 0; }
.agenda-row .t { font-family: var(--f-mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.agenda-row.past { opacity: .55; }
.agenda-row.now { background: var(--accent-soft); border-radius: 6px; }
.agenda-row .what { font-weight: 600; font-size: 15px; }
body.kiosk .nav { display: none; }
html.native-app .nav nav a.nav-changelog { display: none; }
body.kiosk .app { grid-template-columns: minmax(0, 1fr); }
body.kiosk .info-hero .clock { font-size: 96px; }
body.kiosk .agenda-row .what { font-size: 18px; }
body.kiosk .agenda-row .t { font-size: 18px; }

/* Kalender */
.cal { display: grid; grid-template-columns: 52px repeat(var(--days, 7), minmax(110px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); position: relative; min-width: 720px; }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 6px; font-weight: 600; text-align: center; }
.cal-head.today { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.cal-head .small { font-weight: 400; }
.cal-hours { grid-row: 2; position: relative; }
.cal.with-allday .cal-hours, .cal.with-allday .cal-day { grid-row: 3; }
.cal-allday { grid-row: 2; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; background: var(--surface-2); min-width: 0; }
.cal-allday-l { border-left: 0; align-items: center; justify-content: center; font-size: 13px; }
.mark-pill { font-size: 12px; padding: 2px 7px; border-radius: 6px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--accent); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; cursor: pointer; }
.mark-pill.soon { border-style: solid; font-weight: 600; } .mark-pill.over { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.mark-plan { font-size: 11.5px; padding: 1px 6px; border: 0; background: none; color: var(--accent); text-align: left; cursor: pointer; }
.cal-marks { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.mark-row { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin: 4px 0; } .mark-row .label { min-width: 90px; }
.cal-marks .sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.cal-marks > button.sm { margin-left: auto; }
.cal-hours div { position: absolute; right: 6px; font: 11.5px var(--f-mono); color: var(--muted); transform: translateY(-50%); }
.cal-day { grid-row: 2; position: relative; border-left: 1px solid var(--line); cursor: copy; }
.cal-day.weekend { background: var(--surface-2); }
.cal-day .hl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); opacity: .6; pointer-events: none; }
.cal-day .off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--line) 6px 7px); opacity: .45; pointer-events: none; }
.cal-offlabel { font-size: 11px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-offlabel.feiertag { color: var(--warn); }
.cal-offlabel.urlaub, .cal-offlabel.betriebsurlaub { color: var(--phone); }
.cal-day .off.off-feiertag { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--warn-soft) 6px 12px); opacity: 1; }
.cal-day .off.off-urlaub, .cal-day .off.off-betriebsurlaub { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--phone-soft) 6px 12px); opacity: 1; }
.cal-ev { position: absolute; left: 3px; right: 3px; border-radius: 5px; padding: 3px 6px; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; border: 1px solid transparent; z-index: 2; }
.cal-ev.visit { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.cal-ev.phone { background: var(--phone-soft); border-left: 3px solid var(--phone); }
.cal-ev.block { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--muted); }
.cal-ev.done { opacity: .6; }
.cal-ev:not(.done) { touch-action: none; cursor: grab; }
.cal-ev.dragging { cursor: grabbing; box-shadow: 0 6px 18px rgba(0,0,0,.2); z-index: 5; opacity: .92; }
.cal-ev.short { white-space: nowrap; text-overflow: ellipsis; padding-top: 1px; }
.cal-moving { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); border-radius: var(--r); padding: 8px 12px; font-size: 13.5px; }
.cal.moving .cal-day { cursor: crosshair; } .cal.moving .cal-day:hover { background: var(--accent-soft); }
@media (pointer: coarse) { .cal-ev:not(.done) { touch-action: pan-y; cursor: pointer; } }
@media (max-width: 760px) {
  .cal { min-width: 0; grid-template-columns: 38px repeat(var(--days, 3), minmax(0, 1fr)); }
  .cal-head { padding: 6px 2px; font-size: 13px; } .cal-head .small { display: block; font-size: 11.5px; }
  .cal-hours div { font-size: 10px; right: 3px; }
  .cal-ev { font-size: 11.5px; padding: 2px 4px; left: 1px; right: 1px; }
  .cal-offlabel { font-size: 10px; }
}
.cal-ev.short .t b { color: var(--fg); font-family: var(--f-body); }
.cal-ev.done .t::after { content: " ✓"; color: var(--ok); }
.cal-ev .t { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }

/* Öffnungszeiten-Editor */
.hours-grid { display: grid; grid-template-columns: 34px 70px repeat(2, minmax(0, 1fr)); gap: 6px 8px; align-items: center; }
.hours-grid .win { display: flex; gap: 4px; align-items: center; }
.hours-grid input[type="time"] { width: 100%; padding: 5px 6px; }
.open-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.open-strip span { height: 6px; border-radius: 2px; background: var(--line); }
.open-strip span.on { background: var(--ok); }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; background: var(--surface); color: var(--fg); width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 18, 28, .45); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 42px); }
.dlg-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dlg-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.dlg-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dlg-foot .right { display: flex; gap: 8px; margin-left: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 0; flex-wrap: wrap; }
.tabs button { border: 0; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--accent); }
.confirm-bar { display: flex; gap: 8px; align-items: center; background: var(--bad-soft); color: var(--bad); padding: 6px 10px; border-radius: 6px; }

.cl-box { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.cl-row { border: 0; border-bottom: 1px solid var(--line); margin: 0; padding: 6px 0 8px; min-width: 0; }
.cl-row:last-child { border-bottom: 0; }
.cl-row legend { padding: 0; margin-bottom: 4px; }
.cl-row.cl-done legend b { color: var(--muted); }
.cl-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-opt { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 7px; cursor: pointer; font-size: 13px; background: var(--surface); }
.cl-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cl-opt.final:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.cl-opt input { margin: 0; accent-color: var(--accent); }
.cl-state { color: var(--warn); font-weight: 400; }
.mic.rec { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .mic.rec { animation: none; } }
.next-btn { background: var(--signal-ink); color: var(--signal); border-color: var(--signal-ink); font-weight: 700; padding: 9px 16px; }
.wk-zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.wk-zones .field { gap: 4px; }
.wk-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.wk-list { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; }
.wk-list li.ph { color: var(--phone); list-style: none; margin-left: -20px; }
.chip.spec { background: var(--surface); color: var(--fg); border-color: var(--line); font-weight: 500; }
.cl-spec summary { cursor: pointer; margin-top: 6px; color: var(--muted); }
.cov { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.cov #cu-zones { max-height: 460px; overflow: auto; }
.cov tr.sel td { background: var(--accent-soft); }
.cov-legend { flex-wrap: wrap; }
@media (max-width: 1000px) { .cov { grid-template-columns: minmax(0, 1fr); } }
.stackbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); margin: 8px 0 6px; }
.stackbar span { display: block; height: 100%; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 2px; }
.goal { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.goal + .goal { border-top: 1px solid var(--line); }
.goal-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.goal-bar { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); }
.goal-bar span { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.goal-bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); border-radius: 1px; }
.cu-cell { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cu-main { min-width: 0; }
.nav-btn { flex: none; white-space: nowrap; color: var(--accent); border-color: var(--accent); font-weight: 600; }
.nav-btn .p-sign { width: 15px; height: 15px; font-size: 10px; box-shadow: none; }
.nav-btn:hover { background: var(--accent-soft); }
@media (max-width: 760px) { .nav-btn { padding: 8px 12px; } }
.srv-login { position: fixed; inset: 0; z-index: 5000; background: var(--bg); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px; overflow: auto; }
.srv-box { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.srv-box .brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-size: 20px; font-weight: 700; color: var(--fg); }
.srv-box h1 { font-size: 22px; }
.srv-login[hidden] { display: none; }
body.srv-locked .app { visibility: hidden; }
.srv-badge { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.08); margin-bottom: 8px; display: inline-block; }
.srv-badge.ok { color: #7fdcae; } .srv-badge.warn { color: #f5c533; } .srv-badge.bad { color: #f08a80; }
.hit { color: var(--accent); }
.share-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.share-rep { border-bottom: 1px solid var(--line); padding: 6px 0; font-size: 13px; }
.shared-panel { border-color: var(--accent); }
.map-pan.leaflet-bar { display: grid; grid-template-columns: repeat(3, 28px); grid-auto-rows: 28px; background: rgba(255,255,255,.92); border-radius: 8px; overflow: hidden; }
.map-pan button { all: unset; display: grid; place-items: center; width: 28px; height: 28px; cursor: pointer; color: #1d2429; font-size: 13px; }
.map-pan button:hover, .map-pan button:focus-visible { background: var(--accent-soft); outline: none; }
.map-pan [data-home] { font-size: 16px; color: var(--accent); }
.map-pan button.lock { font-size: 13px; } .map-pan button.lock.on { background: var(--accent-soft); }
.map-filter { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.map-filter .label { margin-right: 4px; }
.map-filter .mf { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.map-filter .mf input { width: 15px; height: 15px; margin: 0; }
.map-filter .mf i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.map-filter .mf.tour i { background: var(--accent); } .map-filter .mf.over i { background: #b3261e; } .map-filter .mf.soon i { background: #d99a00; } .map-filter .mf.not i { background: #8a9199; } .map-filter .mf.mark i { background: #7b4bb3; }
.map-filter .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.marker-num.cand.over, .marker-num.cand.due { background: #b3261e; }
.marker-num.cand.soon { background: #d99a00; }
.marker-num.cand.not { background: #8a9199; opacity: .85; }
.marker-num.cand.over, .marker-num.cand.soon, .marker-num.cand.not, .marker-num.cand.mark { border-color: #fff; }
.marker-num.cand.mark { background: #7b4bb3; font-size: 8px; line-height: 12px; text-align: center; }
.cu-acts { display: flex; flex-direction: column; gap: 4px; align-items: stretch; flex: none; }
.cu-mark { white-space: nowrap; }
.chip.mark { background: var(--accent-soft); color: var(--accent); }
.mark-opts { display: flex; flex-direction: column; gap: 8px; }
.mark-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.mark-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mark-opt > input { margin-top: 4px; }
.mark-opt > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mark-opt small { color: var(--muted); font-size: 12.5px; }
.mark-opt input[type=date], .mark-opt select { max-width: 280px; }
.warn-t { color: var(--warn); }
.rhythm-set .toolbar { align-items: center; }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
.nav-phone[hidden] { display: none; }
.phone-setup { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.qr-big { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; } .qr-big svg { display: block; width: 100%; height: auto; }
@media (max-width: 600px) { .phone-setup { grid-template-columns: 1fr; } .qr-big { max-width: 260px; margin: 0 auto; } }
.filter-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.filter-wrap > summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; font-weight: 600; }
.filter-wrap > summary::-webkit-details-marker { display: none; }
.filter-wrap > summary .filter-title::before { content: "▸ "; color: var(--muted); } .filter-wrap[open] > summary .filter-title::before { content: "▾ "; }
.filter-count { font-weight: 400; font-size: 13px; color: var(--muted); } .filter-count b { color: var(--fg); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; padding: 0 12px 12px; }
.filter-bar label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.filter-bar label > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.filter-bar select { max-width: 220px; }
.filter-sum { margin-left: auto; align-self: center; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; } .filter-sum b { color: var(--fg); }
@media (max-width: 760px) { .filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .filter-bar select { max-width: none; width: 100%; } .filter-sum { grid-column: 1 / -1; margin-left: 0; justify-content: space-between; } }
.qr-scan { position: fixed; inset: 0; z-index: 6000; background: #000; }
.qr-scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.qr-frame { position: absolute; left: 50%; top: 50%; width: min(68vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid #7cc0d6; border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.qr-top, .qr-bottom { position: absolute; left: 0; right: 0; color: #fff; text-align: center; padding: 16px; font-size: 15px; }
.qr-top { top: 0; padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.qr-bottom { bottom: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.qr-msg { font-size: 13px; opacity: .85; } .qr-cancel { min-width: 160px; }
.dup-help { margin: 6px 0 0; padding-left: 18px; color: var(--muted); } .dup-help li { margin: 2px 0; } .dup-help b { color: var(--fg); }
.dup-group .confirm-bar { margin-top: 8px; }
.upd-notice { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upd-bar { position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 4000; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 14px; max-width: 520px; margin: 0 auto; }
.upd-text { font-size: 13.5px; margin-bottom: 6px; }
.upd-track { height: 6px; border-radius: 3px; background: var(--accent-soft); overflow: hidden; } .upd-track i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.ct-row { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr 1.3fr auto; gap: 6px; align-items: center; }
@media (max-width: 760px) { .ct-row { grid-template-columns: 1fr 1fr; } .ct-row .toolbar { grid-column: 1 / -1; } }
.gbox { border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.traffic { color: var(--bad); font-weight: 500; }
.cl-admin { border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.cl-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.cl-line { display: inline-flex; gap: 6px; align-items: baseline; color: var(--phone); font-weight: 500; }
.next-card .cl-line { color: inherit; }
.cl-mark { font-size: 13px; }
.cl-off { opacity: .55; }
.cl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.parking-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.parking-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.parking-item.sel { border-color: var(--accent); background: var(--accent-soft); }

.notice { padding: 10px 12px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.im-res { display: block; }
.im-res ul { margin: 0 0 6px; padding-left: 18px; display: block; }
.im-res li { display: list-item; margin-bottom: 4px; }
.im-res p { margin: 0; }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 6px; opacity: 0; pointer-events: none; transition: .2s; z-index: 9999; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* Changelog */
.rel { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rel:last-child { border-bottom: 0; }
.rel .ver { font-family: var(--f-display); font-size: 26px; font-weight: 600; }
.rel ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; max-width: 80ch; }
.rel .why { color: var(--muted); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: 100%; justify-content: flex-end; }
.bars .stack { width: 100%; max-width: 40px; display: flex; flex-direction: column-reverse; border-radius: 3px 3px 0 0; overflow: hidden; }
.bars .seg-v { background: var(--accent); }
.bars .seg-p { background: var(--phone); }
.bars .lab { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bars .val { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

@media (max-width: 1100px) {
  .split, .info { grid-template-columns: minmax(0, 1fr); }
  .map { height: 460px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .m-brand { display: flex; align-items: center; gap: 9px; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; background: var(--surface); border-bottom: 1px solid var(--line); font-family: var(--f-display); font-weight: 700; font-size: 18px; color: var(--accent); }
  .m-brand img { width: 20px; height: auto; }
  .m-brand small { font-family: var(--f-body); font-weight: 500; font-size: 12px; color: var(--brand-grey); }
  main::after { content: "© 2026 Medical Eins GmbH"; display: block; text-align: center; font-size: 11.5px; color: var(--muted); padding: 0 16px 18px; }
  body.kiosk .m-brand { display: none; }
  .nav { order: 2; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)); gap: 0; }
  .brand, .nav-foot { display: none; }
  /* Handy: „Verbesserungen“ ausgeblendet (in den Einstellungen erreichbar), übrige Symbole teilen sich die Breite gleichmäßig */
  .nav nav { flex-direction: row; width: 100%; justify-content: stretch; overflow: hidden; }
  .nav nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; font-size: 10.5px; padding: 7px 2px; text-align: center; }
  .nav nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav nav a.nav-changelog { display: none; }
  .l-long { display: none; } .l-short { display: inline; }
}
@media (max-width: 390px) {
  .nav { padding-left: 2px; padding-right: 2px; }
  .nav nav a { font-size: 9.5px; padding: 7px 0; letter-spacing: -.01em; }
  .nav nav a.active { box-shadow: inset 0 3px 0 var(--nav-accent); }
  .view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .cols-2, .cols-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .info-hero .clock { font-size: 48px; }
  .agenda-row { grid-template-columns: 84px minmax(0, 1fr); }
  .agenda-row > :last-child { grid-column: 2; }
  .rel { grid-template-columns: 1fr; gap: 4px; }
  .map { height: 380px; }
}
body.offline .nav-foot::after { content: "offline"; display: inline-block; margin-top: 6px; padding: 1px 8px; border-radius: 999px; background: var(--warn); color: #fff; font-weight: 600; }
@media (max-width: 760px) {
  .view-head { align-items: stretch; }
  .view-head .toolbar { width: 100%; }
  .info-hero .toolbar { order: 2; }
  .agenda-row .toolbar .btn, .agenda-row .toolbar button { padding: 9px 12px; }
  button, .btn, input, select { min-height: 40px; }
  button.sm, .btn.sm { min-height: 34px; }
  .tl-actions .btn, .tl-actions button { padding: 8px 12px; }
  .cl-opt { padding: 7px 12px 7px 9px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; margin: 0; }
  dialog form { max-height: 100vh; height: 100%; }
  .dlg-body { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* ---- Druck: Tagesplan ---- */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 12mm 12mm 14mm; }
  body.printing { background: #fff !important; color: #000 !important; font: 10pt/1.35 var(--f-body); }
  body.printing .app, body.printing dialog, body.printing #toast { display: none !important; }
  body.printing #print-area { display: block; }
  .pr-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
  .pr-head h1 { font-size: 16pt; margin: 0 0 2px; }
  .pr-logo { width: 26px; height: auto; display: block; margin: 0 0 2px auto; }
  .pr-brand { font-size: 8pt; color: #676c72; margin-bottom: 4px; }
  .pr-km { font-size: 9pt; white-space: nowrap; line-height: 2; }
  .pr-item { border: 1px solid #999; border-radius: 4px; padding: 6px 8px; margin: 0 0 4px; break-inside: avoid; page-break-inside: avoid; }
  .pr-item.phone { border-style: dashed; }
  .pr-item.block { background: #f3f3f3; }
  .pr-title { font-size: 11pt; }
  .pr-time { font-family: var(--f-mono); font-weight: 600; }
  .pr-name { font-weight: 700; }
  .pr-tags { font-size: 8.5pt; color: #444; }
  .pr-addr { margin: 1px 0 3px; }
  .pr-info { border-collapse: collapse; width: 100%; font-size: 9pt; }
  .pr-info th { text-align: left; vertical-align: top; width: 92px; color: #444; font-weight: 600; padding: 1px 6px 1px 0; }
  .pr-info td { padding: 1px 0; }
  .pr-cl { margin-top: 4px; font-size: 9.5pt; display: flex; flex-direction: column; gap: 2px; }
  .pr-lines { margin-top: 4px; }
  .pr-lines span { display: block; border-bottom: 1px solid #bbb; height: 16px; }
  .pr-drive { font-size: 8.5pt; color: #555; margin: 0 0 4px 10px; }
  .pr-foot { margin-top: 10px; font-size: 8pt; color: #666; }
}
#tour-unplanned tr.clickable { cursor: pointer; } #tour-unplanned tr.clickable:hover td { background: var(--accent-soft); }

.hc-row { border-bottom: 1px solid var(--line); padding: 8px 0; }
.hc-row:last-of-type { border-bottom: 0; }
.hc-warn { color: var(--warn, #9a5b00); font-weight: 600; }
.hc-box { margin-top: 6px; padding: 6px 8px; border-radius: var(--r); background: var(--accent-soft); }
.hc-box .toolbar { margin-top: 4px; flex-wrap: wrap; }
