/* Colours and shapes follow the Microsoft 365 website and Microsoft's open Fluent 2 tokens
   (light theme): Segoe UI, white cards on a light grey canvas, a pale peach band under the
   header, black primary buttons and a blue accent. Light only. No Microsoft logo or name.
   An organization's own accent (base.html) still replaces --brand. */
:root {
  --bg: #f5f5f5;
  --canvas: #ffffff;
  --surface: #ffffff;
  --ink: #242424;
  --muted: #616161;
  --line: #d1d1d1;
  --line-soft: #e0e0e0;
  --hover: #f0f0f0;
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --brand-soft: #ebf3fc;
  --brand-ink: #ffffff;
  --cta: #000000;
  --cta-hover: #3d3d3d;
  --ok: #0e700e;
  --ok-bg: #f1faf1;
  --on-ok: #ffffff;
  --warn: #835b00;
  --warn-bg: #fff4ce;
  --out: #616161;
  --danger: #c50f1f;
  --danger-bg: #fde7e9;
  /* Fluent shared colours, for status marks and charts */
  --st-green: #107c10; --st-orange: #bc4b09; --st-red: #c50f1f; --st-purple: #5c2e91;
  --st-blue: #0f6cbd; --st-dark-blue: #0c3b5e; --st-grey: #d1d1d1; --st-teal: #038387;
  --band: linear-gradient(100deg, #fde9df 0%, #fdf0ea 40%, #eef3fb 100%);
  --radius: 8px;
  --shadow: 0 0 2px rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .14);
  --shadow-lg: 0 0 8px rgba(0, 0, 0, .12), 0 14px 28px rgba(0, 0, 0, .14);
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1 { font-size: 1.85rem; line-height: 1.2; margin: 0 0 .25rem; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; font-weight: 600; }

/* Header: maker | product on the left, menus in the middle, account on the right. */
.topbar {
  display: flex; align-items: center; gap: 1.25rem; min-height: 54px;
  padding: 0 max(16px, calc((100% - 1400px) / 2)); background: var(--canvas);
  border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 20;
}
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .7rem; flex: none; min-height: 44px; }
.maker { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-sep { width: 1px; height: 22px; background: var(--ink); }
.product { font-weight: 600; font-size: 1.1rem; }
.ball { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffb900, #f7630c 60%, #ca5010); }
.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav { display: flex; gap: .25rem; align-items: center; flex: 1; min-width: 0; }
.nav > a, .menu > summary {
  display: inline-flex; align-items: center; gap: .3rem; padding: 0 .65rem; min-height: 44px;
  color: var(--ink); text-decoration: none; font-size: .95rem; border-bottom: 2px solid transparent;
}
.nav > a:hover, .menu > summary:hover { text-decoration: underline; }
.nav > a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 600; }
.menu { position: relative; }
.menu > summary { cursor: pointer; list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.chev { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; transition: transform .15s; }
.menu[open] .chev { transform: rotate(180deg); }
.menu-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 300px; padding: .4rem;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-right { left: auto; right: 0; min-width: 240px; padding: .9rem; }
.menu-panel a, .menu-soon { display: flex; flex-direction: column; padding: .6rem .75rem; border-radius: 4px; color: var(--ink); text-decoration: none; margin: 0; }
.menu-panel a:hover { background: var(--hover); }
.menu-panel a[aria-current] { background: var(--brand-soft); }
.menu-panel span, .menu-who span { color: var(--muted); font-size: .85rem; }
.menu-soon { color: var(--muted); }
.menu-who { display: flex; flex-direction: column; margin: 0 0 .8rem; word-break: break-word; }
.menu-who strong { color: var(--ink); }
.menu.account { margin-left: auto; flex: none; }
.menu.account > summary { padding: 0; border: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: .95rem;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 1.75rem 16px 3rem; }
/* The pale band under the header, as on the Microsoft 365 site. */
body:has(.topbar .nav) {
  background: linear-gradient(180deg, rgba(245, 245, 245, 0) 0, var(--bg) 340px) top / 100% 340px no-repeat,
    var(--band) top / 100% 340px no-repeat, var(--bg);
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 0 .75rem; padding-top: .25rem; }
  .menu.account { order: 2; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav > a, .menu > summary { white-space: nowrap; }
  .products .menu-panel { position: fixed; left: 12px; right: 12px; top: 104px; min-width: 0; }
}
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 16px; }
.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 1.25rem 1.4rem; margin: 1rem 0; box-shadow: var(--shadow); }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { font-size: 1.15rem; }
.eyebrow { font-size: .85rem; color: var(--muted); font-weight: 600; margin: 0; }
.mono { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.plain form { margin: 0; }

/* Forms */
form > div { margin-bottom: .9rem; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel],
input[type=search], input[type=datetime-local], input[type=date], input:not([type]), textarea,
select {
  width: 100%; font: inherit; padding: .7rem .8rem; border: 1px solid var(--line);
  border-radius: 4px; background: var(--surface); color: var(--ink); min-height: 44px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
input[type=checkbox] { width: 22px; height: 22px; vertical-align: middle; margin-right: .5rem; }
form > div:has(input[type=checkbox]) { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: flex-start; gap: .5rem; }
form > div:has(input[type=checkbox]) label { font-weight: 400; }
.helptext, form div > div:not(:has(*)) { color: var(--muted); font-size: .85rem; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: .25rem 0; font-size: .9rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; padding: .5rem 1rem; border-radius: 4px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--cta); border-color: var(--cta); color: #fff; }
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-big { min-height: 56px; font-size: 1.1rem; }
.btn-in { background: var(--ok); border-color: var(--ok); color: var(--on-ok); min-width: 110px; }
.btn-out { background: transparent; border-color: var(--out); color: var(--out); min-width: 110px; }
.link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* Messages and pills */
.msg { padding: .7rem .9rem; border-radius: 4px; border-left: 4px solid var(--ok); background: var(--ok-bg); margin: 0 0 .5rem; }
.msg-error { background: var(--danger-bg); color: #6b0f1e; border-left-color: var(--danger); }
.msg-info { background: var(--warn-bg); border-left-color: var(--warn); }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 4px; background: var(--hover); color: #424242; }
.pill-ok { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px #9fd89f; }
.pill-warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px #fdeaa0; }

/* Dashboard */
.event-list { list-style: none; padding: 0; }
.event-item { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; }
.event-item a { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.empty { text-align: center; }
.callout { border-color: var(--brand); }

/* Event page */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 0; box-shadow: var(--shadow); border-top: 3px solid var(--brand); border-radius: var(--radius); padding: .8rem; text-align: center; }
.stat:nth-child(2) { border-top-color: var(--st-green); } .stat:nth-child(3) { border-top-color: var(--st-orange); }
.stat-n { display: block; font-size: 1.9rem; font-weight: 700; }
.stat-l { color: var(--muted); font-size: .85rem; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { min-width: 0; flex: 1; }
.copy-row .btn { white-space: nowrap; flex: none; }
.share-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0; }
.qr svg { width: 100%; height: auto; display: block; background: #fff; padding: 12px; border-radius: 10px; }
.qr-small { max-width: 220px; }
.qr-full { text-align: center; max-width: 520px; margin: 0 auto; }
.qr-full .qr { margin: 1rem auto; }

/* Board */
.search { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: .5rem 0; }
.board-count { margin: .5rem 0; }
.board-list { list-style: none; padding: 0; margin: 0; }
.board-item {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  background: var(--surface); border: 1px solid var(--line-soft); border-left: 6px solid var(--st-grey);
  border-radius: var(--radius); padding: .75rem; margin-bottom: .5rem;
}
.board-item.is-here { border-left-color: var(--st-green); }
.board-item.has-left { border-left-color: var(--st-grey); }
.board-item form { margin: 0; flex: none; }
.who { display: flex; flex-direction: column; min-width: 0; }
.times { color: var(--muted); }
.note { color: var(--warn); }
.big-check { font-size: 3rem; color: var(--ok); margin: 0; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

@media (max-width: 480px) {
  h1 { font-size: 1.35rem; }
  .board-item { align-items: flex-start; flex-direction: column; }
  .board-item form, .board-item .btn { width: 100%; }
}

.invite { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.invite:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.share-row form { margin: 0; }
.callout-quiet { border-style: dashed; }
.event-item .pill { align-self: start; justify-self: end; white-space: nowrap; }
.pill-danger { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 0 0 1px #eeacb2; }
/* Waiver and media release text sit under their questions, keeping the author's line breaks. */
.helptext { white-space: pre-line; }
form > div:has(input[type=checkbox]) { flex-wrap: wrap; }
form > div:has(input[type=checkbox]) .helptext { flex-basis: 100%; order: 3; max-height: 12rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; }
[id$="media_release"] { list-style: none; padding: 0; margin: .25rem 0; display: flex; gap: 1rem; flex-wrap: wrap; }
[id$="media_release"] label { font-weight: 400; display: flex; align-items: center; gap: .4rem; min-height: 44px; }
input[type=radio] { width: 22px; height: 22px; }
form > div:has(input[type=checkbox]) label { flex: 1; min-width: 0; }
form > div:has(input[type=checkbox]) input[type=checkbox] { flex: none; margin-top: .15rem; }

/* Organization branding. Logos often have a dark background, so they sit on black. */
.brand-logo { display: block; height: 40px; width: auto; max-width: 60vw; object-fit: contain; background: #000; border-radius: 6px; }
.hero-logo { max-width: 480px; margin: 0 auto 1rem; background: #000; border-radius: var(--radius); overflow: hidden; }
.hero-logo img, .logo-preview img { display: block; width: 100%; height: auto; }
.logo-preview { max-width: 320px; background: #000; border-radius: 8px; overflow: hidden; margin-bottom: 1rem; }
input[type=color] { width: 64px; height: 44px; padding: 2px; }

/* Platform staff support mode: always visible while open. */
.support-banner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .6rem 16px; background: #a4262c; color: #fff; position: relative; z-index: 21; }
.support-banner form { margin: 0; }
.btn-small { min-height: 36px; padding: .3rem .8rem; }
.support-org { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; }
.support-org form { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0; }
.support-org input[name=reason] { min-width: 240px; flex: 1; }
@media (max-width: 600px) { .support-org { grid-template-columns: 1fr; } }

/* Event report: readable on screen, clean when printed or saved as PDF. */
.report-controls { margin-bottom: 1rem; }
.report section { padding: .9rem 0; border-top: 1px solid var(--line); }
.report h2 { font-size: 1rem; }
.report textarea { width: 100%; font: inherit; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.kpi { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .8rem; background: var(--surface); }
.kpi-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.kpi-n { display: block; font-size: 1.7rem; font-weight: 700; }
.kpi-l { font-size: .85rem; }
.bar-row { display: flex; justify-content: space-between; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.bar-row .v { font-variant-numeric: tabular-nums; font-weight: 700; }
.report-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.report-table th, .report-table td { text-align: left; padding: .3rem .5rem .3rem 0; border-bottom: 1px dashed var(--line); }
.report-table th { font-size: .85em; color: var(--muted, inherit); font-weight: 600; }
.report-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding-top: 1rem; }
.filter-row { margin: .25rem 0 .5rem; }
@media print {
  .topbar, .report-controls, .messages, .foot, .support-banner, .no-print-empty form { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap, body main.wrap { max-width: none; padding: 0; margin: 0 !important; background: #fff; border-radius: 0; min-height: 0; }
  body main.wrap > * { max-width: none; }
  .kpi-primary { color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Event form schedule: radio and day choices as compact rows. */
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin: 0; }
legend { padding: 0 .3rem; font-weight: 600; }
#id_repeat label, #id_repeat_weekdays label { font-weight: 400; display: flex; align-items: center; gap: .5rem; }
#id_repeat input[type=radio] { width: 20px; height: 20px; margin: 0; }
#id_repeat_weekdays { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
#id_repeat_weekdays input[type=checkbox] { margin-right: 0; }

/* Board: which session the board is showing. */
.session-picker { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; flex-wrap: wrap; }
.session-picker label { margin: 0; }
.session-picker select { width: auto; flex: 1 1 10rem; }
.notice { border-color: var(--warn); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Tickets: the player's own page, and the organizer's printable sheet. */
.ticket .qr svg { width: min(16rem, 100%); height: auto; background: #fff; padding: .5rem; border-radius: .5rem; }
.ticket-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .75rem; }
.ticket-card { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .75rem; border: 1px dashed var(--line); break-inside: avoid; }
.ticket-card .qr svg { width: 8rem; height: auto; background: #fff; }

/* Door kiosk: big type, one answer at a time. */
.kiosk-page .topbar, .kiosk-page .foot { display: none; }
.kiosk { max-width: 40rem; margin: 2rem auto; text-align: center; display: flex; flex-direction: column; gap: 1rem; }
.kiosk h1 { font-size: 2.4rem; }
.kiosk-camera video { width: 100%; max-height: 50vh; border-radius: 1rem; background: #000; object-fit: cover; transform: scaleX(-1); }
.kiosk-result { padding: 2rem 1rem; border-radius: 1rem; background: var(--card, #f4f1ec); }
.kiosk-result.is-in, .kiosk-result.is-out, .kiosk-result.is-already_in { background: #d9f2df; color: #133d1f; }
.kiosk-result.is-needs_parent { background: #fff1cc; color: #4d3800; }
.kiosk-result.is-unknown, .kiosk-result.is-other_program, .kiosk-result.is-see_staff, .kiosk-result.is-error, .kiosk-result.is-closed, .kiosk-result.is-replaced, .kiosk-result.is-no_session, .kiosk-result.is-slow { background: #fbe0dc; color: #5c1a12; }
.kiosk-message { font-size: 2rem; font-weight: 700; margin: 0 0 1rem; }
.kiosk-form { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.kiosk-form input { font-size: 1.4rem; text-align: center; }

/* Activity log: two tabs and a dated list. */
.tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--line); margin: 1rem 0 0; }
.tabs a { padding: .5rem 0; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.activity li { display: grid; grid-template-columns: 11rem 1fr; gap: .25rem 1rem; align-items: baseline; }
.activity li:last-child { border-bottom: 0; }
@media (max-width: 560px) { .activity li { grid-template-columns: 1fr; } }

/* Reports, at the top of a program's page */
.reports-card h2 { margin-top: 0; }
.report-latest { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .25rem 0 .75rem; }
.report-when { margin: 0; font-weight: 600; font-size: 1.1rem; }
.report-latest .muted { margin: .2rem 0 0; }
.report-buttons { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.report-earlier-h { margin: .75rem 0 .25rem; font-size: .95rem; }
.report-earlier { margin-bottom: .75rem; }

/* Side menu (DESIGN.md, "Side menu"): every signed-in page. Sections of actions, each worded
   as what it does. Fixed on the left from 960px; behind a Menu button below that. */
.menu-btn { display: none; }
.side { background: var(--canvas); border-right: 1px solid var(--line-soft); padding: 16px 12px 24px; font-size: 15px; }
.side-group + .side-group { margin-top: 20px; }
.side-h { margin: 0 0 4px; line-height: 1.3; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.side-program .side-h { font-size: 15px; color: var(--ink); text-wrap: balance; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 12px; border-radius: 4px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.side-ic { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.side li a:hover .side-ic, .side li a[aria-current="page"] .side-ic { color: var(--brand); }
.side-t { display: flex; flex-direction: column; min-width: 0; }
.side-hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.side li a:hover { background: var(--hover); }
.side li a[aria-current="page"] { background: var(--brand-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.side li a:focus-visible, .side-signout:focus-visible, .menu-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.side-foot { margin-top: 28px; padding: 16px 12px 0; border-top: 1px solid var(--line-soft); }
.side-who { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-weight: 600; word-break: break-word; }
.side-signout { min-height: 44px; padding: 0 12px; margin-left: -12px; background: none; border: 0; border-radius: 4px; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.side-signout:hover { background: var(--hover); }
.side-soon { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
@media (min-width: 960px) {
  body:has(> .side) { padding-left: 280px; }
  body:has(> .side) .topbar { margin-left: -280px; padding-left: 24px; }
  .side { position: fixed; top: 55px; bottom: 0; left: 0; width: 280px; overflow-y: auto; z-index: 15; }
}
@media (max-width: 959.98px) {
  body:has(> .side) .menu-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; margin-left: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--canvas); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
  .side { display: none; }
  body.side-open .side { display: block; position: fixed; top: 55px; left: 0; right: 0; bottom: 0; overflow-y: auto; z-index: 30; box-shadow: var(--shadow-lg); }
  body.side-open { overflow: hidden; }
}
@media print { .side, .menu-btn { display: none !important; } body:has(> .side) { padding-left: 0; } body:has(> .side) .topbar { margin-left: 0; } }
