:root {
    --primary: #1b4332;
    --primary-dark: #10261d;
    --accent: #2d9d63;
    --accent-hover: #23824f;
    --sidebar-width: 255px;
    --topbar-height: 57px;
    --text-light: #c9d6cf;
    --text-muted: #8898aa;
    --border: #e0e6ed;
    --bg: #f0f2f5;
    --white: #ffffff;
}

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

/* LAYOUT */
#app-wrapper { display: flex; min-height: 100vh; }

/* SIDEBAR */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--primary);
    position: fixed;
    left: 0; top: 0; bottom: 0;
    overflow-y: auto;
    transition: transform 0.28s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}
#sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    background: var(--primary-dark);
    color: white;
    font-size: 1.15rem;
    font-weight: 700;
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-brand-icon { font-size: 1.4rem; color: var(--accent); }
.sidebar-nav { flex: 1; padding: 6px 0 16px; }
.nav-section {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 14px 18px 4px;
    font-weight: 700;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.18s;
    border-left: 3px solid transparent;
    font-size: 0.87rem;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; border-left-color: rgba(255,255,255,0.2); }
.nav-item.active { background: rgba(45,157,99,0.22); color: #fff; border-left-color: var(--accent); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 0.88rem; flex-shrink: 0; }

/* SCROLLBAR SIDEBAR */
#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* MAIN */
#main-container {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.28s ease;
}
#main-container.expanded { margin-left: 0; }

/* TOPBAR */
#topbar {
    height: var(--topbar-height);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
#sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}
#sidebar-toggle:hover { background: rgba(255,255,255,0.1); }
.topbar-title { font-size: 1rem; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-info { font-size: 0.82rem; color: var(--text-light); }
.topbar-date { font-size: 0.78rem; color: var(--text-muted); display: none; }
@media (min-width: 900px) { .topbar-date { display: block; } }

/* CONTENT */
#content-area { flex: 1; padding: 22px; overflow-x: hidden; }
.content-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
}

/* FOOTER */
#footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 10px 22px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1b4332;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* STAT CARDS */
.stat-card {
    border-radius: 10px;
    padding: 18px 20px;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}
.stat-card .stat-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.8rem;
    opacity: 0.22;
}
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: 0.82rem; opacity: 0.88; margin-top: 3px; }
.stat-card.blue   { background: linear-gradient(135deg, #3498db, #1a6fa8); }
.stat-card.green  { background: linear-gradient(135deg, #2d9d63, #1b4332); }
.stat-card.orange { background: linear-gradient(135deg, #e67e22, #c0590e); }
.stat-card.red    { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-card.purple { background: linear-gradient(135deg, #8e44ad, #6c3483); }
.stat-card.teal   { background: linear-gradient(135deg, #1abc9c, #0e8c71); }
.stat-card.olive  { background: linear-gradient(135deg, #8a9a3a, #5c6825); }

/* CARDS */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    background: var(--white);
}
.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 13px 18px;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 10px 10px 0 0 !important;
}
.card-body { padding: 18px; }

/* TABLE CONTAINER */
.table-container {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}
.table-toolbar {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.search-input { max-width: 280px; min-width: 160px; }
.table { margin-bottom: 0; font-size: 0.87rem; }
.table thead th {
    background: #f2f8f4;
    font-weight: 600;
    font-size: 0.77rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4a5a4e;
    border-top: none;
    padding: 11px 14px;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}
.table tbody td {
    padding: 11px 14px;
    vertical-align: middle;
    border-color: #f0f4f8;
}
.table tbody tr:hover { background: #f7fcf9; }
.action-btn { padding: 3px 7px; font-size: 0.78rem; }
.table-responsive { overflow-x: auto; }

/* BADGES */
.badge { font-size: 0.75rem; font-weight: 500; padding: 4px 8px; }
.badge-disponible, .badge-actif, .badge-termine, .badge-favorable, .badge-approuve, .badge-payee { background: #2d9d63 !important; }
.badge-en_tournee, .badge-confirmee, .badge-convertie, .badge-emise { background: #3498db !important; }
.badge-maintenance, .badge-en_attente { background: #e67e22 !important; }
.badge-hors_service, .badge-annule, .badge-defavorable, .badge-refuse { background: #e74c3c !important; }
.badge-en_cours { background: #1abc9c !important; }
.badge-inactif { background: #7f8c8d !important; }

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 55px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 3.5rem; margin-bottom: 14px; opacity: 0.25; display: block; }
.empty-state h5 { font-size: 1rem; margin-bottom: 6px; color: #555; }

/* PAGINATION BAR */
.table-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-muted);
    background: #f7fcf9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

/* FORM */
.form-label { font-weight: 500; font-size: 0.87rem; margin-bottom: 4px; }
.form-label.required-field::after { content: ' *'; color: #e74c3c; }
.form-control, .form-select { font-size: 0.87rem; border-color: #dce1e8; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 0.2rem rgba(45,157,99,0.18); }

/* ALERTS */
.alert { font-size: 0.85rem; }
.alert-sm { padding: 8px 12px; font-size: 0.82rem; border-radius: 6px; }

/* PROGRESS */
.progress { background: #e9ecef; }

/* TABLE COLORED ROWS */
.table-success-light { background: rgba(45,157,99,0.06) !important; }
.table-danger-light  { background: rgba(231,76,60,0.06) !important; }
.fw-500 { font-weight: 500; }

/* BADGE EXTRA */
.badge-contre-visite { background: #2d9d63 !important; }

/* PRINT */
@media print {
    #sidebar, #topbar, .no-print, .action-btn { display: none !important; }
    #main-container { margin-left: 0; }
    #content-area { padding: 0; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    #sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
    #sidebar.mobile-open { transform: translateX(0); }
    #main-container { margin-left: 0; }
    #content-area { padding: 14px; }
    .stat-card .stat-value { font-size: 1.3rem; }
}

/* STATUS TIMELINE */
.timeline-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}
.dot-green { background: #2d9d63; }
.dot-blue  { background: #3498db; }
.dot-orange{ background: #e67e22; }
.dot-red   { background: #e74c3c; }
.dot-gray  { background: #7f8c8d; }

/* MINI CARD (dashboard listes) */
.vehicle-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.vehicle-mini-card:last-child { border-bottom: none; }
.vehicle-mini-plate {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 110px;
}

/* MODAL LARGE ON WIDE SCREEN */
@media (min-width: 992px) {
    .modal-xl { max-width: 900px; }
}
