/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === VARIABLES : LIGHT MODE === */
:root {
    /* Brand */
    --primary: #d31681;
    --primary-dark: #aa1268;
    --primary-light: #fce7f3;
    --brand-dark: #190e29;

    /* Semantic tokens */
    --surface:    #ffffff;
    --surface-2:  #f3f4f6;
    --surface-3:  #e5e7eb;
    --bg:         #f3f4f6;
    --text:       #1f2937;
    --text-muted: #6b7280;
    --border:     #e5e7eb;
    --header-bg:  #190e29;

    /* Status */
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;

    /* Gray scale */
    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
}

/* === DARK MODE === */
body.dark {
    --surface:    #1c1030;
    --surface-2:  #130b22;
    --surface-3:  #2a1a45;
    --bg:         #0f0a1a;
    --text:       #f0edf8;
    --text-muted: #9b8fb8;
    --border:     #2d1f4a;
    --header-bg:  #090612;

    --primary-light:  rgba(211, 22, 129, 0.15);
    --success-light:  rgba(22, 163, 74, 0.15);
    --warning-light:  rgba(217, 119, 6, 0.15);
    --danger-light:   rgba(220, 38, 38, 0.15);

    /* Gray scale remapped */
    --gray-50:  #1c1030;
    --gray-100: #2a1a45;
    --gray-200: #2d1f4a;
    --gray-300: #3d2d60;
    --gray-400: #9b8fb8;
    --gray-500: #9b8fb8;
    --gray-600: #c4b8e0;
    --gray-700: #d4cae8;
    --gray-800: #f0edf8;
    --gray-900: #ffffff;

    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    transition: background .2s, color .2s;
}

/* === LOGIN === */
.login-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #190e29 0%, #3d1060 50%, #d31681 100%);
}
.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%; max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { width: 72px; height: 72px; margin: 0 auto .75rem; display: block; }
.login-header h1 {
    font-size: 1.75rem; font-weight: 800;
    background: linear-gradient(135deg, #190e29, #d31681);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: .25rem;
}
.login-header p { color: var(--text-muted); font-size: .875rem; }
.login-error { color: var(--danger); font-size: .85rem; min-height: 1.25rem; text-align: center; }
.btn-block { width: 100%; padding: .75rem; font-size: 1rem; }
.login-hint { text-align: center; margin-top: 1.5rem; font-size: .75rem; color: var(--text-muted); }

/* Dark mode: form inputs */
body.dark .form-group input,
body.dark .form-group select,
body.dark .form-group textarea,
body.dark .search-input,
body.dark .filter-select {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border);
}
body.dark .login-card { background: var(--surface); }

/* === USER INFO (header) === */
.user-info { display: flex; align-items: center; gap: .5rem; margin-left: auto; white-space: nowrap; }
.user-name { font-size: .85rem; font-weight: 500; }
.user-info .badge { font-size: .7rem; }
.user-info .btn { font-size: .75rem; padding: .25rem .5rem; }

.header-right { display: flex; align-items: center; gap: .5rem; }

/* Dark mode toggle button */
#btn-dark-mode {
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.8);
    border-radius: 8px;
    width: 34px; height: 34px;
}
#btn-dark-mode:hover { background: rgba(255,255,255,.15); color: #fff; }

/* === HEADER === */
.header {
    background: var(--header-bg);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
    border-bottom: 1px solid rgba(211, 22, 129, .2);
}
.header-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: .5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-brand { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.header-logo { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.header-brand-name {
    font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em;
    color: #fff;
}
.header-brand-name .brand-av {
    background: linear-gradient(135deg, #d31681, #9b1fbb);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex; justify-content: center; gap: .125rem;
    padding: 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-separator { width: 1px; background: rgba(255,255,255,.15); margin: .5rem .25rem; }
.nav-btn {
    display: flex; align-items: center; gap: .4rem;
    padding: .6rem .85rem;
    background: none; border: none;
    color: rgba(255,255,255,.5);
    cursor: pointer; font-size: .8rem; white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all .15s;
}
.nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-btn:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.05); border-radius: 6px 6px 0 0; }
.nav-btn.active { color: #fff; border-bottom-color: var(--primary); background: rgba(211,22,129,.1); border-radius: 6px 6px 0 0; }

/* === MAIN === */
.main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content > h2 { font-size: 1.5rem; margin-bottom: 1.25rem; color: var(--text); }

/* === SECTION HEADER === */
.section-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-header h2 { margin-bottom: 0; }
.section-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.search-input, .filter-select {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    background: var(--surface);
    color: var(--text);
}
.search-input { width: 220px; }
.search-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* === BUTTONS === */
.btn {
    display: inline-flex; align-items: center; gap: .375rem;
    padding: .5rem 1rem;
    border: none; border-radius: var(--radius);
    font-size: .875rem; font-weight: 500;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-sm { padding: .25rem .5rem; font-size: .8rem; }
.btn-icon {
    width: 32px; height: 32px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--gray-100); border: none; cursor: pointer; transition: all .15s;
}
.btn-icon:hover { background: var(--gray-200); }
.btn-icon svg { width: 16px; height: 16px; }

/* === STATS GRID === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-info h4 { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-info .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }

/* === DASHBOARD === */
.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.dashboard-card { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.dashboard-card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-muted); }

.alert-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .625rem .75rem;
    border-radius: 6px; margin-bottom: .5rem; font-size: .875rem;
}
.alert-item.red { background: var(--danger-light); color: var(--danger); }
.alert-item.orange { background: var(--warning-light); color: var(--warning); }
.alert-item.blue { background: var(--primary-light); color: var(--primary); }
.alert-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.entretien-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: .625rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}
.entretien-item:last-child { border-bottom: none; }
.entretien-item-info { display: flex; flex-direction: column; gap: .125rem; }
.entretien-item-info strong { color: var(--text); }
.entretien-item-info span { color: var(--text-muted); font-size: .8rem; }

/* === TABLE === */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
thead th {
    background: var(--surface-2);
    padding: .75rem 1rem;
    text-align: left; font-size: .75rem; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: var(--surface-3); }
.sort-icon { font-size: .65rem; opacity: .3; margin-left: .25rem; }
.sort-icon.active { opacity: 1; color: var(--primary); }
tbody td {
    padding: .75rem 1rem; font-size: .875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle; color: var(--text);
}
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* === BADGES === */
.badge {
    display: inline-block;
    padding: .125rem .5rem;
    border-radius: 9999px;
    font-size: .75rem; font-weight: 500;
}
.badge-green { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }
.badge-yellow { background: #fef9c3; color: #92400e; }
body.dark .badge-yellow { background: rgba(146, 64, 14, .2); color: #fbbf24; }

/* === MODAL === */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 1rem;
}
.modal.hidden { display: none; }
.modal.modal-top { z-index: 300; }
.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal-large { max-width: 700px; }
.modal-xlarge { max-width: 900px; }
.modal-small { max-width: 400px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; color: var(--text); }
.modal-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: none;
    font-size: 1.5rem; color: var(--text-muted);
    cursor: pointer; border-radius: 50%;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-content > p, .modal-content > form { padding: 1.25rem; }
.modal-content > .form-actions { padding: 0 1.25rem 1.25rem; }

/* === FORMS === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.25rem; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: .25rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: 6px; font-size: .875rem; font-family: inherit;
    background: var(--surface); color: var(--text);
    transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
form:not(.form-grid) { display: flex; flex-direction: column; gap: 1rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; padding-top: .5rem; }

/* === EXPORT === */
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.export-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.export-card h3 { font-size: 1rem; margin-bottom: .5rem; color: var(--text); }
.export-card p { font-size: .875rem; color: var(--text-muted); margin-bottom: 1rem; }

/* === PARAMÈTRES === */
.param-section { margin-bottom: 2rem; }
.param-section-title {
    display: flex; align-items: center; gap: .5rem;
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--text-muted);
    margin-bottom: .75rem; padding-bottom: .5rem;
    border-bottom: 2px solid var(--border);
}
.param-section-title svg { width: 14px; height: 14px; }
.param-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .param-grid-2 { grid-template-columns: 1fr; } }

.param-category {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.param-category-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.param-category-header h3 { font-size: .95rem; margin: 0; color: var(--text); }
.param-list { display: flex; flex-direction: column; gap: .4rem; }
.param-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .4rem .6rem;
    background: var(--surface-2);
    border-radius: 6px; font-size: .875rem;
}
.param-valeur { font-family: monospace; font-size: .75rem; color: var(--text-muted); min-width: 100px; }
.param-libelle { flex: 1; color: var(--text); }
.param-actions { display: flex; gap: .25rem; margin-left: auto; }
.param-perio { }

.param-alert-cards { display: flex; gap: 1rem; flex-wrap: wrap; }
.param-alert-card {
    flex: 1; min-width: 220px;
    background: var(--surface);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    display: flex; align-items: center; gap: .75rem;
    border-left: 4px solid transparent;
}
.param-alert-card.orange { border-left-color: var(--warning); }
.param-alert-card.blue   { border-left-color: var(--primary); }
.param-alert-card.yellow { border-left-color: #f59e0b; }
.param-alert-icon { font-size: 1.25rem; }
.param-alert-info { flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.param-alert-label { font-weight: 600; font-size: .9rem; color: var(--text); }
.param-alert-desc  { font-size: .75rem; color: var(--text-muted); }

/* === SUMMARY BAR === */
.summary-bar {
    background: var(--surface);
    border-radius: var(--radius);
    padding: .75rem 1.25rem; margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: flex; gap: 2rem; font-size: .875rem; color: var(--text-muted);
}
.summary-bar strong { color: var(--text); }

/* === FICHE VEHICULE === */
.fiche-header { display: flex; gap: 2rem; padding: 1.25rem; border-bottom: 1px solid var(--border); }
.fiche-infos { flex: 1; }
.fiche-infos h4 { font-size: 1.1rem; margin-bottom: .75rem; color: var(--text); }
.fiche-detail { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; font-size: .875rem; }
.fiche-detail dt { color: var(--text-muted); }
.fiche-detail dd { color: var(--text); font-weight: 500; }

.fiche-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 1.25rem; }
.fiche-tab {
    padding: .75rem 1rem; border: none; background: none;
    font-size: .875rem; color: var(--text-muted);
    cursor: pointer; border-bottom: 2px solid transparent;
}
.fiche-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.fiche-tab-content { padding: 1.25rem; }
.fiche-tab-header { margin-bottom: .75rem; display: flex; gap: .5rem; justify-content: flex-end; }

/* === UTILITIES === */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .8rem; }
.mt-1 { margin-top: .5rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: .75rem; }

.checkbox-inline { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--text-muted); margin-top: .35rem; cursor: pointer; }
.checkbox-inline input[type="checkbox"] { margin: 0; cursor: pointer; }

tr.row-planifie { background: var(--primary-light); }
tr.row-planifie:hover { background: var(--primary-light); filter: brightness(.95); }

.clickable { cursor: pointer; color: var(--primary); font-weight: 600; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.clickable:hover { text-decoration-style: solid; }

/* === PLANNING / CALENDRIER === */
.planning-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.planning-nav h3 { min-width: 200px; text-align: center; margin: 0; font-size: 1.2rem; text-transform: capitalize; color: var(--text); }
.planning-nav .btn { padding: .5rem .75rem; display: flex; align-items: center; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); width: 100%; }
.calendar-header-row { display: contents; }
.calendar-day-name { padding: .5rem; text-align: center; font-weight: 600; font-size: .8rem; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border); min-width: 0; }
.calendar-cell { min-height: 120px; padding: .375rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); position: relative; min-width: 0; overflow: hidden; }
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-cell.empty { background: var(--surface-2); }
.calendar-cell.weekend { background: var(--surface-2); opacity: .85; }
.calendar-cell.today { background: var(--primary-light); }
.calendar-cell.today .calendar-day-num { background: var(--primary); color: white; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.calendar-day-num { font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: .25rem; }
.calendar-events { display: flex; flex-direction: column; gap: 2px; }
.calendar-event { display: flex; align-items: center; gap: 4px; padding: 1px 4px; border-radius: 3px; font-size: .7rem; line-height: 1.3; cursor: pointer; overflow: hidden; white-space: nowrap; }
.calendar-event:hover { filter: brightness(0.9); }
.calendar-event.blue { background: #dbeafe; color: #1e40af; }
.calendar-event.orange { background: #ffedd5; color: #c2410c; }
.calendar-event.red { background: #fee2e2; color: #dc2626; }
.calendar-event.green { background: #dcfce7; color: #16a34a; }
.calendar-event.teal { background: #ccfbf1; color: #0d9488; }
.calendar-event.purple { background: #ede9fe; color: #7c3aed; }
.calendar-event.yellow { background: #fef9c3; color: #92400e; }
body.dark .calendar-event.blue   { background: rgba(30,64,175,.25); color: #93c5fd; }
body.dark .calendar-event.orange { background: rgba(194,65,12,.25); color: #fdba74; }
body.dark .calendar-event.red    { background: rgba(220,38,38,.25); color: #fca5a5; }
body.dark .calendar-event.green  { background: rgba(22,163,74,.25); color: #86efac; }
body.dark .calendar-event.teal   { background: rgba(13,148,136,.25); color: #5eead4; }
body.dark .calendar-event.purple { background: rgba(124,58,237,.25); color: #c4b5fd; }
body.dark .calendar-event.yellow { background: rgba(146,64,14,.25); color: #fde68a; }

.calendar-event-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.calendar-event.blue .calendar-event-dot { background: #3b82f6; }
.calendar-event.orange .calendar-event-dot { background: #f97316; }
.calendar-event.red .calendar-event-dot { background: #ef4444; }
.calendar-event.green .calendar-event-dot { background: #22c55e; }
.calendar-event.teal .calendar-event-dot { background: #14b8a6; }
.calendar-event.purple .calendar-event-dot { background: #7c3aed; }
.calendar-event.yellow .calendar-event-dot { background: #f59e0b; }
.calendar-event-text { overflow: hidden; text-overflow: ellipsis; }
.calendar-event-more { font-size: .65rem; color: var(--text-muted); padding-left: 4px; }

.calendar-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; padding: .75rem 1rem; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: .375rem; font-size: .8rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.blue   { background: #3b82f6; }
.legend-dot.orange { background: #f97316; }
.legend-dot.red    { background: #ef4444; }
.legend-dot.green  { background: #22c55e; }
.legend-dot.teal   { background: #14b8a6; }
.legend-dot.purple { background: #7c3aed; }
.legend-dot.yellow { background: #f59e0b; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: .5rem; }
.timeline-day { display: flex; gap: 1rem; padding: .75rem; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.timeline-day.today { border-color: var(--primary); border-width: 2px; }
.timeline-day.past { opacity: .6; }
.timeline-date { min-width: 70px; text-align: center; flex-shrink: 0; }
.timeline-day-num { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.timeline-day-name { font-size: .75rem; color: var(--text-muted); text-transform: capitalize; }
.timeline-events { display: flex; flex-direction: column; gap: .375rem; flex: 1; }
.timeline-event { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: var(--radius); border-left: 4px solid; cursor: pointer; }
.timeline-event:hover { filter: brightness(0.95); }
.timeline-event.blue   { border-left-color: #3b82f6; background: #eff6ff; }
.timeline-event.orange { border-left-color: #f97316; background: #fff7ed; }
.timeline-event.red    { border-left-color: #ef4444; background: #fef2f2; }
.timeline-event.green  { border-left-color: #22c55e; background: #f0fdf4; }
.timeline-event.teal   { border-left-color: #14b8a6; background: #f0fdfa; }
.timeline-event.purple { border-left-color: #7c3aed; background: #f5f3ff; }
body.dark .timeline-event.blue   { background: rgba(30,64,175,.15); }
body.dark .timeline-event.orange { background: rgba(194,65,12,.15); }
body.dark .timeline-event.red    { background: rgba(220,38,38,.15); }
body.dark .timeline-event.green  { background: rgba(22,163,74,.15); }
body.dark .timeline-event.teal   { background: rgba(13,148,136,.15); }
body.dark .timeline-event.purple { background: rgba(124,58,237,.15); }

.timeline-event-icon { font-size: 1.1rem; }
.timeline-event-content { flex: 1; font-size: .85rem; color: var(--text); }
.timeline-event-content strong { font-weight: 600; }
.timeline-event-desc { display: block; color: var(--text-muted); font-size: .8rem; }
.timeline-event-range { display: inline-block; color: var(--text-muted); font-size: .75rem; margin-left: .25rem; }
.badge-teal { background: #ccfbf1; color: #0d9488; }
.badge-purple { background: #ede9fe; color: #7c3aed; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header { flex-direction: column; align-items: stretch; padding: .5rem 1rem; }
    .header-brand { justify-content: center; }
    .nav { justify-content: center; }
    .nav-btn span { display: none; }
    .nav-btn { padding: .75rem; }
    .main { padding: 1rem; }
    .section-header { flex-direction: column; align-items: stretch; }
    .section-actions { flex-direction: column; }
    .search-input { width: 100%; }
    .dashboard-columns { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .fiche-header { flex-direction: column; }
    .fiche-detail { grid-template-columns: 1fr; }
    .summary-bar { flex-direction: column; gap: .5rem; }
}

/* === CARBURANT / TICPE === */
.carb-stats-section { margin-bottom: 1.5rem; }

.carb-summary-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem; margin-bottom: 1.25rem;
}
.carb-stat-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 1.25rem; box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
}
.carb-stat-card.accent { border-left-color: var(--primary); }
.carb-stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: .25rem; }
.carb-stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.carb-stat-sub { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.carb-stat-sub strong { color: var(--primary); }

.carb-ticpe-table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
.carb-ticpe-table {
    width: 100%; border-collapse: collapse;
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    font-size: .875rem;
}
.carb-ticpe-table thead th {
    background: var(--surface-2); padding: .6rem 1rem;
    text-align: left; font-size: .75rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.carb-ticpe-table tbody td {
    padding: .6rem 1rem; border-bottom: 1px solid var(--border); color: var(--text);
}
.carb-ticpe-table tbody tr:hover { background: var(--surface-2); }
.carb-ticpe-table tbody tr:last-child td { border-bottom: none; }
.row-current-trim { background: var(--primary-light) !important; }
.carb-total-row { background: var(--surface-2) !important; font-weight: 600; }
.carb-edit-taux { font-size: .7rem; padding: .1rem .35rem; margin-left: .35rem; }

.carb-filters {
    display: flex; flex-wrap: wrap; gap: .5rem;
    margin-bottom: 1rem; align-items: center;
}
.carb-filters .filter-select,
.carb-filters input[type="date"] {
    padding: .45rem .75rem; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: .875rem;
    background: var(--surface); color: var(--text);
}

.import-summary { padding: 1rem 1.25rem 0; }
.import-preview-wrap { padding: .75rem 1.25rem 1.25rem; max-height: 50vh; overflow-y: auto; }
.row-muted { opacity: .5; }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.import-conducteur-select { font-size: .8rem; padding: .25rem .5rem; }
