/* ===== base.css ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: none; text-size-adjust: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; scroll-behavior: smooth;
}
body { min-height: 100dvh; line-height: 1.6; font-family: var(--font-body); font-size: var(--text-base); color: var(--color-text); background-color: var(--color-bg); }
img, svg { display: block; max-width: 100%; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; }
p, li { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }
a, button, [role="button"], input, select { transition: color var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ===== Design Tokens ===== */
:root, [data-theme="light"] {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;

  /* Clinical teal system — precise, trustworthy, calm */
  --color-bg: #f4f7f7;
  --color-surface: #ffffff;
  --color-surface-2: #fbfcfc;
  --color-surface-offset: #eaf0f0;
  --color-border: #d7e2e1;
  --color-divider: #e2eae9;
  --color-text: #16292b;
  --color-text-muted: #5a7071;
  --color-text-faint: #9db2b1;
  --color-text-inverse: #f4f7f7;

  --color-primary: #0d6e6e;
  --color-primary-hover: #0a5757;
  --color-primary-active: #084444;
  --color-primary-highlight: #d9ebe9;

  --color-warning: #b5560f;
  --color-warning-hover: #94440c;
  --color-warning-highlight: #f6e1d1;

  --color-error: #a3273d;
  --color-error-hover: #841f31;
  --color-error-highlight: #f3d9de;

  --color-success: #3f7d3a;
  --color-success-highlight: #ddebda;

  --color-gold: #ab7d1f;
  --color-gold-highlight: #f1e6cd;

  --radius-sm: 0.375rem; --radius-md: 0.625rem; --radius-lg: 0.9rem; --radius-xl: 1.25rem; --radius-full: 9999px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgba(15, 40, 40, 0.06);
  --shadow-md: 0 6px 20px rgba(15, 40, 40, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 40, 40, 0.14);

  --font-display: 'General Sans', 'Segoe UI', sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --color-bg: #0f1a1b;
  --color-surface: #142324;
  --color-surface-2: #17282a;
  --color-surface-offset: #1a2c2d;
  --color-border: #274142;
  --color-divider: #203738;
  --color-text: #dbe8e7;
  --color-text-muted: #8fa8a8;
  --color-text-faint: #56706f;
  --color-text-inverse: #16292b;

  --color-primary: #52b3ab;
  --color-primary-hover: #74c6bf;
  --color-primary-active: #3f9a92;
  --color-primary-highlight: #1c3634;

  --color-warning: #e08a4e;
  --color-warning-highlight: #3a2c1e;

  --color-error: #de6d80;
  --color-error-highlight: #3a2027;

  --color-success: #7dc177;
  --color-success-highlight: #223523;

  --color-gold: #d8b25a;
  --color-gold-highlight: #3a2f18;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.5);
}

/* ===== Layout ===== */
.app-shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: 264px; flex-shrink: 0; background: var(--color-surface); border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column; padding: var(--space-6) var(--space-4);
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2) var(--space-6); }
.brand-logo { width: 36px; height: 36px; color: var(--color-primary); flex-shrink: 0; }
.brand-text { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); line-height: 1.25; color: var(--color-text); }
.brand-text span { display: block; font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 400; font-family: var(--font-body); }

.nav-list { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--color-text-muted); font-weight: 500;
  text-align: left; width: 100%;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--color-surface-offset); color: var(--color-text); }
.nav-item.active { background: var(--color-primary-highlight); color: var(--color-primary); }

.sidebar-footer { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--color-divider); margin-top: var(--space-4); }
.theme-toggle {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--color-border);
  font-size: var(--text-xs); color: var(--color-text-muted); background: var(--color-surface-2);
}
.theme-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ===== Konto / Sync ===== */
.sync-status { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-faint); padding: 0 var(--space-1); }
.sync-status .sync-icon { width: 13px; height: 13px; flex-shrink: 0; }
.sync-status[data-state="saved"] { color: var(--color-success); }
.sync-status[data-state="saving"] { color: var(--color-text-muted); }
.sync-status[data-state="saving"] .sync-icon { animation: spin 900ms linear infinite; }
.sync-status[data-state="error"] { color: var(--color-error); }
.sync-status[data-state="guest"] { color: var(--color-text-faint); }
@keyframes spin { to { transform: rotate(360deg); } }

.account-toggle {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--color-border);
  font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); background: var(--color-surface-2); width: 100%;
}
.account-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
.account-toggle svg { width: 16px; height: 16px; flex-shrink: 0; }
.account-toggle[data-logged-in="true"] { color: var(--color-primary); border-color: color-mix(in oklab, var(--color-primary) 40%, transparent); background: var(--color-primary-highlight); }

/* ===== Modal ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 100; background: rgba(15, 26, 27, 0.55);
  align-items: center; justify-content: center; padding: var(--space-5);
}
.modal-overlay.open { display: flex; }
.modal {
  position: relative; width: 100%; max-width: 420px; background: var(--color-surface); border-radius: var(--radius-xl);
  border: 1px solid var(--color-border); box-shadow: var(--shadow-lg); padding: var(--space-8) var(--space-6) var(--space-6);
  max-height: 90dvh; overflow-y: auto;
}
.modal-close { position: absolute; top: var(--space-4); right: var(--space-4); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); color: var(--color-text-muted); }
.modal-close:hover { background: var(--color-surface-offset); color: var(--color-text); }
.modal-close svg { width: 18px; height: 18px; }
.modal-eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-primary); margin-bottom: var(--space-2); }
.modal-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-3); }
.modal-text { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-6); }
.modal-text strong { color: var(--color-text); }

.modal-tabs { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); background: var(--color-surface-offset); border-radius: var(--radius-md); padding: var(--space-1); }
.modal-tabs[hidden] { display: none; }
.modal-tab { flex: 1; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.modal-tab.active { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-sm); }

.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-form[hidden] { display: none; }
.auth-form label { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.auth-form input { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); font-size: var(--text-sm); color: var(--color-text); font-weight: 400; }
.auth-form input:focus { border-color: var(--color-primary); }
.auth-form .btn { justify-content: center; }
.auth-error { font-size: var(--text-xs); color: var(--color-error); min-height: 1em; }
.auth-success { font-size: var(--text-xs); color: var(--color-success, #2f9e60); background: var(--color-success-highlight, rgba(47, 158, 96, 0.1)); padding: var(--space-3); border-radius: var(--radius-md); line-height: 1.5; }
.auth-link-btn { background: none; border: none; padding: 0; margin-top: calc(-1 * var(--space-2)); font-size: var(--text-xs); color: var(--color-primary); text-decoration: underline; cursor: pointer; align-self: flex-start; }
.auth-link-btn:hover { color: var(--color-primary-dark, var(--color-primary)); }
.auth-hint { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-6); line-height: 1.5; }

/* ===== Abo / Paywall ===== */
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.legal-link.inline { display: inline; text-decoration: underline; color: var(--color-primary); font-size: inherit; padding: 0; }
.legal-link.inline:hover { color: var(--color-primary-hover); }

.pricing-card {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm); padding: var(--space-8) var(--space-8) var(--space-6); max-width: 480px; text-align: center;
}
.pricing-badge {
  display: inline-block; background: var(--color-primary-highlight); color: var(--color-primary); font-size: var(--text-xs);
  font-weight: 700; letter-spacing: 0.02em; padding: var(--space-2) var(--space-4); border-radius: var(--radius-full); margin-bottom: var(--space-5);
}
.pricing-amount { font-size: var(--text-2xl); font-weight: 700; color: var(--color-text); margin-bottom: var(--space-3); }
.pricing-amount span { font-size: var(--text-base); font-weight: 500; color: var(--color-text-muted); }
.pricing-note { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.6; margin-bottom: var(--space-6); }
.pricing-features { list-style: none; padding: 0; margin: 0 0 var(--space-6); text-align: left; display: flex; flex-direction: column; gap: var(--space-3); }
.pricing-features li { position: relative; padding-left: var(--space-6); font-size: var(--text-sm); color: var(--color-text); }
.pricing-features li::before { content: "\2713"; position: absolute; left: 0; top: 0; color: var(--color-primary); font-weight: 700; }
#paywallActionArea { margin-bottom: var(--space-4); }
#paywallActionArea .btn { width: 100%; justify-content: center; }
.pricing-pending { font-size: var(--text-sm); color: var(--color-text-muted); background: var(--color-surface-offset); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); }
.paywall-error { color: var(--color-error); font-size: var(--text-xs); min-height: 1em; margin-bottom: var(--space-3); }
.pricing-methods { font-size: var(--text-xs); color: var(--color-text-faint); margin-bottom: var(--space-2); }
.pricing-legal { font-size: var(--text-xs); color: var(--color-text-faint); }

.billing-status-block {
  margin: var(--space-5) 0; padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-offset);
}
.billing-status-badge {
  display: inline-block; font-size: var(--text-xs); font-weight: 700; padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
  margin-bottom: var(--space-2); background: var(--color-surface); color: var(--color-text-muted); border: 1px solid var(--color-border);
}
.billing-status-badge[data-state="active"] { background: var(--color-success-highlight); color: var(--color-success); border-color: color-mix(in oklab, var(--color-success) 30%, transparent); }
.billing-status-badge[data-state="warn"] { background: var(--color-warning-highlight); color: var(--color-warning); border-color: color-mix(in oklab, var(--color-warning) 30%, transparent); }
.billing-status-badge[data-state="pending"] { background: var(--color-primary-highlight); color: var(--color-primary); }
.billing-status-text { font-size: var(--text-sm); color: var(--color-text); line-height: 1.5; margin-bottom: var(--space-3); }
.billing-status-actions .btn { width: 100%; justify-content: center; }
.billing-error { color: var(--color-error); font-size: var(--text-xs); margin-top: var(--space-2); }

.main { flex: 1; min-width: 0; padding: var(--space-8) clamp(var(--space-6), 4vw, var(--space-16)); max-width: 1120px; }

.mobile-topbar { display: none; }

/* ===== Section headers ===== */
.page-header { margin-bottom: var(--space-8); }
.page-eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-primary); margin-bottom: var(--space-2); }
.page-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; color: var(--color-text); margin-bottom: var(--space-2); }
.page-subtitle { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 60ch; }

/* ===== Disclaimer ===== */
.disclaimer {
  display: flex; gap: var(--space-3); background: var(--color-warning-highlight); border: 1px solid color-mix(in oklab, var(--color-warning) 30%, transparent);
  border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-8);
}
.disclaimer svg { width: 20px; height: 20px; color: var(--color-warning); flex-shrink: 0; margin-top: 2px; }
.disclaimer p { font-size: var(--text-sm); color: var(--color-text); }
.disclaimer strong { color: var(--color-warning); }

/* ===== Cards / grid ===== */
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: var(--space-10); }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.stat-card .num { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; color: var(--color-primary); }
.stat-card .label { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }

.link-card {
  display: flex; align-items: flex-start; gap: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); text-align: left; width: 100%;
}
.link-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.link-card .icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--color-primary-highlight); color: var(--color-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.link-card .icon svg { width: 20px; height: 20px; }
.link-card h3 { font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-1); }
.link-card p { font-size: var(--text-xs); color: var(--color-text-muted); }

.section-block { margin-bottom: var(--space-10); }
.section-block h2 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-4); }

/* ===== Weekly plan table ===== */
.plan-table { width: 100%; table-layout: fixed; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); background: var(--color-surface); border-collapse: collapse; }
.plan-table th, .plan-table td { padding: var(--space-2) var(--space-3); text-align: left; font-size: var(--text-sm); border-bottom: 1px solid var(--color-divider); }
.plan-table th { background: var(--color-surface-offset); font-family: var(--font-display); font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.plan-table th:last-child { width: 44px; }
.plan-table tr:last-child td { border-bottom: none; }
.section-header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.section-header-row h2 { margin-bottom: 0; }
.section-hint { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-4); }
.plan-input { width: 100%; border: 1px solid transparent; background: transparent; padding: var(--space-2) var(--space-2); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--color-text); font-family: inherit; }
.plan-input:hover { border-color: var(--color-border); }
.plan-input:focus { border-color: var(--color-primary); background: var(--color-surface-offset); outline: none; }
.plan-input::placeholder { color: var(--color-text-faint); }
.plan-delete-btn { margin: 0 auto; }
.plan-add-btn { margin-top: var(--space-4); }

/* ===== Toolbar (search/filter) ===== */
.toolbar { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }
.search-input {
  flex: 1; min-width: 200px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-surface); font-size: var(--text-sm);
}
.search-input:focus { border-color: var(--color-primary); }
.filter-select { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); font-size: var(--text-sm); }
.result-count { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: var(--space-4); }

/* ===== Med table ===== */
.med-table-wrap { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.med-row { border-bottom: 1px solid var(--color-divider); padding: var(--space-5); cursor: pointer; }
.med-row:last-child { border-bottom: none; }
.med-row:hover { background: var(--color-surface-offset); }
.med-row-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.med-row-head .name { font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); }
.med-tag { font-size: var(--text-xs); font-weight: 600; padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); background: var(--color-primary-highlight); color: var(--color-primary); white-space: nowrap; }
.med-row-dosage { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-1); }
.med-details { display: none; margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px dashed var(--color-divider); }
.med-row.open .med-details { display: block; }
.med-details dl { display: grid; grid-template-columns: 160px 1fr; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.med-details dt { color: var(--color-text-muted); font-weight: 500; }
.med-details dd { color: var(--color-text); }
.med-details .warn dd { color: var(--color-error); }
.chevron { width: 16px; height: 16px; color: var(--color-text-faint); flex-shrink: 0; transition: transform var(--transition); }
.med-row.open .chevron { transform: rotate(90deg); }

/* ===== Flashcards ===== */
.flash-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.flash-progress { font-size: var(--text-sm); color: var(--color-text-muted); }
.flash-stage { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); }
.flashcard {
  width: 100%; max-width: 560px; min-height: 260px; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md); display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; padding: var(--space-10) var(--space-8); position: relative;
}
.flashcard-cat { position: absolute; top: var(--space-5); left: var(--space-5); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.flashcard-diff { position: absolute; top: var(--space-5); right: var(--space-5); font-size: var(--text-xs); font-weight: 600; padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); }
.diff-Leicht { background: var(--color-success-highlight); color: var(--color-success); }
.diff-Mittel { background: var(--color-gold-highlight); color: var(--color-gold); }
.diff-Schwer { background: var(--color-error-highlight); color: var(--color-error); }
.flashcard-label { font-size: var(--text-xs); color: var(--color-text-faint); margin-bottom: var(--space-3); text-transform: uppercase; letter-spacing: 0.06em; }
.flashcard-text { font-size: var(--text-lg); font-weight: 500; color: var(--color-text); }
.flashcard.answer .flashcard-text { color: var(--color-primary); }
.flash-hint { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-4); }

.flash-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; justify-content: center; }
.btn { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600; }
.btn[hidden] { display: none; }
.btn-primary { background: var(--color-primary); color: var(--color-text-inverse); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-ghost { background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); }
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-success { background: var(--color-success-highlight); color: var(--color-success); border: 1px solid color-mix(in oklab, var(--color-success) 30%, transparent); }
.btn-success:hover { background: var(--color-success); color: white; }
.btn-error { background: var(--color-error-highlight); color: var(--color-error); border: 1px solid color-mix(in oklab, var(--color-error) 30%, transparent); }
.btn-error:hover { background: var(--color-error); color: white; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

/* ===== Checklists ===== */
.checklist-group { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: var(--space-6); overflow: hidden; }
.checklist-group-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5); gap: var(--space-3); }
.checklist-group-header .title-wrap { display: flex; align-items: center; gap: var(--space-3); }
.checklist-group-header .icon { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.checklist-group-header h3 { font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; }
.checklist-group-header .header-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.checklist-progress-badge { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); background: var(--color-surface-offset); padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); white-space: nowrap; }
.checklist-reset-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-md); color: var(--color-text-faint); flex-shrink: 0; }
.checklist-reset-btn:hover { background: var(--color-surface-offset); color: var(--color-error); }
.checklist-reset-btn svg { width: 14px; height: 14px; }
.checklist-reminder-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-md); color: var(--color-text-faint); flex-shrink: 0; }
.checklist-reminder-btn:hover { background: var(--color-surface-offset); color: var(--color-primary); }
.checklist-reminder-btn svg { width: 15px; height: 15px; }
.reminder-chip { margin: 0 var(--space-5) var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-primary-highlight); color: var(--color-primary); font-size: var(--text-xs); font-weight: 600; cursor: pointer; display: inline-block; }
.reminder-chip.is-due { background: var(--color-error-highlight); color: var(--color-error); }
.reminder-panel { margin: 0 var(--space-5) var(--space-4); padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-offset); display: flex; flex-direction: column; gap: var(--space-3); }
.reminder-panel[hidden] { display: none; }
.reminder-chip[hidden] { display: none; }
.reminder-field { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.reminder-field input { font-family: inherit; font-size: var(--text-sm); font-weight: 400; color: var(--color-text); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.reminder-field input:focus { outline: none; border-color: var(--color-primary); }
.reminder-panel-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.checklist-items { padding: 0 var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.check-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) var(--space-2); border-radius: var(--radius-md); cursor: pointer; font-size: var(--text-sm); }
.check-item:hover { background: var(--color-surface-offset); }
.check-item input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--color-primary); flex-shrink: 0; }
.check-item.checked span { color: var(--color-text-faint); text-decoration: line-through; }
.icon-mh { background: var(--color-error-highlight); color: var(--color-error); }
.icon-ana { background: var(--color-warning-highlight); color: var(--color-warning); }
.icon-airway { background: var(--color-primary-highlight); color: var(--color-primary); }
.icon-cpr { background: var(--color-gold-highlight); color: var(--color-gold); }
.icon-selfcare { background: var(--color-success-highlight); color: var(--color-success); }

.reset-row { display: flex; justify-content: flex-end; margin-bottom: var(--space-5); }

/* ===== Resource list ===== */
.resource-group { margin-bottom: var(--space-8); }
.resource-group h2 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-4); }
.resource-list { display: flex; flex-direction: column; gap: var(--space-2); }
.resource-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.resource-item:hover { border-color: var(--color-primary); }
.resource-item a { font-size: var(--text-sm); font-weight: 500; color: var(--color-text); }
.resource-item a:hover { color: var(--color-primary); }
.resource-item svg { width: 16px; height: 16px; color: var(--color-text-faint); flex-shrink: 0; }

/* ===== Utility ===== */
.view { display: none; }
.view.active { display: block; animation: fadein 220ms ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.empty-state { text-align: center; padding: var(--space-16) var(--space-6); color: var(--color-text-muted); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto var(--space-4); color: var(--color-text-faint); }

/* ===== Push-Benachrichtigungen ===== */
.push-status-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-3); flex-wrap: wrap; }
.push-status-text { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
.push-status-row[data-state="active"] .push-status-text { color: var(--color-primary); font-weight: 600; }
.push-status-row[data-state="error"] .push-status-text,
.push-status-row[data-state="unsupported"] .push-status-text { color: var(--color-text-muted); }

/* ===== Erinnerungs-Übersicht (Dashboard) ===== */
.reminder-overview-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-2); }
.reminder-overview-item.is-due { border-color: color-mix(in oklab, var(--color-error) 40%, transparent); background: var(--color-error-highlight); }
.reminder-overview-icon { font-size: var(--text-lg); flex-shrink: 0; }
.reminder-overview-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.reminder-overview-body strong { font-size: var(--text-sm); font-weight: 600; }
.reminder-overview-body span { font-size: var(--text-xs); color: var(--color-text-muted); }
.reminder-overview-item.is-due .reminder-overview-body span { color: var(--color-error); font-weight: 600; }
.reminder-overview-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.highlight-flash { animation: highlight-flash 1.5s ease; }
@keyframes highlight-flash { 0%, 100% { box-shadow: none; } 15%, 55% { box-shadow: 0 0 0 3px var(--color-primary); } }

/* ===== Toasts (Erinnerungen) ===== */
.toast-container { position: fixed; bottom: var(--space-5); right: var(--space-5); z-index: 100; display: flex; flex-direction: column; gap: var(--space-3); max-width: 320px; }
.toast { display: flex; align-items: flex-start; gap: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: var(--space-4); animation: toast-in 200ms ease; }
.toast-icon { font-size: var(--text-lg); flex-shrink: 0; }
.toast-body { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-sm); }
.toast-body strong { font-weight: 600; }
.toast-body span { color: var(--color-text-muted); font-size: var(--text-xs); }
.toast-close { color: var(--color-text-faint); font-size: var(--text-lg); line-height: 1; flex-shrink: 0; margin-left: auto; }
.toast-close:hover { color: var(--color-text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 860px) {
  .toast-container { left: var(--space-4); right: var(--space-4); max-width: none; }
}

/* ===== Rechtliches (Impressum / AGB / Datenschutz) ===== */
.legal-links { display: flex; align-items: center; justify-content: center; gap: var(--space-2); padding-top: var(--space-2); font-size: var(--text-xs); }
.legal-link { color: var(--color-text-faint); font-size: var(--text-xs); padding: 2px 0; }
.legal-link:hover { color: var(--color-primary); }
.legal-links-sep { color: var(--color-text-faint); }
.legal-tabs { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); background: var(--color-surface-offset); border-radius: var(--radius-md); padding: var(--space-1); max-width: 480px; }
.legal-tab { flex: 1; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.legal-tab.active { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-sm); }
.legal-panel { display: none; }
.legal-panel.active { display: block; animation: fadein 220ms ease; }
.legal-panel .section-block h2 { margin-top: var(--space-8); }
.legal-panel .section-block h2:first-child { margin-top: 0; }
.legal-panel .section-block p { font-size: var(--text-sm); line-height: 1.6; color: var(--color-text); margin-bottom: var(--space-4); }
.legal-panel .section-block p strong { color: var(--color-text); }
.legal-panel .section-block a { color: var(--color-primary); text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--color-primary) 40%, transparent); }
.legal-list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0 0 var(--space-4); padding-left: var(--space-5); font-size: var(--text-sm); line-height: 1.6; color: var(--color-text); }
.legal-list li { list-style: disc; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { display: none; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding: var(--space-4) var(--space-5);
  }
  .mobile-topbar .brand { padding: 0; }
  .mobile-nav-toggle { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
  .mobile-nav-toggle svg { width: 18px; height: 18px; }
  .sidebar.mobile-open { display: flex; position: fixed; inset: 0; width: 100%; height: 100dvh; z-index: 30; }
  .main { padding: var(--space-6) var(--space-4); max-width: 100%; }
  .med-details dl { grid-template-columns: 1fr; gap: var(--space-1) 0; }
  .med-details dt { margin-top: var(--space-2); }
}
