/* ═══════════════════════════════════════════════════════
   Shaheen Security – Fleet & Security Management
   Complete Stylesheet
   ═══════════════════════════════════════════════════════ */

/* ═══════ زر تبديل اللغة ═══════ */
.lang-toggle {
    background: var(--primary);
    border: 1.5px solid var(--primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    min-width: 50px;
}
.lang-toggle:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ═══════ دعم RTL / LTR ═══════ */
[dir="ltr"] .sidebar { left: 0; right: auto; }
[dir="ltr"] .main-content { margin-left: var(--sidebar-width); margin-right: 0; }
[dir="ltr"] .topbar { left: var(--sidebar-width); right: 0; }

[dir="rtl"] .sidebar { right: 0; left: auto; }
[dir="rtl"] .sidebar.collapsed { transform: translateX(100%); }
[dir="rtl"] .main-content { margin-right: var(--sidebar-width); margin-left: 0; }
[dir="rtl"] .sidebar.collapsed ~ .main-content { margin-right: 0; }
[dir="rtl"] .topbar { right: var(--sidebar-width); left: 0; }
[dir="rtl"] .sidebar.collapsed ~ .topbar { right: 0; }

[dir="ltr"] { text-align: left; }
[dir="rtl"] { text-align: right; }

[dir="ltr"] table { text-align: left; }
[dir="rtl"] table { text-align: right; }

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #DBEAFE;
    --secondary: #64748B;
    --accent: #10B981;
    --accent-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --bg: #F1F5F9;
    --card: #FFFFFF;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
}

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

html { font-size: 14px; }

body {
    font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

/* ═══════════════ SCROLLBAR ═══════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ═══════════════ LOGIN SCREEN ═══════════════ */
.login-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 50%, #3B82F6 100%);
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    top: -200px; right: -100px;
}
.login-screen::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    bottom: -150px; left: -100px;
}
.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    z-index: 1;
    animation: slideUp 0.4s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px; height: 64px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 16px;
    margin-bottom: 12px;
}
.login-logo h1 { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.login-logo p { color: var(--text-secondary); font-size: 13px; }
.login-footer { text-align: center; margin-top: 20px; }
.secure-badge { font-size: 11px; color: var(--text-muted); }

/* ═══════════════ FORMS ═══════════════ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; color: var(--text); font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; padding: 8px 12px; background: var(--danger-light); border-radius: 6px; }
.success-msg { color: var(--accent); font-size: 13px; margin-top: 8px; padding: 8px 12px; background: var(--accent-light); border-radius: 6px; }

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-secondary { background: #F1F5F9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #E2E8F0; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-loader { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ═══════════════ TOP BAR ═══════════════ */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-center { flex: 1; text-align: center; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
    background: none; border: none; cursor: pointer; color: var(--text);
    padding: 6px; border-radius: 6px; display: flex;
}
.sidebar-toggle:hover { background: #F1F5F9; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 20px; }
.brand-text { font-weight: 700; font-size: 16px; color: var(--primary); }
.page-title { font-weight: 600; font-size: 15px; color: var(--text); }

/* Connection Status */
.conn-status { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; }
.conn-status.connected .conn-dot { background: var(--accent); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.conn-status.connected .conn-text { color: var(--accent); }
.conn-status.disconnected .conn-dot { background: var(--danger); }
.conn-status.disconnected .conn-text { color: var(--danger); }

/* User Menu */
.user-btn { background: var(--primary); border: none; cursor: pointer; border-radius: 50%; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; }
.user-initials { color: white; font-size: 13px; font-weight: 600; }
.user-dropdown {
    position: absolute; top: calc(var(--topbar-height) - 4px); right: 16px;
    background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border); min-width: 200px; z-index: 200; padding: 8px 0;
}
.user-dropdown .user-info { padding: 12px 16px; }
.user-dropdown .user-info strong { display: block; font-size: 14px; }
.user-dropdown .user-info small { color: var(--text-muted); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.user-dropdown button {
    display: block; width: 100%; text-align: left; padding: 10px 16px;
    background: none; border: none; cursor: pointer; font-size: 13px; font-family: inherit; color: var(--text);
}
.user-dropdown button:hover { background: #F8FAFC; }

/* ═══════════════ SIDEBAR ═══════════════ */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 90;
    transition: transform 0.25s ease;
}
.sidebar.collapsed { transform: translateX(-100%); }
.sidebar-nav { padding: 12px 8px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover { background: #F8FAFC; color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item svg { flex-shrink: 0; }
.nav-divider { padding: 16px 12px 8px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-section { margin-top: 8px; }

/* ═══════════════ MAIN CONTENT ═══════════════ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    padding: 24px;
    transition: margin-left 0.25s ease;
}
.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* ═══════════════ VIEW COMMON STYLES ═══════════════ */
.view-header { margin-bottom: 20px; }
.view-header h2 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.view-header p { color: var(--text-secondary); font-size: 13px; }

/* Stats Cards Row */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: white; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-value.primary { color: var(--primary); }
.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-value.warning { color: var(--warning); }

/* Filter / Toolbar */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
    background: white; padding: 12px 16px; border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

/* ═══════════════ DATA TABLE ═══════════════ */
.table-container {
    background: white; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead { background: #F8FAFC; position: sticky; top: 0; z-index: 2; }
.data-table th {
    padding: 12px 14px; text-align: left;
    font-weight: 600; color: var(--text-secondary); font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: #F8FAFC; }
.data-table .scroll-wrap { max-height: calc(100vh - 340px); overflow-y: auto; }

/* Row Colors */
.row-day { background: #E3F2FD !important; }
.row-night { background: #FFF8E1 !important; }
.row-alarm { background: #FFF3CD !important; }
.row-active-green { background: #E6FFE6 !important; }
.row-late { background: #FFF0E0 !important; border-left: 4px solid #F59E0B !important; }
.row-too-short { background: #FEF9C3 !important; border-left: 4px solid #EAB308 !important; }

/* Alert Bell & Badge */
.alert-bell {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
}
.alert-bell:hover { background: var(--primary-light); color: var(--primary); }
.alert-badge {
    position: absolute;
    top: 0; right: 0;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: pulse 2s infinite;
}
.nav-badge {
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: auto;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Status Badges */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.badge-active { background: #D1FAE5; color: #065F46; }
.badge-completed { background: #DBEAFE; color: #1E40AF; }
.badge-normal { background: #D1FAE5; color: #065F46; }

/* ═══════════════ CARDS GRID ═══════════════ */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
    background: white; border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 16px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: #FAFBFC; }

/* Photo Grid */
.photo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.photo-grid img {
    width: 100%; height: 80px; object-fit: cover;
    border-radius: 4px; cursor: pointer;
    transition: opacity var(--transition);
}
.photo-grid img:hover { opacity: 0.85; }

/* Event Photos */
.event-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.event-photos img {
    width: 80px; height: 60px; object-fit: cover;
    border-radius: 6px; cursor: pointer;
    border: 2px solid var(--border);
    transition: border-color var(--transition);
}
.event-photos img:hover { border-color: var(--primary); }

/* ═══════════════ MAP ═══════════════ */
.map-container { width: 100%; height: calc(100vh - 200px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
#tracking-map { width: 100%; height: 100%; }

/* ═══════════════ MODALS ═══════════════ */
.modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-content {
    position: relative; background: white; border-radius: 12px;
    box-shadow: var(--shadow-lg); z-index: 1;
    max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-sm { width: 420px; max-width: 95vw; }
.modal-lg { width: 90vw; max-width: 1200px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Photo Viewer */
.photo-viewer { background: rgba(0,0,0,0.95); border-radius: 0; max-width: 100vw; width: 100vw; height: 100vh; max-height: 100vh; display: flex; align-items: center; justify-content: center; }
.photo-viewer img { max-width: 90vw; max-height: 85vh; object-fit: contain; }
.photo-close { position: absolute; top: 16px; right: 16px; color: white; font-size: 32px; z-index: 10; }
.photo-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.15); border: none; color: white;
    font-size: 48px; padding: 8px 16px; cursor: pointer; border-radius: 8px; z-index: 10;
}
.photo-nav:hover { background: rgba(255,255,255,0.25); }
.photo-prev-btn { left: 16px; }
.photo-next-btn { right: 16px; }
.photo-viewer-info { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.8); font-size: 13px; }

/* ═══════════════ LOADING ═══════════════ */
.loading-overlay {
    display: flex; align-items: center; justify-content: center;
    padding: 60px; color: var(--text-muted);
}
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 12px;
}
.load-more-trigger { height: 40px; display: flex; align-items: center; justify-content: center; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }

/* ═══════════════ CHECK ITEMS ═══════════════ */
.check-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; background: #F8FAFC; font-size: 12px; }
.check-ok { color: var(--accent); }
.check-fail { color: var(--danger); }

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    [dir="rtl"] .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; margin-right: 0 !important; padding: 16px; }
    .topbar { left: 0 !important; right: 0 !important; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .photo-grid { grid-template-columns: repeat(3, 1fr); }
    .cards-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .topbar-center { display: none; }
}

/* ═══════════════════════════════════════════════
   Shaheen Security — SaaS: Billing, SuperAdmin, Warnings
   ═══════════════════════════════════════════════ */

/* ── Subscription Warning Banner ── */
.subscription-banner {
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    position: sticky;
    top: 48px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.subscription-banner a { color: inherit; text-decoration: underline; }
.banner-warning { background: #fef3c7; color: #92400e; border-bottom: 1px solid #fcd34d; }
.banner-restricted { background: #fed7aa; color: #9a3412; border-bottom: 1px solid #fb923c; }
.banner-readonly { background: #fecaca; color: #991b1b; border-bottom: 1px solid #f87171; }
.banner-suspended { background: #991b1b; color: white; }

/* ── Billing View ── */
.billing-view .page-header { margin-bottom: 28px; }
.billing-view .page-header h2 { font-size: 22px; font-weight: 700; color: #1e3a5f; }
.billing-view .page-header p { color: #64748b; font-size: 14px; }

.billing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 32px; }
.billing-card {
    background: white;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
}
.billing-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}
.billing-card .card-header h3 { font-size: 15px; font-weight: 700; color: #1e3a5f; margin: 0; }
.billing-card .card-body { padding: 20px; }
.billing-card .card-footer { padding: 12px 20px; border-top: 1px solid #f1f5f9; }

.sub-status {
    padding: 4px 12px; border-radius: 50px; font-size: 12px; font-weight: 700;
}
.status-trial { background: #dbeafe; color: #1d4ed8; }
.status-active { background: #d1fae5; color: #065f46; }
.status-warning { background: #fef3c7; color: #92400e; }
.status-danger { background: #fecaca; color: #991b1b; }
.status-suspended { background: #1e293b; color: white; }

.sub-plan { font-size: 20px; font-weight: 800; color: #1e3a5f; margin-bottom: 4px; }
.sub-price { font-size: 15px; color: #64748b; margin-bottom: 12px; }
.sub-period { font-size: 13px; color: #94a3b8; margin-bottom: 16px; }

.usage-bar { margin-bottom: 10px; }
.usage-bar span { font-size: 13px; color: #475569; display: block; margin-bottom: 4px; }
.progress { height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 4px; transition: width 0.5s; }

.next-payment .due-date { font-size: 28px; font-weight: 800; color: #1e3a5f; }
.overdue-badge {
    display: inline-block; padding: 4px 14px; border-radius: 50px;
    background: #fecaca; color: #991b1b; font-size: 13px; font-weight: 700; margin-top: 8px;
}
.warning-text { font-size: 13px; color: #ea580c; margin-top: 8px; }

.billing-section { margin-bottom: 28px; }
.billing-section h3 { font-size: 17px; font-weight: 700; color: #1e3a5f; margin-bottom: 14px; }
.section-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

.invoice-status {
    padding: 3px 10px; border-radius: 50px; font-size: 12px; font-weight: 600;
}
.status-paid { background: #d1fae5; color: #065f46; }
.status-sent { background: #dbeafe; color: #1d4ed8; }
.status-overdue { background: #fecaca; color: #991b1b; }
.status-draft { background: #f1f5f9; color: #64748b; }
.status-void { background: #e2e8f0; color: #94a3b8; }

/* ── SuperAdmin View ── */
.sa-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.sa-stat-card {
    background: white; border-radius: 14px; padding: 20px;
    border: 1px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    text-align: center;
}
.sa-stat-card.sa-stat-warning { border-color: #fbbf24; background: #fffbeb; }
.sa-stat-label { font-size: 13px; color: #64748b; margin-bottom: 6px; }
.sa-stat-num { font-size: 32px; font-weight: 800; color: #1e3a5f; font-family: 'Inter', sans-serif; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 50px;
    font-size: 11px; font-weight: 700;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fecaca; color: #991b1b; }
.badge-dark { background: #1e293b; color: white; }
.badge-muted { background: #f1f5f9; color: #94a3b8; }

.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-success { background: #10b981; color: white; border: none; }
.btn-success:hover { background: #059669; }
.text-danger { color: #ef4444; font-weight: 700; }
.text-success { color: #10b981; }
.text-muted { color: #94a3b8; }

.search-input {
    padding: 8px 14px; border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: 14px; font-family: inherit; width: 220px;
}
.search-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* ── Modal (admin-style — used with .modal-card as root overlay) ── */
.modal-overlay:has(> .modal-card) {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.modal-card {
    background: white; border-radius: 16px; padding: 28px; max-width: 480px; width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-card h3 { font-size: 20px; font-weight: 700; color: #1e3a5f; margin-bottom: 16px; }
.modal-card .form-group { margin-bottom: 14px; }
.modal-card .form-group label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.modal-card .form-group input,
.modal-card .form-group select {
    width: 100%; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: 14px; font-family: inherit;
}
.modal-card .form-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-card .form-actions .btn { flex: 1; }

/* ═══════════════ SUBSCRIPTION READ-ONLY MODE ═══════════════ */
body.subscription-readonly .main-content button:not(.nav-item):not(.sidebar-toggle):not(.user-btn):not(.alert-bell):not([onclick*="navigateTo"]):not([onclick*="billing"]) {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}
body.subscription-readonly .main-content input,
body.subscription-readonly .main-content select,
body.subscription-readonly .main-content textarea {
    opacity: 0.6;
    pointer-events: none;
    background: #f1f5f9;
}
body.subscription-readonly .main-content form {
    opacity: 0.6;
    pointer-events: none;
}
/* Keep billing view interactive even in readonly */
body.subscription-readonly .billing-view button,
body.subscription-readonly .billing-view input,
body.subscription-readonly .billing-view select {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    background: initial !important;
}

/* ═══════════════ FEATURE LOCKED BADGE ═══════════════ */
.nav-item.feature-locked {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
}

/* ═══════════════ PRINT ═══════════════ */
@media print {
    .topbar, .sidebar, .toolbar, .btn { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .data-table { font-size: 10px; }
    .subscription-banner { display: none !important; }
}

/* ═══════════════ BILLING — SELF-SERVICE ═══════════════ */
.billing-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 16px; margin-bottom: 24px; }
.billing-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.billing-card .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.billing-card .card-header h3 { margin: 0; font-size: 15px; color: #1e3a5f; }
.sub-card .sub-info { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sub-card .sub-plan { font-size: 18px; font-weight: 700; color: #1e3a5f; }
.sub-card .sub-price { font-size: 14px; color: #64748b; }
.sub-card .sub-period { font-size: 12px; color: #94a3b8; margin-bottom: 12px; }
.sub-card .usage-bar { margin-top: 8px; }
.sub-card .usage-bar span { font-size: 12px; color: #475569; display: block; margin-bottom: 4px; }
.sub-card .usage-bar .progress { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.sub-card .usage-bar .progress-fill { height: 100%; background: linear-gradient(90deg,#2563eb,#3b82f6); transition: width 0.3s; }
.sub-card .card-footer { margin-top: 16px; }

.sub-status { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.sub-status.status-trial { background: #dbeafe; color: #1e40af; }
.sub-status.status-active { background: #d1fae5; color: #065f46; }
.sub-status.status-warning { background: #fef3c7; color: #92400e; }
.sub-status.status-danger { background: #fee2e2; color: #991b1b; }
.sub-status.status-suspended { background: #f3f4f6; color: #6b7280; }

.next-payment .due-date { font-size: 22px; font-weight: 700; color: #1e3a5f; }
.next-payment .warning-text { color: #dc2626; font-size: 13px; margin-top: 6px; }
.overdue-badge { display: inline-block; background: #fee2e2; color: #991b1b; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }

/* Toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle-slider { width: 44px; height: 24px; background: #cbd5e1; border-radius: 12px; position: relative; transition: background 0.2s; }
.toggle-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle input:checked + .toggle-slider { background: #2563eb; }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }

.method-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.method-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid #e2e8f0; border-radius: 20px; background: #fff; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.method-pill:hover { border-color: #2563eb; color: #2563eb; }
.method-pill.selected { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Plans grid */
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.cycle-toggle { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 4px; }
.cycle-btn { padding: 8px 18px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 14px; color: #64748b; }
.cycle-btn.active { background: #fff; color: #1e3a5f; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.save-badge { background: #10b981; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 8px; margin-left: 6px; }

.plans-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 16px; }
.plan-card { position: relative; background: #fff; border: 2px solid #e2e8f0; border-radius: 12px; padding: 24px 20px; display: flex; flex-direction: column; transition: all 0.2s; }
.plan-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.plan-card.recommended { border-color: #2563eb; }
.plan-card.current { border-color: #10b981; background: #f0fdf4; }
.plan-badge, .plan-badge-current { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: 12px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.plan-badge { background: #2563eb; color: #fff; }
.plan-badge-current { background: #10b981; color: #fff; }
.plan-name { font-size: 18px; font-weight: 700; color: #1e3a5f; margin: 0 0 12px; }
.plan-price { margin-bottom: 16px; }
.plan-price .price-amount { font-size: 32px; font-weight: 700; color: #1e3a5f; }
.plan-price .price-unit { font-size: 13px; color: #64748b; margin-left: 4px; }
.plan-limits { font-size: 13px; color: #475569; margin-bottom: 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.plan-features { list-style: none; padding: 0; margin: 0 0 20px; flex: 1; }
.plan-features li { padding: 6px 0; font-size: 13px; }
.plan-features li.ok { color: #065f46; }
.plan-features li.off { color: #cbd5e1; text-decoration: line-through; }

.btn-block { width: 100%; }

/* Checkout modal (scoped — no conflict with app's .modal) */
.checkout-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.6); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.checkout-modal { background: #fff; border-radius: 12px; max-width: 520px; width: 92%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,0.2); animation: slideUp 0.25s; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.checkout-modal .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid #e2e8f0; }
.checkout-modal .modal-head h3 { margin: 0; font-size: 17px; color: #1e3a5f; }
.checkout-modal .modal-close { background: none; border: 0; font-size: 28px; cursor: pointer; color: #94a3b8; line-height: 1; }
.checkout-modal .modal-close:hover { color: #1e3a5f; }
.checkout-modal .modal-body { padding: 22px; }
.checkout-summary { background: #f8fafc; border-radius: 8px; padding: 14px; margin-bottom: 18px; }
.checkout-summary .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.checkout-summary .row.total { font-size: 16px; border-top: 1px solid #e2e8f0; padding-top: 8px; margin-top: 4px; }

.payment-methods h4 { margin: 0 0 12px; font-size: 14px; color: #1e3a5f; }
.pay-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 10px; cursor: pointer; transition: all 0.2s; text-align: start; }
.pay-btn:hover { border-color: #2563eb; background: #f0f9ff; transform: translateX(-2px); }
.pay-icon { font-size: 24px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: #f1f5f9; border-radius: 8px; }
.pay-title { font-weight: 600; font-size: 14px; color: #1e3a5f; }
.pay-sub { font-size: 12px; color: #64748b; }

.bank-transfer .bt-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.bank-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; }
.bt-instructions { background: #f8fafc; padding: 12px; border-radius: 8px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; font-family: inherit; margin: 8px 0 16px; }

.gateway-pending { text-align: center; padding: 20px; }
.gateway-pending .gateway-icon { font-size: 48px; margin-bottom: 10px; }
.gateway-pending h4 { color: #1e3a5f; margin: 10px 0; }
.gateway-pending p { color: #64748b; margin: 6px 0; }

/* Flash */
.flash { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); padding: 12px 20px; border-radius: 8px; color: #fff; font-weight: 600; font-size: 14px; z-index: 2000; opacity: 0; transition: all 0.3s; box-shadow: 0 6px 16px rgba(0,0,0,0.15); }
.flash.show { opacity: 1; transform: translate(-50%, 0); }
.flash-ok { background: #10b981; }
.flash-err { background: #dc2626; }

.invoice-status { padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.invoice-status.status-draft { background: #f3f4f6; color: #6b7280; }
.invoice-status.status-sent { background: #dbeafe; color: #1e40af; }
.invoice-status.status-paid { background: #d1fae5; color: #065f46; }
.invoice-status.status-overdue { background: #fee2e2; color: #991b1b; }
.invoice-status.status-void { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }

/* ═══════════════ ADMIN — Employees + Vehicles ═══════════════ */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1100px) { .admin-grid { grid-template-columns: 2fr 1fr; align-items: start; } }
.admin-list-card .card-header,
.admin-edit-card .card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-list-card .card-actions { display: flex; gap: 8px; align-items: center; }
.admin-list-card .card-actions input[type="search"] { padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; min-width: 200px; }
.admin-list-card .data-table { width: 100%; }
.admin-list-card .data-table .actions { white-space: nowrap; }
.admin-list-card .data-table .row-locked { background: #fff7ed; }
.admin-list-card .data-table .row-locked td:first-child { border-left: 3px solid #ea580c; }
.btn-xs { font-size: 12px; padding: 4px 10px; margin-right: 4px; }
.btn-warning { background: #ea580c; color: #fff; border-color: #ea580c; }
.btn-warning:hover { background: #c2410c; }
.check-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.green { background: #d1fae5; color: #065f46; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.orange { background: #ffedd5; color: #9a3412; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #f3f4f6; color: #4b5563; }

/* Password input with show/hide toggle */
.pwd-input-wrap { position: relative; display: flex; align-items: center; }
.pwd-input-wrap input { flex: 1; padding-inline-end: 40px; }
.pwd-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 4px; }
.pwd-toggle:hover { background: #f1f5f9; }

/* Dashboard tabs */
.dash-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid #e2e8f0; margin-bottom: 18px; padding-bottom: 0; }
.dash-tab { padding: 10px 16px; background: transparent; border: none; cursor: pointer; font-weight: 600; font-size: 14px; color: #64748b; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.dash-tab:hover { color: #1e3a5f; background: #f8fafc; }
.dash-tab.active { color: #2563eb; border-bottom-color: #2563eb; background: transparent; }
.admin-sub-section { padding: 0; }
.admin-sub-section .card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.admin-sub-section .card-actions { display: flex; gap: 8px; align-items: center; }
.admin-sub-section input[type="search"] { padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; min-width: 200px; }
.admin-sub-section .data-table .actions { white-space: nowrap; }
.admin-sub-section .data-table .row-locked { background: #fff7ed; }

.profile-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.profile-row:last-child { border-bottom: none; }
.profile-row .profile-label { color: #64748b; }
.info-msg { background: #dbeafe; color: #1e40af; padding: 10px 14px; border-radius: 8px; border: 1px solid #bfdbfe; font-size: 14px; }
.warning-msg { background: #fef3c7; color: #92400e; padding: 10px 14px; border-radius: 8px; border: 1px solid #fde68a; font-size: 14px; }
