:root {
  --ink: #172033;
  --ink-2: #4a5568;
  --ink-3: #8792a6;
  --paper: #f1f3f7;
  --sheet: #ffffff;
  --line: #e1e5ec;
  --line-2: #eef1f5;
  --rail: #1c2541;
  --rail-2: #263156;
  --rail-ink: #b9c3dd;
  --accent: #2f5bea;
  --accent-ink: #1f46c8;
  --accent-soft: #e8eefd;
  --flag: #f4b740;
  --flag-soft: #fff5dc;
  --flag-ink: #7a5300;
  --ok: #1f8a5b;
  --ok-soft: #e4f4ec;
  --danger: #c2412d;
  --danger-soft: #fbe9e6;
  --radius: 8px;
  --font: "Commissioner", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); font-weight: 600; letter-spacing: .02em; }

/* ---------- buttons and fields */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--sheet);
  padding: 7px 12px; border-radius: var(--radius); font-weight: 500; font-size: 14px;
}
.btn:hover { border-color: #c9d0dc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--line-2); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: grid; gap: 4px; }
.field label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--sheet);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- sign in and consent */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 42%) 1fr; }
.gate-side {
  background: var(--rail); color: #fff; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between;
}
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.wordmark .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--flag); color: var(--rail); display: grid; place-items: center; font-weight: 700; }
.gate-side h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 18px; max-width: 14ch; font-weight: 700; }
.gate-side p { color: var(--rail-ink); max-width: 38ch; margin: 0; }
.gate-flow { display: grid; gap: 10px; margin-top: 34px; max-width: 360px; }
.gate-flow div { display: flex; gap: 12px; align-items: baseline; color: var(--rail-ink); font-size: 14px; }
.gate-flow b { color: var(--flag); font-weight: 600; min-width: 74px; }
.gate-main { display: grid; place-items: center; padding: 32px 20px; }
.gate-card { width: min(400px, 100%); display: grid; gap: 16px; }
.gate-card h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.gate-card .lead { margin: 0; color: var(--ink-2); }
.gate-card .note { font-size: 13px; color: var(--ink-3); }
.lang { display: flex; gap: 4px; }
.lang button { border: 0; background: transparent; padding: 3px 7px; border-radius: 6px; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.lang button[aria-pressed="true"] { background: var(--line-2); color: var(--ink); }
.gate-side .lang button { color: var(--rail-ink); }
.gate-side .lang button[aria-pressed="true"] { background: var(--rail-2); color: #fff; }
.consent-app { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); }
.consent-app img, .consent-app .ph { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); }
.consent-list { margin: 0; padding-left: 18px; color: var(--ink-2); }
.warn { background: var(--flag-soft); color: var(--flag-ink); padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }

/* ---------- shell: rail | main | side (read left to right: where, what, what I owe) */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr) 340px; height: 100vh; height: 100dvh; }
#rail-wrap { display: contents; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; min-height: 0; }
.rail .wordmark { color: #fff; font-size: 17px; padding: 18px 18px 12px; }
.rail .wordmark .mark { width: 26px; height: 26px; font-size: 14px; }
.rail-mine {
  margin: 0 10px 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid #33406b; background: var(--rail-2); color: #fff; border-radius: 9px; padding: 9px 12px; font-weight: 600; font-size: 14px;
}
.rail-mine:hover { border-color: #4a5a8c; }
.rail-mine[aria-current="page"] { box-shadow: inset 3px 0 0 var(--flag); }
.count { font-size: 11px; background: var(--flag); color: var(--rail); border-radius: 9px; padding: 0 6px; font-weight: 700; line-height: 18px; min-width: 18px; text-align: center; display: inline-block; }
.rail-title { font-size: 12px; color: #7f8bb0; padding: 14px 18px 6px; font-weight: 600; }
.plist { list-style: none; margin: 0; padding: 0 10px 10px; overflow: auto; flex: 1; }
.plist > li > a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--rail-ink); text-decoration: none; font-weight: 500;
}
.plist > li > a:hover { background: var(--rail-2); color: #fff; }
.plist > li > a.cur { color: #fff; font-weight: 600; }
.dot { width: 22px; height: 22px; border-radius: 6px; background: #33406b; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.dot.sm { width: 20px; height: 20px; font-size: 11px; border-radius: 5px; }
.psub { display: grid; gap: 1px; margin: 2px 0 8px 18px; padding-left: 10px; border-left: 1px solid #2f3a62; }
.sub-link {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--rail-ink);
  padding: 6px 8px; border-radius: 7px; font-size: 14px; text-align: left; width: 100%; min-width: 0;
}
.sub-link .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-link:hover { background: var(--rail-2); color: #fff; }
.sub-link[aria-current="page"] { background: var(--rail-2); color: #fff; box-shadow: inset 3px 0 0 var(--flag); }
.sub-link .ico { width: 16px; text-align: center; opacity: .75; font-size: 13px; }
.sub-link .hash { width: 16px; text-align: center; opacity: .6; font-weight: 600; }
.sub-link .aud { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: #9fb0e0; border: 1px solid #3b4878; border-radius: 4px; padding: 0 4px; }
.sub-link .n { font-size: 12px; color: #9fb0e0; }
.sub-link .unread { width: 7px; height: 7px; border-radius: 50%; background: var(--flag); flex: none; }
.sub-link.quiet-link { color: #8c98bd; font-size: 13px; margin-top: 4px; }
.sub-title { display: flex; align-items: center; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7f8bb0; padding: 10px 8px 4px; font-weight: 600; }
.sub-title .plus { border: 0; background: transparent; color: var(--rail-ink); font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.sub-title .plus:hover { background: var(--rail-2); color: #fff; }
.rail-foot { padding: 12px 14px 16px; border-top: 1px solid #2b365d; display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 14px; }
.me small { display: block; color: #7f8bb0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.rail-foot .btn.quiet { color: var(--rail-ink); justify-content: flex-start; padding: 6px 8px; }
.rail-foot .btn.quiet:hover { background: var(--rail-2); color: #fff; }

.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.none { background: var(--line); color: var(--ink-3); }
.avatar.ai { background: var(--accent); border-radius: 9px; }

/* ---------- main column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--sheet); border-right: 1px solid var(--line); }
.main-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); min-height: 60px; }
.main-head .ttl { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.main-head h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-head h1 .hash { color: var(--ink-3); margin-right: 2px; }
.main-head .desc { font-size: 13px; color: var(--ink-3); }
.main-head .spacer, .spacer { flex: 1; }
.aud-pill { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; background: var(--line-2); color: var(--ink-2); }
.aud-pill.shared { background: var(--flag-soft); color: var(--flag-ink); }

.stream { flex: 1; overflow-y: auto; padding: 16px 20px 8px; scroll-behavior: auto; }
.day { text-align: center; margin: 14px 0 10px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.msg { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; }
.msg.cont { padding-top: 1px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg:target, .msg.flash { background: var(--flag-soft); transition: background 1.2s; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-head b { font-weight: 600; }
.msg-head time { font-size: 12px; color: var(--ink-3); }
.msg-head .via { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body .cite, .d-detail .cite { text-decoration: none; background: var(--accent-soft); padding: 0 4px; border-radius: 4px; font-size: 13px; font-weight: 600; }
.msg.ai .msg-body { border-left: 3px solid var(--accent); padding-left: 10px; color: #20283b; }
.msg-reply { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.msg-reply a { color: var(--ink-3); }
.msg > div { position: relative; }
.msg-tools { position: absolute; top: -4px; right: 0; display: none; gap: 2px; background: var(--sheet); border-radius: 6px; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: inline-flex; }
.msg-body.deleted { color: var(--ink-3); font-style: italic; }
.msg.is-hidden { opacity: .55; }
.msg.is-hidden:hover, .msg.is-hidden:focus-within { opacity: .85; }
.hidden-mark { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line, currentColor); border-radius: 4px; padding: 0 5px; }
.msg-body .edited { font-size: 11px; color: var(--ink-3); margin-left: 6px; }
.msg-edit-form { display: grid; gap: 6px; }
@media (hover: none) { .msg-tools { position: static; display: inline-flex; } }

/* items docked under a message */
.flags { display: grid; gap: 6px; margin-top: 6px; }
.flag {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--flag-soft); border-left: 4px solid var(--flag); border-radius: 0 8px 8px 0;
  padding: 7px 10px; font-size: 14px; max-width: 680px;
}
.flag .kind { font-size: 12px; font-weight: 700; color: var(--flag-ink); }
.flag .title { flex: 1; min-width: 160px; text-align: left; }
.flag .meta { font-size: 12px; color: var(--ink-2); }
.flag .act { display: flex; gap: 4px; flex-wrap: wrap; }
.flag.confirmed { background: var(--ok-soft); border-left-color: var(--ok); }
.flag.confirmed .kind { color: var(--ok); }
.linklike { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }
.ok-btn { background: var(--ok); border-color: var(--ok); color: #fff; }
.ok-btn:hover { background: #18734b; }
.objection { flex-basis: 100%; font-size: 13px; color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 4px 8px; margin-top: 4px; }
.mine { font-size: 12px; color: var(--ok); font-weight: 600; align-self: center; }

.composer { border-top: 1px solid var(--line); padding: 12px 20px 16px; }
.composer form { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 200px; min-height: 44px; line-height: 1.45; }
.composer .help { font-size: 12px; color: var(--ink-3); margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.composer .help code { background: var(--accent-soft); color: var(--accent-ink); padding: 0 5px; border-radius: 4px; font-family: inherit; font-weight: 600; }
.banner { margin: 10px 20px 0; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.banner .input { width: auto; flex: 1; min-width: 160px; padding: 6px 9px; }
.empty { color: var(--ink-3); text-align: center; padding: 40px 20px; max-width: 46ch; margin: 0 auto; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty.small { padding: 16px 8px; font-size: 13px; }
.empty.small b { font-size: 14px; }

/* ---------- tracker: toolbar and rows */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--sheet); border-radius: 20px; padding: 3px 11px; font-size: 13px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.chip .n { font-size: 12px; color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .n { color: #c9d1e3; }
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; }
.input.sm, select.input.sm { padding: 5px 8px; font-size: 13px; width: auto; }
.input.search { width: 190px; }
.tlist { flex: 1; overflow-y: auto; padding: 8px 20px 24px; }
.tgroup { margin-top: 14px; }
.tgroup h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0 0 6px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.tgroup h3 .n { color: var(--ink-3); font-weight: 600; }
.tgroup h3 .linklike { text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.trow {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) 64px 150px 180px; gap: 12px; align-items: center;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--sheet); margin-bottom: 6px; cursor: pointer;
}
.trow:hover { border-color: #c9d0dc; box-shadow: 0 1px 3px rgba(23, 32, 51, .06); }
.trow.my-turn { border-color: var(--flag); box-shadow: inset 3px 0 0 var(--flag); }
.trow.mem { grid-template-columns: 14px minmax(0, 1fr) auto; }
.trow.g { grid-template-columns: 20px minmax(0, 1fr) 80px; }
.sdot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink-3); }
.s-proposed .sdot { border-color: var(--flag); border-style: dashed; }
.s-open .sdot { border-color: var(--ink-3); }
.s-doing .sdot { border-color: var(--accent); background: var(--accent-soft); }
.s-review .sdot { border-color: #7a4fd6; background: #efe8fc; }
.s-done .sdot { border-color: var(--ok); background: var(--ok); }
.kdot { width: 10px; height: 10px; border-radius: 3px; background: var(--ink-3); }
.k-decision.kdot, .k-agreement.kdot { background: var(--ok); }
.k-question.kdot { background: var(--accent); }
.k-risk.kdot { background: var(--danger); }
.k-note.kdot { background: #a2601a; }
.tmain { min-width: 0; }
.ttitle { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-done .ttitle { color: var(--ink-3); text-decoration: line-through; }
.tmeta { font-size: 12px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0 6px; margin-top: 1px; }
.tmeta .sep { color: #c4cad6; }
.hint-ai { color: var(--accent-ink); font-weight: 600; }
.tdue { font-size: 12px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.tdue.late, .late { color: var(--danger); font-weight: 600; }
.twho { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.twho span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.twho.none { color: var(--ink-3); font-size: 12px; }
.tact { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- side: what I owe, then the brief */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--paper); overflow-y: auto; }
.side-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-sec:last-child { border-bottom: 0; }
.side-sec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.side-sec h2 .upd { font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--ink-3); font-weight: 500; }
.need-group { margin-bottom: 12px; }
.need-group h4 { font-size: 12px; color: var(--ink-3); margin: 0 0 6px; font-weight: 600; display: flex; gap: 6px; }
.need-group h4 .n { color: var(--ink-3); }
.need { background: var(--sheet); border: 1px solid var(--line); border-left: 3px solid var(--flag); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; display: grid; gap: 4px; }
.need:hover { border-color: #c9d0dc; border-left-color: var(--flag); }
.need .ttitle { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.need .tact { justify-content: flex-start; }
.need .suggest { font-size: 12px; background: var(--accent-soft); padding: 5px 8px; border-radius: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.calm { font-size: 14px; color: var(--ink-3); margin: 0 0 6px; }
.mine-line { border: 1px dashed #c9d0dc; background: var(--sheet); border-radius: 8px; padding: 7px 10px; width: 100%; text-align: left; font-size: 13px; color: var(--ink-2); }
.mine-line:hover { border-color: var(--accent); color: var(--ink); }
.more { font-size: 12px; color: var(--accent-ink); }
.brief { background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 14px; }
.brief h2 { font-size: 14px; margin: 14px 0 4px; letter-spacing: -.005em; text-transform: none; color: var(--ink); }
.brief h2:first-child { margin-top: 0; }
.brief p { margin: 0 0 8px; }
.brief ul { margin: 0 0 8px; padding-left: 18px; }
.brief li { margin: 2px 0; }

/* ---------- settings */
.settings { flex: 1; overflow-y: auto; padding: 18px 20px 28px; display: grid; gap: 14px; align-content: start; max-width: 760px; }
.people .person { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.people .person:last-child { border-bottom: 0; }
.people .who { flex: 1; min-width: 0; }
.people .who small { display: block; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .who .hash { color: var(--ink-3); margin-right: 2px; }
.people .person > .switch, .people .person > .btn, .people .person > .role { flex: none; }
.ch-rename { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.role { font-size: 12px; color: var(--ink-2); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.block { background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 10px; }
.block > * { min-width: 0; }
.block h3 { margin: 0; font-size: 14px; }
.block p { margin: 0; font-size: 14px; color: var(--ink-2); }
.copyline { display: flex; gap: 6px; }
.copyline .input { font-size: 13px; }
.steps { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); display: grid; gap: 4px; }
.status-on { color: var(--ok); font-weight: 600; }
.status-off { color: var(--danger); font-weight: 600; }

/* ---------- drawers: item card, private ask, forms */
.drawer-back { position: fixed; inset: 0; background: rgba(23, 32, 51, .28); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: var(--sheet); z-index: 41; display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(23, 32, 51, .16); }
.drawer header { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: 16px; margin: 0; flex: 1; }
.drawer .body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; display: grid; gap: 14px; align-content: start; }
.drawer .qa { display: grid; gap: 6px; }
.drawer .q { font-weight: 600; }
.drawer .a { white-space: pre-wrap; border-left: 3px solid var(--accent); padding-left: 10px; }
.drawer > form { padding: 12px 18px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.drawer .note { font-size: 12px; color: var(--ink-3); margin: 0; }
.drawer .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radios { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.radios legend { font-size: 13px; color: var(--ink-2); font-weight: 500; margin-bottom: 4px; padding: 0; }
.radios label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; cursor: pointer; }
.radios label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radios small { display: block; color: var(--ink-3); font-size: 12px; }
.kind-pill { font-size: 12px; font-weight: 700; color: var(--flag-ink); background: var(--flag-soft); border-radius: 6px; padding: 2px 8px; }
.kind-pill.k-decision, .kind-pill.k-agreement { color: var(--ok); background: var(--ok-soft); }
.kind-pill.k-question { color: var(--accent-ink); background: var(--accent-soft); }
.kind-pill.k-risk { color: var(--danger); background: var(--danger-soft); }
.spill { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px; background: var(--line-2); color: var(--ink-2); }
.spill.s-review { background: #efe8fc; color: #5a35b0; }
.spill.s-doing { background: var(--accent-soft); color: var(--accent-ink); }
.spill.s-done { background: var(--ok-soft); color: var(--ok); }
.spill.s-proposed { background: var(--flag-soft); color: var(--flag-ink); }
.d-title { font-size: 19px; line-height: 1.3; margin: 0; letter-spacing: -.01em; }
.d-detail { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; color: var(--ink-2); background: var(--paper); border-radius: 8px; padding: 10px 12px; }
.d-fields { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 14px; align-items: center; }
.d-fields dt { color: var(--ink-3); font-size: 13px; }
.d-fields dd { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; }
.d-standing { margin: 0; font-size: 13px; color: var(--ink-2); }
.d-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; }
.act-form, .edit-form { display: grid; gap: 8px; width: 100%; }
.act-form .row, .edit-form .row { display: flex; gap: 6px; }
.d-h { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 6px 0 0; }
.d-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.d-history li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; }
.d-history time { color: var(--ink-3); font-size: 12px; }
.d-history .note-q { margin-top: 2px; color: var(--ink-2); border-left: 2px solid var(--line); padding-left: 8px; white-space: pre-wrap; }
.muted { color: var(--ink-3); }
.suggest { font-size: 12px; background: var(--accent-soft); padding: 6px 9px; border-radius: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
.mobile-nav { display: none; }


/* ---------- mentions, small menus */
.mention { background: var(--accent-soft); color: var(--accent-ink); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention.me { background: var(--flag-soft); color: var(--flag-ink); }
.ac, .pop {
  position: fixed; z-index: 70; background: var(--sheet); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(23, 32, 51, .16); padding: 4px; min-width: 210px; max-width: 320px; max-height: 340px; overflow-y: auto; display: grid; gap: 1px;
}
.ac button, .pop button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 14px; width: 100%; color: var(--ink); }
.ac button[aria-selected="true"], .ac button:hover, .pop button:hover, .pop button:focus-visible { background: var(--line-2); outline: none; }
.ac small, .pop small { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.pop button[aria-checked="true"] { font-weight: 600; }
.pop button[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--ok); padding-left: 8px; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.pop-note { margin: 4px 10px 6px; font-size: 12px; color: var(--ink-3); }
.pop-date { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 14px; color: var(--ink-2); }

/* ---------- tracker: quick add and cells that edit in place */
.qadd { display: flex; gap: 8px; align-items: center; margin: 12px 20px 0; padding: 5px 6px 5px 12px; border: 1px dashed #c9d0dc; border-radius: 10px; background: var(--sheet); }
.qadd:focus-within { border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qadd-plus { color: var(--ink-3); font-weight: 700; }
.qadd-in { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 6px 0; font-size: 14px; }
.qadd select.input.sm { max-width: 170px; }
.qadd-prev { margin: 5px 20px 0 40px; font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-height: 22px; }
.qp-title { color: var(--ink); font-weight: 600; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--line-2); border-radius: 12px; padding: 1px 9px 1px 2px; color: var(--ink-2); }
.qp-chip.muted { padding-left: 9px; }
.qp-note { color: var(--flag-ink); }
.cell { border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 3px 6px; margin: -4px -7px; font-family: inherit; color: inherit; min-width: 0; min-height: 26px; }
.twho.cell { font-size: 13px; }
.cell:hover, .cell:focus-visible { border-color: var(--line); background: var(--sheet); }
.tdue.cell { justify-self: end; font-size: 12px; }
.tdue.cell:empty::before { content: "+"; color: transparent; font-weight: 600; }
.trow:hover .tdue.cell:empty::before { color: var(--ink-3); }
.twho.cell { display: flex; align-items: center; gap: 6px; text-align: left; }
.sdot-btn { border: 0; background: transparent; padding: 5px; margin: -5px; border-radius: 6px; display: grid; place-items: center; }
.sdot-btn:hover { background: var(--line-2); }
.trow.pending { opacity: .72; }
.trow.flash { background: var(--flag-soft); transition: background 1.2s; }

/* ---------- chat search and history */
.csearch { display: flex; gap: 8px; align-items: center; padding: 8px 20px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.csearch input[type="search"] { flex: 1; width: auto; }
.cs-results { max-height: 46vh; overflow-y: auto; border-bottom: 1px solid var(--line); }
.cs-results:empty { display: none; }
.cs-hit { display: grid; gap: 2px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-2); background: var(--sheet); padding: 9px 20px; }
.cs-hit:hover { background: var(--paper); }
.cs-meta { font-size: 12px; color: var(--ink-3); }
.cs-text { font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cs-hit mark { background: var(--flag-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.cs-note { margin: 0; padding: 10px 20px; font-size: 13px; color: var(--ink-3); }
.older { text-align: center; font-size: 12px; color: var(--ink-3); padding: 6px 0 2px; }
.day.start { color: #b3bccb; }
.newer { position: sticky; bottom: 6px; display: flex; justify-content: center; pointer-events: none; }
.newer .btn { pointer-events: auto; box-shadow: 0 4px 14px rgba(23, 32, 51, .14); }
.mention-need { border-left-color: var(--accent); }
.mention-need:hover { border-left-color: var(--accent); }

/* ---------- toast with undo, comments, notification settings */
#toast.has-btn { pointer-events: auto; display: flex; gap: 14px; align-items: center; }
.toast-btn { border: 0; background: transparent; color: var(--flag); font-weight: 700; padding: 0; }
.comment-form { display: grid; gap: 6px; }
.comment-form .row { display: flex; justify-content: flex-end; }
.switch.big { align-items: flex-start; font-size: 14px; color: var(--ink); gap: 10px; }
.switch.big small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.switch.big input { margin-top: 3px; flex: none; }
.block .note { font-size: 13px; color: var(--ink-3); }


/* ---------- board view of the tracker */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--sheet); padding: 4px 11px; font-size: 13px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.board { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 12px; align-items: start; padding-top: 12px; }
.bcol { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 180px; display: flex; flex-direction: column; gap: 8px; transition: opacity .15s, box-shadow .15s, background .15s; }
.bcol h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0 2px; font-weight: 700; display: flex; gap: 8px; }
.bcol[data-col="doing"] h3 { color: var(--accent-ink); }
.bcol[data-col="review"] h3 { color: #5a35b0; }
.bcol[data-col="done"] h3 { color: var(--ok); }
.bcards { display: grid; gap: 8px; }
.bcard { background: var(--sheet); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; cursor: pointer; display: grid; gap: 6px; }
.bcard:hover { border-color: #c9d0dc; box-shadow: 0 1px 3px rgba(23, 32, 51, .06); }
.bcard[draggable="true"] { cursor: grab; }
.bcard.dragging { opacity: .45; }
.bcard.my-turn { border-color: var(--flag); box-shadow: inset 3px 0 0 var(--flag); }
.bcard.pending { opacity: .72; }
.bcard .ttitle { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bcard.s-done .ttitle { color: var(--ink-3); text-decoration: line-through; }
.bmeta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-2); min-width: 0; }
.bwho { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bsub { font-size: 12px; color: var(--ink-3); }
.bcol.no-drop { opacity: .35; }
.bcol.can-drop { box-shadow: inset 0 0 0 2px var(--accent-soft); }
.bcol.over { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.bempty { color: var(--ink-3); font-size: 13px; margin: 2px; }
.bnote { font-size: 12px; color: var(--ink-3); margin: 12px 2px 0; }
.ai-check { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed #c9d0dc; border-radius: 10px; }
.ai-check .note { font-size: 12px; color: var(--ink-3); }
.ai-check-text { flex-basis: 100%; white-space: pre-wrap; font-size: 14px; border-left: 3px solid var(--accent); padding-left: 10px; }

/* ---------- documents */
.trow.doc { grid-template-columns: 18px minmax(0, 1fr); }
.doc-ico { color: var(--ink-3); font-size: 15px; line-height: 1; }
.trow.doc .tmeta .aud-pill { font-size: 11px; padding: 0 6px; }
.trow.doc.movable { grid-template-columns: 18px minmax(0, 1fr) auto; }
.g-pinned .doc-ico { color: var(--accent); }
.doc-moves { display: flex; gap: 2px; align-items: center; }
.doc-moves .btn { min-width: 30px; padding: 2px 6px; }
.doc-moves .btn:disabled { opacity: .3; cursor: default; }
.doc-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.doc-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 22px 28px 48px; max-width: 900px; }
.doc-wrap.with-hist { grid-template-columns: minmax(0, 1fr) 240px; max-width: 1160px; }
.doc-page { min-width: 0; }
.doc-title { font-size: 26px; letter-spacing: -.015em; line-height: 1.25; margin: 4px 0 8px; overflow-wrap: anywhere; }
.doc-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); margin-bottom: 20px; }
.doc-verbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--accent-soft); border-radius: var(--radius); padding: 8px 10px; font-size: 14px; margin-bottom: 12px; }
.doc-page .warn { margin-bottom: 12px; }
.md { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.md h2 { font-size: 20px; line-height: 1.3; margin: 26px 0 8px; }
.md h3 { font-size: 17px; margin: 22px 0 6px; }
.md h4, .md h5 { font-size: 15px; margin: 18px 0 4px; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 12px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li.check { list-style: none; margin-left: -20px; display: flex; gap: 6px; }
.md li.check.done { color: var(--ink-3); }
.md li.check .box { flex: none; }
.md blockquote { margin: 0 0 12px; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.md code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.md pre { background: var(--line-2); padding: 10px 12px; border-radius: var(--radius); overflow-x: auto; margin: 0 0 12px; }
.md pre code { background: none; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.md .tbl { overflow-x: auto; margin: 0 0 14px; }
.md table { border-collapse: collapse; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--line-2); font-weight: 600; }
.md .cite { text-decoration: none; background: var(--accent-soft); padding: 0 4px; border-radius: 4px; font-size: 13px; font-weight: 600; }
.md .doc-link { text-decoration: none; border-bottom: 1px dashed currentColor; }
.md .note, .doc-conflict .note { color: var(--ink-3); font-size: 13px; }
.doc-hist { border-left: 1px solid var(--line); padding-left: 16px; display: flex; flex-direction: column; gap: 4px; align-self: start; position: sticky; top: 0; }
.doc-hist h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0 0 6px; }
.doc-hist .hv { text-align: left; border: 1px solid transparent; background: transparent; border-radius: var(--radius); padding: 6px 8px; display: grid; gap: 1px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.doc-hist .hv:hover { background: var(--line-2); }
.doc-hist .hv.on { border-color: var(--accent); background: var(--accent-soft); }
.doc-hist .hv small { color: var(--ink-3); font-size: 12px; }
.doc-hist .hv.ev { cursor: default; }
.doc-hist .hv.ev:hover { background: transparent; }
.doc-hist .hv.ev b { font-weight: 500; color: var(--ink-2); }
.doc-hist .cur { font-weight: 500; color: var(--ok); font-size: 12px; }
.doc-editor { padding: 16px 28px 32px; display: flex; flex-direction: column; gap: 10px; max-width: 1400px; }
.doc-title-in { font-size: 20px; font-weight: 600; }
.doc-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.doc-vis { display: inline-flex; gap: 8px; align-items: center; }
.doc-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.doc-tabs { display: none; }
.doc-text { min-height: 60vh; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.55; }
.doc-prev { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 16px; min-height: 60vh; background: #fcfdfe; }
.doc-help { font-size: 12px; color: var(--ink-3); margin: 0; }
.doc-changed { background: var(--flag-soft); color: var(--flag-ink); padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }
.doc-changed:empty { display: none; }
.doc-conflict { display: grid; gap: 8px; }
@media (max-width: 1100px) {
  .doc-split { grid-template-columns: minmax(0, 1fr); }
  .doc-tabs { display: inline-flex; }
  .doc-split[data-tab="write"] .doc-prev, .doc-split[data-tab="preview"] .doc-text { display: none; }
  .doc-wrap.with-hist { grid-template-columns: minmax(0, 1fr); }
  .doc-hist { border-left: 0; padding-left: 0; position: static; border-top: 1px solid var(--line); padding-top: 12px; }
}
@media (max-width: 900px) {
  .doc-wrap, .doc-editor { padding: 14px 16px 28px; }
  .doc-title { font-size: 22px; }
}

/* ---------- how-to in settings */
.howto { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.howto li { display: grid; gap: 2px; }
.howto li span { color: var(--ink-2); font-size: 13px; }
.howto.kinds li { grid-template-columns: 130px minmax(0, 1fr); gap: 10px; }
@media (max-width: 900px) { .howto.kinds li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- sign in */
.code-input { font-size: 22px; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.gate-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- narrower screens */
@media (max-width: 1280px) {
  .shell { grid-template-columns: 228px minmax(0, 1fr) 300px; }
  .trow { grid-template-columns: 14px minmax(0, 1fr) 58px 120px 170px; }
}
@media (max-width: 1060px) {
  .board { grid-template-columns: repeat(4, minmax(190px, 1fr)); overflow-x: auto; padding-bottom: 6px; }
  .trow { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .trow .tdue, .trow .twho { display: none; }
  .trow.g { grid-template-columns: 20px minmax(0, 1fr) 70px; }
  .trow.g .tdue { display: block; }
}
@media (max-width: 900px) {
  .gate { grid-template-columns: 1fr; }
  .gate-side { padding: 28px 22px; }
  .gate-flow { display: none; }
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail, .side, .main { display: none; }
  .shell[data-view="main"] .main,
  .shell[data-view="side"] .side,
  .shell[data-view="rail"] .rail { display: flex; grid-row: 1; }
  .main { border-right: 0; }
  .main-head { padding: 10px 16px; flex-wrap: wrap; gap: 8px; min-height: 52px; }
  .toolbar { padding: 8px 16px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
  .chip { flex: none; }
  .input.search { width: 100%; }
  .filters-row { width: 100%; }
  .tlist { padding: 6px 16px 20px; }
  .trow { grid-template-columns: 12px minmax(0, 1fr); }
  .trow .tact { grid-column: 2; justify-content: flex-start; }
  .trow .tdue, .trow .twho { display: none; }
  .qadd { margin: 10px 16px 0; flex-wrap: wrap; }
  .board { grid-template-columns: repeat(4, 80vw); scroll-snap-type: x mandatory; }
  .bcol { scroll-snap-align: start; }
  .qadd select.input.sm { max-width: none; flex: 1; }
  .qadd-prev { margin: 4px 16px 0; }
  .csearch { padding: 8px 16px; flex-wrap: wrap; }
  .cs-hit { padding: 9px 16px; }
  .stream { padding: 12px 16px 6px; }
  .composer { padding: 10px 16px 12px; }
  .composer .help { display: none; }
  .settings { padding: 14px 16px 24px; }
  .d-fields { grid-template-columns: 100px minmax(0, 1fr); }
  .d-history li { grid-template-columns: 1fr; gap: 0; }
  .drawer .two { grid-template-columns: 1fr; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); grid-row: 2;
    background: var(--sheet); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav button { border: 0; background: transparent; padding: 10px 4px 12px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
  .mobile-nav button[aria-current="page"] { color: var(--ink); box-shadow: inset 0 2px 0 var(--ink); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
