.map-card {
    border: 1px solid rgba(16, 18, 21, 0.08);
    border-radius: 20px;
    background: linear-gradient(180deg, #fdfdfd 0%, #f4f6f9 100%);
    box-shadow: 0 18px 42px rgba(16, 18, 21, 0.08);
    overflow: hidden;
}

.map-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 1rem 1.15rem 0;
}

.map-card-head h3 {
    margin-bottom: 0.2rem;
    font-size: 1.04rem;
}

.map-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.map-card-actions-advanced {
    align-items: center;
    justify-content: flex-end;
}

.map-layer-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem;
    border: 1px solid rgba(16, 18, 21, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 12px 24px rgba(16, 18, 21, 0.08);
}

.map-layer-button {
    min-height: 30px;
    border: 0;
    border-radius: 999px;
    padding: 0.35rem 0.62rem;
    background: transparent;
    color: var(--color-gray-700, #59616a);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
}

.map-layer-button.is-active {
    background: #111827;
    color: #ffffff;
}

.map-card.is-map-fullscreen {
    position: fixed;
    inset: 14px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
}

.map-card.is-map-fullscreen .gdm-map {
    min-height: 0;
    flex: 1 1 auto;
}

.map-card.is-map-fullscreen .gdm-map-stage {
    min-height: 0;
}

.gdm-map {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.9fr);
    gap: 0;
    min-height: 420px;
}

.map-card-tall .gdm-map {
    min-height: 540px;
}

.map-card-compact .gdm-map {
    min-height: 360px;
}

.mission-map-top .gdm-map {
    min-height: 420px;
}

.gdm-map-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.95rem;
    border-right: 1px solid rgba(16, 18, 21, 0.08);
    background:
        radial-gradient(circle at top left, rgba(182, 31, 38, 0.08), transparent 24%),
        radial-gradient(circle at bottom right, rgba(29, 101, 193, 0.08), transparent 24%),
        linear-gradient(180deg, #eef1f5 0%, #dde3ea 100%);
}

.gdm-map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.gdm-map-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.gdm-map-toolbar-copy {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
    flex: 1 1 240px;
}

.gdm-map-toolbar-copy strong {
    font-size: 0.88rem;
    line-height: 1.2;
}

.map-toolbar-hint {
    color: var(--color-gray-700, #59616a);
    font-size: 0.78rem;
}

.gdm-map-toolbar-status {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.gdm-map-viewport {
    position: relative;
    flex: 1 1 auto;
    min-height: 320px;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    border-radius: 18px;
    border: 1px solid rgba(16, 18, 21, 0.08);
    background:
        radial-gradient(circle at 20% 20%, rgba(182, 31, 38, 0.06), transparent 30%),
        radial-gradient(circle at 80% 80%, rgba(29, 101, 193, 0.06), transparent 26%),
        repeating-linear-gradient(0deg, rgba(16, 18, 21, 0.04) 0, rgba(16, 18, 21, 0.04) 1px, transparent 1px, transparent 64px),
        repeating-linear-gradient(90deg, rgba(16, 18, 21, 0.04) 0, rgba(16, 18, 21, 0.04) 1px, transparent 1px, transparent 64px),
        linear-gradient(180deg, #edf1f5 0%, #dde4eb 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.gdm-map-viewport.is-dragging {
    cursor: grabbing;
}

.gdm-map-base,
.gdm-map-overlay {
    position: absolute;
    inset: 0;
}

.gdm-map-base {
    overflow: hidden;
}

.gdm-map-overlay {
    z-index: 2;
    pointer-events: auto;
}

.gdm-map.is-leaflet-map .gdm-map-overlay {
    display: none;
}

.gdm-map.is-leaflet-map .gdm-map-base {
    overflow: hidden;
}

.gdm-map.is-leaflet-map .leaflet-container {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    background: #e7ebf0;
    outline: none;
}

.gdm-map.is-leaflet-map .leaflet-control-container {
    font-family: var(--font-sans, Inter, system-ui, sans-serif);
}

.gdm-map.is-leaflet-map .leaflet-control-zoom {
    border: 0;
    box-shadow: 0 10px 24px rgba(16, 18, 21, 0.12);
    overflow: hidden;
}

.gdm-map.is-leaflet-map .leaflet-control-zoom a {
    width: 28px;
    height: 28px;
    line-height: 28px;
    color: var(--color-gray-900, #2c3137);
}

.gdm-map.is-leaflet-map .leaflet-popup-content-wrapper,
.gdm-map.is-leaflet-map .leaflet-popup-tip {
    box-shadow: 0 18px 42px rgba(16, 18, 21, 0.14);
}

.gdm-map.is-leaflet-map .leaflet-popup-content {
    margin: 12px 14px;
    font-size: 0.88rem;
}

.gdm-map.is-leaflet-map .leaflet-tooltip {
    border: 0;
    border-radius: 999px;
    background: rgba(16, 18, 21, 0.9);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(16, 18, 21, 0.14);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
}

.gdm-leaflet-marker {
    display: grid;
    place-items: center;
    min-width: 26px;
    min-height: 26px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 24px rgba(16, 18, 21, 0.18);
    position: relative;
    transform: translate(-50%, -50%);
}

.gdm-leaflet-marker.is-selected {
    box-shadow: 0 0 0 4px rgba(182, 31, 38, 0.18), 0 12px 24px rgba(16, 18, 21, 0.22);
}

.gdm-leaflet-marker-point {
    background: var(--marker-color, #1d65c1);
}

.gdm-leaflet-marker-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 0 0 3px var(--marker-color, #1d65c1);
}

.gdm-leaflet-marker-truck {
    width: 34px;
    height: 22px;
    border-radius: 8px;
    background: var(--marker-color, #1f8b4c);
    color: #ffffff;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.vehicle-icon-truck {
    outline: 2px solid rgba(255, 255, 255, 0.72);
    outline-offset: 2px;
}

.vehicle-popup-rich {
    min-width: 220px;
}

.vehicle-popup-rich strong {
    display: block;
    margin-bottom: 0.2rem;
}

.vehicle-popup-rich a {
    color: #b11f24;
    font-weight: 800;
}

.live-map-premium .map-card {
    border-radius: 24px;
}

.live-map-premium .map-stat {
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.live-map-premium .gdm-map-stage {
    min-height: 520px;
}

.map-fullscreen {
    min-height: 0;
}

.gdm-leaflet-marker-truck::before,
.gdm-leaflet-marker-truck::after {
    content: '';
    position: absolute;
    bottom: -4px;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #111215;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.76);
}

.gdm-leaflet-marker-truck::before {
    left: 7px;
}

.gdm-leaflet-marker-truck::after {
    right: 7px;
}

.gdm-leaflet-marker-truck-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(16, 18, 21, 0.88);
    color: #ffffff;
    font-size: 0.68rem;
    white-space: nowrap;
}

.gdm-map-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.gdm-map-tile {
    position: absolute;
    width: 256px;
    height: 256px;
    display: block;
    object-fit: cover;
    user-select: none;
    pointer-events: none;
    filter: saturate(0.92) contrast(1.04);
}

.gdm-map-fallback-note {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 3;
    max-width: calc(100% - 24px);
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(16, 18, 21, 0.78);
    color: #ffffff;
    font-size: 0.8rem;
    line-height: 1.35;
    box-shadow: 0 12px 24px rgba(16, 18, 21, 0.18);
}

.gdm-map-watermark {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--color-gray-700, #59616a);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.gdm-map-marker-group {
    cursor: pointer;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.16s ease, opacity 0.16s ease;
}

.gdm-map-marker-group:hover,
.gdm-map-marker-group:focus-visible,
.gdm-map-marker-group.is-selected {
    transform: scale(1.05);
    outline: none;
}

.gdm-map-marker-ring {
    fill: rgba(255, 255, 255, 0.58);
    stroke: rgba(16, 18, 21, 0.15);
    stroke-width: 1.2;
}

.gdm-map-marker-ring.is-selected {
    stroke: var(--color-red, #b61f26);
    stroke-width: 2.1;
}

.gdm-map-marker {
    stroke: rgba(255, 255, 255, 0.96);
    stroke-width: 2.2;
}

.gdm-map-marker-label {
    fill: #111111;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-anchor: middle;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: 3px;
}

.gdm-map-track {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.95;
}

.gdm-map-track-trajet_prevu {
    stroke: #64748b;
}

.gdm-map-track-trajet_realise {
    stroke: #111827;
}

.gdm-map-sidebar {
    padding: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: linear-gradient(180deg, #fbfcfd 0%, #f1f3f6 100%);
}

.gdm-map-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.gdm-map-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.75rem;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--color-gray-900, #2c3137);
    font-size: 0.84rem;
    line-height: 1.3;
}

.gdm-map-vehicle-body {
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 1.2;
}

.gdm-map-vehicle-cabin {
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 0.8;
}

.gdm-map-vehicle-wheel {
    fill: #101215;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 1;
}

.map-legend-dot {
    width: 0.82rem;
    height: 0.82rem;
    border-radius: 999px;
    border: 1px solid rgba(16, 18, 21, 0.14);
    flex: 0 0 0.82rem;
}

.gdm-map-selection {
    padding: 0.9rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(16, 18, 21, 0.08);
    display: grid;
    gap: 0.35rem;
}

.gdm-map-selection strong {
    line-height: 1.2;
}

.map-definition-list {
    margin-top: 0.45rem;
}

.gdm-map-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    gap: 0.45rem;
    padding: 1rem;
    text-align: center;
    color: var(--color-gray-700, #59616a);
    pointer-events: none;
}

@media (max-width: 1080px) {
    .gdm-map {
        grid-template-columns: 1fr;
    }

    .mission-map-top .gdm-map {
        min-height: 320px;
    }

    .gdm-map-stage {
        min-height: 360px;
        border-right: 0;
        border-bottom: 1px solid rgba(16, 18, 21, 0.08);
    }

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

@media (max-width: 720px) {
    .mission-map-top .gdm-map {
        min-height: 260px;
    }

    .map-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .gdm-map-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .gdm-map-toolbar-status {
        justify-content: flex-start;
    }

    .gdm-map-selection {
        padding: 0.8rem;
    }

    .gdm-map-watermark {
        font-size: 0.68rem;
    }
}

/* Phase 07-A20-I - carte chauffeur lisible mobile/tablette.
   Ce bloc reste dans map.css car ce fichier est charge apres app.css. */
.driver-full-map .map-card-head {
    gap: 0.45rem;
    padding: 0.55rem 0.7rem 0.4rem;
}

.driver-full-map .map-card-head h3 {
    font-size: clamp(0.92rem, 2vw, 1.08rem);
    line-height: 1.15;
}

.driver-full-map .map-card-head p {
    max-width: 68ch;
    font-size: 0.76rem;
    line-height: 1.25;
}

.driver-full-map .map-card-actions {
    gap: 0.4rem;
}

.driver-full-map .map-card-actions .button,
.driver-full-map .gdm-map-toolbar .button {
    min-height: 32px;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    font-size: 0.78rem;
    line-height: 1;
}

.driver-full-map .gdm-map {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
}

.driver-full-map .gdm-map-stage {
    position: relative;
    display: block;
    height: clamp(340px, 45vh, 520px);
    min-height: 0;
    max-height: none;
    padding: 6px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(16, 18, 21, 0.08);
}

.driver-full-map .gdm-map-viewport {
    position: absolute;
    inset: 6px;
    height: auto;
    min-height: 0;
    border-radius: 14px;
}

.driver-full-map .gdm-map-toolbar {
    position: absolute;
    z-index: 6;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    pointer-events: none;
}

.driver-full-map .gdm-map-toolbar-group,
.driver-full-map .gdm-map-toolbar-status {
    pointer-events: auto;
}

.driver-full-map .gdm-map-toolbar-copy {
    display: none;
}

.driver-full-map .gdm-map-toolbar-status {
    max-width: min(48%, 260px);
    justify-content: flex-end;
}

.driver-full-map .gdm-map-toolbar-status .status-chip:not([data-map-state]) {
    display: none;
}

.driver-full-map .gdm-map-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 0.45rem;
    padding: 0.48rem;
}

.driver-full-map .gdm-map-meta {
    display: flex;
    gap: 0.32rem;
    overflow-x: auto;
    padding-bottom: 0.12rem;
    scrollbar-width: thin;
}

.driver-full-map .gdm-map-meta .status-chip {
    flex: 0 0 auto;
    max-width: 100%;
    min-height: 24px;
    padding: 0.24rem 0.54rem;
    font-size: 0.68rem;
    white-space: nowrap;
}

.driver-full-map .gdm-map-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 0.38rem 0.55rem;
    align-content: start;
}

.driver-full-map .map-legend-item {
    min-width: 0;
    font-size: 0.73rem;
    line-height: 1.15;
}

.driver-full-map .map-legend-dot {
    width: 0.68rem;
    height: 0.68rem;
    flex-basis: 0.68rem;
}

.driver-full-map .gdm-map-selection {
    grid-column: 1 / -1;
    max-height: 112px;
    overflow: auto;
    padding: 0.55rem 0.65rem;
    border-radius: 12px;
}

.driver-full-map .gdm-map-watermark,
.driver-full-map .gdm-map-fallback-note {
    max-width: calc(100% - 18px);
    font-size: 0.66rem;
}

@media (max-width: 1024px) {
    .driver-full-map .gdm-map-stage {
        height: clamp(300px, 38vh, 380px);
    }

    .driver-full-map .gdm-map-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .driver-full-map {
        padding: 5px;
    }

    .driver-full-map .map-card-head {
        display: grid;
        gap: 0.35rem;
        padding: 0.48rem 0.55rem 0.35rem;
    }

    .driver-full-map .map-card-head p {
        display: none;
    }

    .driver-full-map .map-card-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .driver-full-map .map-card-actions .button {
        min-height: 32px;
        padding: 0.34rem 0.48rem;
        font-size: 0.72rem;
    }

    .driver-full-map .gdm-map-stage {
        height: clamp(230px, 34vh, 280px);
        padding: 5px;
    }

    .driver-full-map .gdm-map-viewport {
        inset: 5px;
        border-radius: 12px;
    }

    .driver-full-map .gdm-map-toolbar {
        top: 8px;
        left: 8px;
        right: 8px;
    }

    .driver-full-map .gdm-map-toolbar-status,
    .driver-full-map .gdm-map-toolbar [data-map-fit] {
        display: none;
    }

    .driver-full-map .gdm-map-toolbar .button {
        min-height: 30px;
        padding: 0.3rem 0.52rem;
        font-size: 0.68rem;
        box-shadow: 0 8px 16px rgba(16, 18, 21, 0.14);
    }

    .driver-full-map .gdm-map-sidebar {
        gap: 0.38rem;
        padding: 0.42rem;
    }

    .driver-full-map .gdm-map-meta {
        display: none;
    }

    .driver-full-map .gdm-map-legend {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.32rem;
    }

    .driver-full-map .map-legend-item {
        font-size: 0.67rem;
    }

    .driver-full-map .gdm-map-selection {
        display: none;
    }

    .driver-full-map .gdm-map-watermark {
        right: 8px;
        bottom: 8px;
    }

    .driver-full-map .gdm-map-fallback-note {
        left: 8px;
        bottom: 8px;
        padding: 0.34rem 0.5rem;
        line-height: 1.2;
    }
}
