:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #8a8a86;
  --border: #e7e7e2;
  --accent: #e03131;
  --sidebar: #f3f3ef;
  --done: #b0b0aa;
}
[data-theme="dark"] {
  --bg: #121212;
  --surface: #1d1d1d;
  --text: #e8e8e6;
  --muted: #8a8a86;
  --border: #2c2c2c;
  --sidebar: #191919;
  --done: #5c5c58;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: #e03131; min-height: 1.2em; margin-top: 8px; }

/* Login */
.login { display: flex; align-items: center; justify-content: center; height: 100%; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 320px; text-align: center; }
.login-card h1 { font-size: 32px; margin-bottom: 4px; }
.login-card form { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
input, textarea, select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 15px; font-family: inherit; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
button { cursor: pointer; font-family: inherit; font-size: 15px; border: none; border-radius: 8px; padding: 10px 16px; }
.primary { background: var(--accent); color: #fff; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.ghost:hover { background: var(--sidebar); }
.small { font-size: 13px; padding: 6px 10px; }

/* Layout */
.app { display: flex; height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; }
.brand { font-size: 20px; margin-bottom: 16px; }
.quests-header { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.quest-list { list-style: none; flex: 1; overflow-y: auto; }
.quest-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.quest-list li:hover { background: var(--surface); }
.quest-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.quest-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quest-hours { font-size: 12px; color: var(--muted); }
.sidebar-footer { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.nav-btn { background: transparent; color: var(--text); text-align: left; padding: 8px 10px; border-radius: 8px; }
.nav-btn:hover { background: var(--surface); }

/* Main */
.main { flex: 1; overflow-y: auto; padding: 28px 36px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar h1 { font-size: 24px; }

/* Tasks */
.task-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.task { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.task:hover { border-color: var(--muted); }
.task .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--border); }
.task .check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
.task.done .check { background: var(--accent); border-color: var(--accent); }
.task .title { flex: 1; }
.task.done .title { color: var(--done); text-decoration: line-through; }
.task .focus-btn { background: transparent; border: none; color: var(--muted); font-size: 18px; padding: 0 6px; }
.task .focus-btn:hover { color: var(--text); }
.task .del { background: transparent; border: none; color: var(--muted); padding: 0 4px; }
.task .del:hover { color: var(--accent); }
.add-task { width: 100%; text-align: left; color: var(--muted); padding: 12px 14px; }
.done-heading { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 24px 0 8px; }
.done-list .task { opacity: 0.7; }

/* Alle Aufgaben */
.all-toolbar { margin-bottom: 12px; }
#all-filter { max-width: 400px; }

/* Statistik */
.stats-range { display: flex; gap: 8px; margin-bottom: 20px; }
.range-btn { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; }
.range-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.stats-total { font-size: 18px; margin-bottom: 20px; }
.stats-bars { display: flex; flex-direction: column; gap: 10px; }
.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-label { width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-bg { flex: 1; height: 22px; background: var(--sidebar); border-radius: 6px; overflow: hidden; }
.stat-bar { height: 100%; border-radius: 6px; }
.stat-val { width: 70px; text-align: right; color: var(--muted); font-size: 13px; }

/* Fokus-Overlay */
.focus { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 50; }
.focus-quest { font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; }
.focus-title { font-size: 34px; text-align: center; max-width: 80%; }
.focus-timer { font-size: 84px; font-weight: 200; font-variant-numeric: tabular-nums; }
.focus-notes { color: var(--muted); max-width: 70%; text-align: center; }
.focus-actions { display: flex; gap: 12px; margin-top: 8px; }
.focus-hint { position: absolute; bottom: 24px; font-size: 12px; }

/* Modals */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 60; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 380px; z-index: 61; display: flex; flex-direction: column; gap: 12px; }
.modal h3 { font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .quest-list { display: flex; flex-direction: row; gap: 6px; overflow-x: auto; flex: 1; }
  .sidebar-footer { flex-direction: row; }
  .main { padding: 16px; }
  .focus-timer { font-size: 56px; }
}
