/* tasks — the universal inbox. 2026.
   Shares the Love & Maneuver design language (neutral warm system, Inter,
   single-stroke heart) with `meal`/`track`; its own accent is a calm green —
   the colour of "done". Light & dark. */

/* `hidden` must win over component `display` rules. */
[hidden] { display: none !important; }

:root {
  color-scheme: light dark;

  --bg: #f7f4ef;
  --bg-grad: radial-gradient(110% 70% at 50% -20%, #e9efe7 0%, rgba(233, 239, 231, 0) 45%);
  --surface: #fffdfb;
  --surface-2: #f1ede6;
  --ink: #232a23;
  --ink-soft: #5e6b5e;
  --ink-faint: #93a093;
  --line: #e7e8e0;
  --line-strong: #d4d9cd;

  --brand: #2f8f63;
  --brand-strong: #246e4c;
  --brand-tint: #e3f1e9;
  --on-brand: #ffffff;
  --ring: rgba(47, 143, 99, 0.30);

  --danger: #d6453c;

  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-xs: 0 1px 2px rgba(12, 24, 18, 0.05);
  --shadow-sm: 0 1px 3px rgba(12, 24, 18, 0.06), 0 1px 2px rgba(12, 24, 18, 0.04);
  --shadow-md: 0 10px 30px -8px rgba(12, 24, 18, 0.18);
  --shadow-lg: 0 30px 70px -20px rgba(12, 24, 18, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --bg-grad: radial-gradient(110% 70% at 50% -20%, rgba(95, 199, 149, 0.10) 0%, rgba(20, 19, 15, 0) 48%);
    --surface: #1d1d17;
    --surface-2: #26261d;
    --ink: #ebeee6;
    --ink-soft: #a6b0a3;
    --ink-faint: #767f72;
    --line: #2e2e25;
    --line-strong: #41412f;

    --brand: #5fc795;
    --brand-strong: #84d6ac;
    --brand-tint: rgba(95, 199, 149, 0.15);
    --on-brand: #0c2418;
    --ring: rgba(95, 199, 149, 0.35);

    --danger: #f2555b;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 12px 34px -10px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 30px 80px -24px rgba(0, 0, 0, 0.8);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-soft); font-size: 0.9rem; }
.empty-hint { padding: 2.5rem 0.5rem; line-height: 1.6; max-width: 48ch; text-align: center; margin: 0 auto; }

/* ── header ── */
.chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.95rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.mark { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--brand); }
.heart { width: 1.3rem; height: 1.3rem; }
.mark-word { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.chrome-nav { display: flex; align-items: center; gap: 1.25rem; font-size: 0.85rem; }
.who { color: var(--ink-faint); font-size: 0.78rem; font-weight: 450; }

main { max-width: 640px; margin: 0 auto; padding: clamp(1.25rem, 3.5vw, 2.5rem); }

/* ── buttons (shared language with meal/track) ── */
.btn {
  font-family: var(--ui);
  font-size: 0.875rem;
  font-weight: 550;
  padding: 0.62rem 1.05rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s, transform 0.08s;
}
.btn:hover { border-color: var(--brand); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 4px 14px -4px var(--ring); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.icon-btn {
  font-family: var(--ui);
  background: none; border: none; cursor: pointer;
  color: var(--ink-faint); font-size: 0.85rem; line-height: 1;
  padding: 0.3rem 0.4rem; border-radius: var(--r-sm); transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ── capture box ── */
.add-row { display: flex; gap: 0.5rem; margin-bottom: 1.4rem; }
.add-row input {
  flex: 1; min-width: 0;
  font-family: var(--ui);
  font-size: 1rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.14s, box-shadow 0.14s;
}
.add-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }

/* ── task list ── */
.list { display: flex; flex-direction: column; gap: 0.4rem; }
.task {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s, opacity 0.18s;
}
.task-title { flex: 1; min-width: 0; font-size: 0.98rem; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }

.check {
  flex: 0 0 auto;
  width: 1.4rem; height: 1.4rem;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--on-brand);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.check:hover { border-color: var(--brand); }
.check:active { transform: scale(0.92); }
.check svg { width: 0.85rem; height: 0.85rem; }

.task.is-done { opacity: 0.62; }
.task.is-done .check { background: var(--brand); border-color: var(--brand); }
.task.is-done .task-title { text-decoration: line-through; color: var(--ink-faint); font-weight: 450; }

.task-del { opacity: 0; transition: opacity 0.12s, background 0.12s, color 0.12s; }
.task:hover .task-del, .task:focus-within .task-del { opacity: 0.7; }
.task-del:hover { opacity: 1; }
/* Touch devices can't hover — always show the delete affordance. */
@media (hover: none) { .task-del { opacity: 0.55; } }

/* ── done section ── */
.done-section { margin-top: 1.6rem; }
.done-toggle {
  font-family: var(--ui);
  display: flex; align-items: center; gap: 0.45rem;
  background: none; border: none; cursor: pointer;
  color: var(--ink-soft); font-size: 0.78rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.3rem 0; margin-bottom: 0.5rem;
}
.done-toggle:hover { color: var(--ink); }
.done-caret { font-size: 0.7rem; }
.done-list { opacity: 0.95; }

.form-error { color: var(--danger); font-size: 0.85rem; min-height: 1em; font-weight: 500; margin-top: 0.8rem; }
