/* Art direction: Task management / productivity app → clean, precise, functional
   Palette: dark-first, teal accent
   Typography: Geist (body+headings) — crisp, monospace undertone for dev feel
   Density: dense but breathable */

:root, [data-theme="light"] {
  --color-bg:             #f7f6f2;
  --color-surface:        #f9f8f5;
  --color-surface-2:      #fbfbf9;
  --color-surface-offset: #f0ede8;
  --color-divider:        #dcd9d5;
  --color-border:         #d4d1ca;
  --color-text:           #1a1917;
  --color-text-muted:     #6b6a67;
  --color-text-faint:     #a8a7a3;
  --color-primary:        #01696f;
  --color-primary-hover:  #0c4e54;
  --color-primary-bg:     #e8f4f4;
  --color-error:          #c0392b;
  --color-error-hover:    #a93226;
  --color-error-bg:       #faeae8;
  --color-success:        #27ae60;
  --color-success-bg:     #e8f8ee;
  --color-warning:        #e67e22;
  --color-warning-bg:     #fdf3e3;
  --color-prio-hoch:      #c0392b;
  --color-prio-mittel:    #e67e22;
  --color-prio-niedrig:   #27ae60;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:   0 12px 32px rgba(0,0,0,0.12);
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-full: 9999px;
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --transition:  180ms cubic-bezier(0.16, 1, 0.3, 1);
  --font-body: 'Geist', 'Inter', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'Fira Code', monospace;
  --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, 2rem);
  --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;
}

[data-theme="dark"] {
  --color-bg:             #111110;
  --color-surface:        #171615;
  --color-surface-2:      #1c1b1a;
  --color-surface-offset: #201f1e;
  --color-divider:        #272624;
  --color-border:         #343230;
  --color-text:           #e8e7e5;
  --color-text-muted:     #7a7976;
  --color-text-faint:     #4f4e4c;
  --color-primary:        #3d9ba3;
  --color-primary-hover:  #2e8891;
  --color-primary-bg:     #1a2f31;
  --color-error:          #e55a4a;
  --color-error-hover:    #d44a3a;
  --color-error-bg:       #2d1915;
  --color-success:        #4cae6e;
  --color-success-bg:     #162712;
  --color-warning:        #f39c35;
  --color-warning-bg:     #2a1f0a;
  --color-prio-hoch:      #e55a4a;
  --color-prio-mittel:    #f39c35;
  --color-prio-niedrig:   #4cae6e;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:   0 12px 32px rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:#111110; --color-surface:#171615; --color-surface-2:#1c1b1a;
    --color-surface-offset:#201f1e; --color-divider:#272624; --color-border:#343230;
    --color-text:#e8e7e5; --color-text-muted:#7a7976; --color-text-faint:#4f4e4c;
    --color-primary:#3d9ba3; --color-primary-hover:#2e8891; --color-primary-bg:#1a2f31;
    --color-error:#e55a4a; --color-error-bg:#2d1915; --color-success:#4cae6e;
    --color-success-bg:#162712; --color-warning:#f39c35; --color-warning-bg:#2a1f0a;
    --color-prio-hoch:#e55a4a; --color-prio-mittel:#f39c35; --color-prio-niedrig:#4cae6e;
    --shadow-sm:0 1px 3px rgba(0,0,0,0.3); --shadow-md:0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:0 12px 32px rgba(0,0,0,0.5);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { font-family: var(--font-body); font-size: var(--text-sm); color: var(--color-text); background: var(--color-bg); min-height: 100dvh; line-height: 1.6; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
a, button, input, textarea, select { transition: color var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition), opacity var(--transition); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-surface-offset); }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface-offset); color: var(--color-text); }
.btn-error { background: var(--color-error); color: #fff; border-color: var(--color-error); }
.btn-error:hover { background: var(--color-error-hover); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-sleep { background: #6c3fd4; border-color: #6c3fd4; color: #fff; width: 100%; justify-content: center; font-size: var(--text-sm); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); }
.btn-sleep:hover { background: #5a2fc4; }

/* ── Icon Button ── */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-md); color: var(--color-text-muted); }
.icon-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: var(--space-1); }
.form-group label { font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-group input, .form-group textarea, .form-group select { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font-size: var(--text-sm); color: var(--color-text); }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15); }
.form-group textarea { resize: vertical; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
input[type="color"] { height: 38px; padding: var(--space-1); cursor: pointer; }
input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: dark; }
[data-theme="light"] input[type="date"], [data-theme="light"] input[type="time"], [data-theme="light"] input[type="datetime-local"] { color-scheme: light; }

/* ── LOGIN ── */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100dvh; background: var(--color-bg); padding: var(--space-4); }
.login-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-10); width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: var(--space-6); }
.login-logo { display: flex; align-items: center; gap: var(--space-3); }
.login-title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; }
.login-subtitle { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }
#login-form { display: flex; flex-direction: column; gap: var(--space-4); }
.error-msg { background: var(--color-error-bg); color: var(--color-error); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }

/* ── APP SHELL ── */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

/* ── SIDEBAR ── */
.sidebar { background: var(--color-surface); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4); border-bottom: 1px solid var(--color-divider); min-height: var(--topbar-h); }
.sidebar-logo { display: flex; align-items: center; gap: var(--space-3); }
.sidebar-brand { font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.05em; }
.sidebar-nav { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3); flex: 1; }
.nav-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--color-text-muted); width: 100%; text-align: left; font-weight: 500; }
.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-bg); color: var(--color-primary); }
.sidebar-footer { padding: var(--space-3); border-top: 1px solid var(--color-divider); display: flex; flex-direction: column; gap: var(--space-2); }
.sidebar-user { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); }
.user-avatar { width: 32px; height: 32px; border-radius: var(--radius-full); background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: 700; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: var(--text-sm); font-weight: 600; }
.user-role { font-size: var(--text-xs); color: var(--color-text-muted); }
.sidebar-actions { display: flex; gap: var(--space-1); }
.sidebar-toggle-btn { display: none; }

/* ── MAIN AREA ── */
.main-area { display: flex; flex-direction: column; min-height: 100dvh; overflow-x: hidden; }

/* ── TOPBAR ── */
.topbar { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-6); height: var(--topbar-h); border-bottom: 1px solid var(--color-border); background: var(--color-surface); position: sticky; top: 0; z-index: 10; }
#sidebar-open-btn { display: none; }
.topbar-title { font-weight: 600; font-size: var(--text-sm); flex: 1; }
.date-badge { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* ── PAGE ── */
.page { padding: var(--space-6) var(--space-8); max-width: 1200px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-6); gap: var(--space-4); flex-wrap: wrap; }
.page-header-left { display: flex; flex-direction: column; gap: var(--space-1); }
.page-header-right { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.page h2 { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }
.text-muted { color: var(--color-text-muted); font-size: var(--text-sm); }

/* ── DATE NAV ── */
.date-nav { display: flex; align-items: center; gap: var(--space-1); }
.date-picker-input { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-1) var(--space-3); font-size: var(--text-xs); font-weight: 500; color: var(--color-text); }

/* ── INFO CARDS ── */
.info-cards { display: flex; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.info-card { display: flex; align-items: center; gap: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); min-width: 160px; }
.info-card svg { width: 20px; height: 20px; color: var(--color-primary); flex-shrink: 0; }
.info-card-label { font-size: var(--text-xs); color: var(--color-text-muted); }
.info-card-value { font-size: var(--text-base); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── TIMELINE ── */
.timeline-container { display: flex; flex-direction: column; gap: var(--space-2); }
.timeline-item { display: grid; grid-template-columns: 80px 1fr; gap: var(--space-4); align-items: start; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-divider); }
.timeline-item:last-child { border-bottom: none; }
.timeline-time { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; padding-top: var(--space-1); text-align: right; }
.timeline-content { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); }
.timeline-content.type-school { border-left: 3px solid var(--color-primary); background: var(--color-primary-bg); }
.timeline-content.type-break { background: var(--color-surface-offset); border-style: dashed; }
.timeline-content.type-todo { border-left: 3px solid var(--color-warning); }
.timeline-content.type-event { border-left: 3px solid #6c3fd4; }
.timeline-content.type-sleep { border-left: 3px solid #6c3fd4; background: #1a0f2e; }
[data-theme="light"] .timeline-content.type-sleep { background: #f0ebff; }
.timeline-title { font-size: var(--text-sm); font-weight: 600; margin-bottom: 2px; }
.timeline-desc { font-size: var(--text-xs); color: var(--color-text-muted); }
.timeline-badge { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 500; padding: 2px 8px; border-radius: var(--radius-full); margin-top: var(--space-1); }
.badge-school { background: var(--color-primary-bg); color: var(--color-primary); }
.badge-break { background: var(--color-surface-offset); color: var(--color-text-muted); }
.badge-todo { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-event { background: #2d1f52; color: #b89dff; }
[data-theme="light"] .badge-event { background: #f0ebff; color: #6c3fd4; }
.badge-routine { background: var(--color-success-bg); color: var(--color-success); }
.badge-sleep { background: #2d1f52; color: #b89dff; }
[data-theme="light"] .badge-sleep { background: #f0ebff; color: #6c3fd4; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); flex-wrap: wrap; }
.filter-btn { font-size: var(--text-xs); font-weight: 500; padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); color: var(--color-text-muted); border: 1px solid transparent; display: flex; align-items: center; gap: var(--space-1); }
.filter-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.filter-btn.active { background: var(--color-primary-bg); color: var(--color-primary); border-color: oklch(from var(--color-primary) l c h / 0.3); }
.filter-sep { width: 1px; height: 20px; background: var(--color-border); margin: 0 var(--space-1); }

/* ── PRIORITY DOTS ── */
.prio-dot { width: 8px; height: 8px; border-radius: var(--radius-full); display: inline-block; flex-shrink: 0; }
.prio-hoch { background: var(--color-prio-hoch); }
.prio-mittel { background: var(--color-prio-mittel); }
.prio-niedrig { background: var(--color-prio-niedrig); }

/* ── TODO LIST ── */
.todo-list { display: flex; flex-direction: column; gap: var(--space-2); }
.todo-item { display: flex; align-items: flex-start; gap: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); }
.todo-check { width: 20px; height: 20px; border-radius: var(--radius-sm); border: 2px solid var(--color-border); flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.todo-check:hover { border-color: var(--color-primary); }
.todo-check.checked { background: var(--color-primary); border-color: var(--color-primary); }
.todo-check.checked svg { width: 12px; height: 12px; color: white; }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: var(--text-sm); font-weight: 500; }
.todo-title.done { text-decoration: line-through; color: var(--color-text-muted); }
.todo-meta { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-1); flex-wrap: wrap; }
.todo-meta-item { display: flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--color-text-muted); }
.todo-meta-item svg { width: 12px; height: 12px; }
.todo-actions { display: flex; gap: var(--space-1); opacity: 0; transition: opacity var(--transition); }
.todo-item:hover .todo-actions { opacity: 1; }

/* ── CALENDAR ── */
.calendar-grid-wrapper { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); overflow: hidden; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--color-border); }
.calendar-weekdays div { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); text-align: center; text-transform: uppercase; letter-spacing: 0.05em; }
.calendar-weekdays .weekend-day { color: var(--color-text-faint); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day { border-right: 1px solid var(--color-divider); border-bottom: 1px solid var(--color-divider); min-height: 100px; padding: var(--space-2); cursor: pointer; transition: background var(--transition); }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--color-surface-offset); }
.cal-day.today { background: var(--color-primary-bg); }
.cal-day.other-month .cal-day-num { color: var(--color-text-faint); }
.cal-day.weekend .cal-day-num { color: var(--color-text-muted); }
.cal-day.selected { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.cal-day-num { font-size: var(--text-xs); font-weight: 600; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); margin-bottom: var(--space-1); font-variant-numeric: tabular-nums; }
.cal-day.today .cal-day-num { background: var(--color-primary); color: white; }
.cal-event-chip { font-size: 11px; padding: 1px 6px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: white; font-weight: 500; }
/* .cal-day.holiday deprecated → use .is-holiday */
.cal-day.holiday .cal-day-num { color: var(--color-primary); }

/* ── SELECTED DAY PANEL ── */
.selected-day-events { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-5); margin-top: var(--space-4); }
.selected-day-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.selected-day-header span { font-size: var(--text-sm); font-weight: 600; }
.day-event-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-divider); }
.day-event-item:last-of-type { border-bottom: none; }
.day-event-dot { width: 10px; height: 10px; border-radius: var(--radius-full); flex-shrink: 0; margin-top: 5px; }
.day-event-info { flex: 1; }
.day-event-title { font-size: var(--text-sm); font-weight: 500; }
.day-event-time { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* ── MISC ── */
.misc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: var(--space-4); }
.misc-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.misc-card-wide { grid-column: 1 / -1; }
.misc-card-header { display: flex; align-items: center; gap: var(--space-3); }
.misc-card-header svg { width: 20px; height: 20px; color: var(--color-primary); }
.misc-card-header h3 { font-size: var(--text-sm); font-weight: 600; }
.code-block { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.code-block code { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); word-break: break-all; }
.alarm-preview { display: flex; flex-direction: column; gap: var(--space-2); }
.alarm-item { display: flex; align-items: center; justify-content: space-between; }
.alarm-time { font-family: var(--font-mono); font-size: var(--text-base); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-primary); }
.readonly-prompt { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.6; }
.weekday-picker { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.weekday-btn { width: 36px; height: 36px; border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 600; border: 1px solid var(--color-border); color: var(--color-text-muted); }
.weekday-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.weekday-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.sleep-status { font-size: var(--text-xs); color: var(--color-text-muted); text-align: center; }
.msg { border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font-size: var(--text-xs); margin-top: var(--space-2); }
.msg.success { background: var(--color-success-bg); color: var(--color-success); }
.msg.error { background: var(--color-error-bg); color: var(--color-error); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: oklch(0 0 0 / 0.6); display: flex; align-items: center; justify-content: center; z-index: 100; padding: var(--space-4); backdrop-filter: blur(4px); }
.modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-6); width: 100%; max-width: 480px; max-height: 90dvh; overflow-y: auto; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: var(--space-4); }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: var(--text-base); font-weight: 600; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }
#event-recurrence-end-group { display: none; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: var(--space-6); right: var(--space-6); display: flex; flex-direction: column; gap: var(--space-2); z-index: 200; }
.toast { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-5); font-size: var(--text-sm); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: var(--space-3); min-width: 240px; animation: slideIn 0.3s ease; }
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success svg { color: var(--color-success); }
.toast.error svg { color: var(--color-error); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── LOADING OVERLAY ── */
.loading-overlay { position: fixed; inset: 0; background: oklch(0 0 0 / 0.7); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 300; gap: var(--space-4); backdrop-filter: blur(4px); }
.loading-spinner { width: 40px; height: 40px; border: 3px solid var(--color-border); border-top-color: var(--color-primary); border-radius: var(--radius-full); animation: spin 0.8s linear infinite; }
.loading-overlay p { font-size: var(--text-sm); color: var(--color-text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--space-16) var(--space-8); color: var(--color-text-muted); gap: var(--space-3); }
.empty-state svg { width: 40px; height: 40px; color: var(--color-text-faint); }
.empty-state h3 { color: var(--color-text); font-size: var(--text-base); font-weight: 600; }
.empty-state p { max-width: 36ch; font-size: var(--text-sm); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100dvh; z-index: 50; transform: translateX(-100%); transition: transform 0.25s ease; width: var(--sidebar-w); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle-btn { display: flex; }
  #sidebar-open-btn { display: flex; }
  .page { padding: var(--space-4); }
  .misc-card-wide { grid-column: auto; }
  .form-row { grid-template-columns: 1fr; }
  .info-cards { overflow-x: auto; flex-wrap: nowrap; }
}
@media (max-width: 600px) {
  .page-header { flex-direction: column; }
  .page-header-right { width: 100%; }
  .filter-bar { gap: var(--space-1); }
}

/* ── SETUP WIZARD ── */
.setup-screen { display: flex; align-items: flex-start; justify-content: center; min-height: 100dvh; background: var(--color-bg); padding: var(--space-8) var(--space-4); }
.setup-wrapper { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: var(--space-6); }
.setup-header { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-2) 0; }
.setup-header h1 { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; }

.setup-progress { display: flex; align-items: center; gap: 0; }
.setup-step-indicator { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); flex: 1; }
.step-circle { width: 32px; height: 32px; border-radius: var(--radius-full); border: 2px solid var(--color-border); display: flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); background: var(--color-surface); transition: all var(--transition); }
.setup-step-indicator span { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }
.setup-step-indicator.active .step-circle { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-bg); }
.setup-step-indicator.active span { color: var(--color-primary); font-weight: 600; }
.setup-step-indicator.done .step-circle { border-color: var(--color-success); background: var(--color-success); color: white; }
.setup-step-indicator.done .step-circle::after { content: '✓'; font-size: 14px; }
.setup-step-indicator.done .step-circle { font-size: 0; }
.step-line { flex: 1; height: 2px; background: var(--color-border); max-width: 60px; margin-bottom: 18px; }

.setup-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); box-shadow: var(--shadow-md); }
.setup-card-header { display: flex; align-items: center; gap: var(--space-3); }
.setup-card-header svg { width: 22px; height: 22px; color: var(--color-primary); }
.setup-card-header h2 { font-size: var(--text-base); font-weight: 600; }
.setup-hint { font-size: var(--text-sm); color: var(--color-text-muted); background: var(--color-surface-offset); border-radius: var(--radius-md); padding: var(--space-3); line-height: 1.6; }
.setup-nav { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-2); }
.setup-result { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); }
.setup-result svg { width: 16px; height: 16px; flex-shrink: 0; }
.result-ok { background: var(--color-success-bg); color: var(--color-success); }
.result-err { background: var(--color-error-bg); color: var(--color-error); }
.setup-summary { display: flex; flex-direction: column; gap: var(--space-2); background: var(--color-surface-offset); border-radius: var(--radius-lg); padding: var(--space-4); }
.summary-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.summary-row svg { width: 16px; height: 16px; color: var(--color-primary); flex-shrink: 0; }
.loading-dots::after { content: '...'; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0%,20%{content:'.'} 40%{content:'..'} 60%,100%{content:'...'} }

/* ── FERIEN / HOLIDAY ── */
.cal-day.cal-day.is-holiday { background: color-mix(in oklch, var(--color-gold) 14%, var(--color-surface)) !important; }
.cal-day.is-holiday .cal-day-num { color: var(--color-gold) !important; font-weight: 700; }
.is-holiday { background: color-mix(in oklch, var(--color-gold) 14%, var(--color-surface)); }
.cal-holiday-label { font-size: 10px; color: var(--color-gold); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.2; margin-bottom: var(--space-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holiday-banner { display: flex; align-items: center; gap: var(--space-2); background: color-mix(in oklch, var(--color-gold) 12%, var(--color-surface)); color: var(--color-gold); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-3); }
.holiday-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── PLAN BEARBEITEN ── */
.timeline-actions { display: flex; justify-content: flex-end; margin-bottom: var(--space-3); }
.color-badge { display: inline-flex; align-items: center; gap: var(--space-2); }

/* ── SONSTIGE MISC ── */
.msg { padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-sm); margin-top: var(--space-3); }
.msg.success { background: var(--color-success-highlight); color: var(--color-success); }
.msg.error { background: var(--color-error-highlight); color: var(--color-error); }
.btn-sleep-active { background: var(--color-primary-hover) !important; }
