/* ==========================================================================
   Now & Beyond — Designsystem „Warm & ruhig"
   Übernommen aus dem OpenDesign-Entwurf (brand-spec.md, assets/app.css),
   erweitert um: Abend-Thema, Sprachwahl, Verwaltungsbereich,
   Maßstäbe bis 320 px, untere Reiterleiste, Tabelle→Karte.

   DIES IST DIE EINZIGE QUELLE FÜR FARBE, SCHRIFT, RADIUS UND ABSTAND.
   Keine andere Datei definiert Farbwerte.
   ========================================================================== */

/* ---------- 1. Tag ------------------------------------------------------ */
:root,
[data-theme="tag"] {
  color-scheme: light;

  --bg:            oklch(97.2% 0.010 70);   /* Leinen, warm */
  --surface:       oklch(99.4% 0.004 80);   /* Karte */
  --surface-warm:  oklch(95.0% 0.020 72);   /* ruhige Fläche */
  --surface-sunk:  oklch(93.2% 0.016 68);   /* Vertiefung */
  --fg:            oklch(25% 0.024 50);     /* Walnuss-Tinte, nie Schwarz */
  --fg-soft:       oklch(36% 0.022 50);
  --muted:         oklch(45.5% 0.021 50);   /* 5,0:1 auf --bg */
  --border:        oklch(89.5% 0.014 68);
  --border-soft:   oklch(93.5% 0.010 68);
  --border-strong: oklch(58.0% 0.026 62);   /* Bedienelement-Rand: 3,13:1 auf --bg, 3,30:1 auf --surface */
  --border-hover:  oklch(78.0% 0.022 66);   /* nur Zeigerrückmeldung, trägt keine Aussage */

  --accent:        oklch(56% 0.138 40);     /* Terracotta: Fläche, Fokusring */
  --accent-deep:   oklch(47% 0.130 38);     /* Schaltfläche, 4,9:1 zu Weiß */
  --accent-deeper: oklch(41% 0.120 38);
  --accent-ink:    oklch(45% 0.125 40);     /* Terracotta als Text, 6,1:1 */
  --accent-soft:   oklch(94.5% 0.030 45);
  --on-accent:     oklch(99% 0.008 80);

  --calm:          oklch(52% 0.058 155);    /* Salbei — vollständig */
  --calm-soft:     oklch(94.5% 0.024 155);
  --calm-ink:      oklch(38% 0.055 155);
  --warn:          oklch(52% 0.100 68);     /* Bernstein — offen, nie Alarm */
  --warn-soft:     oklch(94.5% 0.038 78);
  --warn-ink:      oklch(42% 0.085 65);
  --warn-line:     oklch(88% 0.045 78);

  --rail-hover:    oklch(99% 0.006 75 / 0.75);
  --topbar-bg:     oklch(97.2% 0.010 70 / 0.88);
  --scrim:         oklch(20% 0.030 50 / 0.88);
  --backdrop:      oklch(25% 0.024 50 / 0.42);

  --shadow-card: 0 1px 2px oklch(25% 0.024 50 / 0.04),
                 0 8px 24px -12px oklch(25% 0.024 50 / 0.16);
  --shadow-lift: 0 2px 6px oklch(25% 0.024 50 / 0.06),
                 0 20px 44px -20px oklch(25% 0.024 50 / 0.26);
  --shadow-accent: 0 1px 1px oklch(30% 0.09 40 / 0.20),
                   0 10px 22px -12px oklch(45% 0.13 40 / 0.72);

  --foto-schleier: 0;   /* Fotos bleiben tagsüber unangetastet */
}

/* ---------- 2. Abend ---------------------------------------------------- */
[data-theme="abend"] {
  color-scheme: dark;

  --bg:            oklch(20.0% 0.014 50);
  --surface:       oklch(24.0% 0.016 52);
  --surface-warm:  oklch(27.5% 0.020 55);
  --surface-sunk:  oklch(16.5% 0.012 50);
  --fg:            oklch(95.0% 0.010 75);
  --fg-soft:       oklch(86.0% 0.012 70);
  --muted:         oklch(73.0% 0.014 65);   /* 6,0:1 auf --bg */
  --border:        oklch(42.0% 0.018 58);
  --border-soft:   oklch(33.0% 0.016 55);
  --border-strong: oklch(58.0% 0.020 58);
  --border-hover:  oklch(52.0% 0.020 58);

  --accent:        oklch(70% 0.120 42);
  --accent-deep:   oklch(72% 0.132 42);
  --accent-deeper: oklch(78% 0.126 44);
  --accent-ink:    oklch(79% 0.105 45);     /* 7,2:1 auf --bg */
  --accent-soft:   oklch(31% 0.048 45);
  --on-accent:     oklch(18% 0.022 50);

  --calm:          oklch(74% 0.078 155);
  --calm-soft:     oklch(28% 0.036 155);
  --calm-ink:      oklch(82% 0.070 155);
  --warn:          oklch(78% 0.105 75);
  --warn-soft:     oklch(29% 0.046 70);
  --warn-ink:      oklch(85% 0.090 78);
  --warn-line:     oklch(40% 0.060 72);

  --rail-hover:    oklch(34% 0.018 58 / 0.75);
  --topbar-bg:     oklch(20.0% 0.014 50 / 0.88);
  --scrim:         oklch(12% 0.020 50 / 0.90);
  --backdrop:      oklch(10% 0.014 50 / 0.62);

  --shadow-card: 0 1px 2px oklch(0% 0 0 / 0.30),
                 0 8px 24px -12px oklch(0% 0 0 / 0.60);
  --shadow-lift: 0 2px 6px oklch(0% 0 0 / 0.36),
                 0 20px 44px -20px oklch(0% 0 0 / 0.72);
  --shadow-accent: 0 1px 1px oklch(0% 0 0 / 0.30),
                   0 10px 22px -12px oklch(0% 0 0 / 0.55);

  --foto-schleier: 0.10;  /* Fotos abends eine Spur zurücknehmen */
}

/* ---------- 3. Maße, Schrift, Bewegung ---------------------------------- */
:root {
  --font-display: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-body:    'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --r-xs: 8px;  --r-sm: 14px;  --r-md: 20px;  --r-lg: 28px;  --r-pill: 999px;
  --rail: 272px;
  --rail-schmal: 76px;
  --seite: 1180px;
  --luft: clamp(18px, 4vw, 40px);   /* seitlicher Rand */
  --ease: cubic-bezier(0.22, 0.9, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; margin: 0; }
h1 { font-size: clamp(1.95rem, 1.3rem + 2.1vw, 3.3rem); line-height: 1.06; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.5rem); line-height: 1.2; letter-spacing: -0.012em; }
h3 { font-size: 1.2rem; line-height: 1.28; letter-spacing: -0.008em; }
h4 { font-size: 1.02rem; line-height: 1.3; }
p  { margin: 0; }
a  { color: inherit; }
img { max-width: 100%; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

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

.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;
}
.sprung {
  position: absolute; left: 12px; top: -60px; z-index: 90;
  padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--fg); color: var(--bg); text-decoration: none; font-weight: 600;
  transition: top 140ms var(--ease);
}
.sprung:focus { top: 12px; }

.eyebrow {
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted);
}
.lede  { font-size: clamp(1.02rem, .96rem + .3vw, 1.125rem); line-height: 1.55; color: var(--fg-soft); max-width: 46ch; }
.prose { color: var(--fg-soft); max-width: 62ch; }
.small { font-size: 0.875rem; letter-spacing: 0.01em; }
.tnum  { font-variant-numeric: tabular-nums; }

/* ---------- 4. Grundgerüst ---------------------------------------------- */

.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; align-self: start;
  height: 100vh; display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  background: var(--surface-warm);
  border-right: 1px solid var(--border);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 22px; text-decoration: none; }
.brand-mark {
  /* 25 % größer als der Ursprungsentwurf: 34 px → 43 px */
  width: 43px; height: 43px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--fg); color: var(--bg);
}
.brand-mark .ic { width: 23px; height: 23px; }
.brand-name { font-family: var(--font-display); font-size: 1.32rem; font-weight: 500; letter-spacing: -0.01em; }

.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.nav-group-label { padding: 0 10px 7px; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--fg-soft); text-decoration: none;
  font-size: 0.9375rem; font-weight: 500;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.nav-item .ic { flex: none; opacity: 0.72; }
.nav-item > span:not(.nav-count) { flex: 1; min-width: 0; }
.nav-item:hover { background: var(--rail-hover); color: var(--fg); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item[aria-current="page"] .ic { opacity: 1; }

.nav-count { font-size: 0.75rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item[aria-current="page"] .nav-count { color: var(--accent-ink); }

.rail-foot { padding-top: 14px; border-top: 1px solid var(--border); margin-top: 14px; }

.steps {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 10px; margin-bottom: 6px;
  background: none; border: 0; border-radius: var(--r-sm);
  font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: none;
  transition: background 140ms var(--ease);
}
.steps:hover { background: var(--rail-hover); }
.ring { width: 32px; height: 32px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.ring .track { stroke: var(--border); }
.ring .fill  { stroke: var(--calm); }
.steps-text { display: flex; flex-direction: column; line-height: 1.25; }
.steps-text b { font-size: 0.875rem; font-weight: 600; }
.steps-text span { font-size: 0.75rem; color: var(--muted); }

.me { display: flex; align-items: center; gap: 11px; padding: 6px 10px; }
.me .avatar { width: 32px; height: 32px; font-size: 0.75rem; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-text b { font-size: 0.875rem; font-weight: 600; }
.me-text span { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* Verwaltung hebt sich leise ab, ohne eine zweite Akzentfarbe zu eröffnen */
.nav-gruppe--verwaltung { border-top: 1px solid var(--border); padding-top: 16px; }
.nav-gruppe--verwaltung .nav-item { color: var(--muted); }
.nav-gruppe--verwaltung .nav-item:hover { color: var(--fg); }

/* ---------- 5. Kopfzeile ------------------------------------------------ */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 13px var(--luft);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--muted); min-width: 0; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.crumbs b { color: var(--fg); font-weight: 600; }

.search { margin-left: auto; position: relative; display: flex; align-items: center; width: min(340px, 30vw); }
.search .ic { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 44px; padding: 9px 58px 9px 39px;
  font: inherit; font-size: 0.9375rem; color: var(--fg);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search kbd {
  position: absolute; right: 8px;
  font-family: var(--font-body); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.04em; color: var(--muted);
  padding: 3px 7px; border: 1px solid var(--border); border-radius: var(--r-xs);
  background: var(--bg);
}

/* Werkzeuge rechts: Thema, Sprache, Konto */
.werkzeuge { display: flex; align-items: center; gap: 8px; flex: none; }

.knopf-rund {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); color: var(--fg-soft);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.knopf-rund:hover { background: var(--surface-warm); color: var(--fg); border-color: var(--border-hover); }
.knopf-rund .ic--mond { display: none; }
[data-theme="abend"] .knopf-rund .ic--mond { display: block; }
[data-theme="abend"] .knopf-rund .ic--sonne { display: none; }

.sprachwahl { position: relative; display: flex; align-items: center; }
.sprachwahl .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.sprachwahl select {
  appearance: none;
  min-height: 44px; padding: 0 30px 0 36px;
  font: inherit; font-size: 0.875rem; font-weight: 600; letter-spacing: .02em;
  color: var(--fg-soft); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  cursor: pointer;
  transition: border-color 140ms var(--ease), color 140ms var(--ease);
}
.sprachwahl::after {
  content: ""; position: absolute; right: 14px; width: 7px; height: 7px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: translateY(-2px) rotate(45deg); pointer-events: none;
}
.sprachwahl select:hover { color: var(--fg); border-color: var(--border-hover); }

.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: var(--r-pill); overflow: hidden;
  display: grid; place-items: center;
  background: var(--surface-sunk); color: var(--fg-soft);
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid var(--border);
}
.avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: saturate(0.87) contrast(1.03) sepia(0.05) brightness(calc(1 - var(--foto-schleier)));
}

/* Schalter für die Leiste, nur auf kleinen Bildschirmen sichtbar */
.leiste-schalter { display: none; }

/* ---------- 6. Hinweisstreifen ------------------------------------------ */

.notice {
  display: flex; align-items: center; gap: 12px;
  margin: 18px var(--luft) 0; padding: 11px 14px 11px 16px;
  background: var(--warn-soft); border: 1px solid var(--warn-line);
  border-radius: var(--r-sm);
  font-size: 0.875rem; color: var(--warn-ink);
}
.notice .ic { flex: none; color: var(--warn); }
.notice p { flex: 1; }
.notice a { color: inherit; text-underline-offset: 3px; }

/* ---------- 7. Inhaltsbereich ------------------------------------------- */

.page { padding: 34px var(--luft) 96px; max-width: var(--seite); width: 100%; }
.section { margin-top: clamp(34px, 5vw, 52px); }
.section-head {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.section-head h2 { flex: none; }
.section-head .small { margin-left: auto; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-card); }

/* Die eine asymmetrische Form: die abgelegte Briefecke. Einmal je Bildschirm. */
.letter {
  position: relative;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-xs);
  padding: 26px 28px 24px;
}
.letter h2 { margin: 12px 0 10px; max-width: 24ch; }
.letter .prose { font-size: 0.9875rem; }
.letter-to { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.letter-to .avatar { width: 34px; height: 34px; }
.letter-to b { font-size: 0.875rem; font-weight: 600; }
.letter-to span { font-size: 0.8125rem; color: var(--muted); }
.letter-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.letter.is-done { background: var(--calm-soft); border-color: var(--calm); }
.letter.is-snoozed { opacity: 0.72; }

/* ---------- 8. Schaltflächen -------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  font: inherit; font-size: 0.9375rem; font-weight: 600; letter-spacing: 0.01em;
  border-radius: var(--r-pill); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background 150ms var(--ease), box-shadow 150ms var(--ease),
              transform 110ms var(--ease), border-color 150ms var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-deep); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: var(--accent-deeper); }
.btn-quiet { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-quiet:hover { background: var(--surface-warm); border-color: var(--border-hover); }
.btn-ghost { background: none; color: var(--fg-soft); padding: 0 14px; }
.btn-ghost:hover { background: var(--surface-warm); color: var(--fg); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }

/* ---------- 9. Zustände -------------------------------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 9px; border-radius: var(--r-pill);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip-calm { background: var(--calm-soft); color: var(--calm-ink); }
.chip-open { background: var(--warn-soft); color: var(--warn-ink); }
.chip-quiet { background: var(--surface-sunk); color: var(--muted); }

/* Fortschritt */
.progress-line { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.progress-track { flex: 1; min-width: 160px; height: 7px; border-radius: var(--r-pill); background: var(--surface-sunk); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--r-pill); background: var(--calm); transition: width 600ms var(--ease); }
.progress-line .small { flex: none; color: var(--muted); }

/* ---------- 10. Karten für den Stand ------------------------------------ */

.stand { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 16px; }
.stand-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px 20px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  text-decoration: none; color: inherit;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}
.stand-card:hover { transform: translateY(-2px); border-color: var(--border-hover); box-shadow: var(--shadow-card); }
.stand-top { display: flex; align-items: center; gap: 10px; }
.stand-top .ic { color: var(--muted); }
.stand-top b { font-size: 0.9375rem; font-weight: 600; flex: 1; }
.stand-card p { font-size: 0.9375rem; color: var(--fg-soft); }
.stand-meta { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; }
.stand-meta .small { color: var(--muted); margin-left: auto; }

/* ---------- 11. Menschen ------------------------------------------------- */

.people { display: flex; flex-wrap: wrap; gap: 14px; }
.person {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  text-decoration: none; color: inherit;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}
.person:hover { border-color: var(--border-hover); background: var(--surface-warm); }
.person .avatar { width: 42px; height: 42px; }
.person b { display: block; font-size: 0.9375rem; font-weight: 600; line-height: 1.3; }
.person span { font-size: 0.8125rem; color: var(--muted); }
.person-add {
  border-style: dashed; background: none; color: var(--muted);
  font: inherit; font-size: 0.9375rem; font-weight: 500; cursor: pointer;
  padding: 10px 20px; min-height: 64px;
  display: inline-flex; align-items: center; gap: 9px;
}
.person-add:hover { color: var(--fg); border-color: var(--muted); }

/* ---------- 12. Bildkacheln ---------------------------------------------- */

.recent { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.recent .tile { aspect-ratio: 5 / 4; }

.tile {
  position: relative; display: block;
  border: 0; padding: 0; margin: 0;
  background: var(--surface-sunk);
  border-radius: var(--r-md); overflow: hidden;
  cursor: pointer; text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}
/* Fotos werden bewusst zurückgenommen — weniger glattes Stockfoto,
   mehr zurückhaltende, europäische Bildsprache: etwas entsättigt, ein
   Hauch wärmer, dezent nachgedunkelt zum Rand hin. Die Tag/Abend-Differenz
   läuft weiter über --foto-schleier, ist hier nur in denselben Filter
   eingerechnet statt eine zweite Regel zu überschreiben. */
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: saturate(0.87) contrast(1.03) sepia(0.05) brightness(calc(1 - var(--foto-schleier)));
}
.tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 58%, rgba(30, 24, 18, 0.16) 100%);
  border-radius: inherit;
}
[data-theme="abend"] .tile::after {
  background: radial-gradient(ellipse at 50% 45%, transparent 58%, rgba(0, 0, 0, 0.32) 100%);
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
[data-theme="abend"] .today-photo img { filter: brightness(calc(1 - var(--foto-schleier))); }

.tile-scrim {
  position: absolute; inset: auto 0 0 0;
  padding: 44px 16px 14px;
  background: linear-gradient(to top, var(--scrim), transparent);
  color: oklch(98% 0.006 80);
  display: flex; align-items: flex-end; gap: 10px;
}
.tile-scrim b { font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; line-height: 1.25; }
.tile-scrim time { margin-left: auto; font-size: 0.75rem; opacity: 0.9; white-space: nowrap; flex: none; }

.badge {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg);
}

/* Erinnerung des Tages */
.today { overflow: hidden; display: flex; flex-direction: column; }
.today-photo { position: relative; aspect-ratio: 4 / 3; background: var(--surface-sunk); }
.today-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.today-foot { padding: 16px 18px 18px; }
.today-foot h3 { margin: 7px 0 4px; font-size: 1.05rem; }
.today-foot .small { color: var(--muted); }
.today-link {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; min-height: 44px;
  font-size: 0.875rem; font-weight: 600; color: var(--fg);
  text-decoration: none; border-bottom: 1px solid var(--border); padding-bottom: 3px;
  transition: border-color 140ms var(--ease);
}
.today-link:hover { border-color: var(--fg); }

/* ---------- 13. Tabellen — nur wo wirklich verglichen wird --------------- */

.tabelle { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.tabelle caption { text-align: left; padding-bottom: 10px; color: var(--muted); font-size: 0.875rem; }
.tabelle th {
  text-align: left; font-weight: 600; font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.tabelle td { padding: 13px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tabelle tbody tr { transition: background 140ms var(--ease); }
.tabelle tbody tr:hover { background: var(--surface-warm); }
.tabelle .tnum { text-align: right; }

/* ---------- 14. Dialog ---------------------------------------------------- */

dialog {
  padding: 0; border: 0; color: var(--fg);
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  max-width: min(660px, calc(100vw - 24px)); width: 100%;
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog[open] { animation: rise 220ms var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } }

.dlg-head { display: flex; align-items: flex-start; gap: 16px; padding: 24px 26px 18px; border-bottom: 1px solid var(--border-soft); }
.dlg-head div { flex: 1; }
.dlg-body { padding: 22px 26px; }
.dlg-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 26px 22px; }
.dlg-foot .small { margin-right: auto; color: var(--muted); }
.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }

.x {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r-pill);
  color: var(--muted); cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.x:hover { background: var(--surface-sunk); color: var(--fg); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.015em; color: var(--fg-soft); }
.field textarea, .field select, .field input[type="text"], .field input[type="email"] {
  font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 11px 13px; min-height: 44px;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.field textarea { min-height: 148px; resize: vertical; line-height: 1.6; }
.field :is(textarea, select, input):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 15. Bestätigungshinweis -------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 16px);
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  background: var(--fg); color: var(--bg);
  border-radius: var(--r-pill);
  font-size: 0.9375rem; font-weight: 500;
  box-shadow: var(--shadow-lift);
  opacity: 0; pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 16. Schlusszeile --------------------------------------------- */

.closing {
  display: flex; align-items: center; gap: 13px;
  margin-top: 56px; padding: 20px 24px;
  background: var(--surface-warm); border-radius: var(--r-md);
  color: var(--fg-soft);
}
.closing .ic { flex: none; color: var(--accent-ink); }

/* ---------- 17. Ikonen ---------------------------------------------------- */

.ic {
  width: 19px; height: 19px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em;
}
.ic--sm { width: 16px; height: 16px; stroke-width: 1.7; }
.ic--lg { width: 24px; height: 24px; stroke-width: 1.5; }

/* ---------- 18. Untere Reiterleiste (nur klein) -------------------------- */

.reiter {
  display: none;
  position: fixed; inset: auto 0 0 0; z-index: 40;
  background: var(--surface-warm);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
/* Spaltenzahl folgt der Zahl der Einträge — fünf Wege plus „Mehr" passen so
   in eine Zeile, ohne dass die Leiste umbricht. */
.reiter ul { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.reiter a, .reiter button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; padding: 4px 2px;
  background: none; border: 0; border-radius: var(--r-sm);
  font: inherit; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em;
  color: var(--muted); text-decoration: none; cursor: pointer;
}
.reiter a[aria-current="page"] { color: var(--accent-ink); }
.reiter .ic { width: 21px; height: 21px; }

/* ---------- 19. Maßstäbe -------------------------------------------------- */

/* 900–1179 px: Leiste auf Ikonen zusammengezogen */
@media (min-width: 901px) and (max-width: 1179px) {
  .shell { grid-template-columns: var(--rail-schmal) minmax(0, 1fr); }
  .rail { padding: 18px 10px 12px; align-items: center; }
  .brand { padding: 0 0 18px; }
  .brand-name, .nav-group-label, .nav-count, .steps-text, .me-text { display: none; }
  .nav ul { align-items: center; }
  .nav-item { justify-content: center; padding: 11px 0; width: 52px; }
  .nav-item > span:not(.nav-count) { display: none; }
  .rail-foot { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .steps { justify-content: center; }
  .me { padding: 6px 0; }
  .search { width: min(280px, 26vw); }
}

/* ≤ 900 px: Leiste fährt als Überlagerung aus, unten Reiter */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 200ms var(--ease);
    box-shadow: var(--shadow-lift);
  }
  .rail[data-offen="ja"] { transform: none; }
  .leiste-schalter { display: grid; }
  .crumbs { display: none; }
  .search { margin-left: auto; width: min(100%, 46vw); }
  .page { padding-bottom: 104px; }
  .reiter { display: block; }
  .rail-schleier {
    position: fixed; inset: 0; z-index: 25;
    background: var(--backdrop); border: 0; padding: 0;
  }
}

/* Ohne JavaScript gibt es niemanden, der die Leiste ausfahren könnte.
   Dann steht sie als waagerechtes Band über dem Inhalt — wie im Entwurf. */
@media (max-width: 900px) {
  html:not(.js) .rail {
    position: static; width: auto; height: auto; transform: none; box-shadow: none;
    flex-direction: row; align-items: center; gap: 6px;
    overflow-x: auto; padding: 12px 16px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  html:not(.js) .brand { flex: none; padding: 0 12px 0 2px; }
  html:not(.js) .nav { flex-direction: row; gap: 6px; overflow: visible; }
  html:not(.js) .nav ul { flex-direction: row; }
  html:not(.js) .nav-item { white-space: nowrap; }
  html:not(.js) .nav-group-label,
  html:not(.js) .nav-count,
  html:not(.js) .rail-foot,
  html:not(.js) .leiste-schalter,
  html:not(.js) .rail-schleier { display: none; }
}

/* ≤ 640 px: eine Spalte, Tabelle wird Karte */
@media (max-width: 640px) {
  .above, .dlg-grid { grid-template-columns: minmax(0, 1fr); }
  .stand, .recent { grid-template-columns: minmax(0, 1fr); }
  .search kbd { display: none; }
  .search input { padding-right: 16px; }
  .section-head .small { margin-left: 0; width: 100%; }

  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabelle tr {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); margin-bottom: 12px; padding: 6px 4px;
  }
  .tabelle td { border-bottom: 1px solid var(--border-soft); display: flex; gap: 14px; align-items: baseline; }
  .tabelle tr td:last-child { border-bottom: 0; }
  .tabelle td::before {
    content: attr(data-kopf);
    flex: 0 0 38%;
    font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--muted);
  }
  .tabelle .tnum { text-align: left; }
}

/* ≤ 400 px: nichts darf herausragen */
@media (max-width: 400px) {
  .werkzeuge .sprachwahl select { padding: 0 26px 0 32px; font-size: 0.8125rem; }
  .avatar { width: 32px; height: 32px; }
  .letter { padding: 20px 18px 18px; }
  .page { padding-left: 16px; padding-right: 16px; }
  .topbar { padding-left: 14px; padding-right: 14px; gap: 8px; }
  .notice { margin-left: 16px; margin-right: 16px; }
  .reiter a span:last-child { font-size: 0.625rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

@media print {
  .rail, .topbar, .reiter, .notice, .toast { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
}

/* ---------- RTL-Grundausrichtung (Arabisch, Urdu, Persisch) --------------
   Minimaler Fallback, kein Umbau des Flex-Layouts: Textrichtung und die
   augenfälligsten Ausrichtungen kippen mit. Gesetzt wird dies über
   html[dir="rtl"] (siehe index.html, spracheSetzen()). ------------------- */
html[dir="rtl"] {
  direction: rtl;
}
html[dir="rtl"] body {
  text-align: right;
}
html[dir="rtl"] .tabelle th,
html[dir="rtl"] .tabelle caption,
html[dir="rtl"] .tabelle td {
  text-align: right;
}
html[dir="rtl"] .tabelle .tnum {
  text-align: left;
}
html[dir="rtl"] .umschlag__zeile,
html[dir="rtl"] .schau__daten div {
  text-align: right;
}
