:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #6b7380;
  --border: #dfe3e9;
  --primary: #0b4f8c;
  --primary-fg: #ffffff;
  --warn: #c35b00;
  --success: #1d7a3c;
  --error: #b3261e;
  --chip-bg: #e8eef5;
  --chip-open: #ffe2c5;
  --chip-reservable: #c7f0d3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary); color: var(--primary-fg);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.brand { color: var(--primary-fg); font-weight: 700; font-size: 18px; text-decoration: none; }
.brand-sub { font-weight: 400; opacity: .8; font-size: 14px; }

.topbar { position: relative; }
.nav-toggle {
  display: none; background: transparent; border: 0; color: var(--primary-fg);
  font-size: 30px; cursor: pointer; padding: 2px 12px; margin-left: auto; line-height: 1;
}
.nav-ico { display: inline-block; width: 20px; text-align: left; margin-right: 8px; font-size: 15px; }
.topnav {
  display: flex; gap: 16px; align-items: center; margin-left: auto;
}
.topnav a {
  color: var(--primary-fg); opacity: .9; font-size: 14px; text-decoration: none;
  padding: 6px 2px;
}
.topnav a:hover { opacity: 1; text-decoration: underline; }
.topnav .nav-signout { opacity: .75; margin-left: 8px; }
.signout { color: var(--primary-fg); opacity: .9; font-size: 14px; }
.page-title { font-size: 18px; margin: 8px 0; }

.legal-notice {
  margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); line-height: 1.5;
}
.legal-card { max-width: 720px; margin: 16px auto; padding: 20px 22px; }
.legal-card h1 { font-size: 22px; margin: 0 0 4px; }
.legal-card h2 { font-size: 15px; margin: 20px 0 6px; color: var(--primary); }
.legal-card p, .legal-card li { font-size: 14px; line-height: 1.55; }
.legal-card ul { padding-left: 20px; margin: 6px 0 10px; }
.legal-card strong { color: var(--text); }

@media (max-width: 600px) {
  .nav-toggle { display: block; }
  .topnav {
    position: absolute; top: 100%; right: 0; left: auto;
    display: none; flex-direction: column; gap: 0;
    align-items: stretch; justify-content: flex-start;
    background: var(--primary); padding: 4px 0;
    box-shadow: 0 6px 14px rgba(0,0,0,.2);
    min-width: 200px; margin: 0;
    border-radius: 0 0 0 8px;
  }
  .topnav.open { display: flex; }
  .topnav a {
    display: block; text-align: left;
    padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,.12);
    opacity: 1;
  }
  .topnav a:last-child { border-bottom: 0; }
  .topnav .nav-signout { margin-left: 0; opacity: .85; }
}

main { max-width: 720px; margin: 0 auto; padding: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.login-card { max-width: 400px; margin: 48px auto; }
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.subtitle { color: var(--muted); font-weight: 400; font-size: 16px; }
.login-card label { display: block; margin-top: 12px; font-size: 14px; color: var(--muted); }
.login-card input[type=text],
.login-card input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 16px;
  margin-top: 4px;
}

.btn-primary, .btn-secondary, button.btn-primary {
  display: inline-block; padding: 10px 16px; border-radius: 8px; font-size: 16px; font-weight: 600;
  border: 0; cursor: pointer; text-decoration: none; margin-top: 16px;
}
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { background: #fde8e6; color: var(--error); padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
.success { background: #e4f5ea; color: var(--success); padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

.filter-bar {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 12px;
}
.filter-bar > .filter-head {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; color: var(--text);
  padding: 4px 2px; margin: 0;
}
.filter-bar > .filter-head::-webkit-details-marker { display: none; }
.filter-bar > .filter-head .filter-ico { color: var(--primary); font-size: 18px; }
.filter-bar > .filter-head .filter-chevron {
  margin-left: auto; color: var(--primary); font-size: 20px;
  transition: transform 0.18s ease;
}
.filter-bar:not([open]) > .filter-head .filter-chevron { transform: rotate(-90deg); }
.filter-bar[open] > .filter-head { margin-bottom: 10px; }
.filter-bar .row { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.filter-bar label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); flex: 1 1 120px; }
.filter-bar input[type=date], .filter-bar select {
  padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); font-size: 15px; margin-top: 2px;
  background: #fff;
}
.filter-bar .ms-filter {
  display: flex; flex-direction: column; font-size: 12px; color: var(--muted); flex: 1 1 200px;
}
.filter-bar .loc-filter {
  display: flex; flex-direction: column; font-size: 12px; color: var(--muted); flex: 1 1 240px;
}
.loc-row { display: flex; gap: 6px; align-items: center; margin-top: 2px; flex-wrap: wrap; }
.loc-btn { padding: 6px 10px; font-size: 14px; margin-top: 0; }
.ms-dropdown { position: relative; margin-top: 2px; }
.ms-trigger {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 15px; background: #fff; cursor: pointer; text-align: left; color: var(--text);
}
.ms-trigger:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.ms-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; max-height: 320px; overflow: auto;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}
.ms-panel.hidden { display: none; }
.ms-opt {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  font-size: 14px; color: var(--text); cursor: pointer; border-radius: 4px;
  min-width: 0;
}
.ms-opt:hover { background: #f0f3f8; }
.ms-opt input { margin: 0; flex: 0 0 auto; }
.ms-opt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-empty { padding: 8px; }
.ms-placeholder { }

.ms-panel--cities {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 8px; row-gap: 2px;
  min-width: 360px;
}
.ms-panel--cities .ms-empty { grid-column: 1 / -1; }

.ms-panel--divisions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; row-gap: 2px;
  min-width: 240px;
}
.ms-panel--divisions .ms-header {
  font-weight: 700; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; padding: 4px 8px 2px;
  position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--border);
}
.ms-panel--divisions .ms-fullrow { grid-column: 1 / -1; }

.overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(255,255,255,0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  backdrop-filter: blur(2px);
}
.overlay.hidden { display: none; }
.overlay-text { color: var(--text); font-size: 16px; font-weight: 600; }
.overlay-subtext { color: var(--muted); }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--border); border-top-color: var(--primary);
  animation: mt-spin 0.8s linear infinite;
}
@keyframes mt-spin { to { transform: rotate(360deg); } }
.filter-bar .check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 15px; flex: 1 1 auto; }
.filter-bar button, .filter-bar .btn-secondary { margin-top: 0; }
.filter-bar .reset-link { align-self: center; font-size: 14px; color: var(--muted); text-decoration: underline; }
.filter-bar .reset-link:hover { color: var(--text); }

.date-header {
  position: sticky; top: 56px; background: var(--bg); padding: 10px 4px 6px;
  font-weight: 700; font-size: 15px; border-bottom: 1px solid var(--border);
  z-index: 10;
}

.game-list { display: flex; flex-direction: column; gap: 8px; }

.game-card {
  display: flex; gap: 12px; align-items: stretch;
  color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px;
}
.game-card:hover { background: #fafbfd; text-decoration: none; }
.game-main { flex: 1 1 auto; min-width: 0; }

.refs {
  flex: 0 0 40%; display: flex; flex-direction: column; gap: 4px;
  justify-content: center; min-width: 0;
  border-left: 1px solid var(--border); padding-left: 10px;
}
.ref-row { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; }
.ref-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; font-weight: 400; color: #fff; line-height: 1;
}
.ref-icon-center { background: var(--primary); }
.ref-icon-ar { background: #6b7380; }
.ref-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ref-row .chip { font-size: 11px; padding: 1px 6px; }
.game-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.game-num { margin-left: auto; font-size: 12px; }
.time { font-weight: 400; font-size: 14px; margin-right: 6px; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--chip-bg); color: var(--text); font-size: 11px; font-weight: 400;
}
.chip-region { background: #dbe7f4; }
.chip-div { background: #e4e7ee; }
.chip-open { background: var(--chip-open); color: #6a3300; }
.chip-warn { background: #fff2c5; color: #6a4800; }

.teams { display: flex; flex-direction: column; gap: 2px; font-size: 15px; font-weight: 600; margin: 4px 0; }
.teams .vs { margin: 0 6px; color: var(--muted); font-weight: 400; }

.meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 4px; gap: 8px; }
.meta span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.back-link { display: inline-block; margin-bottom: 8px; font-size: 14px; }

.game-detail h2 { font-size: 18px; margin: 12px 0; }
.big-date { font-size: 18px; font-weight: 700; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
.game-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 15px; margin: 10px 0; }
.game-detail dt { color: var(--muted); font-size: 13px; align-self: center; }
.game-detail dd { margin: 0; }

.section-title { margin: 18px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.positions { display: flex; flex-direction: column; gap: 8px; }
.pos-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
}
.pos-row.pos-open { border-color: #f6b678; background: #fff9f1; }
.pos-label { flex: 0 0 72px; font-weight: 700; font-size: 15px; }
.pos-body { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.pos-region {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .03em; padding: 2px 6px; border-radius: 4px;
  background: var(--chip-bg); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pos-name { font-size: 15px; color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-btn { margin-top: 0; padding: 8px 14px; font-size: 14px; }

.reserve-pos-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.reserve-pos-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface);
  margin: 0;
}
.reserve-pos-row.reserve-pos-open { border-color: #f6b678; background: #fff9f1; }
.reserve-pos-row.reserve-pos-selectable { cursor: pointer; }
.reserve-pos-row.reserve-pos-selectable:hover {
  border-color: var(--primary); background: #f0f6fc;
}
.reserve-pos-row.reserve-pos-selectable:has(input:checked) {
  border-color: var(--primary); background: #e6f0fa;
  box-shadow: inset 0 0 0 1px var(--primary);
}
.reserve-pos-radio { flex: 0 0 18px; width: 18px; height: 18px; margin: 1px 0 0 0; }
.reserve-pos-radio-spacer { flex: 0 0 18px; width: 18px; height: 18px; }
.reserve-pos-label {
  flex: 0 0 100px; font-weight: 700; font-size: 14px; color: var(--text);
}
.reserve-pos-text {
  flex: 1; font-size: 14px; color: var(--text); word-break: break-word;
  font-variant-numeric: tabular-nums; min-width: 0;
}
.reserve-pos-open .reserve-pos-text { color: var(--warn); font-weight: 600; }

.reserve-section { margin: 14px 0; }
.reserve-note { margin-top: 10px; }
.reserve-label {
  display: block; font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px;
}
.reserve-radio, .reserve-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); margin-bottom: 6px; font-size: 15px;
  cursor: pointer;
}
.reserve-radio input[type="radio"], .reserve-check input[type="checkbox"] {
  width: 18px; height: 18px; margin: 0; flex: 0 0 auto;
}
.reserve-radio:has(input:checked) { border-color: var(--primary); background: #f0f6fc; }
.reserve-select {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.reserve-submit { margin-top: 18px; width: 100%; padding: 12px; font-size: 16px; }

.game-teams { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.team-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: background-color .12s ease, border-color .12s ease;
}
.team-pill:hover { background: #f3f7fc; border-color: #b8d3ec; text-decoration: none; }
.team-pill-static { cursor: default; }
.team-pill-static:hover { background: var(--surface); border-color: var(--border); }
.team-pill-side {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
  padding: 3px 8px; border-radius: 999px; background: var(--chip-bg);
}
.team-pill-name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-pill-arrow { flex: 0 0 auto; color: var(--muted); font-size: 22px; line-height: 1; }

.team-detail .team-title { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.15; }
.team-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.team-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.team-tags .tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--chip-bg); color: var(--text);
}
.team-tags .tag-sar { background: #dbe7f4; color: #19405e; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.team-tags .tag-div { background: #e4e7ee; }
.team-tags .sep { color: var(--muted); margin: 0 2px; font-weight: 400; }

.team-stats {
  display: flex; gap: 8px; padding: 10px 4px; margin-bottom: 12px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.team-stat { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.team-stat + .team-stat { border-left: 1px solid var(--border); }
.team-stat-num {
  font-size: 18px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap;
}
.team-stat-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

.team-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 4px 0 6px; font-size: 14px; }
.team-info dt { color: var(--muted); font-size: 12px; align-self: center; display: inline-flex; align-items: center; gap: 6px; }
.team-info dt i { font-size: 13px; color: var(--primary); width: 14px; text-align: center; }
.team-info dd { margin: 0; align-self: center; min-width: 0; }
.team-info dd a { word-break: break-all; }

.team-games { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.team-game { margin: 0; }
.tg-link {
  display: flex; gap: 12px; align-items: stretch;
  padding: 10px 12px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px;
  background: var(--surface); color: var(--text); text-decoration: none;
}
.tg-link:hover { background: #fafbfd; text-decoration: none; }
.tg-link-static { cursor: default; }
.tg-link-static:hover { background: var(--surface); }
.team-game.tg-played .tg-link { border-left-color: var(--success); }
.team-game.tg-pending .tg-link { border-left-color: var(--primary); }
.team-game.tg-bye .tg-link { border-left-color: var(--muted); background: #f7f8fa; }

.tg-when {
  flex: 0 0 84px; display: flex; flex-direction: column; gap: 1px;
  padding-right: 10px; border-right: 1px solid var(--border);
}
.tg-date { font-weight: 800; font-size: 14px; }
.tg-dow { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tg-time { font-size: 13px; color: var(--text); margin-top: 2px; }
.tg-bye-tag { display: inline-block; margin-top: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 6px; border-radius: 999px; background: var(--chip-bg); align-self: flex-start; }

.tg-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tg-teams { display: flex; flex-direction: column; gap: 2px; }
.tg-side { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.tg-side-tag {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; line-height: 1;
}
.tg-side-tag.tg-h { background: var(--primary); }
.tg-side-tag.tg-a { background: #6b7380; }
.tg-side-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-side-score { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; color: var(--text); }
.tg-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; color: var(--muted); }
.tg-status { color: var(--text); font-weight: 600; }
.team-game.tg-played .tg-status { color: var(--success); }
.team-game.tg-pending .tg-status { color: var(--primary); }

.team-source { margin-top: 14px; }

.team-tabs {
  display: flex; gap: 2px; margin: 14px 0 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.team-tabs::-webkit-scrollbar { display: none; }
.team-tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 9px 14px; font-size: 14px; font-weight: 600;
  color: var(--muted); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.team-tab i { font-size: 16px; line-height: 1; }
.team-tab:hover { color: var(--text); }
.team-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
@media (max-width: 420px) {
  .team-tab { padding: 9px 10px; gap: 5px; }
  .team-tab span { font-size: 13px; }
}
.team-tab-panel { display: none; }
.team-tab-panel.is-active { display: block; }

.gstats {
  display: flex; gap: 8px; padding: 10px 4px; margin-bottom: 12px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.gstat { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.gstat + .gstat { border-left: 1px solid var(--border); }
.gstat-num { font-size: 20px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.gstat-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

.gtable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 8px; }
.gtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.gtable th, .gtable td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top; white-space: normal;
}
.gtable th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; background: #f7f8fa;
  position: sticky; top: 0;
}
.gtable tr:last-child td { border-bottom: 0; }
.gtable .gtable-total td { font-weight: 800; background: #f7f8fa; color: var(--text); }
.gtable a { color: var(--primary); word-break: break-word; }

.gfooter {
  margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #f7f8fa; display: flex; flex-direction: column; gap: 6px;
}
.gfooter-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; }
.gfooter-lbl { color: var(--muted); }
.gfooter-val { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.gfooter-row.gfooter-regionpoints .gfooter-lbl,
.gfooter-row.gfooter-regionpoints .gfooter-val { color: var(--primary); }
.gfooter-row.gfooter-teamquota .gfooter-lbl,
.gfooter-row.gfooter-teamquota .gfooter-val,
.gfooter-row.gfooter-pointsneeded .gfooter-lbl,
.gfooter-row.gfooter-pointsneeded .gfooter-val { color: var(--error); }
.gfooter-row.gfooter-pointspending .gfooter-lbl,
.gfooter-row.gfooter-pointspending .gfooter-val { color: var(--success); }

.gnote {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 8px;
  background: #fff5f5; border: 1px solid #f5c2c2; color: #8a2828;
  font-size: 13px; font-style: italic;
}

/* Ref History — compact two-column card mirroring the schedule card layout. */
.rh-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rh-card {
  display: flex; gap: 12px; align-items: stretch;
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 10px; background: var(--surface);
  padding: 8px 10px;
}
.rh-when {
  flex: 0 0 64px; display: flex; flex-direction: column; gap: 0;
  padding-right: 10px; border-right: 1px solid var(--border);
  align-items: flex-start;
}
.rh-date { font-weight: 800; font-size: 13px; color: var(--text); white-space: nowrap; }
.rh-dow { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.rh-time { font-size: 12px; color: var(--text); margin-top: 2px; white-space: nowrap; }

.rh-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.rh-top-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rh-top-row .chip { font-size: 11px; padding: 1px 7px; }
.rh-gnum { font-size: 11px; color: var(--muted); font-weight: 600; }
.rh-top-row .rh-points { margin-left: auto; }

.rh-teams { display: flex; flex-direction: column; gap: 1px; }
.rh-team { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.rh-team-tag {
  flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; line-height: 1;
}
.rh-team-tag.rh-h { background: var(--primary); }
.rh-team-tag.rh-a { background: #6b7380; }
.rh-team-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rh-bottom-row {
  display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.rh-ref { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; min-width: 0; }
.rh-ref i { color: var(--primary); font-size: 12px; }
.rh-bottom-row .chip { font-size: 10px; padding: 1px 6px; }
.chip.rh-pos-center { background: var(--chip-open); color: #6a3300; font-weight: 700; }
.chip.rh-pos-ar { background: #e4e7ee; color: var(--text); font-weight: 700; }
.rh-field {
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-style: italic; font-size: 11px; color: var(--muted);
}

.rh-points {
  font-weight: 800; font-size: 14px; color: var(--success);
  font-variant-numeric: tabular-nums; display: inline-flex; align-items: baseline; gap: 3px;
}
.rh-points-lbl { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rh-pending { font-size: 12px; font-weight: 700; color: var(--warn); margin-left: auto; font-variant-numeric: tabular-nums; }

.rh-totals {
  margin-top: 10px; padding: 10px 14px; border-radius: 10px;
  background: #f1f7ec; border: 1px solid #c9e3b8;
  display: flex; flex-direction: column; gap: 4px;
}
.rh-totals-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rh-totals-lbl { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.rh-totals-val { font-weight: 800; font-size: 18px; color: var(--success); font-variant-numeric: tabular-nums; }
.rh-totals-pending .rh-totals-val { color: var(--warn); }

@media (max-width: 480px) {
  main { padding: 8px; }
  .filter-bar label { flex: 1 1 100%; }
  .date-header { top: 52px; }
  .refs { padding-left: 8px; }
  .team-game-when { flex-basis: 70px; }
}
