/*
 * Golf Score: Workspace design system.
 * Dark first, light via [data-theme="light"]. Quiet surfaces and hairlines; golfers' own colors carry identity.
 * Page-specific styles live in pages/*.css; everything shared lives here.
 */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;
  --bg: #101216;
  --side: #0C0D10;
  --panel: #15181D;
  --raise: #1C2026;
  --line: #262B32;
  --line2: #1C2026;
  --ink: #E8EAED;
  --ink2: #B3B8C0;
  --muted: #7E858E;
  --faint: #565D67;
  --good: #5FD08F;
  --bad: #F2766B;
  --bad-line: #EF4444; /* thin marks (row stripes): --bad reads orange at 2px */
  --warn: #E5B567;
  --btn: #15181D;
  --primary: #E8EAED;
  --primary-ink: #0E1013;
  --kbd: #1C2026;
  --track: #1E2228;
  --overlay: rgba(0, 0, 0, .55);

  --eagle-bg: #1D3D6E; --eagle: #C6DCFF;
  --birdie-bg: #16352A; --birdie: #7FE0A9;
  --par-bg: transparent; --par: inherit;
  --bogey-bg: #30250F; --bogey: #EDB66E;
  --double-bg: #421F1C; --double: #F49C91;
  --triple-bg: #65241F; --triple: #FFD0C9;

  /* solid fills for stacked score-mix bars */
  --mix-eagle: #3A74D0; --mix-birdie: #3E9E6A; --mix-par: #2B3038; --mix-par-ink: #B3B8C0;
  --mix-bogey: #B98A4A; --mix-bogey-ink: #1C1408; --mix-double: #C2564B; --mix-triple: #8C2F27;

  --chart-grid: #1E232A;
  --chart-label: #6E757E;
  --chart-other: #4A515B;

  /* brand mark, drawn on the light brand tile (--primary) */
  --mark-green: #23804F; --mark-eagle: #2E66C2; --mark-bogey: #B5803F;
  --mark-par-op: .22; --mark-hole: #0E1013; --mark-hole-op: .3;

  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 236px;
  --panel-w: 300px;
  --font: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --side: #F7F7F5;
  --panel: #F7F7F5;
  --raise: #EDEDEA;
  --line: #E6E6E2;
  --line2: #F0F0ED;
  --ink: #1C1C1A;
  --ink2: #4B4B47;
  --muted: #7F7F78;
  --faint: #A8A8A1;
  --good: #2E8B57;
  --bad: #B4372D;
  --bad-line: #DC2626;
  --warn: #9A5B12;
  --btn: #FFFFFF;
  --primary: #1C1C1A;
  --primary-ink: #FFFFFF;
  --kbd: #FFFFFF;
  --track: #EFEFEC;
  --overlay: rgba(20, 20, 18, .35);

  --eagle-bg: #D3E2FA; --eagle: #1B4486;
  --birdie-bg: #E2F2E8; --birdie: #1D6B41;
  --bogey-bg: #FBF1E6; --bogey: #94511A;
  --double-bg: #F8E1DD; --double: #A3342A;
  --triple-bg: #EFC9C3; --triple: #7F1F16;

  --mix-eagle: #2E66C2; --mix-birdie: #5FB283; --mix-par: #E4E4DF; --mix-par-ink: #4B4B47;
  --mix-bogey: #E8B98C; --mix-bogey-ink: #5A3410; --mix-double: #D9786B; --mix-triple: #9E3A2F;

  --chart-grid: #F0F0ED;
  --chart-label: #9A9A93;
  --chart-other: #C4C4BE;

  /* brand mark, drawn on the dark brand tile (--primary) */
  --mark-green: #5FD08F; --mark-eagle: #4C86E0; --mark-bogey: #D49A52;
  --mark-par-op: .28; --mark-hole: #000000; --mark-hole-op: .5;
}

/* Golfer colors: elements carry style="--gc:<dark>;--gcl:<light>" (see ApplicationHelper#golfer_style) and use var(--g). */
[style*="--gc:"] { --g: var(--gc); }
[data-theme="light"] [style*="--gc:"] { --g: var(--gcl); }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a.link, .prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a.link:hover, .prose a:hover { text-decoration-color: var(--muted); }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 26px; letter-spacing: -.02em; line-height: 1.2; }
svg { flex: none; }
button { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ink2 { color: var(--ink2); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 14px; font-weight: 600; font-size: 14px; }
.brand i { width: 22px; height: 22px; border-radius: 6px; background: var(--primary); display: grid; place-items: center; }
.brand-mark { display: block; width: 100%; height: 100%; }
.bm-pole, .bm-par { fill: var(--primary-ink); }
.bm-par { opacity: var(--mark-par-op); }
.bm-flag, .bm-birdie { fill: var(--mark-green); }
.bm-eagle { fill: var(--mark-eagle); }
.bm-bogey { fill: var(--mark-bogey); }
.bm-hole { fill: var(--mark-hole); opacity: var(--mark-hole-op); }
.nl { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--ink2); font-weight: 500; }
.nl svg { width: 16px; height: 16px; color: var(--muted); }
.nl:hover { background: var(--raise); color: var(--ink); }
.nl.on { background: var(--raise); color: var(--ink); }
.nl.on svg { color: var(--ink); }
.nl .ct { margin-left: auto; color: var(--faint); font-size: 12px; }
.side .grp { font-size: 12px; color: var(--muted); padding: 16px 8px 4px; font-weight: 500; }
.gl { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: var(--radius-sm); color: var(--ink2); }
.gl:hover, .gl.on { background: var(--raise); color: var(--ink); }
/* golfer rows end in two handicap columns (solo shamble, stroke play) under the .gl-head labels */
.side .gl-head { display: flex; align-items: baseline; gap: 10px; }
.gl-head > span:first-child, .gl .gn { flex: 1; min-width: 0; }
.gl-head > span + span, .gl .hc { width: 44px; text-align: right; white-space: nowrap; }
.gl-head > span + span { font-size: 11px; color: var(--faint); font-weight: 400; }
.gl .gn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl .hc { color: var(--muted); font-size: 12px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 10px 0 0 8px; display: flex; align-items: center; gap: 10px; }
.side-foot .av { width: 26px; height: 26px; font-size: 11px; }
.side-foot p { font-size: 12.5px; line-height: 1.3; }
.side-foot small { color: var(--muted); font-size: 11.5px; }
.side-foot .acts { margin-left: auto; display: flex; gap: 2px; }
.icon-btn { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--raise); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.theme-sun { display: none; }
[data-theme="light"] .theme-sun { display: block; }
[data-theme="light"] .theme-moon { display: none; }

.scrim { display: none; }
.app { display: flex; flex-direction: column; min-width: 0; }
.bar {
  height: 52px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}
.menu-btn { display: none; }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; min-width: 0; white-space: nowrap; }
.crumb a:hover { color: var(--ink); }
.crumb b { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumb .sep { color: var(--faint); }
.bar .acts { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.bar .acts form { display: contents; }

.page { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; }
.page.with-panel { grid-template-columns: minmax(0, 1fr) var(--panel-w); }
.page.with-panel.wide-panel { --panel-w: 360px; }
.page.with-panel.mid-panel { --panel-w: 330px; }
.main { padding: 26px 32px 64px; min-width: 0; }
.main.narrow { max-width: 760px; }
.main.center { max-width: 760px; margin: 0 auto; width: 100%; }
.panel { border-left: 1px solid var(--line); padding: 22px 20px 40px; background: var(--side); min-width: 0; }

.flash { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); margin: 0 0 18px; }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.flash.alert::before { background: var(--bad); }
.flash ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- headings */
.ph { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.ph .r { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); flex-wrap: wrap; }
.sub { color: var(--muted); margin-top: 4px; }
.sh { display: flex; align-items: center; gap: 10px; margin: 36px 0 10px; flex-wrap: wrap; }
.sh.first, .main > .sh:first-child { margin-top: 0; }
.sh h2 { font-size: 14px; }
.sh p { color: var(--muted); }
.sh .r { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); }
.sh .r a:hover { color: var(--ink); }
.sh .btn { height: 26px; padding: 0 9px; margin: -3px 0; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-weight: 500; font-size: 13.5px; line-height: 1;
  background: var(--btn); color: var(--ink);
  white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--raise); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--raise); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 13px; }
.btn.lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--btn); max-width: 100%; overflow-x: auto; }
.seg > a, .seg > span, .seg > button { padding: 4px 11px; color: var(--muted); font-weight: 500; border: 0; border-left: 1px solid var(--line); white-space: nowrap; background: transparent; cursor: pointer; }
.seg > :first-child { border-left: 0; }
.seg > a:hover, .seg > button:hover { color: var(--ink); }
.seg > .on { background: var(--raise); color: var(--ink); }
.seg small { color: var(--faint); font-size: 12px; margin-left: 5px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-weight: 500; font-size: 13px; white-space: nowrap; }
a.chip:hover { border-color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fmt { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.bad { color: var(--bad); border-color: var(--double-bg); }
.tag.good { color: var(--good); border-color: var(--birdie-bg); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--g, var(--muted)); flex: none; }
.nm .dot, td .dot, th .dot { margin-right: 9px; }
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 600; background: var(--raise); color: var(--ink); flex: none; }
.av.g { background: color-mix(in srgb, var(--g) 16%, transparent); color: var(--g); }
.av.lg { width: 46px; height: 46px; font-size: 19px; }
.kbd { font: 500 11px var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; background: var(--kbd); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--ink2); white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--faint); flex: none; }
.status.done::before { border-color: var(--good); background: radial-gradient(var(--good) 45%, transparent 50%); }
.status.live::before { border-color: var(--warn); background: radial-gradient(var(--warn) 45%, transparent 50%); }
.status.todo::before { border-color: var(--faint); }

/* ---------------------------------------------------------------- tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { font-weight: 500; color: var(--muted); text-align: left; font-size: 12.5px; padding: 0 10px; height: 32px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 0 10px; height: 42px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.t td.wrap { white-space: normal; padding-top: 8px; padding-bottom: 8px; }
table.t .num { text-align: right; }
table.t .c { text-align: center; }
table.t tr > :first-child { padding-left: 2px; }
table.t tr > :last-child { padding-right: 2px; }
table.t tbody tr.link-row { cursor: pointer; }
table.t tbody tr.link-row:hover td { background: var(--panel); }
table.t td.nm, table.t .nm { font-weight: 500; }
table.t .big { font-weight: 600; font-size: 15px; }
table.t.compact td { height: 36px; }
table.t tfoot td { color: var(--muted); border-bottom: 0; }
/* Grouped header: a label over each set of columns, with a gap between sets. */
table.t th[rowspan] { vertical-align: bottom; padding-bottom: 9px; }
table.t th.gh { border-bottom: 0; height: 26px; vertical-align: bottom; padding-left: 28px; }
table.t th.gh span { display: block; text-align: center; color: var(--ink2); font-weight: 600; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
table.t .gs { padding-left: 28px; }
table.t thead tr:has(> .gh) + tr > :last-child { padding-right: 10px; }
/* Tables that flag rows with a stripe on the first cell (.marked): room so the stripe doesn't touch the text. */
table.t.marked tr > :first-child { padding-left: 12px; }
/* Row groups (one course's or one golfer's rows): mark each group's first row with .grp-start
   to close the group above with a firmer line and leave a little space before the next. */
table.t tr:has(+ tr.grp-start) > td { border-bottom-color: var(--line); }
table.t tr + tr.grp-start > td { padding-top: 10px; height: 52px; }
table.t.compact tr + tr.grp-start > td { height: 46px; }
.sc2 { display: inline-flex; align-items: baseline; gap: 5px; }
.sc2 b { font-weight: 600; }
.sc2 small { color: var(--muted); font-size: 12px; }
.pos { color: var(--faint); width: 28px; }

/* ---------------------------------------------------------------- stat strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi { background: var(--bg); padding: 13px 16px 14px; min-width: 0; }
.kpi > span { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 0; }
.kpi b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; margin: 3px 0 2px; }
.kpi p { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.kpi .bar-mini { height: 4px; border-radius: 2px; background: var(--track); margin-top: 9px; overflow: hidden; }
.kpi .bar-mini i { display: block; height: 100%; background: var(--g, var(--ink2)); }

/* ---------------------------------------------------------------- tale of the tape */
/* Cell dividers are drawn by each cell, so an incomplete last row has no grey gap. */
.tape { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tape.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tb { background: var(--bg); padding: 14px 16px; min-width: 0; box-shadow: 0 0 0 1px var(--line); }
.tb h4 { margin: 0 0 8px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.tb h4 span { color: var(--faint); font-weight: 400; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.br { display: grid; grid-template-columns: var(--tape-label, minmax(40px, 64px)) minmax(0, 1fr) 58px; gap: 10px; align-items: center; height: 24px; font-size: 12.5px; color: var(--muted); }
.tb.wide .br { grid-template-columns: var(--tape-label, minmax(40px, 64px)) minmax(0, 1fr) 96px; }
.br > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br .track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.br .track i { display: block; height: 100%; border-radius: 4px; background: var(--g, var(--ink2)); }
.br b { text-align: right; color: var(--ink2); font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.br b.best { color: var(--ink); font-weight: 600; }
.br b small { color: var(--faint); font-weight: 400; font-size: 11.5px; margin-left: 2px; }
.br .gap { grid-column: 2 / 4; color: var(--faint); font-size: 12px; }

/* ---------------------------------------------------------------- scorecard */
.sc-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sc-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.sc { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
table.sc th, table.sc td { text-align: center; height: 34px; padding: 0; border-left: 1px solid var(--line2); }
table.sc thead th { font-weight: 500; color: var(--muted); background: var(--panel); height: 30px; border-bottom: 1px solid var(--line); }
table.sc .lab { text-align: left; padding-left: 12px; width: 118px; border-left: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.sc .lab .dot { margin-right: 8px; }
table.sc tr.meta td, table.sc tr.meta th { color: var(--faint); height: 26px; font-size: 12px; font-weight: 400; }
table.sc tr.pl { border-top: 1px solid var(--line); }
table.sc tr.grp th { text-align: left; padding: 0 12px; height: 34px; background: var(--panel); border-top: 1px solid var(--line); font-weight: 600; }
table.sc tr.grp th span { color: var(--muted); font-weight: 400; margin-left: 8px; }
table.sc .s { background: var(--panel); font-weight: 600; color: var(--ink2); width: 46px; }
table.sc .tt { font-weight: 600; width: 50px; }
table.sc .tp { width: 46px; color: var(--muted); font-size: 12.5px; }
.c-eagle { background: var(--eagle-bg); color: var(--eagle); font-weight: 600; }
.c-birdie { background: var(--birdie-bg); color: var(--birdie); font-weight: 600; }
.c-bogey { background: var(--bogey-bg); color: var(--bogey); }
.c-double { background: var(--double-bg); color: var(--double); font-weight: 500; }
.c-triple { background: var(--triple-bg); color: var(--triple); font-weight: 600; }
.c-none { color: var(--faint); }
.sc-key { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.sc-key span { display: inline-flex; align-items: center; gap: 6px; }
.sc-key i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.under { color: var(--good); }
.over { color: var(--muted); }

/* ---------------------------------------------------------------- charts */
.chartbox { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 10px; min-width: 0; }
.chartbox h3 { font-size: 13px; margin: 0 0 2px; }
.chartbox .cs { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.chart { position: relative; height: 240px; }
.chart.sm { height: 190px; }
.chart.tall { height: 380px; } /* twice .sm, for charts side by side */
.chart.lg { height: 300px; }
.chart.xl { height: 480px; }
.chart.xxl { height: 720px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; background: var(--g, var(--chart-other)); }

/* ---------------------------------------------------------------- bars and mixes */
.mix-row { display: grid; grid-template-columns: var(--mix-label, 72px) minmax(0, 1fr) auto; gap: 10px; align-items: center; height: 32px; }
.mix-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mix.teams { --mix-label: 200px; }
.mix-row .rc { color: var(--faint); font-size: 12px; text-align: right; min-width: 40px; }
.mixbar { display: flex; height: 20px; border-radius: 5px; overflow: hidden; gap: 2px; }
.mixbar span { display: grid; place-items: center; font-size: 11.5px; font-weight: 600; overflow: hidden; color: #fff; min-width: 0; }
.mixbar .m-eagle { background: var(--mix-eagle); }
.mixbar .m-birdie { background: var(--mix-birdie); }
.mixbar .m-par { background: var(--mix-par); color: var(--mix-par-ink); }
.mixbar .m-bogey { background: var(--mix-bogey); color: var(--mix-bogey-ink); }
.mixbar .m-double { background: var(--mix-double); }
.mixbar .m-triple { background: var(--mix-triple); }
.mk { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.mk span { display: inline-flex; gap: 6px; align-items: center; }
.mk i { width: 10px; height: 10px; border-radius: 3px; }
.rec-bar { display: flex; height: 8px; width: 200px; max-width: 100%; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--track); }
.rec-bar span { display: block; height: 100%; }
.meter { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; background: var(--g, var(--ink2)); border-radius: 3px; }
.hn { display: inline-flex; align-items: center; gap: 5px; margin-right: 12px; color: var(--ink2); white-space: nowrap; }
.hn i { font-style: normal; display: inline-grid; place-items: center; min-width: 22px; height: 20px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; color: var(--ink); background: var(--panel); padding: 0 4px; }
.hn small { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- lists */
.awl { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.awr { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 40px; border-bottom: 1px solid var(--line2); padding: 4px 0; }
.awr .em { font-size: 15px; text-align: center; }
.awr b { font-weight: 500; }
.awr .w { color: var(--muted); font-size: 12.5px; text-align: right; max-width: 260px; }
.awr .w em { font-style: normal; color: var(--ink2); font-weight: 500; }
.awr .tag { margin-left: 6px; }

.rows > .row { display: flex; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--line2); }
.rows > .row .r { margin-left: auto; color: var(--muted); }

.tl { position: relative; padding-left: 22px; padding-bottom: 20px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl > i { position: absolute; left: 0; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--g, var(--ink2)); box-shadow: 0 0 0 3px var(--side); }
.tl .h { display: flex; gap: 8px; align-items: baseline; }
.tl .h b { font-weight: 600; }
.tl .h time { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.tl .ctx { color: var(--muted); font-size: 12.5px; }
.tl ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.tl li { color: var(--ink2); line-height: 1.45; }

/* ---------------------------------------------------------------- side panel */
.panel h3 { font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 0 0 8px; }
.panel h2 { font-size: 14px; margin: 0 0 4px; }
.prop { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 32px; }
.prop > span:first-child { color: var(--muted); }
.prop .v { font-weight: 500; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.pdiv { height: 1px; background: var(--line); margin: 16px 0; }
.note { color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; }
.bullets { margin: 0; padding: 0; list-style: none; }
.bullets li { color: var(--ink2); margin-bottom: 8px; padding-left: 16px; position: relative; line-height: 1.45; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--g, var(--muted)); }
.bullets time { display: block; color: var(--faint); font-size: 12px; }
.diffs { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.diffs span { height: 22px; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; display: inline-grid; place-items: center; font-size: 12px; color: var(--ink2); background: var(--bg); }
.tee-sw { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--muted); display: inline-block; flex: none; }

/* ---------------------------------------------------------------- misc layout */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.split.tight { gap: 16px; }
.split > .sh, .split > div > .sh:first-child { margin-top: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.box.flush { padding: 0; overflow: hidden; }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px 16px; text-align: center; }
.empty b { display: block; color: var(--ink); font-weight: 500; margin-bottom: 2px; }
.empty .btn { margin-top: 12px; }
.prose { color: var(--ink2); line-height: 1.65; max-width: 72ch; }
.prose h1, .prose h2, .prose h3 { color: var(--ink); font-size: 15px; margin: 18px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 10px; }
.prose table { border-collapse: collapse; margin: 8px 0 12px; }
.prose th, .prose td { border-bottom: 1px solid var(--line2); padding: 4px 10px 4px 0; text-align: left; }
.prose blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); }
.prose code { font-size: 12.5px; background: var(--panel); border-radius: 4px; padding: 1px 4px; }
details.more > summary { cursor: pointer; color: var(--muted); list-style: none; padding: 10px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary:hover { color: var(--ink); }
.y { color: var(--good); font-weight: 600; }
.n { color: var(--faint); }
.hot { color: var(--bad); font-weight: 600; }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 18px; max-width: 640px; }
.form.wide { max-width: none; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 500; font-size: 13px; color: var(--ink2); }
.field .hint { color: var(--muted); font-size: 12.5px; }
.input, .field input[type=text], .field input[type=number], .field input[type=date], .field input[type=password],
.field input[type=email], .field input[type=search], .field select, .field textarea, select.input {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font: 14px var(--font);
  outline: none;
}
.field textarea, textarea.input { height: auto; min-height: 120px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
.field select, select.input { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--muted); box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 18%, transparent); }
.field input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink2); }
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.form-errors { border: 1px solid var(--double-bg); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--ink2); }
.form-errors b { color: var(--bad); font-weight: 600; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 12px; margin: 0; min-width: 0; }
.fieldset legend { padding: 0 6px; font-weight: 600; font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters .grow { flex: 1; }
.filters label { color: var(--muted); font-size: 12.5px; }
.filters select { height: 30px; width: auto; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--side); }
.login-card { width: 100%; max-width: 360px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px 24px; }
.login-card .brand { padding: 0 0 18px; font-size: 15px; }
.login-card h1 { font-size: 20px; }
.login-card .sub { margin-bottom: 18px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .page.with-panel, .page.with-panel.wide-panel, .page.with-panel.mid-panel { grid-template-columns: minmax(0, 1fr); }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .tape.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .tape, .tape.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .awl, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 40; background: var(--overlay); }
  body.nav-open .scrim { display: block; }
  .menu-btn { display: grid; margin-left: -6px; }
  .bar { padding: 0 12px 0 16px; }
  .bar .acts .btn:has(svg) .label { display: none; }
  .main { padding: 20px 16px 48px; }
  .panel { padding: 20px 16px 32px; }
  h1 { font-size: 22px; }
}
@media (max-width: 560px) {
  .tape, .tape.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .bar .acts .btn { padding: 0 9px; }
  .awr { grid-template-columns: 22px minmax(0, 1fr); }
  .awr .w { grid-column: 2; text-align: left; max-width: none; padding-bottom: 4px; }
  .chart.xl { height: 380px; }
  .chart.xxl { height: 440px; }
  .mix.teams { --mix-label: 120px; }
}

/* ---------------------------------------------------------------- hole-by-hole table */
table.det { table-layout: fixed; min-width: 760px; font-size: 13px; }
table.det th, table.det td { text-align: center; height: 34px; padding: 0; }
table.det th.lab, table.det td.lab { text-align: left; width: 118px; color: var(--ink2); font-weight: 500; padding-left: 2px; }
table.det .tt { font-weight: 600; width: 56px; }
table.det td.c-birdie, table.det td.c-eagle, table.det td.c-bogey, table.det td.c-double, table.det td.c-triple { border-radius: 0; }
.cell-link { display: grid; place-items: center; height: 100%; width: 100%; color: inherit; }
.cell-link.faint { color: var(--faint); }
.cell-link:hover { outline: 1px solid var(--muted); outline-offset: -4px; border-radius: 6px; }
.seg > [aria-pressed="true"] { background: var(--raise); color: var(--ink); }
.hole-stat-hit { color: var(--good); font-weight: 600; }
.hole-stat-miss { color: var(--bad); font-weight: 600; }
.hole-stat-penalty { color: var(--bad); font-weight: 600; }
.hole-stat-sand { color: var(--warn); font-weight: 600; }
