:root {
  color-scheme: light;
  --canvas: oklch(95.5% .006 75);
  --surface: oklch(99% .003 75);
  --sunken: oklch(92.5% .006 75);
  --ink: oklch(21% .008 75);
  --muted: oklch(51% .012 75);
  --faint: oklch(68% .008 75);
  --rule: oklch(87% .007 75);
  --rule-soft: oklch(91% .006 75);
  --error: oklch(50% .16 25);
  --error-soft: oklch(94% .02 25);
  --shadow: 0 1px 1px oklch(30% .01 75 / .04), 0 3px 8px oklch(30% .02 75 / .06);
  --shadow-lg: 0 8px 20px oklch(20% .02 75 / .12), 0 2px 6px oklch(20% .02 75 / .08);
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--canvas); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size: 17px; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid oklch(56% .12 235 / .55); outline-offset: 2px; }
main { width: min(100%, 600px); margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px max(48px, env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin-top: 0; }

.masthead { min-height: 44px; display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--surface); background: var(--ink); font-size: .8rem; font-weight: 700; box-shadow: var(--shadow); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 1.3rem; transition: color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease); }
.icon-button:hover { background: var(--sunken); color: var(--ink); }
.icon-button:active { transform: scale(.92); }

.view-nav { display: flex; gap: 4px; margin: 16px 0 0; padding: 3px; border: 0; border-radius: 11px; background: var(--sunken); }
.view-nav button { flex: 1; min-height: 34px; border: 0; border-radius: 9px; padding: 0; color: var(--muted); background: transparent; font-size: .88rem; font-weight: 550; transition: background 180ms var(--ease), color 180ms var(--ease), box-shadow 180ms var(--ease); }
.view-nav button.selected { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.view-nav .count { margin-left: 5px; color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 550; }
.view-nav .count:empty { display: none; }
.view-nav button.selected .count { color: var(--muted); }

.capture { display: grid; gap: 8px; padding: 16px 0 8px; }
.capture-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.capture-meta { display: grid; gap: 8px; }
input { width: 100%; min-width: 0; border: 1px solid var(--rule); border-radius: 10px; color: var(--ink); background: var(--surface); transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease); }
input:hover { border-color: var(--faint); }
#capture { flex: 1 1 auto; width: auto; min-width: 0; min-height: 48px; padding: 12px 13px; }
#capture::placeholder { color: var(--faint); }
#add-task { min-width: 76px; min-height: 48px; border: 0; border-radius: 10px; padding: 0 16px; color: var(--surface); background: var(--ink); font-weight: 600; box-shadow: var(--shadow); transition: opacity 180ms var(--ease), transform 180ms var(--ease), box-shadow 180ms var(--ease); }
#add-task:hover { opacity: .9; box-shadow: var(--shadow-lg); }
#add-task:active { transform: scale(.97); }
#add-task:disabled { cursor: wait; opacity: .5; box-shadow: none; }

.plan-row, .task-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-choice, .today-action, .schedule-action { min-height: 32px; border: 1px solid var(--rule); border-radius: 999px; padding: 0 12px; color: var(--muted); background: transparent; font-size: .78rem; font-weight: 550; transition: background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease); }
.plan-choice:hover, .today-action:hover, .schedule-action:hover { border-color: var(--faint); color: var(--ink); }
.plan-choice.selected, .today-action { border-color: transparent; color: var(--ink); background: var(--sunken); font-weight: 600; }
#scheduled, .schedule-date { min-height: 32px; border: 1px solid var(--rule); border-radius: 8px; padding: 3px 8px; color: var(--ink); background: var(--surface); font-size: .8rem; }

.form-error { margin: 2px 0 0; color: var(--error); font-size: .85rem; font-weight: 550; }

.queue { padding-top: 8px; }
h2 { margin-bottom: 0; font-size: 1.05rem; font-weight: 600; }
.sync-status { padding: 4px 9px; border-radius: 999px; color: var(--muted); background: var(--sunken); font-size: .72rem; font-weight: 550; }

.task-group { margin-top: 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.task-group:first-child { margin-top: 0; }
.task-group h3 { margin: 0; padding: 13px 14px 9px; color: var(--muted); font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.task-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: start; min-height: 60px; border-bottom: 1px solid var(--rule-soft); margin-left: 6px; transform-origin: left center; transition: opacity 180ms var(--ease), transform 180ms var(--ease), background 180ms var(--ease); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--sunken); }
.complete { display: grid; place-items: center; width: 44px; height: 44px; margin-top: 8px; border: 0; border-radius: 50%; color: transparent; background: transparent; }
.complete::before { content: ""; width: 22px; height: 22px; border: 1.5px solid var(--faint); border-radius: 50%; transition: background 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease); }
.complete:hover::before { border-color: var(--ink); transform: scale(1.06); }
.complete:active::before { background: var(--ink); border-color: var(--ink); transform: scale(.9); }
.check { position: absolute; color: var(--surface); font-size: .75rem; font-weight: 900; opacity: 0; }
.task-copy { min-width: 0; padding: 10px 14px 10px 0; }
.task-text { margin-bottom: 3px; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.4; cursor: text; }
.task-edit { margin: 0 0 3px; min-height: 36px; padding: 4px 8px; font-size: 1rem; line-height: 1.4; }
.task-row.is-editing { background: var(--sunken); }
.task-row.is-editing .task-actions { opacity: .4; pointer-events: none; }
.task-meta { margin-bottom: 0; overflow: hidden; color: var(--muted); font-size: .78rem; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.task-actions { margin-top: 6px; }
.task-row.is-completing { opacity: 0; transform: translateX(12px) scale(.98); }
.task-row.is-completing .complete::before { border-color: var(--ink); background: var(--ink); }
.task-row.is-completing .check { opacity: 1; }

.loading-list { display: grid; gap: 10px; margin-top: 22px; }
.loading-list i { display: block; height: 60px; border-radius: 14px; background: linear-gradient(90deg, var(--surface) 0%, var(--sunken) 45%, var(--surface) 90%); background-size: 200% 100%; box-shadow: var(--shadow); animation: shimmer 1.3s infinite linear; }
.empty-state { padding: 36px 12px 28px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 50%; color: var(--surface); background: var(--ink); font-size: 1.05rem; font-weight: 700; box-shadow: var(--shadow-lg); }
.empty-state h2 { margin-bottom: 6px; font-size: 1.08rem; font-weight: 600; }
.empty-state p { margin: 0 auto; max-width: 30ch; color: var(--muted); font-size: .9rem; line-height: 1.4; }

.toast { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 10; width: min(calc(100% - 32px), 370px); padding: 13px 15px; border-radius: 12px; color: var(--surface); background: var(--ink); box-shadow: var(--shadow-lg); font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -20% 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
.text-button { min-height: 44px; border: 0; border-radius: 12px; padding: 0 10px; color: var(--muted); background: transparent; font-size: .8rem; font-weight: 550; }
.text-button:hover { color: var(--ink); background: var(--sunken); }

.login { min-height: 100dvh; display: grid; align-content: center; gap: 14px; }
.login h1 { margin-bottom: 0; font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em; }
.login-copy { margin: 0; color: var(--muted); font-size: .95rem; }
.login-card { display: grid; gap: 12px; padding: 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: .78rem; font-weight: 550; }
.login-card input { min-height: 48px; padding: 12px 13px; }
.login-card button { min-height: 48px; border: 0; border-radius: 10px; color: var(--surface); background: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.login-card button:disabled { cursor: wait; opacity: .5; box-shadow: none; }
