/* METEO - mise en page du site (mêmes couleurs que METEO_UI) */

:root {
    --bleu: #285aa0;
    --fond: #f4f6fa;
    --carte: #ffffff;
    --texte: #1e1e28;
    --discret: #6e6e78;
    --bord: #dcdce4;
    --entete-grille: #e1e6f0;
    --alterne: #f7f8fc;
    --chaud: #c81e1e;
    --froid: #1f77b4;
    --mono: Consolas, "Cascadia Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font: 14px "Segoe UI", system-ui, sans-serif;
    color: var(--texte);
    background: var(--fond);
    display: flex;
    flex-direction: column;
}

/* --- en-tête et menu */
header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 6px 16px;
    background: var(--bleu);
    color: #fff;
}
header .titre { color: #fff; font-size: 19px; font-weight: bold; text-decoration: none; margin-right: 8px; }
header nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
header nav a, header .sortie {
    color: #dce6f5;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
}
header nav a b { color: #fff; }
header nav a:hover, header nav a.actif { background: rgba(255, 255, 255, .18); color: #fff; }
header .sortie { font-size: 13px; }

main { flex: 1; padding: 14px 16px; min-height: 0; }
body.page-pleine main { display: flex; flex-direction: column; }

.message { color: var(--discret); font-size: 15px; }
.erreur { color: var(--chaud); }
.discret { color: var(--discret); }
.intro { margin: 0 0 10px; color: var(--discret); }
h2 { color: var(--bleu); font-size: 18px; margin: 0 0 10px; }
h3 { color: var(--bleu); font-size: 14px; margin: 14px 0 4px; }

button {
    font: inherit;
    padding: 5px 12px;
    border: 1px solid #b4bccb;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}
button:hover { background: #e1ebfa; }
select, input[type=number] { font: inherit; padding: 4px; }
input.seuil { width: 64px; }

/* --- barre d'outils au-dessus d'un tableau ou d'un graphique */
.barre { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.choix-annee { display: inline-flex; align-items: center; gap: 4px; }
.choix-annee b { margin-right: 4px; }
.choix-annee button { padding: 4px 9px; }
.choix-annee select { font-weight: bold; }
label.case { display: block; cursor: pointer; user-select: none; }
.barre label.case { display: inline-block; }
label.case.retrait { padding-left: 20px; }

/* --- accueil */
.accueil { display: flex; gap: 24px; flex-wrap: wrap; height: 100%; }
.accueil .menu { width: 400px; max-width: 100%; }
.accueil .entree {
    display: block;
    padding: 9px 12px;
    margin-bottom: 2px;
    font-size: 16px;
    color: var(--texte);
    text-decoration: none;
    border-radius: 4px;
}
.accueil .entree b { display: inline-block; width: 34px; color: var(--bleu); }
.accueil .entree:hover { background: #e1ebfa; }
.accueil .droite { flex: 1; min-width: 300px; display: flex; flex-direction: column; }
pre.releve { font: 15px/1.45 var(--mono); margin: 0 0 12px; background: var(--carte); padding: 12px 14px; border: 1px solid var(--bord); border-radius: 4px; }
.courbe-accueil { flex: 1; min-height: 300px; border: 1px solid var(--bord); }

/* --- graphiques avec panneau de réglages à gauche */
.avec-panneau { display: flex; gap: 12px; flex: 1; min-height: 0; }
.panneau { width: 270px; flex: none; overflow-y: auto; }
.panneau .boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 10px 0; }
pre.cadre {
    font: 12.5px/1.35 var(--mono);
    background: var(--carte);
    border: 1px solid var(--bord);
    padding: 6px 8px;
    margin: 8px 0;
    min-height: 3em;
    white-space: pre-wrap;
}
.aide { white-space: pre-line; color: var(--discret); font-size: 12.5px; }
.zone-graphe { flex: 1; min-width: 0; min-height: 420px; border: 1px solid var(--bord); }

/* --- surfaces SVG et infobulle */
.surface { position: relative; overflow: hidden; background: #fff; }
.surface.nuit { background: #000; }
.surface > svg { display: block; position: absolute; left: 0; top: 0; user-select: none; touch-action: none; }
.zone-graphe svg { cursor: crosshair; }
.bulle {
    display: none;
    position: absolute;
    pointer-events: none;
    background: rgba(255, 255, 250, .94);
    border: 1px solid #9696a0;
    padding: 4px 8px;
    font-size: 12.5px;
    line-height: 1.35;
    white-space: nowrap;
    color: #464650;
    z-index: 2;
}
.bulle b { color: var(--bleu); display: block; margin-bottom: 2px; }
.surface.nuit .bulle { background: rgba(20, 20, 30, .94); border-color: #ffff55; color: #aaa; }
.surface.nuit .bulle b { color: #ff5555; }

/* --- tableaux */
table.grille { border-collapse: collapse; font: 13.5px var(--mono); background: var(--carte); }
.grille th, .grille td { padding: 3px 8px; border: 1px solid var(--bord); white-space: nowrap; }
.grille th { font: bold 13px "Segoe UI", system-ui, sans-serif; background: var(--entete-grille); text-align: left; position: sticky; top: 0; z-index: 1; }
.grille .d { text-align: right; }
.grille tbody tr:nth-child(even) { background: var(--alterne); }
.grille tbody tr:hover { background: #e1ebfa; }
.grille td.chaud { color: var(--chaud); }
.grille td.froid { color: var(--froid); }
.grille tr.total td { font-weight: bold; color: #b41e1e; background: #fff5e6; }
.grille tr.en-cours td { color: var(--bleu); }
.table-defile { overflow: auto; max-height: calc(100vh - 170px); }

/* F : table des mois, rose et histogramme */
.table-mois { overflow-x: auto; margin-bottom: 12px; }
.graphes-mois { display: flex; gap: 12px; flex-wrap: wrap; }
.graphes-mois .rose { width: 360px; height: 340px; border: 1px solid var(--bord); }
.graphes-mois .histo { flex: 1; min-width: 320px; height: 340px; border: 1px solid var(--bord); }

/* P et B : tableau à gauche, graphique à droite */
.cote-a-cote { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.cote-a-cote > .histo { flex: 1; min-width: 320px; height: 460px; border: 1px solid var(--bord); }
.cote-a-cote.bilan .droite { flex: 1; min-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.cote-a-cote.bilan .histo { height: 330px; border: 1px solid var(--bord); }
pre.records { font: 13px/1.4 var(--mono); background: var(--carte); border: 1px solid var(--bord); padding: 10px 12px; margin: 0; }

/* L : couleurs des colonnes (fixées par meteo.js : jour, ou couleurs EGA de l'original) */
.liste { max-height: calc(100vh - 190px); }
.liste table.nuit { background: #000; }
.liste table.nuit tbody tr:nth-child(even) { background: #0e0e18; }
.liste table.nuit td { border-color: #28283c; }
.liste td.c0 { color: var(--c0); } .liste td.c1 { color: var(--c1); } .liste td.c2 { color: var(--c2); }
.liste td.c3 { color: var(--c3); } .liste td.c4 { color: var(--c4); } .liste td.c5 { color: var(--c5); }
.liste td.c6 { color: var(--c6); } .liste td.c7 { color: var(--c7); } .liste td.c8 { color: var(--c8); }
.liste td.c9 { color: var(--c9); } .liste td.c10 { color: var(--c10); } .liste td.c11 { color: var(--c11); }
.liste td.c12 { color: var(--c12); } .liste td.c13 { color: var(--c13); }

/* N : notes */
pre.notes { font: 14px/1.45 var(--mono); background: var(--carte); border: 1px solid var(--bord); padding: 12px 14px; white-space: pre-wrap; margin: 0; }

/* S : état des données */
.etat td.complet { background: #dff3df; }
.etat td.partiel { background: #fdecc8; }
.etat td.absent { background: #f1f1f4; }
.journal { max-height: 320px; }

/* connexion */
main.connexion { display: flex; justify-content: center; align-items: flex-start; }
main.connexion form { background: var(--carte); border: 1px solid var(--bord); padding: 20px 24px; margin-top: 60px; display: flex; flex-direction: column; gap: 12px; }
main.connexion input { font: inherit; padding: 6px; margin-left: 6px; }

/* écrans étroits : panneau au-dessus du graphique */
@media (max-width: 760px) {
    main { padding: 10px; }
    .avec-panneau { flex-direction: column; }
    .panneau { width: 100%; }
    .zone-graphe { min-height: 480px; }
    .graphes-mois .rose { width: 100%; }
}
