:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f2330;
  --fg: #e8e8ea;
  --muted: #9a9ca3;
  --border: rgba(127, 127, 127, .25);
  --accent: #4f8cff;
  --accent-fg: #ffffff;
  --danger: #ff5c6c;
  --ok: #3ccf7a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface-2: #f0f2f6;
    --fg: #15171c;
    --muted: #5f6370;
    --border: rgba(60, 60, 80, .18);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.5;
}

.page { max-width: 640px; margin: 0 auto; padding: 48px 16px 64px; }
.header { margin-bottom: 20px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 600; margin: 0 0 6px; }
h1 { font-size: clamp(28px, 6vw, 38px); line-height: 1.15; margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Add form */
.add { display: flex; gap: 8px; margin: 0 0 12px; }
.add input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button {
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 0;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
button:disabled { opacity: .55; cursor: default; }
button.secondary { background: var(--surface-2); color: var(--fg); }
button.link { background: transparent; color: var(--accent); padding: 4px 6px; font-weight: 500; }
button.link:hover { text-decoration: underline; }

/* Messages */
.message { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }
.message.error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.message.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }

/* List card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}
.counts { margin: 0; }
.counts span { color: var(--fg); font-weight: 600; }

.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: opacity .15s;
}
.item:last-child { border-bottom: 0; }
.item.removing { opacity: .4; pointer-events: none; }

.check {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.body { flex: 1; min-width: 0; }
.title {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--fg);
  font-weight: 400;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.title:hover { background: var(--surface-2); }
.item.done .title { color: var(--muted); text-decoration: line-through; }

.delete {
  flex: none;
  background: transparent;
  color: var(--muted);
  padding: 8px;
  border-radius: 8px;
  display: inline-flex;
}
.delete:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* Inline editor */
.editor { display: flex; gap: 6px; flex-wrap: wrap; }
.editor input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
}
.editor button { padding: 8px 12px; font-size: 14px; }

.empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--muted); }
.hint { margin: 14px 4px 0; font-size: 13px; color: var(--muted); }

@media (max-width: 480px) {
  .page { padding-top: 28px; }
  .add { flex-direction: column; }
  .add button { width: 100%; }
  .hint { display: none; }
}
