:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  --paper: #f4f1e8;
  --card: rgba(255, 255, 255, 0.82);
  --ink: #20251f;
  --muted: #6f756c;
  --line: rgba(44, 55, 42, 0.13);
  --green: #2f6b4f;
  --green-soft: #dfeadf;
  --shadow: 0 14px 34px rgba(51, 58, 48, 0.08);
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(255, 255, 255, 0.95), transparent 42%),
    linear-gradient(180deg, #f7f4eb 0%, var(--paper) 100%);
}

button, input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(40px, env(safe-area-inset-bottom));
}

.topbar, .section-heading, .capture-row, .auth-actions, .task-row {
  display: flex;
  align-items: center;
}

.topbar, .section-heading { justify-content: space-between; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 34px; letter-spacing: -0.05em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -0.025em; }

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green);
  background: var(--card);
  font-size: 22px;
}

.icon-button:disabled { opacity: 0.45; }

.sync-status {
  min-height: 18px;
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.sync-status[data-tone="error"] { color: #a24335; }

.capture-card, .auth-card, .list-section {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.capture-card { padding: 18px; }
.capture-card label { display: block; margin-bottom: 11px; font-size: 14px; font-weight: 650; }
.capture-row { gap: 9px; }

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.12); }

button[type="submit"], .auth-actions button {
  flex: none;
  border: 0;
  border-radius: 13px;
  padding: 13px 17px;
  color: white;
  background: var(--green);
  font-weight: 700;
}

.auth-actions button.secondary { color: var(--green); background: var(--green-soft); }

.auth-card { margin-top: 14px; padding: 18px; }
.auth-card p { margin: 7px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-card form { display: grid; gap: 9px; }
.auth-actions { gap: 9px; }
.auth-actions button { flex: 1; }

.list-section { margin-top: 18px; padding: 18px; }
.section-heading { margin-bottom: 12px; }
.count { min-width: 28px; padding: 5px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); text-align: center; font-size: 13px; font-weight: 750; }
.task-list { display: grid; gap: 9px; }

.task-row {
  gap: 11px;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.62);
}

.task-row.is-pending { background: rgba(241, 235, 211, 0.72); }
.task-rank { width: 24px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.task-copy { flex: 1; min-width: 0; }
.task-title { margin: 0; font-size: 15px; line-height: 1.42; overflow-wrap: anywhere; }
.task-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.complete-button { width: 36px; height: 36px; border: 1px solid rgba(47, 107, 79, 0.3); border-radius: 50%; color: var(--green); background: transparent; font-size: 17px; font-weight: 800; }
.complete-button:disabled { opacity: 0.35; }

.empty { margin: 3px 0; padding: 18px 8px; color: var(--muted); text-align: center; font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100vw - 36px);
  padding: 10px 14px;
  border-radius: 999px;
  color: white;
  background: rgba(29, 35, 29, 0.9);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: 160ms ease;
  pointer-events: none;
  font-size: 13px;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .shell { padding-inline: 13px; }
  .capture-row { align-items: stretch; flex-direction: column; }
  button[type="submit"] { width: 100%; }
}
