/* =============================================
   MiTaxi Fleet Management Dashboard
   Professional Dark Theme
   ============================================= */

/* ----- CSS Custom Properties ----- */
:root {
    --primary: #FBBF24;
    --primary-dark: #F59E0B;
    --primary-light: rgba(251, 191, 36, 0.12);
    --primary-glow: rgba(251, 191, 36, 0.25);

    --bg: #0F172A;
    --surface: #1E293B;
    --surface-2: #334155;
    --surface-3: #3E4C63;
    --border: #475569;
    --border-light: rgba(71, 85, 105, 0.5);

    --text: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-dim: #64748B;

    --success: #22C55E;
    --success-light: rgba(34, 197, 94, 0.12);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --info: #3B82F6;
    --info-light: rgba(59, 130, 246, 0.12);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.12);

    --sidebar-w: 264px;
    --sidebar-collapsed: 0px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow: 0 4px 24px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.5);
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ----- Reset ----- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* =============================================
   AUTH SCREEN
   ============================================= */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 20px;
    position: relative;
}

/* Subtle grid pattern background */
.auth-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(251,191,36,0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(59,130,246,0.03) 0%, transparent 50%);
    pointer-events: none;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.auth-logo {
    text-align: center;
    margin-bottom: 36px;
}

.auth-logo-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(251,191,36,0.3);
}

.auth-logo-icon svg { width: 28px; height: 28px; color: #000; }

.auth-logo h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.auth-logo h1 span { color: var(--primary); }

.auth-logo p {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 14px;
    font-weight: 500;
}

.auth-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}

/* Auth Steps Indicator */
.auth-steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 0 20px;
}
.auth-step-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}
.auth-step-dot.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(251,191,36,0.3);
}
.auth-step-dot.done {
    background: rgba(34,197,94,0.15);
    color: #22C55E;
    border-color: #22C55E;
}
.auth-step-line {
    flex: 1; height: 2px;
    background: var(--surface-2);
    max-width: 50px;
    transition: background 0.3s ease;
}
.auth-step-line.done { background: #22C55E; }

/* Password Field */
.password-field {
    position: relative;
}
.password-field .form-control { padding-right: 48px; }
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}
.password-toggle:hover { color: var(--text); }

/* =============================================
   SETUP SCREEN
   ============================================= */
.setup-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.setup-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 44px 40px;
    width: 100%;
    max-width: 560px;
    box-shadow: var(--shadow-lg);
}

.setup-card h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.setup-card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-dim);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-dim);
}

.vehicle-class-checks {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
}
.class-check {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all .15s;
    user-select: none;
}
.class-check:has(input:checked) {
    border-color: var(--primary);
    background: rgba(251,191,36,0.1);
    color: var(--primary);
}
.class-check input { display: none; }

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
    margin-top: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

/* Input with suffix (e.g., "%") */
.input-with-suffix {
    position: relative;
}
.input-with-suffix .form-control {
    padding-right: 48px;
}
.input-suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
}

/* Range slider */
.range-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.range-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    outline: none;
}
.range-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.range-value {
    min-width: 50px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 6px 0;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(251,191,36,0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--surface-2);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface-3);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
    background: #DC2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--text);
}

.btn-success-outline {
    background: transparent;
    border: 1px solid var(--success);
    color: var(--success);
}
.btn-success-outline:hover:not(:disabled) { background: var(--success-light); }

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-light); }

.btn-info-outline {
    background: transparent;
    border: 1px solid var(--info);
    color: var(--info);
}
.btn-info-outline:hover:not(:disabled) { background: var(--info-light); }

.btn-warning-outline {
    background: transparent;
    border: 1px solid var(--warning);
    color: var(--warning);
}
.btn-warning-outline:hover:not(:disabled) { background: var(--warning-light); }

.btn-sm {
    padding: 7px 12px;
    font-size: 12px;
    border-radius: var(--radius-xs);
}
.btn-sm svg { width: 14px; height: 14px; }

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
}

.btn-block { width: 100%; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}
.btn-icon.sm {
    width: 32px;
    height: 32px;
}

/* =============================================
   APP LAYOUT
   ============================================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0F172A 0%, #131C31 100%);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-slow);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; color: #000; }

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
}
.sidebar-logo-text span { color: var(--primary); }

.sidebar-company {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.sidebar-company-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.sidebar-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-section { margin-bottom: 20px; }

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 12px;
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
}
.nav-item:hover {
    background: rgba(251,191,36,0.06);
    color: var(--text);
}
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--primary);
}
.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}
.nav-badge.danger {
    background: var(--danger);
    color: #fff;
}

/* Notification indicator */
.nav-notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    margin-left: auto;
    flex-shrink: 0;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.sidebar-user:hover { background: var(--surface-2); }

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: #000;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 11px;
    color: var(--text-dim);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 4px;
}
.sidebar-logout:hover {
    background: var(--danger-light);
    color: var(--danger);
}
.sidebar-logout svg {
    width: 18px;
    height: 18px;
}

/* ----- Main Content Area ----- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
    flex-shrink: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.page-body {
    padding: 24px 32px;
    flex: 1;
}

/* Mobile menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
}
.mobile-menu-btn:hover { background: var(--surface-2); }
.mobile-menu-btn svg { width: 22px; height: 22px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    backdrop-filter: blur(2px);
}

/* =============================================
   STAT CARDS
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-card:hover {
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-card:hover::before { opacity: 1; }

.stat-card.accent-primary::before { background: var(--primary); }
.stat-card.accent-success::before { background: var(--success); }
.stat-card.accent-info::before { background: var(--info); }
.stat-card.accent-danger::before { background: var(--danger); }
.stat-card.accent-warning::before { background: var(--warning); }

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-card-icon svg { width: 22px; height: 22px; }

.stat-card-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-card-icon.success { background: var(--success-light); color: var(--success); }
.stat-card-icon.info { background: var(--info-light); color: var(--info); }
.stat-card-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-card-icon.warning { background: var(--warning-light); color: var(--warning); }

.stat-card-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.stat-card-sub {
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.stat-card-sub .sub-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sub-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sub-dot.online { background: var(--success); }
.sub-dot.busy { background: var(--warning); }
.sub-dot.danger { background: var(--danger); }

/* Quick actions row */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.quick-action-btn svg { width: 18px; height: 18px; }
.quick-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* =============================================
   TABLES
   ============================================= */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.table-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.table-count {
    font-size: 12px;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: rgba(15,23,42,0.5);
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(71,85,105,0.3);
    font-size: 13px;
    white-space: nowrap;
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
    transition: background var(--transition);
}
tbody tr:hover {
    background: rgba(251,191,36,0.03);
}

.table-empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-dim);
}
.table-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    opacity: 0.35;
}
.table-empty p {
    font-size: 14px;
    font-weight: 500;
}

/* Table footer / pagination */
.table-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.table-info {
    font-size: 12px;
    color: var(--text-dim);
}

.pagination {
    display: flex;
    gap: 4px;
}
.pagination button {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}
.pagination button.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: 700;
}
.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* =============================================
   BADGES
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.badge-online  { background: var(--success-light); color: var(--success); }
.badge-offline { background: rgba(100,116,139,0.15); color: var(--text-dim); }
.badge-busy    { background: var(--warning-light); color: var(--warning); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-info    { background: var(--info-light); color: var(--info); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-neutral { background: rgba(100,116,139,0.15); color: var(--text-secondary); }
.badge-primary-sm { display: inline-block; padding: 2px 8px; background: rgba(251,191,36,0.1); color: var(--primary); border-radius: 6px; font-size: 11px; font-weight: 600; margin: 1px 0; }
.table-actions { display: flex; gap: 4px; }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge-dot.pulse { animation: pulse-dot 2s infinite; }

/* Low balance warning tag */
.tag-low-balance {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--danger-light);
    color: var(--danger);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 700;
    margin-left: 4px;
}

/* Sub-partner roles */
.sp-role {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sp-role-admin   { background: var(--primary-light); color: var(--primary); }
.sp-role-manager { background: var(--info-light); color: var(--info); }
.sp-role-viewer  { background: rgba(100,116,139,0.15); color: var(--text-secondary); }

/* =============================================
   CARDS & SECTIONS
   ============================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}
.card + .card { margin-top: 20px; }

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 700;
}
.card-body { padding: 24px; }

/* Balance overview card */
.balance-card {
    background: linear-gradient(135deg, var(--surface) 0%, rgba(251,191,36,0.05) 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.balance-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.balance-card-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

/* =============================================
   MODAL SYSTEM
   ============================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.2s;
    box-shadow: var(--shadow-lg);
}
.modal.lg { max-width: 680px; }
.modal.xl { max-width: 860px; }

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.modal-close:hover {
    background: var(--surface-2);
    color: var(--text);
}
.modal-close svg { width: 18px; height: 18px; }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* =============================================
   SLIDE PANEL (driver detail)
   ============================================= */
.slide-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}
.slide-panel-overlay.show {
    opacity: 1;
    visibility: visible;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 520px;
    max-width: 90vw;
    background: var(--surface);
    border-left: 1px solid var(--border-light);
    z-index: 195;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.slide-panel-overlay.show .slide-panel,
.slide-panel.show {
    transform: translateX(0);
}

.slide-panel-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.slide-panel-header h3 {
    font-size: 16px;
    font-weight: 700;
}
.slide-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* =============================================
   FILTER TABS
   ============================================= */
.filter-tabs {
    display: inline-flex;
    gap: 2px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-light);
}
.filter-tab {
    padding: 7px 16px;
    border: none;
    background: none;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
}
.filter-tab:hover { color: var(--text-secondary); }
.filter-tab.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 1px 4px rgba(251,191,36,0.25);
}

/* =============================================
   SEARCH INPUT
   ============================================= */
.search-input {
    position: relative;
}
.search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    pointer-events: none;
}
.search-input input {
    padding-left: 38px;
    min-width: 220px;
}

/* =============================================
   TOPUP PRESETS
   ============================================= */
.topup-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.topup-preset {
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.topup-preset:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* =============================================
   DRIVER INFO CELLS
   ============================================= */
.driver-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.driver-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    letter-spacing: -0.02em;
}
.driver-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}
.driver-phone {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 1px;
}

.driver-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}
.driver-actions .btn-sm { padding: 5px 7px; }

/* Vehicle plate */
.vehicle-plate {
    font-weight: 700;
    color: var(--text);
    font-size: 12px;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    display: inline-block;
    letter-spacing: 0.03em;
}

/* Balance colors */
.balance-ok {
    color: var(--success);
    font-weight: 700;
    font-size: 13px;
}
.balance-low {
    color: var(--danger);
    font-weight: 700;
    font-size: 13px;
}

/* Amount coloring */
.amount-positive { color: var(--success); font-weight: 600; }
.amount-negative { color: var(--danger); font-weight: 600; }

/* =============================================
   BALANCE HISTORY SUMMARY
   ============================================= */
.balance-summary {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15,23,42,0.4);
}
.balance-summary-label {
    font-size: 13px;
    color: var(--text-secondary);
}
.balance-summary-value {
    font-size: 22px;
    font-weight: 800;
}

/* =============================================
   DOCUMENTS GRID
   ============================================= */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.doc-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition);
}
.doc-card:hover { border-color: var(--border); }

.doc-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    overflow: hidden;
}
.doc-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doc-card-body { padding: 14px; }
.doc-card-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.doc-card-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.doc-card-actions {
    display: flex;
    gap: 8px;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    min-width: 320px;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toast-in 0.3s ease;
    transition: opacity 0.3s;
    pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}
.toast-icon svg { width: 20px; height: 20px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon   { color: var(--danger); }
.toast.info .toast-icon    { color: var(--info); }

.toast-content { flex: 1; min-width: 0; }
.toast-message {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* =============================================
   LOADING SPINNER
   ============================================= */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
.spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;
    gap: 14px;
    color: var(--text-dim);
    font-size: 13px;
}

/* Skeleton shimmer */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* =============================================
   DROPDOWN MENU
   ============================================= */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: all 0.15s ease;
    padding: 4px 0;
    margin-top: 4px;
}
.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--text);
}
.dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* =============================================
   DRIVER DETAIL SECTIONS
   ============================================= */
.detail-section {
    margin-bottom: 24px;
}
.detail-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
}
.detail-row:not(:last-child) {
    border-bottom: 1px solid rgba(71,85,105,0.2);
}
.detail-label { color: var(--text-secondary); }
.detail-value { font-weight: 600; text-align: right; }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
    text-align: center;
    padding: 64px 32px;
}
.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-dim);
    opacity: 0.3;
    margin-bottom: 18px;
}
.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.empty-state p {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* =============================================
   UTILITY CLASSES
   ============================================= */
.hidden { display: none !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }

/* =============================================
   RESPONSIVE
   ============================================= */

/* Large screens - 3 col stats */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .page-body { padding: 20px 24px; }
    .page-header { padding: 16px 24px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .page-header {
        padding: 14px 16px;
    }
    .page-body {
        padding: 16px;
    }
    .page-title {
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-card-value {
        font-size: 22px;
    }
    .stat-card-icon {
        width: 38px;
        height: 38px;
    }
    .stat-card-icon svg { width: 18px; height: 18px; }

    .table-header {
        padding: 12px 16px;
    }
    thead th, tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 32px 24px;
    }
    .setup-card {
        padding: 28px 20px;
    }

    .modal {
        margin: 8px;
        max-height: 95vh;
    }

    .slide-panel {
        width: 100%;
        max-width: 100vw;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    .toast {
        min-width: 0;
        max-width: 100%;
    }

    .quick-actions { gap: 8px; }
    .quick-action-btn { padding: 8px 14px; font-size: 12px; }

    .search-input input { min-width: 160px; }

    .docs-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .page-actions {
        flex-wrap: wrap;
    }
    .filter-tabs {
        width: 100%;
        overflow-x: auto;
    }
    .table-actions {
        flex-wrap: wrap;
    }
    .balance-card-value {
        font-size: 26px;
    }
    .payment-methods-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   Payment Methods Page
   ========================================== */
.payment-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.payment-method-card {
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.25s ease;
    opacity: 0.6;
}

.payment-method-card.active {
    border-color: var(--primary);
    opacity: 1;
}

.payment-method-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.payment-method-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.payment-method-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.payment-method-status {
    margin-top: 8px;
}

/* Commission Breakdown */
.commission-breakdown {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.commission-item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.commission-label {
    font-size: 14px;
    color: var(--text-muted);
    min-width: 160px;
}

.commission-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    min-width: 50px;
}

.commission-bar {
    flex: 1;
    min-width: 120px;
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    overflow: hidden;
}

.commission-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Badge styles */
.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}
