
        * { 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: #f5f5f5; }
        html, body { max-width: 100%; overflow-x: hidden; }
        .container { background: white; 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: #1a5c2e; margin-bottom: 0.1rem; font-size: 1.35rem; }
        .subtitle { color: #666; margin-bottom: 0.5rem; font-size: 0.85rem; }
        .form-section { background: #f8f9fa; padding: 0.85rem; border-radius: 6px; margin-bottom: 0.75rem; }
        .section-header { display: flex; justify-content: space-between; align-items: center; background: #1a5c2e; 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 #ddd; 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: white; padding: 0.6rem; border-radius: 6px; border: 2px solid #e9ecef; }
        .event-card h3 { margin: 0 0 0.35rem; color: #1a5c2e; font-size: 0.9rem; }
        .event-subtitle { color: #666; font-size: 0.8rem; margin-bottom: 0.6rem; }
        .price-note { color: #1a5c2e; 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: #1a5c2e; background: #f0fff4; }
        .checkbox-label input:checked + span { color: #1a5c2e; font-weight: 600; }
        .checkbox-label input { width: 1.1rem; height: 1.1rem; accent-color: #1a5c2e; }
        .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: #e8f5e9; color: #1a5c2e; }
        .skin-badge.net { background: #e3f2fd; color: #1565c0; }
        .skin-badge.kitty { background: #fff3e0; color: #e65100; }
        .skin-price { color: #666; font-size: 0.75rem; }
        .total-price { font-weight: 700; color: #1a5c2e; font-size: 0.9rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #dee2e6; }
        .btn { width: 100%; padding: 0.5rem; background: #1a5c2e; color: white; border: none; border-radius: 4px; font-size: 0.85rem; cursor: pointer; margin-top: 0.5rem; }
        .btn:hover { background: #154823; }
        .btn:disabled { background: #94a3a8; cursor: not-allowed; }
        .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; }
        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: #1a5c2e; 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: #eef5ef; }
        tfoot td { font-weight: 700; background: #f0f7f1; border-top: 2px solid #1a5c2e; }
        /* 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: #1a5c2e; z-index: 2; }
        #tableContainer tbody td:nth-child(1) { background: #fff; }
        #tableContainer tbody tr:nth-child(even) td:nth-child(1) { background: #fafafa; }
        #tableContainer tbody tr:hover td:nth-child(1) { background: #f0f0f0; }
        #tableContainer tfoot td:nth-child(1) { position: sticky; left: 0; z-index: 1; }
        #tableContainer tfoot tr:nth-child(1) td:nth-child(1) { background: #f0f7f1; }
        #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: #fff; }
.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 #1a5c2e; border-radius:50%; color:#1a5c2e; }
        .sc-circle2 { border:1px solid #1a5c2e; border-radius:50%; color:#0f3d1f; box-shadow:0 0 0 1px #fff, 0 0 0 2px #1a5c2e; }
        .sc-circle3 { border:1px solid #1a5c2e; border-radius:50%; color:#0f3d1f; box-shadow:0 0 0 1px #fff, 0 0 0 2px #1a5c2e, 0 0 0 3px #fff, 0 0 0 4px #1a5c2e; }
        .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: #f8f9fa;
            box-shadow: 1px 0 0 #c8d3cc;
        }
        #scoreGrid tbody td.sg-name { background: #fff; }
        #scoreGrid tbody tr:nth-child(even) td.sg-name { background: #fafafa; }
        #scoreGrid tbody tr:hover td.sg-name { background: #f0f0f0; }
        /* Freeze Player column (public live scorecards) */
        .ls-cards th.sg-name, .ls-cards td.sg-name {
            position: sticky;
            left: 0;
            z-index: 3;
            background: #f8f9fa;
            box-shadow: 1px 0 0 #c8d3cc;
        }
        .ls-cards tbody td.sg-name { background: #fff; }
        .ls-cards tbody tr:hover td.sg-name { background: #f0f0f0; }
        @media (max-width: 768px) {
            /* 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: #e8f5e9; color: #1a5c2e; }
        .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: #333; }
        .loading { text-align: center; padding: 1rem; color: #666; font-size: 0.8rem; }
        .error { color: #dc3545; text-align: center; padding: 0.5rem; font-size: 0.8rem; }
        .success { color: #1a5c2e; text-align: center; padding: 0.5rem; font-size: 0.8rem; }
        .x-mark { color: #1a5c2e; 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: white; 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: #1a5c2e; 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 #ddd; 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: #1a5c2e; background: #f0fff4; }
        .modal .checkbox-label input { width: 0.9rem; height: 0.9rem; accent-color: #1a5c2e; }
        .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: #e8f5e9; color: #1a5c2e; }
        .modal .skin-badge.net { background: #e3f2fd; color: #1565c0; }
        .modal .skin-badge.kitty { background: #fff3e0; color: #e65100; }
        .modal .skin-price { color: #666; font-size: 0.65rem; }
        .modal-actions { display: flex; gap: 0.4rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #dee2e6; }
        .modal-actions .btn { flex: 1; }
        .amount-cell { text-align: center; font-weight: 500; color: #1a5c2e; }
        
        /* Mobile responsive */
        @media (max-width: 768px) {
            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: #f8f9fa; 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) {
            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: #1a5c2e; 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: #1a5c2e; 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) {
            /* 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: white; color: #333; 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 #e0e0e0; 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: #333; }
        .admin-toolbar-panel label { color: #333; 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 #1a5c2e inset; font-weight: 700; }
        .admin-toolbar-actions .btn { padding: 0.4rem 0.35rem; font-size: 0.68rem; width: 100%; text-align: center; }
        #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: #333; 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) {
            .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(17rem, 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: #fff; 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) {
            .signups-header { flex-direction: column; gap: 0.35rem; align-items: stretch; }
            .signups-header h2 { text-align: center; }
            .admin-toolbar-btn { width: 100%; 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(17rem, 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: #fff; 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) {
    .hamburger { display: flex; }
    .nav-links { display: none; position: absolute; top: calc(100% + 0.4rem); right: 0.5rem; min-width: 10.5rem; background: #154d28; 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: #1a5c2e; 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: #fff; 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) {
    .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) {
    .admin-menu-toggle { background: #1a5c2e; border-color: rgba(255,255,255,0.3); }
    .admin-panel-layout.menu-open .admin-toolbar-actions {
        background: #154d28; 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) {
    .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: #1a5c2e !important;
        color: #fff !important;
        border: 1px solid #24763a !important;
    }
    .admin-toolbar-panel h3, .admin-toolbar-panel label { color: #333 !important; }
    .admin-toolbar-panel .success { color: #1a5c2e !important; }
    .admin-toolbar-panel .error { color: #dc3545 !important; }

    /* login form sits on a white card in the page */
    #adminLogin { background: #fff; border: 1px solid #e0e0e0; 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: #1a5c2e; 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; }

.site-nav { display: flex; align-items: center; gap: 0.1rem; }
.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: #fff; color: #1a5c2e; 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: #fff; color: #1a5c2e; border-color: #fff; }

.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 4px;
    width: 40px; height: 36px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px; cursor: pointer; padding: 8px 9px; }
.nav-toggle span { display: block; height: 2px; width: 100%; background: #fff; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.site-topbar.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-topbar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-topbar.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .site-nav { display: none; position: absolute; top: 100%; right: 0.5rem; left: 0.5rem;
        flex-direction: column; align-items: stretch; gap: 0.15rem;
        background: #154d28; border-radius: 10px; padding: 0.55rem;
        box-shadow: 0 12px 30px rgba(0,0,0,0.35); z-index: 940; }
    .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; }
    .site-nav a.active { background: #fff; }
    .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) {
    .dmvi-logo { display: none !important; }
}

/* Admin page content: plain flow on every screen size */
.admin-page { margin-bottom: 1rem; }
.admin-page #adminLogin { background: #fff; border: 1px solid #e0e0e0; border-radius: 10px;
    padding: 1rem; max-width: 26rem; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.admin-page #adminPanel { background: #fff; border: 1px solid #e0e0e0; 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: 100%; text-align: center; }
@media (max-width: 1024px) {
    .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: #fff; 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) {
    .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) {
    #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: #1a5c2e; letter-spacing: 0.06em; margin-bottom: 0.45rem; border-bottom: 1px solid #e4ece4; padding-bottom: 0.25rem; }
@media (max-width: 900px) { .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: #163d20; 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: #137333; border: 1px solid #ceead6; }
.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: #1a5c2e; color: #fff; box-shadow: 0 1px 4px rgba(26,92,46,0.3); }
.seg-btn.active.seg-paid { background: #137333; }
.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: #fff; 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: #1a5c2e; color: #1a5c2e; }
.pill-toggle.active { background: #1a5c2e; border-color: #1a5c2e; 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: #1a5c2e; color: #1a5c2e; border-style: solid; }
.chip-toggle.on { background: #e6f4ea; border: 1.5px solid #1a5c2e; color: #137333; 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:#1a5c2e; color:#fff; box-shadow:0 2px 6px rgba(26,92,46,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: #1a5c2e;
    --cg-green-light: #f6fbf7;
    --cg-green-border: #e2ece4;
    --cg-teal: #0f6674;
    --cg-radius: 12px;
    --cg-radius-sm: 8px;
    --cg-shadow: 0 2px 8px rgba(26,92,46,.08);
    --cg-shadow-lg: 0 8px 24px rgba(26,92,46,.12);
    --cg-text: #163d20;
    --cg-text-secondary: #4a5f4e;
    --cg-text-muted: #8a968d;
    --cg-border: #e4ece5;
    --cg-bg: #f8faf8;
}

/* --- 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: #fff !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(26,92,46,.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: #fff !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: #fff !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: #fff !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: #e8f5e9 !important;
    border-color: var(--cg-green) !important;
    box-shadow: 0 0 0 2px rgba(26,92,46,.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) {
    .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 { width: 100% !important; }
    .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(26,92,46,.2) !important;
    border-radius: var(--cg-radius) !important;
    padding: 1rem 1.2rem !important;
    margin-top: 1rem !important;
    background: linear-gradient(135deg, #f6fbf7, #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(26,92,46,.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) {
    /* 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;
    }

    /* 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:#888"],
#tFormModalBody label span[style*="color:#888"],
.modal label span[style*="color:#888"] {
    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) {

    /* 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) {
    .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) {
    /* 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,#1a5c2e,#0f6674)"] {
        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) {
    /* --- 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; }
    .nav-toggle { min-width: 2.75rem; min-height: 2.75rem; }
    /* 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; }
}

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