/* =====================================================================
   Gestion des écrans — SDIS de l'Allier (modèle v3 : les boucles)
   Identité : rouge pompier, bleu nuit, police Atkinson Hyperlegible
   (hébergée sur le site, aucune ressource extérieure).
   ===================================================================== */

@font-face { font-family: 'Atkinson'; src: url('fonts/AtkinsonHyperlegible-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('fonts/AtkinsonHyperlegible-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --red: #e3262e; --red-dark: #b81c23; --red-soft: #fdecec;
  --navy: #0f1b2d; --navy-2: #172840; --navy-3: #22385a;
  --bg: #eef1f6; --card: #ffffff; --line: #dde3ec; --line-2: #e9edf3;
  --text: #16202e; --dim: #66728a; --faint: #98a2b5;
  --ok: #1f9d55; --ok-soft: #e4f6ec; --warn: #c27a0e; --warn-soft: #fdf3e1; --off: #8a94a6; --off-soft: #eef0f4;
  --live: #e3262e;
  --r: 14px; --r-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 6px 20px rgba(15, 27, 45, .06);
  --shadow-up: 0 10px 30px rgba(15, 27, 45, .18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body.g { margin: 0; height: 100%; }
body.g { background: var(--bg); color: var(--text); font: 15px/1.45 'Atkinson', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body.g a { color: inherit; }
.g svg { width: 18px; height: 18px; flex: none; }

/* ---------- structure ---------- */
.g-app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.g-side { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); color: #cfd8e6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.g-brand { padding: 22px 20px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.g-brand .flame { width: 38px; height: 38px; border-radius: 11px; background: var(--red); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(227, 38, 46, .35); }
.g-brand .flame svg { width: 22px; height: 22px; color: #fff; }
.g-brand b { display: block; color: #fff; font-size: 16px; letter-spacing: .01em; }
.g-brand span { font-size: 12px; color: #8ea0bb; }
.g-nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.g-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: #b8c4d6; font-weight: 700; font-size: 14.5px; }
.g-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.g-nav a.on { background: var(--red); color: #fff; box-shadow: 0 6px 18px rgba(227, 38, 46, .3); }
.g-nav .sep { height: 1px; background: rgba(255, 255, 255, .07); margin: 10px 6px; }
.g-user { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 13px; color: #8ea0bb; }
.g-user b { color: #e6ecf5; }
.g-user a { color: #8ea0bb; }

.g-main { min-width: 0; display: flex; flex-direction: column; }
.g-top { display: flex; align-items: center; gap: 14px; padding: 22px 32px 6px; }
.g-top h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.g-top .sub { color: var(--dim); font-size: 14px; margin-top: 2px; }
.g-top .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.g-body { padding: 18px 32px 40px; }

/* ---------- éléments ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 9px 15px; border-radius: 10px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c5cfdd; background: #f8fafc; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(227, 38, 46, .25); }
.btn.red:hover { background: var(--red-dark); }
.btn.navy { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { background: rgba(15, 27, 45, .05); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn.danger { color: var(--red-dark); }
.btn.danger:hover { background: var(--red-soft); border-color: #f3c3c5; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; }
.card h2 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.muted { color: var(--dim); }
.faint { color: var(--faint); }
.small { font-size: 13px; }

input[type=text], input[type=url], input[type=number], input[type=date], input[type=time], input[type=password], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #9fb3d1; box-shadow: 0 0 0 3px rgba(31, 63, 115, .12); }
textarea { resize: vertical; min-height: 70px; }
label.f { display: block; font-size: 13px; font-weight: 700; color: var(--dim); margin: 12px 0 5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--off-soft); color: var(--off); white-space: nowrap; }
.badge.live { background: var(--ok-soft); color: var(--ok); }
.badge.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.scheduled { background: var(--warn-soft); color: var(--warn); }
.badge.paused, .badge.ended { background: var(--off-soft); color: var(--off); }
.badge.red { background: var(--red-soft); color: var(--red-dark); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.off { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.dot.wait { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }

.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 700; color: var(--dim); padding: 6px 11px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15, 27, 45, .12); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 38px; height: 22px; border-radius: 99px; background: #cdd5e1; position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(16px); }

.toast { position: fixed; right: 24px; bottom: 24px; background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow-up); z-index: 1000; opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red-dark); }

.empty { text-align: center; padding: 28px 10px; color: var(--faint); font-size: 14px; }

/* ---------- panneau latéral / fenêtre ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(15, 27, 45, .32); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: #fff; z-index: 60; box-shadow: var(--shadow-up); transform: translateX(105%); transition: transform .25s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header { padding: 18px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.drawer header h3 { margin: 0; font-size: 17px; flex: 1; }
.drawer .content { padding: 4px 20px 24px; overflow: auto; flex: 1; }

/* ---------- boucles (silos) ---------- */
.silos { display: flex; gap: 18px; overflow-x: auto; padding: 4px 4px 20px; align-items: flex-start; min-height: calc(100vh - 150px); }
.silo { width: 330px; flex: none; background: #f8fafc; border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; border-top: 6px solid var(--c, var(--red)); max-height: calc(100vh - 140px); }
.silo.common { background: linear-gradient(180deg, #f2f5fa, #f8fafc); }
.silo-head { padding: 14px 16px 10px; display: flex; gap: 10px; align-items: flex-start; }
.silo-head .name { font-weight: 700; font-size: 17px; border: 0; background: transparent; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; width: 100%; }
.silo-head .name:hover, .silo-head .name:focus { background: #fff; box-shadow: 0 0 0 1px var(--line); }
.silo-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.silo-meta .badge { cursor: default; }
.silo-body { overflow-y: auto; padding: 0 12px 12px; flex: 1; }
.zone { margin-top: 10px; }
.zone-h { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; padding: 4px 4px 6px; }
.zone-h svg { width: 15px; height: 15px; }
.zone-h .add { margin-left: auto; text-transform: none; letter-spacing: 0; }
.drop { min-height: 46px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px; padding: 2px; transition: background .12s, box-shadow .12s; }
.drop.over { background: var(--red-soft); box-shadow: inset 0 0 0 2px var(--red); }
.drop .hint { border: 2px dashed var(--line); border-radius: 11px; padding: 10px; text-align: center; font-size: 12.5px; color: var(--faint); }
.it { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 11px; padding: 7px; box-shadow: 0 1px 2px rgba(15, 27, 45, .08); cursor: grab; border: 1px solid transparent; position: relative; }
.it:hover { border-color: var(--line); }
.it.dragging { opacity: .45; }
.it.state-paused, .it.state-ended { opacity: .55; }
.it .th { width: 64px; height: 36px; border-radius: 7px; background: var(--navy-3) center/cover no-repeat; flex: none; display: grid; place-items: center; color: #fff; }
.it .th svg { width: 17px; height: 17px; opacity: .85; }
.it .th.txt { background: linear-gradient(135deg, var(--navy-2), var(--navy-3)); }
.it .th.qr { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--line); }
.it .tx { min-width: 0; flex: 1; }
.it .tt { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .ts { font-size: 12px; color: var(--dim); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.it .ts .badge { font-size: 11px; padding: 1px 7px; }
.it.text .tt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 400; }
.it .more { opacity: 0; transition: opacity .1s; }
.it:hover .more { opacity: 1; }
.silo-foot { padding: 10px 16px 14px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--dim); }
.silo-add { width: 260px; flex: none; border: 2px dashed #c9d2df; border-radius: 18px; min-height: 200px; display: grid; place-items: center; color: var(--dim); font-weight: 700; cursor: pointer; background: transparent; font: inherit; }
.silo-add:hover { border-color: var(--red); color: var(--red); }

/* ---------- médiathèque (tiroir) ---------- */
.lib { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; background: #fff; z-index: 40; box-shadow: var(--shadow-up); transform: translateX(105%); transition: transform .25s; display: flex; flex-direction: column; }
.lib.open { transform: none; }
.lib header { padding: 16px 18px 10px; border-bottom: 1px solid var(--line-2); }
.lib header h3 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.lib .tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.lib .grid-m { padding: 12px 14px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; flex: 1; }
.mc { border-radius: 11px; overflow: hidden; background: #f4f6fa; cursor: grab; border: 2px solid transparent; position: relative; }
.mc:hover { border-color: var(--line); }
.mc.sel { border-color: var(--red); }
.mc .im { aspect-ratio: 16/9; background: var(--navy-3) center/cover no-repeat; display: grid; place-items: center; color: #fff; }
.mc .cap { padding: 6px 8px; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc .ty { position: absolute; top: 6px; left: 6px; background: rgba(15, 27, 45, .75); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.mc .ty.live { background: var(--red); }
.lib .folders { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.lib .folders button { flex: none; }
.lib footer { padding: 12px 16px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; align-items: center; font-size: 13px; }
body.lib-open .g-body { padding-right: 432px; }

/* ---------- affectation ---------- */
.assign { display: grid; grid-template-columns: minmax(420px, 1.1fr) 1fr; gap: 18px; align-items: start; }
.map-wrap { position: relative; background: linear-gradient(180deg, #13233a, #0f1b2d); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.map-wrap svg.dept { width: 100%; height: auto; display: block; color: #22385a; }
.map-wrap svg.dept path { stroke: #3a5680; stroke-width: .6; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; background: var(--c, #888); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); cursor: pointer; }
.pin.off { filter: grayscale(.8) brightness(.8); }
.pin:hover::after, .pin.show::after { content: attr(data-name); position: absolute; left: 50%; bottom: 130%; transform: translateX(-50%); background: #fff; color: var(--text); font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 7px; white-space: nowrap; box-shadow: var(--shadow); }
.lanes { display: flex; flex-direction: column; gap: 12px; }
.lane { background: #fff; border-radius: 14px; box-shadow: var(--shadow); border-left: 6px solid var(--c); padding: 12px 14px; }
.lane h3 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.lane .screens { display: flex; flex-wrap: wrap; gap: 8px; min-height: 38px; border-radius: 10px; padding: 3px; }
.lane .screens.over { background: var(--red-soft); box-shadow: inset 0 0 0 2px var(--red); }
.scr { display: inline-flex; align-items: center; gap: 8px; background: #f4f6fa; border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 700; cursor: grab; border: 1px solid var(--line-2); }
.scr svg { width: 15px; height: 15px; }
.scr.dragging { opacity: .4; }

/* ---------- écrans ---------- */
.screens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.sc { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; text-decoration: none; display: block; border-top: 5px solid var(--c, var(--off)); }
.sc:hover { box-shadow: var(--shadow-up); }
.sc .tv { margin: 14px 14px 0; aspect-ratio: 16/9; border-radius: 10px; background: #0f1b2d; position: relative; overflow: hidden; display: grid; place-items: center; color: #6c809f; }
.sc .tv .lbl { position: absolute; left: 10px; bottom: 8px; color: #fff; font-weight: 700; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.sc .bd { padding: 12px 16px 16px; }
.sc .bd b { font-size: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--dim); }

/* ---------- tableau de bord ---------- */
.stat { display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.stat .ic svg { width: 22px; height: 22px; }
.stat b { font-size: 26px; display: block; line-height: 1.1; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }

.days { display: inline-flex; gap: 4px; }
.days label { cursor: pointer; }
.days input { display: none; }
.days span { display: inline-grid; place-items: center; width: 36px; height: 30px; border-radius: 8px; background: var(--line-2); font-size: 12.5px; font-weight: 700; color: var(--dim); }
.days input:checked + span { background: var(--navy-2); color: #fff; }

.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 10%, #22385a 0%, var(--navy) 60%); }
.login .box { width: 360px; background: #fff; border-radius: 20px; padding: 32px 30px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.login .flame { width: 54px; height: 54px; border-radius: 15px; background: var(--red); display: grid; place-items: center; margin: 0 auto 14px; box-shadow: 0 10px 24px rgba(227, 38, 46, .4); }
.login .flame svg { width: 30px; height: 30px; color: #fff; }
.login h1 { text-align: center; margin: 0; font-size: 21px; }
.login p { text-align: center; margin: 4px 0 16px; color: var(--dim); font-size: 14px; }
.login .err { background: var(--red-soft); color: var(--red-dark); border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 8px; }

@media (max-width: 900px) {
  .g-app { grid-template-columns: 1fr; }
  .g-side { position: static; height: auto; }
  .g-nav { flex-direction: row; overflow-x: auto; }
  .assign { grid-template-columns: 1fr; }
  .lib { width: 100vw; }
  body.lib-open .g-body { padding-right: 32px; }
}

/* ---------- grille hebdomadaire d'allumage ---------- */
.sched { user-select: none; font-size: 12px; }
.sched .hours, .sched .r { display: grid; grid-template-columns: 74px repeat(24, 1fr); gap: 2px; align-items: center; }
.sched .hours span { color: var(--faint); text-align: left; }
.sched .r { margin-top: 2px; }
.sched .r b { font-size: 12.5px; color: var(--dim); }
.sched .c { height: 24px; border-radius: 4px; background: var(--ok); cursor: pointer; }
.sched .c.off { background: #2b3446; }
.sched .c:hover { outline: 2px solid var(--navy-3); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--dim); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars div { flex: 1; background: var(--red); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }

/* ---------- médiathèque ---------- */
.mlib { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.mtree { position: sticky; top: 16px; }
.mcats { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.mcats button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; font: inherit; font-weight: 700; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--text); text-align: left; }
.mcats button:hover { background: var(--line-2); }
.mcats button.on { background: var(--navy-2); color: #fff; }
.mcats button .badge { margin-left: auto; }
.mcats button.on .badge { background: rgba(255,255,255,.15); color: #fff; }
.ftree { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 2px solid var(--line-2); }
.ftree li { margin: 2px 0; }
.ftree a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.ftree a:hover { background: var(--line-2); }
.ftree a.on { background: var(--red-soft); color: var(--red-dark); font-weight: 700; }
.ftree a.over { background: var(--red); color: #fff; }
.ftree a span.n { margin-left: auto; font-size: 12px; color: var(--faint); }
.mbar { margin-bottom: 10px; }
.mfolder { margin-bottom: 10px; min-height: 8px; }
.mdrop { border: 2px dashed #c6d0de; border-radius: 16px; padding: 18px; display: flex; gap: 14px; align-items: center; color: var(--dim); background: #fff; margin-bottom: 14px; transition: all .15s; }
.mdrop svg { width: 28px; height: 28px; color: var(--red); }
.mdrop.over { border-color: var(--red); background: var(--red-soft); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.mgrid .mc { background: #fff; box-shadow: var(--shadow); border-radius: 14px; }
.mgrid .mc .im { aspect-ratio: 16/9; }
.mgrid .mc .cap { padding: 9px 12px 2px; font-size: 14px; }
.mgrid .mc .meta { padding: 0 12px 10px; font-size: 12px; color: var(--dim); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mgrid .mc .chk { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(15,27,45,.45); border: 2px solid #fff; display: grid; place-items: center; color: #fff; opacity: 0; transition: opacity .1s; }
.mgrid .mc:hover .chk, .mgrid .mc.sel .chk { opacity: 1; }
.mgrid .mc.sel .chk { background: var(--red); }
.mgrid .mc .chk svg { width: 14px; height: 14px; }
.mgrid .mc .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.35); }
.mgrid .mc .prog div { height: 100%; background: var(--red); }
.mselbar { position: sticky; top: 8px; z-index: 5; background: var(--navy); color: #fff; border-radius: 12px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; margin-bottom: 14px; box-shadow: var(--shadow-up); }
.mselbar .muted { color: #9fb0c9; }
.upl { background: #fff; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; box-shadow: var(--shadow); font-size: 13px; }
.upl .b { height: 6px; background: var(--line-2); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.upl .b div { height: 100%; background: var(--red); width: 0; transition: width .2s; }
.upl.done .b div { background: var(--ok); }
.upl.fail { color: var(--red-dark); }
@media (max-width: 900px) { .mlib { grid-template-columns: 1fr; } .mtree { position: static; } }

/* état du boîtier (santé du Raspberry) */
.sante { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.sante > div { background: var(--off-soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sante > div span { font-size: 12px; color: var(--dim); }
.sante > div b { font-size: 17px; }
.sante > div.warn { background: var(--warn-soft); } .sante > div.warn b { color: var(--warn); }
.sante > div.crit { background: var(--red-soft); } .sante > div.crit b { color: var(--red-dark); }
.alerte { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 8px 12px; margin: 6px 0; font-weight: 600; font-size: 14px; }
.alerte svg { width: 18px; height: 18px; flex: none; }
.alerte.warn { background: var(--warn-soft); color: var(--warn); }
.alerte.crit { background: var(--red-soft); color: var(--red-dark); }
svg.courbe { display: block; width: 100% !important; height: auto !important; background: var(--off-soft); border-radius: 8px; margin: 4px 0; flex: none; }
svg.courbe .gl { stroke: #c9cfda; stroke-width: 1; stroke-dasharray: 3 3; }
svg.courbe .gs { stroke: #e3262e; stroke-width: 1.2; stroke-dasharray: 6 4; opacity: .7; }
svg.courbe .gt { font: 11px system-ui, sans-serif; fill: #8a94a6; }
.incident { margin-top: 16px; border-top: 1px solid var(--line, #e6e8ee); padding-top: 12px; }
.incident b { display: inline-flex; align-items: center; gap: 6px; }
.incident b svg { width: 16px; height: 16px; }
.incident pre { white-space: pre-wrap; font-size: 12px; background: var(--off-soft); border-radius: 8px; padding: 10px; margin: 8px 0 0; max-height: 220px; overflow: auto; }
.sante-mini { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); }
.sante-mini.warn { background: var(--warn-soft); color: var(--warn); }
.sante-mini.crit { background: var(--red-soft); color: var(--red-dark); }
