/* ===== Fleet ERP - Premium Dark Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Tajawal:wght@300;400;500;700&display=swap');

:root {
    /* Light Theme (Main Content) */
    --bg-primary: #f4f7fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --border: #e2e8f0;
    --border-light: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #4b6280;
    
    /* Dark Theme (Sidebar & Header) */
    --dark-bg-primary: #091520;
    --dark-bg-secondary: #0d1e2b;
    --dark-border: #1a3a50;
    --dark-text-primary: #ffffff;
    --dark-text-secondary: #c8daea;
    --dark-text-muted: #7a9bb5;

    /* Accents */
    --accent: #00b8cc;
    --accent-glow: rgba(0, 184, 204, 0.15);
    --accent-dark: #0096a6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0284c7;
    --purple: #8b5cf6;

    --sidebar-w: 220px;
    --header-h: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
    --transition: all 0.25s ease;
}

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

html { font-size: 14px; }
@media (max-width: 1280px) and (min-width: 1024px) { html { font-size: 13px; } }

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

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

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background:
        linear-gradient(180deg, rgba(7,17,24,0.82) 0%, rgba(13,30,43,0.92) 100%),
        url('../img/dashboard-bg.png?v=1') right 65%/cover no-repeat;
    border-left: 1px solid var(--dark-border);
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
    /* Mobile-first: hidden by default, shown on desktop */
    transform: translateX(100%);
}
.sidebar.open { transform: translateX(0); box-shadow: -8px 0 40px rgba(0,0,0,0.55); }
.sidebar-overlay.active { display: block; }

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--dark-border);
}

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

.logo-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.7);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: #fff;
}

.logo-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark-text-primary);
    white-space: nowrap;
}

.sidebar-header .subtitle {
    font-size: 0.75rem;
    color: var(--dark-text-muted);
}

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--dark-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    line-height: 1;
    color: rgba(255,255,255,0.78);
    margin-bottom: 2px;
    position: relative;
}

.nav-item > span:not(.nav-icon):not(.nav-badge) {
    line-height: 1;
    display: flex;
    align-items: center;
}

.nav-item:hover {
    background: var(--accent-glow);
    color: #ffffff;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(99,102,241,0.1));
    color: var(--accent);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; display:flex; align-items:center; justify-content:center; }
.nav-icon svg { width: 18px; height: 18px; stroke-width: 2px; }
.top-header svg { width: 20px; height: 20px; stroke-width: 2px; }

.nav-badge {
    margin-right: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 8px;
}

.sidebar-version {
    text-align: center;
    font-size: 0.7rem;
    color: var(--dark-text-muted);
    padding: 8px;
}

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

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-right: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== TOP HEADER ===== */
.top-header {
    height: var(--header-h);
    background:
        linear-gradient(180deg, rgba(7,17,24,0.72) 0%, rgba(13,30,43,0.86) 100%),
        url('../img/dashboard-bg.png?v=1') center 52%/cover no-repeat;
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.header-right { display: flex; align-items: center; gap: 12px; }
.header-left { display: flex; align-items: center; gap: 16px; }

.header-news {
    flex: 1;
    min-width: 160px;
    max-width: 560px;
    height: 34px;
    border: 1px solid rgba(0,184,204,0.22);
    border-radius: 999px;
    background: rgba(6,16,24,0.42);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
    overflow: hidden;
    position: relative;
}

.header-news::before,
.header-news::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 34px;
    pointer-events: none;
    z-index: 2;
}

.header-news::before {
    right: 0;
    background: linear-gradient(to left, rgba(7,17,24,0.82), rgba(7,17,24,0));
}

.header-news::after {
    left: 0;
    background: linear-gradient(to right, rgba(7,17,24,0.82), rgba(7,17,24,0));
}

.header-news-track {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    white-space: nowrap;
    padding: 0 12px;
    animation: headerTicker 26s linear infinite;
    will-change: transform;
}

.header-news-track.is-static {
    animation: none;
    justify-content: center;
    width: 100%;
}

.news-chip {
    font-size: 0.76rem;
    color: rgba(255,255,255,0.92);
    font-weight: 600;
    line-height: 1;
}

.news-sep {
    color: rgba(0,184,204,0.72);
    font-size: 0.8rem;
}

@keyframes headerTicker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .header-news-track { animation: none; }
}

.btn-menu {
    display: none;
    background: none; border: none;
    color: var(--dark-text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark-text-primary);
}

.header-date {
    font-size: 0.8rem;
    color: var(--dark-text-muted);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar-sm {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--info));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

#headerUsername { font-size: 0.85rem; color: var(--dark-text-secondary); }

.btn-logout {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: var(--transition);
}

.btn-logout:hover { background: var(--danger); color: #fff; }

/* ===== PAGE CONTENT ===== */
.page-content {
    flex: 1;
    padding: 24px;
    background-image:
        linear-gradient(rgba(244,247,251,0.72), rgba(240,245,250,0.78)),
        url('../img/hero-bg.png?v=3');
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-attachment: local;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    border-radius: 16px;
    min-height: 155px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* photo layer — blended on top of card gradient */
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    mix-blend-mode: luminosity;
    transition: transform 0.5s ease;
    z-index: 0;
}
.stat-card:hover::before { transform: scale(1.06); }

/* no ::after needed — gradient lives on the card itself */

/* Gradient is set directly on the card (reliable fallback + color) */
/* ::before adds the photo on top, ::after adds a semi-transparent darkening layer */
.stat-card-drivers   {
    background: linear-gradient(160deg, #0369a1 0%, #06b6d4 100%);
    box-shadow: 0 8px 24px rgba(8,145,178,0.35);
}
.stat-card-vehicles  {
    background: linear-gradient(160deg, #065f46 0%, #10b981 100%);
    box-shadow: 0 8px 24px rgba(5,150,105,0.35);
}
.stat-card-orders    {
    background: linear-gradient(160deg, #92400e 0%, #f59e0b 100%);
    box-shadow: 0 8px 24px rgba(180,83,9,0.35);
}
.stat-card-violations{
    background: linear-gradient(160deg, #7f1d1d 0%, #ef4444 100%);
    box-shadow: 0 8px 24px rgba(220,38,38,0.35);
}
.stat-card-vouchers  {
    background: linear-gradient(160deg, #4c1d95 0%, #a78bfa 100%);
    box-shadow: 0 8px 24px rgba(124,58,237,0.35);
}
.stat-card-documents {
    background: linear-gradient(160deg, #134e4a 0%, #2dd4bf 100%);
    box-shadow: 0 8px 24px rgba(13,148,136,0.35);
}

/* Photo overlay on top of gradient */
.stat-card-drivers::before   { background-image: url('https://images.unsplash.com/photo-1600880292203-757bb62b4baf?w=500&q=70&auto=format'); opacity: 0.18; }
.stat-card-vehicles::before  { background-image: url('https://images.unsplash.com/photo-1601584115197-04ecc0da31d7?w=500&q=70&auto=format'); opacity: 0.18; }
.stat-card-orders::before    { background-image: url('https://images.unsplash.com/photo-1553413077-190dd305871c?w=500&q=70&auto=format'); opacity: 0.18; }
.stat-card-violations::before{ background-image: url('https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=500&q=70&auto=format'); opacity: 0.18; }
.stat-card-vouchers::before  { background-image: url('https://images.unsplash.com/photo-1554224155-6726b3ff858f?w=500&q=70&auto=format'); opacity: 0.18; }
.stat-card-documents::before { background-image: url('https://images.unsplash.com/photo-1568667256549-094345857637?w=500&q=70&auto=format'); opacity: 0.18; }

.stat-card:hover { transform: translateY(-4px); }

/* All inner elements must be z-index: 2 to sit above overlays */
.sc-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
}

.sc-icon-circle {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}
.sc-icon-circle svg { stroke: #fff; }
/* color modifiers for icon circle — used in non-dashboard pages */
.sc-icon-circle.sc-blue   { background: rgba(8,145,178,0.4);   border-color: rgba(6,182,212,0.5); }
.sc-icon-circle.sc-green  { background: rgba(5,150,105,0.4);   border-color: rgba(16,185,129,0.5); }
.sc-icon-circle.sc-red    { background: rgba(220,38,38,0.4);   border-color: rgba(239,68,68,0.5); }
.sc-icon-circle.sc-amber  { background: rgba(180,83,9,0.4);    border-color: rgba(245,158,11,0.5); }
.sc-icon-circle.sc-purple { background: rgba(124,58,237,0.4);  border-color: rgba(167,139,250,0.5); }
.sc-icon-circle.sc-teal   { background: rgba(13,148,136,0.4);  border-color: rgba(45,212,191,0.5); }

.sc-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.02em;
}

.sc-number {
    position: relative;
    z-index: 2;
    font-size: 2.6rem;
    font-weight: 900;
    color: #ffffff;
    text-align: right;
    padding: 0 16px;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    letter-spacing: -0.02em;
}

.sc-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 14px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.8);
    font-weight: 600;
    background: rgba(0,0,0,0.18);
    backdrop-filter: blur(4px);
}
.sc-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.sc-dot.green  { background: #34d399; box-shadow: 0 0 6px #34d399; }
.sc-dot.red    { background: #f87171; box-shadow: 0 0 6px #f87171; }
.sc-dot.amber  { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }
.sc-dot.blue   { background: #60a5fa; box-shadow: 0 0 6px #60a5fa; }
.sc-sep { color: rgba(255,255,255,0.3); margin: 0 2px; }

/* unused old classes — keep for other pages */
.stat-card-bg-icon { display: none; }
.stat-icon-flat { display: none; }
.stat-info { display: none; }
.stat-label, .stat-value, .stat-sub { display: none; }

/* Keep .stat-icon for other pages */
.stat-icon {
    width: 60px; height: 60px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 28px; height: 28px; stroke-width: 1.6px; }
.stat-icon.blue  { background: linear-gradient(135deg, #0891b2, #06b6d4); color: #fff; box-shadow: 0 6px 16px rgba(8,145,178,0.3); }
.stat-icon.green { background: linear-gradient(135deg, #059669, #10b981); color: #fff; box-shadow: 0 6px 16px rgba(5,150,105,0.3); }
.stat-icon.yellow{ background: linear-gradient(135deg, #d97706, #f59e0b); color: #fff; box-shadow: 0 6px 16px rgba(217,119,6,0.3); }
.stat-icon.red   { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; box-shadow: 0 6px 16px rgba(220,38,38,0.3); }
.stat-icon.purple{ background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; box-shadow: 0 6px 16px rgba(124,58,237,0.3); }

/* ===== SECTION STAT CARDS (with .stat-icon) — gradient like dashboard ===== */
.stat-card:has(.stat-icon) {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 16px;
    min-height: auto;
    position: relative;
    overflow: hidden;
    cursor: default;
    border: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.stat-card:has(.stat-icon):hover { transform: translateY(-3px); }

/* Photo layer */
.stat-card:has(.stat-icon)::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    mix-blend-mode: luminosity;
    opacity: 0.22;
    z-index: 0;
    transition: transform 0.5s ease;
}
.stat-card:has(.stat-icon):hover::before { transform: scale(1.08); }

.stat-card:has(.stat-icon.blue) {
    background: linear-gradient(135deg, #0369a1 0%, #0891b2 55%, #06b6d4 100%);
    box-shadow: 0 8px 24px rgba(8,145,178,0.4);
}
.stat-card:has(.stat-icon.blue)::before {
    background-image: url('https://images.unsplash.com/photo-1600880292203-757bb62b4baf?w=500&q=70&auto=format');
}
.stat-card:has(.stat-icon.green) {
    background: linear-gradient(135deg, #065f46 0%, #059669 55%, #10b981 100%);
    box-shadow: 0 8px 24px rgba(5,150,105,0.4);
}
.stat-card:has(.stat-icon.green)::before {
    background-image: url('https://images.unsplash.com/photo-1601584115197-04ecc0da31d7?w=500&q=70&auto=format');
}
.stat-card:has(.stat-icon.yellow) {
    background: linear-gradient(135deg, #92400e 0%, #d97706 55%, #f59e0b 100%);
    box-shadow: 0 8px 24px rgba(180,83,9,0.4);
}
.stat-card:has(.stat-icon.yellow)::before {
    background-image: url('https://images.unsplash.com/photo-1553413077-190dd305871c?w=500&q=70&auto=format');
}
.stat-card:has(.stat-icon.red) {
    background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 55%, #ef4444 100%);
    box-shadow: 0 8px 24px rgba(220,38,38,0.4);
}
.stat-card:has(.stat-icon.red)::before {
    background-image: url('https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=500&q=70&auto=format');
}
.stat-card:has(.stat-icon.purple) {
    background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 55%, #a855f7 100%);
    box-shadow: 0 8px 24px rgba(124,58,237,0.4);
}
.stat-card:has(.stat-icon.purple)::before {
    background-image: url('https://images.unsplash.com/photo-1554224155-6726b3ff858f?w=500&q=70&auto=format');
}
.stat-card:has(.stat-icon.indigo) {
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #6366f1 100%);
    box-shadow: 0 8px 24px rgba(79,70,229,0.4);
}
.stat-card:has(.stat-icon.indigo)::before {
    background-image: url('https://images.unsplash.com/photo-1568667256549-094345857637?w=500&q=70&auto=format');
}

/* Icon box inside section cards */
.stat-card:has(.stat-icon) .stat-icon {
    background: rgba(255,255,255,0.18) !important;
    box-shadow: none !important;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    width: 52px; height: 52px;
    font-size: 1.5rem;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    position: relative; z-index: 2;
}
.stat-card:has(.stat-icon) .stat-icon svg { stroke: #fff; }

/* Text inside section cards */
.stat-card:has(.stat-icon) .stat-info { display: block; flex: 1; position: relative; z-index: 2; }
.stat-card:has(.stat-icon) .stat-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.82);
    margin-bottom: 4px;
}
.stat-card:has(.stat-icon) .stat-value {
    display: block;
    font-size: 1.55rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.stat-card:has(.stat-icon) .stat-sub {
    display: inline-block;
    font-size: 0.68rem;
    color: rgba(255,255,255,0.7);
    margin-top: 5px;
    background: rgba(0,0,0,0.18);
    padding: 2px 8px;
    border-radius: 10px;
}
.stat-icon.indigo{ background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,0.3); }

@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 500px)  { .stats-grid { grid-template-columns: 1fr; } }


/* ===== BUTTONS ===== */
.btn {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary { background: #0d1e2b; color: rgba(255,255,255,0.9); border-color: rgba(0,184,204,0.3); }
.btn-primary:hover { background: var(--accent); color: #ffffff; border-color: var(--accent); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: #0a0e1a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.form-control {
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: var(--transition);
}

.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
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; }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead { background: var(--dark-bg-secondary); }

th {
    padding: 12px 14px;
    text-align: right;
    font-weight: 700;
    color: var(--dark-text-primary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--dark-border);
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
    transition: var(--transition);
}

tr { transition: var(--transition); }

tr:hover td {
    background: #f8fafc;
    color: var(--text-primary);
}

tr:hover {
    box-shadow: inset 3px 0 0 var(--accent);
}

/* ===== GLASS CARD ===== */
.card-glass {
    background: rgba(26,31,53,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(42,49,85,0.6);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* ===== NOTIFICATION BELL ===== */
.notification-bell {
    position: relative;
    background: none;
    border: none;
    color: var(--dark-text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
}

.notification-bell:hover { background: var(--accent-glow); color: var(--accent); }

.notification-bell .count {
    position: absolute;
    top: 0; right: 0;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    animation: pulse 2s infinite;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    z-index: 200;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.notification-dropdown.open { display: block; animation: slideDown 0.2s ease; }

.notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
}

.notif-item:hover { background: var(--accent-glow); }
.notif-item .notif-icon { margin-left: 8px; }
.notif-item .notif-time { color: var(--text-muted); font-size: 0.7rem; }

/* ===== QUICK ACTIONS ===== */
/* ===== DASHBOARD HERO BANNER ===== */
.dashboard-hero {
    background: linear-gradient(rgba(7,17,24,0.38), rgba(14,36,56,0.50)),
                url('../img/hero-bg.png?v=3') center 65%/cover no-repeat;
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(0,184,204,0.18);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
    min-height: 190px;
}
/* Ambient blobs */
.dashboard-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: 30%;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(0,184,204,0.1) 0%, transparent 65%);
    pointer-events: none;
}
.dashboard-hero::after {
    content: '';
    position: absolute;
    bottom: -80px; left: 10%;
    width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 65%);
    pointer-events: none;
}

/* ===== HERO — LEFT BRAND COLUMN ===== */
.hero-brand-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    z-index: 1;
}
.hero-logo-ring {
    position: relative;
    width: 120px; height: 120px;
    flex-shrink: 0;
}
.hero-logo-img {
    width: 120px; height: 120px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    padding: 0;
    position: relative;
    z-index: 1;
    border: none;
    box-shadow: none;
    transform: scaleX(-1);
    filter: drop-shadow(0 4px 16px rgba(0,184,204,0.25));
}
.hero-logo-orbit { display: none; }
.hero-logo-orbit::after { display: none; }
.hero-brand-info { text-align: center; }
.hero-brand-name {
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.02em;
    line-height: 1.2;
}
.hero-accent-gold {
    color: #e8c97a;
    text-shadow: 0 0 12px rgba(232,201,122,0.5);
}
.hero-brand-en {
    font-size: 0.7rem;
    color: rgba(0,184,204,0.7);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 2px;
}
.hero-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.3);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.68rem;
    color: #10b981;
    font-weight: 700;
    margin-top: 6px;
}
.hero-live-dot {
    width: 6px; height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

/* ===== HERO — CENTER TYPEWRITER COLUMN ===== */
.hero-center-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 10px;
    z-index: 1;
    min-width: 0;
}
.hero-tagline-small {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    font-weight: 800;
    letter-spacing: 0.02em;
    text-align: left;
}
.hero-typewriter-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    min-height: 2.4rem;
}
.hero-type-text {
    font-size: 1.65rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
    white-space: nowrap;
    text-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.hero-cursor-blink {
    font-size: 1.4rem;
    font-weight: 300;
    color: #00b8cc;
    animation: cursorBlink 0.9s step-end infinite;
    line-height: 1;
}
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}
.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.hero-pill.teal   { background: rgba(0,184,204,0.15);  border: 1px solid rgba(0,184,204,0.3);  color: #22d3ee; }
.hero-pill.blue   { background: rgba(8,145,178,0.15);  border: 1px solid rgba(8,145,178,0.3);  color: #38bdf8; }
.hero-pill.green  { background: rgba(5,150,105,0.15);  border: 1px solid rgba(5,150,105,0.3);  color: #34d399; }
.hero-pill.amber  { background: rgba(217,119,6,0.15);  border: 1px solid rgba(217,119,6,0.3);  color: #fbbf24; }
.hero-pill.purple { background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3); color: #c084fc; }

/* ===== HERO — RIGHT MOCKUP COLUMN ===== */
.hero-mockup-col {
    flex-shrink: 0;
    width: 420px;
    z-index: 1;
}
.hero-mockup-frame {
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0,184,204,0.25),
        0 20px 50px rgba(0,0,0,0.5),
        0 0 30px rgba(0,184,204,0.08);
    transform: perspective(900px) rotateY(4deg) rotateX(-2deg);
    transition: transform 0.4s ease;
}
.hero-mockup-frame:hover {
    transform: perspective(900px) rotateY(1deg) rotateX(-0.5deg);
}
.hero-mockup-topbar {
    background: #0a1628;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-bottom: 1px solid rgba(0,184,204,0.15);
}
.hero-mock-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.hero-mock-dot.red   { background: #ef4444; }
.hero-mock-dot.amber { background: #f59e0b; }
.hero-mock-dot.green { background: #10b981; }
.hero-mock-title {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    margin-right: 8px;
    flex: 1;
    text-align: center;
    letter-spacing: 0.03em;
}

@media (max-width: 1100px) {
    .hero-mockup-col { width: 340px; }
}
@media (max-width: 900px) {
    .hero-mockup-col { display: none; }
    .hero-center-col { flex: 1; }
}
@media (max-width: 600px) {
    .dashboard-hero { flex-direction: column; align-items: flex-start; min-height: auto; padding: 20px; }
    .hero-brand-col { flex-direction: row; }
    .hero-logo-ring { width: 60px; height: 60px; }
    .hero-logo-img { width: 60px; height: 60px; }
    .hero-type-text { font-size: 1rem; }
}

.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.quick-action-btn {
    padding: 8px 16px;
    background: #0d1e2b;
    border: 1px solid rgba(0,184,204,0.25);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.quick-action-btn svg { width: 16px; height: 16px; stroke-width: 2px; color: var(--accent); }
.quick-action-btn i[data-lucide] { color: var(--accent); }

.quick-action-btn:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.quick-action-btn:hover svg { color: #ffffff; }

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* ===== RISK SCORE / ACCOUNTING CARDS ===== */
.stat-card.risk-high,
.stat-card.risk-medium,
.stat-card.risk-low {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px 20px !important;
    border-radius: 16px;
    border: none !important;
    position: relative;
    overflow: hidden;
    min-height: 110px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.stat-card.risk-high:hover,
.stat-card.risk-medium:hover,
.stat-card.risk-low:hover { transform: translateY(-3px); }

/* photo layer */
.stat-card.risk-high::before,
.stat-card.risk-medium::before,
.stat-card.risk-low::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    mix-blend-mode: luminosity;
    opacity: 0.2;
    z-index: 0;
    transition: transform 0.5s ease;
}
.stat-card.risk-high:hover::before,
.stat-card.risk-medium:hover::before,
.stat-card.risk-low:hover::before { transform: scale(1.08); }

.stat-card.risk-low {
    background: linear-gradient(135deg, #065f46 0%, #059669 55%, #10b981 100%);
    box-shadow: 0 8px 24px rgba(5,150,105,0.4);
}
.stat-card.risk-low::before {
    background-image: url('https://images.unsplash.com/photo-1554224155-6726b3ff858f?w=500&q=70&auto=format');
}
.stat-card.risk-medium {
    background: linear-gradient(135deg, #92400e 0%, #d97706 55%, #f59e0b 100%);
    box-shadow: 0 8px 24px rgba(180,83,9,0.4);
}
.stat-card.risk-medium::before {
    background-image: url('https://images.unsplash.com/photo-1553413077-190dd305871c?w=500&q=70&auto=format');
}
.stat-card.risk-high {
    background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 55%, #ef4444 100%);
    box-shadow: 0 8px 24px rgba(220,38,38,0.4);
}
.stat-card.risk-high::before {
    background-image: url('https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=500&q=70&auto=format');
}

/* text fix for accounting cards */
.stat-card.risk-high .stat-info,
.stat-card.risk-medium .stat-info,
.stat-card.risk-low .stat-info { display: block; position: relative; z-index: 2; }

.stat-card.risk-high .stat-label,
.stat-card.risk-medium .stat-label,
.stat-card.risk-low .stat-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin-bottom: 6px;
}
.stat-card.risk-high .stat-value,
.stat-card.risk-medium .stat-value,
.stat-card.risk-low .stat-value {
    display: block !important;
    font-size: 1.5rem !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    line-height: 1.1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
/* also handle inline color overrides from JS */
.stat-card.risk-high [style*="color:"],
.stat-card.risk-medium [style*="color:"],
.stat-card.risk-low [style*="color:"] { color: #ffffff !important; }

/* ===== ACCOUNTING MODULE LAYOUT ===== */
.acc-layout-root {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.acc-sidebar {
    width: min(260px, 100%);
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    padding: 0;
    overflow: hidden;
}
.acc-sidebar-header {
    position: relative;
    padding: 22px 18px 18px;
    background: linear-gradient(160deg, #091520, #0d2d42);
    overflow: hidden;
}
.acc-sidebar-header-bg {
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1554224155-6726b3ff858f?w=400&q=60') center/cover no-repeat;
    opacity: 0.12;
    mix-blend-mode: luminosity;
}
.acc-sidebar-header-inner {
    position: relative;
    z-index: 1;
}
.acc-sidebar-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
    line-height: 1;
}
.acc-sidebar-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
}
.acc-sidebar-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}
.acc-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 8px;
}
.acc-nav-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
    flex-shrink: 0;
}
.acc-main {
    flex: 1;
    min-width: 0;
}
.acc-loading,
.acc-loading-inner {
    text-align: center;
    padding: 48px 16px;
}
.acc-stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
@media (max-width: 540px) {
    .acc-stats-overview { grid-template-columns: 1fr; gap: 8px; }
}

/* ===== ACCOUNTING SIDEBAR NAV BUTTON ===== */
.acc-nav-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    transition: var(--transition);
}
.acc-nav-btn:hover {
    background: rgba(0,184,204,0.08);
    color: var(--text-primary);
}

/* ===== REPORT TABS ===== */
.report-tabs .tab {
    border: 1.5px solid rgba(255,255,255,0.25);
    border-radius: 30px;
    padding: 8px 16px;
    font-size: 0.8rem;
    background: #0d1e2b;
    color: rgba(255,255,255,0.75);
}
.report-tabs .tab.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 2px 10px var(--accent-glow);
}

/* ===== EXPIRY DANGER ROW ===== */
.expiry-danger { background: rgba(239,68,68,0.06) !important; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(99,102,241,0.15); color: var(--info); }
.badge-muted { background: rgba(107,113,148,0.15); color: var(--text-muted); }
.badge-accent { background: var(--accent-glow); color: var(--accent); }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 6px;
    border-bottom: none;
    margin-bottom: 16px;
    overflow-x: auto;
    padding: 4px 2px;
    flex-wrap: wrap;
}

.tab {
    padding: 9px 18px;
    font-size: 0.84rem;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    border: 1.5px solid rgba(255,255,255,0.25);
    border-radius: 30px;
    transition: var(--transition);
    white-space: nowrap;
    background: #0d1e2b;
    font-family: inherit;
}

.tab:hover {
    color: #ffffff;
    border-color: rgba(255,255,255,0.6);
    background: #152d42;
}
.tab.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 2px 10px var(--accent-glow);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-lg { max-width: 900px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

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

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; }

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow);
    min-width: 280px;
    text-align: center;
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-warning { background: var(--warning); color: #0a0e1a; }
.toast-info { background: var(--info); color: #fff; }

/* ===== SEARCH & FILTER BAR ===== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
}

.search-box input:focus { outline: none; border-color: var(--accent); }

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
}

/* ===== EXPIRY COLORS ===== */
.expiry-valid { color: var(--success); }
.expiry-warning { color: var(--warning); }
.expiry-expired { color: var(--danger); font-weight: 700; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-secondary); }

/* ===== FOOTER ===== */
.app-footer {
    padding: 16px 24px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ===== CONFIRM DIALOG ===== */
.confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
}

.confirm-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    text-align: center;
}

.confirm-box p { margin-bottom: 20px; font-size: 0.95rem; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(to bottom,
            rgba(6,15,24,0.80) 0%,
            rgba(9,21,32,0.75) 50%,
            rgba(6,12,20,0.90) 100%),
        url('../img/hero-bg.png?v=4') center center / cover no-repeat;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-card .logo-section {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .logo-section .icon {
    width: 90px; height: 90px;
    background: transparent;
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem;
    margin-bottom: 12px;
}

.login-card h1 { font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.85rem; }

.login-card .form-control {
    padding: 12px 16px;
    font-size: 0.95rem;
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 8px;
}

.login-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--danger);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 12px;
    display: none;
}

/* ===== DRIVER PROFILE CARDS ===== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0,184,204,0.05), rgba(2,132,199,0.05));
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.profile-avatar {
    width: 72px; height: 72px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), var(--info));
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.profile-info h2 { font-size: 1.2rem; font-weight: 700; }
.profile-info .meta { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }
.profile-info .meta span { margin-left: 16px; }

.profile-stats {
    display: flex;
    gap: 20px;
    margin-right: auto;
}

.profile-stat {
    text-align: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.profile-stat .val { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.profile-stat .lbl { font-size: 0.7rem; color: var(--text-muted); }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1023px) {
    /* Layout: override sidebar width for mobile/tablet */
    .sidebar { width: min(82vw, 290px); z-index: 200; }
    .app-footer { display: none; }
    .page-content { padding: 12px; padding-bottom: 82px; }

    /* Top Header */
    .top-header { padding: 0 12px; height: 52px; gap: 8px; }
    .btn-menu {
        display: flex; align-items: center; justify-content: center;
        width: 36px; height: 36px; border-radius: 8px; padding: 0;
        background: rgba(0,184,204,0.08); border: 1px solid rgba(0,184,204,0.18);
        flex-shrink: 0;
    }
    .btn-menu i[data-lucide] { width: 20px; height: 20px; }
    .page-title { font-size: 0.88rem; font-weight: 700; }
    .page-title i[data-lucide] { width: 16px; height: 16px; vertical-align: middle; }
    .header-date { display: none; }
    .header-user span { display: none; }
    .btn-logout { display: none; }
    .notification-bell { width: 36px; height: 36px; font-size: 1rem; border-radius: 8px; }
    .notification-bell i[data-lucide] { width: 18px; height: 18px; }
    .user-avatar-sm { width: 30px; height: 30px; font-size: 0.75rem; flex-shrink: 0; }
    .header-left { gap: 6px; }
    .header-right { gap: 8px; }
    .header-news { display: none; }

    /* Dashboard stat cards (sc-*) */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { border-radius: 14px; }
    .sc-top { padding: 12px 12px 0; }
    .sc-icon-circle { width: 38px; height: 38px; }
    .sc-icon-circle svg { width: 18px; height: 18px; stroke-width: 2px; }
    .sc-title { font-size: 0.76rem; }
    .sc-number { font-size: 1.9rem; padding: 4px 12px 2px; }
    .sc-footer { font-size: 0.65rem; padding: 8px 12px 12px; gap: 4px; }
    .sc-sep { display: none; }

    /* Section stat cards (stat-icon) */
    .stat-card:has(.stat-icon) { padding: 12px 14px; gap: 12px; }
    .stat-card:has(.stat-icon) .stat-icon { width: 42px; height: 42px; font-size: 1.15rem; border-radius: 10px; }
    .stat-card:has(.stat-icon) .stat-value { font-size: 1.25rem; }
    .stat-card:has(.stat-icon) .stat-label { font-size: 0.7rem; }

    /* Buttons */
    .btn { font-size: 0.82rem; padding: 9px 14px; border-radius: 8px; }
    .btn-sm { font-size: 0.76rem; padding: 6px 10px; }
    .btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; }
    .btn-icon svg, .btn-icon i[data-lucide] { width: 16px; height: 16px; }
    .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
    .toolbar .btn { justify-content: center; width: 100%; }

    /* Cards */
    .card { padding: 14px; border-radius: 14px; }
    .card-header { margin-bottom: 12px; }
    .card-header h3, .section-title, .card h3 { font-size: 0.9rem; }

    /* Forms */
    .form-row, .form-row-3, .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 10px; }
    .form-label { font-size: 0.8rem; margin-bottom: 5px; }
    .form-control { font-size: 16px; padding: 9px 12px; border-radius: 8px; }
    select { font-size: 16px; }

    /* Tables */
    .table-container { border-radius: 10px; }
    table { min-width: 560px; font-size: 0.8rem; }
    th { font-size: 0.72rem; padding: 10px 8px; }
    td { padding: 9px 8px; font-size: 0.8rem; }

    /* Hero */
    .dashboard-hero { min-height: auto; border-radius: 14px; padding: 16px; }
    .hero-type-text { font-size: 1.2rem; }
    .hero-logo-img { width: 80px; height: 80px; }
    .hero-pills { gap: 4px; flex-wrap: wrap; }
    .hero-pill { font-size: 0.62rem; padding: 3px 8px; border-radius: 20px; }
    .quick-actions { gap: 6px; flex-wrap: wrap; }
    .quick-action-btn { padding: 8px 12px; font-size: 0.76rem; border-radius: 8px; }

    /* Sidebar nav items */
    .nav-item { font-size: 0.88rem; padding: 11px 14px; }
    .nav-icon svg { width: 17px; height: 17px; }
    .sidebar-header h2 { font-size: 0.95rem; }
    .nav-section-title { font-size: 0.65rem; }

    /* Modal */
    .modal { margin: 8px; max-height: calc(100dvh - 16px); border-radius: 16px; }
    .modal-header { padding: 14px 16px; }
    .modal-body { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; }
    .modal-header h3 { font-size: 0.92rem; }
    .modal-close { width: 30px; height: 30px; font-size: 1rem; }

    /* Profile */
    .profile-header { flex-direction: column; text-align: center; gap: 12px; }
    .profile-stats { width: 100%; justify-content: center; }

    /* Hero tagline — hidden on mobile */
    .hero-tagline-small { display: none; }

    /* Assistant — floats above bottom nav */
    .assistant-toggle-btn {
        bottom: 72px; left: 14px;
        width: 46px; height: 46px; font-size: 0;
        padding: 0;
    }
    .assistant-panel {
        left: 8px; right: 8px; width: auto; bottom: 72px;
        max-height: calc(100dvh - 155px);
        border-radius: 14px;
    }
    .assistant-messages { max-height: calc(100dvh - 310px); min-height: 120px; }
}

@media (max-width: 480px) {
    /* Tighter on very small phones */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .card { padding: 12px; }
    .page-content { padding: 10px; padding-bottom: 82px; }
    .sc-number { font-size: 1.65rem; }
    .sc-title { font-size: 0.7rem; }
    .sc-icon-circle { width: 34px; height: 34px; }
    .sc-icon-circle svg { width: 16px; height: 16px; }
    .hero-type-text { font-size: 1.05rem; }
    .hero-logo-img { width: 66px; height: 66px; }
    .top-header { padding: 0 10px; height: 50px; }
    .modal { margin: 4px; }
    .btn { font-size: 0.8rem; padding: 8px 12px; }
    .quick-action-btn { font-size: 0.72rem; padding: 7px 10px; }
    table { min-width: 500px; }
    th { font-size: 0.68rem; padding: 8px 6px; }
    td { font-size: 0.76rem; padding: 8px 6px; }
    .stat-card:has(.stat-icon) { padding: 10px 12px; gap: 10px; }
    .stat-card:has(.stat-icon) .stat-icon { width: 38px; height: 38px; font-size: 1.05rem; }
    .stat-card:has(.stat-icon) .stat-value { font-size: 1.1rem; }
    .stat-card:has(.stat-icon) .stat-label { font-size: 0.66rem; }
}

/* ===== MOBILE BOTTOM NAV ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 62px;
    background: linear-gradient(180deg, #0d1e2b 0%, #091520 100%);
    border-top: 1px solid rgba(0,184,204,0.18);
    z-index: 150;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
@media (max-width: 768px) {
    .mobile-bottom-nav { display: flex; }
}
.mob-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    min-height: 54px;
    cursor: pointer;
    border-radius: 10px;
    padding: 6px 2px;
    transition: all 0.2s ease;
    color: rgba(255,255,255,0.4);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.mob-nav-item i[data-lucide] { width: 22px; height: 22px; stroke-width: 1.8px; }
.mob-nav-item span { font-size: 0.6rem; font-weight: 600; font-family: inherit; }
.mob-nav-item.active { color: #00b8cc; }
.mob-nav-item:active { background: rgba(255,255,255,0.06); transform: scale(0.93); }

/* ===== MOBILE: Touch improvements ===== */
@media (hover: none) and (pointer: coarse) {
    .nav-item { padding: 13px 14px; min-height: 44px; }
    .btn, .btn-primary, .btn-secondary, .btn-danger, .btn-success { min-height: 44px; }
    .form-control, select, input[type=text], input[type=password], input[type=number],
    input[type=email], input[type=date], textarea { min-height: 44px; font-size: 16px; }
    .quick-action-btn { min-height: 42px; }
    .stat-card { -webkit-tap-highlight-color: transparent; }
}

/* ===== DESKTOP: sidebar always visible ===== */
@media (min-width: 1024px) {
    .sidebar { transform: none !important; width: var(--sidebar-w); }
    .main-content { margin-right: var(--sidebar-w); }
    .btn-menu { display: none !important; }
    .mobile-bottom-nav { display: none !important; }
}

/* ===== ASSISTANT CHAT ===== */
.assistant-toggle-btn {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,184,204,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: visible;
}
.assistant-toggle-btn:hover { transform: scale(1.1); box-shadow: 0 6px 25px rgba(0,184,204,0.5); }
.assistant-toggle-btn.active { transform: scale(0.95); }
.assistant-icon { position: relative; z-index: 1; line-height: 1; }
.assistant-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(0,184,204,0.3);
    animation: assistantPulse 2s ease-in-out infinite;
}
@keyframes assistantPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 0; }
}

.assistant-panel {
    position: fixed;
    left: 24px;
    bottom: 90px;
    z-index: 999;
    width: 380px;
    max-height: 600px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
    overflow: hidden;
}
.assistant-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #091520, #0d1e2b);
    border-bottom: 1px solid var(--dark-border);
    flex-shrink: 0;
}
.assistant-header-info { display: flex; align-items: center; gap: 10px; }
.assistant-avatar {
    width: 40px; height: 40px;
    background: #fff;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(0,184,204,0.35);
    box-shadow: 0 2px 8px rgba(0,184,204,0.2);
}
.assistant-avatar img {
    width: 100%; height: 100%; object-fit: contain;
}
/* Toggle button logo */
.assistant-icon img.ast-logo {
    width: 32px; height: 32px;
    object-fit: contain; border-radius: 6px;
}
.assistant-toggle-btn .assistant-icon { display: flex; align-items: center; justify-content: center; }
.assistant-name { font-size: 0.9rem; font-weight: 700; color: var(--dark-text-primary); }
.assistant-status { font-size: 0.7rem; color: var(--success); }
.assistant-close-btn {
    background: transparent;
    border: none;
    color: var(--dark-text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.assistant-close-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 340px;
}
.assistant-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    animation: msgSlideIn 0.2s ease;
}
@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.assistant-msg.user-msg { flex-direction: row-reverse; }
.msg-avatar { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.msg-bubble {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.6;
    word-break: break-word;
}
.bot-msg .msg-bubble {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px 12px 12px 12px;
}
.user-msg .msg-bubble {
    background: linear-gradient(135deg, var(--accent), #0096a6);
    color: #fff;
    border-radius: 12px 4px 12px 12px;
    text-align: right;
}
.typing-msg .msg-bubble {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 3px;
    padding: 12px 16px;
}

.assistant-quick {
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    flex-shrink: 0;
}
.assistant-quick-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
}
.assistant-quick-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.assistant-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.assistant-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-family: inherit;
    direction: rtl;
    outline: none;
    transition: border-color 0.15s;
}
.assistant-input:focus { border-color: var(--accent); }
.assistant-send-btn {
    background: linear-gradient(135deg, var(--accent), #0096a6);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.assistant-send-btn:hover { opacity: 0.9; }

@media (max-width: 480px) {
    .assistant-panel { left: 6px; right: 6px; width: auto; bottom: 72px; max-height: calc(100dvh - 150px); }
    .assistant-toggle-btn { left: 12px; bottom: 72px; width: 44px; height: 44px; }
}

/* =====================================================
   Document Manager Styles — v1.0
   ===================================================== */

/* ── Document grid ── */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

/* ── Per-type card ── */
.doc-type-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.doc-type-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.07); }

.doc-type-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.doc-type-icon { font-size: 1.3rem; flex-shrink: 0; }

/* ── Empty slot / drop target ── */
.doc-empty-slot {
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.doc-empty-slot:hover { background: var(--accent-glow); }

/* ── File list inside a type card ── */
.doc-files-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.doc-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: background 0.1s;
}
.doc-file-item:hover { background: var(--bg-card-hover); }

.doc-preview-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    cursor: pointer;
    border: 1px solid var(--border);
}
.doc-preview-pdf {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-muted);
    cursor: pointer;
    gap: 2px;
    flex-shrink: 0;
    background: var(--bg-primary);
}
.doc-preview-pdf:hover { border-color: var(--accent); }

.doc-file-info { flex: 1; min-width: 0; }

.doc-file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ── Small icon buttons ── */
.btn-icon-sm {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.1s;
    padding: 0;
}
.btn-icon-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon-sm.btn-icon-danger:hover { border-color: var(--danger); color: var(--danger); }

/* ── Upload drop zone ── */
.upload-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-primary);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.upload-drop-zone:hover { border-color: var(--accent); background: var(--accent-glow); }
.upload-drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: scale(1.01);
}

/* ── Mobile doc grid ── */
@media (max-width: 600px) {
    .doc-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .doc-type-header { padding: 8px 10px; }
    .doc-type-icon { font-size: 1.1rem; }
}
@media (max-width: 380px) {
    .doc-grid { grid-template-columns: 1fr; }
}

/* ==================================================================
   MOBILE RESPONSIVE OVERHAUL — v2.0
   Converts tables to cards, fixes layouts, improves touch targets.
   ================================================================== */

/* ===== Tables that auto-convert to cards on mobile =====
   Markup:    `<table class="mobile-cards">`  (or any table inside `.responsive-table`).
   Each `<td>` should receive `data-label="عنوان العمود"` (auto-applied by `js/mobile.js`). */
@media (max-width: 768px) {
    /* Sticky-headed horizontal scrolling for any table that's NOT mobile-cards */
    .table-wrapper, .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        position: relative;
    }
    .table-wrapper::after, .table-container::after {
        content: '';
        position: sticky;
        right: 0;
        top: 0;
        width: 24px;
        height: 100%;
        background: linear-gradient(to left, rgba(0,0,0,0.06), transparent);
        pointer-events: none;
        display: block;
    }

    /* ── CARD MODE — tables with `mobile-cards` class OR auto-converted ── */
    table.mobile-cards,
    .responsive-table table {
        min-width: 0 !important;
        display: block;
        background: transparent;
    }
    table.mobile-cards thead,
    .responsive-table thead {
        display: none;
    }
    table.mobile-cards tbody,
    .responsive-table tbody {
        display: block;
    }
    table.mobile-cards tr,
    .responsive-table tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 14px;
        margin-bottom: 10px;
        padding: 10px 12px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    }
    table.mobile-cards td,
    .responsive-table tbody td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 7px 0 !important;
        border: none !important;
        border-bottom: 1px dashed var(--border) !important;
        text-align: right;
        white-space: normal;
        font-size: 0.85rem;
        min-height: 32px;
    }
    table.mobile-cards td:last-child,
    .responsive-table tbody td:last-child {
        border-bottom: 0 !important;
        padding-top: 10px !important;
        flex-wrap: wrap;
    }
    table.mobile-cards td::before,
    .responsive-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.72rem;
        flex-shrink: 0;
        max-width: 45%;
        text-align: right;
    }
    /* When data-label is empty (like serial number column), hide the label */
    table.mobile-cards td[data-label=""]::before,
    .responsive-table tbody td[data-label=""]::before { display: none; }
    table.mobile-cards td[data-label="#"]::before,
    .responsive-table tbody td[data-label="#"]::before {
        content: "#"; font-size: 0.65rem; opacity: 0.5;
    }

    /* Hide rows of total cells from empty-state */
    table.mobile-cards tr td.empty-state,
    .responsive-table tbody td.empty-state {
        display: block !important;
        text-align: center;
        padding: 20px !important;
    }
    table.mobile-cards tr td.empty-state::before,
    .responsive-table tbody td.empty-state::before { display: none; }

    /* Action buttons inside cards take full width and wrap better */
    table.mobile-cards td .btn-sm,
    .responsive-table tbody td .btn-sm {
        flex: 1;
        min-width: 90px;
        justify-content: center;
    }
}

/* ===== Stat cards: better on small phones ===== */
@media (max-width: 768px) {
    .stats-grid { gap: 8px; margin-bottom: 14px; }
    .stat-card { min-height: 120px; border-radius: 12px; }
    .sc-top { padding: 10px 12px 0; }
    .sc-icon-circle { width: 34px; height: 34px; }
    .sc-icon-circle svg { width: 16px; height: 16px; }
    .sc-title { font-size: 0.72rem; line-height: 1.3; }
    .sc-number { font-size: 1.55rem; padding: 2px 12px 0; }
    .sc-footer { font-size: 0.62rem; padding: 6px 12px 10px; }
}
@media (max-width: 360px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .sc-number { font-size: 1.35rem; }
}

/* ===== Toolbar / Filters — wrap correctly on mobile ===== */
@media (max-width: 768px) {
    .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .toolbar .search-box,
    .toolbar > .btn-primary,
    .toolbar > button {
        grid-column: 1 / -1;
    }
    .toolbar select,
    .toolbar input:not([type=date]) {
        width: 100% !important;
        min-width: 0 !important;
    }
    .toolbar input[type=date] { width: 100% !important; }
}

/* ===== Tabs — horizontal scroll cleanly ===== */
@media (max-width: 768px) {
    .tabs, .report-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        margin-bottom: 12px;
        scroll-snap-type: x proximity;
    }
    .tabs::-webkit-scrollbar,
    .report-tabs::-webkit-scrollbar { display: none; }
    .tab, .report-tabs .tab {
        scroll-snap-align: start;
        flex-shrink: 0;
        padding: 7px 14px;
        font-size: 0.78rem;
    }
}

/* ===== Profile Header — properly stacks on mobile ===== */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
        padding: 16px;
    }
    .profile-avatar { width: 60px; height: 60px; font-size: 1.6rem; }
    .profile-info h2 { font-size: 1.05rem; }
    .profile-info .meta {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 12px;
    }
    .profile-info .meta span { margin: 0; font-size: 0.78rem; }
    .profile-stats {
        margin-right: 0;
        width: 100%;
        justify-content: center;
        gap: 8px;
    }
    .profile-stat { flex: 1; padding: 8px 10px; }
    .profile-stat .val { font-size: 1.1rem; }
    .profile-stat .lbl { font-size: 0.65rem; }
}

/* ===== Accounts Module — stack sidebar on mobile/tablet ===== */
@media (max-width: 1023px) {
    .accounting-layout,
    .acc-layout-root {
        flex-direction: column;
        gap: 12px !important;
        padding-bottom: max(72px, env(safe-area-inset-bottom));
    }
    .accounting-layout > .card:first-child,
    .accounting-layout .card.acc-sidebar,
    .acc-layout-root > .card.acc-sidebar,
    .acc-sidebar {
        width: 100% !important;
        max-width: 100%;
        position: relative !important;
        top: 0 !important;
    }
    .accounting-layout .nav-menu,
    .accounting-layout .acc-sidebar-nav,
    .acc-layout-root .acc-sidebar-nav {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px !important;
        padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)) !important;
    }
    .accounting-layout .nav-menu::-webkit-scrollbar,
    .acc-sidebar-nav::-webkit-scrollbar { display: none; }
    .acc-sidebar-nav .acc-nav-btn {
        flex-shrink: 0;
        width: auto !important;
        padding: 7px 14px !important;
        font-size: 0.78rem !important;
        white-space: nowrap;
        border-radius: 20px !important;
    }
    .acc-sidebar-header { padding: 14px 16px !important; }
    .acc-sidebar-subtitle { display: none !important; }
    .acc-sidebar-icon { font-size: 1.35rem !important; margin-bottom: 2px; }
    /* Main content: readable width — no sideways overflow into edge */
    #pageContent .acc-main .card,
    #pageContent #accountingContent .card { max-width: 100%; overflow-x: auto; }
}

/* ===== Driver Profile / Vehicle Profile Tabs Content ===== */
@media (max-width: 768px) {
    /* tabBasic grid-2 collapse to one col, but show inline labels */
    .tab-content .grid-2,
    .tab-content .grid-3 {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    .tab-content .grid-2 > div,
    .tab-content .grid-3 > div {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 8px;
        background: var(--bg-secondary);
        border-radius: 8px;
        font-size: 0.82rem;
    }
    .tab-content .grid-2 > div strong,
    .tab-content .grid-3 > div strong {
        color: var(--text-muted);
        font-weight: 600;
        font-size: 0.76rem;
        flex-shrink: 0;
    }
}

/* ===== Daily Ops / Shifts — improvements ===== */
@media (max-width: 768px) {
    /* Compact shift list table when not mobile-cards */
    .daily-shifts-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* ===== Modal on Mobile = full-screen slide-up sheet ===== */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal {
        margin: 0;
        max-width: 100%;
        width: 100%;
        max-height: 92dvh;
        border-radius: 18px 18px 0 0;
        animation: slideUpSheet 0.28s cubic-bezier(0.32,0.72,0,1);
    }
    @keyframes slideUpSheet {
        from { transform: translateY(100%); opacity: 0.6; }
        to   { transform: translateY(0);   opacity: 1; }
    }
    /* Pull handle */
    .modal::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 4px;
        margin: 8px auto 0;
        flex-shrink: 0;
    }
    .modal-header { padding: 10px 16px 12px; }
    .modal-body { padding: 12px 16px; }
    .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        padding: 10px 16px;
        flex-wrap: wrap;
    }
    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
    }
}

/* ===== Form section title — better visual on mobile ===== */
@media (max-width: 768px) {
    .form-section-title {
        font-size: 0.85rem !important;
        font-weight: 800;
        color: var(--accent);
        padding: 8px 0 6px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 10px !important;
    }
}

/* ===== Header — make username show on med-mobile ===== */
@media (max-width: 768px) and (min-width: 481px) {
    .header-user span { display: inline; max-width: 80px; overflow: hidden; text-overflow: ellipsis; font-size: 0.75rem; }
}

/* ===== Bottom navigation: badge & better gestures ===== */
.mob-nav-item { position: relative; }
.mob-nav-badge {
    position: absolute;
    top: 6px;
    right: 22%;
    background: var(--danger);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #091520;
}

/* ===== iOS Safari fixes ===== */
@supports (-webkit-touch-callout: none) {
    .form-control,
    input[type=text], input[type=password], input[type=number],
    input[type=email], input[type=tel], input[type=date], textarea, select {
        font-size: 16px !important; /* prevents iOS zoom on focus */
    }
}

/* ===== Pull-to-refresh hint (visual only) ===== */
@media (max-width: 768px) {
    .page-content { overscroll-behavior-y: contain; }
}

/* ===== Image / hero-bg performance on mobile ===== */
@media (max-width: 768px) {
    .page-content {
        background-image: linear-gradient(rgba(244,247,251,0.92), rgba(240,245,250,0.94));
        background-attachment: scroll;
    }
    .top-header {
        background: linear-gradient(180deg, rgba(7,17,24,0.95), rgba(13,30,43,0.95));
    }
    .sidebar {
        background: linear-gradient(180deg, rgba(7,17,24,0.96), rgba(13,30,43,0.98));
    }
}

/* ===== Quick action grid on phones ===== */
@media (max-width: 768px) {
    .quick-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .quick-action-btn {
        justify-content: center;
        padding: 10px 8px;
        font-size: 0.74rem;
        text-align: center;
    }
}
@media (max-width: 360px) {
    .quick-actions { grid-template-columns: 1fr; }
}

/* ===== Assistant on small phones ===== */
@media (max-width: 768px) {
    .assistant-panel { left: 6px !important; right: 6px !important; width: auto !important; }
    .assistant-quick { padding: 6px 8px; gap: 4px; }
    .assistant-quick-btn { padding: 4px 8px; font-size: 0.7rem; }
}

/* ===== Notification dropdown on phones — full-width ===== */
@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-height: calc(100dvh - 80px);
    }
}

/* ===== Hide noisy elements that overflow on mobile ===== */
@media (max-width: 480px) {
    /* Some long file inputs / drop zones */
    .upload-drop-zone { padding: 16px 12px; min-height: 90px; font-size: 0.8rem; }
}

/* ===== Make Profile back-button sticky on mobile ===== */
@media (max-width: 768px) {
    .page-content > .btn-outline:first-child {
        position: sticky;
        top: 0;
        z-index: 5;
        background: var(--bg-card);
        margin: -12px -12px 12px !important;
        padding: 10px 14px !important;
        border-radius: 0 0 12px 12px !important;
        border: none !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        text-align: right;
    }
}

/* ===== Card padding tighter on small phones ===== */
@media (max-width: 480px) {
    .card { padding: 12px 12px; border-radius: 12px; }
    .card-header { margin-bottom: 10px; }
    .stat-card { min-height: 110px; }
    .sc-number { font-size: 1.4rem; }
    .sc-icon-circle { width: 32px; height: 32px; }
    .sc-icon-circle svg { width: 14px; height: 14px; }
}

/* ===== Better focus states for keyboard users ===== */
.btn:focus-visible,
.form-control:focus-visible,
.nav-item:focus-visible,
.mob-nav-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== Empty-state on mobile ===== */
@media (max-width: 480px) {
    .empty-state { padding: 36px 12px; }
    .empty-state .icon { font-size: 2.2rem; }
    .empty-state h3 { font-size: 0.95rem; }
}

/* ===== Dashboard hero on small phones ===== */
@media (max-width: 480px) {
    .dashboard-hero {
        padding: 14px;
        gap: 12px;
    }
    .hero-brand-col { gap: 12px; }
    .hero-logo-ring, .hero-logo-img { width: 54px; height: 54px; }
    .hero-brand-name { font-size: 0.9rem; }
    .hero-brand-en { font-size: 0.6rem; }
    .hero-type-text { font-size: 0.95rem; }
    .hero-live-badge { font-size: 0.6rem; padding: 2px 8px; }
}

/* ===== Charts / SVG mockup — hide on smaller screens, already in 900px ===== */

/* ===== Better drop-down (select) appearance on iOS ===== */
select.form-control {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(0% + 12px) 50%,
        calc(0% + 17px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-left: 30px;
}

/* ===== Hint text below scrollable tables ===== */
@media (max-width: 768px) {
    .table-wrapper:not(.no-scroll-hint)::before,
    .table-container:not(.no-scroll-hint)::before {
        content: '👈 اسحب لرؤية باقي الأعمدة';
        display: block;
        font-size: 0.7rem;
        color: var(--text-muted);
        text-align: center;
        padding: 4px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
    }
    /* Hide hint when table is in card mode */
    .responsive-table .table-wrapper::before,
    .responsive-table .table-container::before,
    table.mobile-cards + ::before { display: none !important; }
    .responsive-table .table-wrapper, .responsive-table .table-container {
        overflow: visible;
    }
}

/* ===== Safe-area paddings for notch / home bar ===== */
.sidebar { padding-top: env(safe-area-inset-top, 0); }
.app-container { padding-left: env(safe-area-inset-left, 0); padding-right: env(safe-area-inset-right, 0); }

/* ===== Improved spinner visibility ===== */
.spinner { border-color: rgba(0,0,0,0.06); border-top-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   VAT REPORT — لوحة الضريبة
══════════════════════════════════════════════════════════════ */
.vat-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
}
.vat-filter-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.vat-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 768px) { .vat-summary-cards { grid-template-columns: 1fr; } }

.vat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    border-right: 4px solid transparent;
}
.vat-card-output { border-right-color: var(--danger); }
.vat-card-input  { border-right-color: var(--success); }
.vat-card-danger { border-right-color: var(--danger); background: rgba(239,68,68,0.06); }
.vat-card-success{ border-right-color: var(--success); background: rgba(16,185,129,0.06); }

.vat-card-icon { font-size: 2rem; flex-shrink: 0; }
.vat-card-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.vat-card-amount { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.vat-card-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.vat-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.vat-section-header {
    background: var(--bg-hover);
    padding: 12px 18px;
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}
.vat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.vat-table th {
    padding: 10px 16px;
    background: rgba(0,0,0,0.04);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.78rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}
.vat-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.vat-total-row td {
    background: var(--bg-hover);
    font-weight: 700;
}
.vat-net-box {
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-top: 8px;
}
.vat-net-box-danger  { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); }
.vat-net-box-success { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); }
.vat-net-title   { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.vat-net-formula { font-size: 1.4rem; font-weight: 800; margin-bottom: 12px; }
.vat-net-hint    { font-size: 0.85rem; color: var(--text-muted); }
