* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #e7e5e0;
    background: #14100d;
}

#app { display: flex; }
#map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #1a1611; }

/* ---------- timeline ---------- */
#tl-open {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #1c1712;
    color: #ffd9a0;
    border: 1px solid #6b4b1f;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}
#timeline {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: min(680px, calc(100% - 40px));
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(28, 23, 18, 0.94);
    border: 1px solid #4a3a2a;
    border-radius: 10px;
    padding: 8px 12px;
}
#timeline[hidden] { display: none; }
#tl-body { flex: 1; min-width: 0; }
#tl-hist { display: block; width: 100%; height: 34px; }
#tl-range { width: 100%; margin: 2px 0 0; display: block; }
#tl-right { min-width: 128px; text-align: center; }
#tl-label { font-size: 12px; color: #ffd9a0; white-space: nowrap; }
#tl-key { font-size: 9.5px; color: #857b70; white-space: nowrap; margin-top: 2px; }
#tl-key i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: -1px; }
#tl-play, #tl-close {
    background: #241d16;
    color: #e7e5e0;
    border: 1px solid #4a3a2a;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- consignes officielles ---------- */
#consignes details {
    background: #241d16;
    border: 1px solid #372b20;
    border-radius: 8px;
    margin: 6px 0;
    padding: 0;
}
#consignes summary {
    cursor: pointer;
    padding: 8px 10px;
    font-size: 13px;
    color: #e8b04b;
}
#consignes details ul {
    margin: 0;
    padding: 2px 12px 10px 26px;
    font-size: 12.5px;
    color: #bdb4aa;
    line-height: 1.5;
}
#consignes details li { margin: 4px 0; }
#consignes a { color: #e8b04b; }

#panel {
    width: 340px;
    max-width: 90vw;
    height: 100%;
    overflow-y: auto;
    background: #1c1712;
    border-left: 1px solid #372b20;
    padding: 14px 16px 20px;
    z-index: 1000;
}

#panel header h1 { margin: 0 0 2px; font-size: 20px; }
#panel header h1 span { font-size: 13px; font-weight: 500; color: #c8a05a; display: block; }
#status-line { margin: 4px 0 0; font-size: 12px; color: #9b9187; }
#official-links { display: flex; gap: 8px; margin-top: 10px; }
#official-links a {
    flex: 1;
    text-align: center;
    background: #2a2118;
    border: 1px solid #6b4b1f;
    border-radius: 8px;
    padding: 8px 6px;
    color: #ffd9a0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}
#official-links a:hover { background: #3a2d1f; }

#panel h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #c8a05a;
    margin: 18px 0 8px;
    border-bottom: 1px solid #372b20;
    padding-bottom: 4px;
}

#alerts .alert {
    background: #4a1d10;
    border: 1px solid #93372a;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 10px;
    font-size: 12.5px;
}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
    background: #241d16;
    border: 1px solid #372b20;
    border-radius: 8px;
    padding: 8px 10px;
}
.stat b { display: block; font-size: 18px; color: #ff8c42; }
.stat span { font-size: 11px; color: #9b9187; }

.row { display: block; margin: 7px 0; cursor: pointer; }
.row em { font-style: normal; font-size: 11px; color: #9b9187; }
.sub-row { margin: 2px 0 8px 22px; display: flex; gap: 12px; font-size: 12.5px; color: #bdb4aa; }
.sub-row label { cursor: pointer; }
.row-flex { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

select, input[type="date"] {
    background: #241d16;
    color: #e7e5e0;
    border: 1px solid #4a3a2a;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    width: 100%;
}
input[type="range"] { width: 90px; }
.hint { font-size: 11.5px; color: #857b70; margin: 6px 0 0; }

.legend div, .legend label { display: block; margin: 4px 0; font-size: 12.5px; color: #bdb4aa; }
.legend label { cursor: pointer; }
.legend i { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; }
.legend .sq { width: 12px; height: 12px; border-radius: 2px; }
#panel h2 small { text-transform: none; letter-spacing: 0; color: #857b70; font-weight: 400; }

.warning {
    background: #2a2118;
    border: 1px solid #6b4b1f;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.45;
    margin-top: 18px;
}
.warning a { color: #e8b04b; }

#panel footer {
    margin-top: 16px;
    font-size: 10.5px;
    color: #6f665d;
    line-height: 1.5;
}
#data-times { display: block; margin-top: 4px; }

#panel-toggle {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1100;
    background: #1c1712;
    color: #e7e5e0;
    border: 1px solid #4a3a2a;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
}

.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: #241d16;
    color: #e7e5e0;
}
.leaflet-popup-content { font-size: 12.5px; line-height: 1.5; }
.leaflet-popup-content b { color: #ff8c42; }

.snap-tabs { margin: 8px 0 4px; display: flex; gap: 6px; }
.snap-tabs button {
    background: #1c1712;
    color: #bdb4aa;
    border: 1px solid #4a3a2a;
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 11.5px;
    cursor: pointer;
}
.snap-tabs button.on { background: #4a3a2a; color: #ffd9a0; }
img.snap {
    width: 100%;
    border-radius: 6px;
    min-height: 120px;
    background: #14100d;
    display: block;
}
.snap-cap { display: block; font-size: 10.5px; color: #857b70; margin-top: 3px; line-height: 1.35; }

/* ---------- vue avant / après ---------- */
.compare-page #cmp-app { height: 100%; display: flex; flex-direction: column; }
#cmp-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    background: #1c1712;
    border-bottom: 1px solid #372b20;
    flex-wrap: wrap;
}
#cmp-bar h1 { margin: 0; font-size: 16px; }
.cmp-back { color: #e8b04b; text-decoration: none; font-size: 13px; }
#cmp-bar select { width: auto; max-width: 46vw; }
#cmp-bar .hint { margin: 0; }

#cmp-maps { flex: 1; display: flex; min-height: 0; }
.cmp-side { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cmp-side + .cmp-side { border-left: 2px solid #372b20; }
.cmp-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #241d16;
}
.cmp-head input[type="date"] { width: auto; flex: 1; max-width: 170px; }
.cmp-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: 3px 8px; border-radius: 4px; }
.cmp-tag.avant { background: #1d4ed8; color: #dbeafe; }
.cmp-tag.apres { background: #b91c1c; color: #fee2e2; }
.day-btn {
    background: #1c1712;
    color: #bdb4aa;
    border: 1px solid #4a3a2a;
    border-radius: 5px;
    width: 28px;
    height: 28px;
    cursor: pointer;
}
.cmp-chips { padding: 4px 10px 6px; font-size: 11.5px; color: #857b70; background: #241d16; min-height: 18px; }
.cmp-chips .chip {
    background: #1c1712;
    color: #bdb4aa;
    border: 1px solid #4a3a2a;
    border-radius: 10px;
    padding: 2px 8px;
    margin: 0 3px 3px 0;
    font-size: 11px;
    cursor: pointer;
}
.cmp-chips .chip.on { background: #4a3a2a; color: #ffd9a0; }
.cmp-chips .chip.dim { opacity: 0.4; }
.cmp-map { flex: 1; min-height: 0; background: #1a1611; }

.compare-link {
    display: inline-block;
    margin-top: 10px;
    color: #e8b04b;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid #6b4b1f;
    border-radius: 6px;
    padding: 6px 10px;
}

@media (max-width: 820px) {
    #cmp-maps { flex-direction: column; }
    .cmp-side + .cmp-side { border-left: none; border-top: 2px solid #372b20; }
}

@media (max-width: 820px) {
    #panel {
        position: absolute;
        right: 0;
        top: 0;
        transform: translateX(100%);
        transition: transform .2s ease;
        box-shadow: -8px 0 24px rgba(0,0,0,.5);
    }
    #panel.open { transform: translateX(0); }
    #panel-toggle { display: block; }
}
