.hrw-card {
    --hrw-bg: #ffffff;
    --hrw-panel: #f6f7f9;
    --hrw-panel-alt: #eef1f5;
    --hrw-border: #e1e4ea;
    --hrw-text: #1c1f26;
    --hrw-muted: #6b7280;
    --hrw-accent: #1d7fc4;
    width: 100%;
    max-width: 1600px;
    box-sizing: border-box;
    margin: 1.25rem auto;
    overflow: hidden;
    border: 1px solid var(--hrw-border);
    border-radius: 16px;
    background: var(--hrw-bg);
    color: var(--hrw-text);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
    font: 400 15px/1.5 Inter, "Segoe UI", Arial, sans-serif;
}

.hrw-card * {
    box-sizing: border-box;
}

.hrw-card [hidden] {
    display: none !important;
}

.hrw-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--hrw-border);
}

.hrw-kicker {
    margin: 0 0 4px;
    color: var(--hrw-accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.hrw-header h2 {
    margin: 0 0 4px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--hrw-text);
}

.hrw-meta {
    margin: 0;
    color: var(--hrw-muted);
    font-size: .85rem;
}

.hrw-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
}

/* space-between (avant) redistribuait l'espace entre TOUS les enfants dès
   que la largeur de l'un d'eux changeait — les valeurs du résumé national
   changent de longueur selon le jour sélectionné (nombres, noms de
   départements différents), ce qui faisait visiblement « bouger » le bloc
   recherche à côté. Avec flex-start + cette marge, seul ce bloc se
   déplace (plaqué à droite), les autres restent fixes quel que soit son
   contenu. */
.hrw-national-summary {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 10px 14px;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    background: var(--hrw-panel);
    min-width: 190px;
}

.hrw-national-summary-title {
    margin: 0 0 6px;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--hrw-accent);
}

.hrw-national-summary dl {
    margin: 0;
    display: grid;
    row-gap: 3px;
}

.hrw-national-summary dl > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.hrw-national-summary dt {
    font-size: .74rem;
    color: var(--hrw-muted);
    white-space: nowrap;
}

.hrw-national-summary dd {
    margin: 0;
    font-size: .78rem;
    font-weight: 700;
    color: var(--hrw-text);
    text-align: right;
    white-space: nowrap;
}

/* À côté du bloc titre, dans l'en-tête. */
.hrw-search {
    position: relative;
    flex: 1 1 420px;
    max-width: 560px;
}

.hrw-search label {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--hrw-muted);
}

.hrw-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
}

/* Le champ prend toute la largeur de la ligne — le bouton géolocaliser
   passe dessous plutôt que de se partager la place avec lui. */
.hrw-search-control {
    position: relative;
    flex: 1 1 100%;
}

.hrw-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--hrw-muted);
    font-size: 1.1rem;
}

.hrw-city-input {
    width: 100%;
    padding: 13px 14px 13px 40px;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    background: var(--hrw-panel);
    color: var(--hrw-text);
    font-size: 1.05rem;
}

.hrw-city-input:focus {
    outline: 2px solid var(--hrw-accent);
    outline-offset: 1px;
}

.hrw-locate-button {
    flex: 1 1 100%;
    padding: 10px 18px;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    background: var(--hrw-panel-alt);
    color: var(--hrw-text);
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
}

.hrw-locate-button:hover {
    border-color: var(--hrw-accent);
}

.hrw-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    width: 100%;
    max-height: 280px;
    margin-top: 4px;
    overflow-y: auto;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    background: var(--hrw-bg);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}

.hrw-search-result {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    background: none;
    color: var(--hrw-text);
    text-align: left;
    font-size: .88rem;
    cursor: pointer;
}

.hrw-search-result:hover,
.hrw-search-result.is-active {
    background: var(--hrw-panel-alt);
}

.hrw-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--hrw-border);
    background: var(--hrw-panel);
}

.hrw-hazard-tabs,
.hrw-day-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hrw-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--hrw-border);
    border-radius: 999px;
    background: var(--hrw-panel-alt);
    color: var(--hrw-muted);
    font: 700 .8rem/1 Inter, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
    white-space: nowrap;
}

.hrw-tab-icon {
    width: 15px;
    height: 15px;
    flex: none;
}

.hrw-tab:hover {
    color: var(--hrw-text);
    border-color: var(--hrw-accent);
}

.hrw-tab.is-active {
    background: #e3f2fd;
    border-color: var(--hrw-accent);
    color: #0d47a1;
}

/* Onglets de jour (J0/J1/J2) : rouge plutôt que le bleu des onglets
   d'aléa, sur demande explicite. */
.hrw-day-tabs .hrw-tab.is-active {
    background: #e0342c;
    border-color: #e0342c;
    color: #fff;
}

.hrw-body {
    display: grid;
    grid-template-columns: minmax(0, 2.6fr) minmax(220px, 1fr);
    gap: 0;
}

.hrw-map-wrap {
    position: relative;
    padding: 16px;
    border-right: 1px solid var(--hrw-border);
    background: var(--hrw-bg);
}

.hrw-map-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.hrw-map-primary {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.hrw-map {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

.hrw-map path {
    stroke: #33383f;
    stroke-width: 1;
    cursor: pointer;
    transition: filter .12s ease;
    /* Sans ça, un tap sur mobile affiche le rectangle de surbrillance par
       défaut du navigateur (souvent gris/noir foncé), dimensionné sur la
       boîte englobante du <path> plutôt que sa forme réelle — visible
       comme un « gros carré noir » sur un département au tracé irrégulier. */
    -webkit-tap-highlight-color: transparent;
}

.hrw-map path:hover {
    filter: brightness(.94);
}

/* Le clic donne le focus au <path> (role="button" tabindex="0"), et sans
   ça le navigateur dessine son contour de focus par défaut — un rectangle
   noir calé sur la boîte englobante du département plutôt que sa forme
   réelle (constaté en production : visible comme un « gros carré noir »
   entourant le département cliqué). La sélection est déjà indiquée par le
   contour bleu de .is-selected ci-dessous, qui lui suit la vraie forme —
   pas besoin du contour de focus par-dessus, pour la souris/tactile comme
   au clavier (Entrée/Espace passe par le même chemin de sélection). */
.hrw-map path:focus,
.hrw-map path:focus-visible {
    outline: none !important;
}

.hrw-map path.is-selected {
    stroke: var(--hrw-accent);
    stroke-width: 2.4;
}

.hrw-dept-icon-badge {
    fill: #ffffff;
    stroke: #33383f;
    stroke-width: .8;
    pointer-events: none;
}

.hrw-dept-icon {
    pointer-events: none;
    color: #1c1f26;
}

.hrw-map-inset-wrap {
    padding: 8px;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    background: var(--hrw-bg);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .1);
}

/* Colonne commune à la carte Île-de-France et au bloc d'outils
   (capture/copie), qui reste un bloc séparé juste en dessous plutôt que
   d'être inséré dans le cadre de la carte elle-même. */
.hrw-map-inset-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 26%;
    max-width: 210px;
    min-width: 130px;
}

.hrw-inset-map {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

.hrw-inset-map path {
    stroke: #33383f;
    stroke-width: 1.4;
    cursor: pointer;
    transition: filter .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.hrw-inset-map path:hover {
    filter: brightness(.94);
}

.hrw-inset-map path:focus,
.hrw-inset-map path:focus-visible {
    outline: none !important;
}

.hrw-inset-map path.is-selected {
    stroke: var(--hrw-accent);
    stroke-width: 2.8;
}

.hrw-inset-label {
    display: block;
    margin-top: 4px;
    text-align: center;
    font-size: .68rem;
    font-weight: 700;
    color: var(--hrw-muted);
}

.hrw-map-tooltip {
    position: absolute;
    z-index: 30;
    transform: translate(-50%, calc(-100% - 10px));
    padding: 10px 13px;
    border: 1px solid var(--hrw-border);
    border-radius: 9px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
    pointer-events: none;
    max-width: 260px;
}

.hrw-tooltip-title {
    font-size: .86rem;
    font-weight: 800;
    color: var(--hrw-text);
    margin-bottom: 5px;
    white-space: nowrap;
}

.hrw-tooltip-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: .76rem;
    font-weight: 700;
    color: #1c1f26;
    margin-bottom: 7px;
    white-space: nowrap;
}

.hrw-tooltip-frise {
    display: flex;
    height: 16px;
    width: 220px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--hrw-border);
}

.hrw-tooltip-frise span {
    flex: 1 1 0;
    min-width: 1px;
}

.hrw-tooltip-frise-labels {
    position: relative;
    width: 220px;
    height: 14px;
    margin-top: 2px;
}

.hrw-tooltip-frise-tick-abs {
    position: absolute;
    top: 0;
    font-size: .68rem;
    color: var(--hrw-muted);
    white-space: nowrap;
}

.hrw-map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hrw-muted);
    font-size: .85rem;
    pointer-events: none;
}

/* Sous le bloc Capture PNG / Copier la vue, plutôt qu'en incrustation sur
   la carte elle-même. */
.hrw-legend-title {
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    background: var(--hrw-bg);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .1);
    font-size: 1rem;
    font-weight: 800;
    color: var(--hrw-text);
    text-align: center;
}

.hrw-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    font-size: .78rem;
    color: var(--hrw-muted);
}

.hrw-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hrw-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--hrw-border);
}

/* Bloc séparé (bordure/fond propres), juste sous la carte Île-de-France
   dans la même colonne étroite, plutôt qu'en pleine largeur sous les deux
   cartes ou fondu dans le cadre de la carte elle-même. */
.hrw-map-tools {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    background: var(--hrw-bg);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .1);
}

.hrw-map-tools button {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--hrw-border);
    border-radius: 8px;
    background: var(--hrw-panel-alt);
    color: var(--hrw-text);
    font: 700 .72rem/1.2 Inter, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
}

.hrw-map-tools button:hover {
    border-color: var(--hrw-accent);
}

.hrw-detail {
    padding: 12px;
    min-height: 320px;
}

.hrw-detail-placeholder {
    color: var(--hrw-muted);
    font-size: .9rem;
}

.hrw-detail-content h3 {
    margin: 0 0 4px;
    font-size: 1.15rem;
    color: var(--hrw-text);
}

.hrw-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 6px;
    margin: 10px 0;
}

.hrw-hazard-cell {
    padding: 7px;
    border-radius: 8px;
    background: var(--hrw-panel);
    border: 1px solid var(--hrw-border);
    cursor: pointer;
    /* Hauteur FIXE (pas min-height) et contenu tronqué si besoin : le
       nombre d'alertes actives change combien de cellules ont un libellé
       long (« Risque de pluie verglaçante » vs « Nul »), et un simple
       min-height pouvait encore être dépassé — la grille (donc tout le
       panneau) changeait alors de hauteur selon le nombre d'alertes. */
    height: 92px;
    overflow: hidden;
}

.hrw-hazard-cell.is-active {
    border-color: var(--hrw-accent);
}

.hrw-hazard-cell .hrw-hazard-name {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .68rem;
    color: var(--hrw-muted);
    margin-bottom: 3px;
}

.hrw-hazard-cell .hrw-hazard-icon {
    width: 12px;
    height: 12px;
    flex: none;
}

.hrw-hazard-cell .hrw-hazard-level {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1.3;
}

.hrw-hazard-level-sub {
    font-size: .64rem;
    font-weight: 600;
    opacity: .85;
}

.hrw-frise {
    margin-top: 8px;
}

.hrw-frise h4 {
    margin: 0 0 8px;
    font-size: .9rem;
    color: var(--hrw-text);
}

.hrw-frise-track {
    display: flex;
    height: 36px;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid var(--hrw-border);
}

.hrw-frise-hour {
    position: relative;
    flex: 1 1 0;
    min-width: 3px;
}

/* Heure sans données (avant le début du run HARMONIE ce jour-là) : hachures
   grises plutôt qu'une couleur de niveau, pour ne pas se confondre avec un
   vrai « Nul » (vert). */
.hrw-frise-hour-empty {
    background: repeating-linear-gradient(
        45deg,
        #eceff3,
        #eceff3 3px,
        #dde1e8 3px,
        #dde1e8 6px
    );
}

.hrw-frise-labels {
    display: flex;
    margin-top: 4px;
}

.hrw-frise-tick {
    flex: 1 1 0;
    min-width: 3px;
    text-align: center;
    font-size: .68rem;
    color: var(--hrw-muted);
    white-space: nowrap;
}

.hrw-advice {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--hrw-border);
    border-radius: 8px;
    background: var(--hrw-panel);
}

.hrw-advice h4 {
    margin: 0 0 6px;
    font-size: .9rem;
    color: var(--hrw-text);
}

.hrw-advice-subtitle {
    margin: 0 0 4px;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--hrw-accent);
}

.hrw-advice-text {
    margin: 0;
    font-size: .86rem;
    color: var(--hrw-muted);
    line-height: 1.5;
    /* Réserve la place du message + la phrase de vigilance renforcée
       (ajoutée seulement pour les niveaux élevés) : sinon le panneau
       changeait de hauteur selon le département sélectionné. */
    min-height: 4.5em;
}

.hrw-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid var(--hrw-border);
    color: var(--hrw-muted);
    font-size: .74rem;
}

.hrw-footer a {
    color: var(--hrw-accent);
}

.hrw-plugin-version {
    margin-left: auto;
    opacity: .7;
}

.hrw-error {
    padding: 12px 24px;
    color: #c62828;
}

@media (max-width: 860px) {
    /* Sur écran étroit, le résumé national passe seul sur sa propre
       ligne (pleine largeur) plutôt que de rester plaqué à droite avec un
       grand vide à gauche (constaté en production sur petit écran). */
    .hrw-national-summary {
        flex-basis: 100%;
        margin-left: 0;
    }
    .hrw-body {
        grid-template-columns: 1fr;
    }
    .hrw-map-wrap {
        border-right: 0;
        border-bottom: 1px solid var(--hrw-border);
    }
    .hrw-map-inset-column {
        flex-basis: 96px;
        max-width: 96px;
        min-width: 76px;
    }
    .hrw-map-inset-wrap {
        padding: 5px;
    }
    .hrw-inset-label {
        font-size: .6rem;
    }
}
