
        :root {
            --primary-red: #d10000;
            --dark-bg: #1a1a1a;
            --card-bg: #2d2d2d;
            --text-light: #ffffff;
            --text-gray: #cccccc;
            --border-color: #444;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* Ensure mobile/desktop toggle works even if JS is slow/blocked */
        .mobile-only { display: none; }
        .desktop-only { display: block; }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            background: var(--dark-bg);
            color: var(--text-light);
            line-height: 1.6;
        }
        
        /* Mobile-first responsive design */
        @media (max-width: 768px) {
            .container {
                padding: 1rem;
            }
            
            .dashboard-row {
                grid-template-columns: 1fr;
                gap: 1rem;
            }
            
            .sidebar {
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                height: 60px;
                flex-direction: row;
                justify-content: space-around;
                z-index: 999; /* keep above content but avoid covering sticky modals */
                padding: 0;
            }
            
            .logo {
                display: none;
            }
            
            .sidebar-nav {
                width: 100%;
            }
            
            .sidebar-nav ul {
                display: flex;
                justify-content: space-around;
                width: 100%;
            }
            
            .sidebar-nav li {
                margin: 0;
                flex: 1;
            }
            
            .tab-btn {
                padding: 0.75rem 0.5rem;
                text-align: center;
                font-size: 0.8rem;
            }
            
            .tab-btn span {
                display: none;
            }
            
            
            .main-content {
                margin-left: 0;
                margin-bottom: 70px; /* make space for bottom nav */
                min-height: calc(100vh - 70px);
                z-index: 1;
            }

            /* show correct sections by default on small screens */
            .mobile-only { display: block; }
            .desktop-only { display: none; }
            
            .logout-link {
                display: none;
            }
            
            .dashboard-card {
                padding: 1rem;
            }
            
            .stat-value {
                font-size: 1.5rem;
            }
            
            .member-image {
                width: 50px;
                height: 50px;
            }
            
            .actions-cell {
                flex-direction: column;
                gap: 0.25rem;
            }
            
            .btn-small {
                padding: 0.25rem 0.5rem;
                font-size: 0.75rem;
            }
            
            .id-card-landscape {
                transform: scale(0.7);
                transform-origin: top center;
            }
        }
        
        @media (min-width: 769px) and (max-width: 1024px) {
            .sidebar {
                width: 200px;
            }
            
            .main-content {
                margin-left: 200px;
            }
            
            .dashboard-row {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .id-card-landscape {
                transform: scale(0.85);
                transform-origin: top center;
            }
        }
        
        @media (min-width: 1025px) {
            .sidebar {
                width: 250px;
            }
            
            .main-content {
                margin-left: 250px;
            }
            
            .dashboard-row {
                grid-template-columns: repeat(4, 1fr);
            }
        }
        
        /* Login Styles */
        .login-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            padding: 1rem;
        }
        
        .login-box {
            background: rgba(45, 45, 45, 0.9);
            padding: 2rem;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            width: 100%;
            max-width: 400px;
            border: 1px solid var(--border-color);
        }
        
        .login-box h2 {
            color: var(--primary-red);
            margin-bottom: 1.5rem;
            text-align: center;
            font-size: 1.8rem;
        }
        
        .login-error {
            background: rgba(209, 0, 0, 0.1);
            border: 1px solid var(--primary-red);
            color: #ff6b6b;
            padding: 0.75rem;
            border-radius: 5px;
            margin-bottom: 1rem;
            text-align: center;
        }
        
        .login-box label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--text-gray);
            font-weight: 500;
        }
        
        .login-box input {
            width: 100%;
            padding: 0.75rem;
            margin-bottom: 1.5rem;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid var(--border-color);
            border-radius: 5px;
            color: var(--text-light);
            font-size: 1rem;
        }
        
        .login-box input:focus {
            outline: none;
            border-color: var(--primary-red);
        }
        
        .login-box button {
            width: 100%;
            padding: 0.75rem;
            background: var(--primary-red);
            color: white;
            border: none;
            border-radius: 5px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.3s ease;
        }
        
        .login-box button:hover {
            background: #b00000;
        }
        
        /* Sidebar */
        .sidebar {
            position: fixed;
            left: 0;
            top: 0;
            height: 100vh;
            background: var(--card-bg);
            padding: 1.5rem;
            display: flex;
            flex-direction: column;
            border-right: 1px solid var(--border-color);
        }
        
        .logo {
            font-size: 2rem;
            font-weight: 800;
            color: var(--text-light);
            margin-bottom: 2rem;
            text-align: center;
        }
        
        .logo span {
            color: var(--primary-red);
        }
        
        .sidebar-nav ul {
            list-style: none;
        }
        
        .sidebar-nav li {
            margin-bottom: 0.5rem;
        }
        
        .tab-btn {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem 1rem;
            color: var(--text-gray);
            text-decoration: none;
            border-radius: 5px;
            transition: all 0.3s ease;
            font-weight: 500;
        }
        
        .tab-btn:hover,
        .tab-btn.active {
            background: var(--primary-red);
            color: white;
        }
        
        .logout-link {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-gray);
            text-decoration: none;
            padding: 0.75rem 1rem;
            border-radius: 5px;
            transition: all 0.3s ease;
        }
        
        .logout-link:hover {
            background: rgba(209, 0, 0, 0.1);
            color: var(--primary-red);
        }
        
        /* Main Content */
        .main-content {
            min-height: 100vh;
            background: var(--dark-bg);
        }
        
        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 2rem;
        }
        
        .page-title {
            color: var(--text-light);
            margin-bottom: 1.5rem;
            font-size: 1.8rem;
            font-weight: 700;
        }
        
        /* Tabs */
        .tab-content {
            display: none;
            animation: fadeIn 0.3s ease;
        }
        
        .tab-content.active {
            display: block;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        /* Alerts */
        .alert {
            padding: 1rem;
            margin-bottom: 1.5rem;
            border-radius: 5px;
            animation: slideIn 0.3s ease;
        }
        
        .alert-success {
            background: rgba(76, 175, 80, 0.1);
            border: 1px solid #4caf50;
            color: #81c784;
        }
        
        .alert-error {
            background: rgba(244, 67, 54, 0.1);
            border: 1px solid #f44336;
            color: #e57373;
        }
        
        @keyframes slideIn {
            from { transform: translateY(-10px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }
        
        /* Dashboard Cards */
        .dashboard-row {
            display: grid;
            gap: 1.5rem;
            margin-bottom: 2rem;
        }
        
        .dashboard-card {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: 10px;
            border: 1px solid var(--border-color);
            transition: transform 0.3s ease;
        }
        
        .dashboard-card:hover {
            transform: translateY(-5px);
        }
        
        .stat-title {
            color: var(--text-gray);
            font-size: 0.9rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 0.5rem;
        }
        
        .stat-value {
            color: var(--text-light);
            font-size: 2rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
        }
        
        .stat-desc {
            color: var(--text-gray);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        /* Cards */
        .card {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: 10px;
            border: 1px solid var(--border-color);
            margin-bottom: 2rem;
        }
        
        .card h3 {
            color: var(--text-light);
            margin-bottom: 1.5rem;
            font-size: 1.3rem;
            border-bottom: 2px solid var(--primary-red);
            padding-bottom: 0.5rem;
        }
        
        /* Forms */
        .form-group {
            margin-bottom: 1.5rem;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--text-light);
            font-weight: 500;
        }
        
        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 0.75rem;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid var(--border-color);
            border-radius: 5px;
            color: var(--text-light);
            font-size: 1rem;
        }
        
        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--primary-red);
        }
        
        .form-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1rem;
        }
        
        /* Buttons */
        .btn {
            background: var(--primary-red);
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 5px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .btn:hover {
            background: #b00000;
        }
        
        .btn-outline {
            background: transparent;
            border: 2px solid var(--primary-red);
            color: var(--primary-red);
        }
        
        .btn-outline:hover {
            background: var(--primary-red);
            color: white;
        }
        
        .btn-small {
            padding: 0.35rem 0.75rem;
            font-size: 0.875rem;
            background: rgba(255, 255, 255, 0.1);
            color: var(--text-light);
            border: 1px solid var(--border-color);
            border-radius: 3px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .btn-small:hover {
            background: var(--primary-red);
            border-color: var(--primary-red);
        }
        
        .btn-danger {
            background: #dc3545;
        }
        
        .btn-danger:hover {
            background: #c82333;
        }
        
        /* Member Images */
        .member-image {
            width: 80px;
            height: 80px;
            object-fit: cover;
            border-radius: 50%;
            border: 2px solid var(--border-color);
        }
        
        /* Badges */
        .badge {
            display: inline-block;
            padding: 0.25rem 0.5rem;
            border-radius: 3px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        
        .badge-standard { background: #6c757d; color: white; }
        .badge-premium { background: var(--primary-red); color: white; }
        .badge-ultra { background: #ffd700; color: #333; }
        .badge-active { background: #28a745; color: white; }
        .badge-inactive { background: #6c757d; color: white; }
        .badge-suspended { background: #dc3545; color: white; }
        
        /* Tables */
        .dashboard-table {
            width: 100%;
            background: var(--card-bg);
            border-collapse: collapse;
            border-radius: 5px;
            overflow: hidden;
        }
        
        .dashboard-table th {
            background: rgba(255, 255, 255, 0.05);
            color: var(--text-light);
            padding: 1rem;
            text-align: left;
            font-weight: 600;
            border-bottom: 2px solid var(--border-color);
        }
        
        .dashboard-table td {
            padding: 1rem;
            border-bottom: 1px solid var(--border-color);
            color: var(--text-gray);
        }
        
        .dashboard-table tr:hover {
            background: rgba(255, 255, 255, 0.02);
        }
        
        .actions-cell {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }
        
        /* ID CARD LANDSCAPE STYLES */
        .id-card-container {
            display: flex;
            justify-content: center;
            padding: 2rem;
            background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
            border-radius: 15px;
            margin: 2rem 0;
        }
        
        .id-card-landscape {
            display: flex;
            width: 850px;
            height: 550px;
            background: white;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
            position: relative;
        }
        
        /* FRONT SIDE */
        .id-card-front {
            width: 425px;
            height: 100%;
            background: linear-gradient(135deg, #d10000 0%, #a80000 100%);
            color: white;
            padding: 25px;
            position: relative;
            overflow: hidden;
        }
        
        .id-card-front::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 300px;
            height: 300px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 50%;
        }
        
        .id-card-front::after {
            content: '';
            position: absolute;
            bottom: -30%;
            left: -30%;
            width: 200px;
            height: 200px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 50%;
        }
        
        .id-card-header {
            text-align: center;
            margin-bottom: 25px;
            position: relative;
            z-index: 2;
        }
        
        .club-logo-large {
            font-size: 42px;
            font-weight: 900;
            margin-bottom: 5px;
            letter-spacing: 2px;
        }
        
        .logo-text {
            color: white;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .logo-subtext {
            font-size: 12px;
            letter-spacing: 4px;
            opacity: 0.9;
            margin-top: -5px;
        }
        
        .official-badge {
            display: inline-block;
            background: rgba(255, 215, 0, 0.2);
            border: 2px solid #ffd700;
            padding: 8px 20px;
            border-radius: 20px;
            font-size: 14px;
            letter-spacing: 2px;
            margin-top: 10px;
        }
        
        .id-card-body {
            display: flex;
            gap: 25px;
            position: relative;
            z-index: 2;
        }
        
        .photo-section {
            flex: 1;
        }
        
        .photo-frame {
            background: white;
            padding: 10px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }
        
        .member-photo-large {
            width: 150px;
            height: 180px;
            object-fit: cover;
            border-radius: 5px;
            display: block;
        }
        
        .member-id-front {
            text-align: center;
            font-weight: bold;
            font-size: 16px;
            margin-top: 10px;
            color: #333;
            background: #ffd700;
            padding: 5px;
            border-radius: 5px;
        }
        
        .details-section {
            flex: 1.5;
        }
        
        .detail-row {
            margin-bottom: 12px;
            display: flex;
            align-items: center;
        }
        
        .detail-label {
            font-weight: bold;
            font-size: 12px;
            width: 110px;
            opacity: 0.9;
        }
        
        .detail-value {
            flex: 1;
            font-size: 14px;
            font-weight: 600;
        }
        
        .barcode-section {
            position: absolute;
            bottom: 80px;
            left: 25px;
            right: 25px;
        }
        
        .barcode-placeholder {
            background: white;
            padding: 15px;
            border-radius: 8px;
            text-align: center;
        }
        
        .barcode-lines {
            height: 40px;
            background: repeating-linear-gradient(
                90deg,
                #333 0px,
                #333 2px,
                transparent 2px,
                transparent 4px
            );
            margin-bottom: 5px;
        }
        
        .barcode-number {
            font-family: 'Courier New', monospace;
            font-size: 14px;
            letter-spacing: 2px;
            color: #333;
            font-weight: bold;
        }
        
        .id-card-footer {
            position: absolute;
            bottom: 25px;
            left: 25px;
            right: 25px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            z-index: 2;
        }
        
        .footer-text {
            font-size: 12px;
            opacity: 0.9;
        }
        
        .club-signature {
            font-size: 12px;
            border-top: 1px solid rgba(255, 255, 255, 0.5);
            padding-top: 5px;
            text-align: center;
        }
        
        /* BACK SIDE */
        .id-card-back {
            width: 425px;
            height: 100%;
            background: white;
            color: #333;
            padding: 25px;
            position: relative;
            border-left: 2px dashed #ccc;
        }
        
        .back-header {
            text-align: center;
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 2px solid #d10000;
        }
        
        .club-logo-back {
            font-size: 36px;
            font-weight: 900;
            color: #d10000;
            margin-bottom: 5px;
        }
        
        .club-logo-back span {
            color: #ffd700;
        }
        
        .back-title {
            font-size: 18px;
            font-weight: bold;
            color: #d10000;
            letter-spacing: 2px;
        }
        
        .back-body {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        
        .back-details {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }
        
        .back-detail-row {
            display: flex;
            flex-direction: column;
        }
        
        .back-label {
            font-size: 11px;
            font-weight: bold;
            color: #666;
            margin-bottom: 3px;
        }
        
        .back-value {
            font-size: 13px;
            font-weight: 500;
            color: #333;
            padding: 5px;
            background: #f5f5f5;
            border-radius: 4px;
        }
        
        .terms-section {
            background: #f9f9f9;
            padding: 15px;
            border-radius: 8px;
            border-left: 4px solid #d10000;
        }
        
        .terms-section h4 {
            color: #d10000;
            margin-bottom: 10px;
            font-size: 14px;
        }
        
        .terms-section p {
            font-size: 10px;
            margin-bottom: 5px;
            color: #666;
            line-height: 1.4;
        }
        
        .contact-section {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 10px;
        }
        
        .contact-info {
            font-size: 11px;
            color: #666;
            line-height: 1.5;
        }
        
        .qr-code-placeholder {
            text-align: center;
        }
        
        .qr-code {
            width: 80px;
            height: 80px;
            background: #333;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 14px;
            margin: 0 auto 5px;
            border-radius: 5px;
        }
        
        .qr-label {
            font-size: 9px;
            color: #666;
        }
        
        .back-footer {
            position: absolute;
            bottom: 25px;
            left: 25px;
            right: 25px;
            display: flex;
            justify-content: space-between;
            font-size: 11px;
            color: #666;
            padding-top: 10px;
            border-top: 1px solid #eee;
        }
        
        /* Print styles for ID card */
        @media print {
            body * {
                visibility: hidden;
            }
            
            .id-card-container,
            .id-card-container * {
                visibility: visible;
            }
            
            .id-card-container {
                position: absolute;
                left: 0;
                top: 0;
                width: 100%;
                padding: 0;
                margin: 0;
                background: white;
            }
            
            .no-print {
                display: none !important;
            }
            
            .id-card-landscape {
                box-shadow: none;
                margin: 0 auto;
            }
        }
        
        /* Print button for ID card */
        .print-actions {
            text-align: center;
            margin: 2rem 0;
            padding: 1.5rem;
            background: var(--card-bg);
            border-radius: 10px;
            display: flex;
            justify-content: center;
            gap: 1rem;
            flex-wrap: wrap;
        }
        
        /* Modal */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
        }
        
        .modal-content {
            background: var(--card-bg);
            margin: 10% auto;
            padding: 2rem;
            border: 1px solid var(--border-color);
            width: 90%;
            max-width: 500px;
            border-radius: 10px;
            position: relative;
        }
        
        .close {
            position: absolute;
            right: 1.5rem;
            top: 1.5rem;
            color: var(--text-gray);
            font-size: 1.5rem;
            font-weight: bold;
            cursor: pointer;
        }
        
        .close:hover {
            color: var(--primary-red);
        }
        
        /* Footer */
        footer {
            margin-top: 3rem;
            padding: 2rem;
            background: var(--card-bg);
            border-top: 1px solid var(--border-color);
            text-align: center;
        }
        
        .footer-logo {
            font-size: 1.5rem;
            font-weight: 800;
            color: var(--text-light);
            margin-bottom: 1rem;
        }
        
        .footer-logo span {
            color: var(--primary-red);
        }
        
        .footer-links {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 2rem;
            margin-bottom: 1rem;
        }
        
        .footer-links a {
            color: var(--text-gray);
            text-decoration: none;
            transition: color 0.3s ease;
        }
        
        .footer-links a:hover {
            color: var(--primary-red);
        }
        
        .copyright {
            color: var(--text-gray);
            font-size: 0.875rem;
        }
        
        /* Image Preview */
        #imagePreview {
            margin-top: 0.5rem;
        }
        
        #imagePreview img {
            max-width: 200px;
            max-height: 200px;
            border-radius: 5px;
            border: 1px solid var(--border-color);
        }
   