/* Q3E Surface Isol. · app.css · © Q3E */
:root {
  --bordeaux: #7b1e2b; --noir: #1a1a1a; --jaune: #fff2cc; --jaune-b: #e6c84a; --bleu: #ddebf7; --bleu-b: #2a78d6; --vert: #e2efda; --vert-b: #2e7d32;
  --rouge: #c00000; --rouge-f: #fde8e8; --gris: #f4f4f2; --gris-b: #d0d0cc; --texte: #1a1a1a; --sombre: #595959; --fond: #ffffff;
  --rayon: 10px; --tap: 48px; --ombre: 0 1px 3px rgba(0,0,0,.18);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--gris); color: var(--texte); font-family: Arial, Roboto, "Helvetica Neue", sans-serif; font-size: 16px; line-height: 1.3; }
body { min-height: 100vh; display: flex; flex-direction: column; overscroll-behavior-y: contain; }
button { font: inherit; }
header.barre { background: var(--bordeaux); color: #fff; display: flex; align-items: center; gap: 8px; padding: 6px 10px; position: sticky; top: 0; z-index: 20; min-height: 52px; }
header.barre h1 { font-size: 17px; margin: 0; flex: 1; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.barre .badge { font-size: 12px; background: rgba(255,255,255,.18); border-radius: 12px; padding: 2px 8px; }
header.barre button { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; min-width: var(--tap); min-height: 40px; padding: 4px 10px; font-weight: bold; }
header.barre button.rond { border-radius: 50%; width: 40px; min-width: 40px; height: 40px; padding: 0; font-size: 20px; }
main { flex: 1; padding: 10px 10px 140px; max-width: 980px; width: 100%; margin: 0 auto; }
.carte { background: var(--fond); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 12px; margin-bottom: 10px; }
.carte h2 { font-size: 15px; margin: 0 0 8px; color: var(--bordeaux); }
.bande { background: var(--noir); color: #fff; font-weight: bold; padding: 6px 10px; border-radius: 6px; margin: 10px 0 6px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.bande small { font-weight: normal; color: #ddd; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 8px 14px; border-radius: var(--rayon); border: 1px solid var(--gris-b); background: #fff; color: var(--texte); font-weight: bold; cursor: pointer; }
.btn.prim { background: var(--bordeaux); color: #fff; border-color: var(--bordeaux); }
.btn.sec { background: var(--bleu); border-color: var(--bleu-b); color: #0b3a6b; }
.btn.danger { color: var(--rouge); border-color: var(--rouge); }
.btn.large { width: 100%; font-size: 18px; min-height: 64px; }
.btn:disabled { opacity: .45; }
.ligne-btn { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ligne-btn .btn { flex: 1; }
/* choix du mode (accueil) */
.mode-choix { display: grid; gap: 12px; margin-top: 10px; }
.mode-choix .btn.large { flex-direction: column; align-items: flex-start; text-align: left; min-height: 96px; }
.mode-choix .btn.large small { font-weight: normal; color: var(--sombre); }
.mode-choix .btn.prim small { color: #f3dede; }
/* types de toiture */
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type { background: #fff; border: 2px solid var(--gris-b); border-radius: var(--rayon); padding: 8px; min-height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-weight: bold; text-align: center; }
.type svg { width: 110px; height: 56px; }
.type.actif { border-color: var(--bordeaux); background: #fbeeee; }
/* schéma interactif */
.schema { width: 100%; height: auto; background: #fff; border-radius: 8px; border: 1px solid var(--gris-b); touch-action: manipulation; }
.schema .cote { cursor: pointer; }
.schema .cote text { font-size: 11px; font-weight: bold; fill: #0b3a6b; }
.schema .cote.vide text { fill: var(--rouge); }
.schema .cote.focus rect { fill: var(--jaune); stroke: var(--jaune-b); }
.schema .cote rect { fill: #fff; stroke: #c9d6e8; rx: 3; }
.schema .cote.vide rect { stroke: var(--rouge); }
.schema .ligne { stroke: var(--bleu-b); stroke-width: 2.2; fill: none; }
.schema .sol { stroke: #8a6d3b; stroke-width: 2; }
.schema .mur { fill: #f3f3f1; stroke: #777; stroke-width: 1.2; }
.schema .toit { fill: #dbe8f8; stroke: var(--bleu-b); stroke-width: 1.8; }
.schema .pointille { stroke: #888; stroke-dasharray: 4 3; stroke-width: 1; fill: none; }
.schema .dim { stroke: #666; stroke-width: 1; }
.schema .exemple { font-size: 10px; fill: var(--sombre); font-style: italic; }
.schema .station { fill: #d2691e; }
.schema .visee { stroke: #d2691e; stroke-dasharray: 5 3; stroke-width: 1.3; }
/* champs */
.champ { display: grid; grid-template-columns: 1fr 110px 36px; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid #eee; }
.champ:last-child { border-bottom: 0; }
.champ label { font-size: 14px; }
.champ label b { color: var(--bordeaux); }
.champ label small { display: block; color: var(--sombre); font-size: 12px; }
.champ .saisie { display: flex; align-items: center; gap: 4px; }
.champ input, .champ select { width: 100%; min-height: 44px; border: 1.5px solid var(--jaune-b); border-radius: 8px; background: var(--jaune); font: inherit; font-size: 17px; text-align: center; padding: 4px 6px; color: var(--texte); }
.champ input.gris, .champ select.gris { background: var(--gris); border-color: var(--gris-b); color: #999; }
.champ input:focus, .champ select:focus { outline: 3px solid var(--bleu-b); outline-offset: 1px; }
.champ input.erreur { border-color: var(--rouge); background: var(--rouge-f); }
.champ .unite { font-size: 12px; color: var(--sombre); width: 26px; text-align: left; }
.champ .info { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gris-b); background: #fff; color: var(--bleu-b); font-weight: bold; font-size: 15px; }
.champ.ident input { text-align: left; }
.seg { display: inline-flex; border: 1.5px solid var(--jaune-b); border-radius: 8px; overflow: hidden; width: 100%; }
.seg button { flex: 1; min-height: 44px; border: 0; background: var(--jaune); font-size: 13px; padding: 2px 4px; color: var(--texte); }
.seg button.actif { background: var(--bordeaux); color: #fff; }
.seg button + button { border-left: 1px solid var(--jaune-b); }
.champ .seg.large { grid-column: 2 / 4; }
.champ.choix { grid-template-columns: 1fr 146px; }
.champ.choix.select { grid-template-columns: 1fr; }
.champ.choix.select select { text-align: left; font-size: 14px; }
.msg-champ { grid-column: 1 / 4; font-size: 12px; color: var(--rouge); }
/* résultats */
.resultats { position: sticky; bottom: 0; z-index: 15; background: #fff; border-top: 3px solid var(--bordeaux); box-shadow: 0 -2px 8px rgba(0,0,0,.15); padding: 8px 10px; margin: 0 -10px; }
.resultats .principal { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.resultats .principal .val { font-size: 30px; font-weight: bold; color: #0b3a6b; }
.resultats .principal .val.rouge { color: var(--rouge); }
.resultats .principal .lab { font-size: 13px; color: var(--sombre); }
.resultats .etat { font-weight: bold; padding: 4px 10px; border-radius: 14px; font-size: 13px; }
.etat.ok { background: var(--vert); color: var(--vert-b); } .etat.ko { background: var(--rouge-f); color: var(--rouge); } .etat.vide { background: var(--gris); color: var(--sombre); }
.resultats .secondaires { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; margin-top: 4px; }
.resultats .secondaires b { color: #0b3a6b; }
.resultats.alerte .secondaires b { color: var(--rouge); }
.resultats .msg { font-size: 12px; color: var(--rouge); margin-top: 4px; }
.details { background: var(--bleu); border-radius: 8px; padding: 6px 8px; margin-top: 6px; font-size: 13px; max-height: 42vh; overflow: auto; }
.details table { width: 100%; border-collapse: collapse; }
.details td { padding: 3px 4px; vertical-align: top; border-bottom: 1px solid #c9d6e8; }
.details td.v { text-align: right; white-space: nowrap; font-weight: bold; }
.details td.c { color: #1f3864; font-size: 12px; }
.details tr.ctrl td { background: var(--vert); }
.details tr.ctrl.ko td { background: var(--rouge-f); color: var(--rouge); }
/* feuille d'aide */
.feuille { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: none; }
.feuille.ouverte { display: block; }
.feuille .contenu { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: #fff; border-radius: 16px 16px 0 0; padding: 12px 14px 24px; }
.feuille .contenu h2 { color: var(--bordeaux); font-size: 17px; margin: 4px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.feuille img { width: 100%; height: auto; border: 1px solid var(--gris-b); border-radius: 6px; }
.feuille table { width: 100%; border-collapse: collapse; font-size: 13px; }
.feuille td, .feuille th { border-bottom: 1px solid #eee; padding: 4px; text-align: left; vertical-align: top; }
.feuille th { background: var(--gris); }
.feuille .fermer { background: var(--noir); color: #fff; border: 0; border-radius: 8px; min-height: 40px; padding: 4px 12px; }
.feuille .aide-champ { background: var(--jaune); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.feuille .calc { background: var(--bleu); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; color: #1f3864; }
.feuille .onglets { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.feuille .onglets button { flex: 1; min-height: 40px; border-radius: 8px; border: 1px solid var(--gris-b); background: #fff; }
.feuille .onglets button.actif { background: var(--bordeaux); color: #fff; border-color: var(--bordeaux); }
/* pavé Q3E */
.pave { position: fixed; left: 0; right: 0; bottom: 0; background: #e9e9e6; border-top: 1px solid #bbb; padding: 6px; z-index: 30; display: none; box-shadow: 0 -2px 8px rgba(0,0,0,.2); }
.pave.ouvert { display: block; }
.pave .cible { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 2px 6px 6px; }
.pave .cible b { color: var(--bordeaux); }
.pave .cible .valeur { font-size: 22px; font-weight: bold; background: #fff; border-radius: 6px; padding: 2px 12px; min-width: 110px; text-align: right; border: 1.5px solid var(--jaune-b); }
.pave .touches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 520px; margin: 0 auto; }
.pave button { min-height: 52px; font-size: 22px; font-weight: bold; border-radius: 8px; border: 1px solid #c8c8c4; background: #fff; color: var(--texte); }
.pave button.op { background: #d9d9d6; font-size: 18px; }
.pave button.ok { background: var(--bordeaux); color: #fff; font-size: 17px; }
.pave button.suiv { background: var(--bleu-b); color: #fff; font-size: 17px; }
/* projets */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; min-height: var(--tap); }
.liste li .txt { flex: 1; min-width: 0; }
.liste li .txt small { display: block; color: var(--sombre); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste li .val { font-weight: bold; color: #0b3a6b; white-space: nowrap; }
.liste li .val.rouge { color: var(--rouge); }
.liste li .pastille { width: 12px; height: 12px; border-radius: 50%; background: var(--vert-b); flex: none; }
.liste li .pastille.ko { background: var(--rouge); } .liste li .pastille.vide { background: #bbb; }
.liste li button.ouvrir { flex: 1; text-align: left; background: none; border: 0; padding: 0; min-height: var(--tap); display: flex; align-items: center; gap: 8px; }
.champ-texte { display: grid; grid-template-columns: 1fr; gap: 2px; margin-bottom: 8px; }
.champ-texte label { font-size: 13px; color: var(--sombre); }
.champ-texte input { min-height: 44px; border: 1.5px solid var(--jaune-b); border-radius: 8px; background: var(--jaune); font: inherit; padding: 4px 8px; }
.synth table { width: 100%; border-collapse: collapse; font-size: 13px; }
.synth th { background: var(--noir); color: #fff; padding: 5px 4px; text-align: left; font-weight: bold; }
.synth td { padding: 5px 4px; border-bottom: 1px solid #eee; }
.synth td.n, .synth th.n { text-align: right; white-space: nowrap; }
.synth tr.alerte td { color: var(--rouge); }
.synth tr.total td { font-weight: bold; background: var(--bleu); }
.synth tr.bat td { background: var(--gris); font-weight: bold; }
.cles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.cles div { background: var(--bleu); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.cles div b { display: block; font-size: 18px; color: #0b3a6b; }
.cles div.ctrl { background: var(--vert); } .cles div.ko { background: var(--rouge-f); } .cles div.ko b { color: var(--rouge); }
.graph svg { width: 100%; height: auto; }
.note { font-size: 12px; color: var(--sombre); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; background: var(--noir); color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 14px; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.visible { opacity: .95; }
.apercu { width: 100%; height: auto; border: 1px solid var(--gris-b); border-radius: 6px; margin-top: 8px; }
@media (min-width: 700px) and (orientation: landscape) {
  .element { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .element .colg { position: sticky; top: 62px; }
  .pave .touches { max-width: 640px; }
}
@media print { header.barre, .pave, .resultats, .ligne-btn { display: none !important; } main { padding: 0; } }

/* v0.2 : logo Q3E, bouton X310, aide X310 */
header.barre .logo-barre { height: 30px; width: auto; margin-right: 2px; }
header.barre button.x310 { font-size: 12px; min-width: 44px; padding: 4px 6px; letter-spacing: .5px; }
header.barre button.x310.actif { background: #fff; color: var(--bordeaux); border-color: #fff; }
.accueil-logo { text-align: center; padding: 10px 16px; }
.accueil-logo img { max-width: 260px; width: 70%; height: auto; }
.x310-bandeau { background: #fdf3e3; border: 1px solid #e3c27a; border-radius: 8px; padding: 6px 8px; font-size: 12px; margin-bottom: 6px; }
.champ label small.x310-aide { color: #9a5b00; }
/* v0.2 : en-tête compact sur téléphone (logo + titre + badge + 3 boutons) */
header.barre { gap: 5px; padding: 6px 6px; }
header.barre h1 { font-size: 16px; }
header.barre .logo-barre { height: 24px; }
header.barre button.rond { width: 36px; min-width: 36px; height: 36px; font-size: 18px; }
header.barre button.x310 { font-size: 11px; min-width: 40px; padding: 3px 5px; min-height: 36px; }
header.barre .badge { font-size: 11px; padding: 2px 6px; }
@media (max-width: 380px) { header.barre .logo-barre { display: none; } }
