/* Denver Ignite members' area (the Group System): one stylesheet. Mobile first (390 px), wider screens get a sidebar.
   Brand colors come from Settings as --brand1/--brand2 (inline <style> in the page head, see app/lib/colors.js).
   Light and dark follow the device unless the person chose one (the switch in the top bar, or My account), which
   the server writes as html[data-theme]. The dark tokens appear twice (device dark, and chosen dark) and must stay
   the same; a test compares them.
   Contrast is measured, not guessed: npm run check:contrast checks every screen against WCAG AA (text 4.5:1, large
   text, icons, borders of controls and focus rings 3:1). Fix a failure in the tokens here, or in app/lib/colors.js
   for the brand colors, rather than with a one-off color. */

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #111a2c;
  --muted: #525c70;
  --border: #dfe3ea;
  --border-strong: #7b8396; /* borders of inputs and buttons: 3:1 on every light surface */
  --focus: #1a5fd0;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --info: #1f5d99;
  --info-soft: #e6f0fa;
  --shadow: 0 1px 2px rgba(28, 31, 36, .06), 0 4px 14px rgba(28, 31, 36, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 44px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --danger-fill: #b42318; --danger-on: #ffffff;
  --chart3: #7b5cd6; --chart4: #a35f00; --chart5: #3f6fd1;
  --logo-plate: transparent;
  /* Brand tokens: the real values come from app/lib/colors.js in the page head; these are the defaults. */
  --brand1: #d3141c; --brand2: #24537e; --accent: #ff9f14;
  --brand1-fill: #d3141c; --brand1-on: #ffffff; --brand2-fill: #24537e; --brand2-on: #ffffff;
  --brand1-text: #cb131b; --brand2-text: #24537e; --brand1-soft: #f9dedf; --brand2-soft: #e0e7ed;
  --brand1-ui: #d3141c; --brand2-ui: #24537e;
  --mark1: #d3141c; --mark2: #24537e; --mark-on: #ffffff;
  --stripe-a: #24537e; --stripe-b: #d3141c; --heading: #24537e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b111d;
    --surface: #121a29;
    --surface-2: #172031;
    --text: #edf0f5;
    --muted: #a6afbf;
    --border: #283349;
    --border-strong: #76829a;
    --danger-fill: #ff8a80; --danger-on: #14161a;
    --chart3: #a993ff; --chart4: #f2a541; --chart5: #7aa7ff;
    --focus: #7fb0ff;
    --ok: #6fd39a; --ok-soft: #0f2619;
    --warn: #f3c25c; --warn-soft: #2b210b;
    --danger: #ff8a80; --danger-soft: #361917;
    --info: #8ec0f5; --info-soft: #122337;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b111d;
  --surface: #121a29;
  --surface-2: #172031;
  --text: #edf0f5;
  --muted: #a6afbf;
  --border: #283349;
  --border-strong: #76829a;
  --danger-fill: #ff8a80; --danger-on: #14161a;
  --chart3: #a993ff; --chart4: #f2a541; --chart5: #7aa7ff;
  --focus: #7fb0ff;
  --ok: #6fd39a; --ok-soft: #0f2619;
  --warn: #f3c25c; --warn-soft: #2b210b;
  --danger: #ff8a80; --danger-soft: #361917;
  --info: #8ec0f5; --info-soft: #122337;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word; /* breaks a word only when it cannot fit a line on its own (long addresses) */
}
img { max-width: 100%; height: auto; }
a { color: var(--brand2-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 800; color: var(--heading, var(--text)); }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 700; }
.skip-link:focus { top: 8px; }
.icon { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 6px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--stripe-a), var(--stripe-b));
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; min-height: var(--tap); min-width: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.05rem; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-weight: 900; font-size: .95rem; color: var(--mark-on);
  background: linear-gradient(135deg, var(--mark1), var(--mark2));
  transform: rotate(-4deg);
}
/* The logo sits on a plate only where its ink would not stand out (measured on upload, app/lib/images.js). */
.brand-logo { height: 36px; width: auto; max-width: 120px; object-fit: contain; background: var(--logo-plate, transparent); padding: var(--logo-pad, 0); border-radius: 8px; }
/* A wordmark (2:1 or wider, such as the Denver Ignite logo) says the name itself: shown larger, no name beside it. */
.brand-logo.wordmark { height: 46px; max-width: 150px; border-radius: 0; }
/* Two logos in the page, one for light and one for dark backgrounds; CSS shows the one for the current look, so
   the switch changes it at once with no flash and no script. */
.brand-logo.for-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo.for-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo.for-dark { display: inline-block; }
}
:root[data-theme="dark"] .brand-logo.for-light { display: none; }
:root[data-theme="dark"] .brand-logo.for-dark { display: inline-block; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-user { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); min-height: var(--tap); padding: 0 4px; border-radius: 999px; }
.topbar-user-name { display: none; font-weight: 600; }

/* Light or dark switch (partials/theme-switch.ejs, js/theme.js): a 44 px round button that opens three choices. */
.theme-switch { position: relative; }
.theme-btn { list-style: none; display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; cursor: pointer; color: var(--text); border: 2px solid var(--border-strong); background: var(--surface); }
.theme-btn::-webkit-details-marker { display: none; }
.theme-btn::marker { content: ""; }
.theme-btn:hover { background: var(--surface-2); }
.theme-switch[open] > .theme-btn { background: var(--surface-2); }
.theme-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: max-content; min-width: 220px; max-width: calc(100vw - 32px); padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.theme-menu-title { margin: 4px 10px 4px; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.theme-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
.theme-option:hover { background: var(--surface-2); }
.theme-option > span { flex: 1 1 auto; }
.theme-option .theme-tick { visibility: hidden; color: var(--brand1-text); }
.theme-option[aria-pressed="true"] { background: var(--brand1-soft); }
.theme-option[aria-pressed="true"] .theme-tick { visibility: visible; }
.plain-top { position: absolute; top: 12px; right: 16px; }

/* ---------- Layout ---------- */
.shell { display: block; }
.sidebar { display: none; }
.main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); min-width: 0; outline: none; }
/* The content uses the full width beside the sidebar; running text keeps a readable line length. */
.main p, .main .lead { max-width: 85ch; }
.main p.empty, .main .stat-grid p, .main td p, .main .alert p { max-width: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 16px; }
.page-head h1 { margin: 0; flex: 1 1 auto; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); text-decoration: none; font-weight: 600; color: var(--muted); }
.lead { font-size: 1.05rem; color: var(--muted); }

/* Bottom tab bar (phones). */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, .05);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; padding: 6px 2px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 650;
}
.tab .icon { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--brand1-text); }
.tab[aria-current="page"] .icon { stroke-width: 2.4; }
.tab[aria-current="page"]::after { content: ""; width: 18px; height: 3px; border-radius: 3px; background: var(--brand1-ui); margin-top: 1px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 56px); }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); overflow-y: auto;
    padding: 12px 12px; border-right: 1px solid var(--border); background: var(--surface);
  }
  .tabbar { display: none; }
  .main { padding: 24px 32px 48px; width: 100%; }
  .topbar-user-name { display: inline; }
  h1 { font-size: 1.85rem; }
}

/* Menu (sidebar and the /menu page). */
.menu-group { margin-bottom: 10px; }
.menu-group-name { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 750; padding: 6px 12px; margin: 0; }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-link {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 12px;
  border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 600;
}
.menu-link:hover { background: var(--surface-2); }
.menu-link[aria-current="page"] { background: var(--brand1-soft); color: var(--text); }
.menu-link[aria-current="page"] .icon { color: var(--brand1-text); }
/* Sidebar groups: a button opens or closes each (app.js remembers the choice in this browser). */
.menu-top { margin-bottom: 6px; }
.menu-group-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 4px 12px; margin: 0;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left;
  font: inherit; font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.menu-group-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-group-btn > span:first-child { flex: 1 1 auto; }
.menu-group-btn .menu-group-count { font-size: .72rem; font-weight: 700; letter-spacing: 0; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); text-align: center; }
.menu-group-btn .icon { width: 18px; height: 18px; transition: transform .15s ease; }
.menu-group-btn[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.menu-group-btn[data-current] { color: var(--text); }
.sidebar .menu-group { margin-bottom: 2px; }
.sidebar .menu-group .menu-list { margin: 2px 0 8px; }
.sidebar-foot { margin-top: auto; padding: 8px 0 0; border-top: 1px solid var(--border); display: grid; gap: 4px; }
@media (min-width: 900px) {
  .sidebar .menu-link { min-height: 38px; padding: 6px 12px; }
  .sidebar .menu-link .icon { width: 20px; height: 20px; }
}
.menu-page .menu-link { background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; min-height: 52px; }
.menu-page .menu-link .chev { margin-left: auto; color: var(--muted); }

/* ---------- Cards and lists ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.cards { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.cards > .card { margin-bottom: 0; }
@media (min-width: 700px) { .cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .cards.two { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cards.three { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--brand1-soft), var(--brand2-soft));
  border: 0;
}
.hero::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, var(--brand2) 0 6px, transparent 7px) 0 0 / 28px 28px;
  opacity: .25; transform: rotate(12deg); pointer-events: none;
}
.hero h1, .hero h2 { position: relative; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; color: var(--text); text-decoration: none; }
a.list-row:hover .list-title { text-decoration: underline; }
.list-main { flex: 1 1 auto; min-width: 0; }
.list-title { font-weight: 650; display: block; }
.list-sub { color: var(--muted); font-size: .9rem; display: block; }
.list-row .chev { color: var(--muted); }

.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; font-weight: 600; margin-top: 8px; }
.kv dd { margin: 0; }
@media (min-width: 700px) { .kv { grid-template-columns: 180px minmax(0, 1fr); } .kv dt { margin-top: 0; } .kv dt, .kv dd { padding: 6px 0; } }

/* Tables: stacked cards on phones (stack-sm); any table wider than its space scrolls inside its own box.
   Words never break in the middle: headings wrap only between words, and cells too, except cells marked
   .wrap-any (long addresses, emails, links). */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: normal; word-break: normal; hyphens: manual; }
table.data th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.data th.num, table.data td.num { text-align: right; }
table.data .wrap-any { overflow-wrap: anywhere; }
table.data td.wrap-any { min-width: 12ch; }
/* Sortable headings (app/public/js/tables.js). */
table.data th .th-sort { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; cursor: pointer; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: inherit; border-radius: 6px; }
table.data th.num .th-sort { flex-direction: row-reverse; }
table.data th .th-sort:hover { color: var(--text); }
table.data th .th-sort:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
table.data th .th-arrow { display: inline-block; width: 1em; text-align: center; color: var(--muted); flex: none; }
table.data th[aria-sort="ascending"] .th-arrow, table.data th[aria-sort="descending"] .th-arrow { opacity: 1; color: var(--brand1-text); }
table.data th[aria-sort] { color: var(--text); }
@media (max-width: 699px) {
  table.data.stack-sm td { overflow-wrap: break-word; }
  table.data.stack-sm thead { display: none; }
  table.data.stack-sm, table.data.stack-sm tbody, table.data.stack-sm tr, table.data.stack-sm td { display: block; width: 100%; }
  table.data.stack-sm tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  table.data.stack-sm td { border: 0; padding: 2px 0; }
  table.data.stack-sm td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 600; }
}

/* ---------- Avatars, badges, meters ---------- */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; font-weight: 800; font-size: .95rem;
  background: var(--brand2-soft); color: var(--brand2-text); border: 2px solid var(--surface);
}
.avatar.sm { width: 34px; height: 34px; font-size: .8rem; }
.avatar.lg { width: 96px; height: 96px; font-size: 1.8rem; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.brand { background: var(--brand1-soft); color: var(--brand1-text); border-color: transparent; }
.badge.teal { background: var(--brand2-soft); color: var(--brand2-text); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.meter { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand1-ui), var(--brand2-ui)); }

/* ---------- Alerts and banners ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert p:last-child { margin-bottom: 0; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert a { color: inherit; font-weight: 700; }
.alert-body { color: var(--text); }
.banner { background: var(--warn-soft); color: var(--warn); padding: 10px 16px; font-size: .9rem; font-weight: 600; text-align: center; }
.banner a { color: inherit; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px;
  border-radius: 999px; border: 2px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, background-color .15s ease;
}
.button:hover { background: var(--surface-2); }
.button:active { transform: translateY(1px) scale(.99); }
.button.primary { background: var(--brand1-fill); border-color: var(--brand1-fill); color: var(--brand1-on); }
.button.primary:hover { filter: brightness(1.06); }
.button.teal { background: var(--brand2-fill); border-color: var(--brand2-fill); color: var(--brand2-on); }
.button.danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--danger-on); }
.button.ghost { border-color: transparent; background: transparent; }
.button.small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.button.block { width: 100%; }
/* Disabled: plainly different (dashed, muted) but still readable, so no fading with opacity. */
.button[disabled], .button[disabled]:hover { background: var(--surface-2); border-color: var(--border-strong); border-style: dashed; color: var(--muted); cursor: not-allowed; filter: none; transform: none; }
.link-button { background: none; border: 0; padding: 0; color: var(--brand2-text); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; min-height: var(--tap); }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
@media (max-width: 520px) { .actions-row.stretch > .button { flex: 1 1 100%; } }
/* Quick buttons: each action names itself, with Submit (the quick form) and Show (my own list) side by side.
   Two tiles a row on a 390 px phone, three on wider screens; every button at least 44 px tall. */
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 700px) { .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } }
.quick-action {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 8px; border-radius: 12px; font-weight: 750; font-size: 1rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.quick-name { display: flex; align-items: center; gap: 8px; min-height: 30px; line-height: 1.15; }
.quick-action .icon { width: 28px; height: 28px; flex: none; color: var(--brand1-text); }
.quick-action:nth-child(even) .icon { color: var(--brand2-text); }
.quick-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-top: auto; }
.quick-buttons .button.small { min-height: var(--tap); padding: 4px; font-size: .95rem; border-width: 2px; }
/* Wide screens: name and buttons on one row, so the card is no taller than the old icon tiles. */
@media (min-width: 1100px) {
  .quick-action { flex-direction: row; align-items: center; gap: 8px; }
  .quick-name { flex: 1 1 auto; min-width: 0; }
  .quick-buttons { flex: none; grid-template-columns: 80px; margin-top: 0; }
  .quick-action.has-list .quick-buttons { grid-template-columns: 74px 74px; }
}
.quick-buttons .button.small:not(.primary) { border-color: var(--border-strong); color: var(--text); background: var(--surface); }

/* ---------- Forms ---------- */
.form { max-width: 620px; }
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: block; font-weight: 650; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: .875rem; margin: 4px 0 0; }
.field .error-text { color: var(--danger); font-size: .9rem; font-weight: 600; margin: 6px 0 0; }
.req { color: var(--brand1-text); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=password], input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
}
input[type=color] { width: 64px; height: var(--tap); padding: 2px; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
textarea { min-height: 120px; resize: vertical; }
::placeholder { color: var(--muted); opacity: 1; } /* the browser's own gray is 3.6:1 on the dark surface */
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.check { display: flex; gap: 12px; align-items: flex-start; min-height: var(--tap); padding: 8px 0; cursor: pointer; font-weight: 500; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--brand1-fill); }
.choice-group { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0 0 16px; }
.choice-group legend { font-weight: 650; margin-bottom: 6px; padding: 0; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: inline-flex; align-items: center; min-height: var(--tap); padding: 8px 16px; border-radius: 999px; border: 2px solid var(--border-strong); font-weight: 650; cursor: pointer; background: var(--surface); }
.choice input:checked + span { background: var(--brand1-soft); border-color: var(--brand1-text); color: var(--text); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.code-input { font-size: 1.8rem !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; max-width: 260px; }
.inline-form { display: inline; }
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1 1 auto; }

/* ---------- Plain layout (sign-in) ---------- */
.plain-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 68px 16px 32px; background:
  radial-gradient(circle at 10% 0%, var(--brand1-soft), transparent 45%),
  radial-gradient(circle at 100% 100%, var(--brand2-soft), transparent 45%), var(--bg); }
.plain-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.plain-card.wide { max-width: 680px; }
.plain-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-bottom: 18px; }
.plain-brand .brand-mark { width: 60px; height: 60px; font-size: 1.4rem; border-radius: 18px; }
.plain-brand .brand-logo { height: 64px; max-width: 220px; }
.plain-brand .brand-logo.wordmark { height: 104px; max-width: 290px; }
.plain-brand h1 { font-size: 1.45rem; margin: 0; }
.plain-foot { margin-top: 16px; font-size: .85rem; color: var(--muted); text-align: center; }
@media (min-width: 600px) { .plain-body { justify-content: center; } .plain-card { padding: 36px 32px; } }

/* ---------- Calendar ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.month-nav h2 { margin: 0; text-align: center; flex: 1; }
.event { display: flex; gap: 12px; align-items: stretch; padding: 10px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.event:last-child { border-bottom: 0; }
.event-date { flex: none; width: 56px; border-radius: 12px; text-align: center; padding: 6px 0; background: var(--brand1-soft); color: var(--brand1-text); font-weight: 800; line-height: 1.1; }
.event-date .dow { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.event-date .day { display: block; font-size: 1.4rem; }
.event.cancelled .event-date, .event.off .event-date { background: var(--surface-2); color: var(--muted); }
.event.extra .event-date { background: var(--brand2-soft); color: var(--brand2-text); }
.event-main { flex: 1; min-width: 0; align-self: center; }
/* Past dates: quieter colors, not faded (fading with opacity drops text below 4.5:1). */
.event.past .event-date { background: var(--surface-2); color: var(--muted); }
.event.past .event-title { color: var(--muted); }
.event-title { font-weight: 700; display: block; }
.event.cancelled .event-title { text-decoration: line-through; }
.event-sub { color: var(--muted); font-size: .9rem; display: block; }

/* ---------- Profiles and directory ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head .who { min-width: 0; flex: 1 1 200px; }
.profile-head h1 { margin: 0 0 4px; }
.member-card { display: flex; gap: 12px; align-items: flex-start; }
.member-card .who { flex: 1; min-width: 0; }
.member-card .name { font-weight: 750; color: var(--text); text-decoration: none; }
.contact-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.board-grid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .board-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.board-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); min-height: 60px; }
.board-item.open { border-style: dashed; }
.board-item.wanted { border: 2px solid var(--brand1-text); background: var(--brand1-soft); }
.wanted-rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--brand1-fill); color: var(--brand1-on); flex: none; }
.rules-text { max-width: 70ch; }
.rules-text li { margin-bottom: 6px; }
.logo-preview { max-height: 80px; width: auto; background: #fff; border-radius: 8px; padding: 4px; border: 1px solid var(--border); }
.logo-preview.on-dark { background: #0b111d; padding: 8px; }
.photo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.empty { text-align: center; padding: 24px 12px; color: var(--muted); }
.section-title { margin-top: 24px; }
footer.app-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
input[type=file] { font: inherit; max-width: 100%; min-height: var(--tap); color: var(--muted); }
input[type=file]::file-selector-button {
  min-height: 40px; padding: 8px 16px; margin-right: 10px; border-radius: 999px;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
a.board-item { color: var(--text); text-decoration: none; }
a.board-item:hover .list-title { text-decoration: underline; }
a.card.list-row { text-decoration: none; }

/* ---------- Slips, visitors, attendance, scores (steps 5 to 8) ---------- */
.quick-card { padding: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; position: relative; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 1.5rem; font-weight: 850; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.tab-link { display: inline-flex; align-items: center; min-height: var(--tap); padding: 8px 16px; border-radius: 999px; border: 2px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 700; text-decoration: none; }
.tab-link[aria-current="page"] { background: var(--brand1-soft); border-color: var(--brand1-text); }
.check-list { border: 0; padding: 0; margin: 0 0 16px; }
.check-list legend { padding: 0; margin-bottom: 4px; }
@media (min-width: 700px) { .check-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; } .check-list legend, .check-list .error-text { grid-column: 1 / -1; } }
.choice-group .error-text, .error-text.full { flex-basis: 100%; color: var(--danger); font-size: .9rem; font-weight: 600; margin: 4px 0 0; }
.pad-bottom { padding-bottom: 10px; }
.pre-line { white-space: pre-line; }
.score-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; position: relative; }
.score-trio a { text-decoration: none; color: var(--text); border-radius: 12px; padding: 8px 4px; background: var(--surface); border: 1px solid var(--border); }
.score-trio .stat-num { font-size: 1.7rem; }
.spark { display: block; width: 100%; height: 48px; margin-top: 8px; }
.spark rect { fill: var(--brand2-ui); }
/* The forecast for the current month: a dotted outline above the points so far (same color as every month). */
.spark rect.forecast { fill: none; stroke: var(--brand2-text); stroke-width: 1.5px; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.trend-caption { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.forecast-key { display: inline-block; width: 14px; height: 12px; border: 1.5px dashed var(--brand2-text); border-radius: 2px; flex: none; }
.att-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.att-row:last-child { border-bottom: 0; }
.att-row .who { display: flex; gap: 10px; align-items: center; min-width: 0; font-weight: 650; }
.att-row select { min-height: var(--tap); }
.att-row .att-extra { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.att-row .att-extra input { min-height: 40px; }
.att-row.diff { background: var(--warn-soft); border-radius: 10px; padding: 8px; }
.ready-text { font-family: inherit; min-height: 220px; }
.cards > .quick-card { grid-column: 1 / -1; }
.section-gap { margin-top: 8px; }
.score-trio a[aria-current] { border: 2px solid var(--brand1-text); background: var(--brand1-soft); }
.score-trio .stat-label { display: block; }
.score-trio .stat-num { display: block; }

/* ---------- Slides, editor, run of meeting (step 12) ---------- */
.flush { margin: 0; }
.slide-thumb { display: block; width: 100%; max-width: 320px; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.slide-thumb.small { width: 96px; max-width: 96px; flex: none; }
.slide-none { display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }
.slide-thumb-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumb-grid .slide-thumb.small { width: 100%; max-width: none; }
.slide-status { border-bottom: 1px solid var(--border); padding: 10px 0; }
.slide-status:last-child { border-bottom: 0; }
.slide-status-main { display: flex; gap: 12px; align-items: center; }
.slide-status .list-sub { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
details > summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 650; color: var(--brand2-text); }
.editor-list, .commercial-list { list-style: none; margin: 0; padding: 0; }
.editor-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.editor-item:last-child { border-bottom: 0; }
.editor-item.is-hidden .list-title { color: var(--muted); text-decoration: line-through; }
.editor-main { display: flex; gap: 10px; align-items: center; min-width: 0; }
.editor-num { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--brand2-soft); color: var(--brand2-text); }
.editor-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.editor-actions .button.small { min-height: var(--tap); min-width: var(--tap); padding: 6px 12px; }
.editor-sub, .editor-custom { grid-column: 1 / -1; margin: 0; }
@media (min-width: 700px) { .editor-item { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }
.ann-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ann-item:last-child { border-bottom: 0; }
.ann-item.is-hidden .ann-body { color: var(--muted); text-decoration: line-through; }
.ann-body { margin-bottom: 4px; }
.input-narrow { width: 110px !important; }
.row-warn td { background: var(--warn-soft); }
.commercial-group { border-bottom: 1px solid var(--border); padding: 6px 0; }
.commercial-group:last-child { border-bottom: 0; }
.commercial-group.joint { background: var(--brand1-soft); border-radius: 12px; padding: 8px 10px; margin: 6px 0; border-bottom: 0; }
.joint-label { margin: 0 0 4px; }
.commercial-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; min-height: 52px; }
.commercial-actions { display: flex; gap: 6px; }
.commercial-actions .button.small { min-height: var(--tap); min-width: var(--tap); }
.list-row > .button, .list-row > form .button { flex: none; white-space: nowrap; }
.agenda-table td:first-child, .agenda-table th:first-child { white-space: nowrap; width: 1%; }
.agenda-table .num { text-align: right; white-space: nowrap; width: 1%; font-variant-numeric: tabular-nums; }
.agenda-table .list-sub { font-size: .82rem; }

/* ---------- Display remote and door prize draws (step 13) ---------- */
.remote-now { text-align: center; }
.remote-who { font-size: 1.4rem; font-weight: 800; margin: 6px 0 0; }
.remote-clock { font-size: 3rem; font-weight: 900; font-variant-numeric: tabular-nums; margin: 0; line-height: 1.1; min-height: 1.1em; }
.remote-clock.warn { color: var(--brand1-text); }
.remote-clock.over { color: var(--danger); }
.remote-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 520px) { .remote-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.remote-next { min-height: 64px; font-size: 1.15rem; }
.remote-winner { font-weight: 800; font-size: 1.15rem; margin: 12px 0 0; }
.remote-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.remote-item { width: 100%; text-align: left; min-height: var(--tap); padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.remote-item[aria-current="true"] { background: var(--brand1-soft); border-color: var(--brand1-text); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-win td { background: var(--ok-soft); font-weight: 700; }

/* ---------- Communication, reports (steps 14 to 17) ---------- */
.post-image { display: block; width: 100%; max-width: 360px; height: auto; border-radius: 12px; border: 1px solid var(--border); }
.chart-box { position: relative; width: 100%; min-height: 240px; max-height: 340px; }
.chart-box canvas { width: 100% !important; }
.report-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.report-filter .field { margin: 0; flex: 1 1 140px; }
.table-wrap { overflow-x: auto; }
.hl td { background: var(--warn-soft); }
.decision { margin-top: 6px; }
.badge.decision { white-space: normal; height: auto; max-width: 100%; display: inline-block; line-height: 1.35; padding-top: 3px; padding-bottom: 3px; }

/* Help page (the guides on screen) */
.guide { max-width: 72ch; }
.guide h2 { margin-top: 1.6em; padding-top: .4em; border-top: 1px solid var(--border); }
.guide h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.guide h3 { margin-top: 1.2em; }
.guide li { margin-bottom: 6px; }
.guide pre { overflow-x: auto; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; }
.guide code { font-size: .9em; }
.guide-toc { columns: 2 14em; padding-left: 1.2em; }
.guide-toc li { break-inside: avoid; }
.guide-toc a { display: inline-block; min-height: 34px; padding: 4px 0; }

/* Member slides for commercials (meeting page, AV screen, list page). */
.name-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.name-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 700; }
.name-chip:hover { border-color: var(--brand1-text); }
.name-chip-count { flex: none; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center; background: var(--brand1-soft); color: var(--brand1-text); font-weight: 800; }
.commercial-slides { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.commercial-slide { margin: 0; padding: 8px; }
.commercial-slide img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 10px; }
.commercial-slide figcaption { padding: 6px 4px 0; }

/* ---------- Drafts and the Approve screen (2026-11-16) ---------- */
.badge.draft { background: var(--surface); color: var(--text); border: 1px dashed var(--border-strong); }
.slip-row { border-bottom: 1px solid var(--border); }
.slip-row:last-child { border-bottom: 0; }
.slip-row > .list-row { border-bottom: 0; }
.slip-actions { display: flex; gap: 6px; padding: 0 12px 10px; }
.question-text { color: var(--warn); }
.filter-row { max-width: none; }
.approve-group h2 { display: flex; align-items: center; gap: 8px; }
.approve-member { font-size: .95rem; margin: 10px 0 4px; color: var(--muted); }
.approve-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
/* One compact row per slip: checkbox and text on the left, Open and Change on the right. */
.approve-item { border: 1px solid var(--border); border-radius: 10px; padding: 2px 10px; background: var(--surface); display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
.approve-item .approve-question { grid-column: 1 / -1; }
.approve-item.was-questioned { border-color: var(--warn); }
.approve-check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; min-height: var(--tap); }
.approve-check input[type=checkbox] { width: 28px; height: 28px; margin: 2px 0 0; flex: none; accent-color: var(--brand2-fill); }
.approve-main { display: flex; flex-direction: column; gap: 0; min-width: 0; padding: 4px 0; line-height: 1.3; }
.approve-question { margin: 2px 0 8px 40px; }
.approve-question label { display: block; font-weight: 650; font-size: .88rem; margin-bottom: 4px; }
.approve-question textarea { width: 100%; min-height: 60px; }
/* A checked item is approved, so its question box is hidden. */
.approve-item:has(input[name=item]:checked) .approve-question { display: none; }
.approve-links { margin: 0; display: flex; gap: 14px; }
/* Long descriptions show two lines; Open shows the rest. */
.approve-main .list-sub { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 599px) {
  .approve-item { column-gap: 6px; padding: 2px 8px; }
  .approve-links { flex-direction: column; gap: 0; align-items: flex-end; }
  .approve-links a { min-height: 36px; }
}
.approve-links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.approve-bar {
  position: sticky; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 25;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: flex-end;
  margin-top: 12px; padding: 10px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 -4px 18px rgba(0, 0, 0, .12);
}
.approve-bar .approve-count { margin-right: auto; color: var(--muted); font-weight: 650; }
.approve-bar .button.small { min-height: var(--tap); }
.approve-bar .button.primary { min-width: 120px; }
@media (min-width: 900px) { .approve-bar { bottom: 12px; } }

/* ---------- Printing: the group's logo and name at the top, no menus ---------- */
.print-head { display: none; }
@media print {
  :root { --bg: #ffffff; }
  body { background: #fff; color: #000; }
  .topbar, .sidebar, .tabbar, .skip-link, .banner, .theme-switch, .plain-top, form .button, .page-actions { display: none !important; }
  .print-head { display: flex; align-items: center; gap: 14px; padding: 0 0 10px; margin: 0 0 14px; border-bottom: 3px solid var(--brand1); }
  .print-head img { height: 54px; width: auto; }
  .print-head span { font-weight: 800; font-size: 1.1rem; color: var(--brand2); }
  .shell, .main { display: block; padding: 0; margin: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* Shown on a phone only: large feature presentation files are best uploaded from a computer. */
.phone-note { display: flex; gap: 6px; align-items: flex-start; }
@media (min-width: 900px) { .phone-note { display: none; } }
