:root {
    --sidebar-width: 260px;
    --sidebar-bg: #264271;
    --sidebar-active: #2563eb;
    --topbar-height: 60px;
    --primary: #2563eb;
    --body-bg: #f0f2f5;
}

* { box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--body-bg); margin: 0; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: width 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon {
    width: 42px; height: 42px;
    background: var(--sidebar-active);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
    flex-shrink: 0;
}

.brand-text { overflow: hidden; }
.brand-text .brand-name { font-size: 15px; font-weight: 700; color: white; white-space: nowrap; }
.brand-text .brand-sub { font-size: 11px; color: rgba(255,255,255,0.4); white-space: nowrap; }

.sidebar-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0; }
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-label {
    padding: 10px 20px 4px;
    font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.25); text-transform: uppercase;
    white-space: nowrap; overflow: hidden;
}

.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-nav a:hover {
    color: white;
    background: rgba(255,255,255,0.06);
    border-left-color: rgba(255,255,255,0.2);
}

.sidebar-nav a.active {
    color: white;
    background: rgba(37,99,235,0.25);
    border-left-color: var(--sidebar-active);
    font-weight: 500;
}

.sidebar-nav a i { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar-nav a .nav-text { overflow: hidden; }

.sidebar-divider { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 8px 20px; }

.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

/* ── Collapsed Sidebar ── */
body.sidebar-collapsed .sidebar { width: 68px; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 18px 13px; }
body.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 12px; border-left: none; border-radius: 0; }
body.sidebar-collapsed .sidebar-nav a i { width: auto; font-size: 17px; }
body.sidebar-collapsed .main-content { margin-left: 68px; }

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center;
    padding: 0 24px;
    position: sticky; top: 0;
    z-index: 100;
    gap: 16px;
}

.btn-sidebar-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: #6b7280;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}
.btn-sidebar-toggle:hover { background: #f3f4f6; }

.topbar-title { font-size: 17px; font-weight: 600; color: #111827; flex: 1; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.topbar-icon-btn {
    width: 36px; height: 36px; border-radius: 8px;
    background: none; border: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: #6b7280; cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.topbar-icon-btn:hover { background: #f3f4f6; border-color: #d1d5db; }

.badge-dot {
    width: 8px; height: 8px;
    background: #ef4444; border-radius: 50%;
    position: absolute; top: 4px; right: 4px;
    border: 2px solid white;
}

.topbar-user {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; padding: 6px 10px;
    border-radius: 8px; transition: background 0.2s;
}
.topbar-user:hover { background: #f3f4f6; }

.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}

.user-info .user-name { font-size: 13px; font-weight: 600; color: #111827; line-height: 1.2; }
.user-info .user-role { font-size: 11px; color: #6b7280; }

/* ── Content Area ── */
.content-area { padding: 24px; }

.page-header { margin-bottom: 20px; }
.page-header h4 { font-size: 18px; font-weight: 700; color: #111827; margin: 0; }
.page-header p { font-size: 13px; color: #6b7280; margin: 4px 0 0; }

/* ── Stat Cards ── */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    border-left: 4px solid;
    display: flex; align-items: center; gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

.stat-card.blue  { border-left-color: #2563eb; }
.stat-card.green { border-left-color: #16a34a; }
.stat-card.orange{ border-left-color: #ea580c; }
.stat-card.purple{ border-left-color: #7c3aed; }
.stat-card.red   { border-left-color: #dc2626; }
.stat-card.teal  { border-left-color: #0d9488; }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-card.blue   .stat-icon { background: #eff6ff; color: #2563eb; }
.stat-card.green  .stat-icon { background: #f0fdf4; color: #16a34a; }
.stat-card.orange .stat-icon { background: #fff7ed; color: #ea580c; }
.stat-card.purple .stat-icon { background: #faf5ff; color: #7c3aed; }
.stat-card.red    .stat-icon { background: #fef2f2; color: #dc2626; }
.stat-card.teal   .stat-icon { background: #f0fdfa; color: #0d9488; }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; color: #111827; line-height: 1.2; }
.stat-change { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.stat-change .up   { color: #16a34a; font-weight: 500; }
.stat-change .down { color: #dc2626; font-weight: 500; }

/* ── Cards ── */
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.07); overflow: hidden; }
.card-header {
    background: white; border-bottom: 1px solid #f3f4f6;
    padding: 15px 20px; font-weight: 600; font-size: 14px;
    color: #111827; display: flex; align-items: center; gap: 8px;
}
.card-header .card-title-icon { color: var(--primary); font-size: 16px; }
.card-body { padding: 20px; background: white; }

/* ── Tables ── */
.table-wrapper {
    background: white; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07); overflow: hidden;
}

.table-header {
    padding: 16px 20px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid #f3f4f6;
    flex-wrap: wrap;
}

.table-header .table-title { font-size: 15px; font-weight: 600; color: #111827; flex: 1; }

.table { margin: 0; }
.table thead th {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
    color: #6b7280; background: #fafafa; border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px; white-space: nowrap;
}
.table tbody td {
    padding: 13px 16px; font-size: 13.5px; color: #374151;
    border-bottom: 1px solid #f3f4f6; vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f9fafb; }

/* ── Badges ── */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-active      { background: #dcfce7; color: #15803d; }
.badge-inactive    { background: #fee2e2; color: #b91c1c; }
.badge-maintenance { background: #fef3c7; color: #b45309; }
.badge-idle        { background: #e0f2fe; color: #0369a1; }
.badge-admin       { background: #ede9fe; color: #6d28d9; }
.badge-driver      { background: #dbeafe; color: #1d4ed8; }
.badge-dispatcher  { background: #fce7f3; color: #be185d; }
.badge-pending     { background: #fef9c3; color: #a16207; }
.badge-completed   { background: #dcfce7; color: #15803d; }
.badge-cancelled   { background: #fee2e2; color: #b91c1c; }

/* ── Buttons ── */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-icon { width: 30px; height: 30px; padding: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }

/* ── Forms ── */
.form-label { font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; }
.form-control, .form-select {
    font-size: 13.5px; border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ── Search bar ── */
.search-wrapper { position: relative; }
.search-wrapper .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 13px; }
.search-wrapper input { padding-left: 32px; }

/* ── Modals ── */
.modal-content { border: none; border-radius: 14px; }
.modal-header { border-bottom: 1px solid #f3f4f6; padding: 16px 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-footer { border-top: 1px solid #f3f4f6; padding: 14px 20px; }
.modal-body { padding: 20px; }

/* ── Toast ── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast-msg { min-width: 280px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); }

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2332 0%, #1e3a5f 50%, #2563eb 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.login-card {
    background: white; border-radius: 20px;
    padding: 44px 40px; width: 100%; max-width: 430px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}
.login-logo-wrap { text-align: center; margin-bottom: 28px; }
.login-logo {
    width: 68px; height: 68px; border-radius: 18px;
    background: var(--primary); color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 30px; margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(37,99,235,0.4);
}
.login-logo-wrap h4 { font-size: 22px; font-weight: 700; margin: 0; color: #111827; }
.login-logo-wrap p  { font-size: 13px; color: #6b7280; margin: 4px 0 0; }

/* ── Filter bar ── */
.filter-bar {
    background: white; border-radius: 10px;
    padding: 14px 18px; margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
}

/* ── Chart containers ── */
.chart-box { position: relative; height: 260px; }

/* ── Recent list ── */
.recent-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #f3f4f6;
}
.recent-item:last-child { border-bottom: none; padding-bottom: 0; }
.recent-icon {
    width: 36px; height: 36px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.recent-info { flex: 1; min-width: 0; }
.recent-info .r-title { font-size: 13px; font-weight: 500; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-info .r-sub   { font-size: 11px; color: #9ca3af; }
.recent-amount { font-size: 13px; font-weight: 600; color: #111827; white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease, width 0.3s ease; width: var(--sidebar-width) !important; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    body.sidebar-open .sidebar-overlay { display: block; }
}

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
}

/* ── Utilities ── */
.text-muted-sm { font-size: 12px; color: #9ca3af; }
.fw-600 { font-weight: 600; }
.avatar-xs {
    width: 30px; height: 30px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
