/* Layout: top bar with player tabs; admins get a clubhouse-green panel pinned on the left; content column on the right. */
:root {
  --bg: #eff3ee;
  --surface: #ffffff;
  --surface-2: #e5ece4;
  --fg: #17221b;
  --muted: #5a6b5f;
  --line: #d3ddd4;
  --accent: #1f5d3a;
  --accent-fg: #ffffff;
  --accent-soft: #d6e7da;
  --flag: #e0ad2b;
  --danger: #b23a2e;
  --danger-soft: #f6e1de;
  --open: #1f5d3a;
  --open-soft: #d6e7da;
  --panel: #173b27;
  --panel-fg: #eef4ef;
  --panel-muted: #9fbca9;
  --panel-hover: #1f4b33;
  --panel-active: #2a6343;
  --shadow: 0 1px 2px rgba(23, 34, 27, .06), 0 2px 8px rgba(23, 34, 27, .05);

  --font-display: "Bitter", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-data: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;

  --r: 10px;
  --r-sm: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1511; --surface: #151f19; --surface-2: #1c2921; --fg: #e5ede7; --muted: #93a598; --line: #2a3a30;
    --accent: #62b486; --accent-fg: #0a1a10; --accent-soft: #1f3a2a; --flag: #f0c14b; --danger: #f07a6c; --danger-soft: #3a1f1b;
    --open: #7fd0a1; --open-soft: #1f3a2a; --panel: #0a110d; --panel-fg: #e5ede7; --panel-muted: #85a090; --panel-hover: #14211a; --panel-active: #1f3a2a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1511; --surface: #151f19; --surface-2: #1c2921; --fg: #e5ede7; --muted: #93a598; --line: #2a3a30;
  --accent: #62b486; --accent-fg: #0a1a10; --accent-soft: #1f3a2a; --flag: #f0c14b; --danger: #f07a6c; --danger-soft: #3a1f1b;
  --open: #7fd0a1; --open-soft: #1f3a2a; --panel: #0a110d; --panel-fg: #e5ede7; --panel-muted: #85a090; --panel-hover: #14211a; --panel-active: #1f3a2a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--flag); outline-offset: 2px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack:not(table) { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Buttons & fields ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover, .btn.confirming { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: .84rem; }
.btn-block { width: 100%; padding-block: 11px; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger { color: var(--danger); }
.link-btn.confirming { font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.field > span em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.grow { flex: 1; }
input, select {
  font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 11px; min-width: 0; width: 100%;
}
.field.inline select { width: auto; }
input[type="file"] { padding: 7px; background: var(--surface-2); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.hint { font-size: .85rem; color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.chip-admin { background: var(--flag); color: #2b2205; }
.chip-open { background: var(--open-soft); color: var(--open); }
.chip-closed { background: var(--surface-2); color: var(--muted); }
.chip-win { background: var(--flag); color: #2b2205; }
.count { font-family: var(--font-data); font-weight: 600; font-size: .95rem; color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-family: var(--font-data); font-weight: 700; font-size: .9rem; }
.badge-alert { background: var(--flag); color: #2b2205; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.card h2 .count { font-size: 1rem; }

/* ---------- Demo bar ---------- */
.demo-bar { background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: .86rem; }
.demo-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.demo-tag { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; background: var(--fg); color: var(--bg); padding: 2px 8px; border-radius: 4px; }
.demo-text { color: var(--muted); }
.demo-switch { display: flex; align-items: center; gap: 8px; margin-left: auto; font-weight: 600; }
.demo-switch select { width: auto; padding: 5px 8px; font-size: .86rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 80vh; display: grid; place-items: center; padding-block: 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--accent); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: .9rem; }
.notice { background: var(--accent-soft); color: var(--fg); padding: 10px 12px; border-radius: var(--r-sm); font-size: .92rem; }
.flag { width: 22px; height: 22px; color: var(--fg); flex: none; }
.auth-brand .flag { color: var(--accent); }

/* ---------- Shell ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.topbar-inner { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--fg); text-decoration: none; }
.tabs { display: flex; gap: 4px; order: 0; }
.tab { white-space: nowrap; flex: none; padding: 7px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .93rem; }
.tab:hover { color: var(--fg); background: var(--surface-2); }
.tab.active { background: var(--accent); color: var(--accent-fg); }
.me { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layout { display: block; }
.shell.with-admin .layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); align-items: start; }
.main { padding-block: 28px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 980px; width: 100%; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.main:focus { outline: none; }
.shell:not(.with-admin) .main { margin-inline: auto; }
.shell.with-admin .main { padding-left: 32px; }

/* Admin panel */
.admin-panel {
  background: var(--panel); color: var(--panel-fg);
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 57px);
  min-height: calc(100vh - 57px);
  padding: 22px 12px; padding-left: max(12px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 16px;
}
.admin-head { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.admin-label { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.admin-label::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--flag); }
.admin-sub { font-size: .78rem; color: var(--panel-muted); }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--panel-fg); text-decoration: none; font-weight: 500; }
.admin-link:hover { background: var(--panel-hover); }
.admin-link.active { background: var(--panel-active); font-weight: 700; box-shadow: inset 3px 0 0 var(--flag); }
.admin-link .count { color: var(--panel-muted); margin: 0; }

/* ---------- Page pieces ---------- */
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.empty { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 36px 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.empty-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }

/* Tee sheet */
.tee-sheet { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.tee-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 14px 20px; border-top: 1px solid var(--line); }
.tee-row:first-child { border-top: 0; }
.tee-date { display: flex; flex-direction: column; align-items: center; line-height: 1; padding: 8px 4px; border-radius: var(--r-sm); background: var(--accent-soft); }
.tee-dow { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.tee-day { font-family: var(--font-data); font-weight: 700; font-size: 1.9rem; font-variant-numeric: tabular-nums; margin: 2px 0; }
.tee-mon { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.tee-course { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; min-width: 0; }
.tee-time { display: flex; flex-direction: column; align-items: end; }
.tee-time-label { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tee-time-val { font-family: var(--font-data); font-weight: 700; font-size: 1.55rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.past summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 6px 0; }
.past[open] summary { margin-bottom: 10px; }
.tee-past { opacity: .75; box-shadow: none; }
.tee-past .tee-date { background: var(--surface-2); }

/* Dinner */
.poll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.poll-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.poll-head p { margin-top: 2px; font-size: .88rem; }
.vote-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vote {
  position: relative; overflow: hidden; width: 100%; text-align: left; font: inherit; color: var(--fg);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
}
.vote:hover:not(:disabled) { border-color: var(--accent); }
.vote:disabled { cursor: default; }
.vote-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); transition: width .3s; z-index: 0; }
.vote > :not(.vote-fill) { position: relative; z-index: 1; }
.vote-main { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.vote-label { min-width: 0; overflow-wrap: anywhere; }
.vote-check { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--line); font-size: .75rem; background: var(--surface); }
.vote.mine { border-color: var(--accent); }
.vote.mine .vote-check { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.vote.lead { border-color: var(--flag); }
.vote-count { font-family: var(--font-data); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.vote-who { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); padding-left: 28px; }
.poll-foot { font-size: .84rem; }
.opt { display: flex; flex-direction: column; gap: 4px; }
.opt-actions { display: flex; gap: 14px; justify-content: flex-end; font-size: .8rem; padding-right: 2px; }
.opt-win .vote { border-color: var(--flag); box-shadow: inset 0 0 0 1px var(--flag); }
.winner-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--panel); color: var(--panel-fg); }
.winner-banner .flag { width: 28px; height: 28px; color: var(--panel-fg); }
.winner-banner > div { display: flex; flex-direction: column; min-width: 0; }
.winner-label { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--panel-muted); }
.winner-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; overflow-wrap: anywhere; }
.poll-done .vote-fill { opacity: .55; }
.suggest { display: flex; gap: 8px; }
.suggest input { flex: 1; padding: 7px 10px; }
.fill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.fill-row p { flex: 1; min-width: 200px; }
.row-win { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); padding-left: 8px; border-radius: var(--r-sm); }
.vote-tally { font-family: var(--font-data); font-weight: 700; font-size: 1.15rem; min-width: 64px; text-align: right; }

/* Scorecards */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.toolbar .btn { margin-left: auto; }
.upload-card h2 { font-size: 1.05rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: 2fr 1fr 1fr; }
.form-grid.four { grid-template-columns: 1.4fr 1.6fr 1fr 1fr; }
.span-2 { grid-column: span 2; }
.archive-course { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
.archive-title { font-size: 1.3rem; display: flex; align-items: baseline; padding-bottom: 8px; border-bottom: 2px solid var(--fg); }
.archive-year { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: start; }
.year-label { font-family: var(--font-data); font-weight: 700; font-size: 1.5rem; color: var(--accent); font-variant-numeric: tabular-nums; position: sticky; top: 72px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.sc-tile { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.sc-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; max-width: 100%; padding: 0; border: 0; background: var(--surface-2); cursor: zoom-in; overflow: hidden; }
.sc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.sc-thumb:hover img { transform: scale(1.03); }
.sc-thumb img { transition: transform .25s; }
.pdf-badge { display: grid; place-items: center; height: 100%; font-family: var(--font-data); font-weight: 700; font-size: 1.6rem; color: var(--muted); letter-spacing: .1em; }
.sc-tile figcaption { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; font-size: .86rem; }
.sc-players { font-weight: 600; overflow-wrap: anywhere; }
.sc-meta { color: var(--muted); font-size: .78rem; }
.sc-del { align-self: start; margin-top: 4px; font-size: .8rem; }

/* Show Me the Money */
.m-up { color: var(--accent); }
.m-down { color: var(--danger); }
.m-even { color: var(--muted); }
.card.money-board { padding: 0; overflow: hidden; gap: 0; }
.money-leader { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2px 16px; padding: 18px 20px; background: var(--panel); color: var(--panel-fg); }
.money-leader .winner-label { grid-column: 1 / -1; }
.money-leader-name { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; min-width: 0; overflow-wrap: anywhere; }
.money-leader-amt { font-family: var(--font-data); font-weight: 700; font-size: 2.2rem; line-height: 1; color: var(--flag); font-variant-numeric: tabular-nums; }
.money-list { list-style: none; margin: 0; padding: 0; }
.money-row { display: grid; grid-template-columns: 28px minmax(0, 1.4fr) minmax(60px, 1fr) 110px; align-items: center; gap: 14px; padding: 12px 20px; }
.money-item { border-top: 1px solid var(--line); }
.money-list .money-item:first-child { border-top: 0; }
button.money-row { font: inherit; color: inherit; width: 100%; text-align: left; border: 0; border-top: 0; background: transparent; cursor: pointer; }
button.money-row:hover:not(:disabled) { background: var(--surface-2); }
button.money-row.is-me:hover:not(:disabled) { background: var(--accent-soft); }
button.money-row:disabled { cursor: default; }
.money-caret { font-size: .8rem; margin-left: 6px; color: var(--muted); }
.money-item.open > .money-row { background: var(--surface-2); }
.money-detail { list-style: none; margin: 0; padding: 4px 20px 14px 62px; background: var(--surface-2); display: flex; flex-direction: column; }
.money-detail li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.money-detail li:first-child { border-top: 0; }
.md-date { font-size: .82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.md-for { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.md-chip { padding: 2px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .8rem; font-weight: 600; }
.md-note { font-size: .8rem; color: var(--muted); }
.md-amt { font-family: var(--font-data); font-weight: 700; font-size: 1.1rem; color: var(--accent); }
.money-row.is-me { background: var(--accent-soft); }
.money-rank { font-family: var(--font-data); font-weight: 700; font-size: 1.2rem; color: var(--muted); text-align: center; }
.money-name { font-weight: 600; display: flex; flex-direction: column; min-width: 0; }
.money-sub { font-weight: 400; font-size: .8rem; color: var(--muted); }
.money-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.money-bar-fill { display: block; height: 100%; border-radius: 999px; }
.money-bar-fill.m-up { background: var(--accent); }
.money-bar-fill.m-down { background: var(--danger); }
.money-bar-fill.m-even { background: transparent; }
.money-total { font-family: var(--font-data); font-weight: 700; font-size: 1.3rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-day { display: flex; flex-direction: column; gap: 2px; }
.log-day + .log-day { margin-top: 10px; }
.log-date { font-size: .78rem; font-family: var(--font-body); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.log-row .money-total { font-size: 1.1rem; }
.money-form { grid-template-columns: 1.3fr 1fr 1fr; }
.cat-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.cat-group legend { padding: 0; margin-bottom: 6px; font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cat-group legend em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { position: relative; cursor: pointer; }
.cat-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; }
.cat-chip span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: .9rem; user-select: none; }
.cat-chip span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line); background: var(--surface); flex: none; }
.cat-chip:hover span { border-color: var(--accent); }
.cat-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.cat-chip input:checked + span::before { border-color: var(--accent-fg); background: var(--accent-fg); box-shadow: inset 0 0 0 3px var(--accent); }
.cat-chip input:focus-visible + span { outline: 2px solid var(--flag); outline-offset: 2px; }
.span-all { grid-column: 1 / -1; }

/* Home: today and the next two days */
.up-next { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.up-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); min-width: 0; }
.up-first { border-color: var(--accent); box-shadow: inset 0 4px 0 var(--accent), var(--shadow); }
.up-label { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.up-date { font-size: .85rem; color: var(--muted); }
.up-course { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1.25; margin-top: 6px; overflow-wrap: anywhere; }
.up-time { font-family: var(--font-data); font-weight: 700; font-size: 1.5rem; font-variant-numeric: tabular-nums; margin-top: 4px; }
.up-time-k { font-family: var(--font-body); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.up-more { margin-top: -6px; font-weight: 600; font-size: .9rem; }
.up-more a { text-decoration: none; }
.up-more a:hover { text-decoration: underline; }

/* Money leaders on the home screen */
.leaders { background: var(--panel); color: var(--panel-fg); border-radius: var(--r); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.leaders-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.leaders-head h2 { font-size: 1.05rem; }
.leaders-sub { font-size: .8rem; color: var(--panel-muted); margin-top: 2px; }
.leader-days { font-size: .76rem; color: var(--panel-muted); }
.leaders-link { color: var(--flag); font-weight: 600; font-size: .88rem; text-decoration: none; }
.leaders-link:hover { text-decoration: underline; }
.leaders-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.leader { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--panel-hover); min-width: 0; }
.leader-1 { box-shadow: inset 0 3px 0 var(--flag); }
.leader.is-me { outline: 1px solid var(--panel-muted); }
.leader-place { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--panel-muted); }
.leader-1 .leader-place { color: var(--flag); }
.leader-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-amt { font-family: var(--font-data); font-weight: 700; font-size: 1.6rem; line-height: 1.1; }
.leader-amt.m-up { color: var(--panel-fg); }
.leader-1 .leader-amt.m-up { color: var(--flag); }
.leader-amt.m-down { color: #f3a49a; }

/* Stableford leaderboard */
.card.board { padding: 0; gap: 0; overflow: hidden; }
.board-unit { font-family: var(--font-body); font-size: .8rem; font-weight: 600; color: var(--panel-muted); margin-left: 6px; letter-spacing: .02em; }
.board .table-wrap { margin: 0; }
.board-table th, .board-table td { padding: 11px 12px; }
.board-table th:first-child, .board-table td:first-child { padding-left: 20px; }
.board-table th:last-child, .board-table td:last-child { padding-right: 20px; }
.board-table th.num, .board-table td.num { text-align: right; }
.board-table tr.is-me td { background: var(--accent-soft); }
.board-rank { font-family: var(--font-data); font-weight: 700; font-size: 1.15rem; color: var(--muted); width: 36px; }
.board-avg { font-family: var(--font-data); font-weight: 700; font-size: 1.45rem; color: var(--accent); }
.board-table th.day-group { text-align: center; border-left: 1px solid var(--line); border-bottom: 0; padding-bottom: 2px; color: var(--fg); }
.day-sub { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: .72rem; max-width: 140px; margin: 0 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-table .sub-head th { font-size: .66rem; padding-top: 2px; }
.board-table .need-col { border-left: 1px solid var(--line); }
.board-table td.need-col { font-family: var(--font-data); font-size: 1.05rem; font-weight: 600; color: var(--muted); }
.board-table td.got-col { font-family: var(--font-data); font-size: 1.2rem; font-weight: 700; }
.board-table td.got-col.met { color: var(--accent); }
.board-table td.got-col.missed { color: var(--danger); }
.board-table td.fb-col { font-family: var(--font-data); font-size: 1rem; font-weight: 600; color: var(--fg); }
.board-table th.fb-col { color: var(--muted); }
.fb-row { gap: 10px 16px; }
.fb-row .fb-name { flex: 1; min-width: 90px; }
.fb-field, .fb-total { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fb-field > span, .fb-total > span { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fb-field .pts-input { width: 76px; }
.fb-total output { width: 64px; text-align: center; font-family: var(--font-data); font-weight: 700; font-size: 1.35rem; color: var(--accent); padding: 4px 0; }
.board-table .pm-col { border-left: 1px solid var(--line); }
.board-pm { font-family: var(--font-data); font-weight: 700; font-size: 1.3rem; }
.pm-up { color: var(--accent); }
.pm-down { color: var(--danger); }
.pm-even { color: var(--muted); }
.leader-amt.lead-pm-up { color: var(--panel-fg); }
.leader-1 .leader-amt.lead-pm-up { color: var(--flag); }
.leader-amt.lead-pm-down { color: #f3a49a; }
.leader-amt.lead-pm-even { color: var(--panel-muted); }
.leaders + .leaders { margin-top: -6px; }
.chip-start { margin-top: 3px; background: color-mix(in srgb, var(--flag) 24%, var(--surface)); color: var(--fg); text-transform: none; letter-spacing: 0; font-weight: 600; }
.board-foot { padding: 0 20px 14px; }
.board-foot:first-of-type { padding-top: 14px; }
.day-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.day-chip { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--fg); cursor: pointer; min-width: 0; }
.day-chip:hover { border-color: var(--accent); }
.day-chip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.day-chip-date { font-weight: 700; }
.day-chip-course { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-chip-n { font-size: .74rem; font-weight: 600; color: var(--accent); }
.points-list .list-row { flex-wrap: nowrap; }
.points-list .list-row > :first-child { flex: 1; }
.pts-input::placeholder { color: var(--muted); font-weight: 500; opacity: .6; }
.pts-input { width: 90px; flex: none; text-align: center; font-family: var(--font-data); font-weight: 700; font-size: 1.15rem; padding: 6px 8px; }

/* Long forms (Points with many players): keep Save in reach while scrolling */
.sticky-save { position: sticky; bottom: 0; z-index: 3; background: var(--surface); margin: 0 -20px -20px; padding: 12px 20px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }

/* Trip Dues */
.chip-owe { background: var(--danger-soft); color: var(--danger); }
.chip-part { background: color-mix(in srgb, var(--flag) 28%, var(--surface)); color: var(--fg); }
.dues-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface-2); }
.dues-stat { display: flex; flex-direction: column; min-width: 0; }
.dues-k { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dues-v { font-family: var(--font-data); font-weight: 700; font-size: 1.6rem; line-height: 1.1; }
.dues-progress { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.dues-progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.dues-row.is-me { background: var(--accent-soft); padding-inline: 10px; border-radius: var(--r-sm); }
.dues-nums { white-space: nowrap; font-weight: 600; }
.dues-table input { width: 100px; padding: 6px 8px; }
.dues-table input[name="note"] { width: 160px; }
.dues-actions { display: inline-flex; gap: 6px; }
.undo-last { margin-left: auto; }
.edit-player { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.readonly { padding: 9px 11px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); overflow-wrap: anywhere; }

/* Admin tables & lists */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.editing td { background: var(--accent-soft); }
.th-actions, .cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .btn + .btn { margin-left: 6px; }
.cell-strong { font-weight: 600; }
.cell-email { color: var(--muted); overflow-wrap: anywhere; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list-row:first-child { border-top: 0; }
.list-row > :first-child { flex: 1; min-width: 0; }
.inline-form { flex-direction: row; align-items: end; gap: 12px; flex-wrap: wrap; }
.inline-form.tight { padding: 0; border: 0; box-shadow: none; background: none; display: flex; }
.rename { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 220px; }
.rename input { font-weight: 600; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(8, 14, 10, .72); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.lb-inner { background: var(--surface); border-radius: var(--r); width: min(960px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lb-body { overflow: auto; padding: 16px; display: grid; place-items: center; min-height: 200px; }
.lb-body img { max-width: 100%; height: auto; border-radius: var(--r-sm); }

/* Toast & spinner */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; z-index: 30; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-err { background: var(--danger); color: #fff; }
.center-screen { min-height: 60vh; display: grid; place-items: center; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}

/* ---------- Narrow screens ---------- */
/* Bottom tab bar (phones) — hidden on wide screens */
.bottom-nav { display: none; }
.mobile-only { display: none !important; }

@media (max-width: 820px) {
  .desk-only { display: none !important; }
  .mobile-only { display: inline-flex !important; }
  .tabs { display: none; }
  .topbar-inner { flex-wrap: nowrap; padding-block: 8px; gap: 10px; }
  .brand { font-size: 1.1rem; min-width: 0; }
  .me { gap: 6px; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px max(4px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
    box-shadow: 0 -2px 10px rgba(23, 34, 27, .06);
  }
  .bn-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; min-height: 48px; justify-content: center; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600; border-radius: var(--r-sm); }
  .bn-item svg { width: 24px; height: 24px; }
  .bn-item.active { color: var(--accent); }
  .bn-item.active svg { stroke-width: 2.4; }
  .bn-item.active span { font-weight: 800; }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .sticky-save { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); margin: 0 -16px -16px; padding: 10px 16px; }

  /* Admin panel becomes a drop-down sheet under the header */
  .shell.with-admin .layout { display: block; }
  .shell.with-admin .main { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .admin-toggle { gap: 6px; }
  .admin-toggle.on { background: var(--panel); border-color: var(--panel); color: var(--panel-fg); }
  .admin-panel { display: none; position: fixed; z-index: 14; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 54px); min-height: 0; max-height: calc(100% - 140px); overflow-y: auto;
    padding: 14px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); box-shadow: 0 12px 30px rgba(0, 0, 0, .3); border-radius: 0 0 var(--r) var(--r); }
  .admin-panel.open { display: flex; }
  .admin-link { padding: 12px 10px; font-size: 1rem; }
  .year-label { position: static; }

  /* Touch-friendly controls; 16px text stops iPhones zooming into fields */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; padding: 7px 13px; font-size: .88rem; }
  .link-btn { padding: 6px 0; }
  .vote { min-height: 52px; }
  .cat-chip span { padding: 10px 16px; font-size: .95rem; }

  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Rename rows (trips, courses): the name box gets its own full-width line */
  .list-row > .rename { flex: 1 1 100%; min-width: 0; }

  /* Admin tables turn into stacked cards */
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .table.stack td[data-label]::before { content: attr(data-label); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; flex: none; }
  .table.stack td:first-child { text-align: left; justify-content: flex-start; font-size: 1.02rem; }
  .table.stack td:first-child[data-label]::before { display: none; }
  .table.stack td.cell-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 10px; text-align: left; }
  .table.stack td.cell-actions .btn + .btn { margin-left: 0; }
  .table.stack .cell-email { text-align: right; }
  .table.stack tr.editing td { background: none; }
  .table.stack tr.editing { background: var(--accent-soft); border-radius: var(--r-sm); padding-inline: 10px; }
  .table-wrap { margin: 0; }
  .dues-table input, .dues-table input[name="note"] { width: 60%; max-width: 220px; text-align: right; }
  .dues-actions { width: 100%; }
  .dues-actions .btn { flex: 1; }

  /* Leaderboard: keep rank and player in view while the days scroll sideways */
  .board-table th:nth-child(1), .board-table td:nth-child(1) { position: sticky; left: 0; z-index: 2; background: var(--surface); width: 34px; min-width: 34px; }
  .board-table th:nth-child(2), .board-table td:nth-child(2) { position: sticky; left: 34px; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
  .board-table .sub-head th { position: static; box-shadow: none; }
  .board-table tr.is-me td:nth-child(1), .board-table tr.is-me td:nth-child(2) { background: var(--accent-soft); }
  .board-table td:nth-child(2) .cell-strong { white-space: nowrap; }
  .board-foot { font-size: .8rem; }

  /* Home cards */
  .up-next { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .up-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 14px 16px; }
  .up-label, .up-date { grid-column: 1; }
  .up-course { grid-column: 1; margin-top: 2px; font-size: 1.15rem; }
  .up-time { grid-column: 2; grid-row: 1 / span 3; align-self: center; text-align: right; margin: 0; display: flex; flex-direction: column; align-items: flex-end; font-size: 1.45rem; line-height: 1.1; }
  .up-time-k { margin: 0; }

  /* Demo strip: one compact row */
  .demo-text { display: none; }
  .demo-inner { flex-wrap: nowrap; padding-block: 6px; gap: 10px; }
  .demo-switch { margin-left: auto; }
  .demo-switch select { max-width: 150px; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  .tee-row { grid-template-columns: 64px minmax(0, 1fr); gap: 4px 14px; padding: 12px 14px; }
  .tee-date { grid-row: span 2; }
  .tee-time { flex-direction: row; align-items: baseline; gap: 8px; }
  .tee-time-val { font-size: 1.3rem; }
  .form-grid, .form-grid.three, .form-grid.four, .money-form { grid-template-columns: minmax(0, 1fr); }
  .money-row { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; }
  .money-bar { grid-column: 2 / -1; grid-row: 2; }
  .money-leader { padding: 16px; }
  .money-leader-amt { font-size: 1.8rem; }
  .money-detail { padding: 4px 14px 12px; }
  .money-detail li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .md-date { grid-column: 1 / -1; }
  .dues-summary { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .dues-v { font-size: 1.3rem; }
  .board-table th:first-child, .board-table td:first-child { padding-left: 14px; }
  .board-table th, .board-table td { padding: 10px 8px; }
  .points-list .list-row { flex-wrap: wrap; }
  .fb-row .fb-name { flex-basis: 100%; }
  .fb-field .pts-input { width: 84px; }
  .day-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leaders-list { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .leader { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 0 10px; padding: 10px 12px; }
  .leader-days { grid-column: 2 / -1; }
  .leader-1 { box-shadow: inset 3px 0 0 var(--flag); }
  .leader-amt { font-size: 1.3rem; }
  .span-2 { grid-column: auto; }
  .archive-year { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .toolbar .btn { margin-left: 0; width: 100%; }
  .me-name { display: none; }
  .card { padding: 16px; }
  .demo-switch { margin-left: 0; }
}
