/* ═══════════════════════════════════════════════════════
   HICKORY — STYLESHEET
   Part of the Callan Kerger family of apps.
   Palette extracted from the source painting (sunset pier with
   lanterns over water) — see CLAUDE.md "branding rework".
   ═══════════════════════════════════════════════════════ */

/* ─── Variables ────────────────────────────────────────── */
:root {
  /* ── Brand palette (semantic, from the source painting) ── */
  --pier-wood:        #2d3a2f;  /* hunter green, primary brand */
  --pier-shadow:      #1a2421;  /* near-black, deepest anchor */
  --water-deep:       #2f5e6e;  /* teal, mid water */
  --water-shallow:    #6fa5a8;  /* light teal, sky/wash */
  --mountain-indigo:  #1f2a44;  /* midnight indigo, deep accent */
  --sunset-coral:     #e6815a;  /* peach-coral, warm accent */
  --sunset-peach:     #f3b79b;  /* lighter peach, soft accent */
  --lantern-gold:     #d9a24a;  /* sunrise gold, primary accent */
  --lantern-cream:    #f4e4c4;  /* lantern cream, dark-mode bright */
  --mist:             #efe9dc;  /* off-white paper background */

  /* ── Legacy tokens preserved for diff minimisation ──
     The `--green-*` series and `--gold-*` series stay so we
     don't have to touch every selector in this file or in
     src/*.js. Values are re-pointed at the new palette so the
     visible result is the Hickory brand. New code should use
     the semantic tokens above. */
  --green-900: var(--pier-shadow);
  --green-800: var(--pier-wood);
  --green-700: #3a4d3f;   /* mid pier-wood */
  --green-600: #4f6b53;   /* mossy mid */
  --green-500: var(--water-shallow);
  --green-100: #d8e5dc;   /* mist-green highlight */
  --green-50:  #f3f0e6;   /* mist tinted slightly green */

  --gold-600:  #b07a1a;
  --gold-500:  var(--lantern-gold);
  --gold-400:  #e8b870;
  --gold-100:  var(--lantern-cream);

  --gray-900:  #111827;
  --gray-800:  #1f2937;
  --gray-700:  #374151;
  --gray-600:  #4b5563;
  --gray-500:  #6b7280;
  --gray-400:  #9ca3af;
  --gray-300:  #d1d5db;
  --gray-200:  #e5e7eb;
  --gray-100:  #f3f4f6;
  --gray-50:   #f9fafb;

  --red-500:   #ef4444;
  --red-100:   #fee2e2;
  --blue-500:  #3b82f6;
  --blue-100:  #dbeafe;

  --bg:        var(--mist);     /* warm paper background */
  --card-bg:   #ffffff;
  --border:    #e5e7eb;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.11);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --nav-h: 68px;
  --hero-h: 120px;

  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Fraunces', 'Playfair Display', Georgia, serif;

  --transition: 0.18s ease;
}

/* ─── Dark Mode (midnight tide) ───────────────────────────
   The brand anchors (`--pier-wood`, `--pier-shadow`) stay DARK in both
   modes — they're the always-dark "pier wood at dusk" surface used as
   header/footer/hero backgrounds with white text. What flips in dark
   mode is the page surface (mist → near-black), the card surface, the
   gray text scale, and the subtle green tints. An earlier version of
   this CSS inverted the brand anchors, producing a near-white header
   with unreadable white text — don't do that. */
[data-theme="dark"] {
  /* Body + card surfaces flip to dark. */
  --bg: #14181a; --card-bg: #1a2421; --border: #2d3a2f;

  /* Gray text scale inverts so text reads "light on dark". */
  --gray-900: #f9fafb; --gray-800: #f3f4f6; --gray-700: #e5e7eb;
  --gray-600: #d1d5db; --gray-500: #9ca3af; --gray-400: #6b7280;
  --gray-300: #4b5563; --gray-200: #374151; --gray-100: #1f2937; --gray-50: #111827;

  /* Subtle-green tints (used as light backgrounds in light mode) become
     dark surface tints in dark mode. Keep --green-800 / --green-900
     pointing at the (still-dark) brand anchors. */
  --green-100: #2a3a32;
  --green-50:  #1a221d;

  /* Gold/cream subtly warmer in dark mode (richer lantern glow). */
  --gold-500: #e8b870;
  --gold-400: #d99c4a;
  --gold-100: #3d2e0a;

  /* Bright accents that need a darker tint background in dark mode. */
  --red-100: #450a0a; --blue-100: #172554;
  --red-500: #f87171; --blue-500: #60a5fa;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3); --shadow-sm: 0 2px 6px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4); --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}
/* The .site-header / .page-hero / .site-footer backgrounds already
   resolve to the (always-dark) pier-wood and pier-shadow via
   --green-800 / --green-900 in their base rules — no dark-mode
   override needed for those. We DO need to drop the body shadow that
   would have visually merged the header into the dark body, since the
   default light-mode shadow has too little contrast on dark. */
[data-theme="dark"] .site-header { box-shadow: 0 2px 12px rgba(0,0,0,0.5); }
[data-theme="dark"] .site-footer { background: var(--pier-shadow); }
[data-theme="dark"] .loading-overlay { background: rgba(15,26,18,0.85); }
[data-theme="dark"] .scorecard-table th { background: #0d1f13; }
[data-theme="dark"] .badge-eagle  { background: #854d0e; color: #fef08a; border-color: #a16207; }
[data-theme="dark"] .badge-birdie { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .badge-par    { background: var(--gray-200); color: var(--gray-600); border-color: var(--gray-300); }
[data-theme="dark"] .badge-bogey  { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .badge-double { background: #3b1f6e; color: #c4b5fd; border-color: #5b21b6; }
[data-theme="dark"] .score-eagle  { background: #854d0e !important; color: #fef08a !important; }
[data-theme="dark"] .score-birdie { background: #7f1d1d !important; color: #fca5a5 !important; }
[data-theme="dark"] .score-bogey  { background: #1e3a5f !important; color: #93c5fd !important; }
[data-theme="dark"] .score-double,
[data-theme="dark"] .score-worse  { background: #3b1f6e !important; color: #c4b5fd !important; }
[data-theme="dark"] .score-pickup { background: #374151 !important; color: #6b7280 !important; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .auth-card { background: var(--card-bg); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--gray-50); border-color: var(--gray-200); color: var(--gray-900);
}
[data-theme="dark"] .toast { background: var(--gray-100); }
[data-theme="dark"] .toast.success { background: #1b4332; }
[data-theme="dark"] .toast.error { background: #991b1b; }
[data-theme="dark"] .api-error-banner { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { font-size: 16px; scroll-behavior: smooth; overflow-x: clip; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ─── Layout ────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Header / Navbar ───────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--green-800);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.navbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-400);
  padding: 6px;
}
.brand-icon svg { width: 100%; height: 100%; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: 0.01em;
}
.brand-tagline {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.72);
  transition: color var(--transition), background var(--transition);
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-link:focus-visible { outline: 2px solid var(--gold-400); outline-offset: -2px; }
.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
  font-weight: 600;
}

/* Mobile-only nav items — hidden on desktop, shown in hamburger */
.mobile-nav-only { display: none; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  transition: var(--transition);
}

/* ─── Page Hero ─────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-700) 60%, var(--green-600) 100%);
  padding: 32px 24px 28px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: 1.875rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.hero-subtitle {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.65);
  margin-top: 4px;
}

/* ─── Main Content ──────────────────────────────────────── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  overflow-x: hidden;
}

.view { display: none; }
.view.active { display: block; }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap;
  gap: 10px;
}
.card-header h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-900);
}
.card-link {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--green-700);
  transition: color var(--transition);
}
.card-link:hover { color: var(--green-600); }

.card-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sort-select {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.sort-select:focus {
  outline: none;
  border-color: var(--green-600);
}

.card-body { padding: 22px; }

/* ─── Stats Grid ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card--primary {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  border-color: transparent;
}
.stat-card--primary .stat-icon-wrap { background: rgba(255,255,255,0.15); color: var(--gold-400); }
.stat-card--primary .stat-value { color: #fff; }
.stat-card--primary .stat-label { color: rgba(255,255,255,0.7); }

.stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--green-50);
  color: var(--green-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-wrap svg { width: 20px; height: 20px; }

.stat-body { min-width: 0; }
.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 500;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Chart Cards ───────────────────────────────────────── */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
  padding: 22px;
  margin-bottom: 20px;
}
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-header h3 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-900);
}
.chart-header p {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 3px;
}
.chart-wrapper {
  position: relative;
  height: 240px;
}

.chart-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.chart-badge.up   { background: var(--red-100);   color: var(--red-500); }
.chart-badge.down { background: var(--green-100);  color: var(--green-700); }

.chart-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.chart-filter-btn {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chart-filter-btn:hover {
  border-color: var(--lantern-gold);
  color: var(--lantern-gold);
}
.chart-filter-btn.active {
  background: var(--lantern-gold);
  border-color: var(--lantern-gold);
  color: #fff;
}

/* ─── Data Table ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.text-center { text-align: center; }

.badge-pts {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
}
.badge-pts.good { background: var(--green-100); color: var(--green-700); }
.badge-pts.avg  { background: var(--gold-100);  color: var(--gold-600); }
.badge-pts.low  { background: var(--red-100);   color: var(--red-500); }

/* ─── Empty States ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 96px 24px 72px;
}
.empty-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto 24px;
  color: var(--green-600);
  background: var(--green-50);
  border-radius: 50%;
  padding: 18px;
}
.empty-icon svg { width: 100%; height: 100%; }
.empty-state h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--gray-900);
  margin-bottom: 10px;
}
.empty-state p {
  color: var(--gray-500);
  max-width: 420px;
  margin: 0 auto 28px;
  font-size: 1rem;
  line-height: 1.6;
}
.empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.empty-table-msg {
  padding: 32px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.875rem;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  min-height: 44px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--green-800);
  color: #fff;
}
.btn-primary:hover { background: var(--green-700); box-shadow: 0 4px 12px rgba(27,67,50,0.3); }

.btn-outline {
  background: transparent;
  color: var(--green-800);
  border: 1.5px solid var(--green-800);
}
.btn-outline:hover { background: var(--green-50); }

.btn-ghost {
  background: var(--gray-100);
  color: var(--gray-700);
}
.btn-ghost:hover { background: var(--gray-200); }

.btn-danger {
  background: transparent;
  color: var(--red-500);
  border: 1.5px solid var(--red-500);
}
.btn-danger:hover { background: var(--red-100); }

.btn-icon {
  padding: 7px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--gray-200); }
.btn-icon svg { width: 15px; height: 15px; }

.btn-lg { padding: 12px 28px; font-size: 0.95rem; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.label-hint {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--green-700);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

.form-group input,
.form-group select {
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--card-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(64,145,108,0.12);
}
.form-group input::placeholder { color: var(--gray-400); }

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--gray-400);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-top: 12px;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--green-700);
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 0 4px;
}

/* ─── Scorecard Table ───────────────────────────────────── */
.scorecard-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.scorecard-legend span {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-eagle  { background: #fef08a; color: #854d0e; border: 1px solid #fde047; }
.badge-birdie { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-par    { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-300); }
.badge-bogey  { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge-double { background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; }

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.scorecard-table th {
  background: var(--green-800);
  color: rgba(255,255,255,0.85);
  padding: 9px 10px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: center;
  white-space: nowrap;
}
/* Scorecard detail: self-contained scroll box so position:sticky has an
   unambiguous scroll ancestor — the only approach that works in iOS Safari. */
.scorecard-scroll-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 60vh;
}
/* Sticky header row */
.scorecard-scroll-wrap .scorecard-table th {
  position: sticky;
  top: 0;
  z-index: 5;
}
/* Two-row team header: second row offsets below first (~44px) */
.team-detail .scorecard-scroll-wrap .scorecard-table thead tr:nth-child(2) th { top: 44px; }
/* Sticky first column (Hole numbers) */
.scorecard-scroll-wrap .scorecard-table th:first-child,
.scorecard-scroll-wrap .scorecard-table td:first-child {
  position: sticky;
  left: 0;
}
.scorecard-scroll-wrap .scorecard-table th:first-child { z-index: 6; } /* corner: above both axes */
.scorecard-scroll-wrap .scorecard-table td:first-child {
  z-index: 4;
  background: var(--card-bg);
}
.scorecard-scroll-wrap .scorecard-table tr.row-subtotal td:first-child { background: var(--gray-50); }
.scorecard-scroll-wrap .scorecard-table tr.row-total td:first-child { background: var(--green-800); }
.scorecard-table th:first-child { text-align: left; padding-left: 16px; }

.scorecard-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--gray-100);
  text-align: center;
  color: var(--gray-700);
}
.scorecard-table td:first-child { text-align: left; padding-left: 16px; font-weight: 600; color: var(--gray-900); }

.scorecard-table tr.row-subtotal td {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--gray-900);
  border-top: 2px solid var(--gray-200);
  border-bottom: 2px solid var(--gray-200);
}
.scorecard-table tr.row-total td {
  background: var(--green-800);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Score input cells */
.score-input {
  width: 52px;
  padding: 5px 4px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color var(--transition), background var(--transition);
}
.score-input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 2px rgba(64,145,108,0.15); }

/* FIR/GIR/Putts inputs */
/* Tri-state toggle: cycles "" (not entered) → "yes" → "no" → "" on click.
   Replaced the old binary checkbox so that "not entered" is data-true rather
   than silently meaning "missed." Sized for touch-friendly tapping. */
.tri-toggle {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: var(--gray-400);
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.tri-toggle:hover:not(:disabled) {
  border-color: var(--green-600);
  background: var(--gray-50);
}
.tri-toggle:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 1px;
}
.tri-toggle[data-state="yes"] {
  border-color: var(--green-700);
  background: rgba(64, 145, 108, 0.12);
  color: var(--green-700);
}
.tri-toggle[data-state="no"] {
  border-color: #b91c1c;
  background: rgba(185, 28, 28, 0.10);
  color: #b91c1c;
}
.tri-toggle:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.putts-input {
  width: 40px;
  padding: 4px 2px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color var(--transition);
}
.putts-input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 2px rgba(64,145,108,0.15); }

/* Shot detail columns — hidden by default on mobile, visible on desktop */
.shot-details-toggle-wrap { display: none; margin-bottom: 8px; }
.shot-detail-col { /* visible by default on desktop */ }
.shot-details-legend {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.68rem;
  color: var(--gray-500);
  line-height: 1.45;
}
.shot-details-legend p { margin: 1px 0; }
.shot-details-legend strong { color: var(--gray-700); }
[data-theme="dark"] .shot-details-legend { background: rgba(255,255,255,0.04); border-color: var(--gray-200); }

/* Shot stats in detail view */
.detail-shot-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 16px;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--gray-600);
}
.detail-shot-stats span { white-space: nowrap; }
.stat-yes { color: var(--green-700); font-weight: 600; }

.normalised-note {
  font-size: 0.75rem;
  color: var(--gray-500);
  padding: 8px 12px;
  margin-top: -8px;
  margin-bottom: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--green-600);
}
[data-theme="dark"] .normalised-note { background: rgba(255,255,255,0.04); }
.stat-no  { color: var(--red-400); font-weight: 500; }

@media (max-width: 768px) {
  .shot-details-toggle-wrap { display: block; }
  .shot-detail-col { display: none; }
  .shot-details-legend { display: none; }
  .shot-details-legend.show-legend { display: block; }
  .show-shot-details .shot-detail-col { display: table-cell; }
}

/* Score colour coding */
.score-eagle  { background: #fef9c3 !important; color: #854d0e !important; }
.score-birdie { background: #fee2e2 !important; color: #991b1b !important; }
.score-par    { background: transparent !important; }
.score-bogey  { background: #dbeafe !important; color: #1e40af !important; }
.score-double { background: #ede9fe !important; color: #5b21b6 !important; }
.score-worse  { background: #f3e8ff !important; color: #7e22ce !important; }
/* score-pickup: player picked up / NR — 0 strokes, 0 Stableford points */
.score-pickup { background: #f3f4f6 !important; color: #9ca3af !important; font-style: italic; }

.pts-cell {
  font-weight: 700;
  font-size: 0.875rem;
}
.pts-good { color: var(--green-700); }
.pts-ok   { color: var(--gray-600); }
.pts-bad  { color: var(--red-500); }

/* ─── Round Entry Top Row (Course + Holes + Tees always together) */
.round-top-row {
  display: grid;
  grid-template-columns: 1.5fr auto 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 480px) {
  .round-top-row { grid-template-columns: 1fr; }
}

/* ─── Sync Indicator ──────────────────────────────────── */
.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.08);
  white-space: nowrap;
}
.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sync-indicator[data-status="synced"]  .sync-dot { background: #22c55e; }
.sync-indicator[data-status="offline"] .sync-dot { background: #f59e0b; }
.sync-indicator[data-status="pending"] .sync-dot { background: #f59e0b; }
.sync-indicator[data-status="syncing"] .sync-dot { background: #3b82f6; animation: sync-pulse 1s infinite; }
.sync-indicator[data-status="error"]   .sync-dot { background: #ef4444; }
@keyframes sync-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Pending sync badge on list items */
.sync-pending-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  margin-left: 6px;
  vertical-align: middle;
}
[data-theme="dark"] .sync-pending-badge { background: #451a03; color: #fbbf24; }

/* ─── Tee Set Rows ────────────────────────────────────── */
.tee-set-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.tee-set-row input {
  padding: 7px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--gray-800);
  background: var(--card-bg);
}
.tee-set-row input:focus { border-color: var(--green-600); outline: none; }
.tee-set-row .ts-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--red-400);
  cursor: pointer;
  transition: all var(--transition);
}
.tee-set-row .ts-remove:hover { background: var(--red-50); color: var(--red-600); }
[data-theme="dark"] .tee-set-row input { background: var(--gray-50); border-color: var(--gray-200); color: var(--gray-900); }
@media (max-width: 480px) {
  .tee-set-row { grid-template-columns: 1fr 1fr; }
  .tee-set-row .ts-name { grid-column: span 2; }
}

/* ─── Stableford Reference Panel ──────────────────────── */
.stableford-ref {
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
}
[data-theme="dark"] .stableford-ref { background: rgba(255,255,255,0.02); }
.stableford-ref-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  gap: 8px;
}
.stableford-ref-toggle:hover { color: var(--green-700); }
.stableford-ref-chevron {
  width: 14px; height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s;
  transform: rotate(0deg);
}
.stableford-ref.open .stableford-ref-chevron { transform: rotate(90deg); }
.stableford-ref-body { display: none; }
.stableford-ref.open .stableford-ref-body { display: block; }
.stableford-ref-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  padding: 4px 20px 14px;
  align-items: start;
}
@media (max-width: 600px) {
  .stableford-ref-inner { grid-template-columns: 1fr; gap: 12px; }
}
.stableford-ref-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.stableford-ref-table {
  font-size: 0.78rem;
  border-collapse: collapse;
}
.stableford-ref-table td {
  padding: 2px 10px 2px 0;
  white-space: nowrap;
}
.stableford-ref-table td:last-child {
  font-weight: 700;
  text-align: center;
  padding-left: 6px;
}

/* Stroke allocation breakdown */
.alloc-summary {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.alloc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  padding: 3px 0;
  flex-wrap: wrap;
}
.alloc-shots {
  font-weight: 700;
  min-width: 70px;
  flex-shrink: 0;
}
.alloc-holes {
  color: var(--gray-600);
}
.alloc-count {
  color: var(--gray-400);
  font-size: 0.72rem;
}
.alloc-high .alloc-shots  { color: var(--green-700); }
.alloc-mid  .alloc-shots  { color: var(--green-600); }
.alloc-none .alloc-shots  { color: var(--gray-400); }
[data-theme="dark"] .alloc-high .alloc-shots { color: var(--green-400); }
[data-theme="dark"] .alloc-mid  .alloc-shots { color: var(--green-500); }

/* Shots received column — highlight when player gets strokes */
.shots-cell { text-align: center; color: var(--gray-400); font-size: 0.82rem; }
.shots-highlight { color: var(--green-700); font-weight: 600; }
[data-theme="dark"] .shots-highlight { color: var(--green-400); }

/* Net score cell */
.net-cell { text-align: center; font-weight: 600; }

/* Result column — uses same score-* classes but show golf terms */
.rel-cell { font-size: 0.78rem; white-space: nowrap; }

.par-input, .si-input {
  width: 44px;
  padding: 4px 4px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.85rem;
  background: var(--gray-50);
}
.par-input:focus, .si-input:focus { outline: none; border-color: var(--green-600); }

/* Holes table in courses */
.holes-table td { padding: 5px 8px; }
.holes-table .col-sep { border-left: 2px solid var(--gray-200); }

/* Tee-specific holes selector */
.tee-holes-selector {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-md);
}
[data-theme="dark"] .tee-holes-selector {
  background: rgba(34,197,94,0.06);
  border-color: rgba(34,197,94,0.2);
}
.tee-holes-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tee-holes-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-700);
  white-space: nowrap;
}
.tee-holes-row select {
  font-size: 0.85rem;
  padding: 5px 10px;
  border: 1px solid var(--green-300);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--gray-800);
  font-weight: 600;
}
.tee-holes-row select:focus { outline: none; border-color: var(--green-600); }

/* ─── Round Summary ─────────────────────────────────────── */
.summary-card { overflow: visible; }
.summary-inner {
  display: flex;
  align-items: stretch;
  padding: 8px 0;
}
.summary-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px;
  text-align: center;
}
.summary-stat--featured .summary-val {
  color: var(--green-700);
  font-size: 2rem;
}
.summary-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1;
}
.summary-lbl {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 6px;
}
.summary-divider {
  width: 1px;
  background: var(--gray-200);
  margin: 12px 0;
}

/* ─── Scorecard History Rows ────────────────────────────── */
.scorecard-row {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.scorecard-row:last-child { border-bottom: none; }
.scorecard-row-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  cursor: pointer;
}
.scorecard-row-header:hover { background: var(--gray-50); }

.sc-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  width: 90px;
  flex-shrink: 0;
}
.sc-course {
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sc-gross {
  font-size: 0.8rem;
  color: var(--gray-500);
}
.sc-pts {
  font-size: 1rem;
  font-weight: 700;
  min-width: 60px;
  text-align: right;
}
.sc-pts.good { color: var(--green-700); }
.sc-pts.ok   { color: var(--gray-700); }
.sc-chevron {
  color: var(--gray-400);
  transition: transform var(--transition);
}
.sc-chevron svg { width: 16px; height: 16px; }
.scorecard-row.open .sc-chevron { transform: rotate(90deg); }

.scorecard-detail {
  display: none;
  padding: 0 20px 20px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}
.scorecard-row.open .scorecard-detail { display: block; }

/* ─── Scorecard pagination ──────────────────────────────── */
.sc-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sc-pagination-info { margin-right: auto; }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 0 16px;
  font-size: 0.8rem;
  color: var(--gray-600);
}
.detail-meta strong { color: var(--gray-900); }

/* ─── Courses List ──────────────────────────────────────── */
.course-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.course-item:last-child { border-bottom: none; }
.course-name { font-weight: 600; color: var(--gray-900); flex: 1; }
.course-meta { font-size: 0.8rem; color: var(--gray-500); }
.course-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ─── Sub-headers ───────────────────────────────────────── */
.sub-header {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--gray-800);
  margin: 20px 0 4px;
}
.sub-hint { font-size: 0.75rem; color: var(--gray-400); margin-bottom: 10px; }

/* ─── Search ────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--gray-400);
  pointer-events: none;
}
.search-input {
  padding: 7px 12px 7px 32px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  width: 220px;
  transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--green-600); }

.sort-select {
  padding: 7px 28px 7px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--gray-700);
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.sort-select:focus { outline: none; border-color: var(--green-600); }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: translateY(16px);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--gray-200); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

/* ─── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-900);
  color: #fff;
  padding: 11px 20px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  z-index: 300;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: var(--green-700); }
.toast.error   { background: #dc2626; }

/* ─── Footer ────────────────────────────────────────────── */
.site-footer {
  background: var(--green-900);
  padding: 20px 24px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

/* ─── Draft resume prompt (top of New Round view) ───────── */
.draft-resume-prompt {
  background: var(--pier-wood);
  border: 1px solid var(--lantern-gold);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.draft-resume-prompt__body {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.draft-resume-prompt__icon {
  color: var(--lantern-gold);
  font-size: 1rem;
  flex-shrink: 0;
  animation: banner-pulse 2s ease-in-out infinite;
}
.draft-resume-prompt__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.draft-resume-prompt__text strong {
  color: var(--lantern-cream);
  font-size: 0.9rem;
}
.draft-resume-prompt__text span {
  color: rgba(255,255,255,0.55);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.draft-resume-prompt__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
[data-theme="dark"] .draft-resume-prompt { background: var(--pier-shadow); }

/* ─── In-progress round banner ──────────────────────────── */
.in-progress-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--pier-wood);
  border-top: 2px solid var(--lantern-gold);
  cursor: pointer;
  transition: background 0.15s;
}
.in-progress-banner:hover { background: var(--green-700); }
.in-progress-banner__icon {
  color: var(--lantern-gold);
  font-size: 0.85rem;
  flex-shrink: 0;
  animation: banner-pulse 2s ease-in-out infinite;
}
@keyframes banner-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.in-progress-banner__text {
  color: var(--lantern-cream);
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}
.in-progress-banner__detail {
  color: rgba(255,255,255,0.55);
  font-size: 0.8rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.in-progress-banner__btn {
  background: var(--lantern-gold);
  color: var(--pier-shadow);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.in-progress-banner__btn:hover { background: var(--gold-400); }
[data-theme="dark"] .in-progress-banner { background: var(--pier-shadow); }
[data-theme="dark"] .in-progress-banner:hover { background: var(--green-900); }

/* push footer up when banner is visible */
body.has-inprogress-banner .site-footer { padding-bottom: 64px; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .navbar { padding: 0 12px; gap: 0; width: 100%; justify-content: space-between; }
  .nav-brand { flex-shrink: 1; min-width: 0; gap: 8px; }
  .brand-icon { width: 32px; height: 32px; padding: 4px; flex-shrink: 0; }
  .brand-name { font-size: 1rem; }
  .brand-tagline { display: none; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--green-900);
    flex-direction: column;
    gap: 0;
    padding: 8px 0 12px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 12px 20px; border-radius: 0; }
  .hamburger { display: flex; flex-shrink: 0; }
  .site-header { position: sticky; top: 0; z-index: 100; }
  .nav-user-dropdown { display: none; }
  .mobile-nav-only { display: list-item; }

  .main-content { padding: 16px 14px 48px; }
  .page-hero { padding: 22px 16px 18px; }
  .hero-title { font-size: 1.4rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.35rem; }

  .form-grid { grid-template-columns: 1fr; }
  .summary-inner { flex-wrap: wrap; }
  .summary-stat { min-width: 50%; }
  .summary-divider { display: none; }

  .scorecard-legend { gap: 4px; }
  .scorecard-legend span { font-size: 0.55rem; padding: 1px 5px; }
  .sc-date { display: none; }
  .scorecard-row-header { gap: 10px; padding: 12px 14px; }

  /* Mobile scorecard entry — bigger touch targets */
  .scorecard-table { font-size: 0.8rem; }
  .scorecard-table td { padding: 8px 6px; }
  .scorecard-table th { padding: 8px 6px; font-size: 0.6rem; }
  .scorecard-table .rel-cell,
  .scorecard-table th.result-col { display: none; } /* hide Result column on mobile */
  .score-input { width: 100%; min-width: 40px; padding: 8px 4px; font-size: 1rem; }
  .par-input, .si-input { width: 38px; padding: 6px 2px; font-size: 0.8rem; }

  .chart-wrapper { height: 180px; }
  .search-input { width: 160px; }
  .sort-select { width: 130px; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Nav User Dropdown ────────────────────────────────── */
.nav-user-dropdown {
  position: relative;
  flex-shrink: 0;
}
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  padding: 5px 8px 5px 8px;
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  font-family: inherit;
}
.nav-user-btn:hover { background: rgba(255,255,255,0.18); }
.nav-user-btn > svg:first-child { width: 15px; height: 15px; opacity: 0.7; flex-shrink: 0; }
.user-dropdown-chevron {
  width: 12px !important; height: 12px !important;
  opacity: 0.6;
  transition: transform 0.2s;
}
.nav-user-dropdown.open .user-dropdown-chevron { transform: rotate(180deg); }
.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--green-900);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 4px 0;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 60;
  list-style: none;
  margin: 0;
}
.nav-user-dropdown.open .user-dropdown-menu { display: block; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,255,255,0.72);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.user-dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.user-dropdown-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.user-dropdown-item.active { color: var(--gold-400); font-weight: 600; }
.user-dropdown-item.active svg { opacity: 1; }
.user-dropdown-item--logout { color: var(--gold-400); }
.user-dropdown-item--logout:hover { color: var(--gold-300); }
.user-dropdown-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 4px 0; }
[data-theme="dark"] .user-dropdown-menu { background: #0d1f13; border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .nav-user-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); }

/* ─── Read-only scorecard inputs ────────────────────────── */
.par-input[readonly],
.si-input[readonly] {
  background: var(--gray-100);
  border-color: transparent;
  color: var(--gray-500);
  cursor: default;
  font-weight: 600;
}
.par-input[readonly]:focus,
.si-input[readonly]:focus {
  box-shadow: none;
  border-color: transparent;
}
/* Score input is always editable — keep it prominent */
.score-input { cursor: text; }

/* ─── Loading Overlay ───────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(240,237,232,0.85);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
.loading-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.loading-box p {
  font-size: 0.875rem;
  color: var(--gray-500);
  font-weight: 500;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Username Modal ────────────────────────────────────── */
.modal--sm { max-width: 420px; }

.modal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green-800);
}
.modal-brand h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-800);
}

.user-modal-intro {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.6;
}

/* ─── API error banner ──────────────────────────────────── */
.api-error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: #991b1b;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.api-error-banner svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════
   AUTH PAGE (login / register screens)
   ═══════════════════════════════════════════════════════════ */

/* ─── Full-screen auth shell ───────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px 16px;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 44px;
  width: 100%;
  max-width: 440px;
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; }
}

/* ─── Brand header ─────────────────────────────────────────── */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.auth-brand-icon {
  width: 48px;
  height: 48px;
  background: var(--green-50);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-700);
  flex-shrink: 0;
}

.auth-brand-icon svg { width: 28px; height: 28px; }

.auth-brand-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-800);
  line-height: 1.2;
}

.auth-brand-tagline {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Login / Register tabs ────────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
  gap: 4px;
}

.auth-tab {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
}

.auth-tab:hover { color: var(--green-700); }
.auth-tab.active {
  color: var(--green-800);
  border-bottom-color: var(--green-700);
}

/* ─── Error display ────────────────────────────────────────── */
.auth-error {
  color: var(--red-500);
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 1em;
  margin-bottom: 4px;
}

/* ─── Submit button ────────────────────────────────────────── */
.auth-submit { width: 100%; justify-content: center; margin-top: 8px; }

/* ─── Registration note ────────────────────────────────────── */
.auth-note {
  font-size: 0.8rem;
  color: var(--gray-500);
  text-align: center;
  margin-top: 14px;
  line-height: 1.5;
}

/* ─── Pending approval state ───────────────────────────────── */
.auth-pending {
  text-align: center;
  padding: 12px 0;
}

.auth-pending-icon {
  width: 56px;
  height: 56px;
  background: var(--green-50);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-600);
  margin: 0 auto 16px;
}

.auth-pending-icon svg { width: 28px; height: 28px; }

.auth-pending h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--green-800);
  margin-bottom: 10px;
}

.auth-pending p {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ─── Forced password change header ───────────────────────── */
.auth-change-pass-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-change-pass-icon {
  width: 52px;
  height: 52px;
  background: var(--gold-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-600);
  margin: 0 auto 14px;
}

.auth-change-pass-icon svg { width: 26px; height: 26px; }

.auth-change-pass-header h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--green-800);
  margin-bottom: 6px;
}

.auth-change-pass-header p {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ═══════════════════════════════════════════════════════════
   ADMIN NAV & PANEL
   ═══════════════════════════════════════════════════════════ */

/* ─── Pending badge on admin nav link ──────────────────────── */
.pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red-500);
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  line-height: 1;
}

/* ─── Admin user table ─────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr.row-pending { background: #fffbeb; }

.admin-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ─── Status badges ────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-approved { background: var(--green-100); color: var(--green-800); }
.status-pending  { background: var(--gold-100);  color: var(--gold-600);  }
.status-rejected { background: var(--red-100);   color: var(--red-500);   }

/* ─── Role badges ──────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.role-admin { background: var(--green-800); color: #fff; }
.role-user  { background: var(--gray-200);  color: var(--gray-700); }

/* ─── Small button variant ─────────────────────────────────── */
.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-success {
  background: var(--green-700);
  color: #fff;
}
.btn-success:hover { background: var(--green-600); }

/* ─── Theme Toggle (inside user dropdown) ─────────────── */
/* Sun/moon icons — only show the active one */
#userMenuTheme { position: relative; }
#userMenuTheme #themeIconSun,
#userMenuTheme #themeIconMoon { width: 15px; height: 15px; flex-shrink: 0; }

/* ─── Forgot Password Link ─────────────────────────────── */
.auth-forgot { text-align: center; margin-top: 12px; }
.auth-forgot a { font-size: 0.8rem; color: var(--green-600); text-decoration: underline; }
.auth-forgot a:hover { color: var(--green-700); }

/* ─── Round Notes ──────────────────────────────────────── */
.detail-notes {
  padding: 10px 14px; background: var(--gray-50); border-radius: var(--radius-sm);
  margin-bottom: 12px; font-size: 0.85rem; color: var(--gray-700);
  line-height: 1.6; white-space: pre-wrap;
}
textarea {
  font-family: var(--font-sans); font-size: 0.875rem;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-md);
  padding: 10px 12px; width: 100%; resize: vertical;
  transition: border-color var(--transition);
}
textarea:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(45,106,79,0.12); }

/* ─── Course Sharing ───────────────────────────────────── */
.share-badge { font-size: 0.65rem; font-weight: 600; color: var(--green-600); text-transform: uppercase; letter-spacing: 0.05em; }
.shared-library { margin-top: 16px; }
.shared-course-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
}
.shared-course-item:last-child { border-bottom: none; }

/* ─── Handicap Goal ────────────────────────────────────── */
.goal-section .card-body { padding: 14px 20px; }
.goal-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.goal-form { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.goal-label { font-size: 0.8rem; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.04em; }
.goal-input { width: 70px; padding: 6px 8px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); text-align: center; font-size: 0.85rem; }
.goal-input:focus { outline: none; border-color: var(--green-600); }
.goal-progress-wrap { flex: 1; min-width: 200px; }
.goal-info { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--gray-500); margin-bottom: 4px; }
.goal-bar { height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.goal-bar-fill { height: 100%; background: var(--green-600); border-radius: 4px; transition: width 0.4s ease; }

/* ─── Per-Hole Stats ───────────────────────────────────── */
.hole-stats-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.hole-stats-table th { background: var(--green-800); color: rgba(255,255,255,0.85); padding: 7px 6px; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; text-align: center; }
.hole-stats-table td { padding: 6px; text-align: center; border-bottom: 1px solid var(--gray-100); font-size: 0.8rem; }
.hole-stats-table .row-subtotal td { background: var(--gray-50); font-weight: 700; }
.hole-stat-under { color: var(--green-700); font-weight: 600; }
.hole-stat-over { color: var(--red-500); font-weight: 600; }
.hole-stat-even { color: var(--gray-500); }

/* ─── Best/Worst holes grid ───────────────────────────── */
.best-worst-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; }
@media (max-width: 640px) { .best-worst-grid { grid-template-columns: 1fr; gap: 12px; } }
.best-worst-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; padding-left: 2px; }
.best-worst-best { color: var(--green-700); }
.best-worst-worst { color: var(--red-500); }

/* ─── Holes Toggle ─────────────────────────────────────── */
.toggle-group {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--green-800);
  width: fit-content;
}
.toggle-btn {
  padding: 7px 18px;
  border: none;
  background: transparent;
  color: var(--green-800);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}
.toggle-btn.active { background: var(--green-800); color: #fff; }
.toggle-btn:not(.active):hover { background: var(--green-50); }
[data-theme="dark"] .toggle-group { border-color: var(--green-500); }
[data-theme="dark"] .toggle-btn { color: var(--green-400); }
[data-theme="dark"] .toggle-btn.active { background: var(--green-700); color: #fff; }
[data-theme="dark"] .toggle-btn:not(.active):hover { background: rgba(82,183,120,0.12); }

.nine-hole-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--gold-100);
  color: var(--gold-600);
  margin-left: 4px;
  vertical-align: middle;
}
[data-theme="dark"] .nine-hole-badge { background: #2a1f07; color: var(--gold-400); }

/* Counting rounds indicator — lantern gold capsule badge shown on rounds
   that contribute to the current Handicap Index calculation. */
.counting-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--gold-100);
  color: var(--gold-600);
  margin-left: 4px;
  vertical-align: middle;
}
[data-theme="dark"] .counting-badge { background: #2a1f07; color: var(--gold-400); }

/* ─── Database Review Page ─────────────────────────────── */

/* Stat sub-line (breakdown text under stat label) */
.stat-sub {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 5px;
  line-height: 1.4;
}

/* Count badge in card-header */
.db-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-100);
  color: var(--green-800);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 8px;
  margin-left: 8px;
  vertical-align: middle;
}
[data-theme="dark"] .db-count-badge { background: rgba(82,183,120,0.15); color: var(--green-400); }

/* Search input */
.db-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.db-search-wrap svg {
  position: absolute;
  left: 9px;
  width: 15px;
  height: 15px;
  color: var(--gray-400);
  pointer-events: none;
  flex-shrink: 0;
}
.db-search-wrap input[type="search"] {
  padding: 6px 10px 6px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  width: 230px;
  outline: none;
  transition: border-color var(--transition);
}
.db-search-wrap input[type="search"]:focus { border-color: var(--green-600); }

/* Audit section sub-headers */
.audit-section { border-top: 1px solid var(--border); }
.audit-section:first-child { border-top: none; }
.audit-section-header {
  padding: 12px 20px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .audit-section-header { background: rgba(255,255,255,0.03); }

/* Responsive: collapse stats grid on narrow screens */
@media (max-width: 640px) {
  .db-search-wrap input[type="search"] { width: 160px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── DB Action Buttons (compact icon buttons for table rows) ── */
.db-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--transition);
  vertical-align: middle;
}
.db-action-btn + .db-action-btn { margin-left: 4px; }
.db-action-btn:hover { background: var(--gray-100); color: var(--gray-800); border-color: var(--gray-300); }
.db-action-btn.delete { border-color: transparent; color: var(--red-400); }
.db-action-btn.delete:hover { background: var(--red-50); color: var(--red-600); border-color: var(--red-200); }
.db-action-btn svg { width: 14px; height: 14px; pointer-events: none; }

[data-theme="dark"] .db-action-btn { border-color: rgba(255,255,255,0.1); color: var(--gray-400); }
[data-theme="dark"] .db-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--gray-100); }
[data-theme="dark"] .db-action-btn.delete { color: #f87171; }
[data-theme="dark"] .db-action-btn.delete:hover { background: rgba(239,68,68,0.12); }

/* ─── Edit modal helpers ─────────────────────────────── */
/* Inline note text next to a <label> (e.g. calculated diff) */
.form-label-note {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--green-600);
  margin-left: 8px;
}

/* Player/owner info banner at top of edit modals */
.er-player-banner {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--green-600);
}
[data-theme="dark"] .er-player-banner { background: rgba(255,255,255,0.04); }

/* ─── Recent Rounds Table — Mobile ─────────────────────── */
.recent-rounds-table .course-cell {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .hide-xs { display: none !important; }

  .recent-rounds-table .course-cell {
    max-width: 110px;
  }

  .recent-rounds-table td,
  .recent-rounds-table th {
    padding: 8px 8px;
    font-size: 0.8rem;
  }

  .recent-rounds-table .badge-pts {
    min-width: 28px;
    padding: 2px 5px;
    font-size: 0.75rem;
  }

  .recent-rounds-table .btn-icon {
    width: 28px;
    height: 28px;
  }

  .sort-select {
    font-size: 0.72rem;
    padding: 3px 6px;
  }
}

@media (max-width: 400px) {
  .recent-rounds-table .course-cell {
    max-width: 80px;
  }
}

/* ─── Help sections ───────────────────────────────────── */
.help-section { scroll-margin-top: 80px; }
.help-section h2 { font-size: 1.2rem; color: var(--green-800); margin-bottom: 8px; }
.help-section h3 { font-size: 1rem; margin-top: 16px; margin-bottom: 6px; }
.help-section h4 { font-size: 0.88rem; font-weight: 600; color: var(--text-secondary); margin-top: 10px; margin-bottom: 4px; }
#help-release-notes h3 { font-size: 1.05rem; color: var(--green-800); margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--gray-100); }
#help-release-notes h3:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.help-section p { font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary); margin-bottom: 8px; }
.help-section ul, .help-section ol { font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary); padding-left: 20px; margin-bottom: 8px; }
.help-section table { font-size: 0.82rem; }
.help-section table th { background: var(--green-800); color: #fff; }
.help-section table td { border-bottom: 1px solid var(--gray-100); padding: 6px 10px; }
.help-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; padding: 12px 0; }
.help-toc a { color: var(--green-700); text-decoration: none; font-size: 0.88rem; padding: 8px 12px; border-radius: 6px; background: var(--gray-50); display: block; }
.help-toc a:hover { background: var(--green-50); color: var(--green-900); }

/* ─── Print Styles ─────────────────────────────────────── */
@media print {
  body { background: #fff !important; }
  .site-header, .page-hero, .site-footer, .hamburger,
  .nav-user-dropdown, .modal-close, #modalPrintBtn,
  .btn-danger, .toast, .loading-overlay { display: none !important; }
  .modal-overlay { position: static; background: none !important; backdrop-filter: none !important; opacity: 1 !important; pointer-events: all !important; }
  .modal {
    position: static; transform: none !important; box-shadow: none !important;
    max-width: 100%; border-radius: 0; max-height: none; overflow: visible;
  }
  .modal-body { max-height: none !important; overflow: visible !important; }
  .scorecard-table { width: 100%; font-size: 10pt; }
  .scorecard-table th, .scorecard-table td { border: 1px solid #ccc !important; padding: 4px 6px; }
  .detail-meta { margin-bottom: 12px; }
}

/* ─── Handicap Exclude Toggle ────────────────────────────────── */
.scorecard-row.hcp-excluded .scorecard-row-header {
  opacity: 0.65;
}
.scorecard-row.hcp-excluded .sc-course {
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}
.sc-excluded-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-secondary, #f0f0f0);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}
.btn-hcp-toggle {
  opacity: 0.6;
  transition: opacity 0.15s;
}
.btn-hcp-toggle:hover {
  opacity: 1;
}
.btn-hcp-toggle.excluded {
  opacity: 0.5;
  color: var(--text-muted);
}

/* ─── Team Mobile Entry Panel ───────────────────────────────── */

/* Always hidden; shown only on mobile in team mode */
.team-mobile-panel { display: none; padding: 8px 0 4px; }

@media (max-width: 768px) {
  /* In team mode: hide the horizontal table, show the mobile panel */
  #scorecardEntryCard.team-mode-active .scorecard-scroll-wrap { display: none; }
  #scorecardEntryCard.team-mode-active .shot-details-toggle-wrap { display: none; }
  #scorecardEntryCard.team-mode-active .shot-details-legend { display: none; }
  #scorecardEntryCard.team-mode-active .team-mobile-panel   { display: block; }
}

/* Per-hole card */
.mob-hole-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}
.mob-hole-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
}
[data-theme="dark"] .mob-hole-header { background: var(--gray-800, #1e2330); }
.mob-hole-num {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 52px;
}
.mob-hole-detail { font-size: 0.82rem; color: var(--text-muted); }

/* Player rows inside a hole card */
.mob-hole-players { display: flex; flex-direction: column; }
.mob-player-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
}
.mob-player-row:last-child { border-bottom: none; }
.mob-player-you {
  background: var(--green-50, #f0fdf4);
}
[data-theme="dark"] .mob-player-you { background: rgba(82,183,120,0.07); }
.mob-player-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Score inputs in mobile panel */
.team-mob-marker-score,
.team-mob-score {
  width: 58px;
  height: 40px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 4px 6px;
  -moz-appearance: textfield;
}
.team-mob-marker-score::-webkit-inner-spin-button,
.team-mob-score::-webkit-inner-spin-button { display: none; }
.team-mob-marker-score:focus,
.team-mob-score:focus {
  outline: none;
  border-color: var(--green-500, #4ade80);
  box-shadow: 0 0 0 3px rgba(82,183,120,0.18);
}

/* Pts display in mobile panel */
.team-mob-pts {
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 28px;
  text-align: right;
  color: var(--text-muted);
}

/* OUT / IN / TOTAL subtotal cards */
.mob-subtotal-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--gray-50);
}
[data-theme="dark"] .mob-subtotal-card { background: var(--gray-800, #1e2330); }
.mob-subtotal-label {
  display: block;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--gray-100);
  border-bottom: 1px solid var(--border-color);
}
[data-theme="dark"] .mob-subtotal-label { background: rgba(255,255,255,0.04); }
.mob-subtotal-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}
.mob-subtotal-row:last-child { border-bottom: none; }
.mob-subtotal-row span:nth-child(2) { color: var(--text-muted); font-weight: 500; min-width: 24px; text-align: right; }
.mob-subtotal-row span:nth-child(3) { font-weight: 700; min-width: 48px; text-align: right; }
.mob-subtotal-you { font-weight: 600; color: var(--green-700); }
[data-theme="dark"] .mob-subtotal-you { color: var(--green-400); }
.mob-total-card { background: var(--bg-primary); }
.mob-total-card .mob-subtotal-label { background: var(--green-100); color: var(--green-800); }
[data-theme="dark"] .mob-total-card .mob-subtotal-label { background: rgba(82,183,120,0.15); color: var(--green-400); }

/* ─── Team Scoring ───────────────────────────────────────────── */

/* Team Round toggle row (between Round Details and Scorecard Entry) */
.team-mode-toggle-wrap {
  display: flex;
  align-items: center;
  padding: 8px 0 4px;
}
.team-mode-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
  user-select: none;
}
[data-theme="dark"] .team-mode-label { color: var(--gray-300); }
.team-mode-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--green-600);
  cursor: pointer;
  flex-shrink: 0;
}
.team-mode-icon {
  width: 18px;
  height: 18px;
  color: var(--green-600);
  flex-shrink: 0;
}

/* Team Players setup card */
.team-primary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.team-primary-ph { font-size: 0.85rem; color: var(--text-muted); }
.team-player-label { font-weight: 600; font-size: 0.85rem; min-width: 68px; flex-shrink: 0; color: var(--gray-600); }
[data-theme="dark"] .team-player-label { color: var(--gray-400); }
.team-player-you { color: var(--green-700); }
[data-theme="dark"] .team-player-you { color: var(--green-400); }

.team-player-row {
  display: grid;
  grid-template-columns: 70px 1fr 100px 32px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.team-player-field {
  margin-bottom: 0 !important;
}
.team-player-field input {
  width: 100%;
  height: 32px;
  padding: 4px 8px;
  font-size: 0.85rem;
}
@media (max-width: 480px) {
  .team-player-row {
    grid-template-columns: 60px 1fr 80px 28px;
  }
}

/* Team columns in scorecard table */
.team-col {
  background: var(--green-50, #f0fdf4);
  color: var(--gray-700);
  white-space: nowrap;
}
[data-theme="dark"] .team-col {
  background: rgba(82,183,120,0.07);
  color: var(--gray-300);
}
.team-col .team-score-input {
  width: 52px;
}
.team-ph-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Team badge (on scorecard list and detail) */
.team-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--green-100);
  color: var(--green-700);
  margin-left: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
[data-theme="dark"] .team-badge { background: rgba(82,183,120,0.18); color: var(--green-400); }

/* Team detail in scorecard history */
.team-detail {
  margin: 12px 0 4px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.team-detail-title {
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--green-50, #f0fdf4);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}
[data-theme="dark"] .team-detail-title { background: rgba(82,183,120,0.07); }
.team-detail .scorecard-scroll-wrap { margin: 0; border-radius: 0; }
.team-col-header {
  background: rgba(34, 197, 94, 0.08);
  border-left: 2px solid rgba(34, 197, 94, 0.3);
}
.team-col-header:first-of-type { border-left: 2px solid rgba(34, 197, 94, 0.3); }
[data-theme="dark"] .team-col-header { background: rgba(82,183,120,0.1); }

/* Team aggregate column — inherits dark green from scorecard-table th */
.team-agg-col {
  border-left: 3px solid rgba(255,255,255,0.3) !important;
  white-space: nowrap;
}
.team-agg-pts {
  background: rgba(234,179,8,0.07);
  border-left: 2px solid rgba(234,179,8,0.25);
  font-weight: 600;
  text-align: center;
}
[data-theme="dark"] .team-agg-pts { background: rgba(234,179,8,0.10); }
.team-agg-total { font-size: 1.05em; }
.team-detail-meta {
  margin-left: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
}
.team-event-label {
  display: inline-block;
  background: rgba(99,102,241,0.12);
  color: var(--indigo-600, #4f46e5);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.78rem;
  font-weight: 600;
}
[data-theme="dark"] .team-event-label { background: rgba(129,140,248,0.18); color: #a5b4fc; }

/* Team name + event badges in scorecard list */
.team-name-badge {
  display: inline-block;
  background: rgba(34,197,94,0.12);
  color: var(--green-700);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}
[data-theme="dark"] .team-name-badge { background: rgba(82,183,120,0.18); color: var(--green-400); }
.event-name-badge {
  display: inline-block;
  background: rgba(99,102,241,0.10);
  color: var(--indigo-600, #4f46e5);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}
[data-theme="dark"] .event-name-badge { background: rgba(129,140,248,0.18); color: #a5b4fc; }

/* ── Competition leaderboard ───────────────────────────────── */
.competition-table { width: 100%; }
.competition-rank {
  width: 36px;
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
}
.competition-team-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.competition-players {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.competition-winner-row td { background: rgba(234,179,8,0.07); }
[data-theme="dark"] .competition-winner-row td { background: rgba(234,179,8,0.10); }
.competition-winner-cell {
  background: rgba(234,179,8,0.15) !important;
  font-weight: 700;
  color: var(--yellow-700, #a16207);
}
[data-theme="dark"] .competition-winner-cell {
  background: rgba(234,179,8,0.20) !important;
  color: #fde68a;
}
.competition-footnote {
  font-size: 0.75rem;
  color: var(--gray-400);
  padding: 8px 16px 12px;
}

/* Sortable column headers (admin data review) */
.sortable-header { cursor: pointer; user-select: none; }
.sortable-header:hover { background: rgba(34,197,94,0.08); }
.sort-arrow { display: inline-block; margin-left: 4px; font-size: 0.85em; opacity: 0.4; }
.sort-arrow.active { opacity: 1; color: var(--brand, #16a34a); }
[data-theme="dark"] .sortable-header:hover { background: rgba(82,183,120,0.12); }

/* Back bar — appears on drill-down views (above the page title) */
.back-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.back-bar:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.6);
}
.back-bar > span[aria-hidden] { font-size: 1.1rem; line-height: 1; margin-top: -1px; }
.back-bar[hidden] { display: none; }
@media (max-width: 600px) {
  .back-bar { font-size: 0.85rem; padding: 4px 10px 4px 8px; }
}
