/* VFIHA brand theme, shared by every page.
 *
 * Colours come from the VFIHA brand guidelines. The guide WRITES maroon as #660057 and gold as #FFD433, but its
 * own swatches and the logo artwork are #5C1B2E and #F9C747 (the written hex values look like an unmanaged CMYK
 * conversion). We use the colours that match the logo; change --brand / --gold below to switch.
 * Headings use Bebas Neue (the guide's typeface). The logo goes on white or charcoal only, never on maroon.
 */
@font-face {
  font-family: 'Bebas Neue';
  src: url(fonts/BebasNeue-Regular.woff2) format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #5C1B2E;
  --brand-dark: #451322;
  --gold: #F9C747;
  --gold-ink: #2b1d00;

  --bg: #f5f3f3;
  --surface: #ffffff;
  --surface-2: #f0ecec;
  --text: #1b1618;
  --muted: #645b5f;
  --line: #ddd5d7;
  --field-line: #857a7f;           /* form field borders: >= 3:1 against the page (WCAG 1.4.11) */

  --accent: var(--brand);          /* links, selected controls, primary buttons */
  --accent-ink: #ffffff;
  --accent-soft: #f4e9ec;
  --focus: var(--brand);
  --pick-soft: #fdf2cf;            /* selected rows */
  --header-bg: #ffffff;
  --stripe-1: var(--brand);
  --stripe-2: var(--gold);
  --heading: var(--brand);

  --win: #16794a;  --win-soft: #dcf1e6;
  --loss: #b3261e; --loss-soft: #fbe4e1;
  --tie: #6b5800;  --tie-soft: #f6edc4;
  --warn: #8a4b00; --warn-soft: #fdebd0;

  --radius: 10px;
  --max: 1100px;
  --font-display: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141112; --surface: #1f1a1c; --surface-2: #2a2326; --text: #f3eef0; --muted: #b9aeb3; --line: #3b3236; --field-line: #81767b;
    --accent: #F9C747; --accent-ink: #241800; --accent-soft: #3a3013; --focus: #F9C747; --pick-soft: #3a3013;
    --header-bg: #1e1e1e; --stripe-1: #F9C747; --stripe-2: #5C1B2E; --heading: #ffffff;
    --win: #5fd18e;  --win-soft: #16301f; --loss: #ff9086; --loss-soft: #3a1e1b;
    --tie: #f0d96a;  --tie-soft: #35300f; --warn: #ffbf73; --warn-soft: #3a2a12;
  }
}
:root[data-theme="dark"] {
  --bg: #141112; --surface: #1f1a1c; --surface-2: #2a2326; --text: #f3eef0; --muted: #b9aeb3; --line: #3b3236; --field-line: #81767b;
  --accent: #F9C747; --accent-ink: #241800; --accent-soft: #3a3013; --focus: #F9C747; --pick-soft: #3a3013;
  --header-bg: #1e1e1e; --stripe-1: #F9C747; --stripe-2: #5C1B2E; --heading: #ffffff;
  --win: #5fd18e;  --win-soft: #16301f; --loss: #ff9086; --loss-soft: #3a1e1b;
  --tie: #f0d96a;  --tie-soft: #35300f; --warn: #ffbf73; --warn-soft: #3a2a12;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 12px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 8px; z-index: 100; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 0; outline-color: var(--gold); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px 56px; }
body[data-view="compact"] { --max: 1400px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
[hidden] { display: none !important; }

/* ---------- site header (logo sits on white / charcoal, with a maroon + gold stripe) ---------- */
.site-header { background: var(--header-bg); border-bottom: 4px solid var(--stripe-1); box-shadow: 0 3px 0 var(--stripe-2); margin-bottom: 18px; position: relative; z-index: 3; }
.site-header__in { max-width: var(--max); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); padding: 4px 0; }
.brand img { height: 58px; width: auto; display: block; }
.brand-text { display: grid; line-height: 1; }
.brand-name { font-family: var(--font-display); font-size: 2.1rem; letter-spacing: 0.04em; color: var(--heading); }
.brand-sub { font-size: 0.78rem; color: var(--muted); margin-top: 3px; letter-spacing: 0.01em; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--text); text-decoration: none; font-size: 0.95rem; min-height: 40px; display: inline-flex; align-items: center; }
.site-nav a:hover { background: var(--accent-soft); color: var(--accent); }
.site-nav a[aria-current="page"] { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .site-nav a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-nav a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); } }
#userbox { margin-left: auto; }
@media (max-width: 760px) {
  .brand img { height: 46px; }
  .brand-name { font-size: 1.7rem; }
  .site-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .site-nav a { white-space: nowrap; }
}

/* ---------- page headings ---------- */
.page-head { margin: 0 0 14px; }
h1.page-title { font-family: var(--font-display); font-weight: 400; font-size: 2.6rem; line-height: 1; letter-spacing: 0.03em; margin: 0; color: var(--heading); text-transform: uppercase; }
.page-sub { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

/* ---------- panels: a maroon header band, optionally collapsible ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; background: var(--brand); color: #fff; padding: 10px 16px; border-bottom: 3px solid var(--gold); }
.panel-head :focus-visible { outline-color: var(--gold); }
.panel-title { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; line-height: 1.1; letter-spacing: 0.05em; margin: 0; text-transform: uppercase; }
.panel-meta { font-size: 0.88rem; opacity: 0.92; display: inline-flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; }
.panel-end { margin-left: auto; display: inline-flex; gap: 10px; align-items: center; }
details.panel > summary.panel-head { list-style: none; cursor: pointer; user-select: none; min-height: 52px; }
details.panel > summary.panel-head:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
details.panel > summary::-webkit-details-marker { display: none; }
.chev { width: 11px; height: 11px; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; flex: none; margin-left: 4px; }
details.panel[open] > summary .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.badge { background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 0.78rem; border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.panel-body { padding: 16px; }
.panel-tools { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
:root[data-theme="dark"] .panel-head { background: #4a1727; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .panel-head { background: #4a1727; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- controls ---------- */
input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--field-line); border-radius: 8px; padding: 8px 10px; min-height: 40px; max-width: 100%;
}
input[type="search"], input[type="email"], input[type="password"], input[type="text"], select, textarea { width: 100%; }
select:disabled { opacity: 0.55; }
::placeholder { color: var(--muted); opacity: 0.85; }
label.lbl, .lbl { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px; }

.btn, .chip, .seg button {
  font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 16px; min-height: 38px; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center; justify-content: center; text-decoration: none; line-height: 1.2;
}
.btn:hover:not(:disabled), .chip:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { color: var(--accent-ink); filter: brightness(0.9); }
.btn.danger { color: var(--loss); }
.btn.danger:hover:not(:disabled) { border-color: var(--loss); color: var(--loss); }
.btn.primary.danger { background: var(--loss); border-color: var(--loss); color: #fff; }
.btn.sm { min-height: 32px; padding: 3px 12px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 0.85rem; padding: 5px 13px; min-height: 36px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--accent-soft); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
/* a segmented control sitting on a maroon band */
.seg--onbrand { background: transparent; border-color: rgba(255,255,255,.55); }
.seg--onbrand button { background: transparent; color: #fff; border-right-color: rgba(255,255,255,.35); }
.seg--onbrand button:hover { background: rgba(255,255,255,.14); color: #fff; }
.seg--onbrand button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }
.seg--onbrand :focus-visible { outline-color: #fff; outline-offset: -3px; }

.pill { display: inline-block; font-size: 0.72rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.win { background: var(--win-soft); color: var(--win); }
.pill.loss { background: var(--loss-soft); color: var(--loss); }
.pill.tie { background: var(--tie-soft); color: var(--tie); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.notice { text-align: center; padding: 44px 16px; color: var(--muted); }
.notice .btn { margin-top: 14px; }
.notice .title { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: .04em; color: var(--heading); margin-bottom: 4px; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid var(--line); }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 4px solid transparent; margin-bottom: -2px; padding: 10px 16px; cursor: pointer; color: var(--muted); min-height: 44px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.tabs .n { display: inline-block; min-width: 1.7em; text-align: center; font-size: 0.74rem; background: var(--surface-2); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }

/* ---------- modal dialog + toast ---------- */
dialog.m { border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(94vw, 480px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.m::backdrop { background: rgba(14, 8, 10, .6); }
dialog.m h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; letter-spacing: .04em; color: var(--heading); margin: 0 0 6px; line-height: 1.1; text-transform: uppercase; }
dialog.m .fields { display: grid; gap: 12px; margin: 14px 0; }
dialog.m .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
dialog.m .err { color: var(--loss); font-size: 0.88rem; min-height: 1.3em; margin-top: 6px; }
#toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 30; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#toast.show { opacity: 1; }

/* ---------- footer ---------- */
.site-footer { max-width: var(--max); margin: 12px auto 0; padding: 18px 16px 40px; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--line); }
.site-footer a { color: var(--accent); }

/* ---------- touch screens: bigger targets ---------- */
@media (pointer: coarse) {
  .btn, .chip, .seg button { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="date"], select { min-height: 46px; }
  input[type="checkbox"] { width: 22px; height: 22px; }
}

/* ---------- print: just the content ---------- */
@media print {
  .site-header, .skip-link, .site-footer, #pickbar, #bar, #toast, .btn, .seg, .tabs, .chips { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .card { border-color: #999; break-inside: avoid; }
  .panel-head { background: #fff !important; color: #000 !important; border-bottom: 2px solid #000; }
}
