/* silo.ucdv.fr — feuille de style unique */
:root {
  --brand: #0e7a37;
  --brand-strong: #0a5e2a;
  --brand-soft: #e5f3ea;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --border: #e2e7e4;
  --text: #17211b;
  --text-2: #56635b;
  --text-3: #8a958e;
  --ok: #1f9d55;
  --warn: #d97706;
  --warn-soft: #fff4e0;
  --crit: #dc2626;
  --crit-soft: #fde8e8;
  --err: #7c3aed;
  --err-soft: #efe7fd;
  --off: #9aa3a0;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 2px 8px rgba(16, 24, 20, .04);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #34c26b; --brand-strong: #5ad68a; --brand-soft: #143322;
    --bg: #0f1412; --surface: #171e1a; --surface-2: #1c2520; --border: #2a3530;
    --text: #e6ece8; --text-2: #a7b3ac; --text-3: #75827a;
    --warn-soft: #3a2a10; --crit-soft: #3b1616; --err-soft: #2a1d45;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ En-tête */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 1480px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; min-height: 58px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand span { font-weight: 700; color: var(--brand); letter-spacing: -.01em; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); font-size: 14px; }
.crumbs a { text-decoration: none; color: var(--text-2); padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.crumbs a:hover { background: var(--surface-2); color: var(--text); }
.crumbs .sep { color: var(--text-3); }
.crumbs .here { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.live {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2);
  white-space: nowrap;
}
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.live.on .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.iconbtn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; border: 1px solid transparent; background: none; cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.iconbtn svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------ Mise en page */
.page { max-width: 1480px; margin: 0 auto; padding: 20px; }
.page-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-title h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.page-title .sub { color: var(--text-2); font-size: 14px; }
.grid-accueil { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .grid-accueil { grid-template-columns: minmax(0, 1fr); } .grid-accueil aside { position: static !important; } }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-h {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-h h2 { font-size: 15px; margin: 0; font-weight: 650; }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

/* ------------------------------------------------------------ Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 14px 16px; }
.kpi .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; }
.kpi .val { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 13px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .hint a { color: var(--brand); text-decoration: none; }
.t-ok { color: var(--text); }
.t-warn { color: var(--warn); }
.t-crit { color: var(--crit); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 25%, var(--surface)); }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--surface)); }
.pill.crit { color: var(--crit); background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 30%, var(--surface)); }
.pill.off { color: var(--text-3); }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge.crit { background: var(--crit); color: #fff; border-color: var(--crit); }

/* ------------------------------------------------------------ Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 550; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 20%, var(--border)); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--crit); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button {
  border: 0; background: none; padding: 0 12px; height: 32px; cursor: pointer; color: var(--text-2);
  font-size: 13px; font-weight: 600; border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button.on { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------ Carte silo (accueil) */
.silo-card { overflow: hidden; }
.silo-card.is-warn { border-left: 4px solid var(--warn); }
.silo-card.is-crit { border-left: 4px solid var(--crit); }
.silo-card.is-off { opacity: .8; }
.silo-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; flex-wrap: wrap; }
.silo-head h2 { margin: 0; font-size: 18px; }
.silo-head h2 a { text-decoration: none; }
.silo-head h2 a:hover { color: var(--brand); }
.silo-head .spacer { flex: 1; }
.silo-stats { display: flex; gap: 22px; padding: 0 16px 12px; flex-wrap: wrap; }
.stat .k { font-size: 12px; color: var(--text-2); }
.stat .v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .v.big { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.trend { font-size: 13px; font-weight: 600; margin-left: 4px; }
.trend.up { color: var(--crit); }
.trend.down { color: var(--ok); }
.trend.flat { color: var(--text-3); }
/* Page silo : sélecteur de hauteur (une sonde vue de profil) à gauche de la grille */
.plan-silo { display: flex; gap: 8px; align-items: flex-start; padding: 16px 0 0 16px; }
.plan-silo .heat-wrap { flex: 1; min-width: 0; padding: 0 16px 16px 4px; }
.hauteur { flex: 0 0 92px; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding-bottom: 16px; }
.h-chip {
  height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-size: 13px; font-weight: 650; color: var(--text-2);
}
.h-chip:hover { background: var(--surface-2); color: var(--text); }
.h-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tige { position: relative; display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding: 4px 0; }
.tige::before { content: ""; position: absolute; left: 15px; top: -8px; bottom: -6px; width: 3px; border-radius: 2px; background: var(--text-3); }
.h-pt {
  position: relative; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; align-items: center;
  border: 0; background: none; cursor: pointer; padding: 6px 4px 6px 0; border-radius: 8px; text-align: left; color: var(--text-2);
}
.h-pt:hover { background: var(--surface-2); color: var(--text); }
.h-pt i { grid-row: 1 / 3; justify-self: center; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text-3); z-index: 1; }
.h-pt span { font-weight: 700; font-size: 14px; }
.h-pt small { grid-column: 2; font-size: 11px; color: var(--text-3); line-height: 1; }
.h-pt.on { color: var(--brand); }
.h-pt.on i { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.fond {
  margin-top: 2px; height: 22px; border-top: 3px solid var(--text-3); font-size: 11px; color: var(--text-3); text-align: center; padding-top: 2px;
  background: repeating-linear-gradient(-45deg, transparent 0 5px, color-mix(in srgb, var(--text-3) 25%, transparent) 5px 6px);
}
@media (max-width: 640px) {
  .plan-silo { flex-direction: column; padding: 12px 0 0 0; }
  .hauteur { flex: none; flex-direction: row; flex-wrap: wrap; padding: 0 14px; }
  .tige { flex-direction: row-reverse; margin: 0; }
  .tige::before, .fond { display: none; }
  .h-pt { grid-template-columns: 22px auto; padding: 4px 8px 4px 0; }
  .plan-silo { align-items: stretch; }
  .plan-silo .heat-wrap { width: 100%; padding: 0 0 12px; }
}
/* Coupe verticale d'une sonde (panneau latéral) */
.coupe { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 6px 0 0; }
.coupe::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 26px; width: 3px; border-radius: 2px; background: var(--text-3); }
.coupe-l { display: grid; grid-template-columns: 30px 70px 1fr; align-items: center; gap: 8px; }
.coupe-pt { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); z-index: 1; background: var(--surface-2); }
.coupe-pt.warn { background: #fbbf24; } .coupe-pt.crit { background: var(--crit); } .coupe-pt.err { background: var(--err-soft); box-shadow: 0 0 0 1px var(--err); }
.coupe-n { font-weight: 700; display: flex; flex-direction: column; line-height: 1.1; }
.coupe-n small { font-weight: 500; font-size: 11px; color: var(--text-3); }
.coupe-v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.coupe-fond { border-top: 3px solid var(--text-3); font-size: 11px; color: var(--text-3); padding-top: 3px; padding-left: 2px;
  background: repeating-linear-gradient(-45deg, transparent 0 5px, color-mix(in srgb, var(--text-3) 25%, transparent) 5px 6px); }

/* Vue d'ensemble compacte : tous les silos sur un écran */
.silos-compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 14px; align-items: start; }
.silo-card.mini .mini-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 2px; }
.silo-card.mini h2 { margin: 0; font-size: 17px; }
.silo-card.mini h2 a { text-decoration: none; }
.silo-card.mini h2 a:hover { color: var(--brand); }
.silo-card.mini .spacer { flex: 1; }
.mini-max { font-size: 22px; font-weight: 750; letter-spacing: -.02em; text-decoration: none; font-variant-numeric: tabular-nums; }
.mini-infos { padding: 0 14px 6px; font-size: 13px; color: var(--text-2); }
.mini-infos a { color: var(--brand); text-decoration: none; font-weight: 600; }
.silo-card.mini .heat-wrap { padding: 4px 14px 12px; }
.kpis.compact { margin-bottom: 14px; }
.kpis.compact .kpi { padding: 10px 14px; }
.kpis.compact .val { font-size: 21px; margin-top: 2px; }
.aside-sticky { position: sticky; top: 76px; }
.silo-foot { display: flex; gap: 6px; padding: 10px 16px 14px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ Grille de sondes */
.heat-wrap { padding: 4px 16px 14px; overflow-x: auto; overflow-y: hidden; }
/* Sur téléphone : défilement horizontal qui s'arrête sur chaque case, ombre au bord si ça déborde */
.heat-wrap { scroll-snap-type: x proximity; scroll-padding-left: 8px; -webkit-overflow-scrolling: touch; }
.heat .case-btn:not(.droite) { scroll-snap-align: start; }
.glisser { display: none; font-size: 12px; color: var(--text-3); text-align: center; padding: 0 0 8px; }
.deborde + .glisser { display: block; }
.heat { display: grid; gap: 3px; min-width: min-content; position: relative; padding: 5px; }
.heat svg.murs { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; overflow: visible; z-index: 3; }
/* Murs : un tracé continu par type, coins arrondis. Teinte choisie par silo (data-mur). */
.heat { --mur: #1f2937; }
.heat[data-mur="ardoise"] { --mur: #475569; }
.heat[data-mur="gris"]    { --mur: #6b7280; }
.heat[data-mur="clair"]   { --mur: #9ca3af; }
.heat[data-mur="beton"]   { --mur: #8a8178; }
@media (prefers-color-scheme: dark) {
  .heat { --mur: #e5e7eb; }
  .heat[data-mur="ardoise"] { --mur: #cbd5e1; }
  .heat[data-mur="gris"]    { --mur: #9ca3af; }
  .heat[data-mur="clair"]   { --mur: #6b7280; }
  .heat[data-mur="beton"]   { --mur: #b5aca1; }
}
.heat svg.murs path { fill: none; stroke-linecap: butt; stroke-linejoin: round; }
.heat svg.murs .bout, .heat svg.murs .ouv { stroke-linecap: round; }
.heat svg.murs .mur { stroke: var(--mur); stroke-width: 4; }
.heat svg.murs .ouv { stroke: #3b82f6; stroke-width: 2.5; stroke-dasharray: 2 4; opacity: .9; }
.heat.t-mini svg.murs .mur { stroke-width: 3; }
.heat.t-mini svg.murs .ouv { stroke-width: 2; stroke-dasharray: 1.5 3; }
.heat.t-grand svg.murs .mur { stroke-width: 5; }
.heat.t-grand svg.murs .ouv { stroke-width: 3; stroke-dasharray: 3 5; }
.heat .cell.gap { height: auto !important; min-width: 0 !important; }
.heat.t-mini { gap: 2px; }
.heat.t-mini .cell { height: 14px; min-width: 13px; border-radius: 3px; }
.heat.t-mini .cell:hover { transform: scale(1.35); }
.heat.t-grand { gap: 5px; }
.heat.t-grand .case-btn { margin-top: 14px; }
.heat.t-grand .case-btn.droite { margin: 0 0 0 14px; }
.heat.t-grand .cell { height: 58px; min-width: 46px; border-radius: 8px; font-size: 13px; }
.heat.t-grand .cell .id { font-size: 11px; margin-bottom: 2px; }
.cell.profil { display: flex; flex-direction: column; padding: 0; overflow: hidden; gap: 1px; background: var(--border); }
.cell.profil .id { flex: 0 0 auto; margin: 0 !important; padding: 2px 0 1px; font-size: 10px; text-align: center; background: var(--surface); color: var(--text-2); opacity: 1; }
.heat.t-grand .cell.profil { height: 80px; }
.bande { flex: 1; display: grid; place-items: center; font-size: 10px; font-weight: 650; line-height: 1; background: var(--surface-2); color: #17211b; }
.bande.err { background: var(--err-soft); color: var(--err); font-size: 9px; }
.bande.warn { background: #fbbf24; }
.bande.crit { background: var(--crit); color: #fff; }
.bande.vide { color: var(--text-3); }
.cell.hl { outline: 2px solid var(--brand); outline-offset: 1px; }
.case-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 11px;
  height: 28px; border-radius: 6px; font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap;
  color: var(--brand); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--surface));
}
.case-btn:hover { background: var(--brand); color: #fff; }
.case-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.case-btn.droite { margin: 0 0 0 11px; height: auto; padding: 0 10px; writing-mode: horizontal-tb; }
.heat.t-mini .case-btn { height: 20px; margin-top: 9px; font-size: 11px; gap: 3px; }
.heat.t-mini .case-btn svg { width: 11px; height: 11px; }
.heat.t-mini .case-btn.droite { margin: 0 0 0 9px; padding: 0 6px; }
.cell {
  height: 34px; min-width: 34px; border-radius: 6px; display: grid; place-items: center;
  font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; text-decoration: none;
  color: #17211b; background: var(--surface-2); border: 1px solid transparent; position: relative;
  transition: transform .12s, box-shadow .12s; cursor: pointer; user-select: none;
}
.cell:hover { transform: scale(1.08); box-shadow: 0 3px 10px rgba(0,0,0,.18); z-index: 2; }
.cell.gap { background: none; cursor: default; pointer-events: none; }
.cell.none { background: var(--surface-2); color: var(--text-3); border: 1px dashed var(--border); cursor: default; }
.cell.err { background: var(--err-soft); color: var(--err); }
.cell.warn { background: #fbbf24; color: #3b2600; }
.cell.crit { background: var(--crit); color: #fff; }
.cell.stale { background: var(--surface-2); color: var(--text-3); border: 1px dashed var(--border); }
.cell.inh { opacity: .45; background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(0,0,0,.12) 5px 7px); }
.cell .id { display: block; font-size: 10px; font-weight: 600; opacity: .7; line-height: 1; }
.cell .t { display: block; line-height: 1.1; }
.cell.sel { outline: 3px solid var(--brand); outline-offset: 1px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }

/* ------------------------------------------------------------ Alertes */
.alert-list { display: flex; flex-direction: column; }
.alert-row {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  transition: opacity .25s, transform .25s;
}
.alert-row:last-child { border-bottom: 0; }
.alert-row .bar { align-self: stretch; border-radius: 2px; background: var(--warn); }
.alert-row.crit .bar { background: var(--crit); }
.alert-row .what { font-weight: 650; }
.alert-row .what a { text-decoration: none; }
.alert-row .what a:hover { color: var(--brand); }
.alert-row .meta { font-size: 13px; color: var(--text-2); }
.alert-row .acts { display: flex; gap: 6px; }
.alert-row.leaving { opacity: 0; transform: translateX(16px); }
.empty-state { padding: 28px 16px; text-align: center; color: var(--text-2); }
.empty-state svg { width: 36px; height: 36px; color: var(--ok); margin-bottom: 6px; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 650; background: var(--surface-2); position: sticky; top: 0; }
table.data tr.archived td { color: var(--text-3); }
table.data tr.leaving { opacity: .3; }
table.data td.r, table.data th.r { text-align: right; }
.table-wrap { overflow: auto; max-height: 460px; }

/* ------------------------------------------------------------ Barre d'outils, formulaires */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
label.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--text-2); cursor: pointer; }
input[type=date], input[type=number], input[type=text], textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px; height: 34px;
}
textarea { height: auto; min-height: 96px; width: 100%; resize: vertical; }
input:focus, textarea:focus, .btn:focus-visible, .seg button:focus-visible, .cell:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.field input { width: 100%; }
.field .help { font-size: 12px; color: var(--text-3); margin-top: 4px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ Graphiques */
.chart-box { position: relative; height: 460px; padding: 12px 16px 16px; }
@media (max-width: 700px) { .chart-box { height: 340px; } }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-radius: var(--radius); z-index: 3; color: var(--text-2); font-size: 14px;
}
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.capteurs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 800px) { .capteurs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.capteur { padding: 12px 14px; border-left: 4px solid var(--border); }
.capteur .lbl { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.capteur .lbl i { width: 10px; height: 10px; border-radius: 3px; }
.capteur .now { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.capteur .mm { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.banner {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 70%, var(--text)); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--surface));
  margin-bottom: 16px; font-size: 14px; font-weight: 550;
}
.banner .spacer { flex: 1; }

/* ------------------------------------------------------------ Panneau latéral, info-bulle, toasts */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); z-index: 81;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 30px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer.open + .drawer-bg, .drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer .card-h { border-bottom: 1px solid var(--border); }
.drawer .body { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.kv .k { font-size: 12px; color: var(--text-2); }
.kv .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.tip {
  position: fixed; z-index: 90; pointer-events: none; background: #111a15; color: #fff; font-size: 12px;
  padding: 8px 10px; border-radius: 8px; line-height: 1.5; display: none; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.tip b { font-size: 13px; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #111a15; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); display: flex; gap: 12px; align-items: center; animation: up .2s ease;
}
.toast.err { background: var(--crit); }
.toast button { background: none; border: 0; color: #9ee6b8; font-weight: 700; cursor: pointer; padding: 0; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 640px) {
  .page { padding: 12px; }
  .topbar-in { min-height: 52px; }
  .brand img { width: 30px; height: 30px; }
  .crumbs { flex: 1; overflow: hidden; font-size: 13px; gap: 2px; }
  .crumbs > :not(:nth-last-child(-n+3)) { display: none; }   /* on garde : parent › page */
  .crumbs a { padding: 4px 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .crumbs .here { flex-shrink: 0; max-width: 60vw; }
  .topbar .spacer { display: none; }
  .case-btn .mot { display: none; }
  .card-h { padding: 12px 14px; }
  .kpis { gap: 8px; margin-bottom: 14px; }
  .kpi { padding: 10px 12px; }
  .kpi .lbl { font-size: 11px; }
  .kpi .hint { font-size: 12px; }
  table.data { font-size: 13px; }
  table.data th, table.data td { padding: 8px 10px; }
  .btn, .seg button { min-height: 36px; }
  .topbar-in { padding: 8px 14px; gap: 10px; }
  .brand span, .live .txt { display: none; }
  .kpi .val { font-size: 22px; }
  .silo-stats { gap: 16px; }
}
