/* ============================================================================
   ZipScore design system — appearance is a sticky USER choice (#1845).

   Ported from the Claude Design handoff (ZipScore Redesign.html).

   Two surfaces, selected by the user's theme preference (resolved once in
   scoring/theme_service.py and applied to <body> via the base template). The
   default is LIGHT for everyone:

   - (default / light)  Legacy light surface under the dark XGrab topbar.
   - body.dark          XGrab Motion dark shell (#0a0d14 canvas, #6694fa
                        accent, translucent cards, mono tracked labels).

   The former high-contrast ``body.sheet-mode`` score-sheet surface was retired
   in #1845 (folded into light/dark) — it was never applied to any page.
   ========================================================================= */

:root {
  /* Declare that the app handles BOTH schemes itself so the browser's "auto
     dark mode for web contents" (Chrome force-dark) and OS color-scheme
     heuristics don't re-tint the page on top of our own light/dark shell
     (#1930). Declaring `light dark` (not just `light`) is what makes force-dark
     back off even when the OS preference is dark. */
  color-scheme: light dark;
  /* ---- dark shell (XGrab Motion brand) ---- */
  --bg: #0a0d14;
  --glow: rgba(36, 56, 107, 0.7);
  --accent: #6694fa;
  --accent-strong: #4f7ef0;
  --d-text: #ffffff;
  --d-mid: rgba(255, 255, 255, 0.6);
  --d-dim: rgba(255, 255, 255, 0.42);
  --d-faint: rgba(255, 255, 255, 0.3);
  --d-card: rgba(255, 255, 255, 0.04);
  --d-card-2: rgba(255, 255, 255, 0.06);
  --d-field: rgba(255, 255, 255, 0.03);
  --d-stroke: rgba(255, 255, 255, 0.08);
  --d-stroke-soft: rgba(255, 255, 255, 0.05);

  /* status (shared vocabulary, Motion sync pills) */
  --green: #30d158;
  --amber: #ff9f0a;
  --red: #ff453a;
  --blue: #0a84ff;

  /* ---- light score surface (sunlight, max contrast) ---- */
  --paper: #eef1f6;
  --sheet: #ffffff;
  --ink: #0a1020;
  --ink-mid: #44506a;
  --ink-dim: #6b7689;
  --line: #d3dae6;
  --line-strong: #aab4c6;
  --accent-ink: #1f51c8; /* AA on white */
  --good: #15803d;
  --good-bg: #e7f6ec;
  --good-line: #5cb277;
  --bad: #c81e1e;
  --bad-bg: #fdebeb;
  --bad-line: #e88;
  --warn: #8a5a00;
  --warn-bg: #fbf1d4;
  --warn-line: #d8b25a;

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --rounded: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ---- semantic CONTENT tokens — flip with the user's theme (#1930) ----
     The chrome (.topbar / nav / account menu) is ALWAYS dark and keeps using
     the raw --d-* tokens above. Everything in the content area below the
     topbar must read on whichever surface the user chose, so it uses these
     tokens instead. Defined LIGHT here; the body.dark block overrides them to
     the exact --d-* values so the dark shell is byte-for-byte unchanged.
     This replaces the broken pattern where "ported screen" components hard-wired
     the white --d-* tokens in bare selectors and only looked right under a
     forced `body_class=dark` (retired in #1845 → white-on-white in light). */
  --surface: #ffffff;            /* card / panel fill              (dark: --d-card)      */
  --surface-2: #f2f5fa;          /* raised / hover / field-on-card (dark: --d-card-2)    */
  --field-bg: #fafbfc;           /* input + translucent field      (dark: --d-field)     */
  --hover: rgba(15, 52, 96, 0.06); /* generic hover wash           (dark: white 6%)      */
  --stroke: #d3dae6;             /* card / divider border          (dark: --d-stroke)    */
  --stroke-soft: #e8ecf0;        /* faint inner divider            (dark: --d-stroke-soft) */
  --text: #1a1a2e;               /* primary body text              (dark: --d-text)      */
  --text-mid: #44506a;           /* secondary text                 (dark: --d-mid)       */
  --text-dim: #6b7689;           /* tertiary / muted text          (dark: --d-dim)       */
  --text-faint: #8793a6;         /* labels / hints (AA on white)   (dark: --d-faint)     */
  --accent-text: #1f51c8;        /* accent used AS TEXT (AA on white) (dark: --accent)   */
  /* status text on a content surface — AA-on-white by default, brightened for dark */
  --st-ok: #15803d;              /* (dark: #6ee094) */
  --st-bad: #c81e1e;             /* (dark: #ff8079) */
  --st-warn: #8a5a00;            /* (dark: #ffc24d) */
  --st-info: #1f51c8;            /* (dark: #8fb4ff) */

  /* Competition pipeline round cards + gender/mode tags (#1930). These surface
     in inline styles in competition_detail.html, so they must flip with the
     theme too. Light keeps the existing pastel palette; dark uses translucent
     Motion tints over the dark canvas. */
  --round-bg: #fafafa;           /* regular round card body   */
  --round-head: #f1f5f9;         /* regular round card header */
  --finals-bg: #f5f3ff;          /* finals round card body    */
  --finals-head: #ede9fe;        /* finals round card header  */
  --finals-line: #c7d2fe;        /* finals card border        */
  --tag-women: #fce4ec;          /* Women gender pill bg       */
  --tag-women-ink: #9d2463;      /* Women gender pill text     */
  --tag-men: #e3f2fd;            /* Men gender pill bg         */
  --tag-men-ink: #1e40af;        /* Men gender pill text       */
  --tag-info: #dbeafe;           /* gender/discipline pill     */
  --tag-neutral: #e8eaf6;        /* score-mode / discipline pill */
  --tag-warn-bg: #fef3c7;        /* "Top N advance" badge      */
  --tag-warn-line: #fcd34d;
}

/* Dark shell: flip the semantic content tokens to the XGrab Motion values.
   The raw --d-* tokens are unchanged; these just make the content tokens
   resolve to the same dark palette, so every ported component renders exactly
   as it did when the page forced `body_class=dark` (#1930). */
body.dark {
  color-scheme: dark;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --field-bg: rgba(255, 255, 255, 0.03);
  --hover: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-soft: rgba(255, 255, 255, 0.05);
  --text: #ffffff;
  --text-mid: rgba(255, 255, 255, 0.6);
  --text-dim: rgba(255, 255, 255, 0.42);
  --text-faint: rgba(255, 255, 255, 0.3);
  --accent-text: var(--accent);
  --st-ok: #6ee094;
  --st-bad: #ff8079;
  --st-warn: #ffc24d;
  --st-info: #8fb4ff;

  --round-bg: rgba(255, 255, 255, 0.03);
  --round-head: rgba(255, 255, 255, 0.06);
  --finals-bg: rgba(102, 148, 250, 0.10);
  --finals-head: rgba(102, 148, 250, 0.18);
  --finals-line: rgba(102, 148, 250, 0.45);
  --tag-women: rgba(244, 143, 177, 0.18);
  --tag-women-ink: #f7a8cb;
  --tag-men: rgba(102, 148, 250, 0.20);
  --tag-men-ink: #9bc0ff;
  --tag-info: rgba(102, 148, 250, 0.20);
  --tag-neutral: rgba(255, 255, 255, 0.08);
  --tag-warn-bg: rgba(255, 159, 10, 0.16);
  --tag-warn-line: rgba(255, 159, 10, 0.45);
}

/* ===================== reset & base (legacy light default) ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--sans);
  background: #f4f6f9;
  color: #1a1a2e;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===================== shared atoms ===================== */
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }

.logo {
  font-family: var(--rounded);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.015em;
}
.logo .zip { color: var(--accent); }
/* The "Score" half flips with the theme so it reads on the login/brand panel,
   which sits on the content surface. In the always-dark topbar it is forced
   white again below (.topbar .logo .score). (#1930) */
.logo .score { color: var(--text); }

.ulabel {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* status pill — Motion sync-pill vocabulary, repurposed as scoring status */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.done { color: var(--st-ok); background: rgba(48, 209, 88, 0.12); }
.pill.prog { color: var(--st-warn); background: rgba(255, 159, 10, 0.13); }
.pill.idle { color: var(--text-dim); background: var(--field-bg); }
.pill.live { color: var(--st-info); background: rgba(102, 148, 250, 0.14); }
.pill.fail { color: var(--st-bad); background: rgba(255, 69, 58, 0.13); }

.ping { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.ping.amber { background: var(--amber); }
.ping.rec { background: var(--red); animation: ping-pulse 1.6s ease-in-out infinite; }
@keyframes ping-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(255, 69, 58, 0); }
}

.chip {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  background: var(--surface-2); border: 1px solid var(--stroke);
  border-radius: 999px; padding: 3px 9px; color: var(--text-mid); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}

.crumb {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--accent-text); text-decoration: none; display: inline-block;
  margin-bottom: 8px; white-space: nowrap;
}
.crumb:hover { text-decoration: underline; }

/* ===================== topbar (dark, on every surface) ===================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 22px;
  min-height: 58px;
  border-bottom: 1px solid var(--d-stroke);
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}
.topbar .brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.topbar .logo { font-size: 21px; }
/* Topbar is always dark, so keep the "Score" half white here regardless of theme. */
.topbar .logo .score { color: var(--d-text); }
.topbar .tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  color: var(--d-faint);
  text-transform: uppercase;
}
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
/* The account/status toggle lives in .topbar .right, not .topnav, so it must be
   named here explicitly — otherwise it falls back to bare <button> chrome and
   stops looking like the Info / Admin dropdown toggles beside it (#1856). */
.topnav a, .topnav .nav-dropdown-toggle,
.topbar .right .nav-dropdown-toggle {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--d-mid);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.topnav a:hover, .topnav .nav-dropdown-toggle:hover,
.topbar .right .nav-dropdown-toggle:hover { color: var(--d-text); background: rgba(255, 255, 255, 0.05); }
.topnav a.nav-active,
.topnav .nav-dropdown-toggle.nav-active,
.topnav .nav-dropdown-toggle[aria-expanded="true"],
.topbar .right .nav-dropdown-toggle[aria-expanded="true"] { color: var(--d-text); background: rgba(255, 255, 255, 0.09); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .who {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--d-dim);
  display: flex; align-items: center; gap: 7px;
  text-decoration: none;
}
.topbar .who:hover, .topbar .who.nav-active { color: var(--d-text); }
/* Account-menu Sign out / Sign in (#1855/#1832): a clearly-styled control at
   WCAG AA contrast inside the dropdown — no longer a near-invisible label. */
.signout-btn, .signin-link {
  display: block; width: 100%; text-align: left; box-sizing: border-box;
  background: none; border: none; cursor: pointer;
  padding: 0.5rem 1rem;
  font-family: var(--sans); font-size: 0.88rem; font-weight: 600;
  color: var(--d-text); text-decoration: none;
}
.signout-btn:hover, .signin-link:hover { background: rgba(255, 255, 255, 0.06); }
.signout-form { margin: 0; }

/* "+ New" action button (#1856) — an action, not a tab. */
.topbar .newbtn {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  color: #fff; background: var(--accent-strong);
  padding: 7px 13px; border-radius: 8px; text-decoration: none;
  white-space: nowrap; transition: background 0.15s;
}
.topbar .newbtn:hover, .topbar .newbtn.nav-active { background: var(--accent); }

/* Logged-out topbar links rendered in the .right region. */
.topbar .right .topnav-link {
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  color: var(--d-mid); text-decoration: none; padding: 7px 12px; border-radius: 8px;
}
.topbar .right .topnav-link:hover, .topbar .right .topnav-link.nav-active {
  color: var(--d-text); background: rgba(255, 255, 255, 0.07);
}

/* Account menu (#1855): the toggle + the username chip inside it. */
.account-menu .account-toggle { display: flex; align-items: center; gap: 7px; }
/* Match the username to the sibling nav-button text (was mono 11px, which read
   as a different control); the green ping dot still marks the signed-in state. */
.account-menu .acct-name { font-family: var(--sans); font-size: 13.5px; font-weight: 500; }
/* Right-anchor the panel to the toggle and let it grow leftward — the toggle is
   pinned to the far right of .topbar .right, so a left-anchored panel overflows
   the viewport (#1885). The .nav-dropdown-menu compound selector raises
   specificity above the base `.nav-dropdown-menu { left: 0 }` rule so this wins
   regardless of source order, not by happening to appear later in the file. */
.nav-dropdown-menu.account-menu-panel { left: auto; right: 0; }
.nav-dropdown-menu.account-menu-panel::before { left: auto; right: 0; }

/* Light / Dark theme toggle (#1845) — a two-button segmented control inside
   the account menu. AA-contrast active state. */
.theme-toggle-form { margin: 0; padding: 0.25rem 1rem 0.4rem; }
.theme-toggle {
  display: flex; gap: 3px; background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--d-stroke); border-radius: 9px; padding: 3px;
}
.theme-toggle .theme-opt {
  flex: 1; appearance: none; border: none; cursor: pointer;
  background: transparent; color: var(--d-mid);
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  padding: 6px 10px; border-radius: 6px; transition: background 0.13s, color 0.13s;
}
.theme-toggle .theme-opt:hover { color: var(--d-text); }
.theme-toggle .theme-opt.is-active { background: var(--accent-strong); color: #fff; }

/* nav dropdown (dark) */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 0.35rem); left: 0;
  background: rgba(16, 20, 30, 0.97); border: 1px solid var(--d-stroke); border-radius: 11px;
  min-width: 210px; padding: 0.35rem 0; z-index: 200; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav-dropdown-menu.open { display: block; }
/* Invisible bridge covering the gap between button and menu so the mouse
   can travel diagonally without the menu closing */
.nav-dropdown-menu::before {
  content: ""; position: absolute; top: -0.5rem; left: 0;
  width: 100%; height: 0.5rem;
}
.nav-dropdown-menu a {
  display: block; padding: 0.5rem 1rem; border-radius: 0;
  font-size: 0.88rem; font-weight: 500; color: var(--d-mid); text-decoration: none;
}
.nav-dropdown-menu a:hover, .nav-dropdown-menu a.nav-active { color: var(--d-text); background: rgba(255, 255, 255, 0.06); }
.nav-dropdown-sep { height: 1px; background: var(--d-stroke); margin: 0.3rem 0; }
.nav-dropdown-label {
  font-family: var(--mono); font-size: 0.62rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--d-faint); padding: 0.4rem 1rem 0.1rem;
  pointer-events: none; display: block;
}

/* ===================== layout ===================== */
.container { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1.5rem; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { margin-bottom: 0; }
.sub { color: var(--text-dim); font-size: 13px; margin-top: 7px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* Score-queue bib-first filter (#1733). Was an inline <style> in
   _run_batch_table.html; moved here when the filter was ported to React
   (ADR 032 — no behavior-bearing inline CSS in scoring templates). The React
   <input class="queue-search"> mounted by run-batch-queue/queue.js uses it. */
.queue-search {
  margin-top: .6rem;
  width: 100%;
  max-width: 320px;
  padding: .5rem .7rem;
  font-size: 1rem;
  color: inherit;
  background: var(--field-bg);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}
.queue-search::placeholder { color: var(--text-faint); }
.queue-search:focus {
  outline: 2px solid rgba(102, 148, 250, 0.7);
  outline-offset: 1px;
}

h1 { font-family: var(--rounded); font-weight: 800; font-size: 1.6rem; letter-spacing: -0.01em; margin-bottom: 1rem; }
h2 { font-family: var(--rounded); font-weight: 800; font-size: 1.2rem; margin-bottom: 0.75rem; }
h3 { font-family: var(--rounded); font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; }

/* ===================== legacy light surface (default) ===================== */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }
/* Explanatory one-liner under a card title (#card-subtitles). Tucks under the
   title's bottom margin so the heading + subtitle read as one block. */
.card-title.has-sub { margin-bottom: 0.25rem; }
.card-subtitle { margin: 0 0 1rem; color: var(--text-dim); font-size: 0.85rem; line-height: 1.45; }

.form-group { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
input[type=text], input[type=number],
input[type=date], input[type=time],
input[type=password], input[type=email],
input[type=file], input[type=url],
select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #cdd3db;
  border-radius: 7px;
  font-size: 1rem;
  background: #fafbfc;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #0f3460;
  background: #fff;
}
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input[type=checkbox] { width: auto; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 7px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #0f3460; color: #fff; }
.btn-secondary { background: #e2e8f0; color: #1a1a2e; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-success { background: #38a169; color: #fff; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th { background: #f0f4f8; font-weight: 700; padding: 0.6rem 0.75rem; text-align: left; }
td { padding: 0.55rem 0.75rem; border-top: 1px solid #e8ecf0; }
tr:hover td { background: #f8fafc; }

/* ---------------------------------------------------------------------------
   Scannable data tables (#1836 / #1858)
   --------------------------------------------------------------------------- */
/* Opt-in zebra striping for dense list tables (Seasons, USSA Recent Syncs,
   Review, home tables). Subtle row separation so the eye can track a row across
   wide tables; hover still wins for the row under the cursor. */
.table-zebra tbody tr:nth-child(even) td { background: #f6f8fb; }
.table-zebra tbody tr:hover td { background: #eef3f9; }

/* Differentiate look-alike row actions (#1858): View is the primary/neutral
   read action; Edit is a clearly secondary, outlined action so the two don't
   read as identical gray boxes. Pairs with .btn / .btn-sm. */
.btn-view {
  background: #e6effb;
  color: #0f3460;
  border: 1px solid #c2d6f0;
}
.btn-view:hover { background: #d6e6f8; opacity: 1; }
.btn-edit {
  background: transparent;
  color: #4a5568;
  border: 1px solid #cbd5e0;
}
.btn-edit:hover { background: #f1f4f8; opacity: 1; }
/* Keep paired row actions visually grouped and aligned. */
.row-actions { display: inline-flex; gap: 0.4rem; align-items: center; white-space: nowrap; }

.messages { list-style: none; margin-bottom: 1rem; }
.messages li {
  padding: 0.65rem 1rem;
  border-radius: 7px;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.messages .success { background: #c6f6d5; color: #22543d; }
.messages .error   { background: #fed7d7; color: #742a2a; }
.messages .warning { background: #fefcbf; color: #744210; }
.messages .info    { background: #bee3f8; color: #2a4365; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-air  { background: #ebf8ff; color: #2b6cb0; }
.badge-turns { background: #f0fff4; color: #276749; }

/* legacy score entry (aerials / park & pipe until their light-sheet port) */
.score-grid { display: grid; gap: 1rem; }
.score-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  padding: 1rem;
}
.score-card-header {
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.score-fields { display: grid; gap: 0.65rem; }
.score-field label { font-size: 0.82rem; margin-bottom: 0.2rem; }
.score-input {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.4rem 0.6rem;
  text-align: center;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  width: 100%;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}
.score-input:focus { outline: none; border-color: #0f3460; background: #f0f4ff; }
.score-input.saved { border-color: #38a169; background: #f0fff4; }
.score-input.error-field { border-color: #e53e3e; background: #fff5f5; }
.score-input-sm {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
}

.jump-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.athlete-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.athlete-nav .athlete-name { font-size: 1.2rem; font-weight: 800; }

#save-indicator {
  font-size: 0.78rem;
  color: #718096;
  text-align: right;
  min-height: 1.2em;
  transition: color 0.3s;
}
#save-indicator.saving { color: #d69e2e; }
#save-indicator.saved  { color: #38a169; }
#save-indicator.err    { color: #e53e3e; }

.formset-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
.delete-check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: #e53e3e; }

.help { font-size: 0.78rem; color: #718096; margin-top: 0.2rem; }

.flex-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.text-muted { color: #718096; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* =====================================================================
   DARK SHELL — body.dark (ported browse/review screens)
   ===================================================================== */
body.dark {
  background:
    radial-gradient(60% 420px at 50% -6%, var(--glow), transparent 72%),
    var(--bg);
  color: var(--d-text);
}
body.dark .container { max-width: 1180px; padding: 26px 22px 90px; }

body.dark .card {
  background: var(--d-card);
  border: 1px solid var(--d-stroke);
  border-radius: 16px;
  box-shadow: none;
}
body.dark .card-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d-mid); font-weight: 500; }

.card-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--stroke); gap: 12px; flex-wrap: wrap;
}
.card-bar h2 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-mid); font-weight: 500; margin: 0; }

body.dark label { color: var(--d-mid); }
body.dark input[type=text], body.dark input[type=number],
body.dark input[type=date], body.dark input[type=time],
body.dark input[type=password], body.dark input[type=email],
body.dark input[type=file], body.dark input[type=url],
body.dark select, body.dark textarea {
  border: 1px solid var(--d-stroke);
  border-radius: 10px;
  font-family: var(--sans);
  background: var(--d-field);
  color: var(--d-text);
  transition: border-color 0.15s, background 0.15s;
}
body.dark input::placeholder, body.dark textarea::placeholder { color: var(--d-faint); }
body.dark input:focus, body.dark select:focus, body.dark textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--d-card-2);
}
body.dark select option { background: #141925; color: var(--d-text); }
body.dark input[type=checkbox], body.dark input[type=radio] { accent-color: var(--accent); }

/* labelled translucent field (login) */
.field {
  display: block; background: var(--field-bg); border: 1px solid var(--stroke);
  border-radius: 11px; padding: 9px 14px 10px; transition: border-color 0.15s, background 0.15s;
}
.field:focus-within { border-color: var(--accent); background: var(--surface-2); }
.field .ulabel { display: block; margin-bottom: 3px; font-weight: 500; }
.field input, body.dark .field input {
  width: 100%; border: none; outline: none; background: transparent;
  color: var(--text); font-family: var(--sans); font-size: 16px; padding: 0; border-radius: 0;
}
.field input:focus, body.dark .field input:focus { background: transparent; border: none; }

body.dark .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: var(--sans);
  transition: filter 0.15s, background 0.13s, color 0.13s, transform 0.05s;
}
body.dark .btn:hover { opacity: 1; filter: brightness(1.08); }
body.dark .btn:active { transform: translateY(1px); }
body.dark .btn-primary { background: var(--accent); color: #fff; }
body.dark .btn-secondary { background: var(--d-card-2); border-color: var(--d-stroke); color: var(--d-mid); }
body.dark .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: var(--d-text); filter: none; }
body.dark .btn-danger { background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.35); color: #ff8079; }
body.dark .btn-danger:hover { background: rgba(255, 69, 58, 0.24); filter: none; }
body.dark .btn-success { background: rgba(48, 209, 88, 0.16); border-color: rgba(48, 209, 88, 0.38); color: #6ee094; }
body.dark .btn-success:hover { background: rgba(48, 209, 88, 0.26); filter: none; }

/* compact bar button (design ".mini") */
.mini {
  appearance: none; cursor: pointer; text-decoration: none;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--stroke); background: var(--surface-2); color: var(--text-mid);
  display: inline-flex; align-items: center; gap: 6px; transition: background 0.13s, color 0.13s;
}
.mini:hover { background: var(--hover); color: var(--text); }
.mini.accent { background: var(--accent); border-color: transparent; color: #fff; }
.mini.accent:hover { filter: brightness(1.08); background: var(--accent); }
.mini.danger { background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.35); color: var(--st-bad); }
.mini.danger:hover { background: rgba(255, 69, 58, 0.24); color: var(--st-bad); }

/* full-width accent submit (login) */
.btn-block {
  appearance: none; border: none; width: 100%;
  background: var(--accent); color: #fff;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  padding: 13px; border-radius: 11px; cursor: pointer; margin-top: 3px;
  transition: filter 0.15s, transform 0.05s;
}
.btn-block:hover { filter: brightness(1.08); }
.btn-block:active { transform: translateY(1px); }

/* dark data table */
body.dark table { font-size: 0.9rem; }
body.dark th {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--d-faint);
  font-weight: 500;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--d-stroke);
  background: transparent;
}
body.dark td { padding: 0.7rem 0.85rem; border-top: 1px solid var(--d-stroke-soft); font-size: 0.88rem; }
body.dark tbody tr { transition: background 0.12s; }
body.dark tr:hover td { background: rgba(255, 255, 255, 0.025); }
body.dark td a { color: var(--accent); text-decoration: none; font-weight: 600; }
body.dark td a:hover { text-decoration: underline; }

/* Dark zebra + row-action variants (#1858). */
body.dark .table-zebra tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.03); }
body.dark .table-zebra tbody tr:hover td { background: rgba(255, 255, 255, 0.06); }
body.dark .btn-view {
  background: rgba(94, 154, 255, 0.16);
  border-color: rgba(94, 154, 255, 0.4);
  color: #cfe0ff;
}
body.dark .btn-view:hover { background: rgba(94, 154, 255, 0.26); }
body.dark .btn-edit {
  background: transparent;
  border-color: var(--d-stroke);
  color: var(--d-dim);
}
body.dark .btn-edit:hover { background: rgba(255, 255, 255, 0.06); color: var(--d-text); }

td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
body.dark td.seed, body.dark td.position-cell { color: var(--d-faint); font-family: var(--mono); }
body.dark td.name { font-weight: 600; }
body.dark td.muted, body.dark .sub-cell { color: var(--d-dim); }
.row-link { color: var(--accent-text); text-decoration: none; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.row-link:hover { text-decoration: underline; }

body.dark .messages li { border: 1px solid transparent; border-radius: 10px; font-size: 0.92rem; }
body.dark .messages .success { background: rgba(48, 209, 88, 0.12); border-color: rgba(48, 209, 88, 0.35); color: #6ee094; }
body.dark .messages .error   { background: rgba(255, 69, 58, 0.12); border-color: rgba(255, 69, 58, 0.35); color: #ff8079; }
body.dark .messages .warning { background: rgba(255, 159, 10, 0.12); border-color: rgba(255, 159, 10, 0.35); color: #ffc24d; }
body.dark .messages .info    { background: rgba(102, 148, 250, 0.12); border-color: rgba(102, 148, 250, 0.35); color: #8fb4ff; }

body.dark .badge { font-family: var(--mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; border-radius: 6px; padding: 2px 8px; }
body.dark .badge-air  { background: rgba(102, 148, 250, 0.14); color: var(--accent); }
body.dark .badge-turns { background: rgba(48, 209, 88, 0.12); color: var(--green); }

body.dark .text-muted { color: var(--d-dim); }
body.dark .help { color: var(--d-dim); }

/* ===================== dark components (ported screens only) ===================== */
.comp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.comp {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 16px;
  padding: 18px 18px 16px; margin: 0;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.comp:hover { border-color: rgba(102, 148, 250, 0.4); background: var(--surface-2); }
.comp .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.comp .jur { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-text); }
.comp h3 { font-family: var(--rounded); font-weight: 800; font-size: 18px; letter-spacing: -0.01em; margin-bottom: 5px; }
.comp .meta { font-size: 12.5px; color: var(--text-dim); }
.comp .foot { display: flex; align-items: center; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
.ev-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  background: var(--surface-2); border: 1px solid var(--stroke);
  border-radius: 6px; padding: 3px 8px; color: var(--text-mid); white-space: nowrap;
}

.layout-2 { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }

.side-card { padding: 16px; }
.side-card .h { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 13px; }
.judge-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--stroke-soft); }
.judge-row:last-child { border-bottom: none; }
.judge-row .ord { font-family: var(--mono); font-size: 11px; color: var(--text-faint); width: 26px; flex: none; }
.judge-row .jn { flex: 1; font-size: 13.5px; font-weight: 500; }
.role {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px;
}
.role.tl { color: var(--st-ok); background: rgba(48, 209, 88, 0.12); }
.role.air { color: var(--accent-text); background: rgba(102, 148, 250, 0.14); }

.progress { display: flex; flex-direction: column; gap: 10px; }
.progress .row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.progress .row .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text-mid); }
.meter { height: 5px; border-radius: 3px; background: var(--stroke); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* login */
.login-wrap {
  min-height: calc(100vh - 160px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-brand .logo { font-size: 46px; }
.login-brand .tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.55em; text-indent: 0.55em; color: var(--text-mid); text-transform: uppercase; }
.login-form { background: var(--surface); border: 1px solid var(--stroke); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 13px; }
.login-foot { text-align: center; margin-top: 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-faint); }
.login-foot a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-dim); text-decoration: none; }
.login-foot a:hover { color: var(--accent-text); }
/* Spectator path is the highest-traffic public action — a visible secondary
   button + "or" divider below the sign-in card, not a buried link (#1834). */
.login-or {
  display: flex; align-items: center; gap: 12px; margin: 18px 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-faint);
}
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--stroke); }
.btn-block-secondary {
  display: block; width: 100%; box-sizing: border-box; text-align: center;
  background: transparent; color: var(--text); border: 1px solid var(--stroke);
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  padding: 13px; border-radius: 11px; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-block-secondary:hover { background: var(--hover); border-color: var(--accent); color: var(--accent-text); }
.login-error {
  background: rgba(255, 69, 58, 0.12); border: 1px solid rgba(255, 69, 58, 0.35); color: var(--st-bad);
  border-radius: 10px; padding: 0.7rem 1rem; font-size: 0.88rem;
}

/* results (dark review) */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  appearance: none; cursor: pointer; font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 8px 18px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--surface); color: var(--text-mid);
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.tab[aria-selected="true"], .tab.active { background: var(--accent); border-color: transparent; color: #fff; }
.tab:hover:not(.active) { color: var(--text); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.pills .lab { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin-right: 4px; }
.pillf {
  appearance: none; cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--field-bg); color: var(--text-mid);
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.pillf[aria-selected="true"], .pillf.active { background: rgba(48, 209, 88, 0.16); border-color: rgba(48, 209, 88, 0.4); color: var(--st-ok); }

.rank-medal { font-family: var(--rounded); font-weight: 800; font-size: 16px; }
.m1 { color: #e3b341; } .m2 { color: #c3ccdb; } .m3 { color: #d08a52; }
.total-cell { font-family: var(--rounded); font-weight: 800; font-size: 17px; color: var(--text); }
.scored-row { cursor: pointer; }
.detail-row > td, .detail-row:hover > td { padding: 0; background: rgba(102, 148, 250, 0.06); border-top: none; }
.detail-panel { padding: 16px; border-top: 2px solid var(--accent); animation: detail-fade-in 0.15s ease; }
@keyframes detail-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dcard { background: var(--surface-2); border: 1px solid var(--stroke); border-radius: 12px; padding: 13px 15px; }
.dcard .dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.dcard.final { border-color: var(--accent); }
.dcard.final .dt { color: var(--accent-text); }
.dcard .final-score { font-family: var(--rounded); font-weight: 900; font-size: 34px; text-align: center; padding: 8px 0; }
.drow { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 13px; padding: 3px 0; }
.drow .l { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; flex: none; }
.drow.dtot { border-top: 1px solid var(--stroke); margin-top: 6px; padding-top: 8px; font-weight: 700; }
.drow.dtot .v { color: var(--accent-text); font-size: 15px; }
.jtag { font-family: var(--mono); font-size: 11px; font-weight: 600; background: rgba(102, 148, 250, 0.14); color: var(--st-info); border-radius: 5px; padding: 2px 7px; margin-right: 4px; }
.jtag.warn { background: rgba(255, 159, 10, 0.16); color: var(--st-warn); border: 1px solid rgba(255, 159, 10, 0.4); }
.formula { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); line-height: 1.7; margin-top: 4px; }
.tb-note { margin-top: 0.65rem; padding: 0.5rem 0.65rem; border-radius: 8px; font-size: 0.8rem; }
.tb-note.ok { background: rgba(48, 209, 88, 0.1); border: 1px solid rgba(48, 209, 88, 0.35); color: var(--st-ok); }
.tb-note.bad { background: rgba(255, 69, 58, 0.1); border: 1px solid rgba(255, 69, 58, 0.35); color: var(--st-bad); }
.trick-warning-banner {
  margin-top: 0.5rem; padding: 0.4rem 0.6rem; border-radius: 7px;
  background: rgba(255, 159, 10, 0.1); border: 1px solid rgba(255, 159, 10, 0.4);
  font-size: 0.78rem; color: var(--st-warn);
}

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); margin-right: 0.35rem; animation: ping-pulse 1.6s ease-in-out infinite;
}
.status-badge {
  display: inline-block; font-family: var(--mono); padding: 0.2rem 0.55rem; border-radius: 5px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em;
  background: rgba(255, 69, 58, 0.13); color: var(--st-bad); text-transform: uppercase;
}
.hidden-row { display: none; }

/* pdf import / comparison (dark review) */
.import-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.file-ic {
  width: 44px; height: 44px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: rgba(255, 69, 58, 0.12); color: var(--st-bad); border: 1px solid rgba(255, 69, 58, 0.25);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.tiles4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 0; }
.stat { background: var(--surface); border: 1px solid var(--stroke); border-radius: 14px; padding: 15px; margin: 0; }
.stat .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); }
.stat .n { font-family: var(--rounded); font-weight: 800; font-size: 26px; margin-top: 8px; }
.stat .n.warn { color: var(--st-warn); }
.stat .n.ok { color: var(--st-ok); }
.stat .u { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 3px; }
.legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--text-mid); }
.legend .ic { font-weight: 700; }
.legend .ic.i { color: var(--st-ok); } .legend .ic.c { color: var(--st-info); }
.legend .swatch { display: inline-block; width: 22px; height: 13px; border-radius: 3px; background: rgba(255, 159, 10, 0.22); border: 1px solid rgba(255, 159, 10, 0.45); vertical-align: middle; }
body.dark .cmp { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
body.dark .cmp th { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--d-faint); font-weight: 500; padding: 9px 10px; border-bottom: 1px solid var(--d-stroke); text-align: right; white-space: nowrap; background: transparent; }
body.dark .cmp th.grp { text-align: center; color: var(--d-mid); border-bottom: 1px solid var(--d-stroke-soft); }
body.dark .cmp th.l, body.dark .cmp td.l { text-align: left; }
body.dark .cmp td { padding: 9px 10px; border-top: none; border-bottom: 1px solid var(--d-stroke-soft); text-align: right; font-variant-numeric: tabular-nums; color: var(--d-mid); font-size: 12px; }
body.dark .cmp td.l { color: var(--d-text); font-family: var(--sans); font-weight: 600; }
body.dark .cmp .ci { color: #6ee094; } body.dark .cmp .cc { color: #8fb4ff; }
body.dark .cmp td.diff { background: rgba(255, 159, 10, 0.16); color: #ffc24d; font-weight: 700; }
body.dark .cmp tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
body.dark .cmp tbody tr:hover td.diff { background: rgba(255, 159, 10, 0.22); }

/* warn / info notice cards (duals tie-break guidance) */
.notice {
  border-radius: 12px; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; font-size: 0.9rem;
  border: 1px solid var(--stroke); background: var(--surface);
}
.notice.warn { background: rgba(255, 159, 10, 0.1); border-color: rgba(255, 159, 10, 0.4); }
.notice.warn .nt { color: var(--st-warn); font-weight: 800; font-size: 1rem; margin-bottom: 0.6rem; }
.notice.ok { background: rgba(48, 209, 88, 0.1); border-color: rgba(48, 209, 88, 0.4); color: var(--st-ok); font-weight: 600; }

/* =====================================================================
   AWARDS PODIUM PARTIAL — dual-styled (legacy default + body.dark)
   ===================================================================== */
.awards > summary {
  padding: 0.75rem 1.25rem; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  background: #f7fafc; border-bottom: 1px solid #e2e8f0; list-style: none;
  display: flex; align-items: center; gap: 0.5rem;
}
.awards .award-cite { margin-left: auto; font-size: 0.8rem; color: #718096; font-weight: 400; }
.awards .award-h {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: #2d3748; margin: 0 0 0.6rem;
}
.awards .award-sub { font-size: 0.78rem; font-weight: 600; color: #718096; margin-bottom: 0.35rem; }
.awards table tr { border-bottom: 1px solid #f0f4f8; }
.awards table td { border-top: none; padding: 0.2rem 0.4rem; }
.awards table tr:hover td { background: transparent; }
.awards .rk { width: 1.6rem; color: #4a5568; }
.awards .rk.r1 { color: #b7791f; font-weight: 700; }
.awards .rk.r2 { color: #718096; font-weight: 700; }
.awards .rk.r3 { color: #7b4f21; font-weight: 700; }
.awards .award-total { text-align: right; font-variant-numeric: tabular-nums; }
.awards .award-grp { color: #718096; font-size: 0.8rem; }

body.dark .awards > summary { background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid var(--d-stroke); }
body.dark .awards .award-cite { color: var(--d-dim); }
body.dark .awards .award-h { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--d-faint); font-weight: 500; }
body.dark .awards .award-sub { color: var(--d-dim); }
body.dark .awards table tr { border-bottom: 1px solid var(--d-stroke-soft); }
body.dark .awards .rk { color: var(--d-mid); }
body.dark .awards .rk.r1 { color: #e3b341; }
body.dark .awards .rk.r2 { color: #c3ccdb; }
body.dark .awards .rk.r3 { color: #d08a52; }
body.dark .awards .award-grp { color: var(--d-dim); }

/* ===================== home surface (epic #1849) =====================
   The role-aware front door: "what you can do" CTAs (#1852), the registration
   front door (#1853), the ontology explainer + section cards (#1851). Styled
   for the default light surface with body.dark counterparts, reusing the shared
   theme tokens. */

/* --- CTA grid (#1852 / #1853) --- */
.cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.cta {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  text-decoration: none; color: inherit;
  background: #f7f9fc;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.cta:hover { border-color: var(--accent-ink); box-shadow: 0 2px 10px rgba(15, 52, 96, 0.1); }
.cta:active { transform: translateY(1px); }
.cta-primary {
  background: #eef3ff;
  border-color: var(--accent-ink);
}
.cta-title { font-weight: 700; font-size: 1rem; color: var(--ink); }
.cta-sub { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.35; }
.cta-disabled { opacity: 0.55; pointer-events: none; }

body.dark .cta {
  background: var(--d-card);
  border: 1px solid var(--d-stroke);
}
body.dark .cta:hover { border-color: var(--accent); box-shadow: none; }
body.dark .cta-primary { background: rgba(102, 148, 250, 0.12); border-color: var(--accent); }
body.dark .cta-title { color: var(--d-text); }
body.dark .cta-sub { color: var(--d-mid); }

/* --- registration notes (#1853) --- */
.reg-note { margin-top: 12px; font-size: 0.9rem; }
.reg-distinction { margin-top: 14px; font-size: 0.85rem; line-height: 1.4; }
.warn-note {
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn-line); border-radius: 8px;
  padding: 8px 12px;
}
body.dark .warn-note {
  background: rgba(255, 159, 10, 0.12); color: #ffc24d;
  border-color: rgba(255, 159, 10, 0.35);
}

/* --- ontology explainer (#1851) --- */
.ontology > .ontology-summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.ontology > .ontology-summary::-webkit-details-marker { display: none; }
.ontology-title { font-weight: 700; font-size: 1.1rem; }
.ontology-title::before { content: "▸ "; color: var(--accent-ink); }
.ontology[open] .ontology-title::before { content: "▾ "; }
.ontology-hint { font-size: 0.85rem; }
.ontology-body { margin-top: 14px; }
.ontology-chain {
  margin: 12px 0 0; padding-left: 1.4rem;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 0.95rem; line-height: 1.45;
}
body.dark .ontology-title::before { color: var(--accent); }

/* --- section cards (#1851) --- */
.home-sections { margin-bottom: 1.25rem; }
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.section-card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 16px;
  text-decoration: none; color: inherit;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.section-card:hover { border-color: var(--accent-ink); box-shadow: 0 2px 10px rgba(15, 52, 96, 0.1); }
.section-name { font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.section-desc { font-size: 0.86rem; color: var(--ink-dim); line-height: 1.4; }

body.dark .section-card {
  background: var(--d-card); border: 1px solid var(--d-stroke); box-shadow: none;
}
body.dark .section-card:hover { border-color: var(--accent); box-shadow: none; }
body.dark .section-name { color: var(--d-text); }
body.dark .section-desc { color: var(--d-mid); }

/* ===================== responsive ===================== */
@media (max-width: 860px) {
  .comp-grid { grid-template-columns: 1fr; }
  .layout-2 { grid-template-columns: 1fr; }
  .tiles4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .topbar .right { width: 100%; min-width: 0; margin-left: 0; gap: 6px; justify-content: space-between; }
  .topbar .account-menu { min-width: 0; }
  .topbar .acct-name { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
  .formset-row { grid-template-columns: 1fr; }
  .jump-pair { grid-template-columns: 1fr; }
  .cta-grid, .section-grid { grid-template-columns: 1fr; }
}
