:root {
  color-scheme: light dark;
  --bg: light-dark(#f3f5f4, #141817);
  --surface: light-dark(#ffffff, #1d2321);
  --text: light-dark(#1c2422, #e6ecea);
  --muted: light-dark(#5d6966, #9aa8a4);
  --line: light-dark(#d8dfdc, #333c39);
  --accent: light-dark(#0f6b57, #5cc9ae);
  --on-accent: light-dark(#ffffff, #10201c);
  --danger: light-dark(#b3261e, #ff9a91);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}

main { max-width: 680px; margin: 0 auto; padding: 48px 16px; }
h1 { margin: 0; font-size: 1.9rem; line-height: 1.2; }
#summary { margin: 4px 0 24px; color: var(--muted); min-height: 1.5em; }

input, button { font: inherit; color: inherit; }
input[type="text"], input[type="date"] {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
input[type="text"] { flex: 1 1 220px; min-width: 0; }

button {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { border-color: var(--line); }
.primary { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

form { display: flex; flex-wrap: wrap; gap: 8px; }
#filters { display: flex; gap: 4px; margin: 24px 0 8px; }
#filters button { color: var(--muted); }
#filters [aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

#list { list-style: none; margin: 0; padding: 0; }
#list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
#list input[type="checkbox"] { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
#list form { flex: 1; }
.body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.due { display: block; font-size: .85rem; color: var(--muted); }
.overdue .due { color: var(--danger); }
.done .title { color: var(--muted); text-decoration: line-through; }
.actions { display: flex; flex: none; }
.actions button { padding: 4px 8px; font-size: .9rem; color: var(--muted); }
.actions .delete:hover { color: var(--danger); }

#empty { padding: 32px 0; color: var(--muted); }
#error { color: var(--danger); }
