/* Sorgen-Katalog — ruhig, warm, offline. Alle Farben laufen über Tokens,
   damit der Dark Mode nur die Tokens überschreibt und sonst nichts. */

:root {
  --bg:            #faf8f5;
  --surface:       #ffffff;
  --surface-2:     #f4f0ea;
  --surface-3:     #ebe5db;
  --border:        #e4ddd2;
  --border-strong: #d3c9ba;
  --text:          #2b2926;
  --text-muted:    #6e675f;
  --text-faint:    #948c82;

  --accent:        #4e5aa8;
  --accent-hover:  #3f4a92;
  --accent-soft:   #e8eaf7;
  --accent-text:   #ffffff;

  --calm:          #5b8c7e;
  --calm-soft:     #e3efea;
  --warn:          #a8672f;
  --warn-soft:     #f8ecdf;
  --danger:        #a8443c;
  --danger-soft:   #f7e6e4;

  --heat-0: #efeae2;
  --heat-1: #cfd3ea;
  --heat-2: #a3aad8;
  --heat-3: #7680c2;
  --heat-4: #4e5aa8;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(43, 41, 38, .05), 0 6px 20px rgba(43, 41, 38, .06);
  --shadow-lg: 0 10px 40px rgba(43, 41, 38, .18);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 860px;
}

:root[data-theme="dark"],
:root[data-theme="auto"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] { color-scheme: dark; }

/* Dark-Tokens: einmal für die Systemeinstellung, einmal für die manuelle Wahl. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #17161a;
    --surface:       #201f25;
    --surface-2:     #292830;
    --surface-3:     #34323c;
    --border:        #35333d;
    --border-strong: #474552;
    --text:          #eae7e2;
    --text-muted:    #a7a19a;
    --text-faint:    #7d7770;

    --accent:        #8f9bdd;
    --accent-hover:  #a4aee6;
    --accent-soft:   #2b2c46;
    --accent-text:   #171720;

    --calm:          #7fb6a4;
    --calm-soft:     #223530;
    --warn:          #d69a5e;
    --warn-soft:     #3a2c1d;
    --danger:        #e08b83;
    --danger-soft:   #3a2320;

    --heat-0: #26252c;
    --heat-1: #33364f;
    --heat-2: #474d78;
    --heat-3: #626aa5;
    --heat-4: #8f9bdd;

    --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  --bg:            #17161a;
  --surface:       #201f25;
  --surface-2:     #292830;
  --surface-3:     #34323c;
  --border:        #35333d;
  --border-strong: #474552;
  --text:          #eae7e2;
  --text-muted:    #a7a19a;
  --text-faint:    #7d7770;

  --accent:        #8f9bdd;
  --accent-hover:  #a4aee6;
  --accent-soft:   #2b2c46;
  --accent-text:   #171720;

  --calm:          #7fb6a4;
  --calm-soft:     #223530;
  --warn:          #d69a5e;
  --warn-soft:     #3a2c1d;
  --danger:        #e08b83;
  --danger-soft:   #3a2320;

  --heat-0: #26252c;
  --heat-1: #33364f;
  --heat-2: #474d78;
  --heat-3: #626aa5;
  --heat-4: #8f9bdd;

  --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  font-size: .95rem;
  white-space: nowrap;
}
.brand-mark {
  width: 12px; height: 12px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--calm));
  flex: none;
}

.tabs { display: flex; gap: 2px; margin-left: auto; }
.tabs a {
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.icon-btn {
  flex: none;
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  font-size: .95rem;
  padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.theme-btn::before { content: "◐"; }
:root[data-theme="light"] .theme-btn::before { content: "☀"; }
:root[data-theme="dark"] .theme-btn::before { content: "☾"; }

/* ---------- Layout ---------- */

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px max(16px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-right));
}

.section { margin-bottom: 26px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-note { font-size: .82rem; color: var(--text-faint); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 10px; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .85rem; }
.tiny  { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 1.02rem; }

/* ---------- Knöpfe ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text-faint); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 32px; padding: 4px 11px; font-size: .82rem; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Formularfelder ---------- */

.field { margin-bottom: 16px; }
.field > label, .field-label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.field-hint { font-size: .82rem; color: var(--text-muted); margin: -2px 0 8px; }

input[type="text"], input[type="search"], input[type="date"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
::placeholder { color: var(--text-faint); }

/* ---------- Skala (0–10 / 0–100 als Chips, bewusst kein Slider) ---------- */

.scale { display: flex; flex-wrap: wrap; gap: 5px; }
.scale-chip {
  min-width: 40px;
  min-height: 40px;
  padding: 0 8px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  flex: 1 1 auto;
}
.scale-chip:hover { border-color: var(--accent); color: var(--text); }
.scale-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
}
.scale-ends {
  display: flex; justify-content: space-between;
  font-size: .78rem; color: var(--text-faint); margin-top: 5px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .76rem;
  white-space: nowrap;
}

/* ---------- Banner ---------- */

.banner-host:empty { display: none; }
.banner {
  padding: 11px max(16px, env(safe-area-inset-left));
  font-size: .88rem;
  display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.banner-warn   { background: var(--warn-soft);   color: var(--text); }
.banner-danger { background: var(--danger-soft); color: var(--text); }
.banner-info   { background: var(--accent-soft); color: var(--text); }
.banner strong { font-weight: 650; }
.banner .btn { margin-left: auto; }

/* ---------- Toast ---------- */

.toast-host {
  position: fixed;
  left: 50%; bottom: 96px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(520px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
.toast-main { display: flex; align-items: center; gap: 10px; }
.toast-text { flex: 1; font-size: .9rem; }
.toast-extra { margin-top: 10px; }
.toast-extra .field-label { font-size: .8rem; font-weight: 500; color: var(--text-muted); }

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 26px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}
.fab:hover { background: var(--accent-hover); }
.fab-plus { font-size: 1.25rem; line-height: 1; font-weight: 400; }

/* ---------- Fußzeile ---------- */

.footer {
  max-width: var(--maxw);
  margin: 30px auto 0;
  padding: 18px max(16px, env(safe-area-inset-left)) 26px;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-faint);
}
.footer p { margin: 0 0 .5em; }
.footer-crisis { color: var(--text-muted); }
.footer-crisis strong { color: var(--text); white-space: nowrap; }

/* ---------- Dashboard ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
}
.stat-label { font-size: .78rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.55rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: .9rem; font-weight: 500; color: var(--text-muted); }
.stat-sub { font-size: .78rem; color: var(--text-faint); margin-top: 2px; }
.stat-calm  .stat-value { color: var(--calm); }
.stat-quiet { background: transparent; border-style: dashed; }
.stat-quiet .stat-value { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); }

.heatmap-wrap { overflow-x: auto; padding-bottom: 6px; }
.heatmap { display: inline-flex; flex-direction: column; gap: 4px; min-width: min-content; }
/* Gleiche Spaltenbreite wie das Zellenraster, sonst stehen die Monatsnamen
   nicht über der richtigen Woche. Labels dürfen nach rechts überhängen. */
.heatmap-months {
  display: grid; grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px;
  font-size: .7rem; color: var(--text-faint); height: 14px;
}
.heatmap-months span { white-space: nowrap; overflow: visible; }
.heatmap-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.hm-cell {
  width: 13px; height: 13px;
  border-radius: 3px;
  background: var(--heat-0);
  border: none; padding: 0;
  cursor: pointer;
}
.hm-cell[data-level="0"] { background: var(--heat-0); }
.hm-cell[data-level="1"] { background: var(--heat-1); }
.hm-cell[data-level="2"] { background: var(--heat-2); }
.hm-cell[data-level="3"] { background: var(--heat-3); }
.hm-cell[data-level="4"] { background: var(--heat-4); }
.hm-cell.is-empty { background: transparent; cursor: default; }
.hm-cell.is-today { box-shadow: 0 0 0 1.5px var(--text-faint); }
.heatmap-legend {
  display: flex; align-items: center; gap: 6px;
  font-size: .76rem; color: var(--text-faint); margin-top: 8px;
}
.heatmap-legend .hm-cell { cursor: default; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.bar-label {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .9rem; color: var(--text); text-decoration: none;
}
a.bar-label:hover { text-decoration: underline; }
.bar-count { font-size: .82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: -4px; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar-fill.is-calm { background: var(--calm); }
.bar-fill.is-warn { background: var(--warn); }

.outcome-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 10px 0 8px; }
.outcome-seg { height: 100%; }
.outcome-no     { background: var(--calm); }
.outcome-partly { background: var(--warn); }
.outcome-yes    { background: var(--danger); }
.outcome-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); }
.outcome-legend span::before {
  content: ""; display: inline-block; width: 9px; height: 9px;
  border-radius: 3px; margin-right: 5px; vertical-align: baseline;
}
.outcome-legend .l-no::before     { background: var(--calm); }
.outcome-legend .l-partly::before { background: var(--warn); }
.outcome-legend .l-yes::before    { background: var(--danger); }

.review-card { border-left: 3px solid var(--accent); }
.review-prediction {
  font-size: 1rem;
  margin: 6px 0 12px;
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
  color: var(--text);
}

/* ---------- Katalog ---------- */

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"] { flex: 1 1 200px; }
.toolbar select { width: auto; flex: 0 0 auto; }

.worry-list { display: flex; flex-direction: column; gap: 8px; }
.worry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.worry.is-archived { opacity: .6; }
.worry-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.worry-main { flex: 1; min-width: 0; cursor: pointer; background: none; border: none; text-align: left; font: inherit; color: inherit; padding: 0; }
.worry-title { font-weight: 600; font-size: .98rem; word-break: break-word; }
.worry-meta { font-size: .8rem; color: var(--text-muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.worry-plus {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.3rem; font-weight: 400; line-height: 1;
  cursor: pointer;
}
.worry-plus:hover { background: var(--accent); color: var(--accent-text); }
.worry-body { border-top: 1px solid var(--border); padding: 4px 14px 14px; background: var(--surface-2); }

.entry {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.entry:last-child { border-bottom: none; }
.entry-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.entry-date { font-size: .85rem; font-weight: 600; }
.entry-badge {
  font-size: .72rem; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted);
}
.entry-badge.is-deep { background: var(--accent-soft); color: var(--accent); }
.entry-actions { margin-left: auto; display: flex; gap: 4px; }
.entry-detail { margin-top: 8px; font-size: .88rem; }
.entry-detail dl { margin: 0; display: grid; gap: 8px; }
.entry-detail dt { font-size: .76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.entry-detail dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.delta { font-variant-numeric: tabular-nums; color: var(--calm); font-weight: 600; }

/* ---------- Wizard ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 75%, rgba(0,0,0,.5));
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto;
  padding: 0;
}
.sheet {
  background: var(--surface);
  width: min(620px, 100%);
  min-height: 100%;
  border-radius: 0;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
@media (min-width: 680px) {
  .overlay { padding: 24px 16px 40px; }
  .sheet { min-height: 0; border-radius: var(--radius); border: 1px solid var(--border); }
}

.sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
  border-radius: var(--radius) var(--radius) 0 0;
}
.sheet-step { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sheet-head .icon-btn { margin-left: auto; }
.sheet-body { padding: 18px 16px 22px; flex: 1; }
.sheet-foot {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface);
}
.sheet-foot .spacer { flex: 1; }

.progress { height: 3px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .18s ease; }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }

.step-question { font-size: 1.2rem; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
.step-help { font-size: .88rem; color: var(--text-muted); margin: 0 0 16px; }

.match-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.match {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-2);
}
.match.is-top { border-color: var(--accent); background: var(--accent-soft); }
.match-title { font-weight: 600; font-size: .93rem; word-break: break-word; }
.match-meta { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }
.match-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.match-answer {
  margin-top: 9px; padding: 9px 11px;
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: .87rem; white-space: pre-wrap; word-break: break-word;
}
.match-group-label {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); margin: 14px 0 6px;
}

.mode-choice { display: flex; flex-direction: column; gap: 10px; }
.mode-option {
  display: block; width: 100%; text-align: left;
  padding: 15px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit; color: inherit; cursor: pointer;
}
.mode-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.mode-option strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.mode-option span { font-size: .86rem; color: var(--text-muted); }

.summary-change {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--calm-soft);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.summary-metric { font-size: .82rem; color: var(--text-muted); }
.summary-metric b { display: block; font-size: 1.15rem; color: var(--text); font-variant-numeric: tabular-nums; }

.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }

/* ---------- Aufklapper ---------- */

.disclosure { margin-top: 14px; }
.disclosure-summary {
  display: inline-flex; align-items: center; gap: 8px;
  list-style: none;
  cursor: pointer;
  padding: 4px 0;
  font-size: .85rem; font-weight: 500;
  color: var(--accent);
  user-select: none;
}
.disclosure-summary::-webkit-details-marker { display: none; }
.disclosure-summary:hover { color: var(--accent-hover); }
.disclosure-chevron {
  width: 7px; height: 7px; flex: none;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
.disclosure[open] .disclosure-chevron { transform: rotate(45deg) translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .disclosure-chevron { transition: none; } }
.disclosure-body {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}

/* Begriff plus Kurzerklärung; ab mittlerer Breite zweispaltig, damit
   zehn Einträge nicht zu einer langen Textwand werden. */
.glossary { margin: 0; display: grid; gap: 10px; }
.glossary-item { min-width: 0; }
.glossary dt { font-weight: 600; color: var(--text); }
.glossary dd { margin: 1px 0 0; color: var(--text-muted); line-height: 1.45; }
@media (min-width: 560px) {
  .glossary { grid-template-columns: 1fr 1fr; gap: 12px 20px; }
}

/* ---------- Dialog ---------- */

.dialog-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  padding: 16px;
}
.dialog {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  width: min(440px, 100%);
  max-height: 90vh; overflow-y: auto;
}
.dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Daten-Ansicht ---------- */

.data-note {
  font-size: .87rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-top: 10px;
}
.export-raw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; min-height: 120px; }
.setting-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.setting-row:last-child { border-bottom: none; }
.setting-row .setting-text { flex: 1 1 220px; min-width: 0; }
.setting-row .setting-text strong { display: block; font-size: .93rem; font-weight: 600; }
.setting-row .setting-text span { font-size: .82rem; color: var(--text-muted); }

.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;
}

@media (max-width: 480px) {
  .topbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .brand span:not(.brand-mark) { display: none; }
  .tabs a { padding: 6px 9px; font-size: .85rem; }
  .app { padding-left: 12px; padding-right: 12px; }
  h1 { font-size: 1.3rem; }
}
