/* Additions on top of Pico (pico.classless.min.css, v2.1.1, saved in the repo). Pico styles the plain elements;
   this file only adds what the app needs: rows of controls, tags, head counts, the calendar and the roster. */
:root {
  --ok-bg: #dafbe1; --ok: #116329;
  --warn-bg: #fff8c5; --warn: #7d4e00;
  --changed: #e8a33d;  /* preview marks */
  --bad-bg: #ffebe9; --bad: #a40e26;
  --info-bg: #ddf4ff; --info: #0550ae;
}
body > main { display: flex; flex-direction: column; gap: 1.25rem; }
h1, h2, h3 { margin-bottom: 0; }

/* ---------- Header and tabs ---------- */
header.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-block: .75rem; border-bottom: 1px solid var(--pico-muted-border-color); }
header.bar .brand { font-weight: 700; text-decoration: none; margin-right: auto; }
header.bar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
header.bar nav a { padding: .3rem .6rem; border-radius: var(--pico-border-radius); text-decoration: none; }
header.bar nav a[aria-current="page"] { background: var(--pico-secondary-background); color: var(--pico-secondary-inverse); }
nav.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--pico-muted-border-color); }
nav.tabs a { padding: .45rem .8rem; text-decoration: none; color: var(--pico-muted-color); border-bottom: 2px solid transparent; }
nav.tabs a[aria-current="page"] { color: var(--pico-color); border-bottom-color: var(--pico-primary); }

/* ---------- Buttons: Pico's primary for the main action, secondary for the rest ---------- */
button, button[type="submit"], [role="button"] { width: auto; }
button:not(.primary, .danger), [role="button"]:not(.primary) {
  --pico-background-color: var(--pico-secondary-background);
  --pico-border-color: var(--pico-secondary-border);
  --pico-color: var(--pico-secondary-inverse);
}
button.danger { --pico-background-color: var(--bad); --pico-border-color: var(--bad); --pico-color: #fff; }
button.small, [role="button"].small { padding: .25rem .6rem; font-size: .85rem; }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0 1rem; align-items: start; }
/* A row of fields and buttons, lined up on the bottom edge of the controls. */
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.row > label { flex: 1 1 12rem; margin-bottom: 0; }
.row.tight > label { flex: 0 1 auto; }
.row.mid { align-items: center; }
.row.spread { justify-content: space-between; }
.row :is(input, select, button, [role="button"]), td :is(input, select, button), td form { margin-bottom: 0; }
fieldset { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: 1rem; min-width: 0; } /* browsers default fieldsets to min-content, which let wide tables push the page sideways */
legend { font-weight: 600; padding: 0 .35rem; }
label.check { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.muted { color: var(--pico-muted-color); font-size: .875rem; }
.error { color: var(--bad); font-size: .875rem; }

/* ---------- Messages and tags ---------- */
.notice { padding: .75rem 1rem; border-radius: var(--pico-border-radius); background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color); }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.notice strong { display: block; }
.notice ul { margin: .4rem 0 0; }
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 500; white-space: nowrap; border: 1px solid var(--pico-muted-border-color); color: var(--pico-muted-color); }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tag.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.neg { color: var(--bad); }

/* ---------- Tables ---------- */
.scroll { overflow-x: auto; }
.scroll table { margin-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td input.num { width: 5.5rem; }
tr.void td { color: var(--pico-muted-color); text-decoration: line-through; }
tr.void td.keep { text-decoration: none; }
td .kids { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }

/* ---------- Head counts and totals ---------- */
dl.stats { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; }
dl.stats > div { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: .5rem .8rem; min-width: 7rem; }
dl.stats dt { font-size: .8rem; color: var(--pico-muted-color); }
dl.stats dd { margin: 0; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Category colours: always shown with the category word or the event name. */
.cat-sports { background: #dafbe1; color: #116329; }
.cat-learning { background: #ddf4ff; color: #0550ae; }
.cat-fundraiser { background: #fff1e5; color: #953800; }
.cat-celebration { background: #ffeff7; color: #99286e; }
.cat-community { background: #fbefff; color: #6e40c9; }

/* ---------- Roster ---------- */
ol.roster { margin: 0; padding: 0; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); }
ol.roster li { list-style: none; display: grid; grid-template-columns: 9rem 1fr; gap: .2rem 1rem; padding: .6rem .8rem; margin: 0; border-bottom: 1px solid var(--pico-muted-border-color); }
ol.roster li:last-child { border-bottom: 0; }
ol.roster .time { color: var(--pico-muted-color); font-variant-numeric: tabular-nums; }
ol.roster .people { grid-column: 2; color: var(--pico-muted-color); font-size: .9rem; }
@media (max-width: 30rem) {
  ol.roster li { grid-template-columns: 1fr; }
  ol.roster .people { grid-column: 1; }
}

/* ---------- Print ---------- */
@media print {
  header.bar, nav.tabs, button, [role="button"], .noprint { display: none !important; }
  .scroll { overflow: visible; }
  tr, ol.roster li { break-inside: avoid; }
}

/* ---------- Committee: next event on the Events page ---------- */
article.hero { margin: 0; display: flex; flex-direction: column; gap: 1rem; border-left: 4px solid var(--pico-primary); }
article.hero > header { margin-bottom: 0; }
article.hero > header h2 { font-size: 1.6rem; margin: .1rem 0 .25rem; }
article.hero > header h2 a { text-decoration: none; }
article.hero > header p { margin: 0; color: var(--pico-muted-color); }
article.hero > footer { margin-top: 0; }


/* ---------- Public site ---------- */
/* Plain header: club name in the theme colour, a thin theme-coloured rule underneath. */
header.site { border-bottom: 3px solid var(--pico-primary); }
header.site h1 { color: var(--pico-primary); margin: 0; }
header.site p { color: var(--pico-muted-color); margin: .25rem 0 0; }
header.site p.back { margin: 0 0 .25rem; font-size: .9rem; }

footer.site { text-align: center; color: var(--pico-muted-color); font-size: .85rem; border-top: 1px solid var(--pico-muted-border-color); }

/* ---------- Public home: one centred column on every screen ---------- */
body.public > header, body.public > main, body.public > footer { max-width: 46rem; }
header.site > div { text-align: center; }
header.site a.logo { display: inline-flex; flex-direction: column; align-items: center; gap: .25rem; text-decoration: none; color: var(--pico-primary); }
header.site a.logo img { height: 5rem; width: auto; display: block; }
header.site a.logo span { font-size: 1.1rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
header.site h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
header.bar .brand { display: inline-flex; align-items: center; gap: .5rem; }
header.bar .brand img { height: 2rem; width: auto; }
/* Event form "When": only the fields for the chosen kind of date. Browsers without :has() show them all. */
.when:has(input[name="date_mode"]:checked) .w { display: none; }
.when:has(input[value="one"]:checked) .w-one, .when:has(input[value="range"]:checked) .w-range,
.when:has(input[value="sessions"]:checked) .w-sessions, .when:has(input[value="tbc"]:checked) .w-tbc { display: revert; }
.when [role="radiogroup"] label { margin: 0; }
.grid.sessions { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.grid.sessions input { margin-bottom: 0; }

/* Committee preview of a public event page: a banner and a mark on every changed part. */
.preview-bar { text-align: left; margin: 0 0 1rem; padding: .75rem 1rem; border-radius: var(--pico-border-radius); background: var(--warn-bg); color: var(--warn); }
.preview-bar p { margin: .4rem 0 0; }
.preview-bar table { margin: .5rem 0 0; font-size: .85rem; }
.changed { outline: 3px dashed var(--changed); outline-offset: 3px; }  /* outline only: readable on light and dark */
/* Event key facts: label column beside the value; stacks on a narrow phone. */
article.facts { margin: 0 0 1.5rem; padding: 1.25rem; }
.facts-top { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .75rem; padding: 0; margin: 0 0 1rem; }
.fact { list-style: none; margin: 0; display: flex; gap: .75rem; align-items: flex-start; padding: .75rem;
  border-radius: var(--pico-border-radius); background: var(--pico-background-color); border: 1px solid var(--pico-muted-border-color); }
.fact-icon { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: color-mix(in srgb, var(--pico-primary) 15%, transparent); color: var(--pico-primary); }
.fact-icon .icon { width: 1.25rem; height: 1.25rem; }
.fact div { display: flex; flex-direction: column; min-width: 0; }
.fact small { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pico-muted-color); }
.fact strong { font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.fact span, .fact a { font-size: .95rem; }
.parents { display: flex; gap: .6rem; align-items: flex-start; margin: 0 0 1rem; padding: .75rem 1rem; border-radius: var(--pico-border-radius);
  border-left: 4px solid var(--pico-primary); background: color-mix(in srgb, var(--pico-primary) 8%, transparent); }
.parents .icon { margin-top: .15rem; color: var(--pico-primary); }
.join { padding-top: 1rem; border-top: 1px solid var(--pico-muted-border-color); }
.join h2 { font-size: 1.1rem; margin: 0 0 .4rem; }
.join p { margin: 0 0 .75rem; }
.join [role="button"] { display: inline-flex; align-items: center; gap: .4rem; }
@media (max-width: 480px) { .join .row [role="button"] { width: 100%; justify-content: center; } }
.meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: 0; margin: 0 0 .75rem; color: var(--pico-muted-color); }
.meta li { list-style: none; margin: 0; }
.prose { max-width: 42rem; }

/* Date block: weekday, day, month stacked, like a calendar tear-off. */
.datebox { flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 3.4rem; min-height: 3.6rem;
  border-radius: var(--pico-border-radius); border: 1px solid var(--pico-muted-border-color); background: var(--pico-card-background-color); line-height: 1.05; }
.datebox strong { font-size: 1.35rem; color: var(--pico-primary); }
.datebox small { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pico-muted-color); }
.datebox.big { width: 4.6rem; min-height: 5rem; background: var(--pico-primary); border-color: var(--pico-primary); }
.datebox.big strong { font-size: 2rem; color: var(--pico-primary-inverse); }
.datebox.big small { color: var(--pico-primary-inverse); opacity: .9; }

.next article { margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.next article > a[role="button"] { align-self: flex-start; }
.next-top { display: flex; gap: 1rem; align-items: flex-start; }
.next h2 { font-size: clamp(1.4rem, 5vw, 1.9rem); margin: .1rem 0 .3rem; }
.next p { margin: 0; }
.next .when { font-weight: 600; }

section.events h2 { font-size: 1.15rem; }
section.events h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pico-muted-color); margin: 1.25rem 0 .4rem; }
section.events ol { list-style: none; margin: 0; padding: 0; }
section.events li { list-style: none; margin: 0 0 .5rem; }
section.events li a { display: flex; align-items: center; gap: .85rem; padding: .55rem .7rem; border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius); text-decoration: none; color: var(--pico-color); background: var(--pico-card-background-color); }
section.events li a:hover { border-color: var(--pico-primary); }
section.events .what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
section.events .what small { color: var(--pico-muted-color); font-size: .82rem; }
section.events .chev { color: var(--pico-muted-color); font-size: 1.4rem; }
section.events details { margin-top: 1.25rem; }
section.events ol.past { opacity: .75; }
@media (max-width: 30rem) { header.site a.logo img { height: 3.5rem; } .datebox.big { width: 3.8rem; min-height: 4.2rem; } .datebox.big strong { font-size: 1.6rem; } }
/* Honeypot field on the public EOI form: hidden from people, filled in by bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* Group lists: one group per printed page. */
@media print { .print-page { break-after: page; } .print-page:last-child { break-after: auto; } }

/* =====================================================================
   Committee app shell (docs/research/admin-ui.md): sidebar on desktop,
   bottom tab bar on a phone, breadcrumb, white cards on a grey canvas.
   ===================================================================== */
body.admin {
  --canvas: #f3f5f8; --side-bg: #0f1b2d; --side-text: #c3cfdf; --side-muted: #7f8fa6; --side-hover: #18294a;
  --attention: #d4a017;
  background: var(--canvas);
}
@media (prefers-color-scheme: dark) { body.admin { --canvas: #0b1018; --side-bg: #0a121f; } }
.icon { width: 1.1rem; height: 1.1rem; flex: none; vertical-align: -0.2em; }

/* Sidebar */
aside.side { display: none; }
aside.side a { text-decoration: none; }
.side-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .75rem; color: #fff; font-weight: 700; }
.side-brand img { height: 2rem; width: auto; border-radius: 4px; background: #fff; padding: 2px; }
aside.side nav { display: flex; flex-direction: column; gap: 2px; padding: .25rem .5rem; }
aside.side nav a { display: flex; align-items: center; gap: .65rem; padding: .5rem .75rem; border-radius: 8px; color: var(--side-text); font-size: .95rem; }
aside.side nav a:hover { background: var(--side-hover); color: #fff; }
aside.side nav a[aria-current="page"] { background: var(--side-hover); color: #fff; box-shadow: inset 3px 0 0 var(--pico-primary); }
.side-group { margin: 1rem .75rem .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); }
.side-sub { display: flex; flex-direction: column; margin: 0 0 .25rem 2.2rem; border-left: 1px solid #2a3d5c; }
.side-sub .side-event { padding: .3rem .75rem; color: #fff; font-size: .85rem; font-weight: 600; }
aside.side .side-sub a { padding: .3rem .75rem; font-size: .85rem; border-radius: 0 6px 6px 0; }
.side-me { margin-top: auto; padding: .75rem 1rem 1rem; border-top: 1px solid #22324d; display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; color: var(--side-text); }
.side-me span, .side-me a { display: flex; align-items: center; gap: .5rem; color: var(--side-text); }
.side-me a:hover { color: #fff; }
.badge { margin-left: auto; min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--pico-primary); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.3rem; }
.badge.bad { background: var(--bad); }

/* Content column */
.shell { min-width: 0; overflow-x: clip; } /* wide content scrolls inside its own .scroll box, never the page */
.shell > main { max-width: 76rem; margin: 0 auto; padding: 1.25rem 1.25rem 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.shell > footer.site { max-width: 76rem; margin: 0 auto; padding: 1rem; }
.shell h1 { font-size: 1.6rem; }
.crumbs { max-width: 76rem; margin: 0 auto; padding: .9rem 1.25rem 0; font-size: .85rem; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.crumbs li { list-style: none; margin: 0; color: var(--pico-muted-color); }
.crumbs li + li::before { content: "›"; margin-right: .4rem; }
.crumbs a { color: var(--pico-muted-color); text-decoration: none; }
.crumbs a:hover { color: var(--pico-primary); }
.crumb-back { display: none; align-items: center; gap: .2rem; text-decoration: none; }

/* Cards: white surfaces on the grey canvas */
body.admin fieldset, body.admin .scroll, .page-head, .tile { background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color);
  border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 27, 45, .05); }
body.admin article { border-radius: 12px; margin: 0; }
body.admin .scroll table { margin: 0; }
body.admin .scroll th { background: var(--pico-card-sectioning-background-color); }
body.admin .scroll tbody tr:hover td { background: var(--pico-card-sectioning-background-color); }
.page-head { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.page-head p { margin: .2rem 0 0; }

/* Event page tabs as pills; they scroll sideways on a phone */
nav.tabs.pills { border-bottom: 0; gap: .4rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: .15rem; }
nav.tabs.pills a { white-space: nowrap; padding: .35rem .9rem; border: 1px solid var(--pico-muted-border-color); border-radius: 999px;
  background: var(--pico-card-background-color); color: var(--pico-color); margin: 0; }
nav.tabs.pills a[aria-current="page"] { background: var(--pico-primary); border-color: var(--pico-primary); color: var(--pico-primary-inverse); }

/* Home dashboard */
.next-card { display: flex; flex-direction: column; gap: 1rem; border-left: 4px solid var(--pico-primary); }
.next-card h2 { margin: .15rem 0 .25rem; font-size: 1.5rem; }
.next-card h2 a { text-decoration: none; }
.next-card p { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.tile { padding: 1rem; display: flex; flex-direction: column; gap: .35rem; text-decoration: none; color: var(--pico-color); }
.tile > .icon { width: 1.5rem; height: 1.5rem; color: var(--pico-primary); }
.tile.attention { border-left: 4px solid var(--attention); }
.tile.attention > .icon { color: var(--attention); }
a.tile:hover { border-color: var(--pico-primary); }
.tile a { text-decoration: none; }

/* Desktop: sidebar always visible */
@media (min-width: 1000px) {
  body.admin { padding-left: 15.5rem; }
  aside.side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 15.5rem; overflow-y: auto; background: var(--side-bg); z-index: 10; }
  nav.bottom { display: none; }
}

/* Phone and tablet: bottom tab bar, short breadcrumb */
@media (max-width: 999px) {
  body.admin { padding-bottom: 4.75rem; }
  nav.bottom { display: flex; position: fixed; inset: auto 0 0 0; z-index: 10; background: var(--pico-card-background-color);
    border-top: 1px solid var(--pico-muted-border-color); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); }
  nav.bottom a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .3rem 0;
    color: var(--pico-muted-color); text-decoration: none; font-size: .72rem; }
  nav.bottom a .icon { width: 1.4rem; height: 1.4rem; }
  nav.bottom a[aria-current="page"] { color: var(--pico-primary); }
  nav.bottom .badge { position: absolute; top: 0; left: calc(50% + .4rem); margin: 0; }
  .crumbs ol { display: none; }
  .crumb-back { display: inline-flex; }
  .shell > main { padding: 1rem .85rem 1.5rem; }
}

/* Phone: wide tables become stacked cards (cells label themselves with data-label) */
@media (max-width: 640px) {
  table.stack-sm thead { display: none; }
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; width: 100%; }
  table.stack-sm tr { padding: .6rem .25rem; border-bottom: 1px solid var(--pico-muted-border-color); }
  table.stack-sm td { border: 0; padding: .2rem .6rem; text-align: left; }
  table.stack-sm td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--pico-muted-color); }
  table.stack-sm td.num { text-align: left; }
}
@media print { aside.side, nav.bottom, .crumbs { display: none !important; } body.admin { padding: 0; background: none; } }
/* The sidebar lists the Settings pages on desktop, so the tab row is for phones only. */
@media (min-width: 1000px) { nav.tabs[aria-label="Settings"] { display: none; } }
