/* ============================================
   FlotaSmart - Complete Stylesheet
   Professional Fleet Management UI
   ============================================ */

:root {
    --bg: #f5f6fa;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #25254a;
    --bg-sidebar-active: #2d2d5e;
    --text: #2c3e50;
    --text-light: #7f8c9b;
    --text-sidebar: #a8adc4;
    --text-sidebar-active: #ffffff;
    --primary: #4361ee;
    --primary-hover: #3a56d4;
    --primary-light: #eef0ff;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --border: #e8ecf1;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

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

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 10px;
}

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

.logo-icon { font-size: 1.6rem; }

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: none;
}

.sidebar-toggle:hover { background: var(--bg-sidebar-hover); }

.sidebar-nav {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    transition: all 0.15s ease;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.93rem;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.nav-item i { font-size: 1.15rem; opacity: 0.8; }
.nav-item.active i { opacity: 1; }
.nav-emoji { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }

.nav-badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: auto;
    font-weight: 600;
}

.nav-section {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #5a5f7a;
    padding: 18px 14px 6px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #2a2a4a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-name { color: #fff; font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: #6b7194; }

.logout-btn { font-size: 0.85rem !important; }

.hub-btn {
    background: rgba(67, 97, 238, 0.15) !important;
    color: #8ba4f8 !important;
    border: 1px solid rgba(67, 97, 238, 0.25);
    margin-bottom: 4px;
}

.hub-btn:hover {
    background: rgba(67, 97, 238, 0.3) !important;
    color: #fff !important;
}

.hub-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 0.88rem;
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    transition: all 0.2s;
}

.hub-back-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    text-decoration: none;
}

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

/* === Topbar === */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text);
    padding: 6px;
}

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

/* Notification Bell */
.notification-bell { position: relative; }

.notification-bell button {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 8px;
    border-radius: 50%;
    position: relative;
    transition: background 0.15s;
}

.notification-bell button:hover { background: var(--bg); }

.notif-badge {
    position: absolute;
    top: 4px; right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 200;
}

.notif-dropdown.show { display: block; }

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.notif-header a { font-size: 0.8rem; }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-empty { padding: 30px; text-align: center; color: var(--text-light); font-size: 0.9rem; }

.notif-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.1s;
}

.notif-item:hover { background: var(--bg); text-decoration: none; }
.notif-title { font-size: 0.88rem; color: var(--text); font-weight: 500; }
.notif-time { font-size: 0.75rem; color: var(--text-light); margin-top: 3px; }

.notif-footer {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* === Page Content === */
.page-content { padding: 24px; flex: 1; }

/* === Page Header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.page-subtitle { color: var(--text-light); font-size: 0.93rem; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

.header-vehicle-photo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    object-fit: cover;
}

.plate-badge {
    background: #1a1a2e;
    color: #fff;
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 1px;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-header h2 { font-size: 1.05rem; font-weight: 600; }
.card-body { padding: 20px; }

.card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}

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

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-value small { font-size: 0.7rem; font-weight: 500; color: var(--text-light); }
.stat-label { font-size: 0.82rem; color: var(--text-light); font-weight: 500; }

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

.card-lg { min-height: 400px; }

/* === Filters Bar === */
.filters-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-form { flex: 1; min-width: 240px; }

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap i {
    position: absolute;
    left: 14px;
    color: var(--text-light);
    font-size: 1.1rem;
}

.search-input-wrap input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    outline: none;
    transition: border 0.15s;
}

.search-input-wrap input:focus { border-color: var(--primary); }

.filter-tabs { display: flex; gap: 6px; }

.filter-tab {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.15s;
}

.filter-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === Vehicles Grid === */
.vehicles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.vehicle-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.vehicle-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.vehicle-card.border-danger { border-left: 4px solid var(--danger); }
.vehicle-card.border-warning { border-left: 4px solid var(--warning); }

.vehicle-photo {
    height: 180px;
    background: linear-gradient(135deg, #e8ecf1 0%, #d5dbe5 100%);
    position: relative;
    overflow: hidden;
}

.vehicle-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vehicle-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0.4;
}

.vehicle-plate {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(26, 26, 46, 0.9);
    color: #fff;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
}

.vehicle-info { padding: 14px 16px; }
.vehicle-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.vehicle-meta { display: flex; gap: 14px; font-size: 0.82rem; color: var(--text-light); margin-bottom: 8px; }
.vehicle-meta span { display: flex; align-items: center; gap: 4px; }
.vehicle-meta i { font-size: 0.9rem; }

/* === Vehicle Status List (Dashboard) === */
.vehicle-status-list { display: flex; flex-direction: column; gap: 6px; }

.vehicle-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: background 0.1s;
}

.vehicle-status-item:hover { background: var(--bg); text-decoration: none; }

.vs-photo { width: 40px; height: 40px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; }
.vs-photo img { width: 100%; height: 100%; object-fit: cover; }
.vs-photo-placeholder { width: 100%; height: 100%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.vs-info { flex: 1; overflow: hidden; }
.vs-info strong { display: block; font-size: 0.88rem; font-family: var(--font-mono); }
.vs-info span { font-size: 0.8rem; color: var(--text-light); }
.vs-status { text-align: right; font-size: 0.8rem; font-weight: 500; }

/* === Tables === */
.table-responsive { overflow-x: auto; }
.doc-table-wrap { overflow-x: auto; }

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

.table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: none; }

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.bg-success { background: #d4edda; color: #155724; }
.bg-warning { background: #fff3cd; color: #856404; }
.bg-danger { background: #f8d7da; color: #721c24; }
.bg-info { background: #d1ecf1; color: #0c5460; }
.bg-secondary { background: #e9ecef; color: #495057; }

.service-badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.service-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    margin: 1px 2px;
}

.role-badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.role-admin { background: #ede7f6; color: #4527a0; }
.role-operator { background: #e3f2fd; color: #1565c0; }

.mono { font-family: var(--font-mono); font-size: 0.88rem; }
.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary); font-weight: 600; }

/* === Detail Grid === */
.detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.detail-item { min-width: 140px; }
.detail-label { display: block; font-size: 0.78rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 2px; }
.detail-value { font-size: 1rem; font-weight: 600; }

/* === Tabs === */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* === Files Grid === */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.file-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
}

.file-preview {
    height: 120px;
    overflow: hidden;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-preview.file-icon { font-size: 2.5rem; background: var(--primary-light); }
.file-info { padding: 10px 12px; }
.file-name { display: block; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { display: block; font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }
.file-actions { display: flex; gap: 4px; padding: 0 12px 10px; }

/* === Activity === */
.activity-list { display: flex; flex-direction: column; }

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px; height: 8px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: 7px;
    flex-shrink: 0;
}

.activity-content { font-size: 0.88rem; }
.activity-time { display: block; font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }

/* === Notifications Page === */
.notifications-list { display: flex; flex-direction: column; gap: 10px; }

.notification-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background 0.1s;
}

.notification-card.unread { background: #f0f4ff; border-color: #c5d3f7; }
.notification-card.read { opacity: 0.7; }
.notif-type-icon { font-size: 1.5rem; flex-shrink: 0; }
.notif-body { flex: 1; }
.notif-body h4 { font-size: 0.95rem; margin-bottom: 2px; }
.notif-body p { font-size: 0.85rem; color: var(--text-light); }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }
.btn i { font-size: 1rem; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); border-color: #ccc; }

.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #f5c6cb; }
.btn-danger-ghost:hover { background: #fff5f5; }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-icon {
    padding: 6px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    display: inline-flex;
    transition: all 0.1s;
}

.btn-icon:hover { background: var(--bg); color: var(--primary); }
.btn-icon-danger:hover { color: var(--danger); background: #fff5f5; }

.action-btns { display: flex; gap: 2px; }

/* === Forms === */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    outline: none;
    transition: border 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { display: block; font-size: 0.78rem; color: var(--text-light); margin-top: 4px; }
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; }

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-card { cursor: pointer; }
.checkbox-card input { display: none; }

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.checkbox-card input:checked + .checkbox-label {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.checkbox-dot { width: 8px; height: 8px; border-radius: 50%; }

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-inline input { width: auto; }

/* === Alerts === */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius);
    margin: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.alert-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: inherit; opacity: 0.6; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Modal === */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex; }

.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 { font-size: 1.1rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    line-height: 1;
}

.modal-body { padding: 20px; }

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

/* === Empty States === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.6; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-light); margin-bottom: 20px; }
.empty-state-sm { text-align: center; padding: 30px; color: var(--text-light); }

/* === Settings === */
.settings-grid { display: flex; flex-direction: column; gap: 20px; }
.code-block {
    background: #1a1a2e;
    color: #a8ff60;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow-x: auto;
}

/* === Auth Page === */
.auth-body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-logo { text-align: center; margin-bottom: 30px; }
.logo-icon-large { font-size: 3rem; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 1.8rem; font-weight: 700; color: var(--text); letter-spacing: -1px; }
.auth-subtitle { color: var(--text-light); font-size: 0.9rem; }
.auth-info { text-align: center; color: var(--text-light); font-size: 0.9rem; margin-bottom: 24px; }

.auth-alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.auth-alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.auth-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    width: 100%;
    padding: 10px 14px;
    padding-right: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    outline: none;
    transition: border 0.15s, box-shadow 0.15s;
}

.password-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
}

.password-toggle:hover { opacity: 1; }

.code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.code-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border 0.15s;
}

.code-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15); }

.code-input.shake { animation: shake 0.4s ease; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 0.85rem;
}

.auth-footer {
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    margin-top: 24px;
}

.btn-loading { display: none; }

/* === Responsive === */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .menu-toggle { display: block; }
    .main-content { margin-left: 0; }
    .page-content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .vehicles-grid { grid-template-columns: 1fr; }

    .page-header {
        flex-direction: column;
        gap: 12px;
    }

    .topbar { padding: 0 16px; }
    .notif-dropdown { width: 300px; right: -10px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 30px 20px; }
    .code-input { width: 40px; height: 48px; font-size: 1.2rem; }
    .filters-bar { flex-direction: column; }
}
