:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --text: #1b241e;
  --muted: #5d6b61;
  --border: #d9e0d6;
  --primary: #1f5f3b;
  --primary-ink: #ffffff;
  --primary-soft: #e1efe5;
  --accent: #c99a2e;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn-soft: #fff4d6;
  --warn-ink: #6b4e00;
  --women: #8a3b74;
  --men: #2b5c8a;
  --under: #b42318;
  --over: #1d4ed8;
  --kept: #6b9a2c;
  --dropped: #a8322d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --nav-w: 232px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111613; --surface: #1a211c; --surface-2: #222b25; --text: #e6ece7; --muted: #9aa89e;
    --border: #2f3a33; --primary: #4caf7a; --primary-ink: #0d1a12; --primary-soft: #1d3226;
    --danger: #ef7d74; --danger-soft: #3a1f1d; --warn-soft: #3a3016; --warn-ink: #f0d58a;
    --women: #e08fc9; --men: #8fbbe8; --under: #ff8a80; --over: #8ab4ff; --kept: #5c8a24; --dropped: #9b2f2a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111613; --surface: #1a211c; --surface-2: #222b25; --text: #e6ece7; --muted: #9aa89e;
  --border: #2f3a33; --primary: #4caf7a; --primary-ink: #0d1a12; --primary-soft: #1d3226;
  --danger: #ef7d74; --danger-soft: #3a1f1d; --warn-soft: #3a3016; --warn-ink: #f0d58a;
  --women: #e08fc9; --men: #8fbbe8; --under: #ff8a80; --over: #8ab4ff; --kept: #5c8a24; --dropped: #9b2f2a; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--primary); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* ---- top bar & nav ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem;
  padding: .55rem 16px; padding-top: max(.55rem, env(safe-area-inset-top));
  background: var(--primary); color: var(--primary-ink);
}
.brand { display: flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; font-weight: 650; font-size: 1.05rem; min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand img { border-radius: 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .4rem; min-width: 0; }
#league-select { max-width: 45vw; background: rgba(255,255,255,.15); color: inherit; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: .3rem .5rem; }
#league-select option { color: #000; }
.icon-btn { background: none; border: 0; color: inherit; padding: .3rem; cursor: pointer; border-radius: 6px; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.12); }

.layout { display: flex; min-height: calc(100vh - 52px); }
.sidenav {
  width: var(--nav-w); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  padding: .75rem .5rem 2rem; position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto;
}
.sidenav .section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem .6rem .3rem; }
.sidenav a {
  display: flex; align-items: center; gap: .55rem; padding: .48rem .6rem; border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.sidenav a:hover { background: var(--surface-2); }
.sidenav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidenav a .soon { margin-left: auto; font-size: .68rem; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 0 .4rem; }
.scrim { display: none; }

.view { flex: 1; min-width: 0; padding: 1.1rem 16px 4rem; max-width: 1100px; outline: none; }
.loading { color: var(--muted); padding: 2rem 0; }

@media (max-width: 899px) {
  #menu-btn { display: grid; }
  .sidenav {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100%; z-index: 40; padding-top: 1rem;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidenav { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
}
@media (min-width: 900px) { #menu-btn { display: none !important; } }

/* ---- page header ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1rem; }
.page-head .grow { flex: 1; min-width: 200px; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stat { font-size: 1.6rem; font-weight: 700; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 550;
  padding: .45rem .85rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; text-decoration: none; min-height: 36px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: .2rem .55rem; min-height: 28px; font-size: .85rem; }
.btn.link { border: 0; background: none; color: var(--primary); padding: .2rem .3rem; min-height: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- forms ---- */
label.field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); font-weight: 550; }
label.field.check { flex-direction: row; align-items: center; gap: .45rem; color: var(--text); font-weight: 450; font-size: .95rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .45rem .6rem; min-height: 38px; width: 100%;
}
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
/* labels can wrap to different heights: keep the boxes in a row lined up */
.form-grid > label.field:not(.check) > :is(input, select, textarea) { margin-top: auto; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.search { max-width: 280px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
td.num, th.num { text-align: center; }
table.compact td, table.compact th { padding: .3rem .4rem; }
table.scorecard input { width: 3.2rem; text-align: center; padding: .25rem; min-height: 32px; }
table.scorecard th:first-child, table.scorecard td:first-child { position: sticky; left: 0; background: var(--surface-2); z-index: 1; }

/* ---- badges ---- */
.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: .08rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.active { background: var(--primary-soft); color: var(--primary); }
.badge.sub { background: var(--warn-soft); color: var(--warn-ink); }
.badge.inactive { background: var(--surface-2); color: var(--muted); }
.badge.M { color: var(--men); background: color-mix(in srgb, var(--men) 14%, transparent); }
.badge.W { color: var(--women); background: color-mix(in srgb, var(--women) 14%, transparent); }
.badge.cap { background: var(--accent); color: #2b1f00; }
.badge.bye { background: var(--warn-soft); color: var(--warn-ink); }
.badge.ok { background: var(--primary-soft); color: var(--primary); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ---- alerts ---- */
.alert { border-radius: 8px; padding: .6rem .8rem; margin: .5rem 0; background: var(--surface-2); }
.alert.warn { background: var(--warn-soft); color: var(--warn-ink); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--primary-soft); color: var(--primary); }
.alert ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* ---- tabs ---- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: .55rem .8rem; font: inherit; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---- matchup cards ---- */
.week { margin-bottom: 1rem; }
.week-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.week-head h3 { margin: 0; }
.match-list { display: grid; gap: .5rem; }
.match {
  display: grid; grid-template-columns: 5.2rem 1fr; gap: .6rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .55rem .7rem;
}
.match .when { font-weight: 650; font-variant-numeric: tabular-nums; }
.match .when small { display: block; font-weight: 450; color: var(--muted); font-size: .76rem; }
.match .teams { min-width: 0; }
.match .vs { color: var(--muted); margin: 0 .35rem; font-size: .85rem; }
.match.mine { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.match.bye { background: transparent; border-style: dashed; }
.match-edit { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .4rem; align-items: center; }
@media (max-width: 640px) { .match-edit { grid-template-columns: 1fr 1fr; } }

/* ---- chips (multi-select) ---- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); border-radius: 99px; padding: .25rem .7rem; cursor: pointer; user-select: none; background: var(--surface); }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip input { display: none; }

/* ---- dialogs ---- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .dlg-head { display: flex; align-items: center; padding: .9rem 1rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
dialog .dlg-head h2 { margin: 0; flex: 1; }
dialog .dlg-body { padding: 1rem; }
dialog .dlg-foot { padding: .8rem 1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }

/* ---- toasts ---- */
.toasts { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; gap: .5rem; z-index: 100; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: .65rem .9rem; border-radius: 8px; box-shadow: var(--shadow); animation: pop .15s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

/* ---- auth pages ---- */
.auth-wrap { max-width: 400px; margin: 2rem auto; }
.auth-wrap .card { padding: 1.4rem; }
.auth-wrap form { display: grid; gap: .8rem; }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.coming { text-align: center; padding: 3rem 1rem; }
.coming .big { font-size: 2.5rem; }
.contact a { text-decoration: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .8rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.heat-0 { color: var(--muted); }

/* ---- theme toggle: show the icon for the theme you'd switch to ---- */
#theme-btn .sun { display: none; }
:root[data-theme="dark"] #theme-btn .sun { display: block; }
:root[data-theme="dark"] #theme-btn .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-btn .sun { display: block; }
  :root:not([data-theme="light"]) #theme-btn .moon { display: none; }
}

/* ---- team logos (300x150 landscape banner SVGs; scaled by height) ---- */
.team-logo { display: block; flex: none; object-fit: contain; }
.team-logo.full { width: 300px; max-width: 100%; height: auto; aspect-ratio: 2 / 1; }
.team-logo.sm { height: 30px; width: auto; }
.team-logo.xs { height: 22px; width: auto; }
.team-logo.zoomable { cursor: zoom-in; border-radius: 4px; }
.team-logo.zoomable:hover { filter: brightness(1.06); }
.team-logo.zoomable:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
dialog.logo-lightbox { width: fit-content !important; max-width: calc(100vw - 24px); }
.logo-full { display: grid; place-items: center; }
.logo-full img { display: block; width: 600px; max-width: 100%; height: auto; aspect-ratio: 2 / 1; }
@media (max-width: 520px) { .team-logo.sm { height: 24px; } }
.team-name { display: inline-flex; align-items: center; gap: .4rem; vertical-align: middle; }
.match .teams { display: flex; flex-wrap: wrap; align-items: center; row-gap: .3rem; }
.team-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.team-card { display: flex; flex-direction: column; gap: .75rem; }
.team-card > .team-logo, .team-card > .logo-placeholder { align-self: center; }
.team-card .team-info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
/* keep the card buttons in the bottom-right corner, however many members are listed */
.team-card .team-info > .form-actions { margin-top: auto; padding-top: 1rem; }
.team-card .team-info h2 { margin-top: 0; }
.with-logo { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.with-logo select { flex: 1; min-width: 0; }
.logo-preview { display: flex; gap: 1.25rem; align-items: flex-end; flex-wrap: wrap; justify-content: center;
  padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); min-height: 120px; }
.logo-preview .on-light, .logo-preview .on-dark { padding: .5rem; border-radius: 8px; }
.logo-preview .on-light { background: #fff; }
.logo-preview .on-dark { background: #111613; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- dues ---- */
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.money { text-align: right; }
td.money input { text-align: right; max-width: 8rem; margin-left: auto; display: block; }
tfoot td { font-weight: 650; background: var(--surface-2); border-top: 2px solid var(--border); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--primary); }
.pot { font-size: 2.2rem; font-weight: 750; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.1; }

/* ---- score entry ---- */
.score-match { display: flex; align-items: center; flex-wrap: wrap; gap: .2rem .4rem; font-size: 1.05rem; }
.score-match .vs { color: var(--muted); font-size: .85rem; }
.score-tools { margin: .6rem 0; }
a.match.pick { color: inherit; text-decoration: none; }
a.match.pick:hover { border-color: var(--primary); }
a.match.pick .badge { margin-left: .5rem; }
.save-status { margin: 0; font-size: .82rem; color: var(--muted); text-align: center; }
.save-status.ok { color: var(--primary); font-weight: 600; }
.save-status.busy { color: var(--warn-ink); }
.save-status.err { color: var(--danger); font-weight: 600; }

/* golfer view: one hole per panel, swipe sideways (scroll-snap) */
.hole-strip { display: flex; gap: .35rem; overflow-x: auto; padding: .3rem .2rem .5rem; scrollbar-width: none; }
.hole-strip::-webkit-scrollbar { display: none; }
.hole-dot {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.hole-dot.part { border-color: var(--accent); box-shadow: inset 0 -4px 0 var(--accent); }
.hole-dot.done { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.hole-dot.active { outline: 3px solid var(--primary); outline-offset: 1px; }
.hole-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
  align-items: flex-start; outline: none;
}
.hole-track::-webkit-scrollbar { display: none; }
.hole-panel {
  flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem;
}
.hole-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .7rem; margin-bottom: .4rem; }
.hole-head h2 { margin: 0; font-size: 1.5rem; }
.hole-head .grow-right { margin-left: auto; }
.team-block { margin-top: .6rem; }
.team-label { display: flex; align-items: center; gap: .4rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; margin-bottom: .3rem; }
.player-score {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name name" "score putts" "pick pick";
  gap: .35rem .8rem; align-items: center; padding: .6rem; border: 1px solid var(--border); border-radius: 10px; margin-bottom: .45rem;
  background: var(--surface-2);
}
.player-score.picked { border-color: var(--accent); }
.ps-name { grid-area: name; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.ps-score { grid-area: score; display: flex; align-items: center; gap: .55rem; }
.ps-putts { grid-area: putts; display: flex; align-items: center; gap: .4rem; }
.ps-pick { grid-area: pick; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.2rem; font-size: .9rem; min-height: 32px; }
.ps-pick label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.ps-pick input { width: 22px; height: 22px; }
.player-score.dnp { border-style: dashed; }
.player-score.dnp .ps-score, .player-score.dnp .ps-putts { opacity: .45; }
table.score-grid input.dnp { color: var(--muted); background: var(--surface-2); }
.stepper { display: inline-flex; align-items: center; gap: .25rem; }
.step {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1.5rem; line-height: 1; cursor: pointer; touch-action: manipulation; display: grid; place-items: center; padding: 0;
}
.step:active:not(:disabled) { background: var(--primary-soft); }
.step:disabled { opacity: .35; cursor: default; }
.step-val { min-width: 2ch; text-align: center; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ps-putts .step { width: 40px; height: 40px; font-size: 1.2rem; }
.ps-putts .step-val { font-size: 1.15rem; }
.rel { font-size: .8rem; font-weight: 650; min-width: 5.5em; }
.rel.under, td.sc.under { color: var(--under); }
.rel.over, td.sc.over { color: var(--over); }
.rel.even { color: var(--muted); }
.hole-foot { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; margin-top: .6rem; }
.summary-card td, .summary-card th { text-align: center; }
.summary-card tr.clickable { cursor: pointer; }
.summary-card tfoot th, .summary-card tfoot td { border-top: 2px solid var(--border); font-weight: 700; }
@media (max-width: 420px) {
  .player-score { grid-template-areas: "name name" "score score" "putts pick"; }
  .hole-panel { padding: .7rem; }
}

/* lineup: who's playing (exactly 2 per team) */
.lineup { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.lineup-team { border: 1px solid var(--border); border-radius: 10px; padding: .7rem; background: var(--surface-2); }
.lineup-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.lineup-head h3 { margin: 0; flex: 1; }
.lineup-row { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-top: 1px solid var(--border); }
.lineup-name { flex: 1; min-width: 0; }
.lineup-row .btn { min-height: 40px; }
.lineup-add { margin-top: .5rem; }
.lineup-step h2 { margin-top: 0; }
.course-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem 1rem; margin: .4rem 0 1rem; }
.course-pick .field { min-width: min(100%, 320px); }
.course-pick .small { padding-bottom: .55rem; }

/* admin grid: one player, every hole */
.player-tabs button small { color: var(--muted); font-weight: 450; }
.grid-head { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; margin-bottom: .6rem; }
.grid-head h2 { margin: 0; }
table.score-grid th, table.score-grid td { text-align: center; padding: .3rem .25rem; }
table.score-grid tbody th { text-align: left; position: sticky; left: 0; z-index: 1; }
table.score-grid tr.meta td { color: var(--muted); font-size: .85rem; }
table.score-grid input[type=number] {
  width: 3rem; min-height: 34px; padding: .2rem; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600;
}
table.score-grid input.is-default { color: var(--muted); font-weight: 400; background: var(--surface-2); }
table.score-grid input.under { color: var(--under); }
table.score-grid input.over { color: var(--over); }
table.score-grid input.invalid { outline: 2px solid var(--danger); background: var(--danger-soft); }
table.score-grid td.sum { font-weight: 700; background: var(--surface-2); min-width: 2.6rem; }
table.score-grid tbody tr:hover td { background: transparent; }

/* ---- side games ---- */
.sidegame-table select { min-width: 12rem; }
.sg-game { display: flex; align-items: center; gap: .4rem; }
.sg-payout { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; min-width: 14rem; }
.sg-payout .btn.link { padding: 0; }
.sg-pools { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.sg-pool { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; background: var(--surface-2); }
.sg-pool h3 { margin: 0 0 .2rem; }
.sg-pool p { margin: 0; }
.split-table { width: auto; margin: .4rem 0; }
.split-table th { text-align: left; }
.split-table td.money, .split-table .money { min-width: 6rem; text-align: right; display: inline-block; }
.places-cell { display: flex; align-items: center; gap: .6rem; }
.places-input { width: 4.2rem; text-align: center; }
.sidegame-list { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.sidegame-list dt { font-weight: 650; }
.sidegame-list dd { margin: 0; color: var(--muted); }
@media (max-width: 640px) { .sidegame-list { grid-template-columns: 1fr; } .sidegame-list dd { margin-bottom: .4rem; } }
.sidegame-tag { font-size: .8rem; font-weight: 600; padding: .08rem .55rem; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.sidegame-tag .sg-name, .sidegame-tag .sg-place { white-space: nowrap; }
.sidegame-tag .sg-place { font-weight: 500; }
.sidegame-tag .muted { font-weight: 450; }

/* ---- handicaps ---- */
table.hcp-table { width: auto; min-width: 100%; }
table.hcp-table th, table.hcp-table td { padding: .32rem .5rem; }
.hcp-name { text-align: left; font-weight: 550; text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--text);
  background: var(--surface); position: sticky; left: 0; z-index: 1; white-space: nowrap; }
thead .hcp-name, table.hcp-table thead th:first-child { position: sticky; left: 0; z-index: 2; }
.hcp-value { text-align: center; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
thead .hcp-value { font-size: .78rem; }
thead .hcp-value small { display: block; font-weight: 450; text-transform: none; letter-spacing: 0; }
.hcp-scores-head { text-align: center; }
.hcp-cell { text-align: center; min-width: 2.6rem; font-weight: 600; font-variant-numeric: tabular-nums; color: #fff;
  border: 2px solid var(--surface); }
td.hcp-cell.kept, span.hcp-cell.kept { background: var(--kept); }
td.hcp-cell.dropped, span.hcp-cell.dropped { background: var(--dropped); }
td.hcp-cell.empty { background: transparent; }
table.hcp-table tbody tr:hover td.hcp-cell.kept { background: var(--kept); }
table.hcp-table tbody tr:hover td.hcp-cell.dropped { background: var(--dropped); }
span.hcp-cell { display: inline-block; padding: 0 .35rem; border-radius: 4px; border: 0; min-width: 0; }
.hcp-legend { margin: .2rem 0 .6rem; }
.hcp-team h3 { margin: 1rem 0 .4rem; }
.hcp-rule-preview { font-weight: 650; color: var(--primary); }
.hist-edit input { min-height: 34px; }
.hist-edit input[type=number] { width: 5rem; }
.hcp-prog { margin-top: 1rem; }
.hcp-prog summary { cursor: pointer; color: var(--primary); }
