:root {
  --bg: #f4f4f1;
  --card: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --line: #e2e2dc;
  --accent: #2f6f4f;
  --accent-text: #ffffff;
  --danger: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --card: #1f1f1d;
    --text: #ececea;
    --muted: #9a9a94;
    --line: #34342f;
    --accent: #6fbf94;
    --accent-text: #0f1f17;
    --danger: #f2827a;
  }
}

* { box-sizing: border-box; }

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

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 32px;
}

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); margin: 0; text-transform: capitalize; }

.top { margin-bottom: 16px; }
.muted-text { color: var(--muted); }

.nav { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.nav a { color: var(--muted); text-decoration: none; padding: 10px 0; }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); }
.nav form { margin-left: auto; }

.flash { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.flash.error { color: var(--danger); border-color: var(--danger); }

.stack { display: grid; gap: 8px; }
.stack button { margin-top: 8px; justify-self: start; }
.invite-link { display: grid; gap: 8px; }
.invite-link button { justify-self: start; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

input, button { font: inherit; color: inherit; }

input {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  width: 100%;
}

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

button { cursor: pointer; border: 0; background: none; }

.primary {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.link { color: var(--muted); text-decoration: underline; padding: 8px 0; }

.add { display: flex; gap: 8px; margin-bottom: 8px; }
.add input[type="date"] { width: auto; flex: 0 0 auto; }

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

.items li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}

.items li:last-child { border-bottom: 0; }
.items form { display: contents; }

.label { flex: 1; overflow-wrap: anywhere; }
.label small { display: block; color: var(--muted); font-size: 0.8rem; }

.check {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  color: var(--accent-text);
  font-size: 0.9rem;
  line-height: 1;
}

.icon { width: 44px; height: 44px; color: var(--muted); }

.done .label { text-decoration: line-through; color: var(--muted); }
.done .check { background: var(--accent); border-color: var(--accent); }
.overdue .due { color: var(--danger); font-weight: 600; }
.empty { color: var(--muted); }

.login { margin-top: 10vh; }
.error { color: var(--danger); }
