body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.28;
}

/* Robust anti-overlap rules for narrow localization sidebars. */
.localization-family-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
        "header count"
        "description description" !important;
    align-items: start !important;
    column-gap: 6px !important;
}

.localization-family-header {
    grid-area: header !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    padding-right: 0 !important;
}

.localization-family-header .family-title {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
}

.localization-family-header input[type="checkbox"] {
    flex: 0 0 12px !important;
    width: 12px !important;
    height: 12px !important;
    margin: 0 !important;
}

.localization-family-count-badge {
    grid-area: count !important;
    align-self: start !important;
    justify-self: end !important;
    max-width: 34px !important;
    min-width: 20px !important;
    padding: 1px 4px !important;
    font-size: 0.56rem !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

.localization-family-description {
    grid-area: description !important;
    display: block !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.simulator-container .container {
    width: 100%;
    padding: 14px;
}

/* ===================================== 
   SIMULATOR CONTAINER 
===================================== */

.simulator-container {
    --sim-main-offset: 80px;
    --sim-nav-offset: 0px;
    --sim-gap: 8px;
    --sim-sidebar-width: clamp(250px, 18vw, 292px);
    --sim-kpi-width: clamp(260px, 19vw, 318px);
    margin-top: var(--sim-nav-offset);
    padding: 4px 6px 6px;
    height: calc(100dvh - var(--sim-main-offset) - var(--sim-nav-offset));
    min-height: 600px;
    display: flex;
    flex-direction: column;
    background: #eef2f6;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

@media (min-width: 1041px) {
    body:has(.simulator-container) .navbar-brand {
        font-size: 1.42rem;
    }

    body:has(.simulator-container) .navbar-brand img {
        height: 34px;
    }

    body:has(.simulator-container) .nav-link {
        margin: 0 10px;
        padding: 7px 0 !important;
        font-size: 0.86rem;
    }

    body:has(.simulator-container) main {
        height: calc(100dvh - 80px);
        overflow: hidden;
    }
}

body:has(.simulator-container) .footer {
    display: none !important;
}

/* ===================================== 
   PROBLEM SWITCHER 
===================================== */

.problem-switcher {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin: 0 0 10px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.problem-btn {
    min-width: 136px;
    min-height: 34px;
    padding: 0.38rem 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    font-size: 0.88rem;
    transition: background 0.2s, color 0.2s;
}

.problem-btn:focus {
    background: #2d8cf0;
    color: #fff;
    border-color: #2d8cf0;
}

.problem-btn.active {
    background: #6c757d !important;
    color: #fff !important; 
    border-color: #6c757d !important;
}

/* ===================================== 
   RESIZE CONTROLS 
===================================== */

.resize-controls {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.resize-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #eef5fb;
    color: #24608f;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
}

.resize-btn:hover {
    background: #ddebf7;
    color: #174d78;
    box-shadow: 0 1px 4px rgba(30, 80, 120, 0.16);
}

/* ===================================== 
   RESTORE SIDEBAR BUTTON 
===================================== */

.restore-sidebar-btn {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.restore-sidebar-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-50%) translateX(5px);
}

.restore-sidebar-btn.show {
    display: flex;
}

/* ===================================== 
   SIMULATOR LAYOUT PRINCIPAL 
===================================== */

.simulator-layout {
    display: grid;
    grid-template-columns: var(--sim-sidebar-width) minmax(420px, 1fr) var(--sim-kpi-width);
    flex: 1;
    min-height: 0;
    height: 100%;
    gap: var(--sim-gap);
    position: relative;
    width: 100%;
    overflow: hidden;
}

.simulator-layout.sidebar-collapsed {
    grid-template-columns: minmax(420px, 1fr) var(--sim-kpi-width);
}

.simulator-layout.kpis-collapsed {
    grid-template-columns: var(--sim-sidebar-width) minmax(420px, 1fr);
}

.simulator-layout.sidebar-collapsed.kpis-collapsed {
    grid-template-columns: minmax(0, 1fr);
}

/* ===================================== 
   SIDEBAR PANEL 
===================================== */

.sidebar-panel {
    display: flex;
    min-width: 0;
    max-width: none;
    width: auto;
    height: 100%;
    max-height: none;
    position: relative;
    transition: opacity 0.2s ease;
    align-self: stretch;
    overflow: hidden;
}

.sidebar-panel.hidden {
    display: none;
    overflow: hidden;
}

.sidebar-panel.minimized {
    min-width: 60px;
    width: 60px;
}

.sidebar {
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #dce6f1;
    position: relative;
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    max-height: 100%;
    z-index: 10;
}

.sidebar.minimized .sidebar-content,
.sidebar.minimized .sidebar-header h3 {
    display: none;
}

.sidebar.hidden {
    display: none;
}

/* ===================================== 
   SIDEBAR HEADER 
===================================== */

.sidebar-header {
    padding: 0.75rem;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
    border-radius: 6px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-controls {
    display: flex;
    gap: 0.25rem;
}

.sidebar-control-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.sidebar-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-right: 4px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #8fb4da #e9f1f9;
}

.sidebar-content > form > h3,
.sidebar-content > div > h3 {
    margin: 0 0 10px !important;
    font-size: 1.05rem;
    line-height: 1.25;
}

.sidebar-content::-webkit-scrollbar {
    width: 10px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #e9f1f9;
    border-radius: 999px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #9bc0e7 0%, #6f9fd1 100%);
    border-radius: 999px;
    border: 2px solid #e9f1f9;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #87b0dd 0%, #5f8fc6 100%);
}

.sidebar-sticky-action {
    position: sticky;
    bottom: 0;
    z-index: 12;
    margin-top: 16px;
    padding: 12px 0 6px;
    background: linear-gradient(180deg, rgba(248, 249, 250, 0) 0%, rgba(248, 249, 250, 0.92) 28%, rgba(248, 249, 250, 1) 100%);
    backdrop-filter: blur(4px);
}

.sidebar-sticky-action .btn,
.sidebar-sticky-action button {
    box-shadow: 0 6px 18px rgba(30, 136, 229, 0.18);
}

/* ===================================== 
   VERTICAL RESIZER 
===================================== */

.vertical-resizer {
    display: none !important;
}

.vertical-resizer:hover {
    background: rgba(0, 123, 255, 0.3);
}

.resizer-handle {
    color: #6c757d;
    font-size: 0.8rem;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.vertical-resizer:hover .resizer-handle {
    opacity: 1;
    color: #007bff;
}

/* ===================================== 
   MAIN PANEL 
===================================== */

.main-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: white;
    position: relative;
    overflow: hidden;
    border: 1px solid #dce6f1;
    border-radius: 8px;
}

/* ===================================== 
   MAP SECTION 
===================================== */

.map-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.map-content {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: #d7dee5;
    padding: 8px;
    box-sizing: border-box;
}

#map-canvas {
    width: 100%;
    height: 100%;
    border: none;
    min-height: 0;
    border-radius: 4px;
    overflow: hidden;
}

#map-canvas.leaflet-container,
.leaflet-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

/* ===================================== 
   HORIZONTAL RESIZER 
===================================== */

.horizontal-resizer {
    display: none !important;
}

.horizontal-resizer:hover {
    background: rgba(0, 123, 255, 0.3);
}

.horizontal-resizer:hover .resizer-handle {
    opacity: 1;
    color: #007bff;
}

/* ===================================== 
   KPIS SECTION 
===================================== */

.kpis-section {
    background: #f8fafc;
    border: 1px solid #dce6f1;
    border-radius: 8px;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.kpis-section.minimized {
    min-height: 50px;
    flex: 0;
}

.kpis-section.minimized .kpis-content {
    display: none;
}

.kpis-section.hidden {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
}

.export-control-hidden,
#export-routes-btn,
#export-kpis {
    display: none !important;
}

.simulator-layout.kpis-collapsed .kpis-section {
    display: none !important;
}

.kpis-content {
    flex: 1;
    overflow: auto;
    min-height: 0;
    padding: 8px;
}

/* ===================================== 
   SECTION HEADERS 
===================================== */

.section-header {
    padding: 0.45rem 0.55rem;
    background: #f8fafc;
    border-bottom: 1px solid #dce6f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    border-radius: 6px 6px 0 0;
    flex-shrink: 0;
    position: relative;
    gap: 0.5rem;
}

.section-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
}

.section-controls {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    min-width: 0;
}

.section-controls-left {
    justify-content: flex-start;
}

.section-controls-right {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.dynamic-hud {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
    pointer-events: auto;
}

.dynamic-clock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    min-width: 92px;
    border-radius: 6px;
    padding: 0 10px;
    background: #1f2937;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: 0;
}

.dynamic-speed-box {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #d7dde6;
    border-radius: 6px;
    padding: 3px 8px;
}

.dynamic-speed-box label {
    margin: 0;
    font-size: 0.68rem;
    text-transform: uppercase;
    color: #334155;
    letter-spacing: 0;
}

#dynamic-speed-slider {
    width: 100px;
    margin: 0;
}

#dynamic-speed-label {
    min-width: 34px;
    text-align: right;
    font-weight: 700;
    color: #1f7a48;
}

@media (max-width: 1360px) {
    .dynamic-hud {
        position: static;
        transform: none;
        flex: 1 1 auto;
        justify-content: center;
    }

    #dynamic-speed-slider {
        width: 82px;
    }
}

.section-control-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
}

.section-control-btn:hover {
    background: rgba(0, 123, 255, 0.2);
    box-shadow: 0 1px 4px rgba(30, 80, 120, 0.16);
}

/* ===================================== 
   CONSERVATION DES STYLES ORIGINAUX 
===================================== */

/* Conservation de la mise en forme originale des fieldsets */
.sidebar fieldset {
    margin-bottom: 10px;
    border: 1px solid #d7e3ef;
    padding: 10px;
    border-radius: 7px;
    background: white;
}

.sidebar select, 
.sidebar input {
    width: 100%;
    padding: 6px 8px;
    margin-top: 3px;
    box-sizing: border-box;
    font-size: 0.88rem;
}

.sidebar button {
    width: 100%;
    padding: 8px 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.sidebar button:hover {
    background-color: #0056b3;
}

fieldset {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    text-align: left;
}

legend {
    float: none;
    width: auto;
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: bold;
    color: #1e88e5;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 0.88rem;
}

select {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

select:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 5px rgba(30, 136, 229, 0.2);
}

button.btn {
    background-color: #1e88e5;
    color: #fff;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

button.btn:hover {
    background-color: #1565c0;
}

/* ===================================== 
   INDICATORS TABLE 
===================================== */

#indicators-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    background-color: white;
    border: 1px solid #d9e2ec;
    box-shadow: none;
    font-size: 0.78rem;
}

#indicators-table th, 
#indicators-table td {
    border: 1px solid #d9e2ec;
    padding: 6px;
    text-align: center;
    vertical-align: middle;
}

#indicators-table th {
    background-color: #2f5f8e;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: 700;
}

#indicators-table tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

.kpi-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 88px;
    margin-bottom: 8px;
    padding: 12px;
    border: 1px dashed #b8c9dc;
    border-radius: 8px;
    background: #fff;
    color: #52677d;
    font-size: 0.86rem;
    text-align: center;
}

.kpis-section.has-results .kpi-empty-state {
    display: none;
}

#kpis-section:not(.has-results) #indicators-table {
    display: none !important;
}

.dynamic-kpi-board {
    display: grid;
    gap: 10px;
}

.dynamic-kpi-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    background: linear-gradient(135deg, #f8fbff, #e8f1fc);
    border: 1px solid #d5e4f6;
    border-radius: 10px;
    padding: 10px;
}

.dynamic-kpi-summary > div {
    display: grid;
    gap: 2px;
}

.dynamic-kpi-summary .kpi-key {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5c7088;
}

.dynamic-kpi-summary .kpi-val {
    font-size: 1rem;
    font-weight: 700;
    color: #1f334a;
}

.dynamic-vehicle-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.vehicle-kpi-card {
    border: 1px solid #d9e3f0;
    border-left: 4px solid var(--veh-color, #2e7d32);
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.vehicle-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.vehicle-ident {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.vehicle-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--veh-color, #2e7d32);
    flex: 0 0 auto;
}

.vehicle-name {
    font-weight: 800;
    color: #1f334a;
    letter-spacing: 0.5px;
}

.vehicle-status {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-radius: 12px;
    padding: 3px 8px;
    border: 1px solid transparent;
}

.vehicle-status.driving {
    color: #166534;
    background: #e8f6ee;
    border-color: #b8e0c6;
}

.vehicle-status.returning {
    color: #9a3412;
    background: #fff1e7;
    border-color: #f5d1ba;
}

.vehicle-status.paused {
    color: #1d4ed8;
    background: #eaf1ff;
    border-color: #c8d8ff;
}

.vehicle-status.idle {
    color: #334155;
    background: #eef2f7;
    border-color: #d5dde9;
}

.vehicle-progress {
    height: 7px;
    border-radius: 999px;
    background: #e8eef7;
    overflow: hidden;
    margin-bottom: 10px;
}

.vehicle-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--veh-color, #2e7d32), #7ab5ff);
}

.vehicle-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
}

.vehicle-metrics > div {
    display: grid;
    gap: 1px;
}

.vehicle-metrics span {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    color: #6b7e93;
}

.vehicle-metrics strong {
    font-size: 0.9rem;
    color: #22384f;
}

.vehicle-metrics strong.metric-alert {
    color: #b42318;
}

.vehicle-route-stack {
    margin-top: 10px;
    border-top: 1px dashed #d6deea;
    padding-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.route-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.74rem;
    font-weight: 700;
    border: 1px solid #d5deea;
    color: #334155;
    background: #f8fafc;
}

.route-pill.visited {
    background: #e8f6ee;
    border-color: #b8e0c6;
    color: #166534;
}

.route-pill.pending {
    background: #fff4e8;
    border-color: #f3d5b6;
    color: #9a3412;
}

.route-pill.empty {
    background: #f4f6fa;
    color: #64748b;
}

/* ===================================== 
   LOADING OVERLAY 
===================================== */

#loading-overlay {
    position: absolute;
    inset: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    border-radius: 6px;
    backdrop-filter: blur(1px);
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-message {
    color: white;
    font-size: 18px;
    margin-top: 10px;
    text-align: center;
}

.loading-progress {
    width: min(320px, 72%);
    height: 10px;
    margin-top: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.loading-progress-bar {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #4dabf7 0%, #74c0fc 100%);
    transition: width 0.25s ease;
}

/* ===================================== 
   STYLES POUR SCRIPTS PERSONNALISÉS 
===================================== */

#custom-script-section {
    margin-top: 15px;
    padding: 10px;
    border: 1px dashed #ccc;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.custom-script-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.custom-script-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    height: auto;
}

#custom-script {
    display: block;
    margin-top: 5px;
}

.sidebar .custom-script-info-toggle,
.sidebar .excel-import-info-toggle {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent !important;
    color: #59c7ff;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease, text-shadow 0.2s ease;
    box-shadow: none;
}

.sidebar .custom-script-info-toggle:hover,
.sidebar .custom-script-info-toggle:focus,
.sidebar .excel-import-info-toggle:hover,
.sidebar .excel-import-info-toggle:focus {
    color: #1eaef2;
    text-shadow: 0 0 8px rgba(89, 199, 255, 0.35);
    transform: translateY(-1px);
}

.custom-script-info-toggle i {
    font-size: 0.9rem;
}

.custom-script-info-card {
    margin: 10px 0 12px;
    padding: 12px 14px;
    border: 1px solid #d8e3f3;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.custom-script-info-title {
    margin-bottom: 8px;
    color: #234463;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.custom-script-info-list {
    margin: 0 0 12px 18px;
    padding: 0;
    color: #42566f;
    font-size: 0.86rem;
    line-height: 1.5;
}

.custom-script-info-list li {
    margin-bottom: 5px;
}

.custom-script-info-list code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #eaf1fb;
    color: #1f4f85;
    font-size: 0.82rem;
}

.custom-script-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    background: #2d86da;
    color: #fff;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.custom-script-download-btn:hover,
.custom-script-download-btn:focus {
    background: #1f6eb8;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.excel-import-header {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin-bottom: 4px;
    width: auto;
}

.excel-import-label {
    display: inline-flex;
    align-items: center;
    width: auto;
    flex: 0 0 auto;
    margin-bottom: 0;
}

.excel-import-info-toggle i {
    font-size: 0.9rem;
}

.custom-script-text-label {
    flex: 1 1 auto;
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

#custom-script-method-checkbox {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0 0 0 6px;
}

.excel-import-info-card {
    margin: 10px 0 12px;
    padding: 12px 14px;
    border: 1px solid #d8e3f3;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
}

.excel-import-info-title {
    margin-bottom: 10px;
    color: #234463;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.excel-import-info-block {
    margin-bottom: 8px;
    color: #42566f;
    font-size: 0.86rem;
    line-height: 1.45;
}

.excel-import-info-block code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #eaf1fb;
    color: #1f4f85;
    font-size: 0.82rem;
}

.excel-import-info-note {
    margin: 8px 0 12px;
    color: #54677e;
    font-size: 0.82rem;
    line-height: 1.45;
}

.excel-import-info-note code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #eaf1fb;
    color: #1f4f85;
    font-size: 0.82rem;
}

.localization-section {
    display: block;
}

.localization-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
}

.localization-title-row h3 {
    margin: 0 0 8px !important;
    font-size: 1rem !important;
    line-height: 1.12;
}

#crowd-block > h3 {
    margin: 0 0 8px !important;
    font-size: 1rem !important;
    line-height: 1.12;
}

.localization-intro-card {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid #d5e4f6;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff 0%, #edf4ff 100%);
}

.localization-intro-card p {
    margin: 8px 0 0;
    color: #45596f;
    font-size: 0.9rem;
    line-height: 1.5;
}

.localization-intro-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #1e88e5;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.localization-option-list,
.localization-family-list {
    display: grid;
    gap: 10px;
}

.localization-option-card,
.localization-family-card {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid #d6e3f4;
    border-radius: 10px;
    background: #fff;
}

.localization-option-card {
    position: relative;
    padding-left: 42px;
}

.localization-option-card input[type="radio"] {
    position: absolute;
    top: 15px;
    left: 14px;
}

.localization-option-card.active {
    border-color: #8dc2f5;
    background: linear-gradient(180deg, #ffffff 0%, #f1f8ff 100%);
}

.localization-option-title,
.family-title {
    font-weight: 700;
    color: #1f334a;
}

.localization-option-title,
.crowd-method-title {
    min-width: 0;
}

.localization-option-card small,
.localization-family-card small {
    color: #617286;
    line-height: 1.4;
}

.localization-family-description {
    grid-area: description;
    display: block;
    margin-top: 2px;
}

.localization-family-card {
    position: relative;
    padding-left: 14px;
    padding-right: 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "header count"
        "description description";
    align-items: start;
    column-gap: 6px;
}

.localization-family-header {
    grid-area: header;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14px;
    align-items: center;
    column-gap: 6px;
    padding-right: 0;
}

.localization-family-card input[type="checkbox"] {
    margin: 0;
    justify-self: end;
}

.family-title {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: auto;
}

.localization-family-count-badge {
    grid-area: count;
    position: static;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8f1fb;
    color: #1e5fa8;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
    justify-self: end;
}

.localization-family-header input[type="checkbox"] {
    justify-self: end;
}

.localization-parameter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.localization-weight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.localization-weight-item label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.88rem;
}

.localization-method-summary {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px dashed #c7d7ee;
    border-radius: 10px;
    background: #f8fbff;
    color: #45596f;
}

/* ===================================== 
   CONTENEUR DES MÉTHODES 
===================================== */

.dvrp-methods-section {
    border: 1px solid #c7d7ee;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
}

.dynamic-vehicle-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #c9d7ea;
}

.dynamic-vehicle-controls label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #42566f;
    margin-bottom: 6px;
}

.dynamic-vehicle-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dynamic-vehicle-controls-row input[type="number"] {
    flex: 1 1 auto;
    min-width: 80px;
}

.dynamic-vehicle-controls-row button {
    flex: 0 0 auto;
    width: auto;
    min-width: 92px;
    padding: 8px 12px;
}

#dynamic-sidebar-kpi-section {
    border: 1px solid #c7d7ee;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
    display: flex;
    flex-direction: column;
}

.dynamic-sidebar-kpi-board {
    display: block;
    max-height: min(52vh, 560px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.dynamic-sidebar-kpi-board .dynamic-vehicle-cards {
    grid-template-columns: 1fr;
    gap: 8px;
}

.dynamic-sidebar-kpi-board .vehicle-kpi-card {
    margin-bottom: 0;
}

.dynamic-sidebar-kpi-board .vehicle-route-stack {
    max-height: 92px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dvrp-methods-hint {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: #435466;
    line-height: 1.4;
}

.dvrp-methods-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.dynamic-time-window-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.dynamic-time-window-grid .form-group {
    margin-bottom: 0;
}

.dynamic-time-window-grid input[type="time"] {
    width: 100%;
}

.static-kpi-summary {
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid #d7e4f3;
    border-radius: 8px;
    background: #f8fbff;
    color: #28435f;
    font-size: 0.8rem;
}

/* Resultat conserve mais plus en accord avec les parametres de methode saisis. */
.kpi-stale-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid #f0c36d;
    border-left: 4px solid #d98e04;
    border-radius: 8px;
    background: #fff8e6;
    color: #6b4a00;
    font-size: 0.8rem;
}

.kpi-stale-notice[hidden] {
    display: none;
}

/* Resultat trop volumineux pour le navigateur : seuls les KPIs ont ete conserves. */
.kpi-map-missing-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid #b6d4f2;
    border-left: 4px solid #1565c0;
    border-radius: 8px;
    background: #eef6ff;
    color: #0d3c73;
    font-size: 0.8rem;
}

.kpi-map-missing-notice[hidden] {
    display: none;
}

.kpi-map-missing-notice i {
    margin-top: 2px;
    color: #1565c0;
}

.kpi-stale-notice i {
    margin-top: 2px;
    color: #d98e04;
}

.dvrp-method-option {
    display: grid;
    grid-template-columns: 20px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 2px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid #d2dff1;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.dvrp-method-option:hover {
    border-color: #83addc;
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.12);
    transform: translateY(-1px);
}

.dvrp-method-option input[type="radio"] {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin-top: 2px;
    width: 16px;
    height: 16px;
}

.dvrp-method-title {
    grid-column: 2;
    grid-row: 1;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1f3b57;
}

.dvrp-method-desc {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.82rem;
    color: #5b6e83;
    line-height: 1.35;
}

.dvrp-method-option:has(input[type="radio"]:checked) {
    border-color: #2f80d1;
    background: #eef7ff;
    box-shadow: 0 0 0 2px rgba(47, 128, 209, 0.15);
}
.method-container {
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid #d9e2ec;
    border-radius: 7px;
    background-color: #f9f9f9;
    transition: background-color 0.3s ease;
}

.method-container:hover {
    background-color: #f1f1f1;
}

.method-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    gap: 10px;
    margin-bottom: 0;
    padding: 0;
}

.method-label span {
    flex: 1 1 auto;
    text-align: left;
    display: block;
    min-width: 0;
    min-height: 18px;
    height: auto;
    font-size: 0.86rem;
    line-height: 1.2;
}

.method-label input[type="checkbox"] {
    flex: 0 0 auto;
    margin-left: 10px;
    margin-right: 0;
    align-self: right;
    width: 16px;
    height: 16px;
    margin-bottom: 1px;
}

.method-parameters {
    margin-top: 8px;
    padding: 8px;
    border-left: 3px solid #007bff;
    background-color: #f9f9f9;
    border-radius: 5px;
    display: none;
}

.method-parameters label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
}

.method-parameters input {
    width: 100%;
    padding: 5px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    box-sizing: border-box;
}

.method-container.selected {
    border-color: #007bff;
    background-color: #e7f3ff;
}

/* ===================================== 
   ATTRACTEURS 
===================================== */

#attractors-list {
    display: grid;
    margin-top: 10px;
    padding: 10px;
    background: #f5faff;
    border: 1px solid #b3d8fd;
    border-radius: 6px;
    grid-template-columns: 1fr;
    gap: 8px;
}

#attractors-list label {
    display: flex;
    background: #eaf4fb;
    border-radius: 4px;
    padding: 8px 10px;
    align-items: center;
    font-size: 15px;
    cursor: pointer;
    border: 1px solid #d0e6f7;
    transition: background 0.2s, border 0.2s;
    box-sizing: border-box;
    min-width: 0;
}

#attractors-list label span {
    flex: 1 1 auto;
    text-align: left;
    margin: 0 10px;
}

#attractors-list input[type="checkbox"] {
    margin-left: 0;
    width: 18px;
    height: 18px;
}

.attractor-count-badge {
    min-width: 32px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f4d8b;
    background: #dceeff;
    border: 1px solid #b7d8fa;
    border-radius: 999px;
    padding: 2px 8px;
    line-height: 1.2;
}

.inline-group {
    margin-top: 8px;
}

/* ===================================== 
   BOUTON EXPORT ROUTES 
===================================== */

/*#export-routes-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #2d8cf0;
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 12px 28px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px #2d8cf033;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    margin: 18px 0 10px 0;
}

#export-routes-btn:hover, 
#export-routes-btn:focus {
    background: #1766b3;
    box-shadow: 0 4px 16px #2d8cf055;
    transform: translateY(-2px) scale(1.03);
    outline: none;
}

#export-routes-btn:active {
    background: #14508a;
    transform: scale(0.98);
}

#export-routes-btn .fa {
    font-size: 1.2em;
    margin-right: 6px;
}
    */

/* ===================================== 
   ÉTATS SPÉCIAUX 
===================================== */

.main-panel.fullscreen-map .map-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: white;
    border-radius: 0;
}

.main-panel.fullscreen-map .kpis-section,
.main-panel.fullscreen-map .horizontal-resizer {
    display: none;
}

.simulator-layout.fullscreen-map-active .sidebar-panel,
.simulator-layout.fullscreen-map-active .kpis-section {
    display: none;
}

.fullscreen-exit-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.fullscreen-exit-btn:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* =====================================
   DESKTOP DENSITY PASS
===================================== */

@media (min-width: 1041px) {
    .problem-switcher {
        gap: 0.45rem;
        margin-bottom: 6px;
    }

    .problem-btn {
        min-width: 118px;
        min-height: 30px;
        padding: 0.28rem 0.7rem;
        border-radius: 6px;
        font-size: 0.8rem;
    }

    .sidebar {
        padding: 8px;
        border-radius: 6px;
    }

    .sidebar-content {
        padding-right: 3px;
    }

    .sidebar-content > form > h3,
    .sidebar-content > div > h3 {
        margin: 0 0 7px !important;
        font-size: 0.92rem;
        line-height: 1.18;
    }

    .sidebar fieldset,
    fieldset {
        padding: 7px 8px;
        margin-bottom: 7px;
        border-radius: 6px;
    }

    legend {
        margin-bottom: 4px;
        font-size: 0.82rem;
        line-height: 1.2;
    }

    label {
        margin-bottom: 3px;
        font-size: 0.8rem;
        line-height: 1.25;
    }

    .sidebar select,
    .sidebar input,
    .form-control {
        min-height: 28px;
        padding: 5px 7px;
        font-size: 0.8rem;
    }

    select {
        padding: 7px;
        margin-bottom: 8px;
        font-size: 0.8rem;
    }

    .form-group {
        margin-bottom: 8px;
    }

    button.btn,
    .sidebar button {
        padding: 6px 9px;
        border-radius: 5px;
        font-size: 0.82rem;
    }

    .section-header {
        min-height: 36px;
        padding: 0.3rem 0.42rem;
    }

    .section-header h3 {
        font-size: 0.82rem;
    }

    .section-control-btn,
    .resize-btn {
        width: 28px;
        height: 28px;
        border-radius: 5px;
        font-size: 0.74rem;
    }

    .map-content,
    .kpis-content {
        padding: 6px;
    }

    .dynamic-hud {
        gap: 6px;
    }

    .dynamic-clock {
        min-width: 82px;
        height: 26px;
        padding: 0 8px;
        font-size: 0.8rem;
    }

    .dynamic-speed-box {
        gap: 5px;
        padding: 2px 6px;
    }

    .dynamic-speed-box label {
        font-size: 0.62rem;
    }

    #dynamic-speed-slider {
        width: 82px;
    }

    .problem-types-container {
        gap: 0.35rem;
        margin-top: 0.35rem;
        margin-bottom: 0.4rem;
    }

    .problem-type-label {
        min-height: 50px;
        padding: 0.42rem 0.35rem;
        border-radius: 6px;
    }

    .problem-icon {
        margin-bottom: 0.15rem;
        font-size: 1rem;
    }

    .problem-name {
        font-size: 0.7rem;
    }

    .method-container {
        margin-bottom: 6px;
        padding: 6px;
        border-radius: 6px;
    }

    .method-label {
        gap: 8px;
    }

    .method-label span {
        min-height: 16px;
        font-size: 0.8rem;
        line-height: 1.15;
    }

    .method-label input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    .method-parameters {
        margin-top: 6px;
        padding: 6px;
    }

    .method-parameters label {
        margin-bottom: 3px;
        font-size: 0.78rem;
    }

    .method-parameters input {
        padding: 4px 6px;
        margin-bottom: 6px;
        font-size: 0.8rem;
    }

    .dvrp-methods-grid,
    .crowd-method-list {
        gap: 7px;
    }

    .dvrp-method-option {
        grid-template-columns: 18px 1fr;
        column-gap: 8px;
        padding: 7px 9px;
        border-radius: 6px;
    }

    .dvrp-method-title {
        font-size: 0.82rem;
    }

    .dvrp-method-desc {
        font-size: 0.75rem;
    }

    .dynamic-time-window-grid,
    .crowd-method-params-grid,
    .localization-parameter-grid,
    .localization-weight-grid {
        gap: 8px;
        margin-top: 8px;
    }

    .dynamic-vehicle-controls {
        padding: 8px;
        margin-top: 8px;
    }

    .dynamic-vehicle-controls-row {
        gap: 6px;
    }

    .dynamic-vehicle-controls-row button {
        min-width: 80px;
        padding: 6px 9px;
    }

    .crowd-form-block {
        margin-bottom: 8px;
        padding: 8px;
        border-radius: 7px;
    }

    .crowd-form-subtitle {
        margin-bottom: 6px;
        font-size: 0.66rem;
    }

    .crowd-method-card {
        padding: 8px 10px 8px 34px;
        border-radius: 7px;
    }

    .crowd-method-card input[type="checkbox"] {
        top: 11px;
        left: 11px;
    }

    .localization-family-card {
        padding: 8px 10px;
        border-radius: 7px;
    }

    #indicators-table {
        margin: 6px 0;
        font-size: 0.7rem;
    }

    #indicators-table th,
    #indicators-table td {
        padding: 4px 5px;
    }

    .kpi-empty-state {
        min-height: 64px;
        padding: 9px;
        border-radius: 6px;
        font-size: 0.8rem;
    }

    .static-kpi-summary {
        padding: 6px 8px;
        margin-bottom: 6px;
        border-radius: 6px;
        font-size: 0.76rem;
    }

    .dynamic-kpi-board,
    .dynamic-vehicle-cards {
        gap: 7px;
    }

    .dynamic-kpi-summary {
        gap: 6px;
        padding: 7px;
        border-radius: 7px;
    }

    .dynamic-kpi-summary .kpi-key {
        font-size: 0.64rem;
    }

    .dynamic-kpi-summary .kpi-val {
        font-size: 0.88rem;
    }

    .vehicle-kpi-card {
        padding: 7px;
        border-radius: 7px;
    }

    .vehicle-card-head {
        gap: 7px;
        margin-bottom: 6px;
    }

    .vehicle-status {
        padding: 2px 6px;
        font-size: 0.66rem;
    }

    .vehicle-metrics {
        gap: 5px 7px;
    }

    .vehicle-metrics span {
        font-size: 0.64rem;
    }

    .vehicle-metrics strong {
        font-size: 0.82rem;
    }
}

/* ===================================== 
   RESPONSIVE DESIGN 
===================================== */

@media (max-width: 1200px) {
    .simulator-container {
        --sim-sidebar-width: 280px;
        --sim-kpi-width: 296px;
    }
    
    .resize-controls {
        right: 10px;
        padding: 0.3rem;
    }
    
    .resize-btn {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
}

@media (max-width: 960px) {
    .simulator-layout {
        grid-template-columns: var(--sim-sidebar-width) minmax(0, 1fr);
        grid-template-rows: minmax(420px, 1fr) minmax(220px, 32vh);
    }

    .simulator-layout.sidebar-collapsed,
    .simulator-layout.kpis-collapsed,
    .simulator-layout.sidebar-collapsed.kpis-collapsed {
        grid-template-columns: minmax(0, 1fr);
    }

    .simulator-layout.kpis-collapsed,
    .simulator-layout.sidebar-collapsed.kpis-collapsed {
        grid-template-rows: minmax(420px, 1fr);
    }

    .kpis-section {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .simulator-container {
        height: auto;
        min-height: calc(100dvh - var(--sim-nav-offset));
        overflow: visible;
    }

    .simulator-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
        gap: 15px;
    }

    .simulator-layout.sidebar-collapsed,
    .simulator-layout.kpis-collapsed,
    .simulator-layout.sidebar-collapsed.kpis-collapsed {
        grid-template-columns: 1fr;
    }
    
    .sidebar-panel {
        width: 100%;
        max-width: none;
        min-width: 0;
        flex: 0 0 auto;
        max-height: min(60vh, 720px);
    }

    .sidebar-sticky-action {
        padding-bottom: 2px;
    }
    
    .vertical-resizer {
        display: none;
    }
    
    .horizontal-resizer {
        display: none;
    }
    
    .resize-controls {
        position: static;
        justify-content: center;
        margin: 1rem;
        width: auto;
    }
    
    .main-panel {
        min-width: 0;
        height: 56vh;
    }
    
    .map-section {
        min-height: 0;
    }
    
    .kpis-section {
        min-height: 260px;
        height: auto;
    }

    .dynamic-hud {
        position: static;
        transform: none;
        margin-left: auto;
    }

    .dynamic-kpi-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dynamic-vehicle-cards {
        grid-template-columns: 1fr;
    }

    .localization-parameter-grid {
        grid-template-columns: 1fr;
    }

    .localization-weight-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar-header,
    .section-header {
        padding: 0.5rem;
        min-height: 45px;
    }
    
    .sidebar-header h3,
    .section-header h3 {
        font-size: 0.9rem;
    }
    
    .resize-btn {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    
    .sidebar-control-btn,
    .section-control-btn {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
}

/* ===================================== 
   ANIMATIONS ET TRANSITIONS 
===================================== */

.sidebar-panel,
.main-panel,
.map-section,
.kpis-section {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* États de redimensionnement actif */
.resizing {
    user-select: none;
    pointer-events: none;
}

.resizing * {
    pointer-events: none;
}

/* ===================================== 
   FORM GROUPS POUR UNIFORMITÉ 
===================================== */

.form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 5px rgba(30, 136, 229, 0.2);
}

.form-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.crowd-form-block {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #d9e8f7;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(30, 136, 229, 0.08);
}

.crowd-form-subtitle {
    margin-bottom: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #3c5d7c;
}

.crowd-method-list {
    display: grid;
    gap: 10px;
}

.crowd-method-card {
    display: grid;
    align-items: center;
    padding: 12px 14px 12px 42px;
    border: 1px solid #d6e3f4;
    border-radius: 10px;
    background: #fff;
    position: relative;
    cursor: default;
}

.crowd-method-card input[type="checkbox"] {
    position: absolute;
    top: 15px;
    left: 14px;
}

.crowd-method-card.active {
    border-color: #8dc2f5;
    background: linear-gradient(180deg, #ffffff 0%, #f1f8ff 100%);
}

.crowd-method-title {
    font-weight: 700;
    color: #1f334a;
}

@media (max-width: 1040px) {
    .localization-option-card,
    .crowd-method-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 14px;
        align-items: center;
        gap: 6px;
        padding: 7px 9px;
    }

    .localization-option-card input[type="radio"],
    .crowd-method-card input[type="checkbox"] {
        position: static;
        order: 2;
        justify-self: end;
        width: 13px;
        height: 13px;
        margin: 0;
    }

    .localization-option-title,
    .crowd-method-title {
        order: 1;
        overflow-wrap: normal;
        word-break: normal;
        hyphens: auto;
    }

    .localization-map-legend,
    .crowd-map-legend {
        max-width: min(220px, calc(100% - 18px));
        max-height: min(42vh, 330px);
        overflow-y: auto;
        padding: 8px 9px;
        border-radius: 7px;
        scrollbar-width: thin;
    }
}

.crowd-method-params-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.crowd-method-params-grid .form-group {
    margin-bottom: 0;
}

.crowd-method-params-grid .form-control[readonly] {
    background: #f5f8fc;
    color: #3d4f63;
    cursor: default;
}

/* Styles pour les types de problèmes VRP */
.problem-types-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.6rem;
}

.problem-type-option {
    flex: 1;
    min-width: 100px;
}

.problem-type-option input[type="radio"] {
    display: none;
}

.problem-type-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.55rem 0.45rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    text-align: center;
    min-height: 62px;
    justify-content: center;
}

.problem-type-label:hover {
    border-color: #28a745;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
    transform: translateY(-2px);
}

.problem-type-option input[type="radio"]:checked + .problem-type-label {
    border-color: #28a745;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.05));
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.problem-icon {
    font-size: 1.18rem;
    margin-bottom: 0.25rem;
    display: block;
}

.problem-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.2;
}

.problem-type-option input[type="radio"]:checked + .problem-type-label .problem-name {
    color: #28a745;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .problem-types-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .problem-type-option {
        min-width: auto;
    }
    
    .problem-type-label {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        min-height: auto;
        padding: 0.75rem;
    }
    
    .problem-icon {
        margin-bottom: 0;
        margin-right: 0.75rem;
        font-size: 1.25rem;
    }
}

/* Animation pour les petits écrans */
@media (max-width: 480px) {
    .problem-types-container {
        gap: 0.5rem;
    }
    
    .problem-type-label {
        padding: 0.5rem;
    }
    
    .problem-name {
        font-size: 0.8rem;
    }
}

.vrp-dynamic-hidden {
    display: none !important;
}

.localization-map-legend {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 950;
    min-width: 220px;
    max-width: 280px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(6px);
}

.legend-title {
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #12355b;
}

.legend-subtitle {
    margin: 10px 0 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #4a5568;
}

.legend-actions {
    display: flex;
    gap: 8px;
    margin: 0 0 8px;
}

.legend-action-btn {
    flex: 1 1 0;
    padding: 6px 8px;
    border: 1px solid rgba(51, 78, 104, 0.18);
    border-radius: 8px;
    background: #f8fbff;
    color: #27445f;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.legend-action-btn:hover:not(:disabled) {
    background: #eef5fb;
    border-color: rgba(51, 78, 104, 0.3);
}

.legend-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f3f5f7;
    color: #6b7280;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: #22303f;
}

.legend-line,
.legend-candidate,
.legend-attractor,
.legend-bike,
.legend-swatch {
    flex: 0 0 auto;
}

.legend-line {
    width: 28px;
    height: 0;
    border-top: 3px dashed #0d47a1;
    opacity: 0.9;
}

.legend-bike {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #d64a4a;
    color: #ffffff;
    font-size: 0.8rem;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
}

.legend-candidate {
    width: 10px;
    height: 10px;
    border: 1px solid #7b8794;
    border-radius: 999px;
    background: #d5dbe3;
}

.legend-attractor {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.crowd-map-legend {
    min-width: 280px;
    max-width: 320px;
}

.legend-marker {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
}

.legend-marker-depot {
    background: #d64545;
}

.legend-marker-client {
    background: #2d7dd2;
}

.legend-marker-crowd-client {
    background: #7b2cbf;
}

.legend-marker-relay {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border-color: #111111;
    background: linear-gradient(180deg, #ffd54d 0 68%, #2e8b57 68% 100%);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.legend-marker-relay-inactive {
    opacity: 0.55;
    background: linear-gradient(180deg, #ffd54d 0 68%, #6c757d 68% 100%);
}

.legend-crowd-line {
    display: inline-block;
    width: 30px;
    height: 0;
    border-top-width: 4px;
    border-top-style: solid;
    border-radius: 999px;
}

.legend-crowd-line-vehicle {
    border-top-color: #0d47a1;
}

.legend-crowd-line-crowd {
    border-top-color: #7b2cbf;
    border-top-style: dashed;
}

.legend-arr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
}

.legend-arr-item {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 0.76rem;
    color: #2d3748;
}

.legend-arr-btn {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.legend-arr-btn:hover {
    background: rgba(51, 78, 104, 0.08);
}

.legend-arr-btn.active {
    border-color: rgba(51, 78, 104, 0.16);
    background: rgba(51, 78, 104, 0.1);
}

.legend-arr-btn:not(.active) {
    opacity: 0.45;
}

.legend-arr-item span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

@media (max-width: 768px) {
    .localization-map-legend {
        right: 10px;
        bottom: 10px;
        min-width: 190px;
        max-width: 220px;
        padding: 10px 12px;
    }

    .legend-arr-grid {
        grid-template-columns: 1fr;
    }

    .legend-actions {
        flex-direction: column;
    }
}

/* =====================================
   FINAL DESKTOP COMPACT OVERRIDES
===================================== */

@media (min-width: 1041px) {
    body:has(.simulator-container) main {
        margin-top: 58px;
        height: calc(100dvh - 58px);
        overflow: hidden;
    }

    body:has(.simulator-container) .navbar {
        min-height: 54px;
    }

    body:has(.simulator-container) .navbar-brand {
        font-size: 1.22rem;
    }

    body:has(.simulator-container) .navbar-brand img {
        height: 30px;
    }

    body:has(.simulator-container) .nav-link {
        margin: 0 8px;
        padding: 5px 0 !important;
        font-size: 0.78rem;
    }

    .simulator-container {
        --sim-main-offset: 58px;
        --sim-nav-offset: 0px;
        --sim-gap: 8px;
        --sim-sidebar-width: clamp(248px, 17vw, 292px);
        --sim-kpi-width: clamp(258px, 18vw, 316px);
        margin-top: 0;
        padding: 4px 6px 6px;
        height: calc(100dvh - var(--sim-main-offset));
        min-height: 560px;
    }

    .problem-switcher {
        gap: 0.32rem;
        margin: 0;
        padding: 0;
        min-height: 0;
    }

    .problem-btn {
        min-width: 94px;
        min-height: 24px;
        padding: 0.14rem 0.5rem;
        border-radius: 5px;
        font-size: 0.72rem;
        line-height: 1.1;
    }

    .simulator-layout {
        gap: 8px;
    }

    .sidebar,
    .main-panel,
    .kpis-section,
    .map-section {
        border-radius: 6px;
    }

    .sidebar {
        padding: 6px;
    }

    .sidebar-content {
        padding-right: 2px;
    }

    .sidebar-content::-webkit-scrollbar {
        width: 7px;
    }

    .sidebar-content > form > h3,
    .sidebar-content > div > h3 {
        margin: 0 0 5px !important;
        font-size: 0.82rem;
        line-height: 1.1;
    }

    .sidebar fieldset,
    fieldset {
        padding: 5px 6px;
        margin-bottom: 5px;
        border-radius: 5px;
    }

    legend {
        margin-bottom: 3px;
        font-size: 0.74rem;
        line-height: 1.1;
    }

    label {
        margin-bottom: 2px;
        font-size: 0.72rem;
        line-height: 1.18;
    }

    .sidebar select,
    .sidebar input,
    .form-control,
    select {
        min-height: 23px;
        padding: 3px 5px;
        margin-top: 2px;
        margin-bottom: 5px;
        font-size: 0.72rem;
        border-radius: 4px;
    }

    .form-group {
        margin-bottom: 5px;
    }

    button.btn,
    .sidebar button {
        padding: 4px 7px;
        border-radius: 4px;
        font-size: 0.74rem;
        line-height: 1.15;
    }

    .sidebar-sticky-action {
        margin-top: 6px;
        padding: 6px 0 2px;
    }

    .section-header {
        min-height: 28px;
        padding: 0.2rem 0.3rem;
        gap: 0.3rem;
        border-radius: 5px 5px 0 0;
    }

    .section-header h3 {
        font-size: 0.74rem;
    }

    .section-controls {
        gap: 0.18rem;
    }

    .section-control-btn,
    .resize-btn {
        width: 23px;
        height: 23px;
        border-radius: 4px;
        font-size: 0.65rem;
    }

    .map-content,
    .kpis-content {
        padding: 4px;
    }

    .dynamic-hud {
        gap: 4px;
    }

    .dynamic-clock {
        min-width: 70px;
        height: 22px;
        padding: 0 6px;
        border-radius: 4px;
        font-size: 0.7rem;
    }

    .dynamic-speed-box {
        gap: 4px;
        padding: 1px 5px;
        border-radius: 4px;
    }

    .dynamic-speed-box label {
        font-size: 0.54rem;
    }

    #dynamic-speed-slider {
        width: 68px;
    }

    #dynamic-speed-label {
        min-width: 24px;
        font-size: 0.68rem;
    }

    .problem-types-container {
        gap: 0.3rem;
        margin-top: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .problem-type-label {
        min-height: 42px;
        padding: 0.28rem 0.28rem;
        border-width: 1px;
        border-radius: 5px;
    }

    .problem-icon {
        margin-bottom: 0.08rem;
        font-size: 0.88rem;
    }

    .problem-name {
        font-size: 0.64rem;
        line-height: 1.1;
    }

    .method-container {
        margin-bottom: 4px;
        padding: 5px;
        border-radius: 5px;
    }

    .method-label {
        gap: 6px;
    }

    .method-label span {
        min-height: 14px;
        font-size: 0.72rem;
        line-height: 1.1;
    }

    .method-label input[type="checkbox"] {
        width: 12px;
        height: 12px;
    }

    .method-parameters {
        margin-top: 5px;
        padding: 5px;
    }

    .method-parameters label {
        margin-bottom: 2px;
        font-size: 0.7rem;
    }

    .method-parameters input {
        padding: 3px 5px;
        margin-bottom: 4px;
        font-size: 0.72rem;
    }

    .dvrp-methods-grid,
    .crowd-method-list {
        gap: 5px;
    }

    .dvrp-method-option {
        grid-template-columns: 15px 1fr;
        column-gap: 6px;
        padding: 5px 7px;
        border-radius: 5px;
    }

    .dvrp-method-option input[type="radio"] {
        width: 12px;
        height: 12px;
    }

    .dvrp-method-title {
        font-size: 0.72rem;
    }

    .dvrp-method-desc {
        font-size: 0.66rem;
    }

    .dynamic-time-window-grid,
    .crowd-method-params-grid,
    .localization-parameter-grid,
    .localization-weight-grid {
        gap: 5px;
        margin-top: 5px;
    }

    .dynamic-vehicle-controls,
    .crowd-form-block {
        padding: 6px;
        margin-top: 5px;
        margin-bottom: 5px;
        border-radius: 5px;
    }

    .dynamic-vehicle-controls-row {
        gap: 5px;
    }

    .dynamic-vehicle-controls-row button {
        min-width: 68px;
        padding: 4px 6px;
    }

    .crowd-form-subtitle {
        margin-bottom: 4px;
        font-size: 0.58rem;
    }

    .crowd-method-card {
        padding: 6px 8px 6px 28px;
        border-radius: 5px;
    }

    .crowd-method-card input[type="checkbox"] {
        top: 8px;
        left: 9px;
    }

    .localization-family-card {
        padding: 6px 8px;
        border-radius: 5px;
    }

    #indicators-table {
        margin: 4px 0;
        font-size: 0.64rem;
    }

    #indicators-table th,
    #indicators-table td {
        padding: 3px 4px;
    }

    .kpi-empty-state {
        min-height: 50px;
        padding: 7px;
        border-radius: 5px;
        font-size: 0.72rem;
    }

    .static-kpi-summary {
        padding: 5px 6px;
        margin-bottom: 5px;
        border-radius: 5px;
        font-size: 0.68rem;
    }

    .localization-title-row {
        gap: 4px;
        align-items: flex-start;
    }

    .localization-title-row h3 {
        margin: 0 0 4px !important;
        font-size: 0.88rem !important;
        line-height: 1.08;
    }

    .localization-intro-card {
        margin-bottom: 5px;
        padding: 5px 7px;
        border-radius: 5px;
    }

    .localization-intro-card p {
        margin-top: 3px;
        font-size: 0.62rem;
        line-height: 1.14;
    }

    .localization-intro-badge {
        padding: 1px 5px;
        font-size: 0.52rem;
    }

    .localization-option-list,
    .localization-family-list {
        gap: 4px;
    }

    .localization-option-card,
    .localization-family-card {
        min-height: 0;
        border-radius: 5px;
    }

    .localization-option-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 13px;
        align-items: center;
        gap: 5px;
        padding: 5px 7px !important;
    }

    .localization-option-card input[type="radio"] {
        position: static;
        order: 2;
        width: 12px;
        height: 12px;
        justify-self: end;
        margin: 0;
    }

    .localization-option-title,
    .family-title {
        min-width: 0;
        order: 1;
        font-size: 0.66rem;
        line-height: 1.1;
        white-space: normal;
        overflow-wrap: normal;
        word-break: normal;
        hyphens: auto;
    }

    .localization-option-card small,
    .localization-family-card small,
    .localization-family-description {
        font-size: 0.58rem;
        line-height: 1.1;
    }

    .localization-family-card {
        padding: 5px 7px !important;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 4px;
    }

    .localization-family-header {
        grid-template-columns: minmax(0, 1fr) 12px;
        column-gap: 4px;
        padding-right: 0;
    }

    .localization-family-card input[type="checkbox"] {
        width: 12px;
        height: 12px;
        margin: 0;
    }

    .localization-family-count-badge {
        min-width: 20px;
        padding: 1px 4px;
        font-size: 0.58rem;
    }

    .localization-parameter-grid,
    .localization-weight-grid,
    .crowd-method-params-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 5px;
    }

    .localization-weight-item label {
        margin-bottom: 2px;
        font-size: 0.6rem;
        line-height: 1.08;
    }

    .localization-method-summary {
        gap: 4px;
        padding: 5px;
        border-radius: 5px;
        font-size: 0.62rem;
    }

    .crowd-form-block {
        padding: 5px 6px;
        margin-top: 4px;
        margin-bottom: 4px;
    }

    .crowd-method-card {
        grid-template-columns: minmax(0, 1fr) 13px;
        gap: 5px;
        padding: 5px 7px !important;
    }

    .crowd-method-card input[type="checkbox"] {
        position: static;
        order: 2;
        justify-self: end;
        width: 12px;
        height: 12px;
        margin: 0;
    }

    .crowd-method-title {
        min-width: 0;
        order: 1;
        font-size: 0.66rem;
        line-height: 1.1;
        overflow-wrap: normal;
        word-break: normal;
        hyphens: auto;
    }

    .localization-map-legend,
    .crowd-map-legend {
        right: 8px;
        bottom: 8px;
        min-width: 150px;
        max-width: 214px;
        max-height: min(42vh, 330px);
        overflow-y: auto;
        padding: 7px 8px;
        border-radius: 6px;
        box-shadow: 0 5px 14px rgba(15, 23, 42, 0.14);
        scrollbar-width: thin;
    }

    .crowd-map-legend {
        min-width: 164px;
        max-width: 220px;
    }

    .legend-title {
        margin-bottom: 4px;
        font-size: 0.7rem;
        line-height: 1.1;
    }

    .legend-subtitle {
        margin: 5px 0 4px;
        font-size: 0.6rem;
        line-height: 1.1;
    }

    .legend-actions {
        gap: 4px;
        margin-bottom: 4px;
    }

    .legend-action-btn {
        padding: 3px 5px;
        border-radius: 5px;
        font-size: 0.56rem;
        line-height: 1.1;
    }

    .legend-item {
        gap: 5px;
        margin-bottom: 3px;
        font-size: 0.6rem;
        line-height: 1.1;
    }

    .legend-line {
        width: 18px;
        border-top-width: 2px;
    }

    .legend-bike {
        width: 16px;
        height: 16px;
        border-width: 1px;
        font-size: 0.56rem;
    }

    .legend-candidate,
    .legend-attractor {
        width: 7px;
        height: 7px;
    }

    .legend-marker {
        width: 10px;
        height: 10px;
        border-width: 1px;
    }

    .legend-marker-relay {
        width: 11px;
        height: 11px;
        border-radius: 3px;
    }

    .legend-crowd-line {
        width: 20px;
        border-top-width: 2px;
    }

    .legend-arr-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 3px 4px;
    }

    .legend-arr-item {
        gap: 4px;
        font-size: 0.56rem;
        line-height: 1.1;
    }

    .legend-arr-btn {
        padding: 2px 4px;
        border-radius: 5px;
    }

    .legend-swatch {
        width: 8px;
        height: 8px;
        border-radius: 2px;
    }
}

