@font-face{font-family:'Bricolage Grotesque';font-style:normal;font-weight:200 800;font-display:swap;src:url('/fonts/bricolage-grotesque-latin.woff2') format('woff2')}
@font-face{font-family:'Atkinson Hyperlegible Next';font-style:normal;font-weight:200 800;font-display:swap;src:url('/fonts/atkinson-next-latin.woff2') format('woff2')}
:root {
  color-scheme: dark;
  /* PrecisStudy chalkboard palette */
  --bg: #1b2a25; --surface: #243630; --border: #3b524a; --header: #16231f;
  --text: #f1eee3; --muted: #c3ccc0; --accent: oklch(0.84 0.1 160); --brand: #4fbf85; --on-accent: #0e231e;
  --danger: #f6b3a2; --amber: #f3da8e; --chalk: #a9b6ac;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px;
  --r: 14px;
  font-family: 'Atkinson Hyperlegible Next', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse 60% 18% at 22% 12%, rgb(241 238 227 / .045), transparent 70%), radial-gradient(ellipse 70% 20% at 40% 82%, rgb(241 238 227 / .04), transparent 70%), var(--bg); background-attachment: fixed; color: var(--text); font-size: 16px; line-height: 1.45; padding-bottom: 96px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s1) var(--s3); background: color-mix(in srgb, var(--header) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.brand { margin: 0; font: 800 1.15rem 'Bricolage Grotesque', sans-serif; letter-spacing: -.01em; }
.brand span { color: var(--brand); }
h2, h3, button, nav a, .eyebrow, .chip, .tag, .flag, .pill, .badge { font-family: 'Bricolage Grotesque', 'Atkinson Hyperlegible Next', sans-serif; }
nav { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
nav a { color: var(--muted); text-decoration: none; padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; transition: background .15s, color .15s; }
nav a:hover { color: var(--text); }
nav a[aria-current="page"] { color: var(--on-accent); background: var(--brand); }

main { max-width: 860px; margin: 0 auto; padding: var(--s4) var(--s3); }
.page-head { margin-bottom: var(--s3); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
h2.headline { margin: 0;  font-size: clamp(1.9rem, 5vw, 2.75rem); line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.overdue-note { margin: var(--s1) 0 0; color: var(--danger); font-weight: 600; }

.sec-head { display: flex; align-items: center; gap: var(--s1); margin: var(--s4) 0 var(--s1); color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.sec-head h3 { margin: 0; font: inherit; }
.pill { padding: 1px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .72rem; }
.sec-head.danger { color: var(--danger); }
.sec-head.today { color: var(--accent); } .sec-head.soon { color: var(--amber); } .sec-head.none { color: var(--chalk); }
.sec-head.today .pill, .sec-head.soon .pill, .sec-head.none .pill { border-color: color-mix(in srgb, currentColor 40%, transparent); }
.sec-head.danger .pill { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge { padding: 1px 8px; border-radius: 999px; background: var(--brand); color: var(--on-accent); font-size: .7rem; }

ul.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.task { --c: #8b98a9; position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 14px var(--s2) 14px 20px; background: linear-gradient(100deg, color-mix(in srgb, var(--c) 16%, var(--surface)), var(--surface) 65%); border: 1px solid color-mix(in srgb, var(--c) 22%, var(--border)); border-radius: var(--r); overflow: hidden; transition: border-color .15s; }
.task::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.task:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--border)); }
.task .body { min-width: 0; flex: 1; }
.task .title { font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.chip, .tag, .flag { padding: 1px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.chip { color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.tag { color: #fbbf24; background: color-mix(in srgb, #fbbf24 15%, transparent); }
.flag { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.due.overdue { color: var(--danger); font-weight: 600; }

input[type=checkbox] { appearance: none; flex: none; width: 26px; height: 26px; margin: 0; border: 2px solid #7f9a8e; border-radius: 50%; background: transparent center / 16px no-repeat; cursor: pointer; transition: background-color .15s, border-color .15s; }
input[type=checkbox]:hover { border-color: var(--accent); }
input[type=checkbox]:checked { background-color: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 5' fill='none' stroke='%230e231e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

.empty-state { padding: var(--s5) var(--s3); text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--r); }
.empty-state h3 { margin: 0 0 4px; font-size: 1.4rem; }
.empty-state p, .empty { margin: 0; color: var(--muted); }
.empty { padding: var(--s1) 0; font-size: .9rem; }

.card { padding: var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.card h3 { margin: 0 0 var(--s2); font-size: 1.1rem; }
form.add { display: flex; gap: var(--s1); }
input[type=text], textarea { width: 100%; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 1.1rem; }
textarea { font-size: 1rem; }
button { padding: 12px 22px; border: 0; border-radius: var(--r); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; cursor: pointer; transition: filter .15s; }
button:hover { filter: brightness(1.08); }
.hint, .msg { color: var(--muted); font-size: .88rem; margin: var(--s1) 0 0; }
.msg { color: var(--accent); min-height: 1.4em; }
details { margin-top: var(--s2); }
summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: var(--s1); }
details button { margin-top: var(--s1); }

@media (max-width: 639px) {
  header.top { backdrop-filter: none; padding: var(--s1) var(--s2); }
  nav { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20; width: calc(100% - 32px); max-width: 420px; justify-content: space-around; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); box-shadow: 0 8px 24px rgb(0 0 0 / .45); }
  nav a { flex: 1; text-align: center; padding: 12px 0; }
  main { padding: var(--s3) var(--s2); }
  form.add { flex-direction: column; }
  button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.card + .card { margin-top: var(--s2); }
.field { display: grid; gap: 6px; margin-bottom: var(--s2); color: var(--muted); font-size: .85rem; font-weight: 600; }
select { width: 100%; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.actions { display: flex; gap: var(--s1); margin-top: var(--s2); }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
[hidden] { display: none !important; }
a.bookmarklet { display: inline-block; padding: 10px 18px; border-radius: 999px; border: 1px dashed var(--accent); color: var(--accent); font-weight: 700; text-decoration: none; }
.plan-note { margin: var(--s1) 0 0; color: var(--muted); }
button.move { margin-top: var(--s2); }

.task .del { flex: none; width: 32px; height: 32px; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; opacity: .55; }
.task .del:hover, .task .del:focus-visible { opacity: 1; color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); filter: none; }
.task .mins { color: var(--accent); font-weight: 600; }
button { background: var(--brand); }
button.secondary { background: var(--surface); }
@media (max-width: 639px) { .task .del { width: 44px; height: 44px; margin: -6px -8px 0 0; } }

.progress { height: 8px; margin-top: var(--s2); border-radius: 999px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; max-width: 420px; }
.progress span { display: block; height: 100%; background: var(--brand); transform-origin: left; transition: transform .3s ease-out; }
.task .snooze { flex: none; width: 32px; height: 32px; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.1rem; opacity: .6; }
.task .snooze:hover, .task .snooze:focus-visible { opacity: 1; color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); filter: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 8px 8px 8px 18px; border-radius: 999px; background: var(--header); border: 1px solid var(--brand); color: var(--text); box-shadow: 0 8px 24px rgb(0 0 0 / .4); }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { padding: 8px 16px; border-radius: 999px; min-height: 36px; }
@media (max-width: 639px) { .toast { bottom: 96px; } .task .snooze { width: 44px; height: 44px; margin-top: -6px; } }
.sync-code { display: block; margin: var(--s2) 0 0; padding: 12px 16px; border-radius: var(--r); background: var(--bg); border: 1px dashed var(--brand); color: var(--accent); font: 600 1.05rem ui-monospace, monospace; overflow-wrap: anywhere; user-select: all; }
form.join { margin-top: var(--s2); }
form.join input { font-family: ui-monospace, monospace; font-size: 1rem; }

/* Title is a button that opens the editor; keep it looking like text. */
.task button.title { display: block; width: 100%; padding: 0; margin: 0; border: 0; border-radius: 4px; background: none; color: var(--text); text-align: left; cursor: pointer; font-family: 'Atkinson Hyperlegible Next', sans-serif; min-height: 0; }
.task button.title:hover { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--text) 40%, transparent); text-underline-offset: 3px; filter: none; }
main:focus { outline: none; }

.preview { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: var(--s1) 0 0; min-height: 1.6em; color: var(--muted); font-size: .9rem; }
.preview .pv-label { color: var(--accent); font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.preview .chip { --c: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 22px; border-radius: var(--r); background: var(--brand); color: var(--on-accent); font: 700 1rem 'Bricolage Grotesque', sans-serif; text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.actions.center { justify-content: center; flex-wrap: wrap; }
.welcome { border-style: solid; border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.welcome p { max-width: 36ch; margin: 0 auto; }

dialog.editor { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: var(--s3); border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); }
dialog.editor::backdrop { background: rgb(8 14 12 / .65); }
dialog.editor h2 { margin: 0 0 var(--s2); font-size: 1.4rem; }
dialog.editor input[type=text], dialog.editor input[type=date], dialog.editor input[type=time], dialog.editor input[type=number], dialog.editor textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 1rem; color-scheme: dark; }
dialog.editor .field { margin-bottom: 12px; }
dialog.editor .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog.editor .check { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
dialog.editor .check input { width: 22px; height: 22px; }
dialog.editor a { color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); margin-left: auto; }
dialog.editor .row2 > .field, dialog.editor .row2 input, dialog.editor .row2 select { min-width: 0; }
