/* Zwegat Ultras – App-Gerüst (Glas-Leiste unten, gruppierte Listen, Dialoge).
   Alle Farben als Tokens; Dunkel doppelt: System-Dunkel und ausdrücklich gewählt. */

:root {
  --bg: #f2f4f4;
  --surface: #ffffff;
  --ink: #16191a;
  --muted: #66706f;
  --line: #dce2e2;
  --chip: #e8eded;
  --accent: #2b5c6a; /* Petrol aus dem Logo */
  --accent-ink: #ffffff;
  --petrol: #2b5c6a;
  --mint: #8fd3c9;

  --ok: #1f7a52;
  --ok-bg: #dcf2e6;
  --no: #b3392f;
  --no-bg: #fbe3e0;
  --wait: #8a5d06;
  --wait-bg: #fbedcb;
  --info-bg: color-mix(in srgb, var(--accent) 9%, var(--surface));

  --r-card: 16px;
  --r-ctl: 12px;
  --r-dlg: 22px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .05), 0 10px 28px rgba(0, 0, 0, .07);
  --glass: color-mix(in srgb, var(--surface) 70%, transparent);
  --glass-edge: color-mix(in srgb, var(--ink) 14%, transparent);
  --glass-blur: blur(20px) saturate(1.6);
  --glass-shadow: 0 12px 32px rgba(0, 0, 0, .28);
  --tb-w-compact: min(calc(100vw - 148px), 300px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121415;
    --surface: #1c1f20;
    --ink: #eef2f2;
    --muted: #9aa5a6;
    --line: #2f3536;
    --chip: #2a2f30;
    --accent: #7cc7bb;
    --accent-ink: #0e2226;
    --ok: #5fd39b;
    --ok-bg: #163527;
    --no: #f2877c;
    --no-bg: #3d1c19;
    --wait: #f1c35a;
    --wait-bg: #3a2e10;
    --shadow-card: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121415;
  --surface: #1c1f20;
  --ink: #eef2f2;
  --muted: #9aa5a6;
  --line: #2f3536;
  --chip: #2a2f30;
  --accent: #7cc7bb;
  --accent-ink: #0e2226;
  --ok: #5fd39b;
  --ok-bg: #163527;
  --no: #f2877c;
  --no-bg: #3d1c19;
  --wait: #f1c35a;
  --wait-bg: #3a2e10;
  --shadow-card: none;
  color-scheme: dark;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden gilt auch für Elemente mit eigener display-Regel */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}
/* Streifen hinter der Statusleiste (Uhrzeit bleibt lesbar) */
body::before {
  content: "";
  position: fixed;
  z-index: 59;
  top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
}
body.has-tabbar { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.85rem; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
code { background: var(--chip); padding: 0 .3em; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); font-weight: normal; }
.hint { color: var(--muted); font-size: .85rem; margin: .4rem 0 0; }
.center { text-align: center; }
.negative { color: var(--no); }
.ok { color: var(--ok); }
.no { color: var(--no); }
.pre { white-space: pre-wrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- Kopfzeile (scrollt mit weg) ---------- */
.appbar {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  min-height: 52px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.02rem; }
.brand img { border-radius: 9px; box-shadow: 0 0 0 1px var(--glass-edge); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
}
.page-head { margin: 6px 0 16px; }
.back-link {
  display: inline-flex; align-items: center; gap: 2px; margin: 0 0 4px -6px;
  min-height: 36px; padding-right: 8px; color: var(--accent); text-decoration: none; font-weight: 500;
}
.back-link svg { width: 22px; height: 22px; }
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: 16px;
}
.list { display: grid; gap: 12px; }
.empty { text-align: center; color: var(--muted); padding: 28px 18px; }
.empty h1 { font-size: 1.4rem; color: var(--ink); margin-bottom: .5rem; }
.empty-big { font-size: 2rem; margin: 0 0 .25rem; }
.detail-grid { display: grid; gap: 0 20px; }
.detail-grid > div { min-width: 0; }
.version-note { text-align: center; color: var(--muted); font-size: .8rem; margin: 8px 0 0; }

/* ---------- Gruppierte Listen (wie iOS-Einstellungen) ---------- */
.group { margin: 0 0 24px; }
.group-title { font-size: .9rem; font-weight: 500; color: var(--muted); margin: 0 0 6px; padding: 0 16px; }
.group-body {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.group-body > * + * { border-top: 1px solid var(--line); }
.group-pad { padding: 14px 16px; }
.group-note { color: var(--muted); font-size: .85rem; margin: 6px 0 0; padding: 0 16px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 12px 16px; min-width: 0;
}
.row > span:first-child { min-width: 0; }
.row-value { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-main small, .row-sub { color: var(--muted); font-size: .82rem; }
.row-text { margin: 0; padding: 12px 16px; }
.row-stack { flex-direction: column; align-items: stretch; gap: 2px; }
.row-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-hero { padding-top: 16px; padding-bottom: 4px; }
.row-hero + .row-text { border-top: 0; padding-top: 2px; padding-bottom: 16px; }
.hero-amount { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.row-link { color: var(--ink); text-decoration: none; }
.row-link > svg { width: 18px; height: 18px; color: var(--muted); flex: none; margin-right: -4px; }
.row-link.inactive .row-main > span { color: var(--muted); }
.row-form { margin: 0; }
.row-button {
  width: 100%; border: 0; background: none; font: inherit; color: var(--accent);
  text-align: left; cursor: pointer; text-decoration: none;
}
.row-danger { color: var(--no); font-weight: 600; justify-content: center; text-align: center; }
@media (hover: hover) {
  .row-link:hover, .row-button:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
}

/* ---------- Segmentsteuerung und Chips (aktiv = dunkel gefüllt) ---------- */
.segments {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
  background: var(--chip); border-radius: var(--r-ctl); padding: 3px; margin: 0 0 14px;
}
.group-pad .segments { margin: 0; }
/* Bezeichnung oben, Zahl klein darunter – in allen Breiten gleich, Schrift wächst mit dem Bildschirm,
   damit auch „Genehmigt“ und „Abgelehnt“ nie abgeschnitten werden. */
.seg {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 46px; padding: 5px 3px; border: 0; border-radius: 9px; background: none;
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 600;
  font-size: clamp(.72rem, 3.3vw, .92rem); line-height: 1.15;
  text-align: center; cursor: pointer; min-width: 0;
  transition: background .2s ease, color .2s ease;
}
.seg-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-count { color: var(--muted); font-size: .84em; font-weight: 500; font-variant-numeric: tabular-nums; }
.seg.active, .seg[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.seg.active .seg-count { color: inherit; opacity: .65; }
@media (max-width: 360px) { .seg { padding: 5px 1px; letter-spacing: -.01em; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: 0 .85rem;
  border-radius: 999px; background: var(--chip); color: var(--ink); text-decoration: none; font-size: .88rem; font-weight: 500;
}
.chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.active { background: var(--ink); color: var(--bg); }
.chip.active span { color: inherit; opacity: .7; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .95rem; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-danger { background: var(--no); border-color: var(--no); color: #fff; }
.btn-danger-text { color: var(--no); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.form .btn-block { margin-top: 22px; }
@media (hover: hover) { .btn:hover { filter: brightness(.96); } }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.decision-actions .btn { flex: 1 1 140px; }

/* ---------- Formulare ---------- */
.form label { display: block; font-size: .9rem; font-weight: 600; margin: 16px 0 6px; }
.form > label:first-of-type, .form > input[type=hidden] + label { margin-top: 0; }
.form input[type=text], .form input[type=password], .form textarea, .form select {
  width: 100%; min-height: 46px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; /* kein Zoom auf iOS */
}
.form textarea { resize: vertical; min-height: 92px; }
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.form [aria-invalid=true] { border-color: var(--no); }
.field-error { color: var(--no); font-size: .85rem; margin: .35rem 0 0; }
.input-euro { position: relative; }
.input-euro input { padding-right: 2.25rem !important; text-align: right; font-variant-numeric: tabular-nums; }
.input-euro span { position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.grid-2 { display: grid; gap: 0 12px; }
.grid-2 > div { min-width: 0; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.info-box { background: var(--info-bg); border-radius: var(--r-ctl); padding: 12px 14px; margin-top: 16px; font-size: .92rem; }

/* Schalter statt Checkbox */
.switch {
  -webkit-appearance: none; appearance: none; flex: none;
  position: relative; width: 51px; height: 31px; margin: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  transition: background .2s ease;
}
.switch::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .2s ease;
}
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(20px); }
.switch:disabled { opacity: .5; cursor: default; }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; margin-top: 20px !important; }
.switch-row small { display: block; color: var(--muted); font-weight: 400; font-size: .82rem; }
.row-switch { cursor: pointer; }

/* ---------- Hinweise ---------- */
.alert { padding: 12px 14px; border-radius: var(--r-ctl); margin-bottom: 14px; font-size: .95rem; }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--no-bg); color: var(--no); }
.alert-warning { background: var(--wait-bg); color: var(--wait); }
.push-hint {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 14px;
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  color: var(--ink); text-decoration: none; font-size: .92rem;
}
.push-hint svg { width: 20px; height: 20px; flex: none; }
.push-hint-icon { color: var(--accent); display: grid; }
.push-hint > svg:last-child { color: var(--muted); margin-left: auto; }

/* App installieren */
.install-row { justify-content: flex-start; }
.install-icon { width: 44px; height: 44px; border-radius: 10px; flex: none; box-shadow: 0 0 0 1px var(--glass-edge); }
.install-button { font-weight: 600; }
.install-lead { margin: 0 0 6px; }
.install-steps { margin: 0 0 8px; padding-left: 1.3rem; }
.install-steps li { margin: 4px 0; }
.install-share { display: inline-grid; vertical-align: -4px; color: var(--accent); }
.install-share svg { width: 19px; height: 19px; }
.group-note p { margin: 0; }

/* ---------- Status ---------- */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.badge-offen, .badge-wartet { background: var(--wait-bg); color: var(--wait); }
.badge-genehmigt { background: var(--ok-bg); color: var(--ok); }
.badge-abgelehnt { background: var(--no-bg); color: var(--no); }
.badge-none { background: var(--chip); color: var(--muted); }

/* ---------- Anfragen ---------- */
.req { position: relative; margin: 0; padding: 14px 16px; }
.req-link { position: absolute; inset: 0; z-index: 1; border-radius: var(--r-card); }
.req-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.req-amount { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.req-title { font-size: 1.02rem; font-weight: 600; margin: 6px 0 0; display: flex; align-items: center; gap: 6px; }
.req-has-link { color: var(--muted); display: inline-grid; }
.req-has-link svg { width: 15px; height: 15px; }
.page-kicker { margin: 0 0 2px; color: var(--muted); font-size: .9rem; font-weight: 500; }
.ext-link > svg { width: 18px; height: 18px; color: var(--accent); }
.ext-link .row-main > span { color: var(--accent); font-weight: 600; }
.form input[type=url] {
  width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--bg); color: var(--ink); font: inherit; font-size: 16px;
}
.req-reason {
  margin: 2px 0 2px; color: var(--muted); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.req-meta { margin: 0; color: var(--muted); font-size: .82rem; }
.ap-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ap {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem .2rem .3rem;
  border-radius: 999px; background: var(--chip); font-size: .82rem; font-weight: 500;
}
.ap-icon {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; line-height: 1;
}
.ap-bestaetigt .ap-icon { background: var(--ok); color: var(--surface); }
.ap-abgelehnt .ap-icon { background: var(--no); color: var(--surface); }
.ap-wartet .ap-icon { background: var(--wait-bg); color: var(--wait); }
.ap-keine .ap-icon { background: var(--line); color: var(--muted); }
.comment {
  margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--line);
  white-space: pre-wrap; font-size: .9rem; color: var(--ink);
}
.readonly-note { margin-top: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; display: grid; gap: .1rem 1rem; padding: 0 0 14px 22px;
  border-left: 2px solid var(--line); margin-left: 6px;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: .3rem; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--muted);
}
.timeline .tl-bestaetigt::before, .timeline .tl-status-genehmigt::before { border-color: var(--ok); background: var(--ok); }
.timeline .tl-abgelehnt::before, .timeline .tl-status-abgelehnt::before { border-color: var(--no); background: var(--no); }
.timeline .tl-wartet::before { border-color: var(--wait); border-style: dashed; }
.timeline time { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Leiste unten (Glas-Kapsel) ---------- */
.tabbar {
  --tb-w: min(calc(100vw - 32px), 440px);
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); translate: 0 0;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: var(--tb-w);
  display: flex; padding: 6px; border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: width .3s cubic-bezier(.3, .9, .4, 1), padding .3s ease, bottom .3s ease,
    transform .3s cubic-bezier(.3, .9, .4, 1), translate .25s ease, opacity .2s ease;
}
.tabbar a {
  position: relative; z-index: 1; flex: 1 1 0; min-width: 0; min-height: 48px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink); text-decoration: none; border-radius: 999px; -webkit-touch-callout: none; -webkit-user-drag: none;
}
.tabbar svg { width: 24px; height: 24px; flex: none; transition: width .3s ease, height .3s ease; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tb-label { display: none; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.tb-pill {
  position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 0; width: 0;
  border-radius: 999px; background: color-mix(in srgb, var(--ink) 13%, transparent);
  visibility: hidden; pointer-events: none;
  transition: transform .32s cubic-bezier(.3, .9, .4, 1), width .32s cubic-bezier(.3, .9, .4, 1), scale .18s ease;
}
.tabbar.no-anim .tb-pill { transition: none; }
.tabbar.scrubbing .tb-pill { scale: 1.1 1.16; transition: width .2s ease, scale .18s ease; }
.tb-badge {
  position: absolute; top: 5px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #e0453a; color: #fff; font-size: .7rem; font-weight: 700;
  display: grid; place-items: center; line-height: 1; pointer-events: none;
}
.tb-add-ring {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--ink) 38%, transparent);
  transition: width .3s ease, height .3s ease;
}
.tabbar .tb-add-ring svg { width: 22px; height: 22px; }
.to-top {
  position: fixed; z-index: 20; width: 50px; height: 50px; border-radius: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: calc(50% - 30px + var(--tb-w-compact) / 2 + 10px);
  display: grid; place-items: center; color: var(--ink); cursor: pointer;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  transition: translate .25s ease, opacity .2s ease;
}
.to-top svg { width: 22px; height: 22px; }

/* Nach langem Scrollen: kompakter, „Nach oben“ daneben */
body.bar-compact .tabbar { --tb-w: var(--tb-w-compact); transform: translateX(calc(-50% - 30px)); padding: 5px; }
body.bar-compact .tabbar a { min-height: 40px; }
body.bar-compact .tabbar svg { width: 21px; height: 21px; }
body.bar-compact .tb-add-ring { width: 34px; height: 34px; }
body.bar-compact .tb-pill { top: 5px; bottom: 5px; }

/* Ausblenden bei offener Tastatur bzw. offenem Dialog */
body.bar-hidden .tabbar, body.bar-hidden .to-top,
html:has(dialog[open]) .tabbar, html:has(dialog[open]) .to-top {
  translate: 0 calc(100% + 40px); opacity: 0; pointer-events: none;
}

@media (min-width: 761px) {
  .tabbar, .to-top { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 1000px) {
  .tabbar { --tb-w: min(calc(100vw - 32px), 680px); }
  body:not(.bar-compact) .tb-label { display: inline; }
  body:not(.bar-compact) .tb-badge { position: static; margin-left: -2px; }
  body:not(.bar-compact) .tb-add-ring { width: 32px; height: 32px; }
}

/* ---------- Toast und Update-Hinweis ---------- */
.toast, .update-bar {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: max-content; max-width: min(440px, calc(100vw - 32px));
  background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px;
  font-size: .92rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toast-in .25s ease both;
}
body.has-tabbar .toast, body.has-tabbar .update-bar { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 761px) { body.has-tabbar .toast, body.has-tabbar .update-bar { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); } }
.toast.hide { opacity: 0; translate: 0 8px; transition: opacity .3s ease, translate .3s ease; }
.update-bar { display: flex; align-items: center; gap: 12px; }
.update-bar .btn-primary { background: var(--bg); color: var(--ink); border-color: var(--bg); }
@keyframes toast-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }

/* ---------- Dialoge ---------- */
.dlg {
  border: 0; padding: 0; border-radius: var(--r-dlg);
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px);
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
}
.dlg[open] { animation: dlg-in .22s cubic-bezier(.3, .9, .4, 1); }
.dlg::backdrop { background: rgba(0, 0, 0, .42); }
html:has(dialog[open]), html:has(dialog[open]) body { overflow: hidden; }
html.kb-open .dlg { max-height: calc(var(--vv-h, 100vh) - 24px); margin-top: calc(var(--vv-top, 0px) + 12px); }
.dlg-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 16px 6px 20px; background: var(--surface);
}
.dlg-head h2 { margin: 0; font-size: 1.15rem; outline: none; }
.dlg-close {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--chip); color: var(--ink); display: grid; place-items: center;
}
.dlg-close svg { width: 20px; height: 20px; }
.dlg-body { padding: 4px 20px 6px; }
.dlg-body p { margin: .4rem 0; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 12px 20px 20px; }
.dlg-actions form { margin: 0; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Ziehen zum Aktualisieren ---------- */
body[data-ptr] { overscroll-behavior-y: contain; }
.ptr {
  position: fixed; z-index: 40; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 6px);
  width: 38px; height: 38px; margin-left: -19px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); box-shadow: var(--glass-shadow);
  opacity: 0; transform: translateY(-60px); pointer-events: none;
}
.ptr-dot {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--muted);
  transition: border-color .15s ease, background .15s ease;
}
.ptr.ready .ptr-dot { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 25%, transparent); }
.ptr.loading .ptr-dot { border-color: var(--accent); border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Anmeldung (Gesicht der App: Petrol mit Doodles) ---------- */
body.page-login {
  background: var(--petrol) url("/static/doodles.svg") repeat;
  background-size: 340px;
}
body.page-login::before { background: color-mix(in srgb, var(--petrol) 88%, transparent); }
.page-login .container { max-width: 420px; padding-top: calc(env(safe-area-inset-top, 0px) + 28px); }
.login-hero { text-align: center; color: #fff; margin-bottom: 20px; }
.login-hero img { width: 148px; height: 148px; border-radius: 30px; box-shadow: 0 0 0 4px #fff, 0 12px 32px rgba(0, 0, 0, .3); }
.login-hero h1 { font-size: 2rem; margin-top: 18px; }
.login-hero p { margin: 4px 0 0; color: var(--mint); font-weight: 600; }
.card.login { box-shadow: 0 12px 32px rgba(0, 0, 0, .28); }

/* ---------- Breite Bildschirme ---------- */
@media (min-width: 1000px) {
  .container:has(.detail-grid), .appbar:has(+ .container .detail-grid) { max-width: 1000px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- Touch: ausreichend große Tippflächen ---------- */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-small { min-height: 40px; }
  .seg { min-height: 48px; }
  .chip { min-height: 40px; }
  .back-link { min-height: 44px; }
}

/* ---------- Weniger Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
