/* ==========================================================================
   taken — THE stylesheet. Tokens, base and atoms copied from curriculum's
   design v2 (curriculum/public/app.css, reviews/design-v2/rationale.md):
   dark dithered dashboard, charcoal panels, hairlines, 10px radius, Inter +
   JetBrains Mono (self-hosted). Colour roles: warm = the one accent (add /
   tick), green/amber/red = status, owner hues = place (stan/karli/samen).
   ========================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/jetbrains-mono-latin.woff2) format("woff2"); }

/* ---------- Tokens: dark (default) ---------- */
:root {
  --bg: #18191C; --panel: #1E1F23; --panel2: #25262B; --sunk: #141518; --hair: #2A2B30; --line: #36373D;
  --tx: #ECECEE; --tx2: #A3A4AB; --tx3: #8A8B93;
  --blue: #4C82F0; --blue-hi: #6E9BF6; --blue-tx: #7FA6F5; --blue-bg: rgba(76, 130, 240, .14);
  --ok: #4FBF7F; --ok-bg: rgba(79, 191, 127, .13); --warn: #E3A33B; --warn-bg: rgba(227, 163, 59, .13); --bad: #EF6A5E; --bad-bg: rgba(239, 106, 94, .13);
  --warm: #F28C4B; --warm-tx: #F5A06B; --on-warm: #1A1206; --warm-bg: rgba(242, 140, 75, .14);
  --focus: #8DB0F7;
  --hdr-bg: rgba(24, 25, 28, .78); --shadow: 0 10px 30px rgba(0, 0, 0, .35); --shadow-sm: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 6px 18px rgba(0, 0, 0, .22);
  --mb: color-mix(in srgb, var(--blue) 78%, var(--panel)); /* review-activity bars */
  --strong-bg: color-mix(in srgb, var(--tx) 11%, var(--panel2)); --strong-line: color-mix(in srgb, var(--tx) 30%, var(--line)); /* the main action, neutral */
  --band-tint: oklch(.7 .045 var(--h, 250));
  --radius: 10px; --r-sm: 7px; --gap: 12px; --maxw: 46rem; --measure: 40rem;
  --nav-h: 60px; --hdr-h: 48px; --dock-h: 73px;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, var(--emoji);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif, var(--emoji);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace, var(--emoji);
  --h: 250;
  color-scheme: dark;
}
:root, .trk {
  --trk: oklch(.8 .1 var(--h));          /* text on panels, AA */
  --trk-strong: oklch(.7 .13 var(--h));  /* swatches, lines */
  --trk-fill: oklch(.31 .05 var(--h));   /* tints */
  --band-tint: oklch(.7 .045 var(--h));  /* the dithered band: low chroma, so no hue competes with the accent */
}

/* ---------- Tokens: light (secondary): the header switch / ?scheme=light, or 'auto' on a light OS ---------- */
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #F4F4F1; --panel: #FFFFFF; --panel2: #F3F3EF; --sunk: #ECECE8; --hair: #E3E3DE; --line: #D2D2CC;
    --tx: #18191C; --tx2: #55575E; --tx3: #6A6C73;
    --blue: #3E73E0; --blue-hi: #2F64D6; --blue-tx: #2557C2; --blue-bg: rgba(62, 115, 224, .1);
    --ok: #1B7F4C; --ok-bg: rgba(27, 127, 76, .09); --warn: #9A6100; --warn-bg: rgba(154, 97, 0, .09); --bad: #C93A30; --bad-bg: rgba(201, 58, 48, .08);
    --warm: #E8743A; --warm-tx: #B4470F; --on-warm: #18191C; --warm-bg: rgba(232, 116, 58, .12);
    --focus: #2F64D6;
    --hdr-bg: rgba(244, 244, 241, .82); --shadow: 0 10px 30px rgba(24, 25, 28, .12); --shadow-sm: 0 1px 2px rgba(24, 25, 28, .05);
    color-scheme: light;
  }
  :root[data-theme="auto"], :root[data-theme="auto"] .trk { --trk: oklch(.48 .13 var(--h)); --trk-strong: oklch(.62 .15 var(--h)); --trk-fill: oklch(.93 .04 var(--h)); --band-tint: oklch(.56 .05 var(--h, 250)); }
}
:root[data-theme="light"] {
  --bg: #F4F4F1; --panel: #FFFFFF; --panel2: #F3F3EF; --sunk: #ECECE8; --hair: #E3E3DE; --line: #D2D2CC;
  --tx: #18191C; --tx2: #55575E; --tx3: #6A6C73;
  --blue: #3E73E0; --blue-hi: #2F64D6; --blue-tx: #2557C2; --blue-bg: rgba(62, 115, 224, .1);
  --ok: #1B7F4C; --ok-bg: rgba(27, 127, 76, .09); --warn: #9A6100; --warn-bg: rgba(154, 97, 0, .09); --bad: #C93A30; --bad-bg: rgba(201, 58, 48, .08);
  --warm: #E8743A; --warm-tx: #B4470F; --on-warm: #18191C; --warm-bg: rgba(232, 116, 58, .12);
  --focus: #2F64D6;
  --hdr-bg: rgba(244, 244, 241, .82); --shadow: 0 10px 30px rgba(24, 25, 28, .12); --shadow-sm: 0 1px 2px rgba(24, 25, 28, .05);
  color-scheme: light;
}
:root[data-theme="light"], :root[data-theme="light"] .trk { --trk: oklch(.48 .13 var(--h)); --trk-strong: oklch(.62 .15 var(--h)); --trk-fill: oklch(.93 .04 var(--h)); --band-tint: oklch(.56 .05 var(--h, 250)); }
/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tx); overflow-x: hidden;
  font: 400 15px/1.5 var(--font); letter-spacing: -.003em; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
  /* Subpixel glyph positioning: without it Blink on Linux rounds web-font glyph advances to whole px
     ("f rozen", collapsed word spaces). Form controls inherit it. Do not remove. */
  text-rendering: geometricPrecision;
}
button, input, select, textarea { text-rendering: inherit; }
::selection { background: color-mix(in srgb, var(--blue) 45%, transparent); color: var(--tx); }
img, svg { max-width: 100%; }
a { color: var(--tx); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--tx2) 60%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { font-family: var(--font); letter-spacing: -.015em; line-height: 1.2; font-weight: 600; }
h3 { font-size: 1.05rem; }
.num, code, pre, kbd { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
.num { letter-spacing: 0; }
code { font-size: .86em; background: var(--sunk); border: 1px solid var(--hair); border-radius: 5px; padding: .05em .35em; }
hr { border: 0; border-top: 1px solid var(--hair); }
.muted { color: var(--tx2); } .small { font-size: .875rem; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ok { color: var(--ok); } .bad { color: var(--bad); }

/* Focus: a calm blue ring with a gap, visible on every surface */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* Buttons: compact, bordered, ≥44px touch targets */
button { font: inherit; color: inherit; cursor: pointer; }
button {
  min-height: 44px; padding: .5em 1em; border-radius: var(--r-sm);
  background: var(--panel2); color: var(--tx); border: 1px solid var(--line);
  font: 500 .875rem/1.2 var(--font); letter-spacing: 0;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
button:hover:not(:disabled) { background: color-mix(in srgb, var(--tx) 9%, var(--panel2)); border-color: color-mix(in srgb, var(--tx) 22%, var(--line)); }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary { background: var(--strong-bg); border-color: var(--strong-line); color: var(--tx); font-weight: 600; }
button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--tx) 17%, var(--panel2)); border-color: color-mix(in srgb, var(--tx) 45%, var(--line)); }
button:disabled { opacity: .45; cursor: default; }
button.wide { width: 100%; min-height: 50px; }
input, textarea, select { font: inherit; color: inherit; }
textarea, input[type=text], input[type=number] {
  width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--sunk); color: var(--tx);
  padding: .6em .75em; min-height: 44px; font: 400 1rem/1.45 var(--font);
}
textarea:focus, input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
textarea::placeholder, input::placeholder { color: var(--tx3); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.card { background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0 .55em; font: 500 .68rem/1.6 var(--mono); color: var(--tx2); vertical-align: middle; }

/* ==========================================================================
   taken components
   ========================================================================== */
:root { --band: url(/img/band-dark.png); --o-stan: oklch(.78 .1 250); --o-karli: oklch(.78 .11 345); --o-samen: oklch(.8 .11 150); --cat-fur: #3A3B42; --cat-cushion: #2A2B30; --maxw: 34rem; }
:root[data-theme="light"] { --band: url(/img/band-light.png); --o-stan: oklch(.5 .13 250); --o-karli: oklch(.52 .15 345); --o-samen: oklch(.5 .12 150); --cat-fur: #C9CBD0; --cat-cushion: #E3E3DE; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] { --band: url(/img/band-light.png); --o-stan: oklch(.5 .13 250); --o-karli: oklch(.52 .15 345); --o-samen: oklch(.5 .12 150); --cat-fur: #C9CBD0; --cat-cushion: #E3E3DE; } }
input[type=password], input[type=date] {
  width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--sunk); color: var(--tx);
  padding: .6em .75em; min-height: 44px; font: 400 1rem/1.45 var(--font);
}
body { font-size: 16px; min-height: 100dvh; }

/* ---------- shell: dithered band under a slim header ---------- */
.top { position: relative; height: 104px; background: var(--band) center top / auto 132px repeat-x; image-rendering: pixelated; }
.top-in { position: relative; max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 8px) 16px 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 72%, transparent); border: 1px solid var(--hair); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font: 600 .95rem/1 var(--font); letter-spacing: -.01em; color: var(--tx); text-decoration: none; }
.brand img { width: 20px; height: 20px; image-rendering: pixelated; }
.spacer { flex: 1; }
.sync { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 72%, transparent); border: 1px solid var(--hair); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font: 500 .72rem/1 var(--mono); color: var(--tx2); }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sync.off i { background: var(--warn); } .sync.err i { background: var(--bad); }
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; display: inline-grid; place-items: center; border-radius: 999px; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-color: var(--hair); }
.icon-btn .ic { width: 18px; height: 18px; }
main { max-width: var(--maxw); margin: -34px auto 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 96px); position: relative; }

/* ---------- composer: one line, Enter = saved ---------- */
.composer { display: flex; align-items: center; gap: 6px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: color-mix(in srgb, var(--focus) 70%, var(--line)); }
.composer input { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none !important; padding: 0 8px; min-height: 44px; font-size: 1.0625rem; }
.composer input:focus { outline: none; }
.chip { min-height: 36px; height: 36px; padding: 0 10px; border-radius: 999px; font: 600 .78rem/1 var(--font); display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border-color: var(--line); color: var(--tx); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--oc, var(--tx3)); }
.chip-wrap { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; }
.add { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 9px; background: var(--warm); border-color: var(--warm); color: var(--on-warm); display: inline-grid; place-items: center; }
.add:hover:not(:disabled) { background: color-mix(in srgb, var(--warm) 88%, #fff); border-color: var(--warm); }
.add .ic { width: 20px; height: 20px; stroke-width: 2; }
.hint { margin: 8px 4px 0; font: 400 .74rem/1.5 var(--mono); color: var(--tx3); }
.hint b { font-weight: 500; color: var(--tx2); }
.o-stan { --oc: var(--o-stan); } .o-karli { --oc: var(--o-karli); } .o-samen { --oc: var(--o-samen); }

/* ---------- filter ---------- */
.filter { display: flex; gap: 4px; margin: 18px 0 8px; padding: 3px; background: var(--sunk); border: 1px solid var(--hair); border-radius: 10px; }
.filter button { flex: 1; min-height: 40px; border: 0; background: transparent; color: var(--tx2); border-radius: 7px; font: 500 .86rem/1 var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.filter button[aria-selected=true] { background: var(--panel2); color: var(--tx); box-shadow: 0 0 0 1px var(--line); }
.filter .n { font: 500 .7rem/1 var(--mono); color: var(--tx3); }

/* ---------- task rows ---------- */
.panel { background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.tasks { list-style: none; margin: 0; padding: 4px; }
.task { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; min-height: 52px; border-radius: 8px; }
.task + .task { border-top: 1px solid var(--hair); }
@media (hover: hover) and (pointer: fine) { .task:hover { background: color-mix(in srgb, var(--panel2) 60%, transparent); } }
.tick { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; border-radius: 8px; }
.tick:hover:not(:disabled) { background: transparent; }
.tick i { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--tx3); display: grid; place-items: center; transition: background .12s, border-color .12s; }
.tick:hover i { border-color: var(--warm); }
.tick svg { width: 14px; height: 14px; fill: none; stroke: var(--on-warm); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.task.is-done .tick i, .task.ticking .tick i { background: var(--warm); border-color: var(--warm); }
.task.is-done .tick svg, .task.ticking .tick svg { opacity: 1; }
.body { min-width: 0; padding: 7px 8px 7px 2px; cursor: pointer; border: 0; background: transparent; text-align: left; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 2px; border-radius: 6px; font: inherit; }
.body:hover:not(:disabled) { background: transparent; }
.t-title { font: 400 .98rem/1.35 var(--font); color: var(--tx); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.task.is-done .t-title, .task.ticking .t-title { color: var(--tx3); text-decoration: line-through; text-decoration-color: var(--tx3); }
.t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font: 400 .74rem/1.3 var(--mono); color: var(--tx3); }
.t-meta:empty { display: none; }
.t-owner { display: inline-flex; align-items: center; gap: 5px; color: var(--oc); }
.t-owner::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--oc); }
.t-rec { display: inline-flex; align-items: center; gap: 4px; }
.t-rec svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.t-due.late { color: var(--bad); }
.t-due.today { color: var(--warn); }
.t-pending { color: var(--warn); }
.empty { display: grid; justify-items: center; gap: 4px; padding: 22px 16px 26px; text-align: center; color: var(--tx2); font-size: .92rem; }
.empty img { width: 150px; height: auto; image-rendering: pixelated; margin-bottom: 6px; }
.empty b { color: var(--tx); font-weight: 600; }

/* ---------- folds: upcoming, done today ---------- */
.fold { margin-top: 6px; }
.fold + .fold { margin-top: 0; }
.fold > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; list-style: none; cursor: pointer; font: 500 .82rem/1 var(--font); color: var(--tx2); border-radius: 8px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--tx3); border-bottom: 1.5px solid var(--tx3); transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 2px; }
.fold[open] > summary::before { transform: rotate(45deg); }
.fold > summary:hover { color: var(--tx); }
.count { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.5em; padding: 0 .4em; border-radius: 5px; background: var(--panel2); border: 1px solid var(--hair); font: 500 .7rem/1 var(--mono); color: var(--tx2); }
.fold .tasks { opacity: .92; }

/* ---------- toast ---------- */
.toast { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 20px); display: flex; gap: 12px; align-items: center; width: max-content; max-width: calc(100vw - 32px); padding: 6px 6px 6px 14px; background: var(--panel2); color: var(--tx); border: 1px solid var(--line); border-radius: 10px; font: 500 .88rem/1.3 var(--font); box-shadow: var(--shadow); }
.toast button { min-height: 40px; padding: 0 12px; background: var(--tx); color: var(--bg); border: 0; font-weight: 600; white-space: nowrap; }
.toast button:hover:not(:disabled) { background: color-mix(in srgb, var(--tx) 85%, var(--bg)); }

/* ---------- sheets (edit, settings) ---------- */
dialog.sheet { width: min(100vw, var(--maxw)); max-width: 100vw; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; background: var(--panel); color: var(--tx); box-shadow: var(--shadow); overflow: auto; }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 14px; border-bottom: 1px solid var(--line); } }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .55); }
.sheet-in { padding: 14px 16px calc(env(safe-area-inset-bottom) + 16px); display: grid; gap: 14px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-h h2 { margin: 0; font: 600 1rem/1.2 var(--font); }
.field { display: grid; gap: 6px; }
.field > span, .label { font: 500 .76rem/1.2 var(--font); color: var(--tx2); }
.seg-pick { display: flex; gap: 4px; padding: 3px; background: var(--sunk); border: 1px solid var(--hair); border-radius: 10px; }
.seg-pick button { flex: 1; min-height: 40px; border: 0; background: transparent; color: var(--tx2); display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.seg-pick button[aria-pressed=true] { background: var(--panel2); color: var(--tx); box-shadow: 0 0 0 1px var(--line); }
.seg-pick .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--oc); }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest button { min-height: 36px; height: 36px; padding: 0 11px; border-radius: 999px; font: 500 .76rem/1 var(--font); color: var(--tx2); }
.suggest button[aria-pressed=true] { color: var(--tx); border-color: var(--strong-line); background: var(--strong-bg); }
.sheet-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.err { color: var(--bad); font-size: .84rem; margin: 0; }
.dev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.dev-list li { display: flex; align-items: center; gap: 10px; min-height: 48px; border-top: 1px solid var(--hair); }
.dev-list li:first-child { border-top: 0; }
.dev-list .d-t { flex: 1; min-width: 0; display: grid; }
.dev-list .d-m { font: 400 .72rem/1.3 var(--mono); color: var(--tx3); }
.secret { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--warm); border-radius: var(--r-sm); background: var(--warm-bg); }
.secret code { font-size: .78rem; word-break: break-all; user-select: all; background: var(--sunk); padding: 8px; display: block; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

/* ---------- login ---------- */
.login { margin-top: 8px; padding: 18px 16px; display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 1.25rem; }
.login p { margin: 0; color: var(--tx2); font-size: .9rem; }

.apk-page main { max-width: var(--maxw); margin: 15vh auto; padding: 0 16px; }

@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; animation: none !important; } }
.m0 { margin: 0; }
.ic .knob { fill: var(--bg); }
