/* Staff Sports League — design system (plain CSS, no build step).
   Organisation branding arrives as --org-primary / --org-accent from base.html. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("../fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --border: #E3E6EB;
  --border-strong: #D5D9E0;
  --line: #EEF0F3;
  --ink: #14171F;
  --ink-2: #3B414D;
  --muted: #5B6270;
  --topbar: #14171F;
  --topbar-2: #2A2F3A;
  --topbar-muted: #B8BEC9;
  --org-primary: #14171F;
  --org-accent: #1D4ED8;
  --accent-ink: #163BA3;
  --live: #B42318;
  --live-bg: #FDE7E5;
  --success: #0E7C61;
  --success-bg: #DFF5EC;
  --amber-bg: #FFF1D6;
  --amber-ink: #5C3A00;
  --gold-bg: #FBE7A8; --gold-ink: #5C4300; --gold: #C9971A;
  --silver-bg: #E3E6EB; --silver-ink: #2F343D; --silver: #9AA1AD;
  --bronze-bg: #F5D3BF; --bronze-ink: #6B2E0C; --bronze: #B8693D;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(20, 23, 31, .04);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font); }
a { color: var(--org-accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--org-accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }

/* -- top bar ------------------------------------------------------------------------------ */
.topbar { background: var(--topbar); color: #fff; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--org-accent); display: grid; place-items: center; flex: none; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-title { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--topbar-muted); }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mainnav a { color: #D9DDE4; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 13px; }
.mainnav a:hover { color: #fff; background: var(--topbar-2); text-decoration: none; }
.mainnav a[aria-current="page"] { background: var(--topbar-2); color: #fff; font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.season-select { background: var(--topbar); color: #fff; border: 1px solid #3A404C; border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; color: var(--ink); font: 600 13px/1 var(--font); cursor: pointer; }
.btn:hover { text-decoration: none; background: #F7F8FA; color: var(--ink); }
.btn-primary { background: var(--org-accent); border-color: var(--org-accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.topbar .btn-light { background: #fff; color: var(--ink); border-color: #fff; }

/* -- page layout --------------------------------------------------------------------------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.stack { display: grid; gap: 16px; align-content: start; }
.grid { display: grid; gap: 16px; }
.grid-main { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); }
.grid-half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; }
.card-foot { margin-top: 12px; color: var(--muted); font-size: 12px; }
.section-title { margin: 8px 0 12px; }

/* -- KPI tiles ------------------------------------------------------------------------------- */
.kpi-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font: 700 30px/1.15 var(--display); margin-top: 6px; }
.kpi-value small { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi-note.good { color: var(--success); font-weight: 600; }

/* -- tables --------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num-col { text-align: right; font-family: var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table .total { font: 700 18px var(--display); text-align: right; }
.league-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 180px; }
.league-cell a { color: inherit; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--league, var(--muted)); flex: none; }

/* -- badges, pills, medals -------------------------------------------------------------------- */
.badge { display: inline-grid; place-items: center; background: var(--league, var(--ink)); color: #fff; font: 700 11px/1 var(--font); border-radius: 7px; flex: none; letter-spacing: .02em; }
.badge-sm { min-width: 26px; height: 22px; padding: 0 4px; font-size: 10px; border-radius: 6px; }
.badge-md { min-width: 32px; height: 28px; padding: 0 5px; }
.badge-lg { width: 44px; height: 40px; font-size: 13px; border-radius: 10px; }
.badge-xl { width: 76px; height: 76px; font: 700 26px var(--display); border-radius: 16px; background: #fff; color: var(--league); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill-live { background: var(--live); color: #fff; }
.pill-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.pill-done { background: var(--success-bg); color: #075A45; }
.pill-progress { background: var(--amber-bg); color: var(--amber-ink); }
.pill-plain { background: var(--line); color: var(--ink-2); }
.medal { display: inline-grid; place-items: center; min-width: 56px; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.medal-gold { background: var(--gold-bg); color: var(--gold-ink); }
.medal-silver { background: var(--silver-bg); color: var(--silver-ink); }
.medal-bronze { background: var(--bronze-bg); color: var(--bronze-ink); }
.medal-plain { background: var(--line); color: var(--ink-2); }
.medal-live { background: var(--amber-bg); color: #6E4700; }
.medal-dots { display: inline-flex; gap: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.medal-dots span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.medal-dots .g::before { background: var(--gold); }
.medal-dots .s::before { background: var(--silver); }
.medal-dots .b::before { background: var(--bronze); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* -- bars ------------------------------------------------------------------------------------- */
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; width: var(--pct, 0%); background: var(--league, var(--org-accent)); border-radius: inherit; }
.bar.thin { height: 6px; }
.bar.amber > span { background: #E8A317; }

/* -- live card ----------------------------------------------------------------------------------- */
.live-card { background: var(--topbar); color: #fff; border-color: var(--topbar); }
.live-card .muted, .live-card .small { color: var(--topbar-muted); }
.live-card a { color: #A9C1FF; }
.live-team { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; margin: 10px 0; }
.live-team .name { font-weight: 700; font-size: 14px; }
.live-team .score { font: 700 26px var(--display); }
.live-team .extra { font-size: 12px; color: var(--topbar-muted); }

/* -- lists ---------------------------------------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.row-between { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.eyebrow { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.time-box { width: 56px; min-height: 52px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; text-align: center; font: 700 15px/1.1 var(--display); flex: none; padding: 4px; }
.time-box small { display: block; font: 600 10px var(--font); color: var(--muted); }

/* -- performer cards / avatars --------------------------------------------------------------------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font: 700 13px var(--display); color: var(--ink-2); flex: none; position: relative; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }
.avatar .rank { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--font); color: #fff; border: 2px solid #fff; }
.rank-1 { background: var(--gold); } .rank-2 { background: var(--silver); } .rank-3 { background: var(--bronze); }
.performer { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.performer .big { font: 700 28px var(--display); }

/* -- tabs, filters -------------------------------------------------------------------------------- */
.tabs { display: inline-flex; background: #E9EBEF; border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.tabs a:hover { text-decoration: none; background: rgba(255,255,255,.6); }
.tabs a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr) auto; gap: 12px; align-items: end; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field select, .field input { width: 100%; min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; font: inherit; background: #fff; color: var(--ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--ink); font-weight: 600; font-size: 13px; }
.chip:hover { text-decoration: none; border-color: var(--border-strong); color: var(--ink); }
.chip[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* -- fixtures ----------------------------------------------------------------------------------------- */
.date-strip { display: grid; grid-template-columns: repeat(7, minmax(84px, 1fr)); gap: 10px; overflow-x: auto; }
.date-strip a { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 6px; text-align: center; color: var(--ink); }
.date-strip a:hover { text-decoration: none; border-color: var(--border-strong); }
.date-strip a[aria-current="date"], .date-strip a.selected { background: var(--org-accent); border-color: var(--org-accent); color: #fff; }
.date-strip .dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.date-strip .dom { font: 700 22px var(--display); }
.date-strip .cnt { font-size: 11px; }
.match-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 96px minmax(0, 1fr) 150px 84px; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.match-row:last-child { border-bottom: 0; }
.match-row .team { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.match-row .team.home { justify-content: flex-end; text-align: right; }
.scorebox { background: var(--bg); border-radius: 10px; text-align: center; padding: 8px 6px; font: 700 16px var(--display); white-space: nowrap; }
.venue { font-size: 13px; color: var(--muted); }
.match-row .action { text-align: right; font-weight: 600; }

/* -- form (last 5) ------------------------------------------------------------------------------------ */
.form-dots { display: flex; gap: 6px; }
.form-dots span { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; }
.form-W { background: var(--success); } .form-L { background: var(--live); } .form-D { background: var(--silver-bg); color: var(--ink) !important; }

/* -- league hero ----------------------------------------------------------------------------------------- */
.hero { background: var(--league); color: #fff; border-radius: 18px; padding: 22px; }
.hero .muted, .hero .small { color: rgba(255,255,255,.82); }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.hero-stat { background: rgba(255,255,255,.12); border-radius: 12px; padding: 14px; }
.hero-stat .kpi-label { color: rgba(255,255,255,.85); text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; }
.hero-stat .kpi-value { font-size: 26px; }
.hero h1 { font-size: 30px; }

/* -- charts ------------------------------------------------------------------------------------------------ */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 600 11px var(--font); fill: var(--muted); }
.chart .end-label { font: 700 11px var(--display); }
.chart .grid-line { stroke: var(--line); }

/* -- players --------------------------------------------------------------------------------------------- */
.podium .card { display: flex; align-items: center; gap: 14px; }
.podium .pts { margin-left: auto; text-align: right; }
.podium .pts .num { font-size: 30px; font-weight: 700; display: block; line-height: 1; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list .num { font-size: 16px; }
.dept-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 28px; }
.dept-row { display: grid; grid-template-columns: 130px 1fr 32px; gap: 10px; align-items: center; font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; flex-wrap: wrap; }

/* -- alerts / misc ---------------------------------------------------------------------------------------- */
.note { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.alert { background: var(--amber-bg); color: var(--amber-ink); padding: 10px 14px; border-radius: 12px; }
.empty { color: var(--muted); padding: 12px 0; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: #E8EEFF; color: #1E3A8A; margin-left: 6px; }
.org-list { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.org-list a { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; }

/* -- bottom tab bar (phones) ------------------------------------------------------------------------------- */
.bottom-nav { display: none; }
.mobile-only { display: none; }

@media (max-width: 1080px) {
  .grid-main { grid-template-columns: 1fr; }
  .match-row { grid-template-columns: 80px minmax(0, 1fr) 80px minmax(0, 1fr); }
  .match-row .venue, .match-row .action { grid-column: span 2; }
  .match-row .action { text-align: left; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body { padding-bottom: 72px; }
  h1 { font-size: 24px; }
  .page { padding: 16px 16px 32px; }
  .mainnav, .topbar-actions .season-form, .desktop-only { display: none; }
  .mobile-only { display: block; }
  .topbar-inner { gap: 12px; }
  .grid-kpi, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-half, .grid-3, .dept-grid, .hero-stats { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr; }
  .match-row { grid-template-columns: 1fr auto 1fr; row-gap: 6px; }
  .match-row .when { grid-column: 1 / -1; }
  .match-row .team.home { justify-content: flex-end; }
  .match-row .venue, .match-row .action { grid-column: 1 / -1; text-align: left; }
  .dept-row { grid-template-columns: 110px 1fr 28px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--border); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 12px; font-weight: 600; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a[aria-current="page"] { color: var(--org-accent); }
  .bottom-nav svg { width: 22px; height: 22px; }
}

/* -- small-screen polish -------------------------------------------------------------------------------- */
.match-row .team span { overflow-wrap: anywhere; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chips.scroll .chip { flex: none; }
@media (max-width: 720px) {
  .match-row .team { font-size: 13px; gap: 6px; }
  .hero { padding: 16px; }
  .hero h1 { font-size: 24px; }
}

/* == Phase 3: scoring ============================================================================ */
.ink { color: var(--ink); }
.crumbs { color: var(--muted); margin-bottom: 10px; }
.crumbs a { margin-right: 4px; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; min-height: 46px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-outline-light { background: transparent; color: #fff; border-color: #4A5160; }
.btn-outline-light:hover { background: var(--topbar-2); color: #fff; }
.linkish { background: none; border: 0; padding: 0; color: var(--org-accent); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.linkish.danger { color: var(--live); }
.alert-error { background: var(--live-bg); color: #7A1A12; }
.alert-success { background: var(--success-bg); color: #075A45; }
.alert-info, .alert-warning { background: var(--amber-bg); color: var(--amber-ink); }
.table tr.hl > * { background: #EEF3FF; }
.table th.row-name { font-size: 13px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 600; border-bottom-color: var(--line); white-space: normal; }

/* forms */
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; }
.field input[readonly] { background: var(--bg); color: var(--ink-2); }
.field select + select { margin-top: 6px; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline label { margin: 0; }
.field.inline select { width: auto; min-height: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2, .form-grid .field-check { grid-column: 1 / -1; }
.help { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.field-error { margin: 4px 0 0; font-size: 12px; color: var(--live); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.check input { width: 18px; height: 18px; min-height: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.row-wrap { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
fieldset.card { margin: 0; min-width: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
.filters-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.status-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.status-opt { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
.status-opt:has(input:checked) { border-color: var(--org-accent); box-shadow: 0 0 0 1px var(--org-accent); }
.status-opt.status-live:has(input:checked) { border-color: var(--live); box-shadow: 0 0 0 1px var(--live); background: var(--live-bg); }
.score-grid td { padding: 8px 4px; }
.score-input { width: 62px; height: 46px; text-align: center; font: 700 18px var(--display); border: 1px solid var(--border-strong); border-radius: 10px; }
.score-input:focus { border-color: var(--org-accent); outline: 2px solid var(--org-accent); outline-offset: 0; }
.score-input.tb { width: 44px; height: 32px; font-size: 13px; display: block; margin: 4px auto 0; }
.big-num { font: 700 26px var(--display); }
.game-block + .game-block { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.game-title { margin-bottom: 8px; }
.slot-grid { margin-bottom: 8px; }
.goal-row { display: grid; grid-template-columns: 1.2fr 1.6fr 90px auto; gap: 10px; align-items: end; margin-bottom: 8px; }

/* ball chips */
.balls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ball { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 13px var(--display); background: #E3E6EB; color: var(--ink); flex: none; }
.ball-four, .ball-six { background: var(--org-accent); color: #fff; }
.ball-wicket { background: var(--live); color: #fff; }
.ball-extra { background: #F6C35C; color: #3D2800; font-size: 11px; }
.ball-empty { background: transparent; border: 2px dashed #9AA1AD; }
.ball-summary { display: none; }

/* public scorecard hero */
.score-hero { background: var(--topbar); color: #fff; border-radius: 18px; padding: 22px; }
.score-hero h1 { font-size: 20px; }
.score-hero .small { color: var(--topbar-muted); }
.score-hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; margin-top: 16px; }
.hero-team { display: grid; grid-template-columns: auto 1fr auto 70px; align-items: center; gap: 12px; margin-bottom: 10px; color: var(--topbar-muted); }
.hero-team .name { font-size: 17px; font-weight: 600; }
.hero-team .score { font: 700 28px var(--display); }
.hero-team .overs { font-size: 13px; text-align: right; }
.hero-team.current { color: #fff; }
.hero-team.current .name { font-weight: 700; }
.hero-team.current .score { font-size: 40px; }
.hero-team .batting { font-size: 12px; color: #A9C1FF; font-weight: 600; }
.hero-need { background: var(--topbar-2); border-radius: 10px; padding: 12px 16px; font-weight: 700; font-size: 15px; }
.hero-need span { color: #F6C35C; }
.hero-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.hero-tile { background: var(--topbar-2); border-radius: 10px; padding: 12px 14px; }
.hero-tile .kpi-label { color: var(--topbar-muted); }
.hero-tile .v { font: 700 24px var(--display); margin-top: 4px; }
.hero-tile .v small { font-size: 13px; color: var(--topbar-muted); }
.hero-tile .v.amber { color: #F6C35C; }
.hero-overs { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; border-top: 1px solid var(--topbar-2); margin-top: 16px; padding-top: 16px; }
.hero-overs .lbl { font-size: 13px; color: var(--topbar-muted); font-weight: 600; }
.hero-overs .ball-empty { border-color: #5B6270; }
.hero-overs .ball:not(.ball-four):not(.ball-six):not(.ball-wicket):not(.ball-extra):not(.ball-empty) { background: #3A404C; color: #fff; }
.commentary > li { display: grid; grid-template-columns: 36px 34px 1fr; gap: 10px; align-items: start; }
.commentary .ob { font: 600 13px var(--display); color: var(--muted); padding-top: 8px; }
.commentary .over-summary { display: block; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); border-bottom: 0; margin: 6px 0; }

/* scorer pad (phone-first) */
.pad-page .topbar, .pad-page .bottom-nav { display: none; }
.pad-page .page { padding: 0 0 24px; max-width: 480px; }
.pad-page { padding-bottom: 0 !important; }
.pad { display: grid; gap: 12px; padding: 0 12px; }
.pad > .pad-head, .pad > .pad-strip { margin: 0 -12px; }
.pad-head { display: flex; align-items: center; gap: 12px; background: var(--topbar); color: #fff; padding: 14px 16px; }
.pad-back { width: 40px; height: 40px; border-radius: 10px; background: var(--topbar-2); display: grid; place-items: center; color: #fff; flex: none; }
.pad-back:hover { color: #fff; }
.pad-title { display: grid; line-height: 1.3; min-width: 0; }
.pad-title strong { font: 700 16px var(--display); }
.pad-title span { font-size: 12px; color: var(--topbar-muted); }
.pad-sync { margin-left: auto; font-size: 12px; font-weight: 700; color: #6EE7B7; white-space: nowrap; }
.pad-sync .ok::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #34D399; margin-right: 6px; }
.pad-sync .busy { display: none; color: #FCD34D; }
.pad-sync.htmx-request .ok { display: none; }
.pad-sync.htmx-request .busy { display: inline; }
.pad-strip { background: var(--league, var(--org-accent)); color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.pad-team { font-size: 13px; font-weight: 600; opacity: .9; }
.pad-score { font: 700 32px/1.1 var(--display); }
.pad-score small { font-size: 15px; font-weight: 500; }
.pad-card { padding: 12px 14px; }
.pad-card h2 { margin-bottom: 10px; }
.pad-batter { display: grid; grid-template-columns: 24px 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; font-size: 16px; }
.pad-batter + .pad-batter { border-top: 1px solid var(--line); }
.pad-batter .name { font-weight: 700; }
.pad-batter .num { font-size: 18px; }
.strike-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--org-accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.strike-dot.off { background: transparent; }
.pad-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.pad-bowler { display: grid; align-content: center; }
.pad-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pad-keys[inert] { opacity: .45; }
.key { min-height: 62px; border-radius: 12px; border: 1px solid var(--border-strong); background: #fff; font: 700 22px var(--display); color: var(--ink); cursor: pointer; padding: 0 8px; }
.key:active { transform: translateY(1px); }
.key-boundary { background: var(--org-accent); border-color: var(--org-accent); color: #fff; }
.key-extra { background: #FFF1D6; border-color: #F0C36B; color: #5C3A00; font: 600 15px var(--font); }
.key-plain { font: 600 15px var(--font); background: #F4F5F7; }
.key-wide { grid-column: 1 / -1; }
.key-sm { min-height: 40px; min-width: 44px; font-size: 15px; }
.key-wicket { background: var(--live); border-color: var(--live); color: #fff; font: 700 18px var(--font); display: grid; place-items: center; list-style: none; }
.pad-wicket > summary { min-height: 58px; }
.pad-wicket > summary::-webkit-details-marker { display: none; }
.pad-wicket[open] > summary { margin-bottom: 10px; }
.pad-more { grid-column: 1 / -1; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.pad-more summary { font-weight: 600; font-size: 13px; cursor: pointer; }
.more-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.more-row .eyebrow { width: 92px; }
.pad-foot { text-align: center; }
.choice-row { display: grid; gap: 8px; margin: 0 0 12px; }
.choice { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px; font-weight: 600; }

@media (max-width: 1080px) {
  .score-hero-grid { grid-template-columns: 1fr; }
  .filters-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .hero-team { grid-template-columns: auto 1fr auto; }
  .hero-team .overs { grid-column: 2 / -1; text-align: left; margin-top: -8px; }
  .hero-team.current .score { font-size: 32px; }
  .form-grid, .filters-3, .goal-row { grid-template-columns: 1fr; }
  .score-input { width: 50px; }
  .commentary > li { grid-template-columns: 32px 34px 1fr; gap: 8px; }
}
.key-undo { grid-column: span 2; font: 600 16px var(--font); background: #fff; }
.keys-set { display: contents; } .keys-set:disabled .key { opacity: .45; cursor: not-allowed; }

/* == Phase 4: admin console ======================================================================= */
.mono, textarea.mono { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.mono { background: var(--bg); border-radius: 10px; padding: 10px 12px; overflow-x: auto; }
.select-sm { min-height: 30px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 12px; }
.field input[type="color"] { padding: 4px; width: 80px; }
.field input[type="file"] { padding: 8px; }
.field input[type="checkbox"] { width: 18px; min-height: 0; }
.topbar .mainnav { flex: 1; }
