:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2b6467;
  --danger: #b42318;
  --error-bg: #fef3f2;
  --info-bg: #eff8ff;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1f24;
    --ink: #e6e8eb;
    --muted: #9aa3ad;
    --line: #2c333a;
    --accent: #5fb3b7;
    --danger: #f97066;
    --error-bg: #3a1d1b;
    --info-bg: #13283a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  padding: 48px 16px;
}

.card {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  align-self: flex-start;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

h1 { margin: 0; font-size: 1.4rem; }

.header button { flex-shrink: 0; white-space: nowrap; }

.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }

.row { display: flex; gap: 8px; margin-bottom: 16px; }

input:not([type="checkbox"]) {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
}

input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

button.link {
  padding: 4px 6px;
  background: transparent;
  color: var(--accent);
}

button.danger { color: var(--danger); }

.status {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  background: var(--error-bg);
  color: var(--danger);
}

.status[data-kind="info"] { background: var(--info-bg); color: var(--ink); }

.list { list-style: none; margin: 0; padding: 0; }

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.title { overflow-wrap: anywhere; }

.done .title { text-decoration: line-through; color: var(--muted); }

.edit { padding: 6px 8px; }

.muted { color: var(--muted); }

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  font-size: 0.85rem;
}

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

[hidden] { display: none !important; }
