/* VTOS — palette from the ViPrs logo: slate #39474F, steel #AAB2B8, crimson #D7143C. */

:root {
  --slate-900: #1f272c;
  --slate-800: #2b363c;
  --slate-700: #39474f;
  --slate-600: #4d5d66;
  --slate-500: #66767f;
  --steel-400: #8e979d;
  --steel-300: #aab2b8;
  --steel-200: #cfd5d9;
  --steel-100: #e7ebed;
  --steel-50: #f4f6f7;
  --crimson-700: #a80f2f;
  --crimson-600: #c01236;
  --crimson-500: #d7143c;
  --crimson-100: #fbe3e8;

  --bg: var(--steel-50);
  --surface: #ffffff;
  --surface-2: var(--steel-100);
  --border: var(--steel-200);
  --text: var(--slate-900);
  --text-2: var(--slate-600);
  --text-3: #5d6c75;  /* 4.5:1 on --surface-2 (slate-500 was 4.3:1 on the page) */
  --accent: var(--crimson-500);
  --chart: var(--slate-600);  /* single-series charts (Insights): not a status color */
  --accent-strong: var(--crimson-600);
  --accent-soft: var(--crimson-100);
  --accent-text: var(--crimson-700);
  --nav-bg: var(--slate-700);
  --nav-text: #ffffff;
  --nav-muted: var(--steel-200);  /* menu labels: 6.5:1 on the slate bar */
  --btn-primary: var(--crimson-500);  /* white text: 5.2:1 */
  --btn-primary-hover: var(--crimson-600);
  --on-good: #ffffff;  /* tick on a --good fill */
  --header-h: 59px;  /* the sticky header's height; static/web/shell.js measures it */
  --good: #1f7a4d;
  --good-soft: #dff3e8;
  --warn: #8a5a00;
  --warn-soft: #fbefd5;
  --bad: var(--crimson-700);
  --bad-soft: var(--crimson-100);
  --focus: #2f6fdb;
  --shadow: 0 1px 2px rgb(31 39 44 / 0.06), 0 1px 3px rgb(31 39 44 / 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Syntax highlighting on code pages (Pygments classes) */
  --code-keyword: #a3123a;
  --code-string: #1f6a3f;
  --code-comment: #6b7780;
  --code-number: #8a4b00;
  --code-name: #1d4f9a;
  --code-annotation: #6d3fa0;
  color-scheme: light;
}

/* Dark: follows the device unless the user picked a theme in Settings (html[data-theme]). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161c20;
    --surface: #1f272c;
    --surface-2: #2b363c;
    --border: #39474f;
    --text: #eef1f3;
    --text-2: #b9c1c6;
    --text-3: #9aa3a9;
    --btn-primary: var(--crimson-600);
    --btn-primary-hover: var(--crimson-700);
    --on-good: #10261b;
    --accent: #ef3d62;
    --chart: var(--steel-300);
    --accent-strong: #f25a7a;
    --accent-soft: #3d1a22;
    --accent-text: #ff8fa6;
    --nav-bg: #11171a;
    --good: #6fd3a0;
    --good-soft: #17352a;
    --warn: #f0c065;
    --warn-soft: #3a2f16;
    --bad: #ff8fa6;
    --bad-soft: #3d1a22;
    --focus: #7aa7ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --code-keyword: #ff8fa6;
    --code-string: #8fd9a8;
    --code-comment: #8d989f;
    --code-number: #f0c065;
    --code-name: #8ab4ff;
    --code-annotation: #c9a6ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161c20;
  --surface: #1f272c;
  --surface-2: #2b363c;
  --border: #39474f;
  --text: #eef1f3;
  --text-2: #b9c1c6;
  --text-3: #9aa3a9;
  --btn-primary: var(--crimson-600);
  --btn-primary-hover: var(--crimson-700);
  --on-good: #10261b;
  --accent: #ef3d62;
  --chart: var(--steel-300);
  --accent-strong: #f25a7a;
  --accent-soft: #3d1a22;
  --accent-text: #ff8fa6;
  --nav-bg: #11171a;
  --good: #6fd3a0;
  --good-soft: #17352a;
  --warn: #f0c065;
  --warn-soft: #3a2f16;
  --bad: #ff8fa6;
  --bad-soft: #3d1a22;
  --focus: #7aa7ff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --code-keyword: #ff8fa6;
  --code-string: #8fd9a8;
  --code-comment: #8d989f;
  --code-number: #f0c065;
  --code-name: #8ab4ff;
  --code-annotation: #c9a6ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
/* Nothing may make the page wider than the screen: on iPhones a page that
   pans sideways also lets the fixed bottom menu drift up the page. "clip",
   not "hidden", so the sticky header keeps working. */
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
}
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0; color: var(--text); }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0; }
small, .muted { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* "Skip to content": the first thing a keyboard user tabs to. */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-weight: 650; box-shadow: var(--shadow); }
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

/* --- Top bar & navigation ----------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav-bg); color: var(--nav-text);
  border-bottom: 3px solid var(--crimson-500);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 20px; height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; }
.brand:hover { color: inherit; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.brand-mark img { width: 32px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text span { white-space: nowrap; font-size: 0.7rem; font-weight: 500; color: var(--nav-muted); letter-spacing: 0.04em; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  color: var(--nav-muted); text-decoration: none; padding: 8px 12px; border-radius: var(--radius-sm);
  font-weight: 550; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgb(255 255 255 / 0.08); }
.nav a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / 0.12); }
.nav svg { width: 18px; height: 18px; }
.user-menu { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--nav-muted); white-space: nowrap; }
.user-menu a, .user-menu button {
  color: var(--nav-muted); background: none; border: 0; font: inherit; cursor: pointer; padding: 6px 4px; text-decoration: none;
}
.user-menu a:hover, .user-menu button:hover { color: #fff; }
.user-menu form { margin: 0; }
.account-links { display: flex; align-items: center; gap: 12px; }
.account-toggle { display: none; }
.user-menu button.account-toggle svg { width: 22px; height: 22px; display: block; }
.nav-more { display: none; }
/* Header bell: links to /notifications/; favicon.js fills in the New-task count. */
.user-menu a.bell { position: relative; display: inline-flex; align-items: center; padding: 6px; }
.pin-form { display: inline-flex; margin: 0; }
.user-menu button.pin { display: inline-flex; align-items: center; padding: 6px; background: none; border: 0; cursor: pointer; }
.user-menu button.pin svg { width: 19px; height: 19px; }
.user-menu button.pin.on { color: #fff; }
.pins-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.pins-row .label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.user-menu a.bell svg { width: 20px; height: 20px; }
.user-menu a.bell[aria-current="page"] { color: #fff; }
.bell-count {
  position: absolute; top: 0; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: #d7143c; color: #fff; font-size: 0.7rem; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--nav-bg);
}
.bell-count[hidden] { display: none; }
/* Back and Refresh: only in the Home Screen app (html.app, set in base.html), which has no browser buttons. */
.app-only { display: none; }
html.app .app-only { display: inline-flex; align-items: center; }
.app-back { background: none; border: 0; padding: 6px 2px; margin-right: -4px; color: var(--nav-muted); cursor: pointer; }
.app-back:hover { color: #fff; }
.app-back svg { width: 24px; height: 24px; }
.user-menu button.app-refresh { padding: 6px; }
.user-menu button.app-refresh svg { width: 20px; height: 20px; }
/* Reminders for one event, task or form (partials/item_reminders.html). Plain inside another card. */
.item-reminders summary { cursor: pointer; }
.item-reminders .check-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.card .item-reminders { border: 0; box-shadow: none; padding: 4px 0 12px; margin: 0; background: none; }

@media (max-width: 1360px) { .user-menu .user-name { display: none; } }
/* Full menus (8+ sections, e.g. the moderator's) get a wider bar and no
   icons; below 1700px they go to two rows (see below). */
.topbar-inner:has(.nav > a:nth-child(8)) { max-width: 1680px; }
.nav:has(> a:nth-child(8)) svg { display: none; }
/* Never push Help / Settings / Sign out off the screen: a menu that still
   doesn't fit scrolls sideways (the current page is scrolled into view). */
@media (min-width: 761px) {
  .nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 1240px) {
  .topbar-inner { gap: 12px; }
  .nav a { padding: 8px 9px; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .brand-text { display: none; }
  .nav { gap: 0; }
  .nav a { font-size: 0.88rem; padding: 8px 7px; }
  .nav svg { display: none; }
}
/* Medium screens (iPads, small laptops) with a long menu: two rows, the
   brand, search and account links on top and the sections underneath. */
@media (max-width: 1700px) and (min-width: 761px) {
  .topbar-inner:has(.nav > a:nth-child(7)) { flex-wrap: wrap; height: auto; row-gap: 0; padding-top: 8px; }
  .topbar-inner:has(.nav > a:nth-child(7)) .brand-text { display: flex; }
  .topbar-inner:has(.nav > a:nth-child(7)) .user-menu { margin-left: auto; }
  .nav:has(> a:nth-child(7)) { order: 3; flex: 1 0 100%; padding: 4px 0 6px; }
  .nav:has(> a:nth-child(7)) svg { display: inline; width: 16px; height: 16px; }
}
/* Very long menus (11+ sections, e.g. the moderator's with Safety) take
   two rows on wide screens too: on one row the last sections (Events)
   were scrolled out of sight behind the hidden scrollbar (2026-10-19). */
@media (min-width: 1701px) {
  .topbar-inner:has(.nav > a:nth-child(11)) { flex-wrap: wrap; height: auto; row-gap: 0; padding-top: 8px; }
  .topbar-inner:has(.nav > a:nth-child(11)) .user-menu { margin-left: auto; }
  .nav:has(> a:nth-child(11)) { order: 3; flex: 1 0 100%; padding: 4px 0 6px; }
  .nav:has(> a:nth-child(11)) svg { display: inline; width: 16px; height: 16px; }
}
/* On the second row, wrap instead of scrolling sections out of sight. */
@media (min-width: 761px) {
  .nav:has(> a:nth-child(7)) { flex-wrap: wrap; overflow-x: visible; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .nav:has(> a:nth-child(7)) a { font-size: 0.9rem; padding: 8px 8px; gap: 5px; }
}
@media (max-width: 880px) and (min-width: 761px) {
  .nav:has(> a:nth-child(7)) svg { display: none; }
}
@media (max-width: 760px) {
  .topbar-inner { height: 52px; }
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--nav-bg); border-top: 1px solid rgb(255 255 255 / 0.1);
    justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  /* Its own layer, so iOS Safari repaints it while the toolbars resize. */
  .nav { transform: translateZ(0); -webkit-transform: translateZ(0); }
  /* Home + three sections + More (apps/web/nav.py picks them); the rest are in the More sheet. */
  .nav > a.more-only { display: none; }
  .nav a, .nav .nav-more { flex-direction: column; gap: 2px; font-size: 0.72rem; padding: 6px 2px; flex: 1 1 0; min-width: 0; justify-content: center; }
  .nav .nav-more { display: flex; align-items: center; color: var(--nav-muted); background: none; border: 0; border-radius: var(--radius-sm); font: inherit; font-weight: 550; font-size: 0.72rem; cursor: pointer; }
  .nav .nav-more.here { color: #fff; background: rgb(255 255 255 / 0.12); }
  .nav svg, .nav:has(> a:nth-child(8)) svg { display: inline; width: 22px; height: 22px; }
  body { padding-bottom: 72px; }
  html { scroll-padding-bottom: 80px; }
  /* The account links fold into a menu under the account button. */
  .account-toggle { display: inline-flex; }
  .account-links {
    display: none; position: absolute; top: calc(100% + 3px); right: 8px; z-index: 40; min-width: 200px;
    flex-direction: column; align-items: stretch; gap: 0; padding: 6px 0; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
  }
  .account-links.open { display: flex; }
  .user-menu .account-links a, .user-menu .account-links button { display: block; width: 100%; text-align: left; color: var(--text); padding: 10px 16px; font-size: 1rem; }
  .user-menu .account-links a:hover, .user-menu .account-links button:hover { background: var(--surface-2); color: var(--text); }
  .user-menu .account-links a[aria-current="page"] { font-weight: 700; }
  .user-menu .account-links .user-name { display: block; padding: 6px 16px 8px; color: var(--text-3); font-size: 0.85rem; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
  .topbar-inner { position: relative; }
  .user-menu { margin-left: auto; }
}
/* Small phones: the logo alone. */
@media (max-width: 480px) {
  .brand-text { display: none; }
  .topbar-inner { gap: 8px; }
  .user-menu { gap: 6px; font-size: 0.85rem; }
}
/* Phones: the "More" sheet (base.html #nav-more). */
.nav-sheet {
  width: 100%; max-width: 480px; margin: auto auto 0; padding: 0 0 calc(12px + env(safe-area-inset-bottom)); border: 0;
  border-radius: 14px 14px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -8px 28px rgb(0 0 0 / 0.25);
}
.nav-sheet::backdrop { background: rgb(0 0 0 / 0.4); }
.nav-sheet .card-head { padding: 14px 18px 6px; margin: 0; }
.nav-sheet nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 12px; }
.nav-sheet a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 550; font-size: 0.85rem; text-align: center; }
.nav-sheet a:hover { background: var(--surface-2); color: var(--text); }
.nav-sheet a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav-sheet svg { width: 24px; height: 24px; }

/* --- Layout --------------------------------------------------------------- */

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.page-head .audit-line { font-size: .85em; margin-top: 4px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.stack > * + * { margin-top: 16px; }
/* Home: cards flow into balanced columns (two on wide screens, one on phones),
   so whichever cards a role sees fill both sides. */
.dash-cards { columns: 2 420px; column-gap: 16px; }
.dash-cards > * { break-inside: avoid; margin: 0 0 16px; }
/* Event page: a wide column for cards that grow (schedule, sign-ups,
   attendance) and a narrow one for short cards, each stacking on its own so a
   long card leaves no gap beside it. Without wide cards, the short ones share
   the width. Phones: one column, cards ordered by --order. */
.cols-main-side { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.cols-main-side:not(:has(> .col-main > *)) { grid-template-columns: 1fr; }
.cols-main-side:not(:has(> .col-main > *)) > .col-side { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.cols-main-side:not(:has(> .col-main > *)) > .col-side > * { margin-top: 0; }
.cols-main-side #schedule { --order: 3; }
.cols-main-side #documents { --order: 9; }
.cols-main-side #notes { --order: 10; }
@media (max-width: 900px) {
  .cols-main-side, .cols-main-side:not(:has(> .col-main > *)) > .col-side { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
  .cols-main-side > .stack { display: contents; }
  .cols-main-side > .stack > * { margin-top: 0; order: var(--order, 50); }
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head a { font-size: 0.85rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 14px 18px 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stats:has(> :only-child) { grid-template-columns: minmax(150px, 280px); }  /* a lone tile doesn't span the page */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block;
}
a.stat:hover { border-color: var(--steel-300); color: inherit; }
.stat .label { font-size: 0.8rem; color: var(--text-3); font-weight: 550; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stat .hint { font-size: 0.85rem; color: var(--text-2); }
.stat.alert .value { color: var(--bad); }
.stat.ok .value { color: var(--good); }

/* --- Lists ----------------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; color: inherit; text-decoration: none;
}
.card.flush .row { padding: 10px 18px; }
a.row:hover { background: var(--surface-2); color: inherit; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row .main > .title, .row .main > .meta { display: block; }
.row .meta { font-size: 0.87rem; color: var(--text-2); }
.row .aside { text-align: right; font-size: 0.87rem; color: var(--text-2); white-space: nowrap; }
/* Phones: a row whose right side holds buttons (e.g. Announcements: Email, Edit, End now)
   puts the buttons on their own line under the text instead of squeezing it. */
@media (max-width: 760px) {
  .row:has(> .aside .btn) { flex-wrap: wrap; }
  .row:has(> .aside .btn) > .main { flex-basis: 100%; }
  .row:has(> .aside .btn) > .aside { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
}
.time-col { width: 76px; flex: none; font-variant-numeric: tabular-nums; font-size: 0.9rem; color: var(--text-2); }
.day-head {
  position: sticky; top: var(--header-h); z-index: 5; background: var(--bg);
  font-size: 0.8rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3);
  padding: 16px 0 6px;
}
.cancelled .title { text-decoration: line-through; color: var(--text-3); }
.empty { color: var(--text-3); padding: 12px 0; }
/* Notifications page: announcement rows carry their buttons under the text. */
.notif-announcement .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.notif-announcement .actions form { margin: 0; }
.notif-announcement.dismissed .title { color: var(--text-2); font-weight: 550; }

/* --- Badges & buttons ------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
  vertical-align: 1px;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
/* A badge with a phone-width abbreviation: the full text stays for screen readers. */
.badge .short-label { display: none; }
@media (max-width: 760px) {
  .badge .long-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .badge .short-label { display: inline; }
}
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 0.9rem;
  text-decoration: none; cursor: pointer; min-height: 38px;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff; }
.btn.primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); color: #fff; }
/* A POST form on its way (static/web/submit-guard.js): its buttons wait. */
form.is-sending :is(button, .btn)[type=submit], form.is-sending button:not([type]) { opacity: 0.6; pointer-events: none; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 0.82rem; }
.btn.block { width: 100%; }

/* --- Filters & forms -------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters input[type=search], .filters select, input[type=time], input[type=text], input[type=search] {
  font: inherit; font-size: 0.95rem; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); min-height: 38px;
}
.filters input[type=search] { min-width: min(100%, 240px); flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: 0.85rem; font-weight: 550; cursor: pointer; text-decoration: none;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"], .chip.on { background: var(--slate-700); border-color: var(--slate-700); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip[aria-pressed="true"], :root:not([data-theme="light"]) .chip.on { background: var(--steel-200); border-color: var(--steel-200); color: var(--slate-900); }
}
:root[data-theme="dark"] .chip[aria-pressed="true"], :root[data-theme="dark"] .chip.on { background: var(--steel-200); border-color: var(--steel-200); color: var(--slate-900); }

/* --- Tables ------------------------------------------------------------------ */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3);
  font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; }
/* Sortable headers (static/web/table-sort.js) */
.th-sort { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.th-sort:hover { text-decoration: underline; }
th[aria-sort="ascending"] .th-sort::after { content: " ▲"; font-size: 0.7em; }
th[aria-sort="descending"] .th-sort::after { content: " ▼"; font-size: 0.7em; }
.chip:disabled { opacity: 0.55; cursor: default; }
table.data a { color: var(--text); font-weight: 600; text-decoration: none; }
table.data a:hover { color: var(--accent-text); text-decoration: underline; }

@media (max-width: 760px) {
  table.data.stack-mobile thead { display: none; }
  /* Blocks, not a table: a table grows to its widest row and pushed the
     right-hand column of every card off the screen. */
  table.data.stack-mobile, table.data.stack-mobile tbody, table.data.stack-mobile tfoot { display: block; width: 100%; }
  table.data.stack-mobile tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.data.stack-mobile td { padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  table.data.stack-mobile td[data-label]:not(.primary)::before { content: attr(data-label) ": "; color: var(--text-3); font-size: 0.8rem; }
  table.data.stack-mobile td.primary { grid-column: 1 / -1; font-size: 1rem; }
  table.data.stack-mobile td.hide-mobile { display: none; }
  table.data.stack-mobile td.num { text-align: left; }
  table.data.stack-mobile td.wide { grid-column: 1 / -1; }  /* long cells (name lists) get the full card width */
  /* stack-full: one full-width line per cell, for tables with long cells (mentors' projects). */
  table.data.stack-mobile.stack-full tr { grid-template-columns: 1fr; gap: 4px; }
  table.data.stack-mobile.stack-full td { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; }
  table.data.stack-mobile.stack-full td.stack-list br { display: none; }
  table.data.stack-mobile.stack-full td.stack-list .item { display: inline-block; margin-right: 10px; }
  /* fit-mobile: short tables (a label + a few numbers) stay a table but fit
     the screen: smaller text, tight cells, labels wrap, numbers don't. */
  table.data.fit-mobile { font-size: 0.85rem; }
  table.data.fit-mobile th { font-size: 0.68rem; letter-spacing: 0.02em; }
  table.data.fit-mobile th, table.data.fit-mobile td { padding: 8px 6px; }
  table.data.fit-mobile tr > :first-child { padding-left: 14px; -webkit-hyphens: auto; hyphens: auto; overflow-wrap: break-word; }
  table.data.fit-mobile tr > :last-child { padding-right: 14px; }
  table.data.fit-mobile .num { white-space: nowrap; }
}

/* --- Progress --------------------------------------------------------------- */

.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--slate-600); border-radius: 999px; }
.meter.bad > span { background: var(--accent); }
.meter.good > span { background: var(--good); }
.meter.warn > span { background: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .meter > span { background: var(--steel-300); } }
:root[data-theme="dark"] .meter > span { background: var(--steel-300); }
/* Keep status colours on meters in dark mode (the rules above would win on specificity). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .meter.bad > span { background: var(--accent); }
  :root:not([data-theme="light"]) .meter.good > span { background: var(--good); }
  :root:not([data-theme="light"]) .meter.warn > span { background: var(--warn); }
}
:root[data-theme="dark"] .meter.bad > span { background: var(--accent); }
:root[data-theme="dark"] .meter.good > span { background: var(--good); }
:root[data-theme="dark"] .meter.warn > span { background: var(--warn); }

/* --- Check-in ---------------------------------------------------------------- */

.checkin-head { padding-top: 8px; }
/* Search and filters stay on screen while scrolling the names; the title doesn't. */
.checkin-filters {
  position: sticky; top: var(--header-h); z-index: 10; background: var(--bg); padding: 8px 0 10px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.checkin-chips { display: flex; flex-direction: column-reverse; gap: 6px; }
@media (max-width: 760px) {
  .checkin-head .page-head { margin-bottom: 4px !important; }
  .checkin-head h1 { font-size: 1.45rem; }
  /* One sideways-scrolling row; the selected chips are still easy to see. */
  .checkin-chips { flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; gap: 6px; }
  .checkin-chips::-webkit-scrollbar { display: none; }
  .checkin-chips .chips { flex-wrap: nowrap; flex: none; }
  .checkin-chips .chip { white-space: nowrap; }
}
.checkin-count { font-size: 1.05rem; font-weight: 650; }
.checkin-count .num { font-size: 1.4rem; }
.checkin-list { list-style: none; margin: 0; padding: 0; }
.checkin-item { border-bottom: 1px solid var(--border); }
.checkin-item[hidden] { display: none; }
.checkin-toggle {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 4px; min-height: 60px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.checkin-toggle:active { background: var(--surface-2); }
.check {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--steel-300); flex: none;
  display: grid; place-items: center; color: transparent; transition: all 0.12s;
}
.present .check { background: var(--good); border-color: var(--good); color: var(--on-good); }
.checkin-toggle .name { font-weight: 600; font-size: 1.02rem; }
.checkin-toggle .info { font-size: 0.85rem; color: var(--text-2); }
.checkin-toggle .times { margin-left: auto; font-size: 0.85rem; color: var(--good); font-variant-numeric: tabular-nums; white-space: nowrap; }
.checkin-edit { padding: 0 4px 12px 50px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.9rem; }
.checkin-edit label { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.checkin-edit .error { color: var(--bad); font-weight: 600; width: 100%; }
.htmx-request .checkin-toggle { opacity: 0.6; }

/* --- Misc ------------------------------------------------------------------ */

.notice { padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); margin-bottom: 16px; font-weight: 550; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 8px 0 8px 22px; border-top: 1px solid var(--border); position: relative; font-size: 0.93rem; }
.issues li:first-child { border-top: 0; }
.issues li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 0.93rem; }
dl.facts dt { color: var(--text-3); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.facts dd .badge { white-space: normal; }
.admin-link { font-size: 0.85rem; }

/* --- Login ------------------------------------------------------------------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--nav-bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; padding: 32px 28px; text-align: center; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); border-top: 4px solid var(--crimson-500); }
.login-card img { width: 180px; height: auto; margin-bottom: 8px; }
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.login-card p { color: var(--text-2); margin-bottom: 22px; font-size: 0.93rem; }
.login-card .alt { margin-top: 18px; font-size: 0.82rem; }
.login-card .alt a { color: var(--text-3); }
.email-login { margin-top: 18px; text-align: left; font-size: 0.9rem; }
.email-login summary { cursor: pointer; color: var(--text-2); text-align: center; }
.email-login form { display: grid; gap: 6px; margin: 12px 0 8px; }
.email-login label { font-weight: 600; font-size: 0.85rem; }
.email-login input {
  width: 100%; font: inherit; font-size: 0.95rem; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 40px;
}
.email-login button { margin-top: 8px; }
.email-login small { color: var(--text-3); }
.ms-logo { width: 18px; height: 18px; }

/* --- Messages ----------------------------------------------------------------- */

.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.messages li { padding: 10px 14px; border-radius: var(--radius); background: var(--good-soft); color: var(--good); font-weight: 550; margin-bottom: 6px; }
.messages li.error { background: var(--bad-soft); color: var(--bad); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }
.messages li.info, .messages li.debug { background: var(--surface-2); color: var(--text); box-shadow: inset 4px 0 0 var(--focus); }
/* A failed htmx request (static/web/htmx-errors.js): floats over the page. */
.messages.floating { position: fixed; top: 12px; left: 16px; right: 16px; max-width: 640px; margin: 0 auto; z-index: 1000; }
.messages.floating li { display: flex; gap: 8px; align-items: center; box-shadow: 0 4px 16px rgb(0 0 0 / 0.2); }
.messages.floating li span { flex: 1; }

/* --- Forms --------------------------------------------------------------------- */

/* Phones: iOS zooms into any text box under 16px when it's tapped. (Not the
   kiosk's big scan box, nor boxes that set a bigger size of their own.) */
@media (max-width: 760px) {
  body:not(.station-body) :is(input:not([type=checkbox], [type=radio], [type=range], [style*="font-size"]), select, textarea) { font-size: 16px !important; }
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px 18px; }
.form-grid.one-col { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.field > label, .field legend { font-size: 0.85rem; font-weight: 600; color: var(--text-2); line-height: 1.25; }
.field .req { color: var(--accent); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  font: inherit; font-size: 0.95rem; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); width: 100%; min-height: 40px;
}
.field textarea { resize: vertical; }
/* iOS Safari gives date/time pickers a fixed minimum width (centred text),
   so on phones they ran past the card edge. Let them shrink like other inputs. */
.field input[type=date], .field input[type=time], .field input[type=datetime-local] { min-width: 0; max-width: 100%; display: block; }
@supports (-webkit-touch-callout: none) {
  .field input[type=date], .field input[type=time], .field input[type=datetime-local] { -webkit-appearance: none; appearance: none; text-align: left; }
  .field input::-webkit-date-and-time-value { text-align: left; }
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.field .help { color: var(--text-3); font-size: 0.8rem; }
.field .error { color: var(--bad); font-weight: 600; font-size: 0.82rem; }
.field .errors { display: flex; flex-direction: column; gap: 4px; }
.field-check > label { display: flex; align-items: center; gap: 8px; font-weight: 550; color: var(--text); font-size: 0.95rem; }
/* A tick box that shares a row with input boxes (widget attr
   data-beside-inputs) sits level with the boxes, not their labels: skip one
   label line + gap, then centre on an input's height. */
.field-check:has(input[data-beside-inputs]) { padding-top: calc(0.85rem * 1.25 + 4px); }
.field-check:has(input[data-beside-inputs]) > label { min-height: 40px; font-weight: 400; }
.field input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--slate-700); }
.field fieldset { border: 0; padding: 0; margin: 0; }
.field legend { margin-bottom: 6px; padding: 0; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 12px; }
.check-list.people { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.check-list label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 0.93rem; cursor: pointer; }
.check-list label[hidden] { display: none; }
/* Storage locations (locations.html): a location with locations inside folds
   open and closed; top-level ones start folded. The arrow sits before the name. */
.loc-tree .row::before { content: ""; flex: none; box-sizing: border-box; width: 8px; height: 8px; margin: 0 3px; }
.loc-tree details > summary { list-style: none; cursor: pointer; }
.loc-tree details > summary::-webkit-details-marker { display: none; }
.loc-tree details > summary::before { border: solid var(--text-3); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform 0.15s; }
.loc-tree details[open] > summary::before { transform: rotate(45deg); }
.loc-tree details > ul.list > li:first-child { border-top: 1px solid var(--border); }
/* One person's answers (forms/response.html): each question and answer is
   its own ruled block, the question small and muted, the answer full size. */
.answer-list { margin: 0; }
.answer-list > div { padding: 14px 0; border-top: 1px solid var(--border); }
.answer-list > div:first-child { border-top: 0; padding-top: 0; }
.answer-list > div:last-child { padding-bottom: 0; }
.answer-list dt { font-size: 0.85rem; font-weight: 600; color: var(--text-2); line-height: 1.3; }
.answer-list dd { margin: 6px 0 0; font-size: 1rem; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.answer-list dd.muted { color: var(--text-3); }
/* Answering a form (forms/fill.html): each question is its own block, divided
   by a rule, with a full-size label; long choice labels wrap beside their dot. */
.form-intro { white-space: pre-line; margin: 0 0 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.form-questions { row-gap: 0; }
.form-questions > .field { padding: 18px 0; border-top: 1px solid var(--border); }
.form-questions > .field:first-child { border-top: 0; padding-top: 4px; }
.form-questions > .field > label, .form-questions > .field legend { font-size: 1rem; color: var(--text); margin-bottom: 4px; }
.form-questions label:has(> input[type=radio]), .form-questions .check-list label {
  display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; font-size: 0.95rem; line-height: 1.35; cursor: pointer;
}
.form-questions input[type=radio], .form-questions .check-list input[type=checkbox] {
  width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent);
}
.picker-search { margin-bottom: 6px; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.danger-zone { margin-top: 24px; }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* --- Projects & tasks ------------------------------------------------------------ */

.project-card { text-decoration: none; color: inherit; display: block; }
.project-card:hover { border-color: var(--steel-300); color: inherit; }
.project-card .meta { font-size: 0.87rem; color: var(--text-2); }
.overdue { color: var(--bad); font-weight: 600; }
.quick-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; margin-bottom: 16px; }
.quick-add input[type=text], .quick-add input[type=url] { flex: 1; min-width: 200px; }
.quick-add input { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 40px; }
/* position: relative keeps absolutely positioned bits (the cards' .sr-only labels) inside the
   scroll box; without it they widened the whole page on phones and let it zoom out. */
.board { position: relative; display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
@media (max-width: 760px) { .board { grid-template-columns: repeat(4, 82%); scroll-snap-type: x mandatory; } .board-col { scroll-snap-align: start; } }
.board-col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.board-col h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); margin: 2px 4px 10px; }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow); }
.task-card.is-overdue { border-left: 3px solid var(--accent); }
.task-title { font-weight: 600; color: var(--text); text-decoration: none; display: block; }
.task-title:hover { color: var(--accent-text); text-decoration: underline; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-2); margin-top: 6px; }
.task-move { margin-top: 8px; }
/* Project page: the status badge is a menu for people who can change projects. */
.status-menu { display: inline-flex; align-items: center; gap: 6px; margin: 0; vertical-align: middle; }
.status-menu select {
  font: inherit; font-size: 0.8rem; font-weight: 600; padding: 2px 6px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
}
.status-menu select.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.status-menu select.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.board.board-5 { grid-template-columns: repeat(5, minmax(220px, 1fr)); }
.task-meta .badge { white-space: normal; max-width: 100%; }
.board.board-6 { grid-template-columns: repeat(6, minmax(220px, 1fr)); }
@media (max-width: 760px) { .board.board-5 { grid-template-columns: repeat(5, 82%); } .board.board-6 { grid-template-columns: repeat(6, 82%); } }
/* Project page: the board comes first on phones; ticked tasks get bulk actions. */
.project-layout { display: flex; flex-direction: column; }
@media (max-width: 760px) { .project-board { order: -1; margin-bottom: 16px; } }
.task-card .task-pick { float: right; margin: 2px 0 4px 8px; }
.task-bulk { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 12px; margin-bottom: 12px; }
.task-bulk .bulk-group { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.task-bulk select, .task-bulk input[type=date] { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); max-width: 14em; }
.error-text { color: var(--bad); font-weight: 600; font-size: 0.82rem; margin: 6px 0 0; }
.task-move select { font: inherit; font-size: 0.8rem; padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--slate-600); color: #fff; font-size: 0.68rem; font-weight: 700; display: inline-grid; place-items: center; }
.link-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link-picker select, .link-picker input { font: inherit; font-size: 0.9rem; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 38px; }
.link-picker input { flex: 1; min-width: 160px; }
.link-results { width: 100%; }

/* --- Inventory ----------------------------------------------------------------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.93rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-size: 0.78rem; margin-left: 4px; }
/* Phones: tighter tabs that wrap to a second line instead of hiding the
   last ones off the edge (Finance's Fundraising was cut off). */
@media (max-width: 760px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; gap: 0; }
  .tabs a { padding: 8px 7px; font-size: 0.88rem; }
}
.request-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.request-actions form, .badges form { margin: 0; }
.card.flush .request-row { padding: 10px 18px; }
@media (max-width: 760px) { .request-row { flex-wrap: wrap; } .request-row .aside { width: 100%; justify-content: flex-start; } }
.inline-select { font: inherit; font-size: 0.9rem; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 38px; }

/* --- Calendar ------------------------------------------------------------------ */

.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--border); }
.cal-weekdays div { padding: 8px; font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.cal-day { min-height: 112px; padding: 6px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:first-child { border-left: 0; }
.cal-day.outside { background: var(--surface-2); }
.cal-day.outside .cal-date { color: var(--text-3); }
.cal-date { font-size: 0.82rem; font-weight: 650; color: var(--text-2); padding: 0 2px 2px; font-variant-numeric: tabular-nums; }
.cal-wd { display: none; }
.cal-day.is-today .cal-date { color: var(--accent-text); }
.cal-day.is-today { box-shadow: inset 0 3px 0 var(--accent); }
.cal-entry {
  --stripe: var(--slate-600);
  display: block; font-size: 0.78rem; line-height: 1.3; padding: 2px 6px; border-radius: 4px; text-decoration: none;
  color: var(--text); background: var(--surface-2); border-left: 3px solid var(--stripe);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-entry:hover { color: var(--text); filter: brightness(0.96); }
.cal-entry .title { font-weight: 600; }
.cal-entry .cal-time { color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal-entry .cal-note { display: block; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.cal-entry.cancelled .title { text-decoration: line-through; color: var(--text-3); }
.cal-entry.is-overdue { background: var(--bad-soft); }
.cal-entry.tentative { border-left-style: dashed; background: transparent; outline: 1px dashed var(--border); outline-offset: -1px; }
.cal-entry .cal-tentative { color: var(--warn); font-weight: 700; }
.cal-entry.mine { box-shadow: inset 0 0 0 1px var(--good); }
.cal-mine { color: var(--good); font-weight: 700; margin-right: 3px; }
.cal-competition { --stripe: var(--accent); background: var(--accent-soft); }
.cal-sessions { --stripe: var(--steel-300); background: transparent; }
.cal-sessions .cal-note { display: none; }
.cal-projects { --stripe: var(--good); }
.cal-tasks { --stripe: var(--warn); }
.cal-shopping { --stripe: var(--focus); }
.cal-tools { --stripe: var(--text-3); }
.cal-chip.on { border-left: 4px solid var(--stripe, transparent); }
.cal-chip.cal-events { --stripe: var(--slate-600); }
.cal-chip.cal-sessions { --stripe: var(--steel-300); }
.cal-empty { margin-top: 12px; }

@media (max-width: 760px) {
  .cal { background: none; border: 0; box-shadow: none; overflow: visible; }
  .cal-row { display: block; }
  .cal-row.cal-weekdays { display: none; }
  .cal-row + .cal-row { border-top: 0; }
  .cal-day { min-height: 0; border-left: 0; padding: 0; margin-bottom: 12px; gap: 6px; }
  .cal-day.empty, .cal-day.outside { display: none; }
  .cal-wd { display: inline; }
  .cal-day.is-today { box-shadow: none; }
  .cal-date { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); padding: 4px 0; }
  .cal-entry { font-size: 0.93rem; padding: 8px 12px; white-space: normal; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--stripe); }
  .cal-competition { background: var(--accent-soft); }
}

/* --- Divisions ------------------------------------------------------------------ */

.mini-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin: 12px 0 2px; }
.card-head + .mini-head { margin-top: 0; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dot { width: 10px; height: 10px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border); }
.dot.on { background: var(--good); border-color: var(--good); }

/* --- Training passport ------------------------------------------------------ */

.training-matrix th.cert { font-size: 0.75rem; white-space: nowrap; text-align: center; }
.training-matrix td.cell { text-align: center; padding: 8px 4px; }
.training-matrix td:first-child, .training-matrix th:first-child { position: sticky; left: 0; background: var(--surface); white-space: nowrap; }
/* Headers stay put while scrolling: the wrap scrolls both ways (sticky can't
   follow the page from inside an overflow-x box), the name column stays left. */
.table-wrap.sticky-head { max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow: auto; }
@media (max-width: 760px) { .table-wrap.sticky-head { max-height: calc(100dvh - 150px); } }  /* above the bottom nav */
.sticky-head thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: inset 0 -1px 0 var(--border); }
.sticky-head thead th:first-child { z-index: 3; }

/* --- Check-in station ------------------------------------------------------- */

.station-body { background: var(--nav-bg); min-height: 100vh; }
.station { max-width: 720px; margin: 0 auto; padding: 32px 16px; color: #fff; text-align: center; }
.station header { display: flex; align-items: center; gap: 16px; justify-content: center; margin-bottom: 28px; text-align: left; }
.station header img { width: 64px; height: 64px; }
.station header h1 { font-size: 1.6rem; margin: 0; color: #fff; }
.station header p { margin: 0; color: var(--nav-muted); }
.station label { display: block; font-size: 1.3rem; font-weight: 700; margin-bottom: 10px; }
.station input { width: 100%; font-size: 1.4rem; padding: 14px; border-radius: var(--radius); border: 2px solid var(--steel-300);
  text-align: center; background: #fff; color: #111; letter-spacing: 0.1em; }
.station #hint { color: var(--nav-muted); margin-top: 8px; }
.station-result { margin-top: 28px; min-height: 180px; }
.station-message { border-radius: 14px; padding: 24px 16px; background: var(--surface); color: var(--text); }
.station-message.good { border-top: 6px solid var(--good); }
.station-message.bad { border-top: 6px solid var(--crimson-500); }
.station-message .big { font-size: 2rem; font-weight: 800; margin: 0 0 6px; }
.station-message p { margin: 0; font-size: 1.1rem; }
.station .present { color: var(--nav-muted); margin-top: 16px; font-size: 1.05rem; }
.station .present .num { color: #fff; font-weight: 700; }
.station-camera { margin-top: 20px; }
.station-camera video { width: 100%; max-width: 420px; border-radius: var(--radius); margin-top: 12px; }
.station-exit { margin-top: 40px; font-size: 0.85rem; }
.station-exit a { color: var(--nav-muted); }

/* --- Badges ------------------------------------------------------------------ */

.badge-row { flex-wrap: wrap; }
.badge-scan { display: flex; gap: 6px; align-items: center; }
.badge-scan input { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); width: 200px; }
.qr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.qr-card { display: flex; align-items: center; gap: 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 12px; background: #fff; color: #111; break-inside: avoid; }
.qr-card svg { flex: none; }
.qr-card div { display: grid; gap: 2px; }
.qr-card span, .qr-card small { color: #444; font-size: 0.85rem; }
@media print {
  .topbar, .nav, .skip-link, .no-print, .messages { display: none !important; }
  body, main { background: #fff !important; padding: 0 !important; }
  .qr-cards { grid-template-columns: repeat(2, 1fr); }
}

/* --- Org chart ----------------------------------------------------------------- */

.org-top { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.org-box { min-width: 220px; }
.org-box h2 { font-size: 1rem; margin-bottom: 6px; }
.org-box ul { margin: 0; padding-left: 18px; }
.org-arrow { font-size: 1.6rem; color: var(--text-3); }
.org-sides { display: grid; grid-template-columns: 4fr 6fr; gap: 20px; }
.org-side { display: grid; gap: 12px; align-content: start; }
.org-captain { border-top: 4px solid var(--steel-300); text-align: center; }
.org-captain h2 { font-size: 1.15rem; margin: 0; }
.org-kicker { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin: 0; }
.org-extra { font-size: 0.9rem; margin: 4px 0 0; }
.org-divisions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.org-division { padding: 12px 14px; }
.org-division h3 { font-size: 1rem; margin: 0; }
.org-division h3 a { color: var(--text); text-decoration: none; }
.org-division h3 a:hover { color: var(--accent-text); text-decoration: underline; }
.org-lead { font-weight: 600; font-size: 0.9rem; margin: 2px 0 8px; color: var(--text-2); }
.org-roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 0.85rem; }
.org-roles li { display: flex; flex-wrap: wrap; gap: 2px 6px; border-left: 2px solid var(--accent); padding-left: 8px; }
.org-roles li span { color: var(--text-2); width: 100%; }
.org-roles strong { font-weight: 600; }
.org-note { font-size: 0.85rem; margin: 0; }
.org-sub { margin-top: 10px; }
.org-sub .org-division { background: var(--surface-2); box-shadow: none; }
@media (max-width: 900px) { .org-sides { grid-template-columns: 1fr; } }
.org-roles-wide { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }

/* "View as" banner (look-only impersonation). */
.view-as-bar { position: relative; z-index: 25; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; padding: 8px 16px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 0.9rem; border-bottom: 2px solid var(--warn); }
.perm-table { table-layout: fixed; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table th:first-child { width: 44%; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--slate-700); }
.perm-extra { display: block; font-size: 0.82rem; color: var(--text-2); margin-top: 4px; }

/* Footer and What's new. */
.site-footer { text-align: center; color: var(--text-3); font-size: 0.82rem; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.site-footer a { color: inherit; }

/* --- Out-of-stock reports --------------------------------------------------- */

.report-notice { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.report-form { display: flex; flex-direction: column; gap: 10px; }
.report-form label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-2); }
.report-actions { flex-wrap: wrap; gap: 6px; }
@media (max-width: 760px) { .report-row { flex-wrap: wrap; } .report-row .aside { width: 100%; text-align: left; } }

/* --- Size families (fasteners) --------------------------------------------- */

.size-grid { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.size-grid th, .size-grid td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.size-grid thead th { font-size: 0.82rem; color: var(--text-2); font-weight: 650; }
.size-grid tbody th { text-align: right; font-size: 0.85rem; color: var(--text-2); font-weight: 600; position: sticky; left: 0; background: var(--surface); }
.card.flush .size-grid { margin: 4px 8px 8px; }
.size-cell { display: inline-flex; align-items: center; gap: 3px; min-width: 3.2em; justify-content: center; padding: 3px 8px;
  border-radius: 6px; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 600; }
.size-cell:hover { outline: 1px solid var(--border); }
.size-cell.empty { color: var(--text-3); font-weight: 500; }
.size-cell.low { background: var(--bad-soft); color: var(--bad); }
.size-cell.legend { min-width: 0; padding: 0 6px; }
.size-cell .badge { padding: 0 5px; }
.size-none { color: var(--text-3); }
.size-check input { width: 18px; height: 18px; }
.size-pick { border: 0; padding: 0; margin: 16px 0 0; }
.size-pick legend { font-weight: 650; margin-bottom: 4px; }
.count-entry input { width: 5em; text-align: right; padding: 5px 6px; }
.count-entry input.has-error { border-color: var(--bad); background: var(--bad-soft); }
.preset-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.weigh-form details { margin: 8px 0; font-size: 0.9rem; }
.weigh-form summary { cursor: pointer; color: var(--text-2); margin-bottom: 8px; }

/* --- Keyboard shortcuts (static/web/keys.js) ------------------------------- */

kbd {
  display: inline-block; min-width: 1.5em; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; background: var(--surface-2); color: var(--text); font: 600 0.8em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}
.shortcuts {
  width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0 0 12px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.shortcuts::backdrop { background: rgba(0, 0, 0, 0.4); }
.shortcuts .card-head { position: sticky; top: 0; background: var(--surface); padding: 14px 18px 8px; }
.shortcuts-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; padding: 0 18px; }
.shortcuts h3 { font-size: 0.9rem; margin: 10px 0 6px; }
.shortcuts dl { display: grid; grid-template-columns: 3.4em 1fr; gap: 5px 12px; margin: 0; align-items: baseline; }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; }
.shortcuts dd a { color: inherit; }
.shortcuts p { font-size: 0.82rem; margin-top: 12px; }
@media (max-width: 600px) { .shortcuts-cols { grid-template-columns: 1fr; } }
/* No keyboard on phones and tablets: don't advertise the shortcuts there. */
@media (hover: none) { .kbd-only { display: none; } }
/* After "g": a hint while the next key is awaited. */
.key-pending body::after {
  content: "g …"; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  padding: 4px 12px; border-radius: 999px; background: var(--slate-800); color: #fff; font: 600 0.85rem ui-monospace, monospace;
}
.release { margin-bottom: 16px; }
.release h2 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.release h2 .version { font-variant-numeric: tabular-nums; }
.release ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.release li { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: baseline; }
.release li .area { color: var(--text-3); font-size: 0.82rem; }
@media (max-width: 560px) { .release li { grid-template-columns: 1fr; gap: 2px; } }

/* Highlighted box, e.g. a one-time set-password link. */
.callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.callout input[readonly] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.email-actions { display: flex; flex-direction: column; gap: 6px; }
.email-actions .help { display: block; }

/* Org chart: roles that report to another role sit indented beneath it. */
.org-roles li.org-reports { border-left: 0; padding-left: 14px; display: block; }
.org-roles li.org-reports > .org-roles li { border-left-color: var(--border); }
.org-roles li.org-role-group { border-left-color: var(--border); }
.org-roles li.org-role-group span { color: var(--text); }
.org-open-note { margin: -8px 0 16px; }
.org-mentors { margin: -4px 0 8px; color: var(--text-2); line-height: 1.35; }
.org-highlight .org-open { background: var(--warn-soft); color: var(--warn); font-style: normal; font-weight: 650; border-radius: 4px; padding: 0 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.org-highlight .org-roles li:has(> .org-open) { border-left-color: var(--warn); }
.org-highlight .org-roles li:has(> strong):not(.org-role-group), .org-highlight .org-lead:not(:has(.org-open)), .org-highlight .org-mentors:not(:has(.org-open)) { opacity: 0.55; }

/* --- Knowledge base ------------------------------------------------------ */
.help-link {
  display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%;
  border: 1.5px solid var(--border); color: var(--text-2); font-size: 0.8rem; font-weight: 700; line-height: 1;
  text-decoration: none; vertical-align: middle; margin-left: 6px; background: var(--surface);
}
.help-link:hover { color: var(--accent-text); border-color: var(--accent); }
.help-link.small { width: 1.1rem; height: 1.1rem; font-size: 0.7rem; margin-left: 4px; }
.help-link.missing { border-style: dashed; opacity: 0.7; }
h1 .help-link { position: relative; top: -2px; }
a.plain { color: inherit; text-decoration: none; }
.card-head h2 a.plain { font-size: inherit; }
a.plain:hover { color: var(--accent-text); }
.kb-search { display: flex; gap: 8px; margin-bottom: 18px; max-width: 640px; }
.kb-search input { flex: 1; }
.kb-home { display: grid; gap: 16px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.kb-desc { font-size: 0.9rem; margin-bottom: 6px; }
.kb-sub { margin: 14px 0 2px; font-size: 0.9rem; color: var(--text-2); }
.kb-chips { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 0.85rem; }
.kb-divisions .row { align-items: flex-start; }
.kb-child { padding-left: 18px; }
.kb-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.kb-article { padding: 22px 28px; }
.kb-aside { position: sticky; top: calc(var(--header-h) + 16px); }
.kb-toc { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.kb-toc ul { list-style: none; padding-left: 14px; }
.kb-toc li { margin: 4px 0; }
.kb-meta { margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-3); }
.kb-editor { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin: 16px 0; }
.kb-editor textarea { width: 100%; min-height: 32rem; font: 0.92rem/1.5 var(--mono); }
.kb-preview-wrap { position: relative; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 26px 18px 14px;
  max-height: 40rem; overflow: auto; background: var(--bg); }
.kb-preview-label { position: absolute; top: 6px; left: 12px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3); }
.kb-cheats { margin-bottom: 16px; }
.kb-cheats summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.kb-diff { margin: 0; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); overflow-x: auto;
  font: 0.82rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.kb-diff .add { background: var(--good-soft); color: var(--good); display: inline-block; width: 100%; }
.kb-diff .del { background: var(--bad-soft); color: var(--bad); display: inline-block; width: 100%; }
.kb-diff .hunk { color: var(--text-3); }
@media (max-width: 960px) {
  .kb-home, .kb-layout, .kb-editor { grid-template-columns: 1fr; }
  .kb-aside { position: static; }
  .kb-article { padding: 18px; }
}
/* Article text (rendered Markdown). */
.prose { line-height: 1.65; overflow-wrap: anywhere; }
/* Long links or words in typed text (descriptions, notes) break instead of
   widening the page past the screen. "anywhere" (not break-word) also lets
   grid and flex columns shrink to fit. */
.card p, .card li, .card dd, .card blockquote { overflow-wrap: anywhere; }
.prose > * + * { margin-top: 0.85em; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 1.5em; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 1.45rem; }
.prose h2 { font-size: 1.25rem; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.05rem; }
.prose h4 { font-size: 0.95rem; }
.prose .anchor { margin-left: 6px; color: var(--text-3); text-decoration: none; opacity: 0; font-weight: 400; }
.prose :is(h1, h2, h3, h4):hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.25em; }
.prose blockquote { margin-left: 0; padding: 8px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose code { font: 0.88em var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 0.85rem; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.93rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; }
.prose th { background: var(--surface-2); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }
.prose a.wiki { font-weight: 550; }
.prose .wiki.missing { color: var(--bad); text-decoration: underline dotted; }
.prose .wiki.restricted { color: var(--text-3); }
.prose dt { font-weight: 650; }
.prose dd { margin-left: 1.2em; }
.prose .footnote { font-size: 0.88rem; color: var(--text-2); }

/* New badge on tasks assigned to you that you haven't opened (apps/projects/notices.py) */
.new-badge { font-size: 0.72rem; vertical-align: 1px; }

/* Announcement email preview (sandboxed iframe of the HTML email) */
.email-preview { display: block; width: 100%; height: 520px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f3f5f6; }

/* Code browsing (/code/<id>/): folder listing and highlighted files */
.code-entry { display: flex; gap: 12px; align-items: baseline; padding: 7px 4px; color: var(--text); text-decoration: none; }
.code-entry:hover { background: var(--surface-2); }
.code-entry:hover .code-name { color: var(--accent-text); text-decoration: underline; }
.code-name { flex: 1; min-width: 0; font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; }
.code-name.folder { font-weight: 650; }
.code-size { color: var(--text-3); font-size: 0.85rem; white-space: nowrap; }
.code-branch select { max-width: 16rem; }
.code-plain { font: 0.85rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.code-card { padding: 0; overflow: hidden; }
.code-view { overflow-x: auto; }
.code-view table { border-collapse: collapse; width: 100%; }
.code-view td { padding: 0; vertical-align: top; }
.code-view pre { margin: 0; padding: 10px 12px; font: 0.85rem/1.5 var(--mono); tab-size: 4; }
.code-view td.linenos { background: var(--surface-2); text-align: right; user-select: none; width: 1%; }
.code-view td.linenos pre { color: var(--text-3); padding-right: 10px; }
.code-view td.linenos a { color: inherit; text-decoration: none; }
.code-view td.linenos a:hover { color: var(--accent-text); }
.code-view :is(.k, .kc, .kd, .kn, .kp, .kr, .kt, .ow) { color: var(--code-keyword); }
.code-view :is(.s, .s1, .s2, .sa, .sb, .sc, .sd, .se, .sh, .si, .sr, .ss, .sx) { color: var(--code-string); }
.code-view :is(.c, .c1, .ch, .cm, .cp, .cpf, .cs) { color: var(--code-comment); font-style: italic; }
.code-view :is(.m, .mb, .mf, .mh, .mi, .mo, .il) { color: var(--code-number); }
.code-view :is(.nf, .fm, .nc, .nn, .ne) { color: var(--code-name); }
.code-view :is(.nd, .na, .nt) { color: var(--code-annotation); }
.code-view .err { color: inherit; border: 0; }
.prose .toc { display: none; }

/* Check-in: previous / next event, and the calendar's "add on this day" link */
.checkin-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 0.88rem; }
.cal-date { display: flex; align-items: baseline; gap: 4px; }
.cal-add { margin-left: auto; padding: 0 5px; border-radius: 4px; color: var(--text-3); text-decoration: none; font-weight: 600; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--surface-2); color: var(--text); }
@media (hover: none) { .cal-add { opacity: 1; } }

/* Bulk actions: purchase list checkboxes, shopping list vendor groups, one-click sponsor status */
.inline-action { display: inline; margin: 0; }
.sponsor-season { align-items: flex-start; padding: 12px 0; }
.sponsor-guide { margin-bottom: 16px; }
.sponsor-guide summary { cursor: pointer; }
.sponsor-guide .guide-steps { margin: 12px 0 6px; padding-left: 1.3em; display: grid; gap: 6px; }
.form-section { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.form-section legend { font-weight: 700; font-size: 0.82rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2);
  padding: 0 0 8px; }
.sponsor-season .main > .meta { margin-top: 3px; }
.sponsor-amounts { display: flex !important; flex-wrap: wrap; gap: 4px 18px; }
.sponsor-amounts strong { color: var(--text); }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 18px 10px; }
.bulk-all { display: inline-flex; gap: 6px; align-items: center; margin-right: 6px; }
.row-pick { flex: none; width: 18px; height: 18px; }
.decline-menu { position: relative; display: inline-block; }
.decline-menu > summary { list-style: none; }
.decline-menu > summary::-webkit-details-marker { display: none; }
.decline-menu[open] > form { position: absolute; right: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 260px; }
.decline-menu select { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); max-width: 100%; }
.vendor-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 8px 18px 0; }
.vendor-head h3 { margin: 0; }
.vendor-head h3 .muted { font-weight: 400; }
/* Shopping request form: live "quantity × cost each = total" under the cost field. */
.cost-total { display: block; font-size: 0.87rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cost-total:empty { display: none; }
.cost-total.large { background: var(--warn-soft); color: var(--warn); padding: 6px 10px; border-radius: var(--radius-sm); }
.cost-total .cost-hint { display: block; font-weight: 550; }
/* Record one purchase: tick + cost per shopping-list line. */
.order-lines input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--slate-700); }
.order-lines input[type=number] { font: inherit; width: 7.5em; text-align: right; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.order-lines input.has-error { border-color: var(--bad); background: var(--bad-soft); }
.order-lines .phone-only { display: none; }
@media (max-width: 640px) {
  .order-lines .wide-only { display: none; }
  .order-lines .phone-only { display: inline; }
  .order-lines td, .order-lines th { padding: 8px 6px; }
  .order-lines input[type=number] { width: 6em; }
}
/* Shopping list: each vendor is a band, alternating shades, so it's clear where one ends. */
.vendor-group { padding-bottom: 4px; border-top: 1px solid var(--border); }
.vendor-group:first-child { border-top: 0; }
.vendor-groups > .vendor-group:nth-child(even) { background: var(--surface-2); }
.vendor-group .vendor-head { padding-top: 10px; }
.quick-add select { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); min-height: 40px; max-width: 14em; }

/* Header quick-find (press / anywhere) */
.quick-find { margin: 0; }
.quick-find input { width: 150px; padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: #fff; font-size: 0.85rem; transition: width 0.15s ease; }
.quick-find input::placeholder { color: var(--nav-muted); }
.quick-find input:focus { width: 220px; outline: none; background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.5); }
@media (max-width: 720px) { .quick-find { display: none; } }
/* Search results under the header box (views_search.py). */
.quick-find { position: relative; }
.search-pop { display: none; position: absolute; top: calc(100% + 8px); right: 0; width: min(440px, 90vw); max-height: 70vh;
  overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); z-index: 40; }
.search-pop.open { display: block; }
.search-group { padding: 6px 0; border-bottom: 1px solid var(--border); }
.search-head { padding: 4px 14px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.search-hit { display: block; padding: 6px 14px; color: inherit; text-decoration: none; }
.user-menu .search-pop a.search-hit { color: var(--text); padding: 6px 14px; border-radius: 0; font-weight: 400; }
.user-menu .search-pop a.search-all { color: var(--accent-text); padding: 9px 14px; border-radius: 0; }
.search-hit:hover, .search-hit:focus { background: var(--surface-2); outline: none; }
.search-hit:focus-visible, .search-all:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 0; }
.search-hit .t { display: block; font-weight: 600; font-size: 0.9rem; }
.search-hit .m { display: block; font-size: 0.8rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-all { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; font-size: 0.85rem; color: var(--accent-text); }
.search-all:focus { background: var(--surface-2); outline: none; }
.search-none { padding: 12px 14px; margin: 0; color: var(--text-2); font-size: 0.9rem; }
.search-icon { display: none; color: inherit; }
.search-icon svg { width: 22px; height: 22px; display: block; }
@media (max-width: 720px) { .search-icon { display: inline-flex; } }
.search-page-form { max-width: 640px; }
.search-results { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }

/* Travel manifest (competitions/manifest.html): compact cards, print-friendly */
.manifest { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.manifest-list { margin: 6px 0 0; padding-left: 22px; column-width: 180px; font-size: 0.95rem; }
.manifest-list li { break-inside: avoid; padding: 1px 0; }
@media print {
  .topbar, .site-footer, .no-print, .tabs, .snake-stage { display: none !important; }
  main { padding: 0; }
  .manifest .card { break-inside: avoid; box-shadow: none; border: 1px solid #999; }
}

/* Snake surprises (static/web/snake.js) */
.snake-stage { position: fixed; inset: auto 0 0 0; height: 140px; z-index: 900; pointer-events: none; }
.snake-stage .snake { pointer-events: visiblePainted; cursor: pointer; }
.snake-body { fill: none; stroke: var(--crimson-500); stroke-linecap: round; stroke-linejoin: round; }
.snake-stripes { fill: none; stroke: var(--slate-700); stroke-linecap: butt; opacity: 0.55; }
.snake-head { fill: var(--crimson-600); }
.snake-eye { fill: #fff; }
.snake-tongue { stroke: var(--crimson-700); stroke-width: 2.4; fill: none; stroke-linecap: round; opacity: 0; }
.snake-hiss { position: fixed; z-index: 1001; transform: translateX(-50%); font-weight: 700; color: var(--accent-text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; pointer-events: none;
  animation: snake-pop 0.9s ease-out forwards; }
@keyframes snake-pop { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -24px); } }
.snake-card { position: fixed; left: 16px; bottom: 16px; z-index: 1000; width: min(360px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); box-shadow: 0 8px 28px rgb(31 39 44 / 0.22); padding: 12px 14px;
  animation: snake-in 0.3s ease-out; }
.snake-card.leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; }
@keyframes snake-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.snake-card-head { display: flex; align-items: center; gap: 8px; }
.snake-card-icon { font-size: 1.3rem; }
.snake-card-head strong { flex: 1; }
.snake-x { border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--text-3); cursor: pointer; padding: 2px 6px; }
.snake-card p { margin: 6px 0 10px; line-height: 1.45; }
.snake-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.snake-off { border: 0; background: none; color: var(--text-3); font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
@media (max-width: 760px) { .snake-card { bottom: calc(88px + env(safe-area-inset-bottom)); } .snake-stage { bottom: calc(68px + env(safe-area-inset-bottom)); } }
@media print { .snake-card, .snake-stage, .snake-hiss { display: none !important; } }

/* Insights (superusers): daily bars and the weekday × hour heatmap. */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 8px; border-bottom: 1px solid var(--border); }
.bars > span { flex: 1; min-width: 3px; height: 100%; display: flex; align-items: flex-end; }
.bars > span > i { display: block; width: 100%; background: var(--chart); border-radius: 4px 4px 0 0; min-height: 1px; }
.bars > span:hover > i { opacity: 0.75; }
.bars-axis { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-3); margin-top: 4px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 0.75rem; width: 100%; min-width: 320px; table-layout: fixed; }
.heat col.day { width: 34px; }
.heat thead th { overflow: visible; white-space: nowrap; text-align: left; }
.heat th { color: var(--text-3); font-weight: 500; text-align: right; padding-right: 4px; white-space: nowrap; }
.heat thead th { padding: 0; }
.heat td { height: 18px; border-radius: 3px; background: var(--surface-2); }
.heat td.h1 { background: color-mix(in srgb, var(--chart) 25%, var(--surface)); }
.heat td.h2 { background: color-mix(in srgb, var(--chart) 45%, var(--surface)); }
.heat td.h3 { background: color-mix(in srgb, var(--chart) 70%, var(--surface)); }
.heat td.h4 { background: var(--chart); }
.heat-key { display: flex; gap: 4px; align-items: center; font-size: 0.78rem; color: var(--text-3); margin-top: 6px; }
.heat-key i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; background: var(--surface-2); }
.heat-key i.h1 { background: color-mix(in srgb, var(--chart) 25%, var(--surface)); }
.heat-key i.h2 { background: color-mix(in srgb, var(--chart) 45%, var(--surface)); }
.heat-key i.h3 { background: color-mix(in srgb, var(--chart) 70%, var(--surface)); }
.heat-key i.h4 { background: var(--chart); }

/* Announcements: banners at the top of every page (partials/announcements.html). */
.announcements { display: grid; gap: 8px; margin-bottom: 16px; }
.announcement { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--chart); box-shadow: var(--shadow); }
.announcement .main { flex: 1 1 280px; min-width: 0; }
.announcement p { margin: 4px 0 0; color: var(--text-2); overflow-wrap: anywhere; }
.announcement .actions { display: flex; gap: 8px; align-items: center; }
.announcement.important { border-left-color: var(--warn); background: var(--warn-soft); }
.announcement.important strong { color: var(--warn); }
.announcement.urgent { border-left-color: var(--bad); background: var(--bad-soft); }
.announcement.urgent strong { color: var(--bad); }

/* Activity (/settings/activity/) */
table.activity td.num { white-space: nowrap; vertical-align: top; }
table.activity td.primary { vertical-align: top; white-space: nowrap; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li + li { margin-top: 4px; }
.activity-verb { font-weight: 600; }
.activity-verb.add { color: var(--good); }
.activity-verb.delete { color: var(--bad); }
.activity-list .activity-history { font-size: 0.8rem; font-weight: normal; margin-left: 4px; }

/* Event detailed schedule (event page card and its editor) */
.schedule .time-col { width: 170px; flex: none; font-weight: 600; font-size: 0.93rem; }
.schedule .row.now { background: var(--accent-soft); }
.schedule-day { margin: 10px 18px 2px; font-size: 0.95rem; }
table.schedule-edit td { padding: 6px; vertical-align: top; }
table.schedule-edit input:not([type=checkbox]) { width: 100%; min-width: 92px; display: block; }
/* iOS Safari (iPad) ignored width on the time pickers: they ran into the next
   column and stood taller than the text inputs. Same fix as .field above. */
table.schedule-edit input[type=time] { min-width: 108px; max-width: 100%; }
@supports (-webkit-touch-callout: none) {
  table.schedule-edit input[type=time] { -webkit-appearance: none; appearance: none; text-align: left; }
  table.schedule-edit input::-webkit-date-and-time-value { text-align: left; }
}
table.schedule-edit select { min-width: 118px; }
table.schedule-edit td.wide input { min-width: 180px; }
@media (max-width: 640px) { .schedule .time-col { width: 92px; font-size: 0.87rem; } }

/* Printed to-do list (task_print.html) */
.todo-sheet { max-width: 900px; }
.todo-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  border-bottom: 2px solid var(--text); padding-bottom: 8px; margin-bottom: 12px; }
.todo-head h2 { margin: 0; font-size: 1.4rem; }
.todo-head p { margin: 2px 0 0; }
.todo-date { text-align: right; font-weight: 600; }
.todo-date small { font-weight: 400; color: var(--text-2); }
.todo-group { break-inside: avoid-page; margin-bottom: 14px; }
.todo-group h3 { font-size: 1rem; margin: 0 0 4px; }
.todo-table { width: 100%; border-collapse: collapse; }
.todo-table td { padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.todo-table tr { break-inside: avoid; }
.todo-box { width: 1.6em; font-size: 1.2rem; line-height: 1; }
.todo-who { width: 30%; color: var(--text-2); }
.todo-due { width: 14%; white-space: nowrap; text-align: right; }
.todo-blank td { height: 2em; }
@media print {
  .topbar, .nav, .site-footer, .no-print, .messages, .tabs { display: none !important; }
  .todo-sheet { max-width: none; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .todo-sheet, .todo-sheet * { color: #000 !important; background: #fff !important; }
  .todo-table td { border-bottom-color: #999; }
  .todo-sheet .badge { border: 1px solid #555; }
}
@media (max-width: 600px) { .todo-who { width: auto; } .todo-due { width: auto; } }
