/* TOTEM OS — pilot theme.
   VISUAL PARITY PASS: this sheet ports the Muse Space prototype's design
   language (troop-220-management-system/client/src/theme.css) onto the
   PWA's class system — warm paper surfaces, deep forest sidebar, amber
   accent, Archivo display type, pill badges, tinted alert cards, and a
   dark scheme that follows the OS. Vanilla CSS, no framework. */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&display=swap');

:root {
  /* prototype tokens */
  --bg: #f4f1e8;
  --surface: #fffdf6;
  --surface-2: #ece7d8;
  --ink: #1c2321;
  /* BUILD G (§52): #68736a measured 4.00:1 on --surface-2 and 4.38:1
     on --bg in the real-Chromium contrast audit — under the 4.5:1
     floor for the small text that wears it. #5d685d keeps the sage
     character and clears 4.5:1 on every light surface (4.71–5.73). */
  --muted: #5d685d;
  --line: #ddd6c3;
  --accent: #d97706;
  --accent-ink: #92400e;
  --accent-soft: #f9e8cd;
  --forest: #123524;
  --forest-2: #1b4332;
  --forest-ink: #e9f2e7;
  --sage: #8a9a8b;
  --rust: #b3402a;
  --rust-bg: #f9e9e3;
  --amber-bg: #fdf3e0;
  --green-bg: #e9f2e7;
  --radius: 12px;
  --font-display: "Archivo", system-ui, -apple-system, sans-serif;
  /* legacy aliases (older markup references) */
  --cream: var(--bg);
  --card: var(--surface);
  --gold: var(--accent);
  --gold-soft: var(--accent-soft);
  --forest-dark: var(--forest);
  --red: var(--rust);
  --red-bg: var(--rust-bg);
  --amber: var(--accent-ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1511;
    --surface: #182019;
    --surface-2: #212b22;
    --ink: #edf2ea;
    --muted: #9aa79c;
    --line: #2e3b30;
    --accent: #f2b33d;
    --accent-ink: #f2b33d;
    --accent-soft: #3a2f16;
    /* BUILD G (§52): --rust as TEXT on the dark surfaces measured
       2.63–2.92:1. The dark scheme gets a lighter rust for text;
       filled rust badges (.badge-new / .notif-badge) are pinned back
       to #b3402a in the Build G dark block below so their white
       labels keep 5.70:1. */
    --rust: #e8836b;
    --rust-bg: #3a2019;
    --amber-bg: #2e2410;
    --green-bg: #1d2f22;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  overflow-x: hidden;
}
h1, h2, h3, .big-num, .invite-code { font-family: var(--font-display); }
h1, h2, h3 { color: var(--forest); margin: 0 0 .4rem; letter-spacing: -.01em; }
@media (prefers-color-scheme: dark) { h1, h2, h3 { color: var(--forest-ink); } }
h2 { font-size: 1.375rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: .3rem 0 .7rem; }
a { color: var(--forest-2); }
@media (prefers-color-scheme: dark) { a { color: var(--accent); } }
small { color: var(--muted); }
/* BUILD G (§52): app.js has always emitted class="small" for
   secondary copy, but the class was never defined — those blocks
   rendered at full body size. The class is real now. */
.small { font-size: .85rem; line-height: 1.45; }
button { font: inherit; cursor: pointer; }
/* BUILD G (§52): the control floor is the 44px tap target
   (was 2.25rem/36px). Class-level rules that opt out on purpose
   (.cal-chip in the month grid, .linklike) still win. */
button, select, input:not([type="checkbox"], [type="radio"]) { min-height: 2.75rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

/* ---------- Splash ---------- */
#splash {
  min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(165deg, var(--forest-2) 0%, var(--forest) 70%);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 14px 40px;
}
.splash-card {
  background: var(--surface); border-radius: 20px; max-width: 860px; width: 100%;
  padding: 26px 22px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
  border-top: 6px solid var(--accent);
}
.splash-card h1 { font-size: 2.1rem; font-weight: 900; margin-bottom: .1rem; }
.brand-mark {
  font-size: 2.2rem; background: var(--accent); color: #fff;
  width: 62px; height: 62px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.brand-mark.small { width: 40px; height: 40px; font-size: 1.3rem; border-radius: 10px; margin: 0; }
/* BUILD BR2: the production v4 tile as an image (replaces the emoji
   brand-mark in the shell, splash and public site). The tile artwork
   is full-bleed forest, so the img itself carries the brand field. */
.brand-img {
  width: 62px; height: 62px; border-radius: 16px; display: block;
  margin-bottom: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.brand-img.small { width: 40px; height: 40px; border-radius: 10px; margin: 0; }
/* Level marks (BR2): the chevron (camp/youth surfaces) and the
   roundel (council/institutional surfaces), shown as cream brand
   plates per the brand guide. */
.lvl-mark { height: 46px; width: auto; border-radius: 9px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.lvl-mark.inline { height: 34px; }
.gov-letterhead { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gov-letterhead .brand-img { margin: 0; }
/* BUILD BR2: Governance Pack document body (in-app preview). The
   downloaded standalone document embeds the same rules with literal
   brand hex values (GOV_DOC_CSS in app.js) so the file is
   self-contained; keep the two in step. */
.gpdoc .gp-head { display: flex; gap: 14px; align-items: center; border-bottom: 3px solid var(--forest); padding-bottom: 12px; }
.gpdoc .gp-mark { width: 62px; height: 62px; border-radius: 16px; }
.gpdoc .gp-wm { font-family: var(--font-display); font-weight: 900; font-size: 1.55rem; color: var(--forest); line-height: 1.05; }
.gpdoc .gp-sub { font-weight: 700; color: var(--forest); }
.gpdoc .gp-meta { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.gpdoc .gp-h { font-family: var(--font-display); color: var(--forest); font-size: .98rem; border-bottom: 1px solid var(--line); padding-bottom: 3px; margin: 18px 0 6px; }
.gpdoc .gp-big { font-size: 1.3rem; font-weight: 800; color: var(--forest); }
.gpdoc .gp-risk { color: var(--rust); font-weight: 700; }
.gpdoc .gp-table { width: 100%; border-collapse: collapse; }
.gpdoc .gp-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.gpdoc .gp-small { color: var(--muted); font-size: .85rem; }
.gpdoc .gp-foot { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 9px; color: var(--muted); font-size: .8rem; }
.gpdoc p { margin: 4px 0; }
.splash-troop { font-weight: 600; color: var(--forest-2); margin: 0 0 .2rem; }
@media (prefers-color-scheme: dark) { .splash-troop { color: var(--forest-ink); } }
.splash-sub { color: var(--muted); max-width: 60ch; }
.persona-grid {
  display: grid; gap: 10px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
}
.persona-card {
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; width: 100%;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.persona-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(18,53,36,.16); transform: translateY(-1px); }
.persona-card strong { display: block; color: var(--forest); font-family: var(--font-display); }
@media (prefers-color-scheme: dark) { .persona-card strong { color: var(--forest-ink); } }
.persona-card .role { color: var(--forest-2); font-weight: 600; font-size: .88rem; }
@media (prefers-color-scheme: dark) { .persona-card .role { color: var(--sage); } }
.persona-card .tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.splash-foot { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--muted); font-size: .9rem; }
.auth-card { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.auth-msg { color: var(--rust); font-weight: 700; }

/* The `hidden` attribute MUST win over the display rules in this sheet.
   #app{display:flex} (below) otherwise overrides the UA [hidden] rule, so
   the "hidden" app shell still generates boxes while the splash is up —
   and its position:fixed mobile tab bar then paints an empty dark band
   across the bottom of the splash until sign-in populates it. */
#app[hidden], #splash[hidden], #public-site[hidden] { display: none !important; }
.linklike { background: none; border: none; color: var(--forest-2); text-decoration: underline; padding: 0; min-height: 0; }
@media (prefers-color-scheme: dark) { .linklike { color: var(--accent); } }

/* ---------- Badges & buttons ---------- */
.badge {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px; background: var(--green-bg); color: var(--forest-2);
  border: 1px solid var(--line); white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .badge { color: var(--forest-ink); } }
/* BUILD G (§52): white on --accent measured 3.19:1 (light) and
   1.86:1 (dark) — every amber-filled label now carries deep-brown
   text instead: 5.50:1 on the light amber, 9.42:1 on the dark. */
.badge-demo { background: var(--accent); color: #241703; border-color: var(--accent); }
.badge-gold { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.badge-red { background: var(--rust-bg); color: var(--rust); border-color: var(--rust); }
.badge-amber { background: var(--amber-bg); color: var(--accent-ink); border-color: var(--accent); }
.badge-new { background: var(--rust); color: #fff; border-color: var(--rust); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--forest); background: var(--forest);
  color: #fff; border-radius: 10px; padding: 7px 14px; font-weight: 600; text-decoration: none;
  min-height: 2.75rem;
}
.btn:hover { background: var(--forest-2); }
/* BUILD G (§52): gold buttons carry deep-brown text (see .badge-demo
   note) — hover brightens instead of darkening behind dark text. */
.btn-gold { background: var(--accent); border-color: var(--accent); color: #241703; }
.btn-gold:hover { background: var(--accent); filter: brightness(1.07); }
.btn-ghost { background: transparent; color: var(--forest-2); }
@media (prefers-color-scheme: dark) { .btn-ghost { color: var(--forest-ink); } }
.btn-ghost:hover { background: var(--green-bg); }
/* .btn-small is the deliberate dense-list variant: 40px floor so
   roster/table rows stay compact; primary .btn keeps the full 44. */
.btn-small { padding: 4px 10px; font-size: .88rem; border-radius: 8px; min-height: 2.5rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- App shell ---------- */
#app { display: flex; min-height: 100vh; min-height: 100dvh; }
#sidebar {
  width: 264px; flex: 0 0 264px; background: var(--forest); color: var(--forest-ink);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 14px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.side-brand { display: flex; gap: 10px; align-items: center; }
.side-brand strong { color: #fff; display: block; font-family: var(--font-display); font-weight: 800; }
.side-brand small { color: #bcd4c6; }
#side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
#side-nav::-webkit-scrollbar { width: 6px; }
#side-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 3px; }
#side-nav a {
  color: rgba(233,242,231,.85); text-decoration: none; padding: 9px 10px; border-radius: 10px; font-weight: 600;
}
#side-nav a:hover { background: rgba(255,255,255,.08); }
/* BUILD G (§52): the active pill is amber-filled — deep-brown text
   (white measured 3.19:1 / 1.86:1 on the two ambers). */
#side-nav a.active { background: var(--accent); color: #241703; font-weight: 700; }
#side-nav .nav-note { font-size: .8rem; color: #bcd4c6; padding: 8px 10px 0; }
.side-persona { border-top: 1px solid rgba(255,255,255,.18); padding-top: 12px; }
.side-persona .who { font-weight: 700; color: #fff; }
.side-persona .what { font-size: .85rem; color: #bcd4c6; margin-bottom: 8px; }
.side-persona .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); width: 100%; }
.side-persona .btn-ghost:hover { background: rgba(255,255,255,.12); }

#main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  display: none; align-items: center; gap: 10px; background: var(--forest); color: #fff;
  padding: 10px 14px; position: sticky; top: 0; z-index: 20;
}
#topbar .topbar-title { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
#topbar .topbar-title span { font-size: .78rem; color: #bcd4c6; }
/* BUILD G (§52): topbar chips were 25px tall — they are 36px now
   (shell chrome exception to the 44px in-view floor, documented in
   the Build G report; the bar itself cannot grow past this). */
.persona-chip { font-size: .8rem; background: rgba(255,255,255,.15); padding: 6px 10px; border-radius: 999px; white-space: nowrap; min-height: 2.25rem; display: inline-flex; align-items: center; }
/* §61 (found by the personas375 rig): the persona chip is a nowrap
   flex item — with min-width:auto its min-content (a long §46 label
   like the district/council seats') sets the topbar's minimum width
   and, on phone widths, widens the whole layout. The chip must be
   the flexible element: it shrinks and ellipsizes; the bell and the
   mode badge stay rigid. */
#topbar-persona { min-width: 0; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
#notif-bell, #mode-badge { flex: none; }
#topbar .topbar-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view { padding: 20px; max-width: 1080px; width: 100%; margin: 0 auto; }

#tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--forest); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
#tabbar a {
  color: #cfe2d7; text-decoration: none; font-size: .76rem; font-weight: 600;
  /* BUILD G (§52): each tab takes an equal share of the bar — the
     slots measured 39px wide before; they are ≥54px now. */
  flex: 1; min-height: 3.25rem; justify-content: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 8px; border-radius: 8px;
}
#tabbar a .tab-ico { font-size: 1.3rem; }
/* BUILD G (§52): active-tab amber on forest measured 4.22:1 in the
   light scheme; the bright amber clears it in both (7.24:1). */
#tabbar a.active { color: #f2b33d; }

/* ---------- Cards & sections ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(18,53,36,.05);
}
.card.red { border-color: var(--rust); background: var(--rust-bg); }
.card.amber { border-color: var(--accent); background: var(--amber-bg); }
.card.green { border-color: var(--forest-2); background: var(--green-bg); }
.card.gold { border-color: var(--accent); background: var(--amber-bg); }
.section-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 20px 0 8px; }
.section-title:first-child { margin-top: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.muted { color: var(--muted); }
.big-num { font-size: 1.6rem; font-weight: 800; color: var(--forest-2); }
@media (prefers-color-scheme: dark) { .big-num { color: var(--accent); } }
/* BUILD G (§52): progress must LOOK like progress — a taller bar,
   a lit amber gradient with a floor shadow, and a defined track.
   Static styling only; nothing here animates or re-renders. */
.progress { background: var(--surface-2); border-radius: 999px; height: 16px; overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(18,53,36,.18); border: 1px solid rgba(18,53,36,.10); }
.progress > div { background: linear-gradient(180deg, #e8930c, var(--accent)); height: 100%;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.25); border-radius: 999px; }
ul.tight { margin: .3rem 0 .6rem; padding-left: 1.15rem; }
ul.tight li { margin: .18rem 0; }
ol.tight { margin: .3rem 0 .6rem; padding-left: 1.15rem; }
.check-ok { color: var(--forest-2); font-weight: 700; }
.check-bad { color: var(--rust); font-weight: 700; }

/* feed */
.feed-item.unread { border-left: 5px solid var(--accent); }
.feed-item .meta { font-size: .85rem; color: var(--muted); }

/* forms & finder */
.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.filters label { font-size: .82rem; font-weight: 600; color: var(--forest); display: block; }
@media (prefers-color-scheme: dark) { .filters label { color: var(--forest-ink); } }
.filters input, .filters select, .chat-form input, input[type="search"], input[type="date"], input[type="text"], input[type="email"], input[type="password"] {
  margin-top: 3px; padding: 8px 9px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink); min-width: 0;
}
.filters input, .filters select { width: 100%; }
/* BUILD G (§52): placeholder text is real text for a first-time
   user — hold it to the same contrast as .muted (5.16–7.39:1)
   instead of the UA default gray (~2:1). */
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
/* BUILD G (§52): the whole checkline is the tap target — 44px tall
   with a 20px box, so a thumb lands on the row, not the glyph. */
.checkline { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: .9rem; min-height: 2.75rem; padding: 4px 0; }
.checkline input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.site-card .acts { color: var(--muted); font-size: .86rem; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  font-size: .8rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; color: var(--ink);
}
/* BUILD G (§52): chips that are CONTROLS (filter buttons) get the
   44px floor; display-only chips (recognition) keep label size. */
button.chip { min-height: 2.75rem; padding: 6px 14px; display: inline-flex; align-items: center; }
.chip.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.chip:hover { border-color: var(--accent); }
/* BUILD G (§52): rating stars are text — accent-ink, not accent
   (3.13:1 → 6.97:1 on surface). */
.star { color: var(--accent-ink); letter-spacing: .05em; }
.fav-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 12px; min-height: 2.75rem; }
.fav-btn.on { border-color: var(--accent); background: var(--accent-soft); }

/* tables */
.table-wrap, .tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
th { background: var(--surface-2); color: var(--forest); font-family: var(--font-display); font-size: .82rem; }
@media (prefers-color-scheme: dark) { th { color: var(--forest-ink); } }
tr.never-row td { background: var(--rust-bg); font-weight: 700; color: var(--rust); }
tr.inactive-row td { opacity: .55; }

/* media */
.album-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.album-cover {
  height: 110px; border-radius: 10px; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--forest-2), var(--forest));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; text-align: center; padding: 8px;
}
.album-cover-img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; display: block; }
.media-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
.media-tile {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); margin: 0;
}
.media-tile .tile-art {
  height: 84px; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; color: #fff;
  background: linear-gradient(135deg, var(--sage), var(--forest));
}
.tile-img { width: 100%; height: 96px; object-fit: cover; display: block; }
.media-tile figcaption { padding: 7px 9px; font-size: .8rem; color: var(--muted); }
.attach-btn { cursor: pointer; }

/* chat (§18 messenger) */
.hub-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 12px; align-items: start; }
.chan-list { display: flex; flex-direction: column; gap: 6px; }
.chan-item {
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; width: 100%;
}
.chan-item:hover { border-color: var(--accent); }
.chan-item.on { border-color: var(--accent); background: var(--amber-bg); }
.chan-name { display: block; font-weight: 700; font-family: var(--font-display); color: var(--forest); }
@media (prefers-color-scheme: dark) { .chan-name { color: var(--forest-ink); } }
.chan-prev { display: block; font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble-wrap { display: flex; flex-direction: column; gap: 3px; margin: 10px 0; }

/* FIX-H1 — the new-conversation people picker: grouped, searchable,
   big touch rows (WhatsApp shape, §30 tags on every row). */
.pick-sec { margin: 14px 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pick-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.pick-row:hover { background: var(--green-bg); }
.pick-row .pick-check { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; accent-color: var(--forest-2); }
.pick-ava { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: var(--forest); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem; }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-main strong { font-size: .98rem; }
.pick-main small { color: var(--muted); font-size: .82rem; }
.pick-chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; min-height: 2.75rem; font-size: .88rem; font-weight: 600; cursor: pointer; }
.pick-chip:hover { background: var(--green-bg); }

/* FIX-H2 — the "new messages" pill floats at the thread's lower
   edge (above the mobile tab bar); it never moves the reader. */
.hub-new-pill { position: sticky; bottom: 84px; display: block; margin: 6px 0 6px auto; width: max-content; z-index: 5; box-shadow: 0 4px 14px rgba(18,53,36,.35); }
@media (min-width: 861px) { .hub-new-pill { bottom: 16px; } }

/* FIX-H1 — at phone size the picker is a full-height sheet. */
@media (max-width: 640px) {
  .chat-new-panel { position: fixed; inset: 0; z-index: 50; overflow-y: auto; border-radius: 0; margin: 0; }
  .pick-row { min-height: 60px; }
  .pick-ava { width: 44px; height: 44px; flex-basis: 44px; }
}
.bubble {
  background: var(--surface-2); border-radius: 14px; padding: 8px 12px;
  max-width: 78%; align-self: flex-start; overflow-wrap: anywhere;
}
.bubble.mine { background: var(--forest); color: #fff; align-self: flex-end; }
.bubble-head { font-size: .78rem; color: var(--muted); margin: 8px 2px 2px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; max-width: 46rem; }
.msg .who { font-weight: 700; color: var(--forest); font-size: .88rem; }
.msg .when { color: var(--muted); font-size: .8rem; font-weight: 400; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { margin-top: 0; flex: 1; min-width: 0; } /* §50 F-13c: flex items do not shrink below content size by default — at <=375px the composer row could overflow; min-width:0 lets the input yield */

/* HUB-XL (§47): full messaging — actions, reactions, threads, notices */
.chan-unread {
  background: var(--accent); color: #241703; border-radius: 999px;
  font-size: .72rem; font-weight: 700; padding: 1px 7px; vertical-align: 2px;
}
.chan-pin { display: block; font-size: .78rem; color: var(--forest); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-color-scheme: dark) { .chan-pin { color: var(--forest-ink); } }
.bubble.notice { border: 2px solid var(--accent); }
.bubble.tombstone { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.bubble-jump { box-shadow: 0 0 0 3px var(--accent); }
.bubble .chat-img { display: block; max-width: 240px; width: 100%; border-radius: 10px; margin-bottom: 6px; }
.chat-file {
  display: inline-block; background: var(--amber-bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; margin-bottom: 6px; font-size: .85rem;
}
.quote-block {
  display: block; width: 100%; text-align: left; margin-bottom: 6px;
  background: var(--amber-bg); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 5px 9px; font-size: .8rem; color: var(--muted);
}
.quote-block strong { color: var(--forest); }
@media (prefers-color-scheme: dark) { .quote-block strong { color: var(--forest-ink); } }
.fwd-tag { font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.edited-mark { color: var(--muted); font-size: .72rem; }
.bubble.mine .edited-mark { color: rgba(255,255,255,.75); }
.msg-actions { display: flex; flex-wrap: wrap; gap: 2px; margin: 1px 2px 7px; }
/* BUILD G (§52): message actions are the Hub's working surface for
   thumbs — they were ~36px tall with 12px text. Full 44px targets,
   readable labels; the row wraps exactly as before. */
.msg-act {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .78rem; padding: 6px 8px; border-radius: 8px;
  min-height: 2.75rem; display: inline-flex; align-items: center;
}
.msg-act:hover { background: var(--amber-bg); color: var(--forest); }
.react-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 2px 4px; }
.react-chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 11px; font-size: .82rem; cursor: pointer;
  min-height: 2.5rem; display: inline-flex; align-items: center;
}
.react-chip.on { border-color: var(--accent); background: var(--amber-bg); }
.react-picker {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; margin: 2px 2px 8px; max-width: 78%;
}
.react-pick {
  background: none; border: 1px solid transparent; border-radius: 8px;
  font-size: 1.05rem; padding: 6px 7px; cursor: pointer;
  min-width: 2.75rem; min-height: 2.75rem;
}
.react-pick:hover, .react-pick.on { border-color: var(--accent); background: var(--amber-bg); }
.readby { font-size: .78rem; color: var(--muted); margin: 2px 2px 6px; }
/* BUILD G (§52): accent-ink — the amber alone measured 3.13:1. */
.readby .waiting { color: var(--accent-ink); font-weight: 600; }
.pin-strip {
  background: var(--amber-bg); border: 1px solid var(--accent); border-radius: 10px;
  padding: 7px 12px; margin: 10px 0 4px; font-size: .86rem;
}
.pin-row { padding: 2px 0; }
.thread-box {
  border-left: 3px solid var(--line); margin: 2px 2px 10px 14px; padding: 4px 0 2px 10px;
}
.thread-head { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.comment { font-size: .88rem; padding: 3px 0; }
.comment-form { margin-top: 6px; }
.reply-banner {
  background: var(--amber-bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; margin-top: 10px; font-size: .84rem;
}
.attach-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-top: 8px;
}
.attach-thumb { background: none; border: 2px solid transparent; border-radius: 10px; padding: 0; cursor: pointer; }
.attach-thumb:hover { border-color: var(--accent); }
.attach-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.fwd-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; margin: 2px 2px 10px; font-size: .86rem;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.hub-search .search-results { margin-top: 8px; }
.search-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--line);
}
.member-dir { margin: 10px 0; }
.member-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 6px 0; border-top: 1px solid var(--line);
}
.hub-filter-row { margin: 8px 0 2px; }

/* calendar (§20 month grid) */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-family: var(--font-display); font-weight: 700; font-size: .78rem; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-day {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  min-height: 92px; padding: 5px; display: flex; flex-direction: column; gap: 3px; overflow: hidden;
}
.cal-day.other { opacity: .4; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-num { font-weight: 700; font-size: .84rem; font-family: var(--font-display); }
/* BUILD G (§52): calendar chips are the one documented exception to
   the 44px floor (a month cell cannot hold 44px event rows) — so
   their TEXT carries the accessibility instead: type bumped and
   every category fill now clears 4.5:1 under white text in both
   schemes (meetings were 2.97:1, daytrips 3.19:1 / 1.86:1 dark). */
.cal-chip {
  display: block; font-size: .7rem; font-weight: 700; line-height: 1.25; text-decoration: none;
  border: none; border-radius: 6px; padding: 2px 5px; color: #fff; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 0; width: 100%;
}
.cal-chip.cat-meetings { background: #5f7263; }
.cal-chip.cat-campouts { background: var(--forest-2); }
.cal-chip.cat-daytrips { background: #b45309; }
.cal-chip.cat-ceremonies { background: var(--accent-ink); }
.cal-chip.cat-committee { background: var(--muted); }
/* FIX-C1 (§70): the generic event types get category fills of their
   own — literal hexes, so white chip text clears 4.5:1 in BOTH
   schemes without dark pins (service 5.47 · fundraisers 8.24 ·
   training 6.70 · other 8.41, WCAG-computed at build time). */
.cal-chip.cat-service { background: #0f766e; }
.cal-chip.cat-fundraisers { background: #86198f; }
.cal-chip.cat-training { background: #1d4ed8; }
.cal-chip.cat-other { background: #5d4a36; }
@media (prefers-color-scheme: dark) {
  /* the dark tokens for these two categories are light ambers /
     sages — pin the fills that keep white text at 4.5:1+ */
  .cal-chip.cat-ceremonies { background: #92400e; }
  .cal-chip.cat-committee { background: #5d685d; }
}
.cal-chip.span-mid { opacity: .65; border-radius: 0; }
.cal-chip.span-start { border-radius: 6px 0 0 6px; }
.cal-chip.span-end { border-radius: 0 6px 6px 0; }

/* patrol menu slots (§23) */
.slot { border-top: 1px dashed var(--line); padding: 10px 0 4px; }
.slot:first-of-type { border-top: none; }
.slot-row { padding: 3px 0; align-items: center; }

/* admin (§22) */
.invite-code {
  font-size: 1.7rem; font-weight: 900; letter-spacing: .14em; text-align: center;
  border: 2px dashed var(--accent); background: var(--amber-bg); color: var(--accent-ink);
  border-radius: 12px; padding: 14px 8px; margin: 10px 0;
}

/* modal (share sheet + dialogs) */
#modal-root:not(:empty) {
  position: fixed; inset: 0; background: rgba(10, 25, 18, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60;
}
.modal {
  background: var(--surface); color: var(--ink); border-radius: 16px; max-width: 520px; width: 100%;
  max-height: 86vh; max-height: 86dvh; overflow-y: auto; padding: 20px;
  border-top: 6px solid var(--accent);
}

@media (max-width: 860px) {
  #sidebar { display: none; }
  #topbar { display: flex; }
  #tabbar { display: flex; }
  #view { padding: 14px 12px 92px; }
  /* Deep review (Nov 13, 2026): on a phone the OPEN conversation —
     messages + composer — comes FIRST; the channel list stacks
     below it. Before this, the list rendered above the conversation,
     so the composer sat a full list + history scroll away and the
     Hub read as "you can view, but you can't chat". */
  .hub-wrap { display: flex; flex-direction: column; }
  .hub-wrap .chan-view { order: -1; }
  .cal-day { min-height: 64px; }
  .cal-chip { font-size: .64rem; }
  /* BUILD G (§52): denser cells on phones, same 7px rhythm. */
  table { font-size: .88rem; }
  th, td { padding: 6px 7px; }
}
@media (min-width: 861px) {
  #view { padding-bottom: 28px; }
}

/* Roster print: the meeting-night binder view */
@media print {
  #sidebar, #topbar, #tabbar, .btn, #modal-root, .no-print, #nav-drawer, #drawer-backdrop { display: none !important; }
  body { background: #fff; }
  #view { padding: 0; max-width: none; }
  .card { border-color: #999; box-shadow: none; break-inside: avoid; }
}

/* ---------- Mega Build #2 additions ---------- */
textarea {
  padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: var(--surface); color: var(--ink);
}
select { font: inherit; max-width: 100%; }
#persona-select, #unit-switch, #add-member-sel {
  padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); min-height: 2.25rem;
}
.about-card {
  margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px;
}
.about-card h3 { margin-bottom: .3rem; }
.unit-switch-label { display: block; font-size: .78rem; color: #bcd4c6; margin: 8px 0 4px; }
#unit-switch { width: 100%; margin-bottom: 8px; background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
#unit-switch option { color: #1c2321; }
.side-brand .badge { vertical-align: middle; margin-left: 6px; }
/* announcement comments (§33) */
.cmt-wrap { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.cmt { font-size: .9rem; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }
.cmt.hidden-cmt { background: transparent; color: var(--muted); }
/* trip packet */
.packet .card { break-inside: avoid; }

/* ---------- FIX BUILD (F6/F7) — grouped nav + mobile drawer ---------- */
/* Area headers inside the sidebar/drawer nav (Site Map v0.2 areas):
   visible headers, never collapsible — every item stays one tap away. */
#side-nav .nav-group, #drawer-nav .nav-group {
  font-family: var(--font-display); font-size: .68rem; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase; color: #9fc3ab;
  padding: 13px 10px 3px;
}
#side-nav .nav-group:first-child, #drawer-nav .nav-group:first-child { padding-top: 2px; }
/* The persona name in the sidebar is the door to My Profile (F7). */
.side-persona a.who-link { color: #fff; text-decoration: none; font-weight: 700; display: block; }
.side-persona a.who-link:hover { color: var(--accent); }
a.persona-chip { color: #fff; text-decoration: none; }
a.persona-chip:hover { background: rgba(255,255,255,.28); }

/* Hamburger (☰): lives in the top bar, which only renders on mobile. */
#nav-burger {
  background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff;
  border-radius: 10px; font-size: 1.25rem; line-height: 1; padding: 7px 12px;
  min-width: 46px; min-height: 44px; flex: 0 0 auto;
}
#nav-burger:hover { background: rgba(255,255,255,.14); }

/* Slide-in LEFT drawer with the complete navigation. */
#drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10, 25, 18, .55); z-index: 44;
}
#nav-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 45;
  width: min(302px, 86vw); background: var(--forest); color: var(--forest-ink);
  display: flex; flex-direction: column; gap: 12px; padding: 16px 12px;
  overflow-y: auto; box-shadow: 6px 0 24px rgba(0,0,0,.35);
  animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(-24px); opacity: .4; } to { transform: none; opacity: 1; } }
#nav-drawer[hidden], #drawer-backdrop[hidden] { display: none !important; }
.drawer-head { display: flex; align-items: center; gap: 10px; }
.drawer-head strong { color: #fff; font-family: var(--font-display); font-weight: 800; flex: 1; }
#drawer-close {
  background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff;
  border-radius: 8px; min-width: 44px; min-height: 44px; font-size: 1rem;
}
#drawer-close:hover { background: rgba(255,255,255,.14); }
#drawer-nav { display: flex; flex-direction: column; gap: 2px; }
#drawer-nav a {
  color: rgba(233,242,231,.85); text-decoration: none; padding: 9px 10px; border-radius: 10px; font-weight: 600;
}
#drawer-nav a:hover { background: rgba(255,255,255,.08); }
#drawer-nav a.active { background: var(--accent); color: #241703; font-weight: 700; }
#drawer-nav .nav-note { font-size: .8rem; color: #bcd4c6; padding: 8px 10px 0; }
.drawer-foot { border-top: 1px solid rgba(255,255,255,.18); padding-top: 12px; margin-top: auto; }
.drawer-foot .who { font-weight: 700; color: #fff; }
.drawer-foot .what { font-size: .85rem; color: #bcd4c6; margin-bottom: 8px; }
.drawer-foot a.who-link { color: #fff; text-decoration: none; font-weight: 700; display: block; }
.drawer-foot a.who-link:hover { color: var(--accent); }
.drawer-profile-link { display: block; text-align: center; margin-bottom: 10px; }
.drawer-foot .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); width: 100%; }
.drawer-foot .btn-ghost:hover { background: rgba(255,255,255,.12); }
#unit-switch-drawer { width: 100%; margin-bottom: 8px; background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
#unit-switch-drawer option { color: #1c2321; }

/* My Profile (F7) */
.profile-toggles { display: flex; flex-direction: column; gap: 8px; }
.profile-toggles .checkline { font-weight: 500; }

/* Notification Center + push (Adoption Build) */
.notif-bell { position: relative; text-decoration: none; }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--rust); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.notif-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.notif-row:last-child { border-bottom: none; }
.notif-row.unread { background: var(--accent-soft); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.notif-row .notif-main { flex: 1; min-width: 0; }
.notif-row .notif-title { font-weight: 600; }

/* Test-mode checkout (Adoption Build) */
.testmode-banner { background: var(--rust-bg); color: var(--rust); border: 1px solid var(--rust);
  border-radius: 10px; padding: 9px 12px; font-weight: 700; margin-bottom: 10px; }
.pay-proc { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.pay-due { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-due:last-child { border-bottom: none; }

/* ---------- IA BUILD (§§39/41/45) — module doors, drawer accordions ---------- */
/* The entry screen's five module doors: big, tappable, one identity each. */
.door-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); margin-top: 10px; }
.door-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--forest-2);
  border-radius: 14px; padding: 14px; cursor: pointer; color: var(--ink); font: inherit;
  box-shadow: 0 1px 2px rgba(18,53,36,.05);
}
.door-card:hover { border-color: var(--accent); border-top-color: var(--accent); }
.door-card .door-ico { font-size: 1.6rem; line-height: 1; }
.door-card strong { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.door-card small { color: var(--muted); line-height: 1.35; }

/* Drawer accordions (§45): headers are buttons; a collapsed group's
   items leave the flow entirely. The desktop sidebar is untouched. */
#drawer-nav .drawer-group-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: transparent; border: none; cursor: pointer; font: inherit; text-align: left;
}
#drawer-nav .drawer-group-head:hover { background: rgba(255,255,255,.08); border-radius: 8px; }
#drawer-nav .drawer-caret { font-size: .8rem; opacity: .85; }
#drawer-nav .drawer-items { display: flex; flex-direction: column; gap: 2px; }
#drawer-nav .drawer-items.collapsed { display: none; }
#drawer-nav .drawer-items a { padding-left: 18px; }

/* ---------- SCOUT EXPERIENCE (§49) — sash, rings, points, polls ---------- */
/* My Sash: the sash band is a deep-green diagonal field; earned
   medallions sit on it in full color, in-progress carry their
   count, goals are grayed and locked — the same story the real
   sash tells across a Scout's shoulder. */
.sash-band {
  display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 14px;
  background: linear-gradient(115deg, var(--forest) 0%, var(--forest-2) 55%, #265c40 100%);
  border-radius: 12px;
  /* BUILD G (§52): the sash gets its gold edge — the band should
     read as regalia, not as a dark card. */
  border-top: 4px solid var(--accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 3px 10px rgba(18,53,36,.25);
}
.medal {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 104px; padding: 10px 6px 8px; border-radius: 10px; text-align: center;
  background: var(--surface); border: 2px solid var(--gold);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.medal .medal-disc {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1.05rem; letter-spacing: .02em;
  /* BUILD G (§52): a struck-metal highlight — light from above,
     weight below — so an earned disc reads as an object, not a dot. */
  border: 2px solid rgba(255,255,255,.65);
  box-shadow: inset 0 4px 7px rgba(255,255,255,.38), inset 0 -4px 0 rgba(0,0,0,.22), 0 2px 4px rgba(0,0,0,.25);
}
.medal.progress .medal-disc { outline: 2px dashed var(--accent); outline-offset: 2px; }
.medal .medal-name { font-size: .82rem; font-weight: 700; line-height: 1.2; }
.medal .medal-sub { font-size: .74rem; color: var(--muted); line-height: 1.25; }
.medal.progress { border-style: dashed; }
.medal.goal { opacity: .55; filter: grayscale(1); border-color: var(--line); box-shadow: none; }
.chip.recog { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }

/* Rank path: earned lit, current highlighted, next glowing. */
.rank-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rank-step { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: .85rem; }
.rank-step.earned { background: var(--forest-2); color: var(--forest-ink); border-color: var(--forest-2); }
/* BUILD G (§52): the current rank glows — a static halo, no motion. */
.rank-step.current { border-color: var(--accent); background: var(--accent-soft); font-weight: 800;
  box-shadow: 0 0 0 2px var(--accent), 0 2px 10px rgba(217,119,6,.35); }
.rank-step.next { border: 2px dashed var(--accent); font-weight: 700; }
.rank-arrow { color: var(--muted); }

/* Stat rings: SVG circles stroked in forest, closing on gold. */
.ring-row { display: flex; flex-wrap: wrap; gap: 18px; }
.ring-cell { text-align: center; min-width: 108px; }
.ring { transform: rotate(0deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .ring-bg { stroke: var(--line); }
.ring .ring-fg { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 46px 46px;
  filter: drop-shadow(0 1px 2px rgba(217,119,6,.45)); }
.ring text { text-anchor: middle; fill: var(--ink); }
.ring .ring-num { font-size: 1.35rem; font-weight: 800; }
.ring .ring-of { font-size: .68rem; fill: var(--muted); }
.ring-label { font-weight: 700; font-size: .88rem; margin-top: 2px; }

/* "Your call" — one consistent chip on every binding youth choice. */
.your-call { font-size: .8rem; padding: 4px 10px; }
/* BUILD G (§52): the your-call chip is a SENTENCE wearing .badge's
   nowrap — it measured 490px wide in a 351px column at 375×812 and
   clipped mid-word on the Sash (and every other youth surface that
   carries it). Labels keep nowrap; this one wraps. */
.badge.your-call { white-space: normal; line-height: 1.35; }

/* Patrol Points board: earned-only standings + transparent math. */
.pts-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.pts-row:last-of-type { border-bottom: none; }
.pts-total { font-size: 1.2rem; font-weight: 800; color: var(--accent-ink); }
.pts-cats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: .82rem; color: var(--muted); }
.pts-settings { margin-top: 10px; }
.pts-settings input { min-width: 200px; }

/* In-channel poll (rendered inside the message bubble flow). */
.poll-box { border: 1px solid var(--accent); background: var(--accent-soft);
  border-radius: 10px; padding: 10px 12px; margin: 6px 0; max-width: 560px; }
.poll-q { font-weight: 800; margin-bottom: 6px; }
.poll-panel input[type="text"] { flex: 1; min-width: 140px; }

/* ---------- BUILD D: CAMP STAFF (§42) ---------- */
/* The lead pin at the top of camp-staff navigation: your workspace
   first, everything else after. */
/* BUILD G (§52): accent-ink text (was accent: 2.89:1 on accent-soft). */
.nav-lead { display:block; font-weight:800; color:var(--accent-ink, #92400e);
  background:var(--accent-soft, #e3f2ec); border:1px solid var(--accent, #0b5e43);
  border-radius:10px; padding:8px 10px; margin:0 0 8px; text-decoration:none; }

/* ---- Values & Content Build (§51) ---- */
/* BUILD G (§52): themed surface instead of the unthemed --soft
   fallback (a fixed light panel in both schemes), and accent-ink
   for the summary — accent measured 2.98:1 there. */
.learnit { border:1px dashed var(--line, #cbd5c0); border-radius:10px;
  padding:6px 10px; margin:6px 0; background:var(--surface-2); }
.learnit summary { cursor:pointer; font-weight:700; color:var(--accent-ink, #92400e); }
.learnit ol { margin:6px 0 6px 18px; }
.ev-block { border-left:4px solid var(--gold, #b8860b); background:var(--accent-soft, #fdf6e0);
  border-radius:6px; padding:6px 10px; margin:6px 0; font-size:.92em; }
.req-block { border-top:1px solid var(--line, #e2e8d5); padding:8px 0; }
.req-block:first-of-type { border-top:none; }

/* ---- Platform Build (§54): hat switcher + consent form ---- */
.hat-switch { margin-top: 10px; }
.hat-label { font-size: .78rem; font-weight: 700; opacity: .85; margin-bottom: 5px; }
.consent-form { margin-top: 10px; border-top: 1px dashed var(--line, #d8d2c0); padding-top: 10px; }
.consent-form .checkline { margin: 7px 0; align-items: flex-start; }
.consent-form .checkline input { margin-top: 3px; }

/* ---------- Public site (Build P / §55) ----------
   The unit's pre-login page. It renders in its own top-level
   section, outside the member shell, from whitelisted data only. */
#public-site { min-height: 100vh; min-height: 100dvh; }
.pub-wrap { max-width: 880px; margin: 0 auto; padding: 20px 16px 56px; }
.pub-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pub-brand { display: flex; align-items: center; gap: 10px; color: var(--forest); font-family: var(--font-display); font-size: 1.15rem; }
@media (prefers-color-scheme: dark) { .pub-brand { color: var(--forest-ink); } }
.pub-hero {
  background: var(--forest); color: var(--forest-ink); border-radius: 18px;
  padding: 28px 24px; margin-bottom: 14px;
}
.pub-hero h1 { margin: 0 0 6px; font-size: 2rem; color: #fff; }
/* BUILD G (§52): bright amber on the forest hero — 7.24:1 in both
   schemes (the mid amber measured 4.22:1 in light). */
.pub-hero .pub-meeting { font-weight: 700; color: #f2b33d; }
.pub-hero p { max-width: 62ch; }
.pub-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 8px; }
.pub-photos figure { margin: 0; }
.pub-photos img { width: 100%; height: 128px; object-fit: cover; border-radius: 10px; display: block; }
.pub-photos figcaption { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.pub-event { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pub-event:last-child { border-bottom: none; }
.pub-event .pub-date { font-weight: 700; color: var(--forest-2); white-space: nowrap; }
@media (prefers-color-scheme: dark) { .pub-event .pub-date { color: var(--sage); } }
.pub-foot { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 14px; color: var(--muted); font-size: .86rem; }
.pub-flash { border: 1px solid var(--accent); background: var(--amber-bg); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }

/* ---------- BUILD G (§52) — accessibility floor, consolidated ----------
   Everything in this block was measured in the real-Chromium
   contrast audit (hidden_files/hub-real-scratch/buildg375.cjs):
   computed foreground vs effective background, both schemes. */
/* Dark-scheme leftovers the per-selector overrides never reached:
   .check-ok wore forest-2 on the dark surface (1.51:1) and .msg .who
   wore forest (1.24:1). --rust text is fixed at the token (above);
   these two have no token of their own. */
@media (prefers-color-scheme: dark) {
  .check-ok { color: #93c48d; }
  .msg .who { color: var(--forest-ink); }
  /* The dark --rust is a TEXT rust now; the two filled rust badges
     keep the deep fill so their white labels stay at 5.70:1. */
  .badge-new, .notif-badge { background: #b3402a; }
}
/* Focus must stay visible inside the forest chrome: pull the ring
   inside the element, where the amber cannot be clipped by the
   sidebar/tab-bar edge. */
#tabbar a:focus-visible, #side-nav a:focus-visible, #drawer-nav a:focus-visible { outline-offset: -3px; }
/* Reduced motion: the sheet's only animations are the drawer slide
   and hover transitions; honor the OS setting and still them all.
   (Any future animation is transform/opacity only, per §52.) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- FIX-H4 (§89) — mobile Hub proportion repair ----------
   Carlos's iPhone verdict on v26: the chat WORKED but read
   oversized and the conversation was buried under administration.
   Four repairs: (1) iOS text inflation off; (2) the thread gets a
   real chat header (back + name/counts + Members toggle); (3) on a
   phone the Hub is two screens — list XOR thread — with the live
   composer pinned above the tab bar; (4) per-message actions
   collapse behind one ••• affordance. Proportion guards below are
   width-independent: no Hub element may stretch the page. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

.chan-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 4px; }
.chan-head-main { flex: 1; min-width: 0; }
.chan-head-main h3 { margin: 2px 0 0; overflow-wrap: anywhere; }
.chan-head-main small { color: var(--muted); }
.hub-back-btn {
  display: none; background: transparent; border: 1px solid var(--line); color: var(--forest-2);
  border-radius: 10px; font-size: 1.15rem; line-height: 1; min-width: 44px; min-height: 44px;
  flex: 0 0 auto; align-items: center; justify-content: center; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .hub-back-btn { color: var(--forest-ink); } }
.chan-members-btn { flex: 0 0 auto; }
.msg-menu-btn { display: none; }
.member-add { margin-top: 10px; }
.member-add select { flex: 1; min-width: 0; }

/* Proportion guards (the §89 overflow class): long §46 labels and
   member strings wrap inside their boxes instead of widening the
   layout. .member-row's text cell previously had flex min-width
   auto, so a nowrap badge + long label set the row's min-content
   and clipped at the card edge. */
.member-row > div { min-width: 0; overflow-wrap: anywhere; }
.bubble-head { overflow-wrap: anywhere; }
.search-row > div { min-width: 0; overflow-wrap: anywhere; }
.chan-item { min-width: 0; }

@media (max-width: 640px) {
  /* Two screens: the root class picks list XOR thread. */
  .hub-root .hub-wrap { display: block; }
  .hub-root:not(.hub-thread-open) .chan-view { display: none; }
  .hub-root.hub-thread-open .hub-chrome,
  .hub-root.hub-thread-open .chan-list { display: none; }
  .hub-back-btn { display: inline-flex; }
  /* Message actions: hidden until the ••• menu opens them. */
  .msg-menu-btn { display: inline-flex; }
  .msg-actions-main { display: none; }
  .msg-actions-main.open {
    display: flex; flex-direction: column; align-items: stretch;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    padding: 4px; box-shadow: 0 4px 14px rgba(18,53,36,.18);
  }
  .msg-actions-main.open .msg-act { justify-content: flex-start; }
  /* The live composer is the thread screen's bottom bar: pinned
     above the tab bar (bar ≈ 64px + safe area), messages scroll
     under it, and the card carries bottom room so the last bubble
     is never hidden behind it. */
  .hub-thread-open .chan-composer.is-live {
    position: fixed; left: 0; right: 0; z-index: 26;
    bottom: calc(70px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 8px 12px; box-shadow: 0 -4px 16px rgba(18,53,36,.14);
  }
  .hub-thread-open .chan-composer.is-live .chat-form,
  .hub-thread-open .chan-composer.is-live .reply-banner { margin-top: 0; }
  .hub-thread-open .chan-composer.is-live .reply-banner { margin-bottom: 6px; }
  .hub-thread-open .chan-view.has-live-composer { padding-bottom: 112px; }
  /* The ↓ New messages pill sticks above the pinned composer. */
  .hub-thread-open .hub-new-pill { bottom: 158px; }
}
