/* Mausi App – ruhige, iOS-nahe Oberfläche: warmes Grau, weiße Flächen, ein Akzent. */
:root {
  --bg: #f6f3f1;
  --surface: #ffffff;
  --ink: #1b1819;
  --muted: #675f63;
  --faint: #9a9195;
  --line: rgba(27, 24, 25, .09);
  --accent: #c23a66;
  --accent-ink: #ffffff;
  --accent-soft: rgba(194, 58, 102, .09);
  --danger: #c0392b;
  --tab-h: 54px;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141113; --surface: #1f1b1d; --ink: #f4eff1; --muted: #b6aeb3; --faint: #6f676b;
    --line: rgba(255, 255, 255, .09); --accent: #ee6c94; --accent-ink: #1b0b11;
    --accent-soft: rgba(238, 108, 148, .16); --danger: #ff7b6e;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; font-size: 100%; }
@supports (font: -apple-system-body) { html { font: -apple-system-body; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(var(--tab-h) + var(--sab) + 28px);
}
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
small { font-size: 0.8125rem; color: var(--muted); }
svg.i { flex: none; display: block; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(var(--sat) + 14px) 16px 8px; background: var(--bg);
}
.topbar h1 { font-size: 1.875rem; font-weight: 800; letter-spacing: -.7px; }
#topbar-actions { display: flex; align-items: center; gap: 10px; }
main { padding: 4px 16px 12px; max-width: 640px; margin: 0 auto; }

/* Tab-Leiste */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; padding-bottom: var(--sab);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; height: var(--tab-h); border: 0; background: none; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 0.6562rem; font-weight: 600;
}
.tabbar button.active { color: var(--accent); }

/* Buttons */
.btn {
  display: block; width: 100%; margin-top: 10px; padding: 13px 16px; border-radius: 12px;
  border: 0; background: var(--surface); font-weight: 600; text-align: center;
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.btn.primary:disabled { opacity: .4; }
.btn.danger { color: var(--danger); }
.text-btn {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 12px 4px; min-height: 44px;
  color: var(--accent); font-weight: 600; font-size: 0.9375rem;
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface);
  color: var(--ink); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px var(--line);
}
.icon-btn.solid { background: var(--accent); color: var(--accent-ink); box-shadow: none; }

/* Gruppen im iOS-Stil */
.group { background: var(--surface); border-radius: var(--r); overflow: hidden; margin: 10px 0; }
.group > * + * { border-top: 1px solid var(--line); }
.group.pad { padding: 4px 16px 16px; }
.group.pad > * + * { border-top: 0; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px 10px; }
.group-head strong { flex: 1; font-size: 1.0625rem; }
.group-head span { font-weight: 700; color: var(--c); }
.dot-c { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.row-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px;
  border: 0; background: none; text-align: left; color: inherit; text-decoration: none;
}
button.row-item:active { background: var(--accent-soft); }
.row-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-item .trail { display: flex; flex-direction: column; align-items: flex-end; }
.row-item .trail strong { font-size: 0.9375rem; }
.chev { color: var(--faint); }
.section { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 4px 6px; }
.hint { font-size: 0.8125rem; color: var(--muted); margin: 6px 4px; }
.hint.center { text-align: center; margin-top: 26px; }
.warn { color: var(--danger); display: inline-flex; vertical-align: -2px; }
.note-line { display: flex; gap: 6px; align-items: flex-start; font-size: 0.8125rem; color: var(--muted); margin: 6px 4px; }
.note-line svg { margin-top: 1px; color: var(--danger); }
.note-line.bad span { color: var(--danger); }
.notes { margin-bottom: 4px; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { color: var(--faint); }
.empty .btn { width: auto; padding: 10px 20px; }

/* Kalender */
.weekhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; }
.weektitle { text-align: center; display: flex; flex-direction: column; }
.weektitle strong { font-size: 1.0625rem; }
.weektitle span { font-size: 0.8125rem; color: var(--muted); }
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); margin: 4px 0 10px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; border: 0; background: none; }
.day .wd { font-size: 0.6875rem; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.day .dn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; font-size: 1.125rem; font-weight: 600; }
.day.today .dn { color: var(--accent); font-weight: 800; }
.day.sel .dn { background: var(--accent); color: var(--accent-ink); }
.dot { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.dot.on { background: var(--faint); }
.daysummary { margin: 6px 4px 12px; }
.daysummary h2 { font-size: 1.25rem; letter-spacing: -.2px; }
.daysummary p { color: var(--muted); font-size: 0.875rem; margin-top: 2px; }

.timeline { position: relative; margin: 0 0 12px; }
.hl { position: absolute; left: 0; right: 0; height: 0; }
.hl span { position: absolute; left: 0; width: 38px; transform: translateY(-50%); font-size: 0.6875rem; color: var(--faint); text-align: right; }
.hl::after { content: ""; position: absolute; left: 46px; right: 0; top: 0; border-top: 1px solid var(--line); }
.evs { position: absolute; left: 50px; right: 0; top: 0; bottom: 0; }
.ev {
  position: absolute; display: flex; flex-direction: column; gap: 0; overflow: hidden; text-align: left;
  border: 0; border-radius: 8px; padding: 5px 8px 5px 10px; line-height: 1.25;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  box-shadow: inset 3px 0 0 var(--c);
}
.ev strong { font-size: 0.875rem; }
.ev span { font-size: 0.75rem; color: var(--muted); }
.ev .t { color: var(--ink); opacity: .75; }
.ev.compact { flex-direction: row; align-items: center; gap: 8px; padding-top: 2px; padding-bottom: 2px; }
.now { position: absolute; left: 40px; right: 0; border-top: 2px solid var(--accent); z-index: 2; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -1px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Stunden */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats > * + * { border-top: 0; border-left: 1px solid var(--line); }
.stat { padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 0.75rem; color: var(--muted); }
.stat strong { font-size: 1.375rem; letter-spacing: -.4px; }
.case-row { padding: 10px 16px 12px; }
.case-row-top .num { white-space: nowrap; }
.case-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9375rem; }
.bar { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 7px; }
.bar i { display: block; height: 100%; background: var(--c); border-radius: 99px; }

/* Routen */
.field-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px; }
.field-row label { margin: 0; font-size: 1.0rem; font-weight: 500; color: var(--ink); }
.field-row input { width: auto; margin: 0; border: 0; background: none; padding: 8px 0; }
.num-badge {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 700; font-size: 0.875rem;
}
.stop small, .pick small { display: block; }
.navi { color: var(--accent); padding: 6px; }
.num { font-variant-numeric: tabular-nums; }
.total { margin: 10px 0; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); display: flex; flex-direction: column; gap: 2px; }
.total-km { display: flex; align-items: baseline; gap: 8px; }
.total-km strong { font-size: 1.625rem; letter-spacing: -.5px; color: var(--accent); }
.pick input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }

/* Familien */
.search { width: 100%; margin: 6px 0 4px; }
.family .trail small { margin-top: -1px; }
.detail .info-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; color: inherit; text-decoration: none; }
.detail .info-row svg { color: var(--muted); }
.notes-box { background: var(--accent-soft); border-radius: 12px; padding: 11px 14px; white-space: pre-wrap; margin: 10px 0; font-size: 0.9375rem; }
.detail .section { margin-top: 20px; }

/* Formulare */
label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--muted); margin-top: 14px; }
label.check { display: flex; align-items: center; gap: 10px; font-size: 1.0rem; font-weight: 500; color: var(--ink); }
input:not([type=checkbox]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; font-size: 1.0rem;
  border: 0; border-radius: 10px; background: var(--bg); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.group.pad input:not([type=checkbox]), .group.pad select, .group.pad textarea { background: var(--bg); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slot { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.slot select, .slot input { margin: 0; padding: 9px 6px; font-size: 0.9375rem; }
.slot .icon-btn { width: 40px; height: 40px; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden], .toast[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 8, 14, .4); }
.sheet-card {
  position: relative; width: 100%; max-width: 640px; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0; animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.0625rem; text-align: center; white-space: nowrap; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .link:last-child { justify-self: end; }
.link { border: 0; background: none; color: var(--accent); font-size: 1.0rem; padding: 4px; justify-self: start; }
.link.strong { font-weight: 700; }
.link:disabled { opacity: .5; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(24px + var(--sab)); -webkit-overflow-scrolling: touch; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--tab-h) + var(--sab) + 20px); width: max-content; max-width: 90vw;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 0.875rem; text-align: center;
}

/* Korrekturen: Formular-Basisstile sollen Listenzeilen und Feldzeilen nicht überschreiben */
label.row-item { display: flex; margin: 0; font-size: 1.0rem; font-weight: 400; color: var(--ink); }
.field-row input:not([type=checkbox]) { width: auto; margin: 0; padding: 8px 0; background: none; box-shadow: none; text-align: right; }

/* ---- Version 0.2 ---- */
.toast { display: flex; align-items: center; gap: 14px; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 0.9375rem; padding: 6px 2px; }
.btn.compact { display: inline-block; width: auto; margin: 8px 0 0; padding: 10px 18px; }
.chip {
  border: 0; border-radius: 99px; padding: 9px 14px; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 0.875rem; min-height: 40px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.daysummary { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.day-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: none; }
.day-actions .chip { white-space: nowrap; }
.daybody { touch-action: pan-y; }

/* Einstieg / Hinweise */
.banner { padding: 0; }
.banner-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 0 16px; }
.banner-head strong { font-size: 1.0625rem; }
.banner-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.banner-actions { display: flex; align-items: center; gap: 14px; }
.check { color: var(--faint); display: inline-flex; flex: none; }
.check svg { opacity: .45; }
.check.on { color: var(--accent); }
.check.on svg { opacity: 1; }

/* Termine im Zeitstrahl nach Status */
.ev .okc { display: inline-flex; vertical-align: -3px; margin-left: 5px; color: var(--accent); }
.ev .tag { font-size: 0.6875rem; font-weight: 600; margin-left: 6px; padding: 1px 6px; border-radius: 99px; background: var(--line); color: var(--muted); vertical-align: 1px; }
.ev .tag.open { background: rgba(192, 57, 43, .12); color: var(--danger); }
.ev.st-cancelled { opacity: .55; }
.ev.st-cancelled strong { text-decoration: line-through; }
.ev.st-planned { background: color-mix(in srgb, var(--c) 10%, var(--surface)); }

/* Segmentierter Schalter */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; border-radius: 10px; background: var(--line); }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px 4px; border-radius: 8px; font-size: 0.9375rem; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.row-item input[type=radio] { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }

/* Adressfeld */
.addr-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.addr-status { display: flex; align-items: flex-start; gap: 6px; font-size: 0.8125rem; color: var(--muted); }
.addr-status svg { margin-top: 1px; }
.addr-status.ok { color: var(--accent); }
.addr-status.bad { color: var(--danger); }
.addr-row .text-btn { flex: none; padding-top: 0; padding-bottom: 0; }
.addr-results .row-item { padding: 12px 14px; }
.addr-results svg { color: var(--muted); }

/* Monatsabschluss / Stunden */
.group-head .plain { color: var(--muted); font-weight: 600; }
.plan-note { display: block; margin-top: 4px; }

.demobar { background: var(--accent); color: var(--accent-ink); text-align: center; font-size: 0.8125rem; padding: calc(var(--sat) + 6px) 12px 6px; }
.demobar a { color: inherit; font-weight: 700; }
.demobar + .topbar { padding-top: 14px; }

/* PIN-Sperre */
.lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: calc(var(--sat) + 16px) 16px calc(var(--sab) + 16px); }
.lock[hidden] { display: none; }
.lock-ui { width: 100%; max-width: 320px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.lock-logo { border-radius: 18px; margin-bottom: 4px; }
.lock-ui h2 { font-size: 1.375rem; }
.lock-ui p { color: var(--muted); font-size: 0.9375rem; min-height: 1.4em; }
.lock-ui p.bad { color: var(--danger); }
.pin-dots { display: flex; gap: 14px; margin: 12px 0 18px; min-height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--faint); }
.pin-dots i.on { background: var(--accent); box-shadow: none; }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; justify-content: center; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface); font-size: 1.75rem; font-weight: 500; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.keypad button:active { background: var(--accent-soft); }
.lock.cover .keypad, .lock.cover .pin-dots, .lock.cover p, .lock.cover [data-forgot] { visibility: hidden; }
.lock-ui .text-btn { margin-top: 10px; }

.recovery { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.25rem; font-weight: 700; letter-spacing: 1px; text-align: center; padding: 16px 8px; margin: 10px 0 0; border-radius: 12px; background: var(--accent-soft); color: var(--accent); word-break: break-all; user-select: all; -webkit-user-select: all; }
