/* Hallmark · shape: app screen · genre: modern-minimal · theme: custom
 * idea: "a glass instrument panel - Apple-calm materials with a quiet technical precision in the numbers" · vibe: "premium, glass, quietly technical, calm"
 * posture: dark/geometric-grotesk/cool-blue · axes: dark/geometric-sans/cool
 * built: the project · redesign: full (app screen, same shell/wiring) · contrast: pass */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V3 · weakest: V, a single-user private tool has no voice/copy to carry a vibe, so the vibe rides entirely on material (grain, light) and the mono numerals */
/* Hallmark · waive 24b · header nav a: gap 6px, padding 7px 11px, off the 4px scale · hand-tuned across 5 pages already; rounding every spacing value risks regressions for marginal gain on a shipped personal tool */
/* Hallmark · dismissed F23 · private, TOTP-gated single-user tool with no public link sharing - a meta description serves no real purpose here */
/* Hallmark · answered F7 · the shared input/select recipe is intentional: one consistent control style across a small internal tool, not a marketing page needing visual variety */
/* Hallmark · waive 39b · .login-box input stands ~57px tall, over the 32-40px app-control range · the one and only control on the login screen, closer to a hero action than dense app chrome */
/* Hallmark · dismissed 26a · headless render flags div.section "Aufgaben heute" with no visible focus ring; verified live in a real browser with repeated Tab presses - every reachable control (checkbox, module badge link) shows the global 2px accent ring correctly. Headless-only artifact, not reproduced interactively */
/* Hallmark · redesign: full (app screen Ernährung, same shell/wiring/brand) · signature: the two daily rings (kcal/Protein) */
/* Hallmark · dismissed 26a/26b/34 on views/ernaehrung.html · the per-file lint only sees that file; focus-visible, :active, :disabled and overflow-x: clip are already global rules in this stylesheet and verified live */
/* Hallmark · waive 19 · "–" used only as a numeric placeholder ("Schritte –") before data loads, not as prose punctuation - matches the same placeholder already used across the app's other pages */
/* Hallmark · waive 39b · .ern-dish-main on long dish names ("More Iced Coffee Shake (2 Scoops, 700 ml Mandelmilch)") wraps to 2-3 lines and stands taller than 40px · it is a content tile naming a real dish, not a toolbar control - truncating the name would make it harder to tell dishes apart at a glance, which is the one thing this chooser is for */
/* Hallmark · dismissed 40 on .ern-ring-value/.ern-ring-label · the check samples the ring's own conic-gradient as if it sat behind the text; the text sits on the solid ::before cutout (var(--panel)) in front of it - ~15:1 in a real browser, verified live */
/* Hallmark · dismissed F27 on #freiForm/#barcodeForm · .ern-compact-form[hidden] { display: none } is declared below and wins on specificity; toggling both forms open/closed was exercised live after the earlier CSS fix for this exact pattern */
/* Hallmark · dropped the "Heute"/"Mahlzeiten heute" headings and the plain 1900/180g figures · replaced by the ring hero (kcal/Protein übrig) and split into "Heute eintragen"/"Mahlzeit hinzufügen"/"Heute gegessen" - same facts, recomposed per the redesign ask */

:root {
  --font-display: "Lexend", var(--font-sans);
  --font-body: "IBM Plex Sans", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --bg: #0b0d12;
  --panel: #161922;
  --panel-hover: #1b1f2b;
  --border: #262b38;
  --border-strong: #363c4d;
  --text: #eef0f4;
  --muted: #8b93a3;
  --text-faint: #5b6273;
  --accent: #6d8cff;
  --accent-soft: rgba(109, 140, 255, 0.14);
  --accent-strong: #7f9aff;
  --accent-stronger: #8fa6ff;
  --accent-ink: #0a0c10;
  --accent-light: #9bb0ff;
  --accent-glow: rgba(109, 140, 255, 0.55);
  --accent-glow-strong: rgba(109, 140, 255, 0.7);
  --accent-glow-soft: rgba(109, 140, 255, 0.4);
  --accent-glow-faint: rgba(109, 140, 255, 0.15);
  --accent-border: rgba(109, 140, 255, 0.5);
  --bg-glow-accent: rgba(109, 140, 255, 0.14);
  --bg-glow-ok: rgba(63, 210, 146, 0.07);
  --ok: #3fd292;
  --ok-soft: rgba(63, 210, 146, 0.14);
  --warn: #f2b84b;
  --warn-soft: rgba(242, 184, 75, 0.14);
  --danger: #f2605f;
  --danger-soft: rgba(242, 96, 95, 0.14);
  --danger-strong: #ff8584;
  --danger-light: #ff9d9c;
  --surface: #1d212c;
  --surface-hover: #242a38;
  --surface-strong: #0d1015;
  --glass-panel: rgba(22, 25, 34, 0.6);
  --glass-panel-weak: rgba(22, 25, 34, 0.55);
  --glass-panel-strong: rgba(22, 25, 34, 0.65);
  --glass-header: rgba(11, 13, 18, 0.85);
  --glass-tabbar: rgba(13, 15, 20, 0.8);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-border-weak: rgba(255, 255, 255, 0.06);
  --glass-border-strong: rgba(255, 255, 255, 0.08);
  --wash: rgba(255, 255, 255, 0.03);
  --shadow-hover: rgba(27, 31, 43, 0.75);
  --shadow-drag: rgba(0, 0, 0, 0.6);
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 1px rgba(255,255,255,0.04) inset, 0 14px 34px -14px rgba(0,0,0,0.6);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; overflow-x: clip; }

body {
  margin: 0;
  position: relative;
  background:
    radial-gradient(1000px 480px at 12% -8%, var(--bg-glow-accent), transparent 55%),
    radial-gradient(800px 420px at 88% 0%, var(--bg-glow-ok), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: clip;
}

/* Feines Korn über dem ganzen Hintergrund - Apple-Materialien sind nie
   komplett flach, das gibt der Glas-Fläche etwas Physisches statt eines
   reinen Farbverlaufs. Sehr dezent (3% Deckkraft), rein dekorativ,
   deshalb aria-hidden/pointer-events:none und kein Element im DOM-Baum. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

header, main, .login-wrap { position: relative; z-index: 1; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

a { color: inherit; }

/* Layout */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--glass-header);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
}

header h1 { font-family: var(--font-display); font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }

header nav { display: flex; align-items: center; gap: 2px; }
header nav a {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
header nav a svg { width: 16px; height: 16px; }
header nav a:hover { color: var(--text); background: var(--panel-hover); }
header nav a.active { color: var(--text); background: var(--panel-hover); }

main { padding: 28px 24px 90px; max-width: 1040px; margin: 0 auto; }
main.wide { max-width: 1280px; }

/* Bottom-Tab-Bar: nur mobil sichtbar, s. Media Query unten */
.tabbar { display: none; }

.greeting { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 24px; }
.greeting .sub { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 2px; }

.section { margin-top: 36px; }
.section:first-child { margin-top: 0; }
.section h2 {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 14px;
}

.section summary {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.section summary::-webkit-details-marker { display: none; }
.section summary::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s var(--ease);
}
.section details[open] summary::before { transform: rotate(45deg); }
.section details .aufgaben-list { margin-top: 2px; }

/* Buttons */

button, .btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--wash);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
button:hover, .btn:hover { border-color: var(--accent); background: var(--panel-hover); }
button:active, .btn:active { transform: scale(0.96); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

button.primary, .btn-primary {
  background-color: var(--accent);
  background-image: linear-gradient(180deg, var(--accent-strong), var(--accent));
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: 0 4px 16px -6px var(--accent-glow);
}
button.primary:hover, .btn-primary:hover { background: linear-gradient(180deg, var(--accent-stronger), var(--accent-strong)); border-color: var(--accent-strong); box-shadow: 0 6px 20px -6px var(--accent-glow-strong); }

.btn-danger { color: var(--danger); background: none; border: none; font-weight: 500; }
.btn-danger:hover { color: var(--danger-strong); background: var(--danger-soft); border: none; }

/* Form controls */

input[type=text], input[type=number], input[type=date], select, textarea {
  font-family: inherit;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--text-faint);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type=text]:focus, input[type=number]:focus, input[type=date]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=text]:active, input[type=number]:active, input[type=date]:active, select:active, textarea:active { border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
input::placeholder { color: var(--text-faint); }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
  padding-right: 34px;
}

input[type=date] { color-scheme: dark; }
input[type=date]::-webkit-calendar-picker-indicator {
  filter: invert(0.65);
  opacity: 0.8;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.15s ease;
}
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; flex-direction: column; gap: 6px; }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 160px; }
.form-row .field input, .form-row .field select { width: 100%; }

.form-msg { font-size: 12.5px; color: var(--muted); }
.form-msg.error { color: var(--danger); }
.form-msg.warn { color: var(--warn); }
.form-msg.ok { color: var(--ok); }

.new-module { margin-top: 18px; }
.new-module summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; }
.new-module summary:hover { color: var(--text); }
.new-module form { margin-top: 12px; }

/* Cards / grid */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

.card {
  background: var(--glass-panel);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: block;
  box-shadow: var(--shadow);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card:hover { border-color: var(--accent-border); background: var(--shadow-hover); transform: translateY(-2px) scale(1.005); box-shadow: var(--shadow), 0 0 24px -10px var(--accent-glow-faint), 0 0 0 1px var(--accent-glow-faint); }
.card:active { transform: translateY(0) scale(0.995); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card h2 { font-family: var(--font-display); margin: 0 0 4px; font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card .code { font-family: var(--font-mono); color: var(--muted); font-size: 11.5px; margin-bottom: 14px; }

.status-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--muted); flex-shrink: 0; }
.status-dot.läuft { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-dot.abgeschlossen { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.semester-group { margin-bottom: 22px; }
.semester-group:last-child { margin-bottom: 0; }
.semester-label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin: 0 0 10px; }

.archive { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 18px; }
.archive > summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; }
.archive > summary:hover { color: var(--text); }
.archive .semester-group { margin-top: 16px; }
.archive .card { opacity: 0.75; }
.archive .card:hover { opacity: 1; }

@keyframes cardIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.grid .card { animation: cardIn 0.25s ease both; }
.grid .card:nth-child(2) { animation-delay: 0.02s; }
.grid .card:nth-child(3) { animation-delay: 0.04s; }
.grid .card:nth-child(4) { animation-delay: 0.06s; }
.grid .card:nth-child(n+5) { animation-delay: 0.08s; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.badge.laeuft { color: var(--ok); background: var(--ok-soft); }
.badge.abgeschlossen { color: var(--accent); background: var(--accent-soft); }
.badge.privat { color: var(--warn); background: var(--warn-soft); }
.badge.bereich-uni { color: var(--accent); background: var(--accent-soft); }
.badge.bereich-arbeit { color: var(--ok); background: var(--ok-soft); }
.badge.bereich-privat { color: var(--warn); background: var(--warn-soft); }
.badge.tag { font-family: var(--font-mono); color: var(--muted); background: var(--surface); }

.progress { height: 5px; background: var(--surface); border-radius: 999px; margin-top: 14px; width: 100%; }
.progress > div {
  position: relative;
  height: 100%; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 999px;
  box-shadow: 0 0 8px 0 var(--accent-glow-soft);
  transition: transform 0.3s ease;
}

.countdown { font-family: var(--font-mono); font-size: 11.5px; margin-top: 10px; color: var(--muted); font-weight: 500; }
.countdown.soon { color: var(--warn); }
.countdown.overdue { color: var(--danger); }

/* Zeit-Ziele pro Bereich */

.zeitziel-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.zeitziel-row:last-child { border-bottom: none; }
.zeitziel-label { width: 60px; flex-shrink: 0; font-weight: 500; font-size: 13.5px; }
.zeitziel-bar { flex: 1; height: 5px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.zeitziel-bar > div { height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 999px; transition: transform 0.3s ease; }
.zeitziel-text { font-family: var(--font-mono); font-size: 12px; color: var(--muted); flex-shrink: 0; white-space: nowrap; }
.zeitziel-edit { flex-shrink: 0; width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 999px; }
.zeitziel-edit svg { width: 14px; height: 14px; }

/* Ernährung & Abnehmen
 * shape: app screen, redesigned full within the project's own locked system
 * (same tokens/faces as the rest of the Cockpit) - signature: the two daily
 * rings (kcal/Protein), the one object this screen is checked for first. */

.ampel-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ampel-dot.gruen { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.ampel-dot.rot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.ern-page { display: flex; flex-direction: column; gap: 16px; }

.ern-card {
  background: var(--glass-panel);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.ern-card > h2 {
  font-family: var(--font-display); margin: 0 0 14px; font-size: 14.5px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--text);
}
.ern-card > summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); list-style: none; }
.ern-card > summary::-webkit-details-marker { display: none; }
.ern-card > summary::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: rotate(-45deg); transition: transform 0.15s var(--ease);
}
.ern-card[open] > summary::before { transform: rotate(45deg); }
.ern-card[open] > summary { margin-bottom: 14px; }

/* Signature: Tagesziel-Ringe. Flaches Panel statt Glas, damit der
   Ring-Ausschnitt (::before) exakt mit dem Kartenhintergrund verschmilzt. */
.ern-hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 32px;
  box-shadow: var(--shadow);
}
.ern-rings { display: flex; gap: 20px; flex-shrink: 0; }
.ern-ring {
  --pct: 0;
  --ring-color: var(--accent);
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--surface) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ern-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--panel); }
.ern-ring.rot { --ring-color: var(--danger); }
.ern-ring-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.ern-ring-value { font-family: var(--font-mono); font-size: 19px; font-weight: 600; line-height: 1.1; }
.ern-ring-label { font-size: 11.5px; color: var(--muted); max-width: 80px; line-height: 1.3; }

.ern-hero-meta { display: flex; flex-direction: column; gap: 8px; min-width: 160px; }
.ern-hero-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.ern-hero-row .mono { font-family: var(--font-mono); color: var(--text); margin-left: auto; }
.ern-hero-row strong { color: var(--text); font-weight: 600; }

/* Kompakte Formulare (Tageseintrag, frei eingeben, Barcode, Gerichte,
   Ziele) - app-typische Steuerelementhöhe 32-40px statt Marketing-Felder. */
.ern-compact-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.ern-compact-form[hidden], .ern-field[hidden] { display: none; }
.ern-field { display: flex; flex-direction: column; gap: 5px; min-width: 110px; }
.ern-field.grow { flex: 1; }
.ern-field label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.ern-compact-form input { height: 36px; padding: 0 11px; font-size: 13.5px; }
.ern-compact-form button[type="submit"] { height: 36px; }
.ern-check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); height: 36px; cursor: pointer; }
.ern-check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* Mahlzeit hinzufügen: Suche + Ergebnisse + Bibliothek-Chips */
#suche { width: 100%; height: 38px; }
.ern-result-list { list-style: none; margin: 10px 0 0; padding: 0; }
.ern-result-list:empty { margin: 0; }
.ern-result-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.ern-result-list li:last-child { border-bottom: none; }
.ern-result-source { font-size: 11px; color: var(--text-faint); }

/* Gerichte-Schnellauswahl: Karten statt Pills, damit auch lange Namen
   ("More Iced Coffee Shake (2 Scoops, 700 ml Mandelmilch)") sauber
   umbrechen statt den Zeilenfluss zu sprengen (F15, F34). */
.ern-dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; margin-top: 14px; }
.ern-dish { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--wash); overflow: hidden; display: flex; flex-direction: column; }
.ern-dish-main {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  padding: 9px 11px; min-height: 38px; justify-content: center;
  border: none; border-radius: 0; background: none;
}
.ern-dish-name { font-size: 13px; font-weight: 500; line-height: 1.3; overflow-wrap: break-word; }
.ern-dish-werte { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ern-dish-main:hover { background: var(--panel-hover); }
.ern-dish-faktoren { display: flex; border-top: 1px solid var(--border-strong); }
.ern-dish-faktoren button {
  flex: 1; height: 32px; font-size: 11px; color: var(--muted);
  border: none; border-radius: 0; background: none; padding: 0;
}
.ern-dish-faktoren button:first-child { border-right: 1px solid var(--border-strong); }
.ern-dish-faktoren button:hover { background: var(--panel-hover); color: var(--text); }

.ern-add-more { display: flex; gap: 14px; margin-top: 14px; }
.btn-text {
  background: none; border: none; padding: 0; height: 32px; color: var(--muted);
  font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}
.btn-text:hover { color: var(--text); text-decoration-color: var(--accent); background: none; }

/* Mahlzeiten-Log */
.ern-meal-list { list-style: none; margin: 0; padding: 0; }
.ern-meal-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.ern-meal-list li:last-child { border-bottom: none; }
.ern-meal-quelle { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-faint); }
.ern-meal-name { flex: 1; min-width: 0; overflow-wrap: break-word; }
.ern-meal-werte { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.ern-mahlzeit-meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.ern-chart-wrap svg { width: 100%; height: auto; display: block; }
.ern-kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; margin-top: 16px; }
.ern-kennzahl { text-align: center; }
.ern-kennzahl .wert { font-family: var(--font-mono); font-size: 20px; font-weight: 600; color: var(--accent-light); }
.ern-kennzahl .label { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.ern-ziele-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.ern-ziele-form .ern-field { min-width: 0; }

/* Tages-Navigation + Verlauf */
.mono { font-family: var(--font-mono); }
.ampel-dot.leer { background: var(--border-strong); }

.ern-daynav {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--glass-panel);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.ern-daynav-mitte { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 1px; text-align: center; }
.ern-daynav-titel { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.ern-daynav-datum { font-size: 11.5px; color: var(--muted); }
.ern-daynav-btn {
  width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.ern-daynav-btn svg { width: 18px; height: 18px; }
.ern-daynav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ern-daynav input[type=date] { height: 36px; width: auto; padding: 0 10px; font-size: 13px; }
.ern-daynav .btn-text[hidden] { display: none; }

.ern-history { list-style: none; margin: 0; padding: 0; }
.ern-history-row {
  width: 100%; display: grid; grid-template-columns: 9px minmax(70px, 96px) minmax(40px, 90px) auto 1fr;
  align-items: center; gap: 12px; text-align: left;
  padding: 10px 8px; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; background: none; color: var(--text); font-size: 13.5px; height: auto;
}
.ern-history li:last-child .ern-history-row { border-bottom: none; }
.ern-history-row:hover { background: var(--panel-hover); }
.ern-history-row.aktiv { background: var(--wash); box-shadow: inset 2px 0 0 var(--accent); }
.ern-history-tag { display: flex; flex-direction: column; font-weight: 500; line-height: 1.25; }
.ern-history-sub { font-size: 11px; font-weight: 400; color: var(--text-faint); }
.ern-history-bar { height: 5px; border-radius: 3px; background: var(--wash); overflow: hidden; }
.ern-history-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.ern-history-bar span.rot { background: var(--danger); }
.ern-history-werte { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ern-history-extras { font-size: 12px; color: var(--text-faint); text-align: right; min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .ern-history-row { grid-template-columns: 9px 1fr auto; row-gap: 4px; }
  .ern-history-bar { display: none; }
  .ern-history-extras { grid-column: 2 / -1; text-align: left; }
  .ern-daynav-mitte { order: -1; flex-basis: 100%; }
  .ern-daynav-btn:first-child { order: 0; }
}

@media (max-width: 640px) {
  .ern-hero { padding: 18px; gap: 18px; }
  .ern-rings { width: 100%; justify-content: space-around; }
  .ern-hero-meta { width: 100%; }
}

.overdue-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  text-decoration: none;
}
.overdue-link:hover { text-decoration: underline; }

/* Tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; background: var(--panel); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--panel-hover); }

/* Week view */

.week-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.week-nav h2 { margin: 0; font-family: var(--font-mono); font-size: 13.5px; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: normal; flex: 1; text-align: center; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.day-col {
  background: var(--glass-panel-weak);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border-weak);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 170px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.day-col.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 20px -6px var(--accent-glow-soft); }
.day-head { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; }
.day-head span { font-family: var(--font-mono); font-weight: 500; }
.day-col.today .day-head { color: var(--accent); }
.day-empty { color: var(--border-strong); font-size: 12px; }

.day-event { background: var(--surface); border-radius: 7px; padding: 7px 9px; margin-bottom: 6px; font-size: 12px; transition: background 0.15s ease; }
.day-event:hover { background: var(--surface-hover); }
.day-event.privat { background: var(--warn-soft); border-left: 2px solid var(--warn); }
.day-event.uni { border-left: 2px solid var(--accent); }
.day-event.termin { background: var(--ok-soft); border-left: 2px solid var(--ok); }
.day-event.fahrzeit { opacity: 0.6; border-left: 2px dashed var(--border-strong); }
.day-event-time { font-family: var(--font-mono); color: var(--muted); font-size: 11px; }
.day-event-titel { margin-top: 2px; line-height: 1.3; font-weight: 500; }
.day-event-ort { color: var(--muted); font-size: 11px; margin-top: 2px; }

.kalender-legende { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.kalender-legende span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legende-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legende-dot.uni { background: var(--accent); }
.legende-dot.privat { background: var(--warn); }
.legende-dot.termin { background: var(--ok); }
.legende-dot.fahrzeit { background: var(--border-strong); }

@media (max-width: 900px) {
  .week-grid { grid-template-columns: 1fr; }
  .day-col { min-height: auto; }
}

/* Aufgaben-Kanban-Board (eigene Wochenansicht, gleiche Optik wie der Kalender) */

.day-col.past { opacity: 0.55; }
.day-col.future { opacity: 0.85; }

.task-card {
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: 12px 13px;
  margin-bottom: 8px;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: grab;
  transition: background 0.15s ease;
}
.task-card:hover { background: var(--surface-hover); }
.task-card:active { cursor: grabbing; }
.task-card input[type=checkbox] { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.task-card .task-body { flex: 1; min-width: 0; cursor: pointer; }
.task-card .task-titel { font-size: 14.5px; font-weight: 500; line-height: 1.4; }
.task-card.done .task-titel { text-decoration: line-through; color: var(--muted); }
.task-card .task-badges { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.task-card .task-badges .badge { font-size: 10.5px; padding: 2px 7px; }
.task-card.sortable-ghost { opacity: 0.3; }
.task-card.sortable-chosen { box-shadow: 0 0 0 1px var(--accent); }
.task-card.sortable-drag { box-shadow: 0 8px 20px -6px var(--shadow-drag); }

.timer-dot {
  flex-shrink: 0;
  width: 8px; height: 8px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 6px 1px var(--accent-glow-soft);
  animation: timerPulse 1.6s ease-in-out infinite;
}
@keyframes timerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.task-col { list-style: none; padding: 0; margin: 0; min-height: 24px; }

/* Zeiterfassung: Start/Stop-Button, optional neben dem normalen Abhaken */

.timer-btn {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 7px;
  height: auto;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
.timer-btn svg { width: 11px; height: 11px; flex-shrink: 0; }
.timer-btn:hover { border-color: var(--accent); color: var(--text); background: var(--panel-hover); }
.timer-btn.running { border-color: var(--accent); color: var(--accent-light); background: var(--accent-soft); box-shadow: 0 0 8px 0 var(--accent-glow-faint); }
.task-card .timer-btn { padding: 2px 6px; font-size: 10px; }
.timer-total { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* Aufgaben-Detail-Panel - Notion-artiger Peek von rechts, Seite dahinter bleibt sichtbar */

.task-detail-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 6, 9, 0.55);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.task-detail-backdrop.open { opacity: 1; pointer-events: auto; }

.task-detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  background: var(--glass-panel-strong);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border-left: 1px solid var(--glass-border-strong);
  box-shadow: -24px 0 60px -24px rgba(0,0,0,0.6);
  z-index: 51;
  padding: 24px 28px 32px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s var(--ease);
}
.task-detail-panel.open { transform: translateX(0); }

.task-detail-close {
  position: absolute; top: 18px; right: 18px;
  width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
}
.task-detail-close svg { width: 16px; height: 16px; }

.task-detail-check { display: flex; align-items: center; gap: 9px; margin: 4px 0 20px; cursor: pointer; width: fit-content; }
.task-detail-check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.task-detail-check span { color: var(--muted); font-size: 13px; font-weight: 500; }

.task-detail-title { font-family: var(--font-display); font-size: 25px; font-weight: 600; line-height: 1.3; margin: 0 0 16px; padding-right: 36px; }

.task-detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }
.task-detail-badges:empty { margin-bottom: 0; }

.task-detail-timer {
  text-align: center;
  padding: 32px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.task-detail-time { font-family: var(--font-mono); font-size: 48px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 18px; }
.timer-detail-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; font-size: 14.5px; font-weight: 600;
}
.timer-detail-btn svg { width: 16px; height: 16px; }
.timer-detail-btn.running { border-color: var(--danger); color: var(--danger); }
.timer-detail-btn.running:hover { border-color: var(--danger-strong); background: var(--danger-soft); }

@media (max-width: 640px) {
  .task-detail-panel { width: 100vw; border-left: none; }
}

/* Upload / files */

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.dropzone:hover { border-color: var(--accent); color: var(--text); }
.dropzone.drag { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

.filegroup-titel { font-size: 12px; color: var(--muted); font-weight: 600; margin: 18px 0 0; }
.filegroup-titel:first-child { margin-top: 10px; }
.filelist { list-style: none; padding: 0; margin: 14px 0 0; }
.filelist li { padding: 10px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; }
.filelist li:last-child { border-bottom: none; }
.filelist li span.size { font-family: var(--font-mono); color: var(--muted); font-size: 11px; margin-left: 6px; }
.filelist li .file-info { min-width: 0; overflow-wrap: break-word; flex: 1; }
.filelist li .file-info a { color: var(--text); text-decoration: none; }
.filelist li .file-info a:hover { color: var(--accent); text-decoration: underline; }
.filelist li .file-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: 10px; }
.filelist li .file-actions select { font-size: 12.5px; padding: 5px 24px 5px 8px; }

/* Aufgaben */

.aufgaben-list { list-style: none; padding: 0; margin: 0; }
.aufgaben-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.aufgaben-list li:last-child { border-bottom: none; }
.aufgaben-list label { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.aufgaben-list input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.aufgaben-done { text-decoration: line-through; color: var(--muted); }
.aufgaben-empty { color: var(--muted); font-size: 13px; padding: 14px 2px; }
.badge-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Kompakte, pillenförmige Inline-Felder statt der großen Formular-Inputs */
.badge-group select, .badge-group input[type=date] {
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--surface);
  border-color: var(--text-faint);
  color: var(--muted);
}
.badge-group select { padding-right: 28px; background-position: right 9px center; background-size: 13px; }
.badge-group input[type=date]::-webkit-calendar-picker-indicator { transform: scale(0.8); }

/* Quelle (z.B. Kurzbefehl) ist Metadaten, kein Bereich - bewusst zurückhaltender
   als die farbigen Bereich-Badges, damit beides nicht optisch verschmilzt. */
.badge.quelle {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border-strong);
}

/* Notizen (gerendertes Markdown) */

.notizen { color: var(--text); font-size: 14px; line-height: 1.65; }
.notizen h1, .notizen h2, .notizen h3 { color: var(--muted); font-size: 12px; font-weight: 600; margin: 22px 0 8px; }
.notizen h1:first-child, .notizen h2:first-child, .notizen h3:first-child { margin-top: 0; }
.notizen ul { padding-left: 20px; }
.notizen li { margin: 4px 0; }
.notizen li.task-list-item { list-style: none; margin-left: -20px; }
.notizen input[type=checkbox] { margin-right: 6px; accent-color: var(--accent); }
.notizen p { margin: 8px 0; }
.notizen code { background: var(--surface); padding: 2px 5px; border-radius: 4px; font-size: 0.9em; }

/* Login */

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box {
  background: var(--glass-panel-strong);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--glass-border-strong);
  border-radius: 24px;
  padding: 38px 32px;
  width: 100%;
  max-width: 300px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-box h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.login-box .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; }
.login-box input {
  width: 100%; font-family: var(--font-mono); font-size: 24px; font-weight: 500; letter-spacing: 0.35em; text-align: center;
  padding: 12px 10px 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--text-faint);
  background: var(--surface-strong); color: var(--text); margin: 0 0 16px; font-variant-numeric: tabular-nums;
}
.login-box button { width: 100%; padding: 11px; font-size: 14.5px; }
.login-box .error { color: var(--danger); font-size: 12.5px; min-height: 16px; margin-top: 10px; }

/* Sync banner */

.sync-banner {
  background: var(--danger-soft);
  color: var(--danger-light);
  border-bottom: 1px solid var(--danger);
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
}

/* Misc */

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { color: var(--text); }

/* Mobile */
@media (max-width: 640px) {
  header { padding: 14px 16px; }
  header nav .nav-link { display: none; }
  main { padding: 20px 16px 110px; }
  .grid { grid-template-columns: 1fr; }
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }
  #modul-status-row { flex-direction: column; align-items: stretch !important; }
  #modul-status-row > label { width: 100%; }
  #modul-status-row select, #modul-status-row input { width: 100%; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--glass-tabbar);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-top: 1px solid var(--glass-border);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
    z-index: 30;
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600;
    padding: 5px 18px; border-radius: 12px;
    transition: color 0.2s var(--ease), background 0.2s var(--ease);
  }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a:active { background: var(--panel-hover); }
}

/* iOS-Look (nur Smartphone / Homebildschirm-Web-App)
 * Desktop bleibt unverändert: alles hier greift erst unter 640px. Orientierung
 * an Apples eigenen Apps in Dark Mode: Systemfarben und -schrift, schwarzer
 * Hintergrund, gruppierte Karten, großer Titel, schwebende Glas-Tab-Bar,
 * Bottom-Sheet statt Seitenpanel. */
.navbar-compact, .add-toggle { display: none; }

@media (max-width: 640px) {
  :root {
    --font-display: var(--font-sans);
    --font-body: var(--font-sans);
    --font-mono: var(--font-sans);
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    --bg: #000;
    --panel: #1c1c1e;
    --panel-hover: #2c2c2e;
    --surface: #2c2c2e;
    --surface-hover: #3a3a3c;
    --surface-strong: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --border: rgba(84, 84, 88, 0.6);
    --border-strong: rgba(84, 84, 88, 0.9);
    --text: #fff;
    --muted: rgba(235, 235, 245, 0.6);
    --text-faint: rgba(235, 235, 245, 0.3);
    --accent: #0a84ff;
    --accent-strong: #0a84ff;
    --accent-stronger: #0a84ff;
    --accent-light: #409cff;
    --accent-ink: #fff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --accent-border: transparent;
    --accent-glow: transparent;
    --accent-glow-strong: transparent;
    --accent-glow-soft: transparent;
    --accent-glow-faint: transparent;
    --ok: #30d158;
    --ok-soft: rgba(48, 209, 88, 0.16);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, 0.16);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.16);
    --danger-strong: #ff6961;
    --danger-light: #ff6961;
    --glass-panel: var(--panel);
    --glass-panel-weak: var(--panel);
    --glass-panel-strong: var(--panel);
    --glass-border: transparent;
    --glass-border-weak: transparent;
    --wash: var(--fill);
    --radius: 22px;
    --radius-sm: 12px;
    --shadow: none;
  }

  html, body { background: var(--bg); }
  body { font-size: 16px; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
  body::before { display: none; }

  /* Großer Titel (Large Title) statt Kopfzeile; Abmelden als Icon rechts */
  header {
    position: relative;
    background: none;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: calc(env(safe-area-inset-top) + 14px) 20px 6px;
    align-items: flex-end;
  }
  header h1 { font-size: 34px; font-weight: 700; letter-spacing: 0.01em; line-height: 1.15; min-width: 0; overflow-wrap: anywhere; }
  header nav #logout { font-size: 0; gap: 0; padding: 6px; color: var(--accent); background: none; }
  header nav #logout svg { width: 24px; height: 24px; }

  .navbar-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 40;
    padding: env(safe-area-inset-top) 56px 0;
    height: calc(env(safe-area-inset-top) + 44px);
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border-bottom: 0.5px solid var(--border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
  }
  .navbar-compact.show { opacity: 1; }

  main { padding: 12px 16px calc(env(safe-area-inset-bottom) + 110px); }
  .greeting { font-size: 20px; font-weight: 600; margin: 0 4px 16px; }
  .greeting .sub { font-size: 15px; font-weight: 400; margin-top: 2px; }

  /* Gruppierte Karten wie in Health/Fitness */
  .ern-page { gap: 14px; }
  .ern-card, .ern-hero, .card { background: var(--panel); border: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .ern-card { padding: 16px; }
  .ern-card > h2 { font-size: 20px; font-weight: 700; letter-spacing: 0; margin-bottom: 10px; }
  .ern-card > summary { font-size: 17px; font-weight: 600; color: var(--text); }
  .ern-card > summary::before, .section summary::before { border-color: var(--text-faint); }
  .section h2, .section summary { font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; font-weight: 400; }

  .card { padding: 16px; }
  .card:hover { transform: none; background: var(--panel); border-color: transparent; box-shadow: none; }
  .card:active { transform: none; background: var(--panel-hover); }
  .card h2 { font-size: 17px; }
  .card .code { font-size: 13px; }
  .grid { gap: 10px; }
  .semester-label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; font-weight: 400; margin-left: 4px; }
  .grid .card { animation: none; }

  /* Listenzeilen: 44pt Mindesthöhe, feine Trennlinien */
  .aufgaben-list li, .ern-meal-list li, .ern-result-list li, .filelist li, .zeitziel-row {
    min-height: 44px; padding: 10px 0; font-size: 16px; border-bottom: 0.5px solid var(--border); gap: 10px;
  }
  .aufgaben-list label { font-size: 16px; color: var(--text); flex: 1; min-width: 0; flex-direction: row; gap: 12px; }
  .aufgaben-empty { font-size: 15px; }
  .filelist li { flex-wrap: wrap; }
  .filelist li .file-info { flex-basis: 100%; }
  .filelist li .file-actions { margin-left: 0; width: 100%; justify-content: space-between; }

  /* Buttons: Kapseln, sekundär grau gefüllt mit blauer Schrift */
  button, .btn {
    font-size: 15px; font-weight: 600; min-height: 36px; padding: 8px 16px;
    border: none; border-radius: 999px; background: var(--fill); color: var(--accent);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  button:hover, .btn:hover { border: none; background: var(--fill); }
  button:active, .btn:active { transform: none; opacity: 0.6; }
  button.primary, .btn-primary, button.primary:hover, .btn-primary:hover {
    background: var(--accent); color: #fff; box-shadow: none; border: none;
  }
  .btn-text, .btn-text:hover { color: var(--accent); text-decoration: none; background: none; min-height: 0; padding: 0; }
  .btn-danger, .btn-danger:hover { color: var(--danger); background: none; }

  /* Eingabefelder im iOS-Stil (17px verhindert zusätzlich das Auto-Zoomen) */
  :is(input[type=text], input[type=number], input[type=date], select, textarea) {
    font-size: 17px; min-height: 44px; height: auto; padding: 10px 14px;
    background-color: var(--fill); border: none; border-radius: 12px; color: var(--text);
  }
  :is(input[type=text], input[type=number], input[type=date], select, textarea):focus { box-shadow: none; }
  select { padding-right: 36px; }
  input::placeholder { color: var(--text-faint); }
  .ern-compact-form, .form-row { gap: 10px; }
  .ern-compact-form > *, .ern-compact-form .ern-field { flex: 1 1 100%; }
  .ern-compact-form button[type="submit"], .ern-compact-form > button { height: 44px; width: 100%; }
  .ern-field label, label { font-size: 13px; }
  #suche { height: auto; }

  /* Kleine Pillen-Felder in Listen bleiben kompakt */
  .badge-group select, .badge-group input[type=date] { font-size: 13px; min-height: 30px; padding: 4px 26px 4px 10px; border-radius: 999px; color: var(--muted); }
  .badge-group input[type=date] { padding-right: 10px; }
  .badge { font-size: 12px; padding: 3px 9px; }

  /* Runde Abhak-Kreise wie in Erinnerungen */
  input[type=checkbox] {
    -webkit-appearance: none; appearance: none; flex-shrink: 0;
    width: 24px !important; height: 24px !important; margin: 0;
    border: 1.5px solid var(--text-faint); border-radius: 50%; background: none;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
  }
  input[type=checkbox]:checked {
    border-color: var(--accent);
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 15px no-repeat;
  }
  /* "Gym heute" als iOS-Schalter */
  .ern-check { font-size: 17px; height: 44px; justify-content: space-between; flex-direction: row-reverse; width: 100%; }
  .ern-check input[type=checkbox] {
    width: 51px !important; height: 31px !important; border: none; border-radius: 999px;
    background: radial-gradient(circle at 15.5px 50%, #fff 13.5px, transparent 14px), #39393d;
  }
  .ern-check input[type=checkbox]:checked {
    background: radial-gradient(circle at 35.5px 50%, #fff 13.5px, transparent 14px), var(--ok);
  }

  /* Wochenansicht: Tage als Liste, Navigation als Leiste darüber */
  .week-nav { flex-wrap: wrap; gap: 8px; }
  .week-nav h2 { order: -1; flex-basis: 100%; font-size: 17px; font-weight: 600; }
  .week-nav button { flex: 1; }
  /* Tage nebeneinander zum Wischen, jeweils ein Tag pro "Seite" plus Vorschau auf den nächsten */
  .week-grid {
    display: flex; gap: 10px; align-items: stretch;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 4px -16px 0; padding: 0 16px; scroll-padding: 0 16px;
    -webkit-overflow-scrolling: touch;
  }
  .week-grid::-webkit-scrollbar { display: none; }
  .day-col, .day-col.today {
    flex: 0 0 82%; scroll-snap-align: start; min-height: 160px;
    background: rgba(0, 0, 0, 0.35); border: 1px solid transparent; border-radius: 16px; box-shadow: none;
    padding: 12px; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .day-col.today { border-color: var(--accent); }
  .day-col.past { opacity: 0.6; }

  /* Aufgaben-Seite mobil: Board zuerst, Formular nur über den Plus-Button */
  .add-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; min-height: 0; padding: 0; margin-right: 4px;
  }
  .add-toggle svg { width: 20px; height: 20px; }
  .add-toggle[aria-expanded="true"] svg { transform: rotate(45deg); }
  .add-toggle svg { transition: transform 0.2s var(--ease); }
  .add-card { display: none; order: -2; }
  .add-card.open { display: block; }
  .ern-page > :has(#board) { order: -1; }
  .ern-page > :has(#zeitziele) { order: 1; }
  .ern-page > :has(#erledigtDetails) { order: 2; }
  .task-card:active { background: var(--surface-hover); }
  .day-head { font-size: 15px; color: var(--text); }
  .day-head span { color: var(--muted); }
  .day-col.today .day-head, .day-col.today .day-head span { color: var(--accent); }
  .day-empty { color: var(--text-faint); font-size: 15px; }
  .day-event, .day-event.uni, .day-event.privat, .day-event.termin, .day-event.fahrzeit {
    background: var(--surface); border-radius: 12px; padding: 10px 12px; font-size: 15px; border-left: 4px solid var(--accent);
  }
  .day-event.privat { border-left-color: var(--warn); }
  .day-event.termin { border-left-color: var(--ok); }
  .day-event.fahrzeit { border-left-color: var(--border-strong); }
  .day-event-time, .day-event-ort { font-size: 13px; }
  .task-card { background: var(--surface); border-radius: 12px; padding: 12px; gap: 12px; }
  .task-card .task-titel { font-size: 16px; }
  .kalender-legende { border-top: 0.5px solid var(--border); }
  .kalender-legende span { font-size: 13px; }

  /* Aufgaben-Detail als Bottom-Sheet */
  .task-detail-backdrop { background: rgba(0, 0, 0, 0.5); }
  .task-detail-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100vw; max-height: 92vh;
    border: none; border-radius: 22px 22px 0 0; background: var(--panel);
    backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none;
    padding: 28px 20px calc(env(safe-area-inset-bottom) + 24px);
    transform: translateY(100%);
    transition: transform 0.35s var(--ease);
  }
  .task-detail-panel.open { transform: translateY(0); }
  .task-detail-panel::before {
    content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 5px;
    margin-left: -18px; border-radius: 999px; background: var(--text-faint);
  }
  .task-detail-check { flex-direction: row; gap: 10px; }
  .task-detail-check span { font-size: 15px; }
  .task-detail-title { font-size: 24px; font-weight: 700; }
  .task-detail-time { font-size: 56px; font-weight: 300; }
  .task-detail-timer { border-color: var(--border); }
  .task-detail-close { min-height: 0; width: 30px; height: 30px; padding: 0; color: var(--muted); }

  /* Ernährung: Ringe, Kennzahlen */
  .ern-ring-value { font-size: 22px; font-weight: 700; }
  .ern-ring-label { font-size: 12px; }
  .ern-hero-row { font-size: 15px; }
  .ern-dish { border: none; background: var(--surface); }
  .ern-dish-faktoren { border-top: 0.5px solid var(--border); }
  .ern-dish-faktoren button { min-height: 36px; border-radius: 0; background: none; color: var(--accent); }
  .ern-dish-faktoren button:first-child { border-right: 0.5px solid var(--border); }
  .ern-dish-main { min-height: 44px; border-radius: 0; color: var(--text); }
  .ern-dish-name { font-size: 15px; }
  .ern-dish-grid { grid-template-columns: 1fr 1fr; }
  .ern-kennzahl .wert { font-size: 22px; }

  .timer-btn, .timer-btn:hover { min-height: 28px; border: none; background: var(--fill); color: var(--accent); font-size: 13px; padding: 4px 10px; }
  .timer-btn.running { background: var(--accent); color: #fff; box-shadow: none; }
  .zeitziel-edit, .zeitziel-edit:hover { min-height: 0; padding: 0; width: 32px; height: 32px; }
  .progress, .zeitziel-bar { height: 6px; }
  .progress > div, .zeitziel-bar > div { background: var(--accent); box-shadow: none; }

  .dropzone { border: 1.5px dashed var(--border-strong); border-radius: 16px; font-size: 15px; color: var(--accent); }
  .table-wrap { border: none; border-radius: 16px; background: var(--panel); }
  th { background: none; }
  .notizen { font-size: 16px; }

  /* Schwebende Glas-Tab-Bar (Liquid-Glass-Stil) */
  .tabbar {
    left: 16px; right: 16px;
    bottom: max(10px, calc(env(safe-area-inset-bottom) - 12px));
    padding: 5px;
    gap: 2px;
    border-radius: 999px;
    border: 0.5px solid rgba(255, 255, 255, 0.14);
    background: rgba(37, 37, 40, 0.62);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
  .tabbar a {
    flex: 1; gap: 2px; padding: 7px 0 6px; border-radius: 999px;
    font-size: 10px; font-weight: 600; color: var(--text);
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--accent); background: rgba(255, 255, 255, 0.1); }
  .tabbar a:active { background: rgba(255, 255, 255, 0.14); }

  .sync-banner { padding-top: calc(env(safe-area-inset-top) + 9px); }
  .sync-banner + header { padding-top: 14px; }

  /* Login */
  .login-box { background: none; border: none; box-shadow: none; padding: 0; max-width: 340px; }
  .login-box h2 { font-size: 28px; font-weight: 700; }
  .login-box .sub { font-size: 15px; }
  .login-box input { font-size: 28px; min-height: 56px; border: none; background: var(--panel); border-radius: 14px; }
  .login-box button { min-height: 50px; font-size: 17px; border-radius: 14px; }
}
