/* Système visuel « installateur » : orange de la marque, bleu de Prusse, jaune gaz pour ce qui demande attention.
   Barlow (signalétique) pour le texte, Barlow Condensed pour titres et chiffres. */
:root {
  --c1: #e67e22; --c1-dk: #b85f12; --c1-lt: rgba(230,126,34,.14);
  --c2: #12324f;
  --ink: #12324f; --ink-2: #3c5670; --mute: #6b7f93;
  --bg: #e9eef3; --paper: #fff; --steel: #d3dce5; --steel-2: #f3f6f9;
  --gas: #f2c12e; --gas-lt: #fdf3cf; --gas-ink: #6d5300;
  --ok: #138a4e; --ok-lt: #dcf1e5;
  --bad: #c8312a; --bad-lt: #fae1df;
  --blue: #1f63b8; --blue-lt: #e0ebf8;
  --r-lg: 16px; --r: 12px; --r-sm: 8px;
  --f: 'Barlow', system-ui, 'Segoe UI', sans-serif;
  --fc: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); }
body { font-family: var(--f); color: var(--ink); font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gas); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.ico { width: 22px; height: 22px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 18px; height: 18px; }

/* Barre du haut */
.top { position: sticky; top: 0; z-index: 50; background: var(--c2); color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.top-logo { height: 40px; min-width: 40px; max-width: 92px; border-radius: 8px; background: #fff; color: var(--c2); display: flex; align-items: center; justify-content: center; font: 700 18px var(--fc); overflow: hidden; padding: 3px; flex-shrink: 0; }
.top-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.top-title { font: 600 21px/1.1 var(--fc); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.top-btn { background: rgba(255,255,255,.1); border: none; color: #fff; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.top-btn:active { background: rgba(255,255,255,.2); }

/* Navigation */
.main { padding: 18px 16px 104px; max-width: 920px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--paper); border-top: 1px solid var(--steel); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.nav button { flex: 1; position: relative; border: none; background: none; padding: 10px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; font: 600 12px var(--f); color: var(--mute); min-height: 62px; }
.nav button .ico { width: 25px; height: 25px; }
.nav button.on { color: var(--c1-dk); }
.nav button.on::before { content: ''; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--c1); }
@media (min-width: 900px) {
  .nav { top: 64px; bottom: 0; right: auto; width: 224px; flex-direction: column; border-top: none; border-right: 1px solid var(--steel); padding: 14px 10px; gap: 2px; }
  .nav button { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; font-size: 16px; min-height: 0; border-radius: 10px; }
  .nav button.on { background: var(--c1-lt); }
  .nav button.on::before { top: 10px; bottom: 10px; left: -10px; right: auto; width: 4px; height: auto; border-radius: 0 4px 4px 0; }
  .main { margin-left: 224px; padding: 28px 36px 40px; max-width: 1000px; }
  .fab { bottom: 32px !important; right: 32px !important; }
}

.view { display: none; } .view.on { display: block; }
.view.enter { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Typographie */
h1 { font: 700 32px/1.05 var(--fc); letter-spacing: -.01em; margin-bottom: 4px; }
h2 { font: 700 22px/1.15 var(--fc); }
.sub { color: var(--mute); font-size: 15px; }
.sec { font: 700 20px/1.2 var(--fc); color: var(--ink); margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.sec .cnt { font: 600 15px var(--fc); color: var(--mute); }
.sec a, .link { margin-left: auto; color: var(--c1-dk); font: 600 15px var(--f); cursor: pointer; text-decoration: none; }
.muted { color: var(--mute); }
.small { font-size: 14px; }
.strong { font-weight: 600; }
.money, .num { font-family: var(--fc); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

/* Panneaux : listes groupées plutôt que des cartes partout */
.panel { background: var(--paper); border: 1px solid var(--steel); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.panel > .prow + .prow { border-top: 1px solid var(--steel); }
.panel-pad { padding: 14px 16px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 62px; position: relative; background: var(--paper); }
.prow.tap:active { background: var(--steel-2); }
.prow .tag { position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--steel); }
.tag.t-bad { background: var(--bad); } .tag.t-gas { background: var(--gas); } .tag.t-ok { background: var(--ok); } .tag.t-c1 { background: var(--c1); } .tag.t-blue { background: var(--blue); }
.p-title { font-weight: 600; font-size: 16px; }
.p-meta { color: var(--mute); font-size: 14px; }
.chev { color: var(--steel); }
.card { background: var(--paper); border: 1px solid var(--steel); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; }
.tap { cursor: pointer; }
.row { display: flex; align-items: center; gap: 10px; }
.row.top-al { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chiffres clés */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--steel); border: 1px solid var(--steel); border-radius: var(--r); overflow: hidden; margin-top: 14px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--paper); padding: 14px 16px; cursor: pointer; }
.kpi:active { background: var(--steel-2); }
.kpi-n { font: 700 28px/1 var(--fc); font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 14px; color: var(--mute); margin-top: 5px; }
.kpi.k-bad .kpi-n { color: var(--bad); } .kpi.k-ok .kpi-n { color: var(--ok); } .kpi.k-c1 .kpi-n { color: var(--c1-dk); }

/* Boutons */
.btn { border: 1.5px solid var(--steel); border-radius: 10px; padding: 11px 16px; font: 600 16px var(--f); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; background: var(--paper); color: var(--ink); text-decoration: none; transition: transform .08s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-p { background: var(--c1); border-color: var(--c1); color: #fff; }
.btn-d { background: var(--c2); border-color: var(--c2); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-bad { color: var(--bad); border-color: var(--bad-lt); background: var(--paper); }
.btn-gas { background: var(--gas); border-color: var(--gas); color: #3b2d00; }
.btn-sm { min-height: 40px; padding: 7px 12px; font-size: 15px; border-radius: 9px; }
.btn-full { width: 100%; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btns .btn { flex: 1 1 140px; }
.btns .btn-sm { flex: 1 1 100px; }
.icon-btn { width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid var(--steel); background: var(--paper); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.fab { position: fixed; right: 18px; bottom: 82px; z-index: 40; width: 62px; height: 62px; border-radius: 18px; border: none; background: var(--c1); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(18,50,79,.3); }
.fab .ico { width: 30px; height: 30px; stroke-width: 2.4; }
.fab:active { transform: scale(.95); }

/* Étiquettes de statut */
.bdg { display: inline-flex; align-items: center; gap: 5px; font: 600 14px/1 var(--fc); padding: 4px 8px; border-radius: 5px; white-space: nowrap; letter-spacing: .01em; }
.bdg::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-grey { background: var(--steel-2); color: var(--ink-2); }
.b-blue { background: var(--blue-lt); color: var(--blue); }
.b-ok { background: var(--ok-lt); color: var(--ok); }
.b-bad { background: var(--bad-lt); color: var(--bad); }
.b-warn { background: var(--gas-lt); color: var(--gas-ink); }
.b-c1 { background: var(--c1-lt); color: var(--c1-dk); }

/* Filtres et onglets */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; margin: 12px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; border: 1.5px solid var(--steel); background: var(--paper); border-radius: 9px; padding: 8px 13px; font: 600 15px var(--f); color: var(--ink-2); min-height: 40px; }
.chip.on { background: var(--c2); color: #fff; border-color: var(--c2); }
.seg { display: flex; background: var(--steel); border-radius: 12px; padding: 4px; margin: 4px 0 12px; }
.seg button { flex: 1; border: none; background: none; padding: 10px; border-radius: 9px; font: 700 18px var(--fc); color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(18,50,79,.15); }

/* Formulaires */
.fg { margin-bottom: 14px; }
.fl { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.fi { width: 100%; padding: 12px 13px; border: 1.5px solid var(--steel); border-radius: 10px; font-size: 16px; background: var(--paper); outline: none; min-height: 50px; }
.fi:focus { border-color: var(--c1); box-shadow: 0 0 0 3px var(--c1-lt); }
textarea.fi { min-height: 88px; resize: vertical; line-height: 1.45; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .f2 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1.5px solid var(--steel); border-radius: 10px; background: var(--paper); font-size: 15px; cursor: pointer; min-height: 48px; }
.check input { width: 22px; height: 22px; accent-color: var(--c1); flex-shrink: 0; }
.check:has(input:checked) { border-color: var(--c1); background: var(--c1-lt); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 420px) { .checks { grid-template-columns: 1fr; } }

/* Fenêtre du bas */
.mo { position: fixed; inset: 0; z-index: 200; background: rgba(9,26,43,.55); display: none; align-items: flex-end; justify-content: center; }
.mo.on { display: flex; }
.mo-box { background: var(--paper); width: 100%; max-width: 580px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .22s ease-out; }
.mo-box::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--steel); margin: 0 auto 10px; }
@media (min-width: 600px) { .mo { align-items: center; } .mo-box { border-radius: 20px; padding-top: 18px; } .mo-box::before { display: none; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.mo-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 10px); background: var(--c2); color: #fff; padding: 13px 18px; border-radius: 12px; font-size: 15px; font-weight: 500; z-index: 300; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center; border-left: 4px solid var(--gas); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; padding: 30px 16px; color: var(--mute); }
.empty .ico { width: 40px; height: 40px; color: var(--steel); margin-bottom: 8px; stroke-width: 1.5; }
.empty .strong { color: var(--ink-2); }
.alert { border-radius: 10px; padding: 12px 14px; font-size: 15px; margin-bottom: 10px; display: flex; gap: 10px; align-items: flex-start; }
.al-bad { background: var(--bad-lt); color: #7f1d18; }
.al-warn { background: var(--gas-lt); color: var(--gas-ink); }
.al-info { background: var(--blue-lt); color: #123f75; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--mute); }
.hide { display: none !important; }
