/* Stratahall prototype — mobile-first, no external assets. */
:root {
  --ink: #1b2422;
  --ink-2: #4a5754;
  --muted: #66736f;
  --line: #d9e0dd;
  --bg: #f4f6f3;
  --card: #ffffff;
  --brand: #1f4d45;
  --brand-2: #2f6f63;
  --brand-soft: #e3efeb;
  --accent: #b3541e;
  --warn-bg: #fff4e5;
  --warn-ink: #7a4300;
  --ok-bg: #e5f4ea;
  --ok-ink: #1d5e33;
  --bad-bg: #fbe9e9;
  --bad-ink: #8a1f1f;
  --info-bg: #e8f0fb;
  --info-ink: #1f4a85;
  --demo-bg: #f1ecfa;
  --demo-ink: #553a8a;
  --radius: 12px;
  --tab-h: 72px;
  --shell-width: 430px;
  --space-unit: 4px;
  --space-1: calc(2 * var(--space-unit));
  --space-2: calc(4 * var(--space-unit));
  --space-3: calc(6 * var(--space-unit));
  --space-4: calc(8 * var(--space-unit));
  --type-large: 1.5rem;
  --type-title: 1.25rem;
  --type-body: 1rem;
  --type-caption: .875rem;
  color-scheme: light;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + var(--space-2));
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  line-break: strict;
}
a { color: var(--brand-2); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--space-1); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h1:focus { outline: none; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: var(--space-1); z-index: 50; }
.skip:focus { left: var(--space-1); }
.loading { padding: var(--space-4) var(--space-2); text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
abbr[title] { text-decoration: underline dotted; cursor: help; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--brand); color: #fff; padding-inline: var(--space-2);
}
.brand { display: flex; align-items: center; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--brand); display: grid; place-items: center; font-weight: 800; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text small { opacity: .85; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proto-chip { color: #fff; font-size: .78rem; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: var(--space-1); text-decoration: none; white-space: nowrap; }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); padding: var(--space-1) var(--space-2); font-size: .9rem; }

/* deep-page top bar: Back names its destination; the current context stays visible */
.topbar.deep { justify-content: flex-start;  min-height: 52px; }
.tb-back { display: inline-flex; align-items: center; min-height: 40px; max-width: 46%; flex: none; border-radius: 999px; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.tb-back > span:first-child { font-size: 1.3rem; line-height: 1; margin-top: 0; }
.tb-back-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tb-ctx { flex: 1; min-width: 0; font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar.deep .proto-chip { flex: none; }

/* main */
main { display: block; max-width: 640px; margin: 0 auto; }
main:focus { outline: none; }
.page > * + *, .state-loading > * + * { margin-top: var(--space-2); }
.lede { color: var(--ink-2); }
.hint { color: var(--muted); font-size: .88rem; }
.hint-inline { color: var(--muted); font-size: .82rem; font-weight: normal; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: var(--space-1); font-weight: 600; }
.meta { color: var(--muted); font-size: .85rem; }
.empty { color: var(--muted); font-style: italic; }
.missing { color: var(--warn-ink); background: var(--warn-bg); padding: var(--space-1); border-radius: 6px; }
dd.missing, p.missing { display: block; padding: var(--space-1); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card.quiet { background: transparent; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
h3.minor, h2.minor { font-size: 1rem; margin-top: var(--space-2); }
h2.minor:first-child, h3.minor:first-child { margin-top: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); min-height: 44px;
  border-radius: 10px; border: 1px solid var(--brand-2); background: #fff; color: var(--brand); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--ink-2); }
.btn.danger { border-color: var(--bad-ink); color: var(--bad-ink); }
.btn.small { min-height: 40px; font-size: .92rem; }
.btn.block { display: flex; width: 100%; margin-top: var(--space-1); }
.link-btn { background: none; border: 0; padding: var(--space-1) 0; min-height: 40px; color: var(--brand-2); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap;  }

/* badges */
.badges { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: var(--space-1); }
.badge { display: inline-block; font-size: .74rem; font-weight: 600; line-height: 1.2; padding: var(--space-1); border-radius: 999px; background: #eef1ef; color: var(--ink-2); vertical-align: middle; }
.k-minutes { background: var(--ok-bg); color: var(--ok-ink); }
.k-notice { background: var(--warn-bg); color: var(--warn-ink); }
.b-demo { background: var(--demo-bg); color: var(--demo-ink); }
.b-local { background: var(--info-bg); color: var(--info-ink); }
.b-meeting { background: var(--brand-soft); color: var(--brand); }
.b-latest { background: var(--brand); color: #fff; }
.b-para { background: #f0eee6; color: #5a4f2a; }
.b-partial { background: #fff0d6; color: #7a4f00; }
.st-missing { background: var(--bad-bg); color: var(--bad-ink); }
.st-pending { background: var(--warn-bg); color: var(--warn-ink); }
.st-available { background: var(--ok-bg); color: var(--ok-ink); }
.ss-pending { background: var(--warn-bg); color: var(--warn-ink); }
.ss-approved { background: var(--ok-bg); color: var(--ok-ink); }
.ss-rejected { background: var(--bad-bg); color: var(--bad-ink); }
.ss-needs-info { background: #fff0d6; color: #7a4f00; }
.m-upcoming { background: var(--brand); color: #fff; }
.m-held, .m-ended { background: #eef1ef; color: var(--ink-2); }
.m-cancelled { background: var(--bad-bg); color: var(--bad-ink); }
.m-join-details-missing { background: var(--warn-bg); color: var(--warn-ink); }
.tstatus { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.you { color: var(--brand-2); font-weight: 600; }

/* home */
.hero h1 { font-size: 1.55rem; }
.hero p { color: var(--ink-2); }
.search { display: flex; gap: .5rem; }
.search input, .toolbar input[type=search] { flex: 1; min-width: 0; }
.intro { border-left: 4px solid var(--accent); }
.steps { margin: 0 0 var(--space-1); padding-left: var(--space-3); }
.next-meeting { display: flex; flex-direction: column; gap: var(--space-1); background: var(--card); border: 2px solid var(--brand); border-radius: var(--radius);  color: inherit; text-decoration: none; }
.next-meeting strong { font-size: 1.08rem; color: var(--ink); }
.next-meeting .eyebrow { margin: 0; }
.nm-go { font-size: .9rem; font-weight: 600; color: var(--brand-2); margin-top: var(--space-1); }
.draft-hint { font-size: .9rem; margin: var(--space-1) 0 0; }
.footnote { font-size: .85rem; color: var(--muted); }
.big-date { font-size: 1.1rem; font-weight: 700; color: var(--brand); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin: var(--space-1) 0; }
.sec-head h2 { margin: 0; }

/* topic cards */
.cards, .reqs, .mlist, .doclist, .subs, .comments, .replies, .mupdates, .facts, .timeline, .avail, .history, .plain { list-style: none; margin: 0; padding: 0; }
.cards { display: grid; }
.tcard a { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; }
.tcard a:hover { border-color: var(--brand-2); }
.tcard-top { display: flex; flex-wrap: wrap; align-items: center; }
.tcard-title { font-size: 1.06rem; color: var(--brand); }
.tcard-now { font-size: .9rem; color: var(--ink-2); }
.tcard-meta { font-size: .8rem; color: var(--muted); }
.toolbar { display: grid; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%; min-height: 44px; border: 1px solid #b9c4c0; border-radius: 9px; background: #fff;
}
textarea { resize: vertical; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; min-height: 0; margin: 0; flex: none; accent-color: var(--brand); }
input[type=file] { padding: var(--space-1); }
[aria-invalid=true] { border-color: var(--bad-ink); box-shadow: 0 0 0 2px var(--bad-bg); }
label { display: block; font-weight: 600; font-size: .92rem; }
label > input, label > select, label > textarea { font-weight: normal; }
label small { display: block; font-weight: normal; color: var(--muted); }
label.radio, label.check { display: flex; align-items: center; font-weight: normal; min-height: 44px; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--space-1); }
legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: var(--space-1); }
.form-error:not(:empty) { background: var(--bad-bg); color: var(--bad-ink); border-radius: 8px; margin: var(--space-1) 0 var(--space-2); font-size: .92rem; }
.chips { display: flex; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; min-height: 36px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); text-decoration: none; font: inherit; font-size: .88rem; cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.result-count { font-size: .85rem; color: var(--muted); margin: var(--space-1) 0; }

/* page headers & navigation context */
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1); font-size: .84rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin: 0 var(--space-1); color: #9aa6a2; }
.crumbs a { color: var(--ink-2); }
.crumbs [aria-current=page] { color: var(--ink); font-weight: 600; }
.backbar { display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-1) !important; }
.backbar .back { text-decoration: none; }
.backctx { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.phead h1 { margin-bottom: var(--space-1); }
.onpage { border-top: 1px solid var(--line); }
.onpage-label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: var(--space-1); }
.onpage ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.onpage button { min-height: 36px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font: inherit; font-size: .88rem; color: var(--brand); cursor: pointer; }
.onpage button b { color: var(--ink-2); font-weight: 600; margin-left: var(--space-1); }
.agenda { display: flex; flex-direction: column; gap: var(--space-1); background: var(--brand-soft); border: 1px solid #bcd6ce; border-radius: var(--radius);  color: var(--brand); text-decoration: none; }
.agenda span { font-size: .88rem; color: var(--ink-2); }
.notice-old { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; font-size: .9rem; }
.demo-banner { background: var(--demo-bg); color: var(--demo-ink); border-radius: var(--radius); font-size: .92rem; }
.demo-note { font-size: .82rem; color: var(--demo-ink); }
.flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px #f0a54a; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* topic local views */
.ltabs { border-bottom: 1px solid var(--line); }
.ltabs::-webkit-scrollbar { display: none; }
.ltabs ul { list-style: none; margin: 0; display: flex; }
.ltabs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.ltabs a b { font-weight: 600; font-size: .78rem; color: var(--muted); background: #eef1ef; border-radius: 999px; padding: 0 var(--space-1); }
.ltabs a[aria-current=page] { color: var(--brand); border-bottom-color: var(--brand); }
.ltabs a[aria-current=page] b { background: var(--brand-soft); color: var(--brand); }
.latest { border-top: 1px solid var(--line); }
.latest h3 { margin-bottom: var(--space-1); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { border-top: 1px solid var(--line); }
.hist li:first-child { border-top: 0; }
.hist a { display: flex; align-items: center; color: inherit; text-decoration: none; min-height: 48px; }
.hist-body { display: flex; flex-direction: column; min-width: 0; }
.hist-body b { color: var(--brand); }
.hist-body small { color: var(--muted); font-size: .8rem; }
.unum.old { background: #fff; color: var(--brand); border: 2px solid var(--brand-2); }
.next-steps { display: grid; gap: .5rem; }
.next-steps a { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; }
.next-steps b { color: var(--brand); }
.next-steps span { font-size: .85rem; color: var(--muted); }
.disc > * + * { margin-top: var(--space-2); }
.pinned { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; color: inherit; text-decoration: none; }
.pinned .eyebrow { margin: 0; }
.pin-counts { display: flex; flex-wrap: wrap; align-items: center;  font-weight: 700; font-size: .9rem; }
.pin-counts .badge + .badge, .pin-counts .badge { margin-left: var(--space-1); }
.greqs { margin: 0 0 var(--space-1); border: 1px dashed #c9d3cf; border-radius: 8px; background: #fff; }
.greqs > summary { cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--brand-2); min-height: 40px; display: flex; align-items: center; }
.greqs .reqs { padding: 0 var(--space-1) var(--space-1); margin: 0; }
.upd-preview:not(:empty) { background: var(--brand-soft); border-radius: 8px; padding: var(--space-1) var(--space-2); margin: 0 0 var(--space-2); font-size: .88rem; }
.upd-preview p { margin: var(--space-1) 0 0; }
.drafts { list-style: none; margin: 0 0 var(--space-1); padding: 0; }
.drafts li { display: flex; align-items: center; gap: .5rem; border-top: 1px solid var(--line); padding: var(--space-1) 0; }
.drafts li:first-child { border-top: 0; }
.drafts li > a, .drafts li > span { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: inherit; padding: var(--space-1) 0; }
.drafts li > a b { color: var(--brand); }
.drafts li span span { font-size: .84rem; color: var(--muted); }

/* topic content */
.summary { font-size: 1.02rem; }
.facts li { border-top: 1px solid var(--line); }
.facts li:first-child { border-top: 0; padding-top: var(--space-1); }
.facts p { margin: var(--space-1) 0; }
.src { font-size: .85rem; }
.questions { margin: 0; }
.appears { display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; margin-top: var(--space-2); font-size: .88rem; }
.appears > span { color: var(--muted); }
.post header { font-size: .88rem; color: var(--muted); margin-bottom: var(--space-1); }
.timeline { position: relative; }
.tl-item { border-left: 3px solid var(--line); padding: 0 0 var(--space-2) var(--space-2); margin-left: var(--space-2); position: relative; }
.tl-item.latest { border-left-color: var(--brand); }
.tl-item:last-child { padding-bottom: 0; }
.tl-head { display: flex; align-items: flex-start; margin-left: calc(-1 * var(--space-4)); margin-bottom: var(--space-1); }
.unum { flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.tl-item:not(.latest) .unum { background: #fff; color: var(--brand); border: 2px solid var(--brand-2); }
.unum.sm { width: 1.7rem; height: 1.7rem; font-size: .8rem; }
.tl-sub { font-size: .82rem; color: var(--muted); margin-top: var(--space-1); }
.links { display: flex; flex-wrap: wrap;  font-size: .88rem; }
.links a, .links span { padding: var(--space-1) 0; }
.links.stack { flex-direction: column; }
.big { font-size: 1.06rem; }

/* discussion */
.sorter { display: flex; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: var(--space-2); }
.sorter button { min-height: 36px; border: 1px solid var(--line); background: #fff; border-radius: 999px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--ink-2); }
.sorter button[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.dgroup { border: 1px solid var(--line); border-radius: 10px; margin-bottom: var(--space-2); background: #fbfcfb; }
.dgroup.open { border-color: var(--brand-2); }
.dgroup-head { display: flex; align-items: center;  cursor: default; list-style: none; }
details.dgroup > summary { cursor: pointer; }
details.dgroup > summary::-webkit-details-marker { display: none; }
.dg-title { flex: 1; min-width: 0; font-size: .92rem; }
.dg-title small { display: block; color: var(--muted); font-size: .8rem; }
.chev { width: .6rem; height: .6rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); flex: none; transition: transform .15s; }
details[open] > summary .chev { transform: rotate(-135deg); }
.dgroup-body { padding: 0 var(--space-2) var(--space-2); }
.uctx { margin: 0 0 var(--space-1); padding: var(--space-1) var(--space-2); border-left: 3px solid var(--brand-soft); background: #fff; font-size: .88rem; color: var(--ink-2); }
.req-line { display: block; font-size: .86rem; margin-bottom: var(--space-1); }
.comment { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: var(--space-1); }
.c-head { display: flex; flex-wrap: wrap; align-items: center; font-size: .85rem; }
.author { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.c-text { margin: var(--space-1) 0; }
.c-foot { display: flex; flex-wrap: wrap;  font-size: .78rem; color: var(--muted); }
.stance { font-size: .74rem; font-weight: 700; padding: var(--space-1); border-radius: 6px; }
.sc-q { background: var(--info-bg); color: var(--info-ink); }
.sc-support { background: var(--ok-bg); color: var(--ok-ink); }
.sc-concern { background: var(--bad-bg); color: var(--bad-ink); }
.sc-cond { background: #fff0d6; color: #7a4f00; }
.sc-info { background: var(--demo-bg); color: var(--demo-ink); }
.sc-reply { background: #eef1ef; color: var(--ink-2); }
.replies { margin: var(--space-1) 0 0 var(--space-1); border-left: 2px solid var(--line); padding-left: var(--space-1); }
.reply { padding: var(--space-1) 0; }
.reply-form { margin-top: var(--space-1); background: #f7f9f8; border-radius: 8px; }
.composer { margin-top: var(--space-2); border: 2px solid var(--brand-soft); }

/* requests */
.reqs { display: grid; gap: .5rem; margin: var(--space-1) 0; }
.req, .sub { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; background: #fff; }
.req strong, .sub strong { color: var(--brand); }
.req-top { display: flex; flex-wrap: wrap; }
.req .muted, .sub .muted { font-size: .82rem; }
.fb { font-size: .85rem; color: var(--warn-ink); }
.subs { display: grid; gap: .5rem; }
.scope .avail li { border-left: 3px solid var(--ok-ink); padding-left: var(--space-1); margin-bottom: var(--space-1); }
.history { font-size: .86rem; }
.history li { padding: var(--space-1) 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.history time { display: block; color: var(--muted); font-size: .78rem; }
.feedback { border-radius: 8px; margin: var(--space-1) 0; background: var(--warn-bg); color: var(--warn-ink); }
.feedback.approved { background: var(--ok-bg); color: var(--ok-ink); }
.feedback p { margin: var(--space-1) 0 0; }
.ctx { background: var(--brand-soft); border-radius: 8px; }

/* surveys */
.tally { border-top: 1px solid var(--line); }
.tally h4 { font-size: .92rem; margin-bottom: var(--space-1); }
.tally ul { list-style: none; padding: 0; margin: 0 0 var(--space-1); }
.tally li { display: grid; grid-template-columns: minmax(3.5rem, auto) 1fr 1.6rem; gap: .5rem; align-items: center; font-size: .88rem; }
.bar { height: .6rem; background: #eef1ef; border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand-2); }

/* meetings */
.mlist { display: grid; gap: .5rem; }
.mrow { display: flex; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; background: #fff; }
.mdate { flex: none; width: 3.4rem; text-align: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: flex; flex-direction: column; line-height: 1.1; font-size: .82rem; }
.mdate b { font-size: 1.35rem; }
.mdate small { color: var(--muted); font-size: .7rem; }
.mbody { display: flex; flex-direction: column; min-width: 0; }
.mbody strong { color: var(--brand); }
.mbody .muted { font-size: .84rem; }
.demo-states > summary { cursor: pointer; list-style: none; }
.demo-states > summary::-webkit-details-marker { display: none; }
.demo-states > summary h2 { display: inline; }
.demo-states > summary h2::after { content: " ▾"; color: var(--muted); font-size: .9rem; }
.demo-states[open] > summary h2::after { content: " ▴"; }
.demo-states > summary .muted { display: block; font-size: .85rem; margin-top: var(--space-1); }
.demo-states .mlist { margin-top: var(--space-2); }
.join { border: 2px solid var(--brand); }
.kvs { margin: 0; }
.kv { display: grid; grid-template-columns: 7.5rem 1fr;  border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 600; }
.kv dd small { display: block; font-weight: normal; color: var(--muted); font-size: .8rem; }
.join-opts { display: grid; margin: var(--space-1) 0 var(--space-2); }
.join-opt { background: #f7f9f8; border-radius: 10px; }
.join-opt h3 { font-size: .95rem; }
.join-opt p { margin: var(--space-1) 0 0; font-size: .9rem; }
.url { font-size: .78rem; color: var(--muted); }
.voting { background: #fff8ec; border: 2px solid #e2a54a; border-radius: var(--radius); }
.voting h3 { color: var(--warn-ink); }
.mupdates { display: grid; }
.doc-link { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; background: #fff; }
.doc-link b { color: var(--brand); }
.doc-link > span:not(:has(> .badge)) { font-size: .85rem; color: var(--muted); }
.doclist { display: grid; gap: .5rem; }

/* documents */
.toc ol { margin: 0; }
.docsec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.prose p { margin-bottom: var(--space-2); }
.sec-foot { font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); margin: var(--space-1) 0 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* me */
.identity .anon { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.6rem; font-weight: 700; color: var(--brand); margin: 0 0 var(--space-1); }
.danger-zone { border-color: #e6c3c3; }
.count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--brand); color: #fff; font-size: .82rem; padding: 0 var(--space-1); }
.review details { margin: var(--space-1) 0; }
.review summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; }
.pager { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.pager a { padding: var(--space-1) 0; }

/* bottom tabs */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); height: var(--tab-h); color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600; min-width: 0; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabbar a.cur { color: var(--brand); }
.tabbar a.cur svg { stroke-width: 2.4; }
.tabbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + var(--space-2)); transform: translate(-50%, 20px);
  width: min(92vw, 520px); background: var(--ink); color: #fff; border-radius: 10px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 359px) {
  main { padding: var(--space-2); }
  .kv { grid-template-columns: 1fr; }
  .search { flex-direction: column; }
  .tabbar a { font-size: var(--type-caption); }
  .brand-text small { max-width: 9rem; }
  .tb-back { max-width: 50%; }
}
/* Shared settled-choice tokens and component rules. Keep these after legacy
   component declarations; area styles may extend them without changing tokens. */
html {
  scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + var(--space-2));
}
body { max-width: var(--shell-width); margin-inline: auto; }
main, .topbar, .banner {
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
}
main { padding-top: var(--space-2); padding-bottom: var(--space-3); min-width: 0; }
.topbar, .tabbar { width: 100%; max-width: var(--shell-width); margin-inline: auto; }
.topbar, .topbar.deep {
  background: var(--brand); color: #fff; border: 0;
  padding-top: calc(3px + env(safe-area-inset-top, 0px));
  padding-bottom: 3px; flex-wrap: nowrap;
}
.topbar.deep { padding-top: calc(4.5px + env(safe-area-inset-top, 0px)); padding-bottom: 4.5px; }
.brand { min-height: 44px; flex: 1; }
.brand-mark { background: #fff; color: var(--brand); }
.proto-chip, .tb-back { color: #fff; border-color: rgba(255,255,255,.55); }
.proto-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .25rem .6rem; }
.brand-text small, .tb-back-label, .tb-ctx {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.backctx, .tabbar span { white-space: normal; overflow: visible; text-overflow: clip; max-width: 100%; }
.tb-back { min-height: 44px; }
.tb-ctx { font-size: .95rem; }
.topbar.deep .proto-chip { min-width: 44px; }
.topbar :focus-visible { outline-color: #f0a54a; }
.tabbar {
  background: var(--card); grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.tabbar a { height: auto; min-height: var(--tab-h); padding-block: var(--space-1); text-align: center; }
.tabbar a.cur svg { fill: currentColor; stroke: currentColor; stroke-width: 1.8; }

/* Four type levels; control text never inherits a smaller caption size. */
h1, .hero h1, .identity .anon { font-size: var(--type-large); }
h2, h3, .tcard-title, .next-meeting strong, .big-date, .big, .mdate b { font-size: var(--type-title); }
body, h4, label, legend, input, select, textarea, button, .btn.small,
.chip, .onpage button, .ltabs a, .sorter button, .summary, .tally h4,
.dg-title, .join-opt h3, .join-opt p, .tb-back, .tb-ctx, .tb-back > span:first-child,
.banner.warn, .tcard-now, .draft-hint, .notice-old, .demo-banner,
.upd-preview:not(:empty), .form-error:not(:empty), .req-line, .history,
.appears, .links, .pager, .pin-counts, .greqs > summary, .uctx, .toast { font-size: var(--type-body); }
small, .brand-text small, .proto-chip, .hint, .hint-inline, .eyebrow, .meta,
.badge, .tstatus, .nm-go, .footnote, .tcard-meta, .result-count, .crumbs ol,
.backctx, .onpage-label, .agenda span, .demo-note, .ltabs a b, .hist-body small,
.next-steps span, .drafts li span span, .src, .post header, .unum, .unum.sm,
.tl-sub, .sorter, .dg-title small, .c-head, .author, .c-foot, .stance,
.req .muted, .sub .muted, .fb, .history time, .tally li, .mdate, .mdate small,
.mbody .muted, .demo-states > summary h2::after, .demo-states > summary .muted,
.kv dt, .kv dd small, .url, .doc-link span, .sec-foot, .count, .tabbar a { font-size: var(--type-caption); }
input, select, textarea { background: var(--card); border-color: var(--muted); }
.phead h1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.tcard-title, .mbody strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.url, .mono, .anon, .c-text, .prose, input, textarea { overflow-wrap: anywhere; }
:lang(zh), :lang(ja), :lang(ko) { hyphens: none; line-break: strict; }

/* Golden's green surfaces and semantic badge colours remain the light theme.
   Card surfaces use tokens so system dark appearance still works. */
.btn, .greqs, .uctx, .comment, .req, .sub, .mrow, .doc-link,
.chip, .onpage button, .sorter button, .unum.old, .tl-item:not(.latest) .unum { background: var(--card); }
.btn.primary, .chip.on { background: var(--brand); color: #fff; }
.sorter button[aria-pressed=true] { background: var(--ink); color: var(--card); }
.skip { background: var(--card); color: var(--ink); }
/* Muted captions on tinted surfaces need a darker local foreground, not a
   change to the locked palette. */
.mdate small, .ltabs a b { color: var(--ink-2); }
:where(a, button, summary):active { filter: brightness(.82); box-shadow: inset 0 0 0 2px var(--muted); }

/* Four-pixel base; retain golden's visible collection and control gaps. */
p, label, .survey, .kvs { margin-bottom: var(--space-2); }
.topbar, .brand, .tb-back, .row, .actions, .badges, .search, .cards, .tcard a,
.tcard-top, .toolbar, label.radio, label.check, .chips, .onpage ul, .ltabs ul,
.ltabs a, .hist a, .next-steps, .next-steps a, .pinned, .pin-counts, .drafts li,
.tl-head, .links, .sorter, .dgroup-head, .c-head, .c-foot, .reqs, .req, .sub,
.req-top, .subs, .tally li, .mlist, .mrow, .mbody, .kv, .join-opts, .mupdates,
.doc-link, .doclist, .sec-foot, .pager { gap: var(--space-1); }
.card, .block, .docsec, .tcard a, .next-meeting, .agenda, .notice-old,
.demo-banner, .pinned, .next-steps a, .dgroup-head, .comment, .reply-form,
.req, .sub, .feedback, .ctx, .join-opt, .voting, .doc-link, .mrow { padding: var(--space-2); }
.btn, .btn.small, .tb-back, input, select, textarea, .chip, .onpage button,
.sorter button, .greqs > summary, .form-error:not(:empty), .toast { padding: var(--space-1) var(--space-2); }
.btn.small, .link-btn, .chip, .onpage button, .sorter button, .review summary { min-height: 44px; }
.latest, .onpage, .tally, .sec-foot { margin-top: var(--space-2); padding-top: var(--space-1); }
.steps, .questions, .toc ol { padding-left: var(--space-3); }
.facts li, .hist a, .history li, .plain li, .kv { padding-block: var(--space-1); }
.steps li, .questions li, .facts p, .c-text, .tally li { margin-bottom: var(--space-1); }
label > input, label > select, label > textarea, label small, .actions { margin-top: var(--space-1); }
.ltabs { margin: var(--space-2) 0 0; overflow: visible; }
.ltabs ul { padding: 0; min-width: 0; flex-wrap: wrap; }
.ltabs li { min-width: 0; max-width: 100%; }
.ltabs a { white-space: normal; padding: var(--space-1); }
.mdate { width: auto; min-width: 3.5rem; padding: var(--space-1); }
.mbody, .kv dd, fieldset { min-width: 0; }
.cards, .toolbar, .mupdates { gap: .6rem; }
.page > :is(.cards, .mlist, .doclist, .subs, .reqs) { margin-top: var(--space-2); }
.mrow { gap: .75rem; }
.hist a { gap: .65rem; }
.join-opts { gap: .75rem; }
.links { gap: .25rem 1rem; }
.badges, .pin-counts, .req-top { gap: .35rem; }
.tcard-top, .chips, .c-head, .onpage ul { gap: .4rem; }
.badge { padding: .2rem .5rem; }
/* Provenance badges also appear consecutively outside a flex badge row. */
.badge + .badge { margin-inline-start: .35rem; }
.badges > .badge, .tcard-top > .badge, .req-top > .badge { margin-inline-start: 0; }
/* Until badges have an operable full-value disclosure, show every value. */
.badge { white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
.st-missing::before { content: '× '; }
.st-pending::before { content: '⌛ '; }
.st-available::before { content: '✓ '; }

/* Keep document scrolling compatible with core's window scroll restoration.
   Feedback must not change the content height when it appears. Do not cap its
   height: this live region has no focusable, keyboard-operable scroll control. */
.toast {
  width: min(calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), calc(var(--shell-width) - 32px));
  color: var(--card);
}
:where(a, button, input, select, textarea, summary, [tabindex]) { scroll-margin-block: var(--space-2); }
@media (max-width: 359px) {
  .topbar.deep { gap: var(--space-1); }
  .tb-back { max-width: 100%; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .mrow { flex-wrap: wrap; }
  .mbody { flex: 1 1 10rem; }
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121e1b; --card: #1b2b26; --ink: #eef6f2; --ink-2: #d0dfd8;
    --muted: #b2c6bc; --line: #4b665a; --brand-soft: #263e35;
    --brand: #a7decf; --brand-2: #a7decf; --accent: #f2b086;
    --warn-bg: #392b19; --warn-ink: #ffcf8a;
    --ok-bg: #193323; --ok-ink: #a8dfb7;
    --bad-bg: #3d2020; --bad-ink: #ffb8b8;
    --info-bg: #202f42; --info-ink: #bfd9ff;
    --demo-bg: #302841; --demo-ink: #ddc9ff;
  }
  .topbar, .topbar.deep { background: #1f4d45; }
  .brand-mark { color: #1f4d45; }
  .btn.primary, .chip.on, .b-latest, .m-upcoming, .unum, .count { color: #15251f; }
  .badge:not([class*="st-"]):not([class*="ss-"]):not([class*="p-"]):not([class*="b-"]):not([class*="k-"]):not([class*="m-"]),
  .k-other, .m-held, .m-ended, .sc-reply, .bar, .ltabs a b, .dgroup, .reply-form, .join-opt { background: var(--brand-soft); }
  .b-para { background: #38351e; color: #ede0aa; }
  .b-partial, .ss-needs-info, .sc-cond { background: var(--warn-bg); color: var(--warn-ink); }
  .voting { background: var(--warn-bg); border-color: var(--warn-ink); }
  :where(a, button, summary):active { filter: brightness(1.2); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
