/* yat — styles from design.md. Every colour is a light/dark token pair. */
:root {
  --canvas:#faf8f5; --surface:#ffffff; --surface-raised:#ffffff; --surface-sunken:#f3f0eb;
  --border:#e4dfd8; --border-strong:#8f8a82;
  --text:#1d1e1c; --text-ui:#46443f; --text-secondary:#5c5a56; --text-tertiary:#6e6b66;
  --accent:#0f766e; --accent-hover:#0b5f59; --accent-subtle:#dcefec; --on-accent:#ffffff;
  --accent-inverse:#4fd1c0;
  --overdue:#b42318; --waiting:#8a5a00; --frozen:#48647f; --started:#2d7a2d;
  --l-red:#b3261e; --l-orange:#a34a00; --l-yellow:#7a6200; --l-green:#2d7a2d;
  --l-blue:#1f63b5; --l-violet:#6b46c1; --l-pink:#b02a70; --l-gray:#5c5a56;
  --shadow-float:0 4px 16px rgba(29,30,28,.12), 0 0 0 1px rgba(29,30,28,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --t-state:120ms; --t-layer:180ms; --ease:cubic-bezier(.2,0,0,1);
  --top-h: 96px;
  --check-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  color-scheme: light;
}
:root[data-theme="dark"] {
  --canvas:#171614; --surface:#201f1c; --surface-raised:#2a2825; --surface-sunken:#131210;
  --border:#35322e; --border-strong:#76716a;
  --text:#f0ede8; --text-ui:#cdc8bf; --text-secondary:#b3aea6; --text-tertiary:#9a958c;
  --accent:#4fd1c0; --accent-hover:#74dccd; --accent-subtle:#173b37; --on-accent:#0c2421;
  --accent-inverse:#0f766e;
  --overdue:#ff8a7a; --waiting:#e5b454; --frozen:#9db8d4; --started:#7fcf7f;
  --l-red:#f28b82; --l-orange:#f2a15a; --l-yellow:#dcc04a; --l-green:#7fcf7f;
  --l-blue:#7fb2f0; --l-violet:#b39df2; --l-pink:#f08cc0; --l-gray:#b3aea6;
  --shadow-float:0 4px 16px rgba(0,0,0,.5), 0 0 0 1px rgba(240,237,232,.08);
  --check-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c2421' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin:0; }
/* Keep room for the page scrollbar even when the page is short, so collapsing a section
   (and the scrollbar going away) does not shift the layout sideways. */
html { scrollbar-gutter:stable; }
/* To-do titles and what the user wrote are the darkest thing on screen (--text). The interface
   around them (navigation, headers, buttons, captions) starts one step lighter (--text-ui). */
body { background:var(--canvas); color:var(--text-ui); font:400 16px/1.4 var(--font); -webkit-font-smoothing:antialiased; }
button { font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; }
a { color:inherit; }
:focus-visible { outline:2px solid var(--accent); outline-offset:0; }
.mono { font-family:var(--mono); font-variant-numeric:tabular-nums; }
code { font:13px var(--mono); background:var(--surface-sunken); padding:1px 5px; border-radius:4px; word-break:break-all; }
.ic { fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; flex:none; }
.spacer { flex:1; }
[hidden] { display:none !important; }

/* ───────── Shell ───────── */
.shell { display:grid; grid-template-columns:240px minmax(0,1fr); min-height:100vh; }
#sidebar { background:var(--surface-sunken); position:sticky; top:0; height:100vh; overflow:auto; padding:12px 0; display:flex; flex-direction:column; }
.sb-head { display:flex; align-items:center; height:36px; padding:0 16px; margin-bottom:8px; }
.brand { font-weight:600; letter-spacing:.02em; }
.icon-btn.sb-close { display:none; margin-left:auto; }
.srow { display:flex; align-items:center; gap:10px; height:36px; padding:0 12px 0 14px; margin-right:8px; border-radius:0 6px 6px 0;
  border-left:2px solid transparent; text-decoration:none; color:var(--text-ui); width:calc(100% - 8px); text-align:left; }
.srow .ic { color:var(--text-secondary); }
.srow:hover { background:var(--surface); }
.srow.on { background:var(--surface); font-weight:600; border-left-color:var(--accent); }
.srow.on .ic { color:var(--accent); }
.srow .sname { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.srow.new { color:var(--text-tertiary); } .srow.new .ic { color:var(--text-tertiary); }
.srow.drag-over { box-shadow:inset 0 2px 0 var(--accent); }
/* .key and .activity share one fixed-width slot on the right, so the avatars before it line up
   whether the row ends with a key (hidden until hover), a count or an empty slot. */
.srow .key { flex:none; min-width:20px; text-align:center; font:500 12px var(--mono); color:var(--text-tertiary); visibility:hidden; }
.srow .activity { flex:none; min-width:20px; justify-content:center; }
#sidebar:hover .srow .key { visibility:visible; }
#sidebar .cap { font:500 12px/1.35 var(--font); color:var(--text-tertiary); padding:16px 16px 4px; }
#sidebar .foot { border-top:1px solid var(--border); margin-top:auto; padding:8px 8px 0; }
/* scoped to the sidebar: #view also carries the class "profile" on the Profile page */
#sidebar .profile { display:flex; align-items:center; gap:4px; }
#sidebar .profile .who { display:flex; align-items:center; gap:10px; flex:1; min-width:0; height:48px; padding:0 8px; border-radius:8px; text-decoration:none; }
#sidebar .profile .who:hover, #sidebar .profile .who.on { background:var(--surface); }
#sidebar .profile .who-t { display:grid; min-width:0; }
#sidebar .profile .who-name { font-weight:600; line-height:1.3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#sidebar .profile .who-plan { font:500 12px/1.35 var(--font); color:var(--text-tertiary); }
#sidebar .profile .icon-btn:hover { background:var(--surface); }
.icon-btn.on { color:var(--accent); background:var(--accent-subtle); }
.activity { display:inline-flex; align-items:center; height:18px; padding:0 6px; border-radius:999px; background:var(--accent-subtle); font:500 12px var(--font); color:var(--text); }

#main { display:flex; min-width:0; min-height:100vh; }
.pane { flex:1; min-width:0; padding:0 56px 120px; }
#top, #view { max-width:720px; margin:0 auto; }
body:not(.sheet):has(#view.settings) #top, body:not(.sheet):has(#view.profile) #top, body:not(.sheet):has(#view.features) #top, body:not(.sheet):has(#view.stats) #top { display:none; }
body:has(#view.settings) #view, body:has(#view.profile) #view, body:has(#view.features) #view, body:has(#view.stats) #view { padding-top:24px; }
#top { position:sticky; top:0; z-index:5; background:var(--canvas); padding:24px 0 12px; }

/* ───────── Composer ───────── */
.composer { display:flex; align-items:center; gap:6px; height:36px; padding:0 10px; background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; }
.composer:focus-within { outline:2px solid var(--accent); outline-offset:-1px; }
.composer .cfield { position:relative; flex:1; min-width:0; height:100%; }
.composer input, .composer .hl { position:absolute; inset:0; font:inherit; padding:0; margin:0; border:0; white-space:pre; line-height:34px; letter-spacing:normal; }
.composer input { width:100%; background:transparent; color:var(--text); outline:0 !important; }
.composer input::placeholder { color:var(--text-tertiary); }
.composer .hl { color:transparent; overflow:hidden; pointer-events:none; }
.composer .hl mark { color:transparent; background:var(--accent-subtle); border-radius:4px; box-shadow:0 0 0 2px var(--accent-subtle); }
.composer .sheet-close, .composer .send { display:none; }
.acc { display:none; }
#acc-date { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.tips { display:flex; gap:12px; flex-wrap:wrap; align-items:center; font:500 12px/1.35 var(--font); color:var(--text-tertiary); padding:6px 2px 0; }
.tips .mono { color:var(--text-secondary); font-size:12px; }
.btn-text.hide-tips { margin-left:auto; font:500 12px var(--font); }
.float { background:var(--surface-raised); box-shadow:var(--shadow-float); border-radius:12px; }
#ac:empty { display:none; }
.ac { position:absolute; z-index:20; padding:4px; margin-top:6px; width:360px; max-width:100%; }
.ac-item { display:flex; align-items:center; gap:8px; height:36px; padding:0 8px; border-radius:6px; cursor:pointer; }
.ac-item.on { background:var(--accent-subtle); }
.ac-l { display:flex; align-items:center; gap:8px; flex:1; min-width:0; }
.ac-l b { font-weight:600; }
.ac-l .label { width:12px; height:12px; padding:0; }
.ac .short { margin-left:auto; font:12px var(--mono); color:var(--text-tertiary); }
.ac .offer { color:var(--accent); }
.sortbar { display:flex; align-items:center; gap:12px; height:36px; padding:0 12px; background:var(--surface-sunken); border-radius:8px; font:500 12px var(--font); color:var(--text-secondary); }
.sortbar .kbd { color:var(--text-tertiary); }
.sortbar button { margin-left:auto; font-size:16px; }

/* ───────── Title row, chips ───────── */
.title-row { display:flex; align-items:center; gap:10px; min-height:40px; margin:8px 0 8px; padding:0 12px 0 3px; }
.title-row .ws-ic { color:var(--text-secondary); margin-left:9px; }
.view-title { font:600 20px/1.3 var(--font); margin:0 0 0 9px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.title-row .ws-ic + .view-title { margin-left:0; }
.icon-btn.menu-btn { display:none; }
#conn { display:flex; align-items:center; gap:4px; font:500 12px var(--font); color:var(--text-tertiary); }
.chips { display:flex; gap:8px; overflow-x:auto; padding:4px 3px 12px; scrollbar-width:none; }
.chips::-webkit-scrollbar { display:none; }
.members .avatar { width:24px; height:24px; font-size:10px; }

/* ───────── Labels and states ───────── */
.label { --hue:var(--l-gray); display:inline-flex; align-items:center; height:20px; padding:0 8px; border-radius:999px; font:400 13px/1 var(--font); white-space:nowrap;
  background:color-mix(in srgb, var(--hue) 9%, transparent); color:color-mix(in srgb, var(--hue) 70%, var(--text-secondary)); transition:background var(--t-state) var(--ease); }
.label.active { background:color-mix(in srgb, var(--hue) 22%, transparent); color:var(--hue); font-weight:600; }
[data-hue=red]{--hue:var(--l-red)} [data-hue=orange]{--hue:var(--l-orange)} [data-hue=yellow]{--hue:var(--l-yellow)}
[data-hue=green]{--hue:var(--l-green)} [data-hue=blue]{--hue:var(--l-blue)} [data-hue=violet]{--hue:var(--l-violet)}
[data-hue=pink]{--hue:var(--l-pink)} [data-hue=gray]{--hue:var(--l-gray)}
/* on desktop a filter chip reads like the labels on the rows; the active one carries an × */
button.label.chip { height:24px; padding:0 10px; gap:6px; flex:none; }
button.label.chip .chip-x { margin-right:-4px; }
.tag { display:inline-flex; align-items:center; gap:4px; height:20px; padding:0 6px; border:1px solid currentColor; border-radius:6px; font:500 12px/1 var(--font); white-space:nowrap; flex:none; }
.tag.waiting { color:var(--waiting); } .tag.frozen { color:var(--frozen); } .tag.in-progress { color:var(--started); }
.tag.pending { color:var(--text-secondary); border-style:dashed; }
.is-pending .tag.pending { color:var(--text-tertiary); }

/* ───────── Checkbox ───────── */
.check { width:36px; height:36px; display:grid; place-items:center; flex:none; border-radius:999px; order:0; }
.check::before { content:""; width:18px; height:18px; border-radius:999px; border:1.5px solid var(--border-strong); transition:background var(--t-state) var(--ease), border-color var(--t-state) var(--ease); }
.check[aria-checked="true"]::before { background:var(--accent) var(--check-tick) center/12px no-repeat; border-color:var(--accent); }
.check.ghost { color:var(--text-tertiary); } .check.ghost::before { display:none; }
.is-pending .check::before { border-style:dashed; }

/* ───────── To-do row ───────── */
.list { position:relative; }
.row { position:relative; border-bottom:1px solid var(--border); outline:none; touch-action:pan-y; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.ri { position:relative; display:flex; align-items:center; height:36px; padding:0 12px 0 3px; border-radius:6px; background:transparent; }
.row:hover > .ri, .row.selected > .ri { background:var(--surface-sunken); }
.row:focus-visible > .ri { box-shadow:inset 0 0 0 2px var(--accent); }
.row .l2 { display:contents; }
.row .time { order:1; width:72px; flex:none; font:13px var(--mono); font-variant-numeric:tabular-nums; color:var(--text-secondary); white-space:nowrap; overflow:hidden; }
.row .time.overdue { color:var(--overdue); }
/* No row on screen has a date or a time: the column would be an unexplained gap, so titles sit next to the checkbox. */
.pane:not(:has(.row .time:not(:empty))) .row .time { display:none; }
.row .main { order:2; display:flex; align-items:center; gap:6px; min-width:0; flex:1; }
.title { color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; cursor:pointer; }
.row.done .title { color:var(--text-tertiary); text-decoration:line-through; }
.row.done .time { color:var(--text-tertiary); }
.row .meta { order:3; display:flex; align-items:center; gap:8px; margin-left:12px; color:var(--text-secondary); font-size:13px; flex:none; }
.row .meta:empty { display:none; }
/* the workspace, as a grey icon-only label: a click filters the view to it */
.row .meta .label.ws { padding:0 5px; flex:none; }
.row .meta .mi { display:flex; color:var(--text-secondary); }
/* Others commented since the user last opened it: an accent dot on the comment icon. */
.row .meta .mi.unread { position:relative; color:var(--accent); }
.row .meta .mi.unread::after { content:""; position:absolute; top:0; right:-1px; width:7px; height:7px; border-radius:999px; background:var(--accent); }
.row .meta .prog { font-size:13px; }
/* Notes card: opens under the notes icon on hover, right-aligned with it, after a short pause. */
.row .meta .has-tip { position:relative; }
.note-tip { position:absolute; z-index:4; top:calc(100% + 10px); right:-12px; width:max-content; max-width:320px; padding:10px 12px;
  color:var(--text); font:400 13px/1.45 var(--font); text-align:left; white-space:normal; pointer-events:none;
  visibility:hidden; opacity:0; transition:opacity var(--t-state) var(--ease), visibility 0s linear var(--t-state); }
.has-tip:hover > .note-tip { visibility:visible; opacity:1; transition-delay:250ms, 250ms; }
.note-tip .nt-body { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:10; overflow:hidden; overflow-wrap:anywhere; }
.note-tip .nt-body.plain { white-space:pre-line; }
@media (hover:none), (max-width:760px) { .note-tip { display:none; } }
/* The to-do's link, after the meta strip: a tap opens it, the row stays where it is. */
.row .row-link { order:3; margin:0 -4px 0 8px; }
.row:hover .row-link:hover { background:var(--surface); }
.row .clk { display:none; }
.row.clocked > .ri { background:var(--accent-subtle); }
.row .margin-clock { position:absolute; left:-28px; top:10px; color:var(--accent); display:flex; }
/* Laid out but transparent: pointing at its spot in the margin shows it too, not only hovering the row. */
.row .chev { position:absolute; left:100%; top:0; width:32px; height:36px; display:grid; opacity:0; place-items:center; color:var(--text-tertiary); border-radius:6px; }
.row:hover .chev, .row:focus-within .chev { opacity:1; }
.row .chev:hover { color:var(--text); background:var(--surface-sunken); }
.row.virtual .title { color:var(--text-secondary); }
.row .handle { display:flex; color:var(--text-tertiary); cursor:grab; touch-action:none; padding:6px; margin:-6px; }
.sorting .row .chev { display:none !important; }
.row.dragging { z-index:3; border-color:transparent; }
.row.dragging > .ri { background:var(--surface-raised); box-shadow:var(--shadow-float); }
.drop-line { height:2px; background:var(--accent); margin:-1px 0; }
.avatars { display:flex; }
.avatar { --hue:var(--l-gray); flex:none; width:20px; height:20px; border-radius:999px; display:grid; place-items:center; font:600 8px var(--font);
  background:color-mix(in srgb, var(--hue) 16%, var(--surface-sunken)); color:var(--text); border:1px solid var(--canvas); margin-left:-4px; }
.avatar:first-child { margin-left:0; }
.avatar.lg { width:28px; height:28px; font-size:11px; }
.avatar.xl { width:32px; height:32px; font-size:12px; border-color:transparent; }
img.avatar { object-fit:cover; padding:0; }
.avatar.more { --hue:var(--l-gray); }
/* today's progress around the user's own avatar: 2px, clockwise from 12, drawn outside so nothing moves */
.ring { --p:0; position:relative; flex:none; display:grid; border-radius:999px; }
.ring::before { content:""; position:absolute; inset:-3px; border-radius:999px; pointer-events:none;
  background:conic-gradient(var(--accent) calc(var(--p) * 1turn), var(--border) 0);
  -webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask:radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px)); }
/* the last of today's to-dos done: confetti burst from the ring (app.js moves each piece) */
.confetti { position:fixed; inset:0; z-index:60; pointer-events:none; overflow:hidden; }
.confetti i { position:absolute; width:6px; height:9px; border-radius:1px; background:var(--hue); }

/* ───────── Sections ───────── */
.group { margin-top:24px; }
.group:first-child { margin-top:0; }
.sec { position:sticky; top:var(--top-h); z-index:2; display:flex; align-items:baseline; gap:8px; height:32px; padding:8px 12px 0; background:var(--canvas); font-weight:600; }
.sec .sub { font:400 13px var(--font); color:var(--text-secondary); }
.sec .count { font:500 12px var(--font); color:var(--text-tertiary); }
.sec.overdue { color:var(--overdue); } .sec.waiting { color:var(--waiting); } .sec.frozen { color:var(--frozen); } .sec.in-progress { color:var(--started); }
.sec .btn-text { margin-left:auto; font-weight:400; font-size:13px; }
[data-sec] > .sec { cursor:pointer; user-select:none; -webkit-user-select:none; }
.sec .sec-chev { align-self:center; flex:none; margin:0 -4px 0 -4px; color:var(--text-tertiary); transition:transform var(--t-state) var(--ease); }
.nomatch { padding:12px 15px; color:var(--text-tertiary); }
.done-wrap { margin-top:16px; }
.show-done { padding:8px 15px; font-size:13px; }
.empty { text-align:center; padding:72px 0 24px; }
.empty p { font:600 28px/1.2 var(--font); margin:0; color:var(--text-ui); }
.note { color:var(--text-secondary); font-size:13px; }

/* ───────── Buttons ───────── */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; height:32px; padding:0 14px; border-radius:8px; font-weight:600; transition:background var(--t-state) var(--ease); white-space:nowrap; }
.btn.primary { background:var(--accent); color:var(--on-accent); } .btn.primary:hover { background:var(--accent-hover); }
.btn.secondary { border:1px solid var(--border-strong); color:var(--text-ui); font-weight:400; } .btn.secondary:hover { background:var(--surface-sunken); }
.btn.danger { background:var(--overdue); color:var(--canvas); }
.btn-text { color:var(--accent); text-decoration:none; } .btn-text:hover { text-decoration:underline; }
.btn-text.danger { color:var(--overdue); } .btn-text.quiet { color:var(--text-tertiary); }
.icon-btn { width:36px; height:36px; display:grid; place-items:center; border-radius:999px; color:var(--text-secondary); flex:none; text-decoration:none; }
.icon-btn:hover { background:var(--surface-sunken); color:var(--text); }
.icon-btn.sm { width:28px; height:28px; }
.field { height:36px; width:100%; padding:0 10px; background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; font:inherit; color:var(--text); }
.field:focus { outline:2px solid var(--accent); outline-offset:-1px; }
.field::placeholder { color:var(--text-tertiary); }
.field.small { height:32px; font-size:14px; }
textarea.field { height:auto; padding:8px 10px; resize:vertical; line-height:1.4; }
select.inline, input.inline { font:inherit; color:var(--text); background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; height:28px; padding:0 6px; }
input.inline.num { width:52px; }

/* switch + toggle row */
.switch { width:36px; height:20px; border-radius:999px; background:var(--border-strong); position:relative; flex:none; transition:background var(--t-state) var(--ease); }
.switch::after { content:""; position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:999px; background:var(--surface); transition:transform var(--t-state) var(--ease); }
.switch[aria-checked="true"] { background:var(--accent); } .switch[aria-checked="true"]::after { transform:translateX(16px); background:var(--on-accent); }
.toggle-row { display:flex; align-items:center; gap:12px; min-height:44px; padding:6px 12px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.toggle-row .tr-name { flex:none; }
.toggle-row .d { font-size:13px; color:var(--text-secondary); flex:1; min-width:180px; }
.toggle-row .switch, .toggle-row > .btn, .toggle-row > form, .toggle-row .seg, .toggle-row .on-caption { margin-left:auto; }
.toggle-row .on-caption { font:500 12px var(--font); color:var(--accent); }
.toggle-row .inline-field { max-width:280px; margin-left:auto; }
.toggle-row.wrap .mcp { flex-basis:100%; display:grid; gap:6px; padding:6px 0; font-size:13px; }
.toggle-row.wrap .mcp .k { display:inline-block; width:110px; color:var(--text-tertiary); }
.seg { display:flex; gap:4px; }
.seg button { height:32px; padding:0 12px; border-radius:8px; border:1px solid transparent; font-size:13px; color:var(--text-secondary); }
.seg button[aria-pressed="true"] { background:var(--surface); border-color:var(--border-strong); color:var(--text-ui); font-weight:600; }
.settings .sec, .stats .sec { position:static; }
.settings .phone-only > .group:first-child { margin-top:24px; }
/* toggle row parts: a value (what the user owns, in --text), a leading icon, a name over a
   description, and a text button lined up with the names. The profile's first block puts its
   labels in one 72px column, the width of the time column, so the values start together. */
.toggle-row .v { color:var(--text); min-width:0; overflow-wrap:anywhere; }
.toggle-row > .ic { color:var(--text-secondary); }
.toggle-row .tr-main { display:grid; flex:1; min-width:0; }
.toggle-row .tr-main .tr-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.toggle-row .tr-main .d { min-width:0; }
.toggle-row .btn-text.lead { display:inline-flex; align-items:center; gap:12px; min-height:32px; }
.fields .tr-name { width:72px; }
.fields .inline-field { margin-left:0; flex:1; min-width:0; max-width:320px; }
.page-end { margin-top:32px; padding:0 12px; }
#pk-error { margin:8px 0 0; padding:0 12px; }
.oauth-note { margin:8px 0 0; padding:0 12px; font-size:13px; color:var(--overdue); }
#pk-error:empty { display:none; }

/* ───────── Menus, toast, clock, dialogs ───────── */
.menu { padding:4px; min-width:220px; border:0; margin:0; inset:auto; position:fixed; }
.mrow { display:flex; align-items:center; gap:10px; width:100%; height:36px; padding:0 10px; border-radius:6px; text-decoration:none; color:var(--text-ui); text-align:left; font-size:14px; }
.mrow .ic { color:var(--text-secondary); }
.mrow:hover { background:var(--surface-sunken); }
.mrow.danger, .mrow.danger .ic { color:var(--overdue); }
.msep { height:1px; background:var(--border); margin:4px 6px; }
#toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); z-index:40; display:grid; gap:8px; justify-items:center; }
.toast { display:inline-flex; align-items:center; gap:16px; min-height:40px; padding:0 14px; border-radius:8px; background:var(--text); color:var(--canvas); font-size:13px; box-shadow:var(--shadow-float); }
.toast button { color:var(--accent-inverse); font-weight:600; }
.toast:empty { display:none; }
#clock { position:fixed; right:24px; bottom:24px; z-index:30; }
body:has(#detail.open) #clock { right:424px; }
.clock-pill { display:inline-flex; align-items:center; gap:10px; height:40px; padding:0 6px 0 14px; border-radius:999px; max-width:320px; }
.clock-pill .ic { color:var(--accent); }
.clock-pill .cp-go { display:inline-flex; align-items:center; gap:10px; min-width:0; text-decoration:none; }
.clock-pill .cp-title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; color:var(--text-secondary); min-width:0; }
.clock-pill button { width:28px; height:28px; border-radius:999px; display:grid; place-items:center; background:var(--surface-sunken); flex:none; }
.scrim { position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.32); display:grid; place-items:center; padding:16px; }
.dialog { width:400px; max-width:100%; padding:20px; max-height:90vh; overflow:auto; }
.dialog h2 { font:600 20px/1.3 var(--font); margin:0 0 12px; }
.dialog p { margin:0 0 12px; color:var(--text-secondary); }
.dialog .actions { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
.dialog .hint, .hint { font:500 12px/1.35 var(--font); color:var(--text-tertiary); margin:6px 0 0; }
.ws-name-line { display:flex; gap:8px; align-items:center; }
.ws-icon-btn { width:40px; height:40px; border:1px solid var(--border-strong); border-radius:8px; display:grid; place-items:center; flex:none; color:var(--text); }
.icon-pick { margin-top:12px; }
.icon-grid { display:grid; grid-template-columns:repeat(auto-fill,44px); background:var(--surface-sunken); border-radius:8px; padding:4px; margin-top:8px; max-height:228px; overflow-y:auto; }
.icon-grid button { width:44px; height:44px; display:grid; place-items:center; border-radius:8px; color:var(--text-secondary); }
.icon-grid button.on { background:var(--accent-subtle); color:var(--accent); }
.short-line { display:flex; align-items:center; gap:8px; margin-top:12px; font-size:13px; color:var(--text-secondary); }
.short-line .field { width:140px; }
.members-list { display:grid; gap:4px; margin-bottom:12px; }
.member { display:flex; align-items:center; gap:10px; min-height:44px; }
.member .mname { display:grid; flex:1; min-width:0; } .member small { color:var(--text-tertiary); font-size:12px; }
.member .d { font:500 12px var(--font); color:var(--text-tertiary); }
.cacts { display:flex; gap:10px; margin-left:auto; font-size:13px; }
.invite { display:flex; gap:8px; }
.label-list { display:grid; gap:8px; margin-bottom:12px; }
.label-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-height:32px; }
.label-row .field { flex:1; min-width:110px; color:color-mix(in srgb, var(--hue) 70%, var(--text)); }
.hue-dots { display:flex; gap:2px; }
.hue-dot { width:22px; height:22px; border-radius:999px; display:grid; place-items:center; }
.hue-dot::before { content:""; width:14px; height:14px; border-radius:999px; background:var(--hue); }
.hue-dot[aria-checked="true"] { box-shadow:inset 0 0 0 2px var(--hue); }
.hue-dot[aria-checked="true"]::before { width:10px; height:10px; }
.import-table { max-height:320px; overflow:auto; }
.import-table table { border-collapse:collapse; width:100%; font-size:13px; }
.import-table th { text-align:left; font:500 12px var(--font); color:var(--text-tertiary); padding:6px 8px 6px 0; border-bottom:1px solid var(--border); }
.import-table td { padding:0 8px 0 0; height:36px; border-bottom:1px solid var(--border); max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.import-table tr.bad td { color:var(--overdue); }
.dialog .ac { position:static; width:auto; margin:12px 0 0; }
.dialog .move-title { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.move-list { display:grid; gap:2px; margin:0 -10px; }
.move-list .mrow { height:40px; }
.move-list .mname, #view-menu .mname { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.move-list .mrow.current { color:var(--text-secondary); cursor:default; }
.move-list .mrow.current:hover { background:none; }
.move-list .mrow .cur, #view-menu .mrow .cur { color:var(--accent); }
#radial { position:fixed; inset:0; z-index:60; pointer-events:none; display:none; }
#radial.on { display:block; }
#radial svg { position:absolute; overflow:visible; }
.radial text { font:500 11px var(--font); fill:var(--text-secondary); text-anchor:middle; }
.radial .seg { fill:var(--surface-raised); stroke:var(--border); }
.radial .shadow { filter:drop-shadow(0 4px 16px rgba(0,0,0,.18)); }
.radial g.open .seg { fill:var(--surface-sunken); } .radial g.open { color:var(--text); } .radial g.open text { fill:var(--text); }
.radial g.current text { font-weight:700; fill:var(--text); } .radial g.current { color:var(--text); }
.radial g.off > .ic, .radial g.off > text { opacity:.4; }
.radial .dot { fill:var(--accent); stroke:var(--surface-raised); stroke-width:2; }
#radial.touch { background:rgba(0,0,0,.16); }
.radial-cap { position:absolute; left:50%; top:calc(16px + env(safe-area-inset-top)); transform:translateX(-50%); height:40px; padding:0 16px; display:flex; align-items:center; font-weight:600; white-space:nowrap; }
.radial-cap.low { top:auto; bottom:calc(24px + env(safe-area-inset-bottom)); }
.radial-cap.danger { color:var(--overdue); }
.radial g.on .seg { fill:var(--accent-subtle); } .radial g.on { color:var(--accent); } .radial g.on text { fill:var(--accent); }
.radial g.danger { color:var(--overdue); } .radial g.danger text { fill:var(--overdue); }
.radial g { color:var(--text-secondary); }
.radial g.empty .seg { fill:var(--surface-raised); }
body.dropping #main { outline:2px dashed var(--accent); outline-offset:-6px; }

/* ───────── Detail ───────── */
#detail { display:none; }
#detail.open { display:block; width:400px; flex:none; background:var(--surface); border-left:1px solid var(--border); position:sticky; top:0; height:100vh; overflow:auto; }
.dhead { display:flex; align-items:center; gap:8px; padding:8px 12px; }
.dws { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--text-secondary); }
.dblock { padding:12px 16px; border-bottom:1px solid var(--border); }
.dblock .k { font:500 12px var(--font); color:var(--text-tertiary); margin-bottom:6px; }
.dtitle { display:flex; align-items:flex-start; gap:4px; padding-left:4px; }
.title-input { flex:1; font:600 20px/1.3 var(--font); color:var(--text); background:none; border:0; resize:none; padding:6px 4px; border-radius:6px; field-sizing:content; min-height:36px; }
.title-input:focus { outline:2px solid var(--accent); }
.sched-btn { display:flex; align-items:center; gap:8px; height:32px; color:var(--text-ui); }
.sched-btn .ic { color:var(--text-secondary); } .sched-btn .more { color:var(--text-tertiary); }
.picker .k { padding:6px 10px 2px; margin:0; }
.dblock .seg { flex-wrap:wrap; }
.dblock .seg button { height:28px; padding:0 10px; }
.order-btns { display:flex; align-items:center; gap:6px; }
.order-btns .btn { height:28px; padding:0 10px; font-size:13px; }
.order-btns .icon-btn { border:1px solid var(--border-strong); border-radius:8px; color:var(--text-ui); }
.danger-zone { margin-top:32px; border-top:1px solid var(--border); border-bottom:0; padding-bottom:24px; }
.danger-zone .btn-text { display:inline-flex; align-items:center; gap:6px; }
.overdue-text { color:var(--overdue); }
.picker { margin-top:8px; padding:6px; background:var(--surface-raised); box-shadow:var(--shadow-float); border-radius:12px; max-width:300px; }
.picker .preset { display:flex; width:100%; height:36px; align-items:center; padding:0 10px; border-radius:6px; text-align:left; }
.picker .preset:hover { background:var(--surface-sunken); }
.picker .preset span { margin-left:auto; font:13px var(--mono); color:var(--text-tertiary); }
.cal { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; padding:8px 4px; border-top:1px solid var(--border); margin-top:6px; text-align:center; font:13px var(--mono); }
.cal .h { grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; font:600 16px var(--font); padding:0 0 6px; }
.cal .wd { font:500 12px var(--font); color:var(--text-tertiary); }
.cal .d { height:32px; display:grid; place-items:center; border-radius:999px; font:13px var(--mono); }
.cal .d:hover { background:var(--surface-sunken); }
.cal .d.today { box-shadow:inset 0 0 0 1px var(--border-strong); }
.cal .d.sel { background:var(--accent); color:var(--on-accent); font-weight:600; }
.time-field { display:flex; align-items:center; gap:8px; padding:6px 6px 2px; font-size:13px; color:var(--text-secondary); }
.time-field .field { width:120px; height:32px; }
.lab-list { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.lab-x { display:inline-flex; align-items:center; gap:2px; }
.lab-x button { color:var(--text-tertiary); display:grid; place-items:center; width:20px; height:20px; border-radius:999px; }
.lab-list .field { width:150px; }
.lab-add { display:contents; }
.notes { min-height:88px; }
.sub-check { display:flex; align-items:center; gap:8px; min-height:32px; }
.sub-check .sq { width:16px; height:16px; border-radius:4px; border:1.5px solid var(--border-strong); flex:none; }
.sub-check.done .sq { background:var(--accent) var(--check-tick) center/11px no-repeat; border-color:var(--accent); }
.sub-check.done .ct { color:var(--text-tertiary); text-decoration:line-through; }
.sub-check .ct { flex:1; color:var(--text); }
.sub-check .handle, .sub-check .x { opacity:0; color:var(--text-tertiary); display:grid; place-items:center; cursor:grab; }
.sub-check:hover .handle, .sub-check:hover .x { opacity:1; }
.sub-check .x { cursor:pointer; width:20px; height:20px; }
.checks + .field { margin-top:6px; }
.link-line { display:flex; gap:6px; align-items:center; }
.rule .sentence { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.choice { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:10px 0; }
.choice button { border:1px solid var(--border-strong); border-radius:8px; padding:8px 10px; font-size:13px; color:var(--text-secondary); text-align:left; }
.choice button b { display:block; color:var(--text-ui); }
.choice button.on { outline:2px solid var(--accent); outline-offset:-1px; }
.text-actions { display:flex; flex-wrap:wrap; gap:6px 16px; font-size:14px; }
.entry { display:flex; align-items:center; gap:6px; margin-top:8px; }
.entry .field { width:auto; flex:1; font-size:12px; padding:0 6px; }
.entry .running { flex:1; font:500 12px var(--font); color:var(--accent); }
.entry .x { color:var(--text-tertiary); display:grid; place-items:center; width:24px; height:24px; }
.comment { display:flex; gap:10px; margin-bottom:12px; }
.cbody { flex:1; min-width:0; }
.chead { display:flex; align-items:baseline; gap:8px; }
.ctime { font-size:13px; color:var(--text-secondary); }
.ctext { color:var(--text); white-space:pre-wrap; overflow-wrap:anywhere; }
/* The comment box follows its text: 2 lines to start, then grows (app.js covers browsers without field-sizing). */
.comment-box { field-sizing:content; min-height:calc(2lh + 16px); max-height:40vh; resize:none; overflow-y:auto; }
.comment-send { display:flex; align-items:center; justify-content:flex-end; gap:12px; margin-top:8px; }
.comment-send .hint { margin:0; }
/* Shortcut hints: ⌘ on Apple devices, Ctrl elsewhere (body.mac is set by app.js) */
.on-mac, body.mac .off-mac { display:none; }
body.mac .on-mac { display:inline; }
.mention { color:var(--accent); }
/* Markdown in comments and notes */
.md { white-space:normal; overflow-wrap:anywhere; line-height:1.5; }
.md > :first-child { margin-top:0; } .md > :last-child { margin-bottom:0; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin:0 0 8px; }
.md ul, .md ol { padding-left:20px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-size:inherit; font-weight:600; margin:12px 0 4px; }
.md blockquote { padding-left:10px; border-left:2px solid var(--border); color:var(--text-secondary); }
.md pre { background:var(--surface-sunken); padding:8px; border-radius:4px; overflow-x:auto; }
.md pre code { padding:0; background:none; word-break:normal; white-space:pre; }
.md a { color:var(--accent); }
.notes-view { color:var(--text); cursor:text; min-height:24px; }

/* ───────── Statistics ───────── */
.stat-block { padding:4px 12px 8px; }
.stat-row { display:flex; align-items:center; gap:10px; height:32px; border-bottom:1px solid var(--border); font-size:14px; }
.stat-row .ic { color:var(--text-secondary); }
.stat-row:not(:has(.ic)) .st-name { color:var(--text); }
.stat-row .st-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stat-row.done .st-name { color:var(--text-tertiary); text-decoration:line-through; }
.stat-row .bar { width:120px; height:8px; background:var(--surface-sunken); border-radius:999px; overflow:hidden; }
.stat-row .bar i { display:block; height:100%; background:var(--accent); }
.stat-row .st-n { font-size:13px; color:var(--text-secondary); white-space:nowrap; }
.stats .sec .seg { margin-left:auto; align-self:center; } .stats .sec .seg button { height:28px; font-weight:400; }
.stats .sec .seg button[aria-pressed="true"] { font-weight:600; }
.stat-row .st-n b { color:var(--text); font-weight:400; }
.stat-row .st-n.w { width:76px; text-align:right; flex:none; } .stat-row .st-n.w2 { width:56px; text-align:right; flex:none; }
.stat-row .bar { flex:none; }
/* the period: its size, and the way to the one before and after */
.st-ctl { display:flex; align-items:center; gap:12px; }
.st-ctl .period { display:flex; align-items:center; gap:2px; }
.st-ctl .pl { font:400 13px/1.4 var(--font); color:var(--text-secondary); white-space:nowrap; padding:0 4px; min-width:14em; text-align:center; } /* one width for every period, so Week/Month/Year and the arrows stay put */
.st-ctl .seg button::after { content:attr(data-l); display:block; height:0; overflow:hidden; visibility:hidden; font-weight:600; } /* room for the pressed weight */
.st-ctl .pl b { color:var(--text-ui); font-weight:600; }
.st-ctl button.pl { height:32px; border-radius:8px; } .st-ctl button.pl:hover { background:var(--surface-sunken); }
.st-ctl .icon-btn:disabled { color:var(--border-strong); opacity:.5; cursor:default; background:none; }
/* while another period loads (app.js): dim what is about to change, after a beat so a quick answer doesn't flicker */
.list.stats { transition:opacity var(--t-layer) var(--ease); }
html.st-busy .list.stats { opacity:.4; cursor:progress; transition-delay:150ms; }
/* figures: a quiet row of numbers */
.stat-figs { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); margin:0 12px; border-bottom:1px solid var(--border); }
.stat-figs .fig { display:grid; align-content:start; gap:2px; padding:8px 0 14px; min-width:0; }
.stat-figs .fig + .fig { padding-left:16px; border-left:1px solid var(--border); }
.stat-figs .fk { font:500 12px/1.35 var(--font); color:var(--text-tertiary); }
.stat-figs .fv { font:400 24px/1.2 var(--mono); font-variant-numeric:tabular-nums; color:var(--text); }
.stat-figs .fv small { font-size:13px; color:var(--text-secondary); }
.stat-figs .fd { font:400 13px/1.4 var(--font); color:var(--text-secondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* the days of a week or a month, the months of a year */
.stat-cal { display:grid; grid-template-columns:repeat(7, minmax(0,1fr)); gap:4px; padding:8px 12px 0; }
.stat-cal.months { grid-template-columns:repeat(6, minmax(0,1fr)); }
.stat-cal .wd { font:500 12px/1.35 var(--font); color:var(--text-tertiary); text-align:center; padding-bottom:2px; }
.stat-cal .d { position:relative; height:60px; border-radius:8px; padding:6px 8px 0; display:flex; flex-direction:column; align-items:flex-start; gap:2px; text-align:left; border:1px solid var(--border); min-width:0; }
.stat-cal button.d:hover { background:var(--surface-sunken); }
.stat-cal .dn { font:400 12px/1 var(--mono); color:var(--text-tertiary); }
.stat-cal .dv { font:400 16px/1.2 var(--mono); font-variant-numeric:tabular-nums; color:var(--text); white-space:nowrap; }
.stat-cal .lvl { position:absolute; left:7px; right:7px; bottom:6px; height:4px; border-radius:999px; background:var(--surface-sunken); overflow:hidden; }
.stat-cal .lvl i { display:block; height:100%; background:var(--accent); border-radius:999px; animation:none; }
.stat-cal .d.out { border-color:transparent; }
.stat-cal .d.future { border-style:dashed; }
.stat-cal .d.today { border-color:var(--border-strong); }
.stat-cal .d.sel, .stat-cal button.d.sel:hover { background:var(--accent-subtle); border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.stat-cal .d.sel .dn { color:var(--accent); font-weight:600; }
.stat-cal .d.sel .lvl { background:color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.stat-cal .d.none .dv { color:var(--text-tertiary); }
.stat-recap { display:flex; flex-wrap:wrap; align-items:center; gap:4px 16px; padding:10px 12px 0; font:400 13px/1.4 var(--font); color:var(--text-secondary); }
.stat-recap b { color:var(--text); font-weight:600; }
.stat-none { margin:0; padding:10px 12px 0; font-size:14px; color:var(--text-tertiary); }
.stats .done-wrap { margin-top:4px; }
/* column charts: weeks, months, weekdays */
.stat-chart { padding:28px 12px 4px; }
.stat-chart .cols { position:relative; display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:6px; align-items:end; height:120px;
  background:linear-gradient(var(--border), var(--border)) 0 0 / 100% 1px no-repeat, linear-gradient(var(--border), var(--border)) 0 50% / 100% 1px no-repeat; }
.stat-chart .col { display:flex; align-items:flex-end; justify-content:center; gap:2px; height:100%; border-radius:6px 6px 0 0; }
.stat-chart .col.on { background:var(--surface-sunken); }
.stat-chart .col i { display:block; width:38%; max-width:14px; border-radius:3px 3px 0 0; background:var(--accent); }
.stat-chart .col i.add { background:color-mix(in srgb, var(--text-tertiary) 40%, var(--surface-sunken)); }
.stat-chart .col.on i.add { background:color-mix(in srgb, var(--text-tertiary) 55%, var(--surface-sunken)); }
.stat-chart .col i.solo { width:56%; max-width:24px; }
.stat-chart .ymax { position:absolute; right:0; top:-16px; font:400 12px/1 var(--mono); color:var(--text-tertiary); }
.stat-chart .chart-empty { position:absolute; inset:0 20% 0 0; display:grid; place-items:center; text-align:center; font:400 13px/1.4 var(--font); color:var(--text-tertiary); padding:0 24px; }
.stat-chart .xl { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:6px; padding-top:6px; border-top:1px solid var(--border-strong); }
.stat-chart .xl > span { font:500 12px/1.35 var(--font); color:var(--text-tertiary); text-align:center; white-space:nowrap; }
.stat-chart .xl > span.on { color:var(--text-ui); font-weight:600; }
.stat-chart .xl .ph { display:none; }
.stat-chart .keys { display:flex; flex-wrap:wrap; gap:6px 16px; padding:10px 0 0; font:500 12px/1.35 var(--font); color:var(--text-secondary); }
.stat-chart .sw { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; vertical-align:-1px; background:var(--accent); }
.stat-chart .sw.add { background:color-mix(in srgb, var(--text-tertiary) 40%, var(--surface-sunken)); }
/* small marks in a row: twelve weeks of a workspace, the days a recurring to-do came round */
.spark { display:inline-flex; align-items:flex-end; gap:1px; width:72px; height:16px; flex:none; }
.spark i { flex:1; min-height:1px; border-radius:1px; background:var(--accent); }
.spark i.z { height:1px; background:var(--border-strong); }
.hits { display:inline-flex; gap:4px; flex:none; }
.hits i { width:10px; height:10px; border-radius:999px; border:1.5px solid var(--border-strong); }
.hits i.done { background:var(--accent); border-color:var(--accent); }
.hits i.due { border-style:dashed; }
.stat-note { display:flex; align-items:flex-start; gap:8px; margin:20px 12px 0; font:400 13px/1.4 var(--font); color:var(--text-tertiary); }
.stat-note .ic { flex:none; margin-top:1px; }
.stat-sub { font:500 12px var(--font); color:var(--text-tertiary); padding:12px 0 4px; }

/* ───────── Sign-in ───────── */
.signin-body { display:grid; place-items:center; min-height:100vh; padding:16px; }
.signin { width:360px; max-width:100%; display:grid; gap:12px; }
.signin h1 { font:600 20px/1.3 var(--font); margin:0; }
.signin .tagline { margin:0 0 12px; color:var(--text-secondary); }
.signin form { display:grid; gap:12px; }
.signin p { margin:0; color:var(--text-secondary); }
.signin .error { color:var(--overdue); }
.signin .btn { height:36px; }
/* Continue with Google / Apple: secondary buttons carrying the provider's mark */
a.btn { text-decoration:none; }
.logo { flex:none; }
.code { letter-spacing:.5em; text-align:center; font:20px var(--mono) !important; height:44px; }

/* ───────── Corner add, drawer scrim ───────── */
.corner-add, .corner-nav, .drawer-scrim, .phone-only { display:none; }

/* ───────── Phone ───────── */
/* ───────── Attachments (Features › Attachments) ───────── */
/* The detail's block: tiles in three columns, 4:3, the file name under each. */
.att-grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:8px; }
.att-grid:empty { display:none; }
.att { display:grid; gap:4px; min-width:0; text-align:left; text-decoration:none; color:inherit; border-radius:8px; }
.att .th { position:relative; display:block; aspect-ratio:4 / 3; border-radius:8px; overflow:hidden; background:var(--surface-sunken); box-shadow:inset 0 0 0 1px var(--border); }
.att .th img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.att .th.tall img { object-position:top; } /* a phone screen: its top, where the title is */
.att:hover .th { box-shadow:inset 0 0 0 1px var(--border-strong); }
.att .fn { font:500 12px/1.35 var(--font); color:var(--text-tertiary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.att.up .th img { opacity:.4; }
.att.up .fn { color:var(--text-secondary); }
.att .pbar { position:absolute; left:8px; right:8px; bottom:8px; height:4px; border-radius:999px; background:var(--surface-raised); overflow:hidden; }
.att .pbar i { display:block; width:0; height:100%; background:var(--accent); transition:width var(--t-state) linear; }
.att .ft, .viewer .strip .ft { position:absolute; inset:0; display:grid; place-items:center; align-content:center; gap:4px; color:var(--text-secondary); font:500 12px/1.35 var(--font); }
.att .ft .mono { color:var(--text-tertiary); }
.add-line { display:flex; align-items:center; gap:12px; margin-top:8px; font-size:14px; }
.att-grid:empty + .add-line { margin-top:0; }
.add-line .btn-text { display:inline-flex; align-items:center; gap:6px; min-height:32px; }
.add-line .hint { margin:0; }
.row .meta .att-n { display:inline-flex; align-items:center; gap:3px; color:var(--text-secondary); font:13px var(--mono); font-variant-numeric:tabular-nums; }

/* Dropping files: the app's file-drop outline (body.dropping #main) on the panel under the
   pointer, or a row lit like a selection with an accent ring; a caption follows the pointer. */
#detail.dropping { outline:2px dashed var(--accent); outline-offset:-6px; }
.row.drop-on > .ri { background:var(--accent-subtle); box-shadow:inset 0 0 0 2px var(--accent); }
.drop-cap { position:fixed; z-index:70; display:inline-flex; align-items:center; gap:8px; height:40px; padding:0 14px; font-weight:600; color:var(--text-ui); white-space:nowrap; pointer-events:none; }
.drop-cap .ic { color:var(--accent); }

/* The viewer: full screen above everything, the picture on the sunken surface. */
body.viewing { overflow:hidden; }
body.viewing #toast { z-index:66; bottom:124px; } /* Deleted, with Undo, shows above the viewer's strip */
.viewer { position:fixed; inset:0; z-index:65; display:grid; grid-template-rows:auto minmax(0, 1fr) auto; background:var(--surface-sunken); color:var(--text-ui); }
.viewer .vbar { display:flex; align-items:center; gap:8px; min-height:56px; padding:8px 12px 8px 16px; padding-top:max(8px, env(safe-area-inset-top)); background:var(--canvas); border-bottom:1px solid var(--border); }
.viewer .vname { display:grid; min-width:0; }
.viewer .vname b { font:600 16px/1.4 var(--font); color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.viewer .vname span { font:400 13px/1.4 var(--font); color:var(--text-secondary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.viewer .vpos { font:13px var(--mono); font-variant-numeric:tabular-nums; color:var(--text-secondary); white-space:nowrap; }
.viewer .icon-btn.danger { color:var(--overdue); }
.viewer .v-stage { position:relative; display:grid; place-items:center; min-height:0; padding:24px 96px; touch-action:pan-y pinch-zoom; }
.viewer .v-body { display:contents; }
.viewer .pic { position:absolute; inset:24px 96px; margin:auto; max-width:calc(100% - 192px); max-height:calc(100% - 48px); border-radius:4px; box-shadow:var(--shadow-float); background:var(--surface); }
.viewer .vfile { display:grid; justify-items:center; gap:6px; padding:24px 32px; min-width:240px; max-width:100%; text-align:center; }
.viewer .vfile .ic { color:var(--text-secondary); }
.viewer .vfile b { color:var(--text); font-weight:600; overflow-wrap:anywhere; }
.viewer .vfile span { font-size:13px; color:var(--text-secondary); }
.viewer .vfile .btn { margin-top:8px; }
.viewer .navb { position:absolute; top:50%; width:44px; height:44px; margin-top:-22px; border-radius:999px; display:grid; place-items:center; background:var(--surface-raised); color:var(--text-ui); box-shadow:var(--shadow-float); }
.viewer .v-prev { left:32px; } .viewer .v-next { right:32px; }
.viewer .navb[hidden] { display:none; }
.viewer .strip { display:flex; justify-content:center; align-items:center; gap:8px; padding:12px 16px; overflow-x:auto; background:var(--canvas); border-top:1px solid var(--border); }
.viewer .strip[hidden] { display:none; }
.viewer .strip .th { position:relative; display:block; width:80px; aspect-ratio:4 / 3; border-radius:6px; overflow:hidden; background:var(--surface-sunken); box-shadow:inset 0 0 0 1px var(--border); flex:none; }
.viewer .strip .th img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.viewer .strip .th.on { outline:2px solid var(--accent); outline-offset:2px; }
.viewer .vacts { display:none; }

@media (max-width: 760px) {
  .add-line .hint { display:none; }
  .att-grid { gap:12px 8px; }
  .viewer .vbar { padding:8px 8px 8px 4px; padding-top:max(8px, env(safe-area-inset-top)); }
  .viewer .vbar .icon-btn { width:44px; height:44px; }
  .viewer .vbar .v-dl, .viewer .vbar .v-open, .viewer .vbar .v-del { display:none; }
  .viewer .vpos { padding-right:8px; }
  .viewer .v-stage { padding:0; }
  .viewer .pic { inset:0; max-width:100%; max-height:100%; border-radius:0; box-shadow:none; }
  body.viewing #toast { bottom:calc(172px + env(safe-area-inset-bottom)); }
  .viewer .navb { display:none; }
  .viewer .strip { justify-content:flex-start; border-top:0; padding:12px 16px 8px; }
  .viewer .strip .th { width:64px; }
  .viewer .vacts { display:flex; justify-content:space-around; align-items:center; padding:4px 8px calc(16px + env(safe-area-inset-bottom)); background:var(--canvas); }
  .viewer .vacts a, .viewer .vacts button { display:grid; justify-items:center; gap:2px; min-width:72px; min-height:52px; padding:4px 0; font:500 12px/1.35 var(--font); color:var(--text-ui); text-decoration:none; }
  .viewer .vacts .ic { color:var(--text-secondary); }
  .viewer .vacts .danger, .viewer .vacts .danger .ic { color:var(--overdue); }
}

@media (max-width: 760px) {
  .shell { display:block; }
  #sidebar { position:fixed; z-index:45; left:0; top:0; bottom:0; width:min(85vw, 300px); height:auto; transform:translateX(-100%); transition:transform var(--t-layer) var(--ease); }
  #sidebar .srow { height:44px; }
  #sidebar .srow .key { display:none; }
  body.drawer #sidebar { transform:none; }
  .icon-btn.sb-close { display:grid; }
  body.drawer .drawer-scrim { display:block; position:fixed; inset:0; z-index:44; background:rgba(0,0,0,.32); }
  .pane { padding:0 0 132px; }
  .icon-btn.menu-btn { display:grid; margin-left:-2px; }
  .phone-only { display:revert; }
  .no-phone { display:none; }  /* keyboard-only hints: a phone has no ⌘, Ctrl or Alt */
  /* navigation lives in the bottom-left corner; the profile and the settings behind the picture, top left */
  #sidebar .foot { display:none; }
  .corner-nav { display:block; position:fixed; left:0; bottom:0; z-index:41; width:96px; height:96px; border-radius:0 96px 0 0; background:var(--surface-raised); color:var(--text-ui); box-shadow:var(--shadow-float); }
  .corner-nav .ic { position:absolute; left:28px; bottom:28px; }
  body.sheet .corner-nav, body.drawer .corner-nav, body:has(#detail.open) .corner-nav { display:none; }
  .title-row { padding:6px 12px 0; margin:0 0 4px; min-height:52px; position:sticky; top:0; z-index:5; background:var(--canvas); }
  .view-title { margin-left:0; }
  .title-row .ws-ic { margin-left:0; }
  .chips { padding:4px 16px 12px; }
  button.label.chip { height:44px; padding:0 14px; }
  button.label.chip .chip-x { display:none; }
  .sec { top:52px; height:40px; padding:14px 16px 0; }

  /* composer becomes a sheet docked above the keyboard */
  #top { display:none; position:fixed; left:0; right:0; bottom:var(--kb, 0px); top:auto; z-index:42; padding:8px 12px calc(12px + env(safe-area-inset-bottom));
    background:var(--surface-raised); border-radius:12px 12px 0 0; box-shadow:var(--shadow-float); max-width:none; }
  body.sheet #top { display:flex; flex-direction:column-reverse; }
  #top .cwrap { display:flex; flex-direction:column-reverse; }
  .acc { display:flex; gap:16px; overflow-x:auto; padding:6px 4px 10px; font-size:14px; white-space:nowrap; scrollbar-width:none; }
  .acc button { color:var(--accent); height:32px; }
  .composer { height:44px; border:0; background:none; padding:0; gap:8px; }
  .composer:focus-within { outline:0; }
  .composer .cfield { background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; padding:0 10px; }
  .composer .cfield:focus-within { outline:2px solid var(--accent); outline-offset:-1px; }
  .composer input, .composer .hl { left:10px; right:10px; width:auto; line-height:42px; font-size:16px; }
  .composer .sheet-close, .composer .send { display:grid; width:44px; height:44px; }
  .composer .send { background:var(--accent); color:var(--on-accent); }
  .tips { display:none; }
  #under .tips:has(span:first-child:not(:has(.mono))) { display:flex; }
  .ac { position:static; width:auto; margin:0 0 6px; }
  /* the held filter: one tap shows the similar to-dos, floating centred just above the sheet */
  #under .similar { position:absolute; bottom:calc(100% + 12px); left:50%; transform:translateX(-50%); height:40px; border-radius:999px; }
  .corner-add { display:block; position:fixed; right:0; bottom:0; z-index:41; width:96px; height:96px; border-radius:96px 0 0 0; background:var(--accent); color:var(--on-accent); box-shadow:var(--shadow-float); }
  .corner-add .ic { position:absolute; right:28px; bottom:28px; }
  body.sheet .corner-add, body.drawer .corner-add, body:has(#detail.open) .corner-add { display:none; }
  #toast { bottom:108px; left:16px; right:16px; transform:none; justify-items:center; }
  #clock { right:16px; bottom:108px; }
  body.sheet #toast { bottom:140px; }

  /* one line: the title level with the checkbox, everything about the to-do at the right */
  .row > .ri { height:auto; min-height:48px; padding:0 16px 0 3px; border-radius:0; }
  .row .check { width:48px; height:48px; }
  .row .check::before { width:22px; height:22px; }
  .row .main { order:1; flex:1 0 45%; }
  .row .meta { order:2; margin-left:8px; gap:6px; flex:0 1 auto; min-width:0; overflow:hidden; }
  .row .meta .label:not(.ws):nth-of-type(n+2) { display:none; }
  .row .meta .label.ws { padding:0; background:none; color:var(--text-tertiary); }
  .row .clk { order:3; display:flex; color:var(--accent); margin-left:8px; }
  .row .time { order:4; width:auto; margin-left:8px; text-align:right; }
  .row .time:empty { display:none; }
  .row .margin-clock, .row .chev { display:none !important; }
  .row:hover > .ri { background:transparent; }
  .row .handle { margin-left:auto; padding:12px; }
  /* a full thumb-sized target at the right edge, never clipped with the meta strip */
  .row .row-link { order:5; width:44px; height:44px; margin:0 -12px 0 0; }

  #detail.open { position:fixed; inset:0; top:0; z-index:43; width:auto; height:auto; border:0; border-radius:12px 12px 0 0; }
  .list.settings .toggle-row { padding:8px 16px; }
  .page-end, #pk-error { padding:0 16px; }
  .toggle-row .btn-text.lead { min-height:44px; }
  #sidebar .profile .who { height:56px; } .order-btns .btn, .dblock .seg button { height:36px; } .order-btns .icon-btn { width:36px; height:36px; }
  .stat-block { padding:4px 16px 8px; }
  .stat-row { height:44px; font-size:15px; }
  .stat-row .spark, .stat-row .st-n.every { display:none; }
  .stat-row .bar { width:72px; }
  .title-row:has(.st-ctl) { flex-wrap:wrap; }
  .st-ctl { flex:1 0 100%; justify-content:space-between; padding:0 0 8px 4px; }
  .st-ctl .seg button { height:36px; padding:0 10px; } .st-ctl .pr { display:none; } .st-ctl .pl { min-width:0; } .st-ctl .icon-btn { width:44px; height:44px; } .st-ctl button.pl { height:44px; }
  .stat-figs { grid-template-columns:repeat(2, minmax(0,1fr)); margin:0 16px; }
  .stat-figs .fig:nth-child(3) { padding-left:0; border-left:0; }
  .stat-figs .fig:nth-child(-n+2) { border-bottom:1px solid var(--border); }
  .stat-figs .fig:nth-child(n+3) { padding-top:12px; }
  .stat-cal { padding:8px 16px 0; gap:3px; }
  .stat-cal.months { grid-template-columns:repeat(4, minmax(0,1fr)); }
  .stat-cal .d { height:52px; padding:5px 6px 0; }
  .stat-cal .dv { font-size:14px; }
  .stat-cal .lvl { left:5px; right:5px; bottom:5px; }
  .stat-recap, .stat-none { padding:10px 16px 0; }
  .stat-chart { padding:28px 16px 4px; }
  .stat-chart .xl .dk, .stat-chart .xl .skip { display:none; } .stat-chart .xl .ph { display:inline; }
  .stat-note { margin:20px 16px 0; }
  .stats .show-done { min-height:44px; padding:0 16px; }
  .empty { padding:56px 16px 24px; }
  .empty p { font-size:24px; }
  .nomatch { padding:12px 16px; }
  .dialog { width:100%; }
  .scrim { align-items:end; padding:0; }
  .scrim .dialog { border-radius:12px 12px 0 0; padding-bottom:calc(20px + env(safe-area-inset-bottom)); }
  .move-list .mrow { height:48px; font-size:16px; }
  /* taller rows: the workspace menu opens under the title row, so let it scroll on short screens */
  .menu { max-height:calc(100dvh - 72px); overflow-y:auto; }
  .menu .mrow { height:44px; font-size:16px; }
  .btn { height:44px; padding:0 18px; }
  .seg button { height:44px; }
}

/* ───────── Voice capture (only with a Claude API key and a browser that recognises speech) ───────── */
.composer .mic, .corner-add .vmic, #voice { display:none; }
.vcard { width:100%; max-width:420px; padding:10px 12px 14px 16px; display:grid; gap:6px; text-align:left; color:var(--text-ui); font-size:13px; }
.vc-head { display:flex; align-items:center; gap:6px; min-height:32px; font:500 12px/1.35 var(--font); color:var(--accent); }
.vcard.reading .vc-head { color:var(--text-tertiary); }
.vc-acts { margin-left:auto; display:flex; gap:12px; }
.vc-acts a, .vc-acts button { display:inline-flex; align-items:center; min-height:32px; padding:0 4px; color:var(--accent); font:600 14px var(--font); text-decoration:none; }
.vc-title { margin:0; font:600 16px/1.4 var(--font); color:var(--text); overflow-wrap:anywhere; }
.vc-said { margin:0; font-size:15px; line-height:1.45; color:var(--text-secondary); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.vc-facts { display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; color:var(--text-secondary); }
.vc-facts .f { display:inline-flex; align-items:center; gap:5px; }
.vc-facts .ic, .vc-notes .ic { color:var(--text-secondary); }
.vc-notes { display:flex; gap:6px; align-items:flex-start; color:var(--text-secondary); }
.vc-notes .ic { margin-top:1px; }
.vc-notes p { margin:0; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.vc-cap { margin:0; font:500 12px/1.35 var(--font); color:var(--text-tertiary); }
.dots { display:inline-flex; gap:3px; }
.dots i { width:5px; height:5px; border-radius:999px; background:currentColor; animation:yat-dots 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay:.15s; } .dots i:nth-child(3) { animation-delay:.3s; }
@keyframes yat-dots { 0%, 100% { opacity:.3; } 50% { opacity:1; } }
.lvl { display:inline-flex; align-items:center; gap:2px; height:16px; }
.lvl i { width:3px; height:16px; border-radius:2px; background:var(--accent); animation:yat-lvl .9s var(--ease) infinite; }
.lvl i:nth-child(2) { animation-delay:-.2s; } .lvl i:nth-child(3) { animation-delay:-.45s; } .lvl i:nth-child(4) { animation-delay:-.65s; } .lvl i:nth-child(5) { animation-delay:-.3s; }
@keyframes yat-lvl { 0%, 100% { transform:scaleY(.35); } 50% { transform:scaleY(1); } }
.v-head { display:flex; align-items:center; gap:8px; font:500 12px/1.35 var(--font); color:var(--accent); }
.v-head .mono { font-size:12px; color:var(--text-secondary); }
.v-text { margin:0; max-height:40vh; overflow:auto; font-size:16px; line-height:1.45; color:var(--text); overflow-wrap:anywhere; }
.v-int { color:var(--text-tertiary); }
/* the composer's mic, while the field is empty */
body.can-voice .composer .mic { display:grid; width:28px; height:28px; }
body.can-voice .composer:not(:has(#q:placeholder-shown)) .mic { display:none; }
.composer .mic.on { color:var(--accent); background:var(--accent-subtle); } /* listening, hovered or not */
/* desktop: click the mic to listen; the live card floats under the composer (app.js places it) */
#voice.desk { display:block; }
#voice.desk .v-live { position:fixed; z-index:42; padding:12px 12px 12px 16px; display:grid; gap:8px; }
#voice.desk .v-text { max-height:30vh; }
.v-foot { display:flex; align-items:center; gap:8px; }
.v-foot .vc-cap { margin-right:auto; }
@media (min-width: 761px) {
  #toast .vcard { width:420px; }
}

@media (max-width: 760px) {
  /* the sheet's mic sits in the send slot while the field is empty */
  body.can-voice .composer .mic { display:grid; width:44px; height:44px; background:var(--accent); color:var(--on-accent); }
  body.can-voice .composer:has(#q:placeholder-shown) .send { display:none; }
  body.can-voice .corner-add { -webkit-touch-callout:none; -webkit-user-select:none; user-select:none; touch-action:none; }
  .corner-add { transition:width var(--t-layer) var(--ease), height var(--t-layer) var(--ease), border-radius var(--t-layer) var(--ease); }
  /* listening: the corner add grows and turns into the microphone; the corner menu becomes the bin */
  body.voicing .corner-add { display:block; z-index:43; width:176px; height:176px; border-radius:176px 0 0 0; }
  body.voicing .corner-add > .ic:not(.vmic) { display:none; }
  body.voicing .corner-add .vmic { display:block; right:44px; bottom:44px; }
  body.voicing:has(#voice.arm) .corner-add { width:96px; height:96px; border-radius:96px 0 0 0; }
  body.voicing:has(#voice.arm) .corner-add .vmic { right:28px; bottom:28px; }
  body.voicing .corner-nav, body.voicing #toast, body.voicing #clock { display:none; }
  #voice.on { display:block; }
  #voice .v-dim { position:fixed; inset:0; z-index:40; background:rgba(0, 0, 0, .16); }
  #voice .v-cap { position:fixed; left:50%; top:calc(16px + env(safe-area-inset-top)); transform:translateX(-50%); z-index:42; height:40px; padding:0 16px; display:flex; align-items:center; font-weight:600; white-space:nowrap; color:var(--text-ui); }
  #voice.arm .v-cap { color:var(--overdue); }
  #voice .v-live { position:fixed; left:16px; right:16px; bottom:calc(256px + env(safe-area-inset-bottom)); z-index:42; padding:12px 16px 16px; display:grid; gap:8px; }
  #voice.arm .v-head { color:var(--text-tertiary); }
  #voice.arm .lvl i { animation:none; background:var(--text-tertiary); }
  #voice.arm .v-text { color:var(--text-tertiary); text-decoration:line-through; }
  #voice .v-ring { position:fixed; right:0; bottom:0; z-index:41; width:228px; height:228px; border-radius:228px 0 0 0; background:var(--accent-subtle); pointer-events:none; }
  #voice.arm .v-ring { display:none; }
  #voice .v-cancel { position:fixed; left:0; bottom:0; z-index:42; width:96px; height:96px; border-radius:0 96px 0 0; background:var(--surface-raised); color:var(--overdue); box-shadow:var(--shadow-float); transition:width var(--t-layer) var(--ease), height var(--t-layer) var(--ease), border-radius var(--t-layer) var(--ease); }
  #voice .v-cancel .ic { position:absolute; left:28px; bottom:28px; width:22px; height:22px; }
  #voice.arm .v-cancel { width:176px; height:176px; border-radius:0 176px 0 0; background:color-mix(in srgb, var(--overdue) 14%, var(--surface-raised)); }
  #voice.arm .v-cancel .ic { left:44px; bottom:44px; width:32px; height:32px; }
  #voice .v-hint { position:fixed; left:16px; bottom:calc(112px + env(safe-area-inset-bottom)); z-index:42; height:28px; padding:0 10px; display:flex; align-items:center; font:500 12px var(--font); color:var(--text-ui); }
  #voice.arm .v-hint { left:auto; right:16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition:none !important; animation:none !important; scroll-behavior:auto !important; }
}
