
        * { 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: collapse; font-size: 0.68rem; }
        th, td { padding: 0.3rem 0.35rem; text-align: left; border-bottom: 1px solid #dee2e6; }
        th { background: #f8f9fa; font-weight: 600; color: #333; font-size: 0.65rem; border-right: 1px solid #e9ecef; }
        th:last-child { border-right: none; }
        td { border-right: 1px solid #f0f0f0; }
        td:last-child { border-right: none; }
        tr:hover { background: #f8f9fa; }
        /* Zebra striping for readability */
        tbody tr:nth-child(even) { background: #fafafa; }
        tbody tr:nth-child(even):hover { background: #f0f0f0; }
        /* 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: #f8f9fa; 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: #f8f9fa; }
        #tableContainer tfoot tr:nth-child(2) td:nth-child(1) { background: #d4edda; }
        /* 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; }
        #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 (5th-22nd: after Player/Hcp/CHCP/Tee, before Tot) shrink to content */
        #scoreGrid th:nth-child(n+5):nth-child(-n+22) { width: 1%; }

        /* 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 */
            #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: hidden; text-overflow: ellipsis; }
            /* Stack tournament/day selectors (inline grid-template-columns overrides the global mobile rule) */
            #payoutsSection .form-row { grid-template-columns: 1fr !important; }
        }
        /* 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 */
            .signup-card { background: white; border: 1px solid #dee2e6; border-radius: 8px; padding: 0.5rem; margin-bottom: 0.4rem; }
            .signup-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
            .signup-card-name { font-weight: 700; font-size: 0.85rem; color: #333; }
            .signup-card-bets { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; margin-bottom: 0.3rem; }
            .signup-card-day { font-size: 0.65rem; }
            .signup-card-day-title { font-weight: 600; color: #1a5c2e; font-size: 0.6rem; text-transform: uppercase; margin-bottom: 0.15rem; }
            .signup-card-bet-row { display: flex; gap: 0.3rem; flex-wrap: wrap; font-size: 0.6rem; }
            .signup-card-bet-item { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.1rem 0.3rem; border-radius: 3px; background: #f0f0f0; }
            .signup-card-bet-item.active { background: #e8f5e9; color: #1a5c2e; font-weight: 600; }
            .signup-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid #eee; }
            .signup-card-amount { font-weight: 700; color: #1a5c2e; font-size: 0.75rem; }
            .signup-card-actions { display: flex; gap: 0.25rem; flex-wrap: wrap; }
            .signup-card-actions .btn-sm { padding: 0.2rem 0.4rem; font-size: 0.6rem; }
            
            /* 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; }
            .signup-card { padding: 0.4rem; }
            .signup-card-name { font-size: 0.75rem; }
            .signup-card-bets { gap: 0.25rem; }
            .signup-card-actions .btn-sm { padding: 0.15rem 0.35rem; font-size: 0.55rem; }
            .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.35rem; }
.site-nav a { color: #fff; text-decoration: none; font-size: 0.8rem; font-weight: 600;
    padding: 0.35rem 0.7rem; border-radius: 6px; white-space: nowrap;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); }
.site-nav a:hover { background: rgba(255,255,255,0.25); }

.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.3rem;
        background: #154d28; border-radius: 10px; padding: 0.5rem;
        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.6rem 0.8rem; }
}

/* 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;
    }
}
