/* ---------------------------------------------------------------
   Touch beats width.

   Every mobile rule below also fires on `pointer: coarse`, and every
   desktop-only rule additionally requires `pointer: fine`. Width was
   only ever a proxy for "mouse or thumb"; when a phone's browser
   reports a 900px layout viewport -- a per-site zoom, a vendor browser
   mode, anything -- the proxy is wrong and the golfer gets 10px type
   and sixteen hole chips across the strip.

   Consequence, accepted deliberately: a tablet in landscape gets the
   touch layout. For an app used one-handed on a tee box that is right.
   --------------------------------------------------------------- */
/* ---- Sabio Golf palette, taken from the badge ----
   Every brand colour goes through a variable so a club can override the lot.
   Club portals set --cg-primary etc. from their own branding, which is how
   Safari DC keeps its green while the platform is navy and gold. */
:root {
  --cg-primary:      #162b42;   /* badge navy */
  --cg-primary-dark: #0e1c2c;
  --cg-primary-soft: #eef1f6;
  /* the rest of the club colour's shades -- Sabio navy until a club's
     colour arrives; ui.js cgBrandVars() recomputes all of them from it */
  --cg-primary-solid: #162b42;
  --cg-primary-tint: #dadde1;
  --cg-primary-line: #a6aeb7;
  --cg-primary-ink:  #162b42;
  --cg-primary-night: #0a1320;
  --cg-primary-deep: #0f1e2e;
  --cg-on-primary:   #ffffff;
  --cg-accent:       #bca876;   /* badge gold */
  --cg-accent-deep:  #8a7440;
  --cg-success:      #166534;
  --cg-warn:         #b8860b;
}

        * { box-sizing: border-box; }
        body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 1200px; margin: 0 auto; padding: 0.5rem; background: var(--cg-bg); }
        /* `clip`, NOT `hidden`. overflow-x:hidden forces overflow-y to
           compute to `auto`, which makes BODY a scrolling container -- and
           a sticky element sticks to its nearest scrolling ancestor, so the
           top bar stuck to the body box and slid away with the page
           (measured: top 0 -> -318px after a 900px scroll). `clip` clips
           identically without creating a scroll container. .site-topbar
           always said position:sticky; this rule was overruling it from
           five hundred lines away. */
        html, body { max-width: 100%; overflow-x: clip; }
        .container { background: var(--cg-surface); padding: 0.85rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); max-width: 100%; box-sizing: border-box; }
        h1 { color: var(--cg-primary); margin-bottom: 0.1rem; font-size: 1.35rem; }
        .subtitle { color: var(--cg-text-muted); margin-bottom: 0.5rem; font-size: 0.85rem; }
        .form-section { background: var(--cg-surface-2); padding: 0.85rem; border-radius: 6px; margin-bottom: 0.75rem; }
        .section-header { display: flex; justify-content: space-between; align-items: center; background: var(--cg-primary); color: white; padding: 0.45rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; cursor: pointer; user-select: none; }
        .section-header h2 { margin: 0; font-size: 0.95rem; color: white; }
        .section-header .toggle-icon { font-size: 1rem; font-weight: 700; }
        .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.6rem; }
        .form-group { display: flex; flex-direction: column; }
        label { margin-bottom: 0.3rem; font-weight: 500; font-size: 0.8rem; }
        .required { color: #dc3545; }
        input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="datetime-local"] { padding: 0.4rem; border: 1px solid var(--cg-border); border-radius: 4px; font-size: 0.85rem; }
        .event-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.6rem; }
        .event-card { background: var(--cg-surface); padding: 0.6rem; border-radius: 6px; border: 2px solid var(--cg-border); }
        .event-card h3 { margin: 0 0 0.35rem; color: var(--cg-primary); font-size: 0.9rem; }
        .event-subtitle { color: var(--cg-text-muted); font-size: 0.8rem; margin-bottom: 0.6rem; }
        .price-note { color: var(--cg-primary); font-weight: 600; font-size: 0.8rem; margin-bottom: 0.6rem; }
        .checkbox-group { display: flex; flex-direction: column; gap: 0.45rem; }
        .checkbox-label { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; border: 2px solid #dee2e6; border-radius: 5px; cursor: pointer; transition: all 0.2s; }
        .checkbox-label:hover { border-color: var(--cg-primary); background: #f0fff4; }
        .checkbox-label input:checked + span { color: var(--cg-primary); font-weight: 600; }
        .checkbox-label input { width: 1.1rem; height: 1.1rem; accent-color: var(--cg-primary); }
        .skin-type { display: flex; align-items: center; gap: 0.4rem; }
        .skin-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
        .skin-badge.gross { background: var(--cg-primary-soft); color: var(--cg-primary); }
        .skin-badge.net { background: #e3f2fd; color: #1565c0; }
        .skin-badge.kitty { background: #fff3e0; color: #e65100; }
        .skin-price { color: var(--cg-text-muted); font-size: 0.75rem; }
        .total-price { font-weight: 700; color: var(--cg-primary); font-size: 0.9rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--cg-border); }
        .btn { width: auto; padding: 0.45rem 1.1rem; background: var(--cg-primary); color: white; border: none; border-radius: 8px; font-size: 0.82rem; font-weight: 700; cursor: pointer; margin-top: 0.4rem; display: inline-flex; align-items: center; gap: 0.35rem; }
        .btn.btn-full, .btn[style*="width:100%"], .btn[style*="width: 100%"] { width: 100%; justify-content: center; }
        .btn:hover { filter: brightness(1.08); }
        .btn:disabled { background: #94a3a8; cursor: not-allowed; filter: none; }
        .btn-sm { padding: 0.3rem 0.7rem; font-size: 0.72rem; border-radius: 6px; }
        .btn-secondary { background: #6c757d; margin-top: 0.3rem; }
        .btn-secondary:hover { background: #5a6268; }
        .btn-secondary { background: #6c757d; margin-top: 0.3rem; }
        .btn-secondary:hover { background: #5a6268; }
        .btn-success { background: #28a745; }
        .btn-success:hover { background: #218838; }
        
        /* Table styles */
        .table-container { overflow-x: auto; margin-top: 0; }
        .mobile-cards { display: none; }

        /* ---- player cards (Who's In) ---- */
        .pcard-games { margin-top:0.55rem; display:grid; gap:0.3rem; }
        .pcard-game { display:grid; grid-template-columns:auto 1fr auto auto; align-items:center; gap:0.5rem;
                      border:1px solid #e6ece7; border-radius:9px; padding:0.4rem 0.6rem; font-family:inherit;
                      background:#fbfefc; cursor:pointer; text-align:left; width:100%; }
        .pcard-game.static { cursor:default; }
        .pcard-game.on { background:#f0fdf4; border-color:var(--cg-green-border); }
        .pcard-gd { display:inline-flex; align-items:center; justify-content:center; min-width:1.5rem; height:1.35rem;
                    border-radius:6px; background:#495057; color:#fff; font-size:0.6rem; font-weight:800; }
        .pcard-gn { font-size:0.75rem; font-weight:700; color:#1f2a22; }
        .pcard-gp { font-size:0.72rem; font-weight:800; color:#3f5145; }
        .pcard-gs { font-size:0.62rem; font-weight:800; color:#c5221f; }
        .pcard-game.on .pcard-gs { color:var(--cg-primary); }
        .pcard-none { font-size:0.7rem; color:var(--cg-text-muted); padding:0.3rem 0; }
        .pcard-foot { display:flex; align-items:center; justify-content:space-between; gap:0.5rem; flex-wrap:wrap;
                      margin-top:0.55rem; padding-top:0.45rem; border-top:1px dashed #e9eee9; }
        .pcard-total { display:flex; flex-direction:column; line-height:1.15; }
        .pcard-total span { font-size:0.58rem; font-weight:700; color:var(--cg-text-muted); }
        .pcard-total b { font-size:1.05rem; }
        .pcard-admin { display:flex; align-items:center; gap:0.3rem; flex-wrap:wrap; }

        /* signup page ("The Field"): the card grid renders its own columns —
           don't force the container into a second grid that squeezes it to one */
        body[data-page="home"] .desktop-table { display: none; }
        body[data-page="home"] .mobile-cards { display: block; }

        /* The Field player-card grid: 2-up on phones, capped at 6 per row on
           wide screens so the cards never get cramped */
        .su-field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 0.55rem; }
        @media (min-width: 640px) and (pointer: fine)  { .su-field-grid { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); } }
        @media (min-width: 1100px) and (pointer: fine) { .su-field-grid { grid-template-columns: repeat(5, 1fr); } }
        table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.72rem; }
        th, td { padding: 0.42rem 0.5rem; text-align: left; border-bottom: 1px solid #edf1ed; }
        th { background: #eef2ee; font-weight: 700; color: #4a554c; font-size: 0.6rem;
             text-transform: uppercase; letter-spacing: 0.05em;
             border-bottom: 2px solid #d7e0d8; white-space: nowrap; }
        /* the signups workhorse gets the full treatment: dark sticky header */
        #tableContainer th { background: var(--cg-primary); color: #fff; position: sticky; top: 0; z-index: 5;
             border-bottom: none; }
        td { color: #2a332c; font-variant-numeric: tabular-nums; }
        td:last-child, th:last-child { border-right: none; }
        tbody tr:hover { background: #f2f8f3; }
        tbody tr { transition: background .08s ease; }
        /* Zebra striping for readability */
        tbody tr:nth-child(even) { background: #f9fbf9; }
        tbody tr:nth-child(even):hover { background: var(--cg-primary-soft); }
        tfoot td { font-weight: 700; background: var(--cg-primary-soft); border-top: 2px solid var(--cg-primary); }
        /* Amount column alignment */
        .amount-cell { text-align: center; }
        th.num-col, td.num-col { width: 0.5rem; text-align: center; white-space: nowrap; }
        th.name-col, td.name-col { width: 9rem; }
        /* Freeze Name column (signups table only) */
        #tableContainer table { position: relative; }
        #tableContainer td:nth-child(1), #tableContainer th:nth-child(1) {
            position: sticky;
            left: 0;
            z-index: 1;
            min-width: 120px;
        }
        #tableContainer th:nth-child(1) { background: var(--cg-primary); z-index: 2; }
        #tableContainer tbody td:nth-child(1) { background: var(--cg-surface); }
        #tableContainer tbody tr:nth-child(even) td:nth-child(1) { background: var(--cg-surface-2); }
        #tableContainer tbody tr:hover td:nth-child(1) { background: var(--cg-surface-2); }
        #tableContainer tfoot td:nth-child(1) { position: sticky; left: 0; z-index: 1; }
        #tableContainer tfoot tr:nth-child(1) td:nth-child(1) { background: var(--cg-primary-soft); }
        #tableContainer tfoot tr:nth-child(2) td:nth-child(1) { background: #d4edda; }
        /* Tables live in rounded cards with their section */
.afc .table-container { border-radius: 10px; border: 1px solid #e3e9e4; background: var(--cg-surface); }
.afc .table-container table { border-radius: 10px; overflow: hidden; }

/* Tight hole columns (1-18) in the payouts score-entry grid */
        #scoreGrid th, #scoreGrid td { padding: 0.1rem; text-align: center; white-space: nowrap; }
        #scoreGrid th.sg-name, #scoreGrid td.sg-name { text-align: left; padding: 2px 4px; }
        /* classic scorecard marks: circles under par, squares over par.
           Fill-based so marks never expand beyond a single ring — dense grids stay legible. */
        .tie-list { cursor: pointer; text-decoration: underline dotted #999; }
        .sc-circle, .sc-sq { display:inline-block; min-width:0.86rem; height:0.86rem; line-height:0.84rem; text-align:center; font-size:0.72rem; font-weight:700; padding:0 0.04rem; }
        .sc-circle { border:1px solid var(--cg-primary); border-radius:50%; color:var(--cg-primary); }
        .sc-circle2 { border:1px solid var(--cg-primary); border-radius:50%; color:var(--cg-primary); box-shadow:0 0 0 1px #fff, 0 0 0 2px var(--cg-primary); }
        .sc-circle3 { border:1px solid var(--cg-primary); border-radius:50%; color:var(--cg-primary); box-shadow:0 0 0 1px #fff, 0 0 0 2px var(--cg-primary), 0 0 0 3px #fff, 0 0 0 4px var(--cg-primary); }
        .sc-sq { border:1px solid #c0392b; border-radius:2px; color:#c0392b; }
        .sc-sq2 { border:1px solid #c0392b; border-radius:2px; color:#7c1f14; box-shadow:0 0 0 1px #fff, 0 0 0 2px #c0392b; }
        .sc-sq3 { border:1px solid #c0392b; border-radius:2px; color:#7c1f14; box-shadow:0 0 0 1px #fff, 0 0 0 2px #c0392b, 0 0 0 3px #fff, 0 0 0 4px #c0392b; }
        #scoreGrid td input[type="number"]:not(.chcp-input) {
            width: 1.3rem !important; padding: 1px; font-size: 0.65rem; text-align: center;
            -moz-appearance: textfield; appearance: textfield;
        }
        #scoreGrid td input[type="number"]::-webkit-outer-spin-button,
        #scoreGrid td input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
        /* hole columns (Start, holes 1-18 + F9/B9, through Tot) shrink to uniform
           width; handicap dots are absolutely-positioned overlays that never
           stretch a column */
        #scoreGrid th:nth-child(n+5):nth-child(-n+26) { width: 1%; }
        #scoreGrid td.sg-hole { position: relative; }

        /* Freeze Player column (payouts score-entry grid) */
        #scoreGrid th.sg-name, #scoreGrid td.sg-name {
            position: sticky;
            left: 0;
            z-index: 3;
            background: var(--cg-surface-2);
            box-shadow: 1px 0 0 #c8d3cc;
        }
        #scoreGrid tbody td.sg-name { background: var(--cg-surface); }
        #scoreGrid tbody tr:nth-child(even) td.sg-name { background: var(--cg-surface-2); }
        #scoreGrid tbody tr:hover td.sg-name { background: var(--cg-surface-2); }
        /* Freeze Player column (public live scorecards) */
        .ls-cards th.sg-name, .ls-cards td.sg-name {
            position: sticky;
            left: 0;
            z-index: 3;
            background: var(--cg-surface-2);
            box-shadow: 1px 0 0 #c8d3cc;
        }
        .ls-cards tbody td.sg-name { background: var(--cg-surface); }
        .ls-cards tbody tr:hover td.sg-name { background: var(--cg-surface-2); }
        @media (max-width: 768px), (pointer: coarse) {
            /* Keep the sticky name column from swallowing the screen on phones:
               wrap (name / [bets] / give-max on their own lines) instead of clipping */
            #scoreGrid th.sg-name, #scoreGrid td.sg-name,
            .ls-cards th.sg-name, .ls-cards td.sg-name { max-width: 40vw; }
            #scoreGrid td.sg-name, .ls-cards td.sg-name {
                overflow-x: visible; text-overflow: clip;
                white-space: normal !important; word-break: break-word;
            }
            #scoreGrid td.sg-name .btn-sm, .ls-cards td.sg-name .btn-sm { white-space: nowrap; }
            /* Stack tournament/day selectors (inline grid-template-columns overrides the global mobile rule) */
            #payoutsSection .form-row { grid-template-columns: 1fr !important; }

            /* Score-entry grid: use (nearly) the full screen width — cancel the
               container/panel/form padding around the scroll box */
            #scoreGridWrap { margin-left: -1.6rem; margin-right: -1.6rem; }
            /* Slim the fixed columns so hole columns actually fit */
            #scoreGrid th.sg-name, #scoreGrid td.sg-name { max-width: 34vw; font-size: 0.58rem; }
            #scoreGrid td input[type="number"]:not(.chcp-input) { width: 1.7rem !important; font-size: 0.58rem; }
            #scoreGrid td .chcp-input { width: 2rem !important; font-size: 0.55rem; }
            #scoreGrid td .tee-pick { width: 2.8rem !important; font-size: 0.52rem; }
            #scoreGrid th:nth-child(n+5):nth-child(-n+22) { width: auto; }
        }
        /* Contact columns (Email, Phone) toggled via contactVisible */
        .hide-contact td:nth-child(3), .hide-contact th:nth-child(3),
        .hide-contact td:nth-child(4), .hide-contact th:nth-child(4) { display: none; }
        #tableContainer td:nth-child(3), #tableContainer th:nth-child(3) { white-space: nowrap; min-width: 130px; }
        .sort-th { cursor: pointer; user-select: none; }
        .sort-th:hover { background: #e9ecef; }
        .sort-arrow { font-size: 0.6rem; margin-left: 0.2rem; }
        .badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 9999px; font-size: 0.6rem; font-weight: 500; }
        .badge-gross { background: var(--cg-primary-soft); color: var(--cg-primary); }
        .badge-net { background: #e3f2fd; color: #1565c0; }
        .badge-kitty { background: #fff3e0; color: #e65100; }
        .badge-paid { background: #d4edda; color: #155724; }
        .badge-unpaid { background: #f8d7da; color: #721c24; }
        .actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
        .btn-sm { padding: 0.2rem 0.45rem; font-size: 0.65rem; }
        .btn-danger { background: #dc3545; }
        .btn-danger:hover { background: #c82333; }
        .btn-warning { background: #ffc107; color: var(--cg-text); }
        .loading { text-align: center; padding: 1rem; color: var(--cg-text-muted); font-size: 0.8rem; }
        .error { color: #dc3545; text-align: center; padding: 0.5rem; font-size: 0.8rem; }
        .success { color: var(--cg-primary); text-align: center; padding: 0.5rem; font-size: 0.8rem; }
        .x-mark { color: var(--cg-primary); font-weight: bold; text-align: center; }
        
        /* Modal styles */
        .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
        .modal { background: var(--cg-surface); border-radius: 8px; padding: 1rem; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
        .modal h3 { margin: 0 0 0.6rem; color: var(--cg-primary); font-size: 1rem; }
        .modal .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.5rem; }
        .modal .form-group { display: flex; flex-direction: column; }
        .modal label { margin-bottom: 0.2rem; font-weight: 500; font-size: 0.75rem; }
        .modal input[type="text"] { padding: 0.35rem; border: 1px solid var(--cg-border); border-radius: 4px; font-size: 0.8rem; }
        .modal .checkbox-group { display: flex; flex-wrap: wrap; gap: 0.35rem; }
        .modal .checkbox-label { display: flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.5rem; border: 2px solid #dee2e6; border-radius: 4px; cursor: pointer; font-size: 0.75rem; }
        .modal .checkbox-label:hover { border-color: var(--cg-primary); background: #f0fff4; }
        .modal .checkbox-label input { width: 0.9rem; height: 0.9rem; accent-color: var(--cg-primary); }
        .modal .skin-badge { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.6rem; font-weight: 600; }
        .modal .skin-badge.gross { background: var(--cg-primary-soft); color: var(--cg-primary); }
        .modal .skin-badge.net { background: #e3f2fd; color: #1565c0; }
        .modal .skin-badge.kitty { background: #fff3e0; color: #e65100; }
        .modal .skin-price { color: var(--cg-text-muted); font-size: 0.65rem; }
        .modal-actions { display: flex; gap: 0.4rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--cg-border); }
        .modal-actions .btn { flex: 1; }
        .amount-cell { text-align: center; font-weight: 500; color: var(--cg-primary); }
        
        /* Mobile responsive */
        @media (max-width: 768px), (pointer: coarse) {
            body { padding: 0.35rem; max-width: 100%; }
            .container { padding: 0.6rem; }
            h1 { font-size: 1.15rem; }
            .subtitle { font-size: 0.75rem; margin-bottom: 0.5rem; }
            .form-section { padding: 0.6rem; margin-bottom: 0.5rem; }
            .form-row { grid-template-columns: 1fr; gap: 0.4rem; }
            .event-cards { grid-template-columns: 1fr; gap: 0.4rem; margin-bottom: 0.4rem; }
            .event-card { padding: 0.5rem; }
            .event-card h3 { font-size: 0.85rem; }
            .checkbox-label { padding: 0.45rem; }
            .skin-badge { font-size: 0.65rem; }
            .skin-price { font-size: 0.7rem; }
            .total-price { font-size: 0.85rem; }
            .btn { padding: 0.5rem; font-size: 0.85rem; }
            
            /* Hide table on mobile, show cards instead */
            .desktop-table { display: none !important; }
            .mobile-cards { display: block !important; }
            
            /* Signup cards */
            
            /* Totals cards */
            .totals-card { border-radius: 8px; padding: 0.5rem; margin-bottom: 0.35rem; font-size: 0.7rem; }
            .totals-card.all { background: var(--cg-surface-2); border: 1px solid #e9ecef; }
            .totals-card.paid { background: #d4edda; border: 1px solid #c3e6cb; }
            .totals-card-title { font-weight: 700; margin-bottom: 0.25rem; }
            .totals-card-row { display: flex; justify-content: space-between; padding: 0.1rem 0; }
            .totals-card-row span:last-child { font-weight: 600; }
            
            /* Modal: full width on mobile */
            .modal { width: 95%; padding: 0.75rem; max-height: 85vh; }
            .modal .form-row { grid-template-columns: 1fr; gap: 0.35rem; }
            
            /* Admin panel buttons stack */
            #adminPanel { flex-direction: column; gap: 0.5rem; }
            #adminPanel .btn { margin-left: 0; }
        }
        
        @media (max-width: 480px), (pointer: coarse) {
            h1 { font-size: 1rem; }
            .container { padding: 0.5rem; border-radius: 6px; }
            .checkbox-label { padding: 0.4rem; font-size: 0.8rem; }
            .checkbox-label input { width: 0.95rem; height: 0.95rem; }
            .badge { font-size: 0.55rem; padding: 0.1rem 0.4rem; }
        }

        /* Admin toolbar inside All Signups header */
        .signups-header { display: flex; justify-content: space-between; align-items: center; background: var(--cg-primary); color: white; padding: 0.5rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; position: relative; }
        .signups-header h2 { margin: 0; font-size: 1rem; color: white; }
        .site-topbar { position: sticky; top: 0; z-index: 900; background: var(--cg-primary); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.4rem 0.9rem; margin-top: -0.5rem; margin-bottom: 0.7rem; margin-left: calc(-1 * min(0.5rem, 0.5vw)); margin-right: calc(-1 * min(0.5rem, 0.5vw)); width: auto; max-width: calc(100vw - 2 * (env(safe-area-inset-left, 0px))); box-sizing: border-box; box-shadow: 0 1px 5px rgba(0,0,0,0.18); }
        .site-topbar .topbar-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.9rem; color: inherit; text-decoration: none; }
        .site-topbar .topbar-brand img { width: 26px; height: auto; border-radius: 5px; }
        .topbar-admin { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.35rem; row-gap: 0.3rem; }
        @media (max-width: 480px), (pointer: coarse) {
            /* brand left, hamburger (+ Admin on /admin) pinned top-right */
            .site-topbar { flex-wrap: nowrap; }
            .topbar-admin { justify-content: flex-end; width: auto; flex-wrap: nowrap; }
            .topbar-admin .admin-toolbar-btn { padding: 0.25rem 0.5rem; font-size: 0.68rem; }
            .topbar-brand span { font-size: 0.8rem; }
        }
        .admin-toolbar-btn { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.3); padding: 0.3rem 0.7rem; border-radius: 5px; cursor: pointer; font-size: 0.75rem; font-weight: 600; transition: background 0.2s; white-space: nowrap; }
        .admin-toolbar-btn:hover { background: rgba(255,255,255,0.35); }
        .admin-toolbar-panel { position: absolute; top: 100%; right: 0; margin-top: 0.4rem; background: var(--cg-surface); color: var(--cg-text); box-shadow: 0 6px 28px rgba(0,0,0,0.28); padding: 1.25rem; width: min(96vw, 1100px); max-width: calc(100vw - 1.5rem); border: 1px solid var(--cg-border); z-index: 950; overflow-y: auto; overflow-x: auto; max-height: 85vh; border-radius: 8px; box-sizing: border-box; }
        .admin-toolbar-panel .form-row { grid-template-columns: 1fr 1fr; gap: 0.65rem 0.9rem; margin-bottom: 0.65rem; }
        .admin-toolbar-panel h3 { color: var(--cg-text); }
        .admin-toolbar-panel label { color: var(--cg-text); font-size: 0.75rem; margin-bottom: 0.2rem; }
        .admin-panel-layout { display: grid; grid-template-columns: 118px 1fr; gap: 0.9rem; align-items: start; }
        .admin-toolbar-actions { display: flex; flex-direction: column; gap: 0.3rem; border-right: 1px solid #ececec; padding-right: 0.65rem; position: sticky; top: 8px; align-self: start; }
        .admin-toolbar-actions .btn.active-tab { box-shadow: 0 0 0 3px var(--cg-primary) inset; font-weight: 700; }
        .admin-toolbar-actions .btn { padding: 0.4rem 0.8rem; font-size: 0.68rem; width: auto; }
        #exportScope { width: 100%; max-width: none !important; font-size: 0.68rem; padding: 0.3rem 0.25rem; }
        .admin-panel-content { min-width: 0; }
        .course-detail-closed { display: none; }
        .settings-field-group { margin-bottom: 0.5rem; }
        .settings-field-group label { display: block; font-weight: 600; font-size: 0.7rem; color: var(--cg-text); margin-bottom: 0.2rem; }
        .filter-btn.active { background: rgba(255,255,255,0.45); border-color: rgba(255,255,255,0.6); }
        @media (max-width: 768px), (pointer: coarse) {
            .signups-header { padding: 0.45rem 0.6rem; }
            .signups-header h2 { font-size: 0.9rem; }
            .admin-toolbar-btn { padding: 0.25rem 0.55rem; font-size: 0.7rem; }
            .admin-toolbar-panel { min-width: auto; max-width: calc(100vw - 0.75rem) !important; right: 0; left: auto; width: fit-content; min-width: min(300px, calc(100vw - 0.75rem)); padding: 0.75rem; box-sizing: border-box; }
            .admin-toolbar-panel .form-row { grid-template-columns: 1fr; gap: 0.35rem; }
            .admin-panel-layout { grid-template-columns: 1fr; }
            .admin-toolbar-actions { flex-direction: row; flex-wrap: wrap; border-right: none; padding-right: 0; top: 0; background: var(--cg-surface); z-index: 60; padding: 0.35rem; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
            .admin-toolbar-actions .btn { width: auto; }
        }
        @media (max-width: 480px), (pointer: coarse) {
            .signups-header { flex-direction: column; gap: 0.35rem; align-items: stretch; }
            .signups-header h2 { text-align: center; }
            .admin-toolbar-btn { width: auto; text-align: center; }
            .admin-toolbar-panel { right: 0; left: auto; min-width: auto; max-width: calc(100vw - 0.75rem) !important; width: fit-content; min-width: min(300px, calc(100vw - 0.75rem)); }
        }
     
/* Keep wide admin tables (score grid, previews) inside the panel */
.admin-toolbar-panel table { max-width: 100%; }
.admin-toolbar-panel .table-container { max-width: 100%; overflow-x: auto; }

/* Panels and their children never exceed the viewport */
.admin-toolbar-panel, .admin-toolbar-panel * { max-width: 100%; }
.admin-toolbar-panel input, .admin-toolbar-panel select { box-sizing: border-box; }

.nav-links { display: flex; gap: 0.35rem; align-items: center; }
/* Hamburger menu (mobile) */
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 4px; width: 38px; height: 34px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.35); border-radius: 6px; cursor: pointer; padding: 6px 8px; }
.hamburger span { display: block; height: 2px; width: 100%; background: var(--cg-surface); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.site-topbar.open .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-topbar.open .hamburger span:nth-child(2) { opacity: 0; }
.site-topbar.open .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 768px), (pointer: coarse) {
    .hamburger { display: flex; }
    .nav-links { display: none; position: absolute; top: calc(100% + 0.4rem); right: 0.5rem; min-width: 10.5rem; background: var(--cg-primary); flex-direction: column; align-items: stretch; padding: 0.4rem; z-index: 940; gap: 0.25rem; border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,0.3); }
    .site-topbar.open .nav-links { display: flex; }
    .nav-links .admin-toolbar-btn { width: 100%; text-align: left; border-radius: 6px; padding: 0.45rem 0.7rem; }
}

/* Admin panel hamburger (mobile) */
.admin-menu-toggle { display: none; flex-direction: column; justify-content: center; gap: 3px; width: 36px; height: 34px; background: var(--cg-primary); color: #fff; border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; cursor: pointer; margin-bottom: 0.5rem; padding: 7px 8px; }
.admin-menu-toggle span { display: block; width: 100%; height: 2px; background: var(--cg-surface); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.admin-menu-toggle.open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.admin-menu-toggle.open span:nth-child(2) { opacity: 0; }
.admin-menu-toggle.open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
@media (max-width: 768px), (pointer: coarse) {
    .admin-menu-toggle { display: flex; }
    #adminPanel { align-items: flex-end; }
    .admin-panel-layout .admin-toolbar-actions { display: none; }
    .admin-panel-layout.menu-open .admin-toolbar-actions { display: flex; flex-direction: column; align-items: flex-end; border-right: none; position: static; box-shadow: none; background: transparent; padding: 0 0 0.5rem 0; }
    .admin-panel-layout.menu-open .admin-toolbar-actions .btn { width: fit-content; min-width: 8.5rem; text-align: left; }
}

/* Mobile: the admin MENU itself is a dark-green card (like the site menus);
   the panel behind forms stays white and readable */
@media (max-width: 768px), (pointer: coarse) {
    .admin-menu-toggle { background: var(--cg-primary); border-color: rgba(255,255,255,0.3); }
    .admin-panel-layout.menu-open .admin-toolbar-actions {
        background: var(--cg-primary); border-radius: 10px; padding: 0.4rem;
        box-shadow: 0 10px 28px rgba(0,0,0,0.25); margin-bottom: 0.5rem;
    }
    .admin-panel-layout.menu-open .admin-toolbar-actions .btn {
        background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.35);
    }
}

/* ============================================================
   MOBILE ADMIN = PLAIN PAGE (no dropdowns, no nested menus).
   Login form / tabs / sections all render in normal page flow.
   (Desktop keeps the classic dropdown + sidebar layout.)
   ============================================================ */
@media (max-width: 768px), (pointer: coarse) {
    .admin-toolbar-panel {
        position: static !important;
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0.75rem 0 0 0 !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: inherit !important;
    }
    /* the header Admin button is pointless now — the content is right below */
    .topbar-admin button[onclick="toggleAdminToolbar(event)"] { display: none !important; }
    .admin-menu-toggle { display: none !important; }

    .admin-panel-layout { display: block; }
    #adminPanel { align-items: stretch !important; }

    /* tabs: a simple wrapped row of pills, always visible */
    .admin-panel-layout .admin-toolbar-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0.35rem !important;
        position: static !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 0 0.75rem 0 !important;
        border-right: none !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .admin-panel-layout.menu-open .admin-toolbar-actions { display: flex !important; }
    .admin-panel-layout .admin-toolbar-actions .btn {
        width: auto !important;
        min-width: 0 !important;
        background: var(--cg-primary) !important;
        color: #fff !important;
        border: 1px solid var(--cg-primary) !important;
    }
    .admin-toolbar-panel h3, .admin-toolbar-panel label { color: var(--cg-text) !important; }
    .admin-toolbar-panel .success { color: var(--cg-primary) !important; }
    .admin-toolbar-panel .error { color: #dc3545 !important; }

    /* login form sits on a white card in the page */
    #adminLogin { background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 8px; padding: 0.75rem; }
    .admin-panel-content { width: 100%; }
}

/* ============================================================
   MENU SYSTEM v2 — ground-up redesign.
   One header: brand left, nav right (inline on desktop,
   hamburger dropdown on mobile). Admin content is plain page
   flow. Old dropdown machinery above is dead CSS (elements
   no longer exist).
   ============================================================ */
.site-topbar { position: sticky; top: 0; z-index: 900; background: var(--cg-primary); color: #fff;
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    padding: 0.45rem 0.9rem; box-shadow: 0 1px 5px rgba(0,0,0,0.18); }
.topbar-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.9rem; color: inherit; text-decoration: none; white-space: nowrap; }
.topbar-brand img { width: 26px; height: auto; border-radius: 5px; }

/* The menu drifted: on most pages it sat against the right edge, on /rounds
   it stopped 220px short because that page puts a GPS pill in the bar after
   it. Ordering the bar explicitly pins the menu in the same place whatever
   else a page adds, without caring where in the DOM it was added. */
.site-nav { display: flex; align-items: center; gap: 0.1rem; margin-left: auto; order: 10; }
@media (min-width: 1025px) and (pointer: fine) {
    /* The brand takes the slack, so the identity controls travel right
       with the menu instead of being stranded beside the logo. */
    .site-topbar > .topbar-brand { margin-right: auto; }
    .site-nav { margin-left: 0; }

}
.site-topbar > .nav-toggle { order: 12; }
.site-topbar > #cgGpsPill { order: 5; margin-left: 0.4rem; }
.nav-sect { font-size: 0.5rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
    color: rgba(255,255,255,0.5); margin: 0 0.4rem 0 0.6rem; white-space: nowrap; }
.site-nav .nav-sect:first-child { margin-left: 0.35rem; }
.site-nav a { color: rgba(255,255,255,0.92); text-decoration: none; font-size: 0.74rem; font-weight: 600;
    padding: 0.3rem 0.55rem; border-radius: 8px; white-space: nowrap; }
.site-nav a:hover { background: rgba(255,255,255,0.18); }
.site-nav a.active { background: var(--cg-surface); color: var(--cg-primary); font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.site-nav a.nav-admin { border: 1px solid rgba(255,255,255,0.28); color: rgba(255,255,255,0.78); margin-left: 0.55rem; }
.site-nav a.nav-admin.active { background: var(--cg-surface); color: var(--cg-primary); border-color: #fff; }

/* nav-toggle-fixed-geometry
   The bars are positioned, not flowed. A flowed hamburger gets its
   height from 3 spans + 2 gaps + padding, so anything that touches
   text metrics -- Android text scaling, a stray line-height, an
   align-items from a touch-target rule -- changes its shape. Reported
   twice as "wide and ugly on Chrome, fine on Firefox"; the two engines
   inflate rem differently, and the height was set in rem in one of the
   four places it was set. Now the box is 44x44 in px and the bars are
   placed inside it, so no text rule can reach it. */
/* Same 44x44 as the hamburger, and square for the same reasons. */
.cg-back-btn { display: inline-flex; align-items: center; justify-content: center;
    box-sizing: border-box; width: 44px; height: 44px; min-width: 44px;
    min-height: 44px; padding: 0; margin-right: 0.1rem; flex: 0 0 44px;
    background: rgba(255,255,255,0.12); color: #fff;
    border: 1px solid rgba(255,255,255,0.3); border-radius: 8px; cursor: pointer; }
.cg-back-btn svg { stroke: currentColor; }
.cg-back-btn:hover { background: rgba(255,255,255,0.22); }

.nav-toggle { display: none; position: relative; box-sizing: border-box;
    width: 44px; height: 44px; min-width: 44px; min-height: 44px;
    padding: 0; background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px; cursor: pointer; }
.nav-toggle span { position: absolute; left: 11px; width: 22px; height: 3px;
    background: var(--cg-surface); border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s; }
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 20.5px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.site-topbar.nav-open .nav-toggle span:nth-child(1) { top: 20.5px; transform: rotate(45deg); }
.site-topbar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-topbar.nav-open .nav-toggle span:nth-child(3) { top: 20.5px; transform: rotate(-45deg); }

@media (max-width: 1024px), (pointer: coarse) {
    /* keep the hamburger fully visible no matter how many badges/pills crowd the bar */
    .site-topbar { gap: 0.4rem; padding: 0.4rem 0.55rem; }
    /* flex-basis and a min-height, not just flex:0 0 auto: `auto` takes
       the basis from the content box, so a crowded bar could still
       compress it. Reported as the wrong shape on Chrome for Android --
       I could not reproduce it (44x44 in every engine I measured), so
       this removes the possibility rather than fixing a known cause. */
    /* Square, and not negotiable. Four other rules in this file set a
       height, a min-height or a padding that can reach this element
       (two of them from generic `button` touch-target selectors); the
       winner decided the shape, and on one engine it was the wrong
       one. */
    .nav-toggle { display: block; flex: 0 0 44px !important; margin-left: auto;
        width: 44px !important; height: 44px !important;
        min-width: 44px !important; min-height: 44px !important;
        aspect-ratio: 1 / 1; padding: 0 !important; align-self: center;
        box-sizing: border-box;
        background: rgba(255,255,255,0.25); border: 2px solid rgba(255,255,255,0.55); }
    .topbar-brand { flex: 0 1 auto; min-width: 0; overflow: hidden; }
    .topbar-brand img { width: 22px; }
    /* Keeps the admin chip from shoving the hamburger off screen. The nav
       dropdown is absolutely positioned outside the bar, so it must be
       excluded: it was being clipped to 124px wide and 140px tall. */
    .site-topbar > *:not(.topbar-brand):not(.nav-toggle):not(.site-nav) { min-width: 0; overflow: hidden; max-width: 30vw; }
    .site-nav { display: none; position: absolute; top: 100%; right: 0.55rem; left: auto;
        /* px, not rem: the wide-viewport type scaling multiplies every
           rem, and a panel width is a share of the SCREEN, not a
           multiple of the type. 18rem became 630px on a phone
           reporting a 900px viewport. */
        /* 76vw measured 296px of a 390px screen -- three-quarters of the
           phone for a menu. It should sit OVER the page, not replace it. */
        width: min(64vw, 252px);
        flex-direction: column; align-items: stretch; gap: 0.15rem;
        background: var(--cg-primary); border-radius: 10px; padding: 0.55rem;
        box-shadow: 0 12px 30px rgba(0,0,0,0.35); z-index: 940;
        /* Taller than the screen on a small phone with every section open, so
           it scrolls itself rather than losing the items below the fold. */
        /* 4rem clears the top bar; the rest clears the bottom tab bar and
           the phone's own gesture area, which the menu was running under --
           with a group open, the last few links sat behind the tab bar. */
        max-height: calc(100dvh - 4rem - 4.4rem - env(safe-area-inset-bottom, 0px));
        padding-bottom: 0.9rem;
        overflow-y: auto; overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch; }
    .site-topbar.nav-open .site-nav { display: flex; }
    .site-nav a { width: 100%; text-align: left; font-size: 0.95rem; padding: 0.55rem 0.8rem; white-space: normal; }
    .site-nav a.active { background: var(--cg-surface); }
    .nav-sect { margin: 0.4rem 0.3rem 0.1rem; font-size: 0.58rem; color: rgba(255,255,255,0.45); }
    .site-nav .nav-sect:first-child { margin-top: 0; }
    .site-nav a.nav-admin { margin-left: 0; margin-top: 0.4rem; border-color: rgba(255,255,255,0.35); }
}

/* DMVI logo under topbar — hidden on mobile (topbar already shows a logo) */
@media (max-width: 768px), (pointer: coarse) {
    .dmvi-logo { display: none !important; }
}

/* Admin page content: plain flow on every screen size */
.admin-page { margin-bottom: 1rem; }
.admin-page #adminLogin { background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 10px;
    padding: 1rem; max-width: 26rem; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.admin-page #adminPanel { background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 10px;
    padding: 0.75rem; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.admin-panel-layout { display: grid; grid-template-columns: 128px 1fr; gap: 0.9rem; align-items: start; width: 100%; }
.admin-toolbar-actions { display: flex; flex-direction: column; gap: 0.3rem; }
.admin-toolbar-actions .btn { width: auto; }
@media (max-width: 1024px), (pointer: coarse) {
    .admin-panel-layout { display: block; }
    .admin-toolbar-actions { flex-direction: row; flex-wrap: wrap; margin-bottom: 0.75rem;
        border-right: none; padding: 0.35rem; background: var(--cg-surface); z-index: 60;
        border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
    .admin-toolbar-actions .btn { width: auto; }
    .admin-toolbar-actions select { max-width: 100%; margin-bottom: 0.4rem; }
}

/* Responsive admin forms — prevent any overflow at any width */
@media (max-width: 768px), (pointer: coarse) {
    .admin-page .form-row {
        grid-template-columns: 1fr !important;
        gap: 0.4rem !important;
    }
    .admin-page input[type="datetime-local"],
    .admin-page input[type="date"],
    .admin-page input[type="number"],
    .admin-page input[type="text"],
    .admin-page select {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .admin-page [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    .admin-page label {
        font-size: 0.68rem !important;
        white-space: normal !important;
    }
}

/* pulsing LIVE chip on the Live Scores nav link */
.live-dot {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #fff;
    background: #dc3545;
    border-radius: 999px;
    vertical-align: middle;
    animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    50% { opacity: 0.75; box-shadow: 0 0 0 5px rgba(220, 53, 69, 0); }
}

/* standalone LIVE SCORES pill — mobile only, appears with the nav badge */
#liveFab {
    position: fixed;
    bottom: 4.5rem;
    right: 0.85rem;
    z-index: 1050;
    display: none;
    align-items: center;
    background: #dc3545;
    color: #fff;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(220, 53, 69, 0.45);
    animation: live-pulse 1.6s ease-in-out infinite;
}
@media (max-width: 768px), (pointer: coarse) {
    #liveFab.live { display: inline-flex; }
}

/* tournament form: side-by-side Day 1 / Day 2 panels */
.t-day-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.5rem 0; }
.t-day-panel { border: 1px solid #d9e4d9; border-radius: 8px; padding: 0.6rem 0.7rem; background: #fbfdfb; }
.t-day-title { font-size: 0.72rem; font-weight: 800; color: var(--cg-primary); letter-spacing: 0.06em; margin-bottom: 0.45rem; border-bottom: 1px solid #e4ece4; padding-bottom: 0.25rem; }
@media (max-width: 900px), (pointer: coarse) { .t-day-columns { grid-template-columns: 1fr; } }

/* ===== Page hero: consistent modern header band on every page ===== */
.container > h1:first-of-type {
    font-size: 1.35rem; font-weight: 800; color: var(--cg-text); margin: 0.2rem 0 0.1rem 0;
    letter-spacing: -0.01em;
}
.container > .subtitle:first-of-type, .container > p.subtitle {
    color: #6c7a70; font-size: 0.85rem; margin: 0 0 0.9rem 0; font-weight: 600;
}
.section-header h2, .afc-title { letter-spacing: 0.04em; }
.badge { border-radius: 999px; padding: 0.14rem 0.55rem; font-size: 0.62rem; font-weight: 800; }
.badge-paid { background: #e6f4ea; color: var(--cg-primary); border: 1px solid var(--cg-green-border); }
.badge-unpaid { background: #fdecea; color: #c5221f; border: 1px solid #f6cfcb; }

/* ===== Modern signups toolbar: segmented controls, pill & chip toggles ===== */
.seg-btn { border: none; background: transparent; color: #4a554c; font-size: 0.74rem; font-weight: 700;
    padding: 0.35rem 0.7rem; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem;
    transition: background .12s ease, color .12s ease; white-space: nowrap; }
.seg-btn:hover { background: #e2eae3; }
.seg-btn.active { background: var(--cg-primary); color: #fff; box-shadow: 0 1px 4px rgba(22,43,66,0.3); }
.seg-btn.active.seg-paid { background: var(--cg-primary); }
.seg-btn.active.seg-unpaid { background: #c5221f; }
.seg-btn.active.seg-partial { background: #b8860b; }
.seg-count { background: rgba(255,255,255,0.28); border-radius: 999px; padding: 0 0.4rem; font-size: 0.66rem; font-weight: 800; }
.seg-btn:not(.active) .seg-count { background: #dfe7e0; color: #495047; }
.pill-toggle { border: 1.5px solid #d7e0d8; background: var(--cg-surface); color: #4a554c; font-size: 0.74rem; font-weight: 700;
    padding: 0.4rem 0.85rem; border-radius: 999px; cursor: pointer; transition: all .12s ease; white-space: nowrap; }
.pill-toggle:hover { border-color: var(--cg-primary); color: var(--cg-primary); }
.pill-toggle.active { background: var(--cg-primary); border-color: var(--cg-primary); color: #fff; }
.chip-toggle { display: inline-flex; align-items: center; gap: 0.3rem; border: 1.5px dashed #c9d5ca; background: #fbfdfb;
    color: #6c7a70; font-size: 0.72rem; font-weight: 700; padding: 0.4rem 0.75rem; border-radius: 999px; cursor: pointer;
    transition: all .12s ease; }
.chip-toggle:hover { border-color: var(--cg-primary); color: var(--cg-primary); border-style: solid; }
.chip-toggle.on { background: #e6f4ea; border: 1.5px solid var(--cg-primary); color: var(--cg-primary); border-style: solid; }

/* ===== Signup page tabs: task-first form, roster one tap away ===== */
.signup-tab { flex:1; border:none; background:transparent; color:#4a554c; font-size:0.88rem; font-weight:800;
    padding:0.6rem 0.9rem; border-radius:10px; cursor:pointer; transition:all .12s ease; white-space:nowrap; }
.signup-tab:hover { background:#e2eae3; }
.signup-tab.active { background:var(--cg-primary); color:#fff; box-shadow:0 2px 6px rgba(22,43,66,0.3); }

/* ===== Member-officials in /admin: gate hub cards & tools by role permission ===== */
.role-member #hubCardUsers, .role-member #hubCardSettings, .role-member #tabBtnUsers,
.role-member #tabBtnSettings, .role-member #tabBtnPassword { display: none !important; }
.role-member #hubCardSignups:not(.perm-tournaments-manage),
.role-member #hubCardPayouts:not(.perm-scoring-enter),
.role-member #hubCardTournaments:not(.perm-tournaments-manage),
.role-member #hubCardCourses:not(.perm-tournaments-manage),
.role-member #hubCardMembers:not(.perm-members-review_applications),
.role-member #hubCardOps:not(.perm-tournaments-manage) { display: none !important; }

/* ===== MODERN UI OVERHAUL ===== */
:root {
    --cg-green: var(--cg-primary);
    --cg-green-light: #f6f8fb;      /* was a green tint */
    --cg-green-border: #e3e8ef;
    /* the gradient partner must be a shade of the brand colour, not the
       gold accent - paired with green it came out green-to-brown */
    --cg-teal: var(--cg-primary-dark);
    --cg-radius: 12px;
    --cg-radius-sm: 8px;
    /* neutral shadows and slate text - these were all green-tinted, which is
       what kept the pages looking green even after the brand colour moved */
    --cg-shadow: 0 2px 8px rgba(22,43,66,.08);
    --cg-shadow-lg: 0 8px 24px rgba(22,43,66,.12);
    --cg-text: #1b2735;
    --cg-text-secondary: #4a5566;
    --cg-text-muted: #687180;   /* was #8a919c: 3.1:1 on white, below WCAG AA */
    --cg-border: #e4e8ee;
    --cg-bg: #f8f9fb;
}

/* --- Modern inputs --- */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="password"], input[type="time"],
select, textarea {
    border: 1.5px solid var(--cg-border) !important;
    border-radius: var(--cg-radius-sm) !important;
    padding: 0.55rem 0.75rem !important;
    font-size: 0.85rem !important;
    background: var(--cg-surface) !important;
    color: var(--cg-text) !important;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--cg-green) !important;
    box-shadow: 0 0 0 3px rgba(22,43,66,.12) !important;
    background: var(--cg-green-light) !important;
}
input::placeholder, textarea::placeholder {
    color: var(--cg-text-muted) !important;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a968d' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.6rem center !important;
    padding-right: 2rem !important;
}

/* --- Modern labels --- */
label {
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    color: var(--cg-text-secondary) !important;
    margin-bottom: 0.25rem !important;
}

/* --- Modern section cards --- */
.form-section {
    background: var(--cg-surface) !important;
    padding: 1rem !important;
    border-radius: var(--cg-radius) !important;
    margin-bottom: 0.8rem !important;
    border: 1px solid var(--cg-border) !important;
    box-shadow: var(--cg-shadow) !important;
}
.afc {
    background: var(--cg-surface) !important;
    border: 1px solid var(--cg-border) !important;
    border-radius: var(--cg-radius) !important;
    padding: 1rem !important;
    margin-bottom: 0.8rem !important;
    box-shadow: var(--cg-shadow) !important;
}
.afc-title {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: var(--cg-green) !important;
    margin-bottom: 0.8rem !important;
    padding-bottom: 0.6rem !important;
    border-bottom: 1px solid var(--cg-green-border) !important;
}
.afc-step {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.6rem !important;
    height: 1.6rem !important;
    border-radius: 50% !important;
    background: var(--cg-green) !important;
    color: #fff !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    flex-shrink: 0 !important;
}

/* --- Modern buttons --- */
.btn {
    border-radius: var(--cg-radius-sm) !important;
    padding: 0.6rem 1.2rem !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    border: none !important;
    cursor: pointer !important;
    transition: transform .1s ease, box-shadow .15s ease !important;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--cg-shadow-lg); }
.btn:active { transform: translateY(0); }
.btn-sm {
    border-radius: 6px !important;
    padding: 0.35rem 0.7rem !important;
    font-size: 0.75rem !important;
    border: none !important;
    cursor: pointer !important;
    transition: all .12s ease !important;
}

/* --- Modern modals --- */
.modal-overlay {
    background: rgba(0,0,0,.5) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}
.modal {
    background: var(--cg-surface) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,.25) !important;
    max-width: 34rem !important;
    width: calc(100% - 2rem) !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 0 !important;
}
.modal > *:first-child { padding: 1rem 1.2rem 0.5rem !important; }
.modal .form-section { box-shadow: none !important; border: none !important; padding: 0.5rem 1.2rem !important; }
.modal .form-row { grid-template-columns: 1fr 1fr !important; gap: 0.7rem !important; }
.modal button.btn { margin: 0.5rem 1.2rem 1rem !important; }

/* --- Better form rows --- */
.form-row { gap: 0.7rem !important; margin-bottom: 0.7rem !important; }
.form-group { gap: 0.25rem !important; }

/* --- Checkbox group --- */
.checkbox-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
}
.checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    padding: 0.5rem 0.8rem !important;
    background: var(--cg-green-light) !important;
    border: 1.5px solid var(--cg-green-border) !important;
    border-radius: var(--cg-radius-sm) !important;
    cursor: pointer !important;
    font-size: 0.8rem !important;
    transition: all .12s ease !important;
}
.checkbox-label:hover { border-color: var(--cg-green) !important; }
.checkbox-label:has(input:checked) {
    background: var(--cg-primary-soft) !important;
    border-color: var(--cg-green) !important;
    box-shadow: 0 0 0 2px rgba(22,43,66,.1) !important;
}
.checkbox-label input[type="checkbox"] {
    width: 1.15rem !important;
    height: 1.15rem !important;
    accent-color: var(--cg-green) !important;
}

/* --- Modal header with icon --- */
.modal h3 {
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: var(--cg-text) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 2px solid var(--cg-green-border) !important;
    margin-bottom: 0.8rem !important;
}

/* --- Total price pill --- */
.total-price {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    background: linear-gradient(135deg, var(--cg-green), var(--cg-teal)) !important;
    color: #fff !important;
    font-weight: 800 !important;
    font-size: 0.9rem !important;
    padding: 0.5rem 1.2rem !important;
    border-radius: 999px !important;
    margin-top: 0.5rem !important;
}

/* --- Mobile responsive --- */
@media (max-width: 640px), (pointer: coarse) {
    .form-row { grid-template-columns: 1fr !important; }
    .modal { border-radius: 12px !important; max-height: 95vh !important; }
    .afc { padding: 0.7rem !important; }
    .afc-step { width: 1.4rem !important; height: 1.4rem !important; font-size: 0.7rem !important; }
    .btn:not(.btn-sm):not(.btn-icon) { width: 100%; }
    .btn-sm { width: auto !important; }
    input, select, textarea { font-size: 0.82rem !important; }
    .checkbox-label { font-size: 0.78rem !important; padding: 0.45rem 0.6rem !important; }
    .modal .form-row { grid-template-columns: 1fr !important; }
}

/* --- Pay box styling (wizard) --- */
.pay-box {
    border: 2px solid rgba(22,43,66,.2) !important;
    border-radius: var(--cg-radius) !important;
    padding: 1rem 1.2rem !important;
    margin-top: 1rem !important;
    background: linear-gradient(135deg, var(--cg-green-light), #f0faf4) !important;
}
.pay-box h4 {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    font-size: 0.85rem !important;
    color: var(--cg-green) !important;
    font-weight: 800 !important;
    margin: 0 0 0.6rem !important;
}
.pay-box .method {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 0.78rem !important;
    color: var(--cg-text-secondary) !important;
    margin: 0.35rem 0 !important;
    padding: 0.4rem 0.6rem !important;
    background: rgba(255,255,255,.7) !important;
    border-radius: 6px !important;
}
.pay-box .method strong {
    color: var(--cg-green) !important;
    min-width: 4.5rem !important;
    font-weight: 700 !important;
}

/* --- Site topbar modernization --- */
.site-topbar {
    background: linear-gradient(135deg, var(--cg-green), var(--cg-teal)) !important;
    box-shadow: 0 2px 12px rgba(22,43,66,.25) !important;
}
.site-nav a {
    color: rgba(255,255,255,.85) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    padding: 0.35rem 0.7rem !important;
    border-radius: 8px !important;
    transition: all .15s ease !important;
}
.site-nav a:hover, .site-nav a.active {
    background: rgba(255,255,255,.15) !important;
    color: #fff !important;
}
.nav-sect {
    color: rgba(255,255,255,.4) !important;
    font-size: 0.6rem !important;
    text-transform: uppercase !important;
    letter-spacing: .08em !important;
    font-weight: 700 !important;
}

/* ===== MODAL MOBILE FIX ===== */
@media (max-width: 640px), (pointer: coarse) {
    /* Tournament modal — force single column, reduce padding */
    .modal .form-row,
    #tournamentForm .form-row,
    #tFormModalBody .form-row {
        grid-template-columns: 1fr !important;
        gap: 0.4rem !important;
        margin-bottom: 0.4rem !important;
    }

    /* Full-width inputs in modals */
    .modal input,
    .modal select,
    .modal textarea,
    #tournamentForm input,
    #tournamentForm select,
    #tournamentForm textarea,
    #tFormModalBody input,
    #tFormModalBody select {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Inline label+input rows → stack */
    .modal label,
    #tournamentForm label {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    .modal label input,
    .modal label select,
    #tournamentForm label input,
    #tournamentForm label select {
        width: 100% !important;
        margin-top: 0.25rem !important;
    }
    /* ...except a checkbox or radio with its text: stacked, the box sat
       alone above a bold line it belonged to, and the box itself was
       stretched to 100%. More specific than the rule above, so it wins. */
    .modal label:has(> input[type="checkbox"]),
    .modal label:has(> input[type="radio"]),
    #tournamentForm label:has(> input[type="checkbox"]),
    #tournamentForm label:has(> input[type="radio"]) {
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    .modal label > input[type="checkbox"],
    .modal label > input[type="radio"],
    #tournamentForm label > input[type="checkbox"],
    #tournamentForm label > input[type="radio"] {
        width: 1.15rem !important;
        min-width: 1.15rem !important;
        flex: 0 0 auto;
        margin-top: 0.15rem !important;
    }

    /* Reduce modal section padding */
    .modal .afc,
    #tournamentForm .afc {
        padding: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    /* Collapsible section headers */
    .afc-title {
        cursor: pointer !important;
        user-select: none !important;
        position: relative !important;
        padding-right: 1.5rem !important;
    }
    .afc-title::after {
        content: '▾' !important;
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 0.9rem !important;
        color: var(--cg-text-muted) !important;
        transition: transform .2s ease !important;
    }
    .afc-title.collapsed::after {
        transform: translateY(-50%) rotate(-90deg) !important;
    }
    .afc-title.collapsed + *,
    .afc.collapsed > *:not(.afc-title) {
        display: none !important;
    }

    /* Price selects — full width */
    .modal .form-row label:has(select) {
        width: 100% !important;
    }
    .modal .form-row label:has(input[type="number"]) {
        width: 100% !important;
    }

    /* Tee select triples — stack */
    .form-row:has(> div:has(select[id*="Tee"])) {
        grid-template-columns: 1fr !important;
    }

    /* Deadline inputs — full width */
    input[type="datetime-local"],
    input[type="date"] {
        width: 100% !important;
    }

    /* Number inputs — don't shrink too narrow but cap width */
    input[type="number"] {
        max-width: 100% !important;
    }
    label input[type="number"] {
        width: 100% !important;
    }

    /* URL input */
    input[type="url"],
    input[placeholder*="league.unknowngolf"] {
        width: 100% !important;
        font-size: 0.75rem !important;
    }
}

/* Collapsible sections — toggle on click (all screen sizes) */
.afc-title {
    cursor: pointer !important;
    user-select: none !important;
    position: relative !important;
    padding-right: 1.8rem !important;
}
.afc-title::after {
    content: '▾' !important;
    position: absolute !important;
    right: 0.2rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 0.85rem !important;
    color: var(--cg-text-muted) !important;
    transition: transform .2s ease !important;
}
.afc-title.collapsed::after {
    transform: translateY(-50%) rotate(-90deg) !important;
}
.afc-title.collapsed + * {
    display: none !important;
}
/* When clicking a title, toggle collapse */

/* ===== DESKTOP MODAL FIX ===== */
/* Tournament modal: auto-wrap grid columns, prevent overflow */
#tournamentForm .form-row,
#tFormModalBody .form-row,
.modal .form-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
}

/* Prevent grid children from overflowing */
#tournamentForm .form-row > *,
#tFormModalBody .form-row > *,
.modal .form-row > * {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Label with inline input — force wrap */
#tournamentForm label:has(input),
#tFormModalBody label:has(input),
.modal label:has(input) {
    min-width: 0 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
}
#tournamentForm label input,
#tFormModalBody label input,
.modal label input {
    display: inline-block !important;
    max-width: 6rem !important;
    vertical-align: middle !important;
}

/* Select fields — cap width */
#tournamentForm select,
#tFormModalBody select,
.modal select {
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Modal body — constrain width */
#tournamentForm,
#tFormModalBody {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Wide text descriptions in labels — allow wrapping */
#tournamentForm label span[style*="color: var(--cg-text-muted)"],
#tFormModalBody label span[style*="color: var(--cg-text-muted)"],
.modal label span[style*="color: var(--cg-text-muted)"] {
    display: inline !important;
    white-space: normal !important;
    word-break: break-word !important;
    font-size: 0.65rem !important;
}

/* URL input — full width but capped */
input[placeholder*="league.unknowngolf"],
input[type="url"] {
    max-width: 100% !important;
    width: 100% !important;
    font-size: 0.75rem !important;
}

/* Price custom inputs — inline but capped */
input[id*="Custom"] {
    max-width: 7rem !important;
}

/* Tee interval — small number input */
#tTeeInterval {
    max-width: 3.5rem !important;
    display: inline-block !important;
}

/* Start hole select */
#tDay1StartHole, #tDay2StartHole {
    width: 100% !important;
    max-width: 100% !important;
}

/* Datetime inputs — cap width */
input[type="datetime-local"] {
    max-width: 100% !important;
    width: 100% !important;
}

/* ===== ADMIN MOBILE FIX ===== */
@media (max-width: 768px), (pointer: coarse) {

    /* Admin panel layout: stack sidebar above content */
    .admin-panel-layout {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    /* Admin hub cards: 2 columns instead of auto */
    .admin-hub-grid, [style*="grid-template-columns:repeat"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Member table: make scrollable + hide low-priority columns */
    .table-container, [style*="overflow-x"] {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Member list: responsive — hide Join/Renewal/Affiliation on mobile */
    .members-table th:nth-child(n+7),
    .members-table td:nth-child(n+7) {
        display: none !important;
    }

    /* Actions column: wrap buttons */
    .members-table td:last-child {
        white-space: normal !important;
    }
    .members-table td:last-child .btn-sm {
        margin: 0.1rem !important;
        padding: 0.2rem 0.4rem !important;
        font-size: 0.6rem !important;
    }

    /* All fixed grid columns → single column */
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr"],
    [style*="grid-template-columns: 2fr 1.2fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr auto"],
    [style*="grid-template-columns:1fr 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.4rem !important;
    }

    /* Even wider grids → single column */
    [style*="grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Min-widths: remove on mobile */
    [style*="min-width:10rem"],
    [style*="min-width:11rem"],
    [style*="min-width:7rem"] {
        min-width: 0 !important;
    }

    /* Admin toolbar: stack */
    .admin-toolbar-panel .form-row,
    .admin-toolbar-panel [style*="display:grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Score entry grid: smaller inputs */
    .sg-hole input[type="number"] {
        width: 1.8rem !important;
        font-size: 0.6rem !important;
        padding: 1px !important;
    }
    .sg-name {
        max-width: 6rem !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 0.6rem !important;
    }

    /* Payout section: stack */
    #payoutsSection .form-row,
    #payoutsSection [style*="grid-template"] {
        grid-template-columns: 1fr !important;
    }

    /* Tables in admin: horizontal scroll with sticky header */
    table {
        font-size: 0.68rem !important;
    }
    th, td {
        padding: 0.25rem 0.35rem !important;
        white-space: nowrap !important;
    }

    /* Ops page: hub cards 2 columns */
    .ops-hub-card {
        padding: 0.7rem 0.5rem !important;
    }

    /* Pairings: group cards stack carts */
    [style*="flex:1;min-width:11"] {
        min-width: 100% !important;
    }

    /* Modal: full screen on mobile */
    .modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 1rem !important;
    }
    .modal-overlay {
        padding: 0 !important;
    }

    /* Select all: full width */
    select {
        width: 100% !important;
    }

    /* Long labels: wrap */
    label {
        white-space: normal !important;
        word-break: break-word !important;
    }
}

/* Extra small phones: even more compact */
@media (max-width: 400px), (pointer: coarse) {
    .admin-hub-grid {
        grid-template-columns: 1fr !important;
    }
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .sg-hole input[type="number"] {
        width: 1.5rem !important;
    }
}

/* ===== DIRECTORY MOBILE FIX ===== */
@media (max-width: 640px), (pointer: coarse) {
    /* Member directory cards: stack, don't clip */
    [style*="border:2px solid #e3e9e4;border-radius:14px"] {
        max-width: 100% !important;
        overflow: visible !important;
    }
    /* Card header (name + follow button) */
    [style*="linear-gradient(135deg,var(--cg-primary),var(--cg-accent-deep))"] {
        flex-wrap: wrap !important;
        padding: 0.7rem !important;
        gap: 0.4rem !important;
    }
    /* Avatar */
    [style*="width:4rem;height:4rem;border-radius:50%"] {
        width: 3rem !important;
        height: 3rem !important;
        flex-shrink: 0 !important;
    }
    /* Follow button: don't clip */
    [style*="border-radius:8px;cursor:pointer;padding:0.4rem 0.8rem"] {
        flex-shrink: 0 !important;
        font-size: 0.65rem !important;
        padding: 0.3rem 0.6rem !important;
    }
    /* Card content: reduce padding */
    [style*="padding:0.7rem"] {
        padding: 0.5rem !important;
    }
    /* Badges: wrap */
    [style*="display:flex;gap:0.4rem;flex-wrap:wrap;font-size:0.65rem"] {
        flex-wrap: wrap !important;
        gap: 0.2rem !important;
    }
    /* Action buttons: full width, wrap */
    [style*="display:flex;gap:0.3rem;margin-top:0.5rem"] {
        flex-wrap: wrap !important;
    }
    [style*="display:flex;gap:0.3rem;margin-top:0.5rem"] .btn-sm {
        flex: 1 1 auto !important;
        font-size: 0.62rem !important;
        padding: 0.3rem 0.5rem !important;
    }
    /* Player card modal: fit mobile */
    #memberRecordBox {
        max-width: 100% !important;
        max-height: 95vh !important;
    }
}


/* ============================================================
   MOBILE UX PASS v2 — readable text, real touch targets, scrollable tables
   ============================================================ */
@media (max-width: 768px), (pointer: coarse) {
    /* --- touch targets: 40px+ --- */
    .btn-sm, .pill-toggle, .admin-toolbar-btn {
        min-height: 2.5rem !important;
        padding: 0.5rem 0.85rem !important;
        font-size: 0.78rem !important;
    }
    .btn {
        min-height: 2.7rem !important;
        padding: 0.6rem 1.1rem !important;
    }
    .site-nav a { min-height: 2.7rem; display: flex; align-items: center; padding: 0.55rem 0.9rem; }
    .topbar-brand { min-height: 2.75rem; display: inline-flex; align-items: center; }
    /* px, not rem: rem inflates under text scaling and this is a
       square icon, not text. */
    .nav-toggle { min-width: 44px; min-height: 44px; }
    /* keep dense score grids dense */
    #scoreGrid .btn-sm, .ls-cards .btn-sm, .sg-table .btn-sm {
        min-height: 0 !important;
        padding: 0.2rem 0.45rem !important;
        font-size: 0.65rem !important;
    }
    /* --- readable text floors --- */
    .nav-sect { font-size: 0.64rem !important; }
    .skin-badge { font-size: 0.66rem !important; }
    #uiVersion { font-size: 0.66rem !important; }
    body { font-size: 0.92rem; }
    /* niche desktop controls hidden on phones */
    #adminTransferBtn { display: none !important; }
    /* small links get tappable padding */
    .container a[href^="/history"] { padding: 0.45rem 0.2rem; display: inline-block; }
    /* --- wide tables scroll, never clip --- */
    table.ls-cards, #scoreGrid, .sg-table, .table-scroll,
    #portalProfileCard table, #liveScoresContent table, #membersList table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* photo overlay button a touch bigger */
    #portalProfileCard button[onclick="portalPhotoPicker()"] { min-width: 1.75rem; min-height: 1.75rem; font-size: 0.75rem; }
}
/* Tablets (James, 8 Nov 2026): the rule above also catches every touch
   screen, tablets included. A table shown as a block only grows as wide as
   its own columns, so on a tablet the live and results boards (team scramble
   and best ball, payouts, skins, hole-by-hole cards) sat in the left two
   thirds of their card. From 641px up on a touch screen they are tables
   again. Each one already sits in its own overflow-x:auto box, so a board
   wider than the screen still scrolls sideways; a table without such a box
   keeps the block rule. Phones (640px and under) and desktop are unchanged. */
@media (min-width: 641px) and (pointer: coarse) {
    #liveScoresContent div[style*="overflow-x"] > table { display: table; }
    #liveScoresContent div[style*="overflow-x"] > table.ls-cards { min-width: 100%; }
}

/* tournament form on phones: inputs fill the row (no skinny fields + whitespace) */
@media (max-width: 700px), (pointer: coarse) {
    #tournamentForm .form-group input:not([style]):not([type=checkbox]),
    #tournamentForm .form-group select,
    #tournamentForm .form-group textarea { width: 100%; }
}


/* ---- grouped menu (CLUB / PERSONAL) ----
   On desktop these were left as a flat row, so thirteen items still ran off the
   side of the screen. They are two dropdowns here, the same two groups as on
   mobile - the bar holds two controls instead of thirteen links. */
.nav-group-head { display:inline-flex; align-items:center; gap:0.3rem;
    background:rgba(255,255,255,0.12); border:1px solid rgba(255,255,255,0.22);
    color:#fff; font-size:0.74rem; font-weight:700; border-radius:8px;
    padding:0.34rem 0.6rem; cursor:pointer; white-space:nowrap; }
.nav-group-head:hover { background:rgba(255,255,255,0.2); }
/* Anchor for the desktop dropdown panels only. Applied globally it overrode the
   phone menu's own absolute positioning (left/right 0.5rem), so the menu stopped
   filling the width of the screen. */
@media (min-width: 1025px) and (pointer: fine) { .site-nav { position:relative; } }
/* Each head + panel pair. The panel anchors to THIS, not to the whole bar. */
@media (min-width: 1025px) and (pointer: fine) { .nav-pair { position:relative; display:inline-flex; } }
.nav-group { position:absolute; top:calc(100% + 0.45rem); right:0; left:auto; z-index:950;
    display:flex; flex-direction:column; align-items:stretch; gap:0.15rem;
    min-width:11rem; background:var(--cg-primary); border-radius:10px;
    padding:0.4rem; box-shadow:0 12px 30px rgba(0,0,0,0.35); }
.nav-group.collapsed { display:none; }
.nav-group a { white-space:nowrap; }
@media (max-width: 1024px), (pointer: coarse) {
    .nav-group-head { display:flex; align-items:center; justify-content:space-between;
        width:100%; background:rgba(255,255,255,0.10); border:0; border-radius:8px;
        color:rgba(255,255,255,0.95); font-size:0.7rem; font-weight:800; letter-spacing:0.05em;
        text-transform:uppercase; padding:0.5rem 0.7rem; margin:0.25rem 0 0.15rem; cursor:pointer; }
    .nav-group-head .nav-caret { font-size:0.8rem; opacity:0.8; }
    /* Undo EVERY desktop dropdown property, not just display. The rule above
       makes .nav-group position:absolute for the desktop panels; this block
       only re-set display and flex-direction, so on a phone both groups stayed
       absolutely positioned and floated off the right edge of the screen -
       two panels open at once with the item names cut in half. */
    /* The wrapper must disappear on a phone, where head and panel are a
       plain stacked list and a flex box around them would break the column. */
    .nav-pair { display:contents; }
    .nav-group { position:static; display:flex; flex-direction:column; gap:0.15rem;
        min-width:0; background:none; border-radius:0; padding:0; box-shadow:none;
        top:auto; left:auto; right:auto; z-index:auto; }
    .nav-group.collapsed { display:none; }
    .nav-group a { padding-left:1.25rem; }
    .nav-signout { margin-top:0.5rem; border-top:1px solid rgba(255,255,255,0.18);
        padding-top:0.6rem !important; color:rgba(255,255,255,0.62) !important;
        font-size:0.78rem !important; font-weight:600 !important; }
}

/* ==================================================================
   Sabio Golf UI system (ui.js companions) — 2026-09-20
   Theme variables, toasts, modals, skeletons, empty states, icons,
   dark mode, native tab bar, admin tabs, wizard, a11y focus.
   ================================================================== */
:root {
    /* Tells the browser which palette to paint FORM CONTROLS with. Without
       it Chrome keeps the light widget appearance in dark mode, so a search
       box stayed white while our CSS painted its text near-white -- the text
       was there, on a background the browser had chosen, not us. */
    color-scheme: light;
    --cg-bg:          #f5f5f5;
    --cg-surface:     #ffffff;
    --cg-surface-2:   #f8f9fa;
    --cg-text:        #234;
    --cg-text-muted:  #66707a;
    --cg-border:      #dde2e6;
    --cg-shadow:      0 2px 10px rgba(0,0,0,0.10);
    --cg-focus:       0 0 0 3px rgba(188,168,118,0.55);
}
[data-theme="dark"] {
    color-scheme: dark;
    /* These two are declared once in the light :root and were never given a
       dark value, so every rule built on them stayed light. The one that bit
       was the focus style: input:focus sets its background to
       var(--cg-green-light) with !important, so a focused search box turned
       white under near-white text -- which is why it only looked broken while
       you were typing in it. */
    --cg-green-light: #1c2a38;
    --cg-green-border:#2b3a49;
    --cg-bg:          #0d161f;
    --cg-surface:     #16222e;
    --cg-surface-2:   #1c2a38;
    --cg-text:        #e6edf3;
    --cg-text-muted:  #93a1af;
    --cg-border:      #2b3a49;
    --cg-primary-soft:#1e3040;
    --cg-primary-tint:#313e4a;
    --cg-primary-line:#43505d;
    --cg-primary-ink: #717e8c;
    --cg-primary-deep:#b1b8c0;
    --cg-shadow:      0 2px 12px rgba(0,0,0,0.45);
}
/* ---- sticky tab bar (ui.js injectTabBar) ---- */
#cgTabBar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    display: flex; background: var(--cg-surface);
    border-top: 1px solid var(--cg-border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 14px rgba(0,0,0,.08);
}
#cgTabBar a {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
    align-items: center; gap: 0.1rem; padding: 0.4rem 0.15rem 0.35rem;
    color: var(--cg-text-muted); text-decoration: none;
    font-size: 0.58rem; font-weight: 700; letter-spacing: 0.01em;
}
#cgTabBar a.on { color: var(--cg-primary); }
#cgTabBar a.on svg { stroke-width: 2.4; }
#cgTabBar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Nothing at the foot of a page should hide behind the bar. */
body:has(#cgTabBar) { padding-bottom: 3.6rem; }
/* Tablets (James, 6 Nov 2026: the app is for iPad and Android tablets too).
   Five tabs spread across a 1280px screen sat 250px apart with 9px labels;
   keep them together in the middle, a size up. */
@media (min-width: 700px) {
    /* !important: a later nav rule sets space-around */
    #cgTabBar { justify-content: center !important; }
    #cgTabBar a { flex: 0 1 9rem; font-size: 0.68rem; }
}
@media (min-width: 900px) and (pointer: fine) { #cgTabBar { display: none; } body:has(#cgTabBar) { padding-bottom: 0; } }

[data-theme="dark"] body { background: var(--cg-bg); color: var(--cg-text); }
/* Pages that set "html, body { background:#f6faf7 }" inline (friends, honors,
   messages, news...) kept the LIGHT html background in dark mode: on a short
   page everything below the content was a white block (13 Nov). */
html[data-theme="dark"] { background: var(--cg-bg); }
[data-theme="dark"] .container,
[data-theme="dark"] .form-section { background: var(--cg-surface) !important; color: var(--cg-text); }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--cg-text); }
[data-theme="dark"] .section-header { background: var(--cg-primary); }
[data-theme="dark"] .section-header h2 { color: #fff; }
[data-theme="dark"] input[type="text"], [data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="tel"], [data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"], [data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="date"], [data-theme="dark"] select, [data-theme="dark"] textarea,
[data-theme="dark"] input[type="search"], [data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="time"], [data-theme="dark"] input:not([type]) {
    background: var(--cg-surface-2); color: var(--cg-text); border-color: var(--cg-border);
    /* Chrome paints a search field's text with -webkit-text-fill-color, which
       wins over `color`. Without this the wall's search box was near-white
       text on a field Chrome had decided to paint white. */
    -webkit-text-fill-color: var(--cg-text);
    caret-color: var(--cg-text);
}
/* The dark inputs above set -webkit-text-fill-color, and a placeholder
   inherits it -- so in Chrome/Android/iOS every hint read as bright as a
   typed value (13 Nov). Give the placeholder its own fill. */
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--cg-text-muted); -webkit-text-fill-color: var(--cg-text-muted); opacity: 1; }
[data-theme="dark"] input[type="search"]::-webkit-search-cancel-button { filter: invert(1) opacity(.6); }
[data-theme="dark"] .table-container table { background: var(--cg-surface); color: var(--cg-text); }
[data-theme="dark"] .table-container th { background: var(--cg-surface-2); color: var(--cg-text); }
[data-theme="dark"] .table-container tr:nth-child(even) { background: var(--cg-surface-2); }
[data-theme="dark"] .site-topbar { background: #0e1c2c; }
[data-theme="dark"] .subtitle { color: var(--cg-text-muted); }
[data-theme="dark"] .plan, [data-theme="dark"] .feature, [data-theme="dark"] .event-card { background: var(--cg-surface) !important; border-color: var(--cg-border) !important; }
[data-theme="dark"] .btn-secondary { background: #3a4a5a; }

/* icons */
.cg-ic { width: 1.05em; height: 1.05em; vertical-align: -0.18em; }
.cg-iconify { display: inline; }
.cg-iconify .cg-ic { width: .95em; height: .95em; vertical-align: -0.15em; }
.site-nav .cg-ic { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }
.site-nav a { display: inline-flex; align-items: center; gap: 0.32em; }

/* a11y focus */
:focus { outline: none; }
:focus-visible { box-shadow: var(--cg-focus); border-radius: 6px; }
.section-header:focus-visible { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.75); }

/* buttons */
.cg-btn-danger { background: #c0392b !important; }
.cg-btn-danger:hover { background: #a93226 !important; }
.btn-accent { background: var(--cg-accent-deep) !important; }
.btn-ghost { background: transparent !important; color: var(--cg-primary); border: 1.5px solid var(--cg-primary); }

/* toasts */
.cg-toasts { position: fixed; z-index: 9900; right: 1rem; bottom: 5rem; display: flex; flex-direction: column; gap: 0.5rem; max-width: min(24rem, calc(100vw - 2rem)); }
@media (max-width: 700px), (pointer: coarse) { .cg-toasts { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px)); } }
body:not(.cg-native) .cg-toasts { bottom: 1.2rem; }
.cg-toast { display: flex; align-items: flex-start; gap: 0.5rem; background: #16222e; color: #eef3f8; border-radius: 12px; padding: 0.7rem 0.95rem; font-size: 0.85rem; font-weight: 600; line-height: 1.35; box-shadow: 0 8px 26px rgba(0,0,0,0.35); opacity: 0; transform: translateY(8px); transition: opacity .22s, transform .22s; cursor: pointer; border-left: 4px solid #6c757d; }
.cg-toast.in { opacity: 1; transform: none; }
.cg-toast.success { border-left-color: #2e9e5b; }
.cg-toast.success .cg-ic { color: #58d68d; }
.cg-toast.error { border-left-color: #c0392b; }
.cg-toast.error .cg-ic { color: #ff8f86; }
.cg-toast.warn { border-left-color: #b8860b; }
.cg-toast.info { border-left-color: var(--cg-accent); }

/* modals */
.cg-overlay { position: fixed; inset: 0; background: rgba(10,18,26,0.55); z-index: 9800; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.cg-overlay.in { opacity: 1; }
.cg-modal-card { background: var(--cg-surface); color: var(--cg-text); border-radius: 16px; max-width: 26rem; width: 100%; padding: 1.15rem 1.2rem 1rem; box-shadow: 0 18px 60px rgba(0,0,0,0.4); transform: translateY(10px) scale(.98); transition: transform .2s; max-height: 86vh; overflow: auto; }
.cg-overlay.in .cg-modal-card { transform: none; }
.cg-modal-card.danger { border-top: 4px solid #c0392b; }
.cg-modal-title { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--cg-primary); }
[data-theme="dark"] .cg-modal-title { color: #fff; }
.cg-modal-body { font-size: 0.88rem; line-height: 1.5; color: var(--cg-text); overflow-wrap: anywhere; }
.cg-modal-typed { margin-top: 0.8rem; }
.cg-modal-typed label { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 0.35rem; }
.cg-modal-typed input { width: 100%; padding: 0.55rem; border: 1.5px solid var(--cg-border); border-radius: 8px; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; background: var(--cg-surface-2); color: var(--cg-text); }
.cg-modal-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
.cg-modal-actions .btn { margin-top: 0; flex: 1; }

/* skeletons */
.cg-skel { padding: 0.6rem 0; }
.cg-skel-row { height: 0.85rem; border-radius: 6px; margin: 0.55rem 0; background: linear-gradient(100deg, var(--cg-surface-2) 40%, var(--cg-border) 50%, var(--cg-surface-2) 60%); background-size: 200% 100%; animation: cg-shimmer 1.3s infinite linear; }
@keyframes cg-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .cg-skel-row { animation: none; } }

/* empty states */
.cg-empty { text-align: center; padding: 2.2rem 1rem; color: var(--cg-text-muted); }
.cg-empty .cg-ic { opacity: 0.4; }
.cg-empty h4 { margin: 0.6rem 0 0.3rem; color: var(--cg-text); font-size: 1rem; }
.cg-empty p { margin: 0 auto 0.9rem; font-size: 0.82rem; max-width: 24rem; line-height: 1.45; }
.cg-empty-cta { display: inline-block; width: auto; padding: 0.55rem 1.3rem; }

/* theme toggle */
.cg-theme-btn { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 8px; width: 34px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.cg-theme-btn:hover { background: rgba(255,255,255,.25); }

/* offline banner */
.cg-offline { position: fixed; top: 0; left: 0; right: 0; z-index: 9700; background: #b8860b; color: #fff; font-size: 0.78rem; font-weight: 700; text-align: center; padding: 0.45rem 1rem calc(0.45rem + env(safe-area-inset-top, 0px)); transform: translateY(-110%); transition: transform .25s; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.cg-offline.in { transform: none; }
.cg-offline .cg-ic { vertical-align: -0.22em; margin-right: 0.3em; }

/* native bottom tab bar */
.cg-tb-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9600; display: flex; background: var(--cg-primary-dark); padding: 0.3rem 0.2rem calc(0.3rem + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 18px rgba(0,0,0,0.3); }
.cg-tb-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.12rem; background: none; border: none; color: rgba(255,255,255,0.62); font-size: 0.6rem; font-weight: 700; text-decoration: none; padding: 0.25rem 0 0.15rem; border-radius: 10px; }
.cg-tb-item.active { color: #fff; position: relative; }
.cg-tb-item.active::before { content: ''; position: absolute; top: -0.3rem; width: 1.4rem; height: 3px; border-radius: 3px; background: var(--cg-accent); }
body.cg-native { padding-bottom: calc(3.6rem + env(safe-area-inset-bottom, 0px)) !important; }
@media print { .cg-tb-bar, .cg-toasts, .cg-offline, .cg-theme-btn, .site-topbar { display: none !important; } }

/* admin tabs */
.cg-tabs { display: flex; gap: 0.3rem; overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--cg-primary); padding: 0.35rem 0.45rem 0; border-radius: 12px 12px 0 0; position: sticky; top: 3.1rem; z-index: 800; scrollbar-width: none; }
.cg-tabs::-webkit-scrollbar { display: none; }
.cg-tabs button { flex: none; background: rgba(255,255,255,0.12); border: none; color: rgba(255,255,255,0.85); font-size: 0.78rem; font-weight: 700; padding: 0.5rem 0.9rem; border-radius: 9px 9px 0 0; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35em; }
.cg-tabs button:hover { background: rgba(255,255,255,0.22); }
.cg-tabs button.active { background: var(--cg-surface); color: var(--cg-primary); }
.cg-tab-pane { display: none; }
.cg-tab-pane.active { display: block; }

/* stat strip + sparkline */
.cg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 0.6rem; margin-bottom: 0.8rem; }
.cg-stat { background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 12px; padding: 0.7rem 0.85rem; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.cg-stat .v { font-size: 1.35rem; font-weight: 900; color: var(--cg-primary); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .cg-stat .v { color: #fff; }
.cg-stat .l { font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--cg-text-muted); }
.cg-spark { width: 100%; height: 2.6rem; }

/* mobile wizard (rounds) */
.cg-wiz-steps { display: flex; gap: 0.4rem; margin: 0.6rem 0 0.8rem; }
.cg-wiz-steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--cg-border); }
.cg-wiz-steps span.done { background: var(--cg-accent); }
.cg-wiz-steps span.cur { background: var(--cg-primary); }
.cg-wiz-nav { display: flex; gap: 0.6rem; margin-top: 0.8rem; }
.cg-wiz-nav .btn { margin: 0; flex: 1; }
@media (max-width: 768px), (pointer: coarse) {
    .cg-wiz-pane { display: none; }
    .cg-wiz-pane.cur { display: block; }
}
@media (min-width: 769px) and (pointer: fine) {
    .cg-wiz-steps, .cg-wiz-nav, .cg-wiz-label { display: none !important; }
    .cg-wiz-pane { display: block !important; }
}

/* signup sticky summary + progress */
.cg-sticky { position: sticky; top: 3.6rem; }
@media (max-width: 768px), (pointer: coarse) { .cg-sticky { position: static; } }
.cg-progress { display: flex; align-items: center; gap: 0.45rem; font-size: 0.72rem; font-weight: 800; color: var(--cg-text-muted); margin: 0.4rem 0 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cg-progress b { color: var(--cg-primary); }
[data-theme="dark"] .cg-progress b { color: #fff; }

/* club hero + countdown */
.club-hero { border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, var(--cg-primary), var(--cg-primary-dark)); color: #fff; padding: 1.4rem 1.2rem; position: relative; margin-bottom: 0.9rem; }
.club-hero .eyebrow { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: var(--cg-accent); }
.club-hero h1 { color: #fff; margin: 0.2rem 0 0.5rem; }
.club-hero p { color: rgba(255,255,255,0.85); font-size: 0.85rem; margin: 0; }
.cg-countdown { display: flex; gap: 0.5rem; margin: 0.9rem 0; }
.cg-countdown div { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22); border-radius: 10px; padding: 0.45rem 0.6rem; min-width: 3.2rem; text-align: center; }
.cg-countdown b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.cg-countdown span { font-size: 0.58rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; }

/* field list search/filter bar */
.cg-filterbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 0.5rem 0 0.7rem; }
.cg-filterbar input { flex: 1 1 12rem; padding: 0.5rem 0.7rem; border: 1.5px solid var(--cg-border); border-radius: 9px; font-size: 0.9rem; background: var(--cg-surface); color: var(--cg-text); }
.cg-chip { background: var(--cg-surface-2); border: 1.5px solid var(--cg-border); color: var(--cg-text-muted); border-radius: 999px; font-size: 0.72rem; font-weight: 800; padding: 0.35rem 0.85rem; cursor: pointer; }
.cg-chip.on { background: var(--cg-primary); border-color: var(--cg-primary); color: #fff; }

/* rules assistant sheet */
.cg-rules-card { max-width: 34rem; width: 100%; height: min(78vh, 38rem); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.cg-rules-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem 0.6rem; border-bottom: 1px solid var(--cg-border); }
.cg-rules-title { font-weight: 900; font-size: 1rem; color: var(--cg-primary); display: flex; align-items: center; gap: 0.4rem; }
[data-theme="dark"] .cg-rules-title { color: #fff; }
.cg-rules-badge { background: var(--cg-accent); color: #fff; font-size: 0.58rem; font-weight: 900; letter-spacing: 0.08em; border-radius: 6px; padding: 0.12rem 0.4rem; }
.cg-rules-close { background: var(--cg-surface-2); border: none; color: var(--cg-text-muted); border-radius: 8px; width: 30px; height: 28px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cg-rules-ctx { flex: none; font-size: 0.72rem; font-weight: 700; color: var(--cg-text-muted); padding: 0.45rem 1rem 0; }
.cg-rules-msgs { flex: 1 1 0; min-height: 3.2rem; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0.7rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.cg-rules-hello { font-size: 0.8rem; color: var(--cg-text-muted); line-height: 1.5; flex: none; }
.cg-rules-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.cg-rules-chips .cg-chip { font-weight: 600; }
.cg-rules-q { align-self: flex-end; background: var(--cg-primary); color: #fff; border-radius: 14px 14px 4px 14px; padding: 0.55rem 0.85rem; font-size: 0.85rem; font-weight: 600; max-width: 85%; }
.cg-rules-a { align-self: flex-start; background: var(--cg-surface-2); border: 1px solid var(--cg-border); border-radius: 14px 14px 14px 4px; padding: 0.65rem 0.85rem; font-size: 0.82rem; line-height: 1.5; max-width: 92%; overflow-wrap: anywhere; }
.cg-rules-cite { margin-top: 0.45rem; font-size: 0.72rem; color: var(--cg-text-muted); }
.cg-rules-cite summary { cursor: pointer; font-weight: 700; }
.cg-rules-err { color: #c0392b; font-weight: 700; }
.cg-rules-ask { flex: none; display: flex; gap: 0.5rem; padding: 0.6rem 1rem; border-top: 1px solid var(--cg-border); background: var(--cg-surface); }
.cg-rules-ask textarea { flex: 1 1 0; min-width: 0; height: 3.4rem; resize: none; border: 1.5px solid var(--cg-border); border-radius: 10px; padding: 0.55rem 0.7rem; font-size: 0.88rem; font-family: inherit; background: var(--cg-surface); color: var(--cg-text); }
.cg-rules-send { width: auto !important; margin: 0; flex: 0 0 auto; min-width: 4.5rem; }
.cg-rules-foot { flex: none; font-size: 0.66rem; color: var(--cg-text-muted); padding: 0.5rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px)); text-align: center; border-top: 1px dashed var(--cg-border); }
.cg-rules-lr { display: inline-flex; align-items: center; gap: 0.3rem; background: #fff3d6; border: 1px solid #e8cf9a; color: #8a5a00; font-size: 0.62rem; font-weight: 800; border-radius: 999px; padding: 0.14rem 0.55rem; margin-bottom: 0.4rem; }
[data-theme="dark"] .cg-rules-lr { background: #3a2f14; border-color: #5c4a1e; color: #e8cf9a; }
.cg-rules-cap { display: flex; align-items: center; gap: 0.3rem; font-size: 0.66rem; font-weight: 700; color: #8a5a00; background: #fff3d6; border: 1px solid #e8cf9a; border-radius: 8px; padding: 0.3rem 0.5rem; margin-bottom: 0.45rem; }
[data-theme="dark"] .cg-rules-cap { background: #3a2f14; border-color: #5c4a1e; color: #e8cf9a; }
.cg-rules-tr { display: inline-flex; align-items: center; gap: 0.3rem; background: #eef1f6; border: 1px solid #c9d3e3; color: #33507a; font-size: 0.62rem; font-weight: 800; border-radius: 999px; padding: 0.14rem 0.55rem; margin: 0 0.3rem 0.4rem 0; }
[data-theme="dark"] .cg-rules-tr { background: #1e2c3f; border-color: #33507a; color: #9fb4d4; }
/* SG v2 (14 Nov 2026): caddie mode, facts card, citations, recap */
.cg-sg-tabs { display: inline-flex; background: var(--cg-surface-2); border: 1px solid var(--cg-border); border-radius: 999px; padding: 2px; gap: 2px; }
.cg-sg-tabs button { border: 0; background: none; color: var(--cg-text-muted); font: inherit; font-size: 0.72rem; font-weight: 800; padding: 0.32rem 0.7rem; border-radius: 999px; cursor: pointer; min-height: 32px; }
.cg-sg-tabs button.on { background: var(--cg-primary); color: #fff; }
.cg-sg-bar { flex: none; display: flex; align-items: center; gap: 0.4rem; padding: 0.45rem 1rem 0; flex-wrap: wrap; }
.cg-sg-hole { width: auto !important; flex: 0 0 auto; margin: 0 !important; font: inherit; font-size: 0.75rem; font-weight: 700; padding: 0.3rem 0.4rem; border: 1px solid var(--cg-border); border-radius: 8px; background: var(--cg-surface); color: var(--cg-text); min-height: 32px; }
.cg-sg-gps { font: inherit; font-size: 0.72rem; font-weight: 700; border: 1px solid var(--cg-border); background: var(--cg-surface); color: var(--cg-text-muted); border-radius: 999px; padding: 0.3rem 0.65rem; cursor: pointer; min-height: 32px; }
.cg-sg-gps.on { border-color: var(--cg-primary); color: var(--cg-primary); }
[data-theme="dark"] .cg-sg-gps.on { color: #9fe0b5; border-color: #3f8f5c; }
.cg-sg-baglink { margin-left: auto; font-size: 0.72rem; font-weight: 700; color: var(--cg-text-muted); }
.cg-sg-mic { flex: 0 0 auto; width: 2.6rem; border: 1.5px solid var(--cg-border); background: var(--cg-surface); border-radius: 10px; font-size: 1.05rem; cursor: pointer; }
.cg-sg-mic.on { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.18); }
.cg-sg-wait { font-size: 0.72rem; color: var(--cg-text-muted); margin-bottom: 0.35rem; }
.cg-sg-facts { border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 12px; padding: 0.55rem 0.65rem; margin-bottom: 0.5rem; }
.cg-sg-pl { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.cg-sg-pl-n { font-size: 1.9rem; font-weight: 900; line-height: 1; color: var(--cg-primary); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .cg-sg-pl-n { color: #9fe0b5; }
.cg-sg-pl-l { font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--cg-text-muted); }
.cg-sg-club { text-align: right; font-size: 1.05rem; font-weight: 900; color: var(--cg-text); }
.cg-sg-club span { display: block; font-size: 0.68rem; font-weight: 700; color: var(--cg-text-muted); }
.cg-sg-row { font-size: 0.74rem; margin-top: 0.4rem; color: var(--cg-text); line-height: 1.45; }
.cg-sg-row > span { color: var(--cg-text-muted); }
.cg-sg-adj { display: inline-block; font-size: 0.66rem; font-weight: 800; background: var(--cg-surface-2); border: 1px solid var(--cg-border); border-radius: 999px; padding: 0.1rem 0.5rem; margin: 0 0.25rem 0.25rem 0; }
.cg-sg-adj i { font-style: normal; font-weight: 600; color: var(--cg-text-muted); }
.cg-sg-hz { font-size: 0.72rem; }
.cg-sg-note { font-size: 0.68rem; color: var(--cg-text-muted); margin-top: 0.4rem; }
.cg-sg-note a, .cg-sg-baglink { color: inherit; font-weight: 800; text-decoration: underline; }
.cg-sg-say { line-height: 1.5; }
.cg-sg-cites { margin-top: 0.55rem; border-top: 1px dashed var(--cg-border); padding-top: 0.35rem; }
.cg-sg-cites-h { font-size: 0.62rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cg-text-muted); }
.cg-sg-cites .cg-rules-cite div { white-space: normal; margin-top: 0.3rem; }
.cg-sg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(4.6rem, 1fr)); gap: 0.35rem; margin-bottom: 0.5rem; }
.cg-sg-stats div { background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 10px; padding: 0.35rem 0.4rem; text-align: center; }
.cg-sg-stats b { display: block; font-size: 0.95rem; font-weight: 900; }
.cg-sg-stats span { font-size: 0.6rem; font-weight: 700; color: var(--cg-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
@media (max-width: 480px) { .cg-rules-card { height: min(90vh, 46rem); } }
@media (max-width: 420px) { .cg-rules-head { flex-wrap: wrap; gap: 0.4rem; } .cg-sg-tabs { order: 3; width: 100%; } .cg-sg-tabs button { flex: 1; } }

/* ==================================================================
   Compact buttons pass — tighter padding/type on the shared button
   system everywhere (web + app). Tap targets stay >= ~1.85rem.
   ================================================================== */
.btn { padding: 0.34rem 0.68rem !important; font-size: 0.74rem !important; margin-top: 0.3rem; border-radius: 8px; }
.btn.big, .btn-su { padding: 0.55rem 1rem !important; font-size: 0.85rem !important; }
.btn-sm { padding: 0.22rem 0.5rem !important; font-size: 0.64rem !important; border-radius: 7px; }
.btn-hero { padding: 0.6rem 1.25rem !important; font-size: 0.88rem !important; }
.rv-btn { padding: 0.42rem 0.75rem !important; font-size: 0.76rem !important; border-radius: 9px; }
.rv-btn.big { padding: 0.7rem 0.9rem !important; font-size: 0.9rem !important; }
.admin-toolbar-btn { font-size: 0.6rem !important; padding: 0.22rem 0.5rem !important; }
.pill-toggle, .seg-btn, .chip-toggle { padding: 0.24rem 0.6rem !important; font-size: 0.66rem !important; }
.signup-tab { padding: 0.4rem 0.7rem !important; font-size: 0.74rem !important; }
.afc button, .afc .btn-sm { font-size: 0.68rem !important; }
button.btn-sm { min-height: 1.55rem; }
.btn, .btn-sm, .rv-btn { min-height: 1.85rem; }
@media (max-width: 768px), (pointer: coarse) {
    .btn { padding: 0.42rem 0.7rem !important; font-size: 0.78rem !important; }  /* taller on touch */

    /* The compact pass above leaves buttons at 1.85rem -- about 30px. That is
       fine with a mouse and too small for a thumb: a golfer uses this
       one-handed, outdoors, often with a glove on, and 44px is the minimum
       both Apple and Google publish for a reliable tap. Raise the MINIMUM on
       touch widths only, so the compact look is kept on desktop.

       .rv-btn is declared here AND redefined inside seven pages, so this uses
       a class+attribute selector (0,2,0) to outrank every bare .rv-btn
       (0,1,0) whichever stylesheet wins the cascade.

       The :not() exempts the small chips -- bet chips, hole pickers, inline
       row actions. They set their own font-size inline, sit in dense rows,
       and are never the primary action. This rule only ever makes a control
       bigger; nothing shrinks. */
    .rv-btn:not([style*="font-size:0.5"]):not([style*="font-size:0.6rem"]):not([style*="font-size:0.62"]),
    .btn:not(.btn-sm):not(.admin-toolbar-btn):not([style*="font-size:0.5"]):not([style*="font-size:0.6rem"]):not([style*="font-size:0.62"]) {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
    }
    .rv-btn.big:not([style*="font-size:0.5"]):not([style*="font-size:0.6rem"]):not([style*="font-size:0.62"]) { min-height: 48px; }

    /* Why 0.5/0.6 and not "any inline font-size": measuring the live pages
       showed the dense chips all sit at 0.6-0.68rem while real buttons are
       0.7rem and up or set none at all. The first version of this rule
       exempted any inline font-size, which quietly skipped "Play a round"
       and "Post a tee time" -- two of the biggest buttons in the app --
       because their inline style happened to mention a size.

       Then 0.6 as a prefix was still too broad: it swallowed 0.66 and 0.68,
       which is where "Finish", "Send to attest", "Read" and "More news"
       live -- real actions, not chips. Only the icon chips (0.6rem, 0.62rem)
       and anything smaller are exempt now. */

    /* The marketing nav. "For golfers", "For clubs", "Demos" measured 12px
       tall: fine with a mouse, a coin-toss with a thumb. */
    .sp-nav-links a {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
        padding: 0 0.15rem;
    }

    /* Real navigation that renders as bare text: "Open a club portal",
       "MANAGE", "Export CSV". These measured 11-14px tall. */
    #rvClubPortalLink,
    .cg-text-action {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
        padding: 0.25rem 0.1rem;
    }
}
.cg-hide { display: none; }


/* ---------- dark mode: the personal pages ----------
   wall / rounds / friends / news / home are built from .rv-* and .card, which
   the original dark block never covered. Scoped under [data-theme="dark"] so
   light mode is byte-identical to before. */
[data-theme="dark"] .rv-card,
[data-theme="dark"] .card,
[data-theme="dark"] .su-card,
[data-theme="dark"] .afc,
[data-theme="dark"] .ipcard,
[data-theme="dark"] .strip,
[data-theme="dark"] .cc-card {
    background: var(--cg-surface) !important;
    border-color: var(--cg-border) !important;
    color: var(--cg-text);
}
[data-theme="dark"] .rv-sub,
[data-theme="dark"] .rv-lab,
[data-theme="dark"] .rvm-meta { color: var(--cg-text-muted); }
[data-theme="dark"] .rv-h,
[data-theme="dark"] h2.sec { color: var(--cg-text); }
[data-theme="dark"] .rv-in {
    background: var(--cg-surface-2);
    border-color: var(--cg-border);
    color: var(--cg-text);
}
[data-theme="dark"] .rv-in::placeholder { color: #6d7c8b; -webkit-text-fill-color: #6d7c8b; }
[data-theme="dark"] .rv-btn.ghost {
    background: var(--cg-surface-2);
    border-color: var(--cg-border);
    color: var(--cg-text);
}
/* the scorecard grid */
[data-theme="dark"] table.sc,
[data-theme="dark"] table.sc td,
[data-theme="dark"] table.sc th {
    background: var(--cg-surface);
    color: var(--cg-text);
    border-color: var(--cg-border);
}
[data-theme="dark"] table.sc td.sc-cell.scorer { background: #172c20; }
[data-theme="dark"] table.sc .tot,
[data-theme="dark"] table.sc thead th { background: var(--cg-surface-2); }
/* the round-summary rings keep their brand colours; only the plate behind
   them changes */
[data-theme="dark"] .cgw-card,
[data-theme="dark"] .cgw-body { background: var(--cg-surface); color: var(--cg-text); }

/* The crest is dark artwork on transparency. On a dark bar it disappears
   without the white chip it already gets elsewhere. */
[data-theme="dark"] .topbar-brand img,
[data-theme="dark"] .su-hero-logo,
[data-theme="dark"] #brandHeroLogo {
    background: #fff;
    border-radius: 6px;
    padding: 0.12rem;
}
[data-theme="dark"] .cg-theme-btn { background: rgba(255,255,255,.10); }


/* ---------- dark mode: club /home's own classes ---------- */
[data-theme="dark"] .cta,
[data-theme="dark"] .hl,
[data-theme="dark"] .quick a,
[data-theme="dark"] .rxd-menu,
[data-theme="dark"] .payto,
[data-theme="dark"] .btn.ghost,
[data-theme="dark"] .joincta .btn {
    background: var(--cg-surface) !important;
    color: var(--cg-text);
    border-color: var(--cg-border) !important;
}
[data-theme="dark"] .podium {
    background: var(--cg-surface-2) !important;
    border-color: var(--cg-border) !important;
    color: var(--cg-text);
}
/* the amber "how to pay" and countdown chips: keep the warning feel, invert it */
[data-theme="dark"] .cta .howto,
[data-theme="dark"] .cd {
    background: #3a2f12 !important;
    border-color: #6b5720 !important;
    color: #f2dfa8 !important;
}
[data-theme="dark"] .podium .t,
[data-theme="dark"] .podium .tp { color: var(--cg-text-muted); }
[data-theme="dark"] .btn.ghost,
[data-theme="dark"] .joincta .btn { color: var(--cg-primary); }

/* ---------- dark mode: the pinned "you" / winner row ----------
   This was dark-grey ink on the dark navy plate -- the one row a member
   most wants to find was the one row they could not read. Two rules were
   fighting each other and both were in this file:

     [data-theme="dark"] [style*="background:#fff"] { background: var(--cg-surface) !important; }
         a blanket rule that flattens ANY inline #fff* plate, and #fffbe6
         (the warm "you" tint) starts #fff, so the plate went dark;

     [data-theme="dark"] tr[style*="fffbe6"] td { color: #2a2a2a !important; }
         which then darkened the ink FOR a light plate that was no longer
         there.

   Neither is wrong on its own. Rather than weaken the blanket rule -- it
   is what rescues the white cards -- give the row a plate that belongs in
   dark mode and ink to match. [data-theme][attr] + element is (0,2,1),
   which out-specifies the blanket (0,2,0), so this wins on merit and not
   on being written later. */
[data-theme="dark"] tr[style*="fffbe6"],
[data-theme="dark"] tr[style*="FFFBE6"],
[data-theme="dark"] tr[style*="fff8e1"] { background: #3b3119 !important; }
[data-theme="dark"] tr[style*="fffbe6"] td,
[data-theme="dark"] tr[style*="FFFBE6"] td,
[data-theme="dark"] tr[style*="fff8e1"] td { color: #f4e8c8 !important; }
/* the gold star and the little "you" are inline-coloured for a light plate */
[data-theme="dark"] tr[style*="fffbe6"] td span,
[data-theme="dark"] tr[style*="fff8e1"] td span { color: #e8c874 !important; }


/* ---------- dark mode: the club leaderboard tables ---------- */
[data-theme="dark"] .leadtab th {
    color: var(--cg-text-muted);
    border-bottom-color: var(--cg-border);
}
[data-theme="dark"] .leadtab td {
    color: var(--cg-text);
    border-bottom-color: var(--cg-border);
}
/* .leadtab tinted rows: plate and ink are set together above. */
[data-theme="dark"] .flag,
[data-theme="dark"] .muted,
[data-theme="dark"] .rv-note { color: var(--cg-text-muted) !important; }


/* ---------- dark mode: global table striping ----------
   These stripes are applied to every table, not only .table-container ones,
   so the club leaderboard was light-plated while its text went light. */
[data-theme="dark"] th { background: var(--cg-surface-2); color: var(--cg-text-muted); }
[data-theme="dark"] tbody tr:nth-child(even) { background: var(--cg-surface-2); }
[data-theme="dark"] tbody tr:nth-child(odd) { background: var(--cg-surface); }
[data-theme="dark"] td { color: var(--cg-text); }
/* (the pinned-row ink rule is handled above, with its plate) */


/* ---------- dark mode: semantic ink ----------
   These are picked to read on white; on #16222e they vanish. Same meaning,
   lifted. --cg-primary is handled at runtime by ui.js applyBrand, because a
   club's colour is not known at build time. */
[data-theme="dark"] {
    --cg-success:        #4ade80;
    --cg-warn:           #e3b341;
    --cg-accent-deep:    #d9bd76;
    --cg-text-secondary: #9fb0c0;
}
/* --cg-accent-deep is lifted to a light gold above so it reads as TEXT on the
   dark page. Where it is a BACKGROUND (selected profile tab, accent buttons,
   the attest button, little step badges) the white ink on it fell to 1.8:1.
   Dark ink there instead. */
[data-theme="dark"] .pf-tab.on,
[data-theme="dark"] .btn-accent,
[data-theme="dark"] .eh-pill.zero,
[data-theme="dark"] .cta .badge,
[data-theme="dark"] [style*="background:var(--cg-accent-deep"] {
    color: #1d1a10 !important;
}
/* light chip + dark ink pairs invert together, or one half goes invisible */
[data-theme="dark"] .chip-soft,
[data-theme="dark"] [style*="background:#eef4ef"],
[data-theme="dark"] [style*="background:#dcfce7"],
[data-theme="dark"] [style*="background:#f4f8f5"],
[data-theme="dark"] [style*="background:#f4fbfd"],
[data-theme="dark"] [style*="background:#f8f9fa"],
[data-theme="dark"] [style*="background:#e8f4ec"],
[data-theme="dark"] [style*="background:#f6faf7"],
[data-theme="dark"] [style*="background:#cce5ff"],
[data-theme="dark"] [style*="background:#d4edda"],
[data-theme="dark"] [style*="background:#e2e3e5"],
[data-theme="dark"] [style*="background:#e9ecef"],
[data-theme="dark"] [style*="background:#eef3ef"],
[data-theme="dark"] [style*="background:#eef2ee"],
[data-theme="dark"] [style*="background:#f6f8fb"],
[data-theme="dark"] [style*="background:#f0fff4"],
[data-theme="dark"] [style*="background:#fee2e2"] {
    background: var(--cg-surface-2) !important;
    color: var(--cg-text) !important;
}
/* Dark mode lifts --cg-accent-deep to a light gold so it reads as TEXT on a
   dark panel; as a button fill under white text it fell to 1.8:1 (Ask SG,
   Gross/Net/Points, the sponsor logo button). Dark ink on the gold instead. */
[data-theme="dark"] [style*="background:var(--cg-accent-deep)"] { color: #1a1408 !important; }
/* same for --cg-primary-deep, which dark mode lifts for text (Go unlimited) */
[data-theme="dark"] [style*="background:var(--cg-primary-deep)"] { color: #111 !important; }
/* A <label> styled as a button (the sponsor "logo" upload) keeps its own
   white ink: the site-wide label color rule above is !important too. */
:root:not([data-theme="dark"]) label.btn-sm[style*="color:#fff"] { color: #fff !important; }
/* two more inline inks chosen against white (Apply page, Flight headings) */
[data-theme="dark"] [style*="color:#33413a"],
[data-theme="dark"] [style*="color:#1f2a22"],
[data-theme="dark"] [style*="color:#3f4c44"],
[data-theme="dark"] [style*="color:#162b42"],
[data-theme="dark"] [style*="color:#163d20"] { color: var(--cg-text) !important; }
[data-theme="dark"] [style*="color:#495057"] { color: var(--cg-text-secondary) !important; }
/* Results page shot chips (birdies, eagles, streaks): pastel cards whose
   names were lifted to light text by the rules below. One dark card each,
   the colored border still says which kind it is. */
/* Achievements and Streaks on the live board (10 Nov 2026): a wrapping flex
   row let the chips on the last line grow up to 12rem while the full lines
   stayed narrower. A grid keeps every chip the same width, last line too. */
.ach-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.3rem; margin-bottom: 0.4rem; }
.ach-row > .ach-chip { min-width: 0 !important; max-width: none !important; }
[data-theme="dark"] .ach-chip { background: var(--cg-surface-2) !important; }
[data-theme="dark"] .ach-chip .ach-lab { color: var(--cg-accent-deep) !important; }
/* the score-sync line on Scoring & results: its fill is set from JS (cssText),
   which the attribute rules cannot see */
[data-theme="dark"] .sg-sync-banner { background: var(--cg-surface-2) !important; border-color: var(--cg-border) !important; }


/* ---------- dark mode: inline muted inks ----------
   Chosen against white and applied inline, so no ordinary selector reaches
   them. Matched on the literal they carry; light mode is untouched. */
[data-theme="dark"] [style*="color:#44554a"],
[data-theme="dark"] [style*="color:#44524a"],
[data-theme="dark"] [style*="color:#4a5d4f"],
[data-theme="dark"] [style*="color:#5d7264"],
[data-theme="dark"] [style*="color:#3d5245"],
[data-theme="dark"] [style*="color:#7a8b7e"],
[data-theme="dark"] [style*="color:#5d6b60"],
[data-theme="dark"] [style*="color:#41514a"],
[data-theme="dark"] [style*="color:#8a9a8e"],
[data-theme="dark"] [style*="color:#666"],
[data-theme="dark"] [style*="color:#777"],
[data-theme="dark"] [style*="color:#888"],
[data-theme="dark"] [style*="color:#8a978d"],
[data-theme="dark"] [style*="color:#5d6e61"],
[data-theme="dark"] [style*="color:#667;"] { color: var(--cg-text-muted) !important; }
[data-theme="dark"] [style*="color:#856004"],
[data-theme="dark"] [style*="color:#856404"],
[data-theme="dark"] [style*="color:#6b5310"],
[data-theme="dark"] [style*="color:#8a5a00"],
[data-theme="dark"] [style*="color:#6d5200"],
[data-theme="dark"] [style*="color:#8a6d1a"],
[data-theme="dark"] [style*="color:#b8860b"] { color: var(--cg-warn) !important; }
/* inline alert reds: pale pink boxes went dark, red ink on dark was ~2.8:1
   (results page "Closest to the Pin", the competition box, 13 Nov) */
[data-theme="dark"] [style*="background:#fdf3f2"],
[data-theme="dark"] [style*="background:#fdecea"] { background: #3d1d1b !important; }
[data-theme="dark"] [style*="color:#c5221f"] { color: #ff9b8f !important; }
[data-theme="dark"] [style*="color:#16341f"],
[data-theme="dark"] [style*="color:#22301f"],
[data-theme="dark"] [style*="color:#1b2735"] { color: var(--cg-text) !important; }


/* ---------- dark mode: the scorecard ----------
   These must outrank the pages' own `table.sc td.sc-cell` (0,2,2) and
   `.rvm-chip.tappable` rules, so each selector carries at least as many
   classes plus the theme attribute. */
[data-theme="dark"] table.sc th,
[data-theme="dark"] table.sc td { border-color: #2f4256; }
[data-theme="dark"] table.sc th { background: #1b2b3b; color: var(--cg-text); }
[data-theme="dark"] table.sc td.sc-cell { background: var(--cg-surface); color: var(--cg-text); }
[data-theme="dark"] table.sc td.sc-cell.scorer { background: #16303f; }
[data-theme="dark"] table.sc td.sc-cell.filled { color: #fff; }
[data-theme="dark"] table.sc td.tot { background: #1b2b3b; color: var(--cg-text); }
[data-theme="dark"] table.sc td.nm { background: var(--cg-surface); color: var(--cg-text); }
/* the par / stroke-index / yardage rows sit above the players and were the
   faintest thing on the card */
[data-theme="dark"] table.sc tr td:not(.sc-cell):not(.tot):not(.nm),
[data-theme="dark"] table.sc tbody tr:nth-child(even) td,
[data-theme="dark"] table.sc tbody tr:nth-child(odd) td { background: var(--cg-surface); }
[data-theme="dark"] table.sc tbody tr:nth-child(even) td.tot,
[data-theme="dark"] table.sc tbody tr:nth-child(odd) td.tot { background: #1b2b3b; }

/* per-hole mobile cards */
[data-theme="dark"] .rvm-sum,
[data-theme="dark"] .rvm-hole { background: var(--cg-surface); border-color: var(--cg-border); color: var(--cg-text); }
[data-theme="dark"] .rvm-sum .rvm-p { border-bottom-color: var(--cg-border); }
[data-theme="dark"] .rvm-hhead { background: #1b2b3b; }
[data-theme="dark"] .rvm-hmeta { color: var(--cg-text-muted); }
[data-theme="dark"] .rvm-hmeta b { color: var(--cg-text); }
[data-theme="dark"] .rvm-chip { border-color: var(--cg-border); }
[data-theme="dark"] .rvm-chip.tappable { background: #16303f; }
[data-theme="dark"] .rvm-chip .rvm-name { color: var(--cg-text-muted); }
[data-theme="dark"] .rvm-chip .rvm-score.empty { color: #48596a; }


/* ---------- scorecard tints ----------
   Were inline literals on the card, which no stylesheet could override. Light
   values are exactly what they replaced, so the light card is unchanged. */
:root {
    --cg-card-head: #dde3ec;
    --cg-card-row:  #f4f6fa;
    --cg-card-tot:  #cde5d4;
    --cg-panel:     #f7f8fb;
}
[data-theme="dark"] {
    --cg-card-head: #1b2b3b;
    --cg-card-row:  #1a2836;
    --cg-card-tot:  #17302a;
    --cg-panel:     #16222e;
}
/* White on gold is 1.8:1. The attest button is the one thing on this card a
   golfer must not miss, so it takes dark ink on the gold instead. */
[data-theme="dark"] #rvAttestHdr { color: #1b2735 !important; }

/* ---------- club portal: member directory ----------
   An id selector on purpose: this grid belongs to one element on one page,
   and a class here would reach pages I am not looking at.

   minmax(min(100%,17rem),1fr) did not hold its minimum -- a 430px phone
   still got two 180px columns, and the third button fell off the edge of
   every card. A media query is duller and does what it says. */
#portalDirectoryResults {
    display: grid;
    gap: 0.6rem;
    align-items: start;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}
@media (max-width: 560px), (pointer: coarse) {
    #portalDirectoryResults { grid-template-columns: 1fr; }
}


/* ---------------------------------------------------------------------
   Narrow phones: six things compete for the top bar -- logo, wordmark, an
   admin badge, the signed-in chip, the GPS toggle and the hamburger. The
   rule above gives each non-brand item max-width:30vw with overflow:hidden,
   so on a 390px screen the result was "Sabio G" and a GPS pill sliced in
   half. The wordmark is the only element up there that carries no function
   (the logo next to it is the same link home), so it is the one that goes.
   --------------------------------------------------------------------- */
@media (max-width: 430px), (pointer: coarse) {
    .topbar-brand span { display: none; }
    .site-topbar > *:not(.topbar-brand):not(.nav-toggle):not(.site-nav) {
        max-width: 38vw;
    }
}

/* unread direct messages, on the Messages nav link */
.nav-dm-badge { display:inline-block; margin-left:0.35rem; background:#d4453a;
  color:#fff; border-radius:999px; font-size:0.6rem; font-weight:800;
  line-height:1; padding:0.16rem 0.36rem; vertical-align:middle; }
.nav-dm-badge[hidden] { display:none; }


/* ---------------------------------------------------------------------
   Card language, shared.

   These were defined inside profile.html only. The member portal reuses
   the same classes so the two profiles read as one product, which means
   the rules have to live where both pages can see them. A page that wants
   to differ can still override: its own <style> comes after this file.
   --------------------------------------------------------------------- */
.rv-card { background:#fff; border:2px solid var(--cg-green-border); border-radius:14px;
           padding:0.9rem 1rem; margin-bottom:0.7rem; }
.rv-h    { font-size:1.05rem; font-weight:800; color:var(--cg-primary); margin:0.2rem 0 0.6rem; }
.rv-sub  { font-size:0.72rem; color:#7a8b7e; }
.rv-lab  { font-size:0.64rem; font-weight:700; color:#7a8b7e; text-transform:uppercase;
           letter-spacing:.04em; margin:0.5rem 0 0.2rem; }
.rv-in   { width:100%; box-sizing:border-box; font-size:0.85rem; padding:0.5rem 0.6rem;
           border:2px solid #cfe0d3; border-radius:8px; background:#fff; }
/* wrap at EVERY width, not only under 640px. Children are flex:1
   (basis 0) so they never wrap on their own; only an item with a
   deliberate full-width basis does -- and when the row could not
   wrap, such an item squeezed its siblings to nothing. */
.rv-row  { display:flex; flex-wrap:wrap; gap:0.5rem; align-items:flex-end; }
.rv-row > div { flex:1; }
/* The four side games are one set and should read as one. flex:1 alone is
   basis 0, so four of them squeeze to 90px on a phone and stretch to 240
   on a desktop-width viewport; a real basis makes them reflow 4-up, 2-up,
   1-up instead of distorting. Scoped to the games card so no other row
   changes shape. */
#rvGamesCard .rv-row > div { flex: 1 1 8rem; }
/* .rv-row bottom-aligns its cells, which is right for two controls of the
   same height and wrong for four games whose help text runs to different
   lengths -- the four inputs sat on four different lines. Top-align so the
   labels and the boxes line up across the row. */
#rvGamesCard .rv-row { align-items: flex-start; }
.rv-btn  { border:0; border-radius:10px; padding:0.65rem 1.1rem; font-size:0.85rem; font-weight:800;
           cursor:pointer; background:var(--cg-primary); color:#fff; }
.rv-btn.ghost { background:var(--cg-primary-soft); color:var(--cg-primary); }
.rv-btn.big   { width:100%; padding:0.9rem; font-size:1rem; }

/* The player QR sits beside the name on the portal. Left to its own
   devices it draws at full width and opens a hole in the middle of the
   card, which is most of what made that page look unfinished. */
/* The member portal is a profile page, so it reads like one: a column,
   not the full width of a desktop monitor. /profile uses 44rem and the
   client's note was simply that the two did not match. */
body[data-page="portal"] .container { max-width: 44rem; margin-left: auto; margin-right: auto; }

#cgMemberQrSlot { max-width: 11.5rem; }
#cgMemberQrSlot > #cgMemberQr { padding: 0.55rem !important; }
/* The header above the code already says what it is for; repeating it in
   three lines of small print is what made this block taller than the whole
   left-hand column. Kept on a phone, where the code is actually shown. */
#cgMemberQrSlot #cgMemberQrHint { display: none; }
@media (max-width: 640px), (pointer: coarse) { #cgMemberQrSlot #cgMemberQrHint { display: block; } }
#cgMemberQrSlot > #cgMemberQr { margin-top: 0 !important; }
/* qrcode-1.4.4 draws an <svg>, not a canvas or an img -- a selector for the
   other two matches nothing and the code silently keeps its full size. */
#cgMemberQrSlot #cgMemberQrImg svg,
#cgMemberQrSlot #cgMemberQrImg canvas,
#cgMemberQrSlot #cgMemberQrImg img { width: 100px !important; height: 100px !important;
                                     display: block; margin: 0 auto; }
#cgMemberQrSlot #cgMemberQrHint { font-size: 0.58rem; line-height: 1.35; }
@media (max-width: 640px), (pointer: coarse) {
  #cgMemberQrSlot { max-width: none; width: 100%; }
}

/* ---------------------------------------------------------------------
   iOS Safari zoom  (ios-zoom)
   ---------------------------------------------------------------------
   Wangombe, on an iPhone at Woodlands: "the page is being chopped off on
   the sides - right and left". Another golfer called it "bleeding".

   It is not a layout overflow. At a 390px viewport the pages measure
   scrollWidth 390 - nothing is too wide. What happens is that iOS Safari
   ZOOMS THE WHOLE PAGE IN when you focus a text control whose font-size is
   under 16px, and it does not zoom back out when you leave the field. From
   then on the page is magnified and you see the middle of it, cut off at
   both edges. That is exactly what the screenshot shows, and it is why it
   never reproduces in a desktop browser.

   153 controls across the app were under 16px. The round-setup page already
   carried font-size:16px inline on every input - somebody hit this before
   and fixed one page by hand. This is the same fix in one place.

   Scoped to small screens so nothing on desktop changes, and limited to
   controls that actually open a keyboard. !important because a good number
   of these sizes are inline style attributes. */
@media (max-width: 820px), (pointer: coarse) {
  /* ONE line. Breaking a :not() chain across lines puts whitespace between
     the parts, and whitespace in a CSS selector is a DESCENDANT combinator --
     it silently became "a :not() inside an input" and matched almost nothing.
     The count only went from 153 to 129, which is how I noticed. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ---------------------------------------------------------------------
   mobile-form-stack
   ---------------------------------------------------------------------
   Admin forms are built with inline `grid-template-columns` and flex rows
   with no wrap. On a desktop that is six neat columns; on a phone it is a
   row that runs off the right edge, which reads as the page "bleeding".

   Phones get one field per row. Small tablets get two. Nothing changes
   above 900px, so every desktop layout stays exactly as it was. */
@media (max-width: 640px), (pointer: coarse) {
  .form-section form[style*="grid-template-columns"],
  .form-section div[style*="grid-template-columns"],
  .rv-card form[style*="grid-template-columns"],
  .rv-card div[style*="grid-template-columns"],
  .modal form[style*="grid-template-columns"],
  .modal div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  /* A row of fields that cannot wrap is the other half of the problem. */
  .form-row, .rv-row { flex-wrap: wrap !important; }
  .form-row > *, .rv-row > * { min-width: 0; }
  /* Flex and grid children default to min-width:auto, so one long value
     refuses to shrink and drags the whole row past the viewport. */
  .form-section [style*="display:flex"] > *,
  .form-section [style*="display: flex"] > *,
  .rv-card [style*="display:flex"] > * { min-width: 0; }
  /* Where one field stops and the next starts. */
  .form-section form[style*="grid-template-columns"] > .form-group + .form-group,
  .form-section div[style*="grid-template-columns"] > .form-group + .form-group {
    border-top: 1px solid var(--cg-green-border, #e3ece5);
    padding-top: 0.45rem;
  }
  /* A label that wraps onto two lines above a full-width control reads far
     better than one squeezed beside it. */
  .form-section .form-group > label { display: block; margin-bottom: 0.15rem; }
}
@media (min-width: 641px) and (pointer: fine) and (max-width: 900px) {
  .form-section form[style*="grid-template-columns"],
  .form-section div[style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* A table that must stay a table scrolls inside its own box rather than
   taking the page with it. */
@media (max-width: 900px), (pointer: coarse) {
  .form-section table, .rv-card table { max-width: 100%; }
}

/* ---------------------------------------------------------------------
   touch-and-type-floor
   ---------------------------------------------------------------------
   An audit of all three portals at phone and desktop width found 578 tap
   targets under 40px -- on every single page -- and 38 different font
   sizes, the commonest being 10.9, 11.5 and 12.5px.

   Apple asks for 44pt, Google for 48dp. This is also a game played
   outdoors in sunlight with a glove on, so small text is not a style
   choice, it is a thing people cannot read.

   Phones only. Nothing above 640px moves, so every desktop layout is
   untouched. */
@media (max-width: 640px), (pointer: coarse) {

  /* ---- the type floor --------------------------------------------- */
  /* Nothing drops below 12.5px. Captions and hints were running at 9.3
     to 11.5px, which is unreadable on a bright fairway. */
  body, p, span, div, td, th, li, label, summary, a, small {
    font-size: max(12.5px, 1em);
  }
  /* The ones that set their own small size inline or by class, named so
     the rule is deliberate rather than a blanket !important. */
  .rv-sub, .rv-gdesc, .rv-fmt-s, .meta, .hint, .pf-rt, .ff-tag, .df-tag,
  .pa-flag, .form-group > label, .rv-lab {
    font-size: 12.5px !important;
    line-height: 1.45;
  }
  /* A label is a label: slightly smaller than its field, never tiny. */
  .rv-lab { font-size: 12.5px !important; letter-spacing: 0.01em; }

  /* ---- the touch floor -------------------------------------------- */
  /* 44px for anything you tap. min-height rather than height so a button
     that is already taller keeps its size, and inline-flex centring so
     short labels do not sit at the top of a taller box. */
  button, .btn, .rv-btn, a.btn, [role="button"],
  input[type="submit"], input[type="button"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
  }
  /* Full-width action buttons stay full width. */
  .rv-btn.big, .btn.big { width: 100%; }

  select, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
  textarea {
    min-height: 44px;
  }
  textarea { min-height: 72px; }

  /* A checkbox or radio you have to hit with a fingertip. The control
     itself stays its native size; the LABEL around it becomes the target. */
  input[type="checkbox"], input[type="radio"] {
    width: 20px; height: 20px; flex: 0 0 auto;
  }
  label:has(> input[type="checkbox"]),
  label:has(> input[type="radio"]),
  .rv-optrow {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Icon-only buttons in table rows -- the smallest targets in the app. */
  td button, td .btn, td a, .pf-rt button, .pa-ut button {
    min-height: 40px;
    min-width: 40px;
  }

  /* Links inside running text are not buttons; do not stretch them. */
  p a, .rv-sub a, li a { min-height: 0; display: inline; }
}

/* --------------------------------------------------------------------
   touch-floor-round-2
   --------------------------------------------------------------------
   After the first pass the phone still measured 202 tap targets under
   40px and 293 characters under 12.5px. Two causes, both specific:

   1. inline style="font-size:0.6rem" and friends beat a stylesheet rule.
      Same trick that worked for grid-template-columns: match the inline
      value itself. 0.5-0.7rem is 8-11.2px, all of it below the floor.
   2. icon-only buttons came out 35px WIDE and 44 tall. Apple asks for
      44 square, not 44 in one direction. */
@media (max-width: 640px), (pointer: coarse) {
  [style*="font-size:0.5"], [style*="font-size: 0.5"],
  [style*="font-size:0.6"], [style*="font-size: 0.6"],
  [style*="font-size:0.7"], [style*="font-size: 0.7"],
  [style*="font-size:9px"], [style*="font-size: 9px"],
  [style*="font-size:10"], [style*="font-size: 10"],
  [style*="font-size:11"], [style*="font-size: 11"] {
    font-size: 12.5px !important;
  }

  button, .btn, .rv-btn, [role="button"],
  input[type="submit"], input[type="button"] { min-width: 44px; }

  /* The topbar: brand link and the icon buttons beside it. */
  .site-topbar a, .site-topbar button, header a, header button,
  nav a, nav button { min-height: 44px; display: inline-flex;
                      align-items: center; }

  /* A bottom tab bar is thumb territory -- the most-used control in the
     app and the one people hit while walking. */
  .cg-tabbar a, .cg-tabbar button, [class*="tabbar"] a, [class*="tabbar"] button {
    min-height: 48px; min-width: 48px;
  }
}

/* =====================================================================
   sabio-design-system
   =====================================================================
   One scale for spacing, one for type, one radius set, one shadow set.
   Applied to the shared rv-* components so every screen that already uses
   them improves at once.
   ===================================================================== */
:root {
  /* spacing: a 4px base, because every ad-hoc value in the app rounds to it */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;
  --sp-4: 1rem;     --sp-5: 1.5rem;   --sp-6: 2rem;

  /* type: 12.5px floor matches the mobile rule, so nothing fights it */
  --fs-xs: 0.78rem; --fs-sm: 0.875rem; --fs-md: 1rem;
  --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(16,24,40,.06);
  --sh-2: 0 4px 12px rgba(16,24,40,.08);
  --sh-focus: 0 0 0 3px rgba(22,43,66,.18);

  --ink:      #15202b;   /* the colour a VALUE is */
  --ink-mute: #68788a;   /* the colour a LABEL is */
}

/* ---- card ---------------------------------------------------------- */
/* A 2px border on a white card reads as a box to fill in. One hairline
   and a soft shadow reads as a surface. */
.rv-card {
  border: 1px solid #e6eaef;
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--sh-1);
}

/* ---- headings and labels ------------------------------------------- */
.rv-h { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.01em;
        margin: 0 0 var(--sp-3); }

/* The label was 0.64rem, bold, uppercase, wide-tracked and dark. That is
   four kinds of emphasis on the quietest thing on the card. */
.rv-lab {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: none;
  letter-spacing: 0;
  margin: var(--sp-3) 0 var(--sp-1);
}
.rv-sub { font-size: var(--fs-xs); color: var(--ink-mute); line-height: 1.5; }

/* ---- inputs -------------------------------------------------------- */
.rv-in {
  font-size: var(--fs-sm);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid #d4dbe3;
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.rv-in:focus, .rv-in:focus-visible {
  outline: none;
  border-color: var(--cg-primary);
  box-shadow: var(--sh-focus);
}
.rv-in::placeholder { color: #9aa7b4; }

/* ---- buttons ------------------------------------------------------- */
.rv-btn {
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: var(--sh-1);
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease;
}
.rv-btn:active { transform: translateY(1px); box-shadow: none; }
.rv-btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.rv-btn.ghost {
  background: #fff;
  color: var(--cg-primary);
  border: 1px solid #d4dbe3;
  box-shadow: none;
}
.rv-btn.ghost:hover { border-color: var(--cg-primary); }
/* The one thing on the screen you are meant to press. */
.rv-btn.big {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-md);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
}

/* ---- the round-setup player card ----------------------------------- */
/* Each player was name on one line, three fields on the next, email on a
   third -- three rows and a lot of air for what is really one person. */
.rv-player {
  border: 1px solid #e6eaef;
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  background: #fff;
}
.rv-player .rv-lab { margin-top: var(--sp-2); }
/* display:flex lived in the page's own copy of this rule. Removing the
   duplicate took the flex with it and every field fell onto its own line. */
.rv-player .rv-p-meta { display: flex; gap: var(--sp-2); align-items: flex-end; }
.rv-player .rv-p-meta > * { flex: 1; min-width: 0; }
.rv-player .rv-p-meta .narrow { flex: 0 0 5rem; }

/* A label on a player card is a label like any other. */
.rv-player label {
  display: block;
  font-size: var(--fs-xs) !important;
  font-weight: 600 !important;
  color: var(--ink-mute) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  margin: var(--sp-2) 0 var(--sp-1) !important;
}

/* P1 is the person already signed in: one line, not a form. */
.rv-p-you {
  display: flex; align-items: center; gap: var(--sp-2);
  flex-wrap: wrap; margin-bottom: var(--sp-1);
}
.rv-p-you .who { font-weight: 700; color: var(--ink); }
.rv-p-you .hi  { color: var(--ink-mute); font-size: var(--fs-xs); }
.rv-p-you .edit {
  margin-left: auto; background: none; border: 0; padding: var(--sp-1);
  color: var(--cg-primary); font-weight: 700; font-size: var(--fs-xs);
  cursor: pointer; text-decoration: underline;
}

/* Gender and email, out of the way until somebody wants them. */
.rv-pmore { margin-top: var(--sp-2); }
.rv-pmore > summary {
  cursor: pointer; list-style: none;
  font-size: var(--fs-xs); font-weight: 600; color: var(--cg-primary);
  padding: var(--sp-1) 0;
}
.rv-pmore > summary::-webkit-details-marker { display: none; }
.rv-pmore > summary::before { content: "+ "; font-weight: 800; }
.rv-pmore[open] > summary::before { content: "\2212 "; }

/* ---- the wizard header reads as progress --------------------------- */
.cg-wiz-steps { display: flex; gap: var(--sp-1); }
.cg-wiz-steps span {
  flex: 1; height: 4px; border-radius: var(--r-pill);
  background: #e6eaef;
}
.cg-wiz-steps span.cur  { background: var(--cg-primary); }
.cg-wiz-steps span.done { background: var(--cg-primary); opacity: .45; }
.cg-wiz-label { color: var(--ink-mute) !important; font-weight: 700 !important; }

/* ---- the error banner is read by GOLFERS --------------------------- */
/* It said "Sabio Golf hit an error on this page: unhandled promise:
   rows.map is not a function -- Screenshot this and send it over", in dark
   red monospace pinned over the app. That is a developer's console shown
   to a customer, and it is exactly the thing that earns a one-star review.
   The detail still has to be reachable, so it stays -- just not shouted. */
[data-cg-error] {
  font: 600 var(--fs-xs)/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  background: #fff4e5 !important;
  color: #7a4f01 !important;
  border-bottom: 1px solid #f0d9a8;
  padding: var(--sp-3) var(--sp-4) !important;
  /* In the app the page runs under the phone's status bar: the first line
     ("Something went wrong") sat behind the clock and battery (James,
     17 Nov 2026). It now starts below the bar; --cg-sat is the status bar
     height the app measures (0 on the website). */
  top: var(--cg-sat, env(safe-area-inset-top, 0px)) !important;
  padding-left: calc(var(--sp-4) + env(safe-area-inset-left, 0px)) !important;
  padding-right: calc(var(--sp-4) + 2.2rem + env(safe-area-inset-right, 0px)) !important;
  box-shadow: var(--sh-1);
}
[data-cg-error] .cg-err-x {
  position: absolute; right: calc(0.4rem + env(safe-area-inset-right, 0px));
  top: 0.4rem;
  width: 2rem; height: 2rem; border: 0; border-radius: 999px;
  background: rgba(122, 79, 1, 0.12); color: #7a4f01; font: 700 1rem/1 system-ui, sans-serif; cursor: pointer;
}


/* ---------------------------------------------------------------------
   wizard-nav-sticky
   ---------------------------------------------------------------------
   The button that moves you forward should never be something you have to
   go looking for. With four players on step 2 it was below the fold, under
   a Cancel button that looked more important than it did. */
.cg-wiz-nav {
  position: sticky;
  bottom: 0;
  z-index: 5;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding: var(--sp-2) 0 var(--sp-3);
  background: linear-gradient(to bottom, rgba(244,247,245,0), var(--cg-bg, #f4f7f5) 28%);
}
/* Previous was visibility:hidden on step 1 -- invisible but still holding
   half the row, which is why Next was a half-width button next to a gap. */
.cg-wiz-nav .btn#rvWizBack[hidden] { display: none !important; }
.cg-wiz-nav .btn#rvWizNext { flex: 2; font-weight: 800; }

@media (max-width: 640px), (pointer: coarse) {
  /* Clear of the tab bar, which is fixed. */
  .cg-wiz-nav { bottom: 56px; }
}

/* ---- the format choices --------------------------------------------- */
/* A fixed icon column, so three different emoji do not give three
   different left edges to the three titles. */
.rv-fmt .rv-fmt-i {
  flex: 0 0 1.75rem;
  text-align: center;
  font-size: 1.25rem;
}
.rv-fmt {
  border-radius: var(--r-md);
  padding: var(--sp-3);
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
/* Chosen should be unmistakable at arm's length in sunlight. */
.rv-fmt.on {
  border-color: var(--cg-primary) !important;
  background: var(--cg-primary-soft, #eef7f0) !important;
  box-shadow: inset 0 0 0 1px var(--cg-primary);
}
.rv-fmt.on::after {
  content: "\2713";
  margin-left: auto;
  align-self: center;
  font-weight: 900;
  color: var(--cg-primary);
}


/* A quiet way out. Cancel was a full-width slab the same weight as Next,
   sitting between the form and the button you came to press. */
.rv-cancel {
  display: block;
  width: 100%;
  margin: var(--sp-3) 0 0;
  padding: var(--sp-2);
  background: none;
  border: 0;
  color: var(--ink-mute);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.rv-cancel:hover { color: var(--cg-primary); }
@media (max-width: 640px), (pointer: coarse) { .rv-cancel { min-height: 44px; } }


/* Three equal choices should be three equal buttons. "Stroke play" wrapped
   to two lines while the other two did not. */
.rv-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-1);
  margin-top: var(--sp-1);
}
.rv-seg > button {
  width: 100%;
  padding: var(--sp-2) var(--sp-1);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The one that is chosen, unmistakably. */
.rv-seg > button.on, .rv-btn.ghost.on {
  background: var(--cg-primary-soft, #eef7f0) !important;
  border-color: var(--cg-primary) !important;
  color: var(--cg-primary) !important;
  box-shadow: inset 0 0 0 1px var(--cg-primary);
}
/* Going back a step is minor. With Next hidden on step 3 it was taking the
   whole row as a dark slab underneath Start round. */
.cg-wiz-nav .rv-btn.ghost#rvWizBack { flex: 1; min-height: 44px; }


/* ---------------------------------------------------------------------
   rv-nowbar -- which hole you are on
   ---------------------------------------------------------------------
   The scorecard is 22 columns wide and a phone shows five of them, so on
   the 14th green you open the app to holes 1-5 and have to swipe across to
   find the one you want. Eighteen times, one-handed, with a glove on. */
.rv-nowbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--cg-primary);
  color: #fff;
  box-shadow: var(--sh-2);
}
.rv-nowbar .nb-l { display: flex; flex-direction: column; min-width: 0; }
.rv-nowbar .nb-h { font-size: var(--fs-md); font-weight: 800; line-height: 1.15; }
.rv-nowbar .nb-m { font-size: var(--fs-xs); opacity: .85; }
.rv-nowbar .nb-b {
  margin-left: auto;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-4);
  background: #fff;
  color: var(--cg-primary);
  border: 0;
  border-radius: var(--r-sm);
  font-weight: 800;
  font-size: var(--fs-sm);
  white-space: nowrap;
  cursor: pointer;
}

/* The column that bar is talking about. */
table.sc td.now, table.sc th.now {
  background: #fff6d8 !important;
  box-shadow: inset 1px 0 0 var(--cg-accent-deep, #b8860b),
              inset -1px 0 0 var(--cg-accent-deep, #b8860b);
}
table.sc th.now { font-weight: 900; }
/* dark mode: the pale yellow column kept the card's light text (2:1) */
[data-theme="dark"] table.sc td.now, [data-theme="dark"] table.sc th.now { background: #3a3218 !important; }


/* ---------------------------------------------------------------------
   sticky-name-column
   ---------------------------------------------------------------------
   22 columns, five of them visible. Swipe to hole 14 and the names are
   gone, leaving four rows of numbers belonging to nobody. */
#rvScoreTable table.sc td.nm,
#rvScoreTable table.sc tr > th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  /* Opaque, or the cells scrolling underneath show straight through. */
  background: #fff;
  box-shadow: 2px 0 0 #d9e5dc;
}
#rvScoreTable table.sc tr > th:first-child { background: #e8f2ec; z-index: 4; }
[data-theme="dark"] #rvScoreTable table.sc td.nm { background: var(--cg-surface); }
[data-theme="dark"] #rvScoreTable table.sc tr > th:first-child { background: #1b2b3b; }

/* The highlighted column must not paint over the pinned names. */
#rvScoreTable table.sc td.nm.now,
#rvScoreTable table.sc th.now:first-child { background: #fff !important; }

/* A flex child will not shrink below its content unless you say so, and
   these children are nowrap -- so when the pair did not fit, the text ran
   underneath the button rather than the layout giving way. */
.rv-nowbar { gap: var(--sp-2); padding: var(--sp-2); }
.rv-nowbar .nb-l { flex: 1 1 auto; min-width: 0; }
.rv-nowbar .nb-h { white-space: nowrap; }
.rv-nowbar .nb-m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* width:auto against a phone-width rule that makes every .btn 100% wide:
   that is what was taking the whole bar and collapsing the hole number to
   zero behind it. */
.rv-nowbar .nb-b {
  flex: 0 0 auto;
  width: auto !important;
  padding: var(--sp-2) var(--sp-3);
}


/* Where you are, versus what you can do. Wall/Golf are tabs and Play/Tee
   time are actions; as four loose buttons with two of them solid, two of
   them read as the selected tab. */
.wall-tabset {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: #e9eef1;
}
.wall-tabset > .rv-btn {
  border: 0 !important;
  box-shadow: none !important;
  border-radius: var(--r-pill) !important;
}
.wall-tabset > .rv-btn.ghost { background: transparent !important; }
[data-theme="dark"] .wall-tabset { background: rgba(255,255,255,.08); }


/* Show / hide password: pw-toggle.js puts its own eye button in every
   password box (styles injected by that script). */


/* =====================================================================
   dark-surface-rescue
   =====================================================================
   An audit of every run of text on fourteen pages in dark mode found 86
   under 3:1 against what is actually behind it. Two opposite causes:

     light text on a card that kept a hard-coded white background
     (#e6edf3 on #fbfefc is 1.16:1 -- white on white), and

     a muted green or grey chosen to sit on white, left on a dark card
     (#4a5d4f on #16222e is 2.28:1).

   Both are fixed by naming the literals, because they are written inline
   and in each page's own <style> rather than in one place. Every value
   here came out of the audit. ===================================== */
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background-color: #fff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background-color:#ffffff"],
[data-theme="dark"] [style*="background-color: #ffffff"],
[data-theme="dark"] [style*="background:#fbfefc"],
[data-theme="dark"] [style*="background: #fbfefc"],
[data-theme="dark"] [style*="background-color:#fbfefc"],
[data-theme="dark"] [style*="background-color: #fbfefc"],
[data-theme="dark"] [style*="background:#f8fffe"],
[data-theme="dark"] [style*="background: #f8fffe"],
[data-theme="dark"] [style*="background-color:#f8fffe"],
[data-theme="dark"] [style*="background-color: #f8fffe"],
[data-theme="dark"] [style*="background:#f4f7f5"],
[data-theme="dark"] [style*="background: #f4f7f5"],
[data-theme="dark"] [style*="background-color:#f4f7f5"],
[data-theme="dark"] [style*="background-color: #f4f7f5"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background-color:#f8fafc"],
[data-theme="dark"] [style*="background-color: #f8fafc"],
[data-theme="dark"] [style*="background:#fcfdfc"],
[data-theme="dark"] [style*="background: #fcfdfc"],
[data-theme="dark"] [style*="background-color:#fcfdfc"],
[data-theme="dark"] [style*="background-color: #fcfdfc"],
[data-theme="dark"] [style*="background:#fafdfb"],
[data-theme="dark"] [style*="background: #fafdfb"],
[data-theme="dark"] [style*="background-color:#fafdfb"],
[data-theme="dark"] [style*="background-color: #fafdfb"],
[data-theme="dark"] [style*="background:#f9fbfa"],
[data-theme="dark"] [style*="background: #f9fbfa"],
[data-theme="dark"] [style*="background-color:#f9fbfa"],
[data-theme="dark"] [style*="background-color: #f9fbfa"],
[data-theme="dark"] [style*="background:#fdfdfd"],
[data-theme="dark"] [style*="background: #fdfdfd"],
[data-theme="dark"] [style*="background-color:#fdfdfd"],
[data-theme="dark"] [style*="background-color: #fdfdfd"] {
  background: var(--cg-surface) !important;
}

[data-theme="dark"] [style*="color:#4a5d4f"],
[data-theme="dark"] [style*="color: #4a5d4f"],
[data-theme="dark"] [style*="color:#5d7264"],
[data-theme="dark"] [style*="color: #5d7264"],
[data-theme="dark"] [style*="color:#7a8b7e"],
[data-theme="dark"] [style*="color: #7a8b7e"],
[data-theme="dark"] [style*="color:#8a9a8e"],
[data-theme="dark"] [style*="color: #8a9a8e"],
[data-theme="dark"] [style*="color:#8a978d"],
[data-theme="dark"] [style*="color: #8a978d"],
[data-theme="dark"] [style*="color:#999"],
[data-theme="dark"] [style*="color: #999"],
[data-theme="dark"] [style*="color:#999999"],
[data-theme="dark"] [style*="color: #999999"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color: #64748b"],
[data-theme="dark"] [style*="color:#475569"],
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color:#5d6b60"],
[data-theme="dark"] [style*="color: #5d6b60"] {
  color: var(--cg-text-secondary) !important;
}

/* The two that are a class rather than an inline colour. */
[data-theme="dark"] .nw-s { color: var(--cg-text-secondary) !important; }
[data-theme="dark"] #cgDemoNote { color: var(--cg-text-secondary) !important; }

/* A win in the demo card was dark green on a dark panel. */
[data-theme="dark"] [style*="color:#1a5c2e"],
[data-theme="dark"] [style*="color:#155724"],
[data-theme="dark"] [style*="color:#166534"],
[data-theme="dark"] [style*="color: #1a5c2e"],
[data-theme="dark"] [style*="color:var(--cg-success)"] { color: #5fd083 !important; }
/* and a loss was dark red on the same panel */
[data-theme="dark"] [style*="color:#b03030"],
[data-theme="dark"] [style*="color:#991b1b"],
[data-theme="dark"] [style*="color: #b03030"],
[data-theme="dark"] [style*="color:#c8102e"],
[data-theme="dark"] [style*="color: #c8102e"],
[data-theme="dark"] [style*="color:#dc3545"],
[data-theme="dark"] [style*="color: #dc3545"] { color: #ff8a8a !important; }


/* The last of the dark-mode contrast failures. These are set by a class in
   a page's own <style>, so the inline-attribute rules above cannot see
   them, and by two foreground colours the first pass did not list. */
[data-theme="dark"] .rv-anonf { background: var(--cg-surface) !important; }
[data-theme="dark"] [style*="color:#444"],
[data-theme="dark"] [style*="color: #444"],
[data-theme="dark"] [style*="color:#5b6b60"],
[data-theme="dark"] [style*="color: #5b6b60"],
[data-theme="dark"] [style*="color:#333"],
[data-theme="dark"] [style*="color: #333"],
[data-theme="dark"] [style*="color:#555"],
[data-theme="dark"] [style*="color: #555"],
[data-theme="dark"] [style*="color:#666"],
[data-theme="dark"] [style*="color: #666"] { color: var(--cg-text) !important; }


/* =====================================================================
   light-contrast-floor
   =====================================================================
   The same audit run against the light theme as a control found 64 runs
   of text under 3:1, all of them one of six pale greys on white. WCAG
   wants 4.5:1 for body text, and this is a game played outdoors in
   sunlight -- a pale grey caption is not quiet, it is absent.

   Each literal is darkened to clear 4.5:1 while keeping its character:
   the greens stay slightly green, the neutrals stay neutral. The
   dark-mode block above is scoped and !important, so it still wins where
   it applies. ========================================================= */
[style*="color:#bbbbbb"],
[style*="color: #bbbbbb"] { color: #6b6b6b !important; }
[style*="color:#bbb"],
[style*="color: #bbb"] { color: #6b6b6b !important; }
[style*="color:#999999"],
[style*="color: #999999"] { color: #6e6e6e !important; }
[style*="color:#999"],
[style*="color: #999"] { color: #6e6e6e !important; }
[style*="color:#8a9a8e"],
[style*="color: #8a9a8e"] { color: #5f6f63 !important; }
[style*="color:#a9b8ad"],
[style*="color: #a9b8ad"] { color: #627165 !important; }
[style*="color:#c8d2cb"],
[style*="color: #c8d2cb"] { color: #68736b !important; }
[style*="color:#8a978d"],
[style*="color: #8a978d"] { color: #5f6b61 !important; }

/* The same values where they are a class rather than an inline colour. */
.nw-meta, .nw-credit { color: #627165 !important; }
#uiVersion, .ui-version { color: #6b6b6b !important; }


/* cc-rowhead -- the hole table's first column was sized for the numbers
   beside it, so "Hole" and "Yds" came out as "H..." and "Yd...". */
.cc-tbl th:first-child,
.cc-tbl td:first-child {
  min-width: 3.1rem;
  white-space: nowrap;
  text-overflow: clip;
  overflow: visible;
}


/* text-overflow does nothing on a flex container, and the touch-target
   rule makes every button inline-flex. This one holds a long course name
   that has to truncate, so it goes back to being a block and uses
   line-height for the vertical centring. */
.cmap-course-btn {
  display: block !important;
  text-align: left;
  line-height: 2.1;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}


/* =====================================================================
   In-app help
   =====================================================================
   A "?" beside each admin heading, opening a panel written for that
   screen. A club organiser who is stuck is stuck on one question, not on
   the product, so the answer appears next to the thing rather than in a
   manual somewhere else. ============================================= */
.cgh-q {
  margin-left: var(--sp-2);
  width: 1.3rem; height: 1.3rem;
  min-height: 0 !important;
  padding: 0; border: 0; border-radius: 50%;
  background: var(--cg-primary-soft, #eef7f0);
  color: var(--cg-primary);
  font: 800 0.78rem/1 inherit;
  cursor: pointer;
  vertical-align: middle;
  flex: 0 0 auto;
}
.cgh-q:hover { background: var(--cg-primary); color: #fff; }

/* above the round-in-progress strip (9989), below the impersonation bands */
#cgHelpScrim {
  position: fixed; inset: 0; z-index: 9994;
  background: rgba(10, 20, 13, .35);
}
#cgHelpPanel {
  position: fixed; z-index: 9995;
  top: 0; right: 0; bottom: 0;
  width: min(26rem, 100vw);
  display: flex; flex-direction: column;
  background: var(--cg-surface, #fff);
  color: var(--cg-text, #15202b);
  box-shadow: -8px 0 28px rgba(16, 24, 40, .18);
  overflow-y: auto;
}
#cgHelpPanel[hidden], #cgHelpScrim[hidden] { display: none; }
#cgHelpPanel .cgh-head {
  position: sticky; top: 0;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--cg-primary); color: #fff;
}
#cgHelpPanel .cgh-title { font-weight: 800; font-size: var(--fs-md); }
#cgHelpPanel .cgh-x {
  margin-left: auto; width: 2rem; height: 2rem; min-height: 0 !important;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.18); color: #fff;
  font-size: 0.9rem; cursor: pointer;
}
#cgHelpPanel .cgh-body { padding: var(--sp-4) var(--sp-4) var(--sp-6); }
#cgHelpPanel .cgh-h {
  margin: var(--sp-4) 0 var(--sp-1);
  font-size: var(--fs-sm); font-weight: 800;
  color: var(--cg-primary);
}
#cgHelpPanel .cgh-h:first-child { margin-top: 0; }
#cgHelpPanel .cgh-p {
  margin: 0; font-size: var(--fs-sm); line-height: 1.6;
  color: var(--cg-text, #15202b);
}
@media (max-width: 640px), (pointer: coarse) {
  /* Full width on a phone, and clear of the tab bar. */
  #cgHelpPanel { width: 100vw; bottom: var(--cg-tabbar-h, 0px); }
}


/* =====================================================================
   ios-zoom-wins
   =====================================================================
   The type floor above raises anything written inline at a tiny size:

       [style*="font-size:0.7"] { font-size: 12.5px !important }

   That is (0,1,0). The iOS zoom rule is `select` at (0,0,1), so on any
   control carrying an inline font-size the floor won -- and 12.5px is
   under the 16px threshold at which iOS Safari zooms the whole page in
   and does not zoom back out. Four controls on the live site were back
   under 16px because of my own rule.

   The floor is right for captions and wrong for anything that opens a
   keyboard. Re-stated last, with a doubled attribute selector so it is
   (0,2,1) and wins outright. ======================================== */
@media (max-width: 820px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"])[style][style],
  select[style][style],
  textarea[style][style],
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}


/* =====================================================================
   type-floor-round-3
   =====================================================================
   What the first floor could not reach: tags it did not list, and sizes
   set by a class rule, which outranks a bare tag selector. Measured at
   8.8px to 12.2px across six pages.

   Form controls are deliberately absent -- they are handled by
   ios-zoom-wins at 16px, and anything here would fight it. ========== */
@media (max-width: 640px), (pointer: coarse) {
  figcaption, small, i, b, em, strong, cite, abbr,
  button, output, time, dt, dd, caption, blockquote {
    font-size: max(12.5px, 1em);
  }

  /* Classes that set their own size below the floor. */
  .cmap-hchip, .cmap-btn, .hz-b, .hz-note,
  .nw-meta, .nw-s, .nw-more, .nw-credit,
  .per, .seg-btn, .seg-count, .btn-example,
  figcaption, small {
    font-size: 12.5px !important;
  }
}


/* =====================================================================
   justify-respects-author
   =====================================================================
   The 44px touch-target rule sets justify-content:center on every button
   so a short label centres in a stretched one. On a button whose content
   is a left-aligned card that centres the whole row, and it silently
   beats the author's text-align:left -- text-align does nothing to a
   flex container's items.

   Measured on the round-setup format cards: three titles at 100px, 51px
   and 83px from the left, tracking the length of each description.

   Anywhere left alignment was asked for explicitly, honour it. The
   attribute selector is (0,1,0) against the rule's (0,0,1), so this wins
   without needing to chase every element. ============================ */
[style*="text-align:left"],
[style*="text-align: left"],
.rv-fmt,
.pcard-game,
.cmap-course-btn,
.rv-ta-list button,
.nav-group-head {
  justify-content: flex-start !important;
  text-align: left;
}


/* Friend row actions. Icons on the row instead of a Manage link that sent
   you to another page to do the two obvious things. */
.ff-acts { display: flex; gap: 0.35rem; flex-shrink: 0; align-items: center; }
.ff-ico {
  width: 34px; height: 34px; min-height: 34px !important;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #d4dbe3; border-radius: 50%;
  background: #fff; color: var(--cg-primary);
  font-size: 0.9rem; font-weight: 800; cursor: pointer; padding: 0;
}
.ff-ico:hover { background: var(--cg-primary-soft, #eef7f0); }
.ff-ico.danger { color: #b03030; }
.ff-ico.danger:hover { background: #fdeaea; border-color: #e3b5b5; }
.ff-ico[disabled] { opacity: .45; cursor: default; }
@media (max-width: 640px), (pointer: coarse) {
  /* Still a real target without becoming a slab. */
  .ff-ico { width: 40px; height: 40px; min-height: 40px !important; }
}


/* ---- safe area: keep the header clear of the status bar ---- */
/* The app draws the WebView behind the status bar, so without this the clock
   and the battery print on top of the club name. The rest of this file was
   already written for insets -- .cg-tb-bar pads its bottom with
   safe-area-inset-bottom -- but env() resolves to 0 unless the page carries
   viewport-fit=cover, and 40 of 50 pages did not. Both edges were dead.

   Placed last on purpose: .site-topbar is declared in four places above with
   different padding, so an inset added to any one of them loses to a later
   rule. Those four want merging; not while a release is waiting. */
.site-topbar {
    padding-top: calc(0.45rem + env(safe-area-inset-top, 0px));
}
/* The bar is sticky at top:0. Its sticky offset has to clear the status bar
   too, or it re-tucks underneath as soon as the page scrolls. */
.site-topbar { top: 0; }
/* Anything else pinned to the top of the window needs the same treatment. */
.cg-offline { padding-top: calc(0.45rem + env(safe-area-inset-top, 0px)); }
/* The help panel is full height from the top: its title and X sat under
   the clock and battery in the app (James, 14 Oct). Same inset, both sides. */
#cgHelpPanel .cgh-head { padding-top: calc(var(--sp-4, 1rem) + env(safe-area-inset-top, 0px)); }
#cgHelpPanel { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Landscape on a notched phone: viewport-fit=cover hands us the full width
   INCLUDING the cutout, so flow content needs the horizontal insets back.
   Zero in portrait, so this costs nothing in the normal case. */
html { padding-left: env(safe-area-inset-left, 0px);
       padding-right: env(safe-area-inset-right, 0px); }
.cg-tb-bar { padding-left: calc(0.2rem + env(safe-area-inset-left, 0px));
             padding-right: calc(0.2rem + env(safe-area-inset-right, 0px)); }
.site-topbar { padding-left: calc(0.9rem + env(safe-area-inset-left, 0px));
               padding-right: calc(0.9rem + env(safe-area-inset-right, 0px)); }
.site-nav { padding-left: env(safe-area-inset-left, 0px); }


/* ---- wide result tables on a phone ----------------------------------
   The skins / xD-hole tables are generated with min-width:540px inside
   an overflow-x:auto box. On a 335px-wide phone that guarantees the
   WINNER and PAYOUT columns start off the right edge -- the two columns
   the page exists to show. Measured: 717px of table in a 335px box.

   Dropping the forced minimum lets the table fit; the box keeps its
   overflow-x so anything genuinely too wide still scrolls. The last two
   columns may wrap, because a winner's name is the long one. */
@media (max-width: 640px) {
    div[style*="overflow-x:auto"] > table { min-width: 0 !important; }
    div[style*="overflow-x:auto"] > table th,
    div[style*="overflow-x:auto"] > table td {
        padding-left: 3px !important;
        padding-right: 3px !important;
    }
    /* !important because a wider mobile rule already sets
       th, td { white-space: nowrap !important } -- asked the browser which
       rule was winning rather than guessing. That is why the min-width half
       of this fix worked (it was !important) and the wrapping half did not,
       leaving the Leader cell one long unbreakable line. */
    /* anywhere was the half that did the damage. white-space:normal is
       what lets "Joe Karonge" wrap at its space, and that is all this
       needs. overflow-wrap:anywhere additionally permits a break INSIDE
       a word, which drops the column's min-content width to one
       character -- so on the rounds history, whose last two columns are
       NET and DIFF rather than WINNER and PAYOUT, the browser squeezed
       the header into DIF / F and stacked the GHIN badge vertically.
       Reported as "what's with these columns on the right?".
       The 5rem floor went with it: it was sized for a player's name and
       was being applied to a two-digit net score. */
    div[style*="overflow-x:auto"] > table th:nth-last-child(-n+2),
    div[style*="overflow-x:auto"] > table td:nth-last-child(-n+2) {
        white-space: normal !important;
    }
}

/* Results money tables on a narrow phone (360px): cells may wrap, so the
   Payout / Each column stays on screen instead of past the edge. The
   hole-by-hole scorecard grid (.ls-cards) keeps scrolling sideways. */
@media (max-width: 400px) {
    #liveScoresContent table:not(.ls-cards) td,
    #liveScoresContent table:not(.ls-cards) th { white-space: normal !important; }
    /* 390px iPhone (17 Nov 2026): six-column skins tables were 23px too wide
       and cut the money column ("$14.2"); slimmer cell padding fits them */
    #liveScoresContent table:not(.ls-cards) td,
    #liveScoresContent table:not(.ls-cards) th { padding-left: 3px !important; padding-right: 3px !important; }
    #liveScoresContent table:not(.ls-cards) th { letter-spacing: 0 !important; font-size: 0.56rem !important; }
}


/* ===== Readable gray text (WCAG AA, 4.5:1) =====
 * Small gray labels were 2.2-3.6:1 on white -- city names, dates, "thru 12",
 * bracket seeds, pricing small print. Most are inline styles written by the
 * page scripts, so they are darkened here by value rather than hunted down
 * one by one. Light theme only: the dark theme has its own palette above.
 */
html:not([data-theme="dark"]) .rv-sub,
html:not([data-theme="dark"]) .rv-lab { color: #5d6e61; }
html:not([data-theme="dark"]) [style*="color:#888"], html:not([data-theme="dark"]) [style*="color: #888"],
html:not([data-theme="dark"]) [style*="color:#999"], html:not([data-theme="dark"]) [style*="color: #999"],
html:not([data-theme="dark"]) [style*="color:#aaa"], html:not([data-theme="dark"]) [style*="color: #aaa"],
html:not([data-theme="dark"]) [style*="color:#9aa"], html:not([data-theme="dark"]) [style*="color: #9aa"],
html:not([data-theme="dark"]) [style*="color:#889"], html:not([data-theme="dark"]) [style*="color: #889"],
html:not([data-theme="dark"]) [style*="color:#777"], html:not([data-theme="dark"]) [style*="color: #777"] { color: #666b70 !important; }
html:not([data-theme="dark"]) [style*="color:#7a8b7e"], html:not([data-theme="dark"]) [style*="color: #7a8b7e"],
html:not([data-theme="dark"]) [style*="color:#7d8a80"], html:not([data-theme="dark"]) [style*="color: #7d8a80"],
html:not([data-theme="dark"]) [style*="color:#8a978d"], html:not([data-theme="dark"]) [style*="color: #8a978d"] { color: #5d6e61 !important; }
/* the same grays as stylesheet rules on the public pages */
html:not([data-theme="dark"]) .updated { color: #666b70; }

/* ===== Keyboard focus, site-wide =====
 * Buttons and links styled as pills (hero buttons, Sign in, segmented
 * controls) had no visible focus at all: tabbing through the home page
 * showed nothing. A clear ring for keyboard users only (:focus-visible),
 * nothing for mouse or touch.
 */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible,
.btn-hero:focus-visible, .sp-signin:focus-visible, .seg-btn:focus-visible, .pill-toggle:focus-visible {
    outline: 3px solid #1a73e8 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px rgba(255,255,255,0.85) !important;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 1px;
}

/* Dark theme: table header cells and section titles that carry an inline
 * light background or brand color. On the club Results page the signups
 * header row was pale gray text on a pale gray band (2.2:1) and the
 * "Past Rounds" title navy-green on navy. */
[data-theme="dark"] th[style*="background"] { background: var(--cg-surface-2) !important; color: var(--cg-text) !important; }
[data-theme="dark"] h3[style*="color:var(--cg-primary)"],
[data-theme="dark"] h2[style*="color:var(--cg-primary)"] { color: var(--cg-text) !important; }

/* ===== Event Setup: group cards (Groups step) =====
 * The phone rule `select { width:100% !important }` (pointer: coarse) made
 * each player's "move" dropdown take the whole row, and the name — the only
 * part allowed to shrink — collapsed to nothing: four rows of "PH 29" and an
 * empty box (Oct 30 event, James's phone). These selects size to their text,
 * the name has a floor, and controls wrap under the name on a narrow card.
 * (0,2,1) + !important outranks `.admin-page select` (0,1,1).
 * Class names are sgp- (was sg-): the shared design layer sabio-ui.css
 * owns .sg-card/.sg-title/.sg-facts/.sg-btn, and the two collided -- the
 * profile name could not wrap and ran on under the QR (12 Nov 2026). */
.setup-groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: 0.6rem; }
.sgp-card { border: 1px solid var(--cg-green-border, #d7e6da); border-radius: 14px; padding: 0.6rem 0.7rem; background: var(--cg-surface, #fff); box-shadow: 0 1px 4px rgba(20,60,35,.05); min-width: 0; }
.sg-head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.sg-num { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--cg-primary); color: #fff; font-weight: 800; font-size: 0.78rem; flex-shrink: 0; }
.sgp-title { color: var(--cg-text); font-size: 0.85rem; white-space: nowrap; }
.setup-groups-grid input.sg-team { flex: 1 1 9rem; min-width: 0; max-width: 16rem; width: auto !important; font-size: 0.78rem; padding: 0.3rem 0.5rem; border: 1.5px solid #c9d4c9; border-radius: 8px; background: var(--cg-surface, #fff); color: var(--cg-text); }
.sgp-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0.45rem 0 0.4rem; }
.sg-chip { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--cg-surface-2, #f4f8f5); border: 1px solid #e0e9e1; border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.68rem; font-weight: 600; color: var(--cg-text-secondary); white-space: nowrap; }
.sg-chip b { color: var(--cg-text); }
.sg-chip-hcp { background: var(--cg-primary-soft); color: var(--cg-primary); border-color: transparent; font-weight: 800; }
.sg-chip-warn { background: #fff3cd; color: #856404; border-color: #ffe69c; font-weight: 800; }
.sg-chip-open { background: #fff4e5; color: #b45309; border-color: #f0d9b5; font-weight: 800; }
.setup-groups-grid select.sg-hole, .setup-groups-grid select.sg-move, .setup-groups-grid select.sg-add,
.setup-groups-grid input.sg-time { width: auto !important; max-width: 100% !important; min-width: 0; }
.setup-groups-grid select.sg-hole { font-size: 0.74rem; padding: 0.1rem 0.25rem; border: 1px solid #c9d4c9; border-radius: 6px; background: var(--cg-surface, #fff); color: var(--cg-text); font-weight: 700; cursor: pointer; }
.setup-groups-grid input.sg-time { width: 4.2rem !important; font-size: 0.74rem; padding: 0.1rem 0.25rem; border: 1px solid #c9d4c9; border-radius: 6px; text-align: center; font-weight: 700; background: var(--cg-surface, #fff); color: var(--cg-text); }
.setup-groups-grid select.sg-add { font-size: 0.72rem; padding: 0.25rem 0.45rem; border: 1.5px dashed #b7cdc0; border-radius: 8px; background: var(--cg-surface, #fbfefc); color: var(--cg-primary); font-weight: 700; }
.sg-players { display: flex; flex-direction: column; gap: 0.3rem; }
.sg-prow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; border: 1px solid var(--cg-border); border-radius: 10px; padding: 0.35rem 0.5rem; background: var(--cg-surface, #fff); }
.sg-prow.is-scorer { border-color: var(--cg-primary-line); background: var(--cg-primary-soft); }
.sg-pmain { display: flex; align-items: center; gap: 0.4rem; flex: 1 1 11rem; min-width: 8rem; }
.sg-pname { font-size: 0.8rem; color: var(--cg-text); overflow-wrap: anywhere; }
.sg-pctl { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-left: auto; }
.setup-groups-grid select.sg-move { font-size: 0.72rem; padding: 0.2rem 0.35rem; border: 1px solid var(--cg-primary-line); border-radius: 7px; background: var(--cg-primary-soft); color: var(--cg-primary); font-weight: 700; cursor: pointer; }
.sgp-btn { background: var(--cg-surface, #fff); color: var(--cg-primary); border: 1px solid var(--cg-primary-line); border-radius: 7px; padding: 0.2rem 0.45rem; font-size: 0.7rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.sg-scorer-on { background: var(--cg-primary); color: #fff; border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.68rem; font-weight: 800; white-space: nowrap; }
.sg-x { background: none; border: none; color: #c0392b; font-weight: 800; font-size: 1.05rem; line-height: 1; padding: 0.2rem 0.35rem; cursor: pointer; min-height: 0 !important; min-width: 0 !important; width: auto !important; }
.sg-open { display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--cg-primary-line); border-radius: 10px; padding: 0.35rem 0.5rem; background: var(--cg-primary-soft); min-height: 2.2rem; font-size: 0.66rem; color: var(--cg-primary-deep); font-weight: 700; }
.sg-legend { font-size: 0.68rem; color: var(--cg-text-secondary); background: var(--cg-surface-2, #f4f8f5); border: 1px solid #e0e9e1; border-radius: 10px; padding: 0.4rem 0.7rem; margin-bottom: 0.55rem; line-height: 1.55; }
.sg-legend summary { cursor: pointer; font-weight: 800; color: var(--cg-primary); }
@media (max-width: 480px) {
    .sgp-card { padding: 0.55rem 0.55rem; }
    .sg-pctl { margin-left: 0; width: 100%; }
}
[data-theme="dark"] .sg-prow.is-scorer, [data-theme="dark"] .sg-open, [data-theme="dark"] .setup-groups-grid select.sg-move { background: var(--cg-surface-2); }
[data-theme="dark"] .sg-chip { border-color: var(--cg-border); }
/* the minutes box next to Generate: the site-wide input padding hid the number */
input[type="number"].sg-iv { width: 3.8rem !important; padding: 0.2rem 0.3rem !important; }
.setup-groups-grid input.sg-time, .setup-groups-grid select.sg-hole { padding: 0.15rem 0.35rem !important; }
.setup-groups-grid select.sg-move, .setup-groups-grid select.sg-add { padding: 0.25rem 1.6rem 0.25rem 0.45rem !important; }
/* Flights step: same squeeze as the group cards -- the A/B/C picker went
   full width on phones and the player's name collapsed to nothing. */
select.sg-flight.sg-flight { width: auto !important; max-width: 5.5rem !important; flex: 0 0 auto; padding: 0.2rem 1.4rem 0.2rem 0.4rem !important; }
/* ...and on a phone one flight per row (the generic phone rule makes every
   inline "repeat(...)" grid two columns, too narrow for a name and a picker) */
@media (max-width: 640px) { .sg-fgrid.sg-fgrid { grid-template-columns: 1fr !important; } }
/* a select is as wide as its longest option: long team names in "Move to…"
   pushed it to a full row of its own */
.setup-groups-grid select.sg-move { max-width: 10.5rem !important; }
.setup-groups-grid select.sg-hole { max-width: 15rem !important; }
[data-theme="dark"] .sg-chip-hcp { color: var(--cg-text); background: var(--cg-surface-2); border-color: var(--cg-border); }
[data-theme="dark"] .sg-legend summary { color: var(--cg-text); }
[data-theme="dark"] .sg-num { background: var(--cg-surface-2); border: 1px solid var(--cg-border); }

/* Unknown Golf disabled 12 Nov 2026 — Safari DC uses Sabio only; to re-enable
   see docs/unknown-golf-disabled.md. Every Unknown Golf field and button wears
   sg-ug-only and stays hidden unless /api/settings says ug_enabled (app.js
   adds body.sg-ug-on). */
body:not(.sg-ug-on) .sg-ug-only { display: none !important; }

/* ---------- dark mode: sweep 13 Nov ----------
   Event form "DAY 1 / DAY 2" panels stayed white (labels 2.2:1), and the
   unselected Day pills in Sign-ups read 2:1. */
[data-theme="dark"] .t-day-panel, [data-theme="dark"] .afc .t-day-panel { background: var(--cg-surface-2); border-color: var(--cg-border); }
[data-theme="dark"] .t-day-title { border-bottom-color: var(--cg-border); }
[data-theme="dark"] .pill-toggle:not(.active) { color: var(--cg-text-muted); border-color: var(--cg-border); }
/* the New Tournament games list: pale rows kept light text (1.2:1) */
[data-theme="dark"] #tournamentForm .game-row { background: var(--cg-surface-2); border-color: var(--cg-border); }

/* course picker (ui.js cgCoursePicker, 14 Nov 2026) */
.cgcp { position: relative; width: 100%; min-width: 0; }
.cgcp-row { position: relative; display: flex; align-items: center; }
.cgcp-row .cgcp-input { flex: 1 1 auto; min-width: 0; width: 100%; box-sizing: border-box; padding-right: 2.2rem !important; }
.cgcp-clear { position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--cg-text-muted, #66717c); cursor: pointer; font-size: 0.8rem; line-height: 1; padding: 0; }
.cgcp-clear:hover, .cgcp-clear:focus-visible { background: var(--cg-surface-2, #f1f4f2); color: var(--cg-text, #17212b); }
.cgcp-clear[hidden] { display: none; }
.cgcp-list { position: absolute; z-index: 1200; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 0.25rem; list-style: none;
  background: var(--cg-surface, #fff); color: var(--cg-text, #17212b); border: 1px solid var(--cg-border, #d7e0d8); border-radius: 12px;
  box-shadow: 0 14px 36px rgba(16,24,40,.16); max-height: min(20rem, 55vh); overflow-y: auto; box-sizing: border-box; }
.cgcp-list[hidden] { display: none; }
.cgcp--multi .cgcp-list { top: auto; margin-top: 4px; position: absolute; }
.cgcp-opt { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.5rem 0.6rem; min-height: 44px; box-sizing: border-box; justify-content: center;
  border-radius: 8px; cursor: pointer; }
.cgcp-opt.on, .cgcp-opt:hover { background: var(--cg-primary-soft, #eef3ef); }
.cgcp-n { font-size: 0.86rem; font-weight: 700; overflow-wrap: anywhere; }
.cgcp-p { font-size: 0.74rem; color: var(--cg-text-muted, #66717c); display: flex; gap: 0.4rem; flex-wrap: wrap; }
.cgcp-p em { font-style: normal; font-weight: 700; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cgcp-msg { padding: 0.6rem; font-size: 0.78rem; color: var(--cg-text-muted, #66717c); }
.cgcp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cgcp-chips:not(:empty) { margin-bottom: 0.4rem; }
.cgcp-chip { display: inline-flex; align-items: center; gap: 0.35rem; max-width: 100%; box-sizing: border-box; padding: 0.3rem 0.3rem 0.3rem 0.65rem;
  border-radius: 12px; background: var(--cg-primary-soft, #eef3ef); border: 1px solid var(--cg-border, #d7e0d8); }
.cgcp-chip-t { display: flex; flex-direction: column; min-width: 0; }
.cgcp-chip-t b { font-size: 0.8rem; overflow-wrap: anywhere; }
.cgcp-chip-t small { font-size: 0.68rem; color: var(--cg-text-muted, #66717c); }
.cgcp-chip--typed { border-style: dashed; }
.cgcp-chip button { flex: 0 0 auto; width: 1.8rem; height: 1.8rem; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  color: var(--cg-text-muted, #66717c); font-size: 0.75rem; padding: 0; }
.cgcp-chip button:hover, .cgcp-chip button:focus-visible { background: var(--cg-surface, #fff); color: #b42318; }
.cgcp-note { font-size: 0.7rem; color: #9a6400; margin-top: 0.25rem; }
.cgcp-note:empty { display: none; }
@media (max-width: 760px) { .cgcp .cgcp-input { font-size: 16px !important; min-height: 44px; } }
.cgcp--multi .cgcp-input { padding: 0.45rem 0.55rem; border: 1px solid var(--cg-border, #ced4da); border-radius: 8px; font-size: 0.85rem;
  background: var(--cg-surface, #fff); color: var(--cg-text, #17212b); }
