/* addme UI system (design §22). One narrow, phone-first column. No title: every distractor is a loss. */
:root {
  --bg: #EEF1F5;
  --surface: #FFFFFF;
  --ink: #161A21;
  --muted: #5B6474;
  --line: #D6DBE3;
  --accent: #2E48D4;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E8FC;
  --mark: #FFE37A;
  --ok: #1D7A4C;
  --ok-soft: #DDF1E6;
  --warn: #9A5300;
  --bench: #E4E8EE;
  --shadow: 0 10px 30px rgba(22, 26, 33, .16);
  --f-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1116; --surface: #171B23; --ink: #E7EAF0; --muted: #98A1B1; --line: #2A303C;
    --accent: #8FA2FF; --accent-ink: #0E1116; --accent-soft: #232B4A; --mark: #5E4F12;
    --ok: #62C894; --ok-soft: #173326; --warn: #E3A458; --bench: #12161D; --shadow: 0 10px 30px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1116; --surface: #171B23; --ink: #E7EAF0; --muted: #98A1B1; --line: #2A303C;
  --accent: #8FA2FF; --accent-ink: #0E1116; --accent-soft: #232B4A; --mark: #5E4F12;
  --ok: #62C894; --ok-soft: #173326; --warn: #E3A458; --bench: #12161D; --shadow: 0 10px 30px rgba(0,0,0,.55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* else .drawer/.ask display:flex overrides the hidden attribute */
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 600px; margin: 0 auto; padding: 18px 16px 140px; display: flex; flex-direction: column; gap: 14px; }
.seg { display: inline-flex; background: var(--bench); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 5px 14px; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* capture */
.field { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; }
.field:focus-within { border-color: var(--accent); }
#cap { display: block; width: 100%; min-height: 58px; max-height: 40vh; resize: none; border: 0; outline: none; background: transparent; padding: 13px 14px; font-size: 17px; line-height: 1.45; }
.tbtns { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.tbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px; text-align: left; min-width: 0; font-size: 13.5px; line-height: 1.3; display: flex; gap: 6px; align-items: center; }
.tbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tbtn .ret { flex: none; font: 500 12px/1 var(--f-mono); color: var(--accent); }
.tbtn.predicted { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.tbtn:disabled { opacity: .4; cursor: default; }

.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 11px; font-size: 13px; line-height: 1.5; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); }
.chip.on.guess { background: transparent; border-style: dashed; }
.chip.dim { color: var(--muted); }
.chip.done { background: var(--ok-soft); border-color: var(--ok); }
.chip.add { border-style: dashed; color: var(--muted); }
.chip.solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.receipt { display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 0; }
.fact { font-size: 14px; padding: 2px 0 2px 10px; border-left: 3px solid var(--mark); }
.fact .who { font-weight: 600; }
.when { color: var(--muted); }
.mini { border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 13px; background: var(--surface); width: 13em; max-width: 60vw; }

.ico.chk .tick { opacity: 0; transition: opacity .12s; }
.ico.chk:hover .tick, .ico.chk:focus-visible .tick { opacity: .55; }
.ico.chk:hover { background: var(--bench); }
.lnk { border: 0; background: none; padding: 0 0 0 6px; color: var(--accent); font-size: 13px; }
.lnk:hover { text-decoration: underline; }
.pinbtn { flex: none; border: 0; background: none; padding: 4px; margin: -4px -4px -4px 0; color: var(--muted); border-radius: 8px; align-self: center; }
.pinbtn svg { display: block; width: 17px; height: 17px; }
.pinbtn:hover { color: var(--accent); background: var(--bench); }
.pinbtn.on { color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.card-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; margin-bottom: 6px; }
.card-h b { font: 600 16px/1.2 var(--f-display); }
.k { font: 500 10.5px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.card li { font-size: 14px; }
.card li .when { font-size: 12.5px; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.q { color: var(--warn); font-weight: 700; }

/* threads view */
.filter { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.tlist { display: flex; flex-direction: column; gap: 2px; }
.tag { font: 400 12px/1.6 var(--f-mono); padding: 0 8px; border-radius: 999px; background: var(--accent-soft); border: 0; color: var(--ink); }
.period { font: 500 10.5px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 4px 4px; }
.cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow { font: 500 10.5px/1 var(--f-mono); text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.cd.has { color: var(--ink); font-weight: 600; }
.cd.has::after { content: ""; position: absolute; left: 50%; bottom: 16%; height: 4px; transform: translateX(-50%); background: radial-gradient(circle, var(--accent) 2px, transparent 2.5px) 0 0 / 7px 4px repeat-x; }
.cd.d1::after { width: 4px; background-size: 4px 4px; }
.cd.d2::after { width: 11px; }
.cd.d3::after { width: 18px; }
.cd.today { box-shadow: inset 0 0 0 1px var(--line); }
.cd.sel { background: var(--accent-soft); color: var(--ink); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }
.ent-h { font: 700 26px/1.15 var(--f-display); letter-spacing: -.015em; margin: 8px 0 2px; }
.esec { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.esec h3 { margin: 0 0 2px; font: 500 10.5px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.erow { display: flex; flex-direction: column; gap: 2px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.etxt { border: 0; background: none; padding: 0; text-align: left; font-size: 15px; }
.etxt:hover { color: var(--accent); }
.emeta { display: flex; gap: 10px; align-items: center; font: 400 12px/1.4 var(--f-mono); color: var(--muted); }
.info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14.5px; }
.info dt { color: var(--muted); font-size: 13px; }
.info dd { margin: 0; overflow-wrap: anywhere; }
.fld { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); }
.fld input { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: var(--surface); font-size: 15px; color: var(--ink); }
.picker { display: flex; flex-direction: column; gap: 8px; }
.pick-in { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface); font-size: 15px; }
.pick-in:focus { border-color: var(--accent); outline: none; }
.filt { margin: 2px 0 8px; }
.corow { display: flex; flex-direction: column; gap: 5px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.coname { border: 0; background: none; padding: 0; text-align: left; font-weight: 600; font-size: 15px; }
.coname:hover { color: var(--accent); }
.exp { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.back { border: 0; background: none; color: var(--accent); padding: 0; font-size: 14px; }
.th-head h2 { font: 700 21px/1.2 var(--f-display); margin: 6px 0 8px; text-wrap: balance; }
.frags { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.frag { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.frag.ret { opacity: .45; }
.frag .txt { font-size: 15.5px; line-height: 1.5; }
.w { border: 0; background: none; padding: 0 1px; border-radius: 4px; font: inherit; line-height: inherit; text-align: left; }
.w:hover { background: var(--bench); }
.w.m { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.w.amb { text-decoration-style: dotted; text-decoration-color: var(--warn); }
.w.sel { background: var(--mark); }
.fmeta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font: 400 12.5px/1.4 var(--f-mono); color: var(--muted); }
.more { border: 0; background: none; color: var(--muted); font: 500 14px/1 var(--f-mono); padding: 2px 6px; margin-left: auto; }
.panel-in { background: var(--bench); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.panel-in textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); resize: vertical; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }

.note { font-size: 12.5px; color: var(--muted); }

/* ---- polish (round 5) ---- */
/* consistency pass (round 13): one input style, one icon-chip style, one "more" link style */
.search, .pick-in, .mini, .fld input, .panel-in textarea {
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 15px; padding: 9px 12px; }
.search:focus, .pick-in:focus, .mini:focus, .fld input:focus, .panel-in textarea:focus { border-color: var(--accent); outline: none; }
.mini { border-radius: 12px; }
.ichip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 8px; }
.ichip svg { width: 15px; height: 15px; flex: none; }
.ichip.dim svg { opacity: .8; }
.chip.done { color: var(--ok); }
.more { border: 0; background: none; padding: 2px 0; color: var(--accent); font-size: 13px; text-align: left; }
.more:hover { text-decoration: underline; }
.sub { display: flex; flex-direction: column; gap: 2px; }
.kbtn { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.kbtn:hover { color: var(--accent); }
.card-h { margin-bottom: 2px; }
.frag .fmeta .chip { padding-top: 2px; padding-bottom: 2px; }
body { font-size: 15.5px; -webkit-font-smoothing: antialiased; }
.wrap { gap: 18px; padding-top: 22px; }
.field { border-radius: 18px; box-shadow: 0 1px 2px rgba(22,26,33,.05), 0 8px 24px -12px rgba(22,26,33,.12); }
#cap { font-size: 17.5px; padding: 15px 16px; }
#cap::placeholder { color: var(--muted); opacity: .7; }
.tbtns { gap: 8px; }
.tbtn { min-height: 52px; padding: 9px 11px; border-radius: 14px; align-items: flex-start; justify-content: space-between; transition: border-color .12s, background .12s; }
.tbtn .lab { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbtn .ret { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); }
.tbtn.predicted { font-weight: 600; }
.chip { padding: 4px 12px; font-size: 13.5px; transition: background .12s, border-color .12s; }
.chips { gap: 7px; }
.receipt { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; gap: 11px; }
.r-k { font: 500 10.5px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); flex: none; }
.iconbtn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 11px 4px 9px; font-size: 13px; color: var(--muted); flex: none; }
.iconbtn svg { width: 15px; height: 15px; }
.iconbtn.on, .iconbtn:hover { border-color: var(--accent); color: var(--ink); }
.fact { border-left-width: 2px; color: var(--ink); line-height: 1.45; }
.ctx { display: flex; flex-direction: column; gap: 2px; border-left: 2px solid var(--mark); padding-left: 10px; }
.ctx-h { font-weight: 600; font-size: 13.5px; }
.ctx-i { border: 0; background: none; padding: 3px 0; text-align: left; display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.ctx-i:hover .ctx-t { color: var(--accent); }
.ctx-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-i .when { font-size: 12px; flex: none; }
.ltag { font: 500 10.5px/1.6 var(--f-mono); padding: 0 6px; border-radius: 5px; background: var(--accent-soft); flex: none; }
.card { border-radius: 16px; padding: 12px 14px; }
.period { padding-top: 20px; }
.th-head h2 { font-size: 23px; letter-spacing: -.01em; }
.h2btn { border: 0; background: none; padding: 0; font: inherit; text-align: left; color: inherit; }
.h2btn .pen { font-size: 14px; color: var(--muted); margin-left: 8px; opacity: 0; transition: opacity .12s; }
.h2btn:hover .pen, .h2btn:focus-visible .pen { opacity: 1; }
@media (hover: none) { .h2btn .pen { opacity: .6; } }
.frag { padding: 12px 0; }
.frag .txt { font-size: 16px; }
.tag { padding: 1px 9px; }

/* app (v1) */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; position: sticky; top: calc(8px + env(safe-area-inset-top, 0px)); z-index: 5; }
.tabs button { padding: 8px 4px; }
.wrap { padding-top: calc(14px + env(safe-area-inset-top, 0px)); padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.more { margin-left: 0; }
.mini.wide { width: 100%; max-width: 100%; font-size: 17px; }
.more.dots { margin-left: auto; color: var(--muted); font: 500 15px/1 var(--f-mono); padding: 2px 6px; }
.frag .fmeta { gap: 6px 8px; }
#below { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
button.more { align-self: flex-start; }
.chips.alias { margin: 6px 0 0; }

/* one control line (search + square icon buttons): same height, border, radius, background */
.srow { display: flex; gap: 8px; margin-bottom: 12px; }
.search { flex: 1; min-width: 0; width: 100%; height: 46px; border-radius: 14px; padding: 0 14px; margin: 0; }
.sq { flex: none; width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.sq:hover, .sq:focus-visible { border-color: var(--accent); }
.sq svg { width: 20px; height: 20px; }
/* calendar: no frame of its own; month line uses the same square buttons */
.cal-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cal-h b { flex: 1; text-align: center; font: 600 15px/1 var(--f-display); text-transform: capitalize; }
.cd { border: 0; background: transparent; border-radius: 10px; height: 40px; font: 400 14px/1 var(--f-body); font-variant-numeric: tabular-nums; color: var(--muted); position: relative; }
.cd.has::after { bottom: 5px; }
.cal-list { margin-top: 8px; }
/* the thread's own field (ADR 0023): the same input style, grows with the text */
.th-add { margin-top: 14px; }
.th-add textarea { display: block; resize: none; min-height: 0; line-height: 1.45; }
.x { border: 0; background: none; color: var(--muted); padding: 0 0 0 6px; font-size: 15px; line-height: 1; }
.x:hover { color: var(--ink); }
.card-x { margin-left: auto; font-size: 20px; padding: 0 2px 0 8px; align-self: center; }

/* ---- the one list row (parts.js row/threadRow, design §22) ----
   name (bold, 2 lines) · a note (muted, 2 lines) · meta line: time left, icons and actions right.
   Hover is the same everywhere: the name turns accent. */
.tlist { display: flex; flex-direction: column; }
.titem { display: flex; flex-direction: column; gap: 4px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.titem:last-child { border-bottom: 0; }
.t-open { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; border: 0; background: none; padding: 0; text-align: left; color: var(--ink); min-width: 0; }
.titem .lab { font-weight: 600; font-size: 15.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color .12s; }
.titem:hover .lab, .t-open:focus-visible .lab { color: var(--accent); }
.titem .last { font-size: 14px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-meta { display: flex; align-items: center; gap: 10px; min-height: 20px; }
.titem .meta { font: 400 12px/1.3 var(--f-mono); color: var(--muted); flex: 1; min-width: 0; }
.t-right { display: flex; align-items: center; gap: 8px; flex: none; }
.t-right .ico { display: block; width: 18px; height: 18px; color: var(--muted); }
.t-right .ico svg { display: block; width: 18px; height: 18px; }
.t-right .ico.done { color: var(--ok); }
/* something open in the thread (ADR 0027): a sign only, closed inside the thread */
.t-right .ico.open { color: var(--accent); }
.card .titem { padding: 9px 0; }
.receipt .titem { padding: 0 0 2px; border: 0; }
.tbtns.wrap { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* the obligation's checkbox in the thread (ADR 0027): ☐ open → ☑ done, tap again to undo */
.chip.close { border-color: var(--accent); color: var(--ink); }
.chip.close svg { color: var(--accent); }
.chip.close.done { border-color: var(--ok); background: var(--ok-soft); }
.chip.close.done svg { color: var(--ok); }
