* { box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }

body { background: #f3f4f6; margin: 0; padding: 16px; transition: background 0.3s, color 0.3s; min-height: 100vh; }
body.dark { background: #1e1e2f; color: #e2e2e2; }
body.dark .card { background: #2a2a3a; }
body.dark input, body.dark select, body.dark button, body.dark textarea { background: #3a3a4a; color: #e2e2e2; border-color: #555; }
body.dark .popup-content { background: #2a2a3a; }
body.dark .pending-card { background: #2a2a3a; border-color: #4a4a5a; }
body.dark .stat-card { background: #3a3a4a; }
body.dark .stat-card-header { background: #4a4a5a; }
body.dark .filter-btn { background: #3a3a4a; border-color: #4a4a5a; color: #a0a0b0; }
body.dark .filter-btn.active { background: #3b82f6; color: white; }
body.dark .commission-table th { background: #4a4a5a; }
body.dark .admin-record-card { background: #3a3a4a; border-color: #4a4a5a; }

/* Login Page */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-container { display: flex; max-width: 1200px; width: 100%; background: white; border-radius: 32px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.login-hero { flex: 1; background: linear-gradient(135deg, #1e3a5f 0%, #0f2b44 100%); position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" opacity="0.1"><path fill="white" d="M45.3 49.8c-9 8-9 22 0 30l36 36c9 9 23 9 32 0l36-36c9-8 9-22 0-30l-36-36c-9-8-23-8-32 0l-36 36z"/></svg>'); background-repeat: repeat; background-size: 40px; opacity: 0.1; }
.hero-content { position: relative; z-index: 2; color: white; }
.logo-wrapper { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; }
.logo-icon { width: 40px; height: 40px; color: white; }
.logo-text { font-size: 1.5rem; font-weight: 700; }
.hero-title { font-size: 2.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 20px; }
.hero-highlight { color: #60a5fa; border-bottom: 3px solid #60a5fa; }
.hero-desc { font-size: 1rem; opacity: 0.8; margin-bottom: 40px; line-height: 1.5; }
.hero-stats { display: flex; gap: 32px; margin-top: 20px; }
.stat-item { display: flex; flex-direction: column; }
.stat-number { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; opacity: 0.7; }
.login-form { flex: 1; padding: 48px; background: white; display: flex; flex-direction: column; justify-content: center; }
.form-header h2 { font-size: 1.8rem; margin: 0 0 8px 0; color: #0f172a; }
.form-header p { color: #64748b; margin-bottom: 24px; }
.input-with-icon { display: flex; align-items: center; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; transition: all 0.2s; margin-bottom: 16px; }
.input-with-icon:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.input-icon { padding: 0 12px; font-size: 1.2rem; color: #64748b; }
.form-input { flex: 1; border: none; background: transparent; padding: 14px 12px; font-size: 1rem; outline: none; }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; border: none; border-radius: 12px; padding: 14px 24px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; width: 100%; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -5px rgba(59,130,246,0.4); }
.btn-outline { background: transparent; border: 2px solid #e2e8f0; border-radius: 12px; padding: 12px 24px; font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: all 0.2s; width: 100%; color: #1e293b; margin-top: 16px; }
.btn-outline:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-secondary { background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; }
.btn-danger { background: #ef4444; }
.btn-warning { background: #f59e0b; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; width: auto; border-radius: 20px; }
.btn-block { width: 100%; margin-top: 8px; }
.form-divider { text-align: center; margin: 24px 0; position: relative; }
.form-divider::before, .form-divider::after { content: ''; position: absolute; top: 50%; width: calc(50% - 30px); height: 1px; background: #e2e8f0; }
.form-divider::before { left: 0; }
.form-divider::after { right: 0; }
.form-divider span { background: white; padding: 0 16px; color: #94a3b8; }
.app-status { margin-top: 16px; padding: 12px; text-align: center; border-radius: 12px; font-size: 0.85rem; min-height: 50px; }

/* Main App */
.container { max-width: 1200px; margin: 0 auto; }
.card { background: white; border-radius: 24px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: background 0.3s; }
h2 { font-size: 1.5rem; margin: 0 0 12px 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.flex-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-group { flex: 1; min-width: 120px; }
label { display: block; font-size: 0.8rem; font-weight: 500; margin-bottom: 4px; }
input, select, button, textarea { padding: 10px 12px; border-radius: 14px; border: 1px solid #cbd5e1; font-size: 1rem; background: white; }
button { background: #6366f1; color: white; border: none; font-weight: 600; cursor: pointer; transition: 0.2s; }
button:hover { background: #4f46e5; }
button:disabled { background: #9ca3af; cursor: not-allowed; }

/* Sticky Header */
.sticky-top { position: sticky; top: 0; z-index: 100; background: inherit; }
.sticky-top .card:first-child { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sticky-top .card:last-child { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }

/* Badges */
.badge { background: #ef4444; color: white; border-radius: 20px; padding: 2px 8px; font-size: 0.7rem; margin-left: 8px; display: inline-block; }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.7rem; margin-left: 8px; }
.role-admin { background: #6366f1; color: white; }
.role-spv { background: #10b981; color: white; }
.role-member { background: #f59e0b; color: white; }

/* Filter Bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; align-items: flex-end; }
.filter-btn { padding: 6px 16px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 20px; font-size: 0.75rem; cursor: pointer; color: #64748b; transition: all 0.2s; }
.filter-btn.active { background: #3b82f6; border-color: #3b82f6; color: white; }

/* Scrollable Container */
.scrollable-container { max-height: 400px; overflow-y: auto; overflow-x: hidden; }

/* Admin Tabs */
.admin-tabs-container { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px; background: #f1f5f9; border-bottom: 1px solid #e2e8f0; }
.admin-tab-btn { padding: 8px 16px; background: transparent; border: none; border-radius: 20px; font-weight: 500; font-size: 0.8rem; cursor: pointer; color: #64748b; transition: all 0.2s; }
.admin-tab-btn:hover { background: #e2e8f0; color: #1e293b; }
.admin-tab-btn.active { background: #3b82f6; color: white; }

/* Admin Record Card */
.admin-record-card { display: flex; justify-content: space-between; align-items: center; padding: 12px; margin-bottom: 8px; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; flex-wrap: wrap; gap: 12px; }

/* Popups */
.popup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.popup-content { background: white; padding: 24px; border-radius: 30px; max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; }
.password-wrapper { display: flex; gap: 8px; align-items: center; }
.toggle-pwd { width: auto; padding: 10px; background: #9ca3af; }

/* Pending Cards (SPV) */
.pending-card { background: white; border-radius: 16px; padding: 14px; margin-bottom: 12px; border: 1px solid #e2e8f0; }

/* Commission Table */
.commission-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.commission-table th, .commission-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.commission-table th { background: #f1f5f9; font-weight: 600; }

/* Dark Mode Toggle */
.dark-toggle { position: fixed; bottom: 20px; right: 20px; background: #6366f1; border-radius: 50%; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 24px; z-index: 1000; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* Avatar */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: white; font-weight: bold; flex-shrink: 0; }

/* Logout Button */
.logout-btn:hover { background: #dc2626 !important; }

/* Responsive */
@media (max-width: 900px) {
    .login-container { flex-direction: column; border-radius: 24px; }
    .login-hero { padding: 32px; }
    .hero-title { font-size: 1.8rem; }
    .hero-stats { gap: 16px; }
    .login-form { padding: 32px; }
}
@media (max-width: 700px) {
    .flex-row { flex-direction: column; align-items: stretch; }
    .admin-tab-btn { font-size: 0.7rem; padding: 6px 12px; }
    .admin-record-card { flex-direction: column; align-items: flex-start; }
}