/* The shell owns viewport layout; only main scrolls. */
html { height: 100%; scroll-behavior: smooth; }
body { height: var(--shell-height, 100dvh); max-width: var(--shell-width); margin-inline: auto; padding-bottom: 0; display: flex; flex-direction: column; overflow: hidden; }
#topbar, #tabbar, #banner { flex: none; width: 100%; }
#topbar { position: relative; flex-wrap: nowrap; }
#topbar .brand-text { flex: 1; }
#topbar .download-app { flex: none; min-height: 44px; padding: 4px 10px; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; background: transparent; color: #fff; font-size: 13px; white-space: nowrap; }
#topbar .shell-search { display: grid; place-items: center; flex: none; width: 44px; height: 44px; color: #fff; text-decoration: none; }
.shell-search svg, .search-page svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shell-search svg { width: 20px; height: 20px; }
/* NAV-11 B: search is a dedicated flat page, never a list toolbar. */
.search-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.search-page .search-header { display: flex; align-items: center; gap: 6px; margin: 0 0 24px; }
.search-back, .search-clear { display: grid; place-items: center; flex: none; padding: 0; border: 0; background: transparent; color: var(--brand); cursor: pointer; }
.search-back { width: 32px; height: 32px; }
.search-back svg, .search-clear svg { width: 20px; height: 20px; }
.search-field { position: relative; flex: 1; min-width: 0; margin: 0; }
.search-field > svg { position: absolute; width: 15px; height: 15px; left: 12px; top: 12.5px; color: var(--muted); pointer-events: none; }
.search-field > input { width: 100%; height: 40px; min-height: 40px; margin: 0; padding: 0 10px 0 33px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 400; }
.search-field > input::placeholder { color: var(--muted); opacity: 1; }
.search-page .search-submit { flex: none; height: 40px; min-height: 40px; border-radius: 999px; padding: 0 12px; font-size: 13px; font-weight: 700; }
.search-page h2 { font-size: 16px; font-weight: 700; margin: 0; }
.search-page > section + section { margin-top: 24px; }
.search-section-head { display: flex; align-items: center; justify-content: space-between; }
.search-clear { width: 32px; height: 32px; }
.search-recents { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 8px 0 0; }
.search-recents > li { display: flex; align-items: center; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.search-recents a { min-width: 0; overflow-wrap: anywhere; padding: 8px 0 8px 12px; text-decoration: none; }
.search-recents button { flex: none; width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.search-suggestions ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; list-style: none; padding: 0; margin: 8px 0 0; }
.search-suggestions a { display: block; padding: 8px 0; font-size: 14px; text-decoration: none; }
.search-results ul { list-style: none; padding: 0; margin: 8px 0 0; }
.search-results li { position: relative; }
.search-results li + li::before { content: ""; position: absolute; inset: 0 0 auto; border-top: 1px solid var(--line); pointer-events: none; }
.search-results a { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; text-decoration: none; }
.search-results strong { font-size: var(--type-title); color: var(--brand); }
.search-results a > span { font-size: 14px; color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  .search-field > input { background: var(--card); }
}

#topbar > .proto-chip { flex: 0 1 auto; max-width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#banner { max-height: 22dvh; overflow: auto; }
#app { flex: 1; min-height: 0; width: 100%; margin: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scroll-behavior: smooth; scroll-padding: 16px; padding: 16px; }
#tabbar { position: relative; inset: auto; transform: none; padding-bottom: env(safe-area-inset-bottom, 0px); }
/* One narrow row: brand at roots, symmetric Back/title/action slots at depth.
   Long context stays in the page heading; the bar never grows another row. */
#topbar.deep { display: grid; grid-template-columns: minmax(44px, 25%) minmax(0,1fr) minmax(44px, 25%); gap: 8px; }
#topbar.deep .tb-back { grid-column: 1; grid-row: 1; max-width: 100%; min-height: 44px; padding: 4px 6px; gap: 4px; font-size: .86rem; }
#topbar.deep .tb-ctx { grid-column: 2; grid-row: 1; text-align: center; min-width: 0; font-size: .95rem; }
#topbar.deep > .proto-chip { grid-column: 3; grid-row: 1; justify-self: end; max-width: 100%; min-height: 44px; }
.field-error { color: var(--bad-ink); font-size: .9rem; margin: 4px 0; }
.field-error:empty { display: none; }
#copy-recovery { width: min( calc(100% - 32px), 560px); max-height: 85dvh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); padding: 16px; }
#copy-recovery::backdrop { background: #0008; }
#copy-recovery textarea { width: 100%; user-select: text; }
.core-outgoing { position: fixed; z-index: 5; overflow: hidden; padding: 16px; pointer-events: none; background: var(--bg, #fff); }
#app { background: var(--bg, #fff); }
/* Feed content lives on the page, not on group or item surfaces. Scope the
   reset to content components: .btn.block and controls keep their own look.
   #app also takes precedence over area styles (including dark appearance). */
#app :is(section, details).block,
#app :is(.card, .docsec, .mrow, .mdate, .doc-link, .sub, .req, .kv,
  .join-opt, .latest, .tally, .comment, .reply-form, .replies, .reply-quote,
  .feedback, .ctx, .uctx, .greqs, .dgroup, .missing, .form-error,
  .upd-preview, .forms-summary, .next-meeting, .agenda, .pinned,
  .notice-old, .demo-banner, .voting, .sec-foot, .banner),
#app .tcard > a,
#app .next-steps > a {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding-inline: 0;
}
#app :is(section, details).block,
#app :is(.card, .docsec, .dgroup, .forms-summary) { padding-block: 0; }
/* Headings have a stronger rhythm than the spacing inside a row. */
#app .page :is(section, details).block,
#app .page :is(.docsec, section.card, .dgroup, .next-steps) {
  margin-top: var(--space-4);
}
#app :is(.block, .card, .docsec) > :is(h2, h3):first-child { margin-top: 0; }
#app h2.minor, #app h3.minor { margin-top: var(--space-4); }
#app :is(.block, .card, .docsec) > :is(h2, h3):first-child { margin-bottom: var(--space-1); }
#app :is(.cards, .mlist, .doclist, .reqs, .subs, .mupdates, .join-opts,
  .kvs, .comments, .replies, .drafts, .next-steps, .timeline) {
  gap: 0;
  margin-bottom: 0;
  padding: 0;
}
#app :is(.questions, .steps, .toc ol) { padding-left: 0; list-style-position: inside; }
/* All rows share 14px vertical breathing room and full-width dividers. */
#app :is(.cards, .mlist, .doclist, .reqs, .subs, .mupdates, .facts,
  .hist, .history, .plain, .questions, .steps, .avail, .comments,
  .replies, .drafts, .timeline, .toc ol) > li,
#app :is(.kv, .join-opt, .next-steps > a, .survey, .review) {
  position: relative;
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 14px 0;
}
/* Linked rows own their padding, so the entire row remains tappable. */
#app :is(.cards, .mlist, .doclist, .reqs, .subs, .hist) > li { padding: 0; }
#app :is(.mrow, .doc-link, .sub, .req),
#app :is(.tcard, .hist li) > a { padding: 14px 0; }
#app :is(.latest, .tally, .next-meeting, .agenda, .pinned,
  .notice-old, .demo-banner, .voting, .feedback, .ctx, .uctx, .banner) { padding-block: 14px; }
#app :is(.missing, .form-error, .upd-preview, .forms-summary) { padding-block: var(--space-1); }
#app .kv > .missing { padding: 0; }
#app .dgroup-head { padding: 14px 0; }
#app .dgroup-body, #app .greqs .reqs { padding: 0; }
#app .drafts li > :is(a, span) { padding-block: 0; }
#app .tl-head { margin-left: 0; }
#app :is(.block, .card, .docsec, .comment, .join-opt) > p:last-child { margin-bottom: 0; }
/* Plain forms must not float transparent content over the feed. */
#app :is(.composer, .reply-form) { position: static; max-height: none; overflow: visible; padding-block: 14px; }
/* Paint a hairline on a pseudo-element rather than boxing the row. Hidden
   filtered topics don't count as neighbours or give the first row a rule. */
#app :is(.cards, .mlist, .doclist, .reqs, .subs, .mupdates, .facts,
  .hist, .history, .plain, .questions, .steps, .avail, .comments,
  .replies, .drafts, .timeline, .toc ol) > li:not([hidden]) ~ li:not([hidden])::before,
#app :is(.kv + .kv, .join-opt + .join-opt, .survey + .survey,
  .review + .review, .next-steps > a + a, .latest, .tally)::before,
#app .join > .join-opts::before,
#app .join > .join-opts + .kvs::before,
#app .docsec > .sec-foot::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  border-top: 1px solid var(--line);
  pointer-events: none;
}
#app :is(.latest, .tally, .join > .join-opts,
  .join > .join-opts + .kvs, .docsec > .sec-foot) { position: relative; }
#app .docsec > .sec-foot { padding-top: 14px; }
/* LAYOUT-11 E / LAYOUT-12 A: multi pages share the flat-row layer above.
   Only forms, notices and dismissible onboarding retain their item surfaces. */
#app [data-page-type="multi"] .page-surface.page-surface {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 16px;
  margin: 10px 0;
  min-width: 0;
}
#app [data-page-type="multi"] .page-surface > :last-child { margin-bottom: 0; }
#app .intro .steps { margin: 0 0 var(--space-1); }
#app .intro .steps > li { padding: 8px 0; }
#app .intro .steps > li::before { content: none; }
/* LAYOUT-13 B+C: one shared marker-heading class, including disclosures.
   Counts are plain muted text; All is emitted only for explicit previews. */
#app .section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  max-height: 48px;
  padding: 0;
  margin: 0 0 var(--space-1);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  min-width: 0;
  width: 100%;
}
#app .section-head::before {
  content: "";
  flex: none;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--brand);
}
#app .section-title {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
#app .section-count, #app .section-all { flex: none; font-size: 13px; font-weight: 400; line-height: 22px; }
#app .section-count { color: var(--muted); }
#app .section-all { color: var(--brand); text-decoration: none; }
#app .section-all { display: grid; align-items: center; min-height: 44px; }
#app h3.section-head { margin-top: var(--space-3); }
#app .section-head:first-child { margin-top: 0; }
#app summary:has(> .section-head) { list-style: none; min-height: 44px; cursor: pointer; }
#app summary:has(> .section-head)::-webkit-details-marker { display: none; }
#app .dgroup-head:has(> .section-head) { padding: 0; }
#app .dgroup-head > .section-head { margin: 0; }
#app .sec-head { gap: 8px; }
#app .sec-head > .section-head { margin: 0; }
#app .search-section-head > .section-head { margin: 0; }
#app .page :is(.quiet, .intro, .topics-introduction) { margin-top: var(--space-4); }
#topbar, #tabbar { z-index: 6; }
@media (prefers-reduced-motion: reduce) {
  html, #app { scroll-behavior: auto; }
  #app > .page { animation: none; }
}
