/* ESAM Vigie - theme clair professionnel, accents colores */
:root {
  --bg: #f3f6f4; --panel: #ffffff; --panel2: #f7faf8; --line: #e3e9e5; --text: #1c2b23; --muted: #6b7d73;
  --side: #0f2e1f; --side2: #143d29; --side-text: #cfe3d7;
  --brand: #1f8a52; --brand-d: #166b3f; --brand-l: #e3f4ea;
  --ok: #1f9d55; --warn: #e08e0b; --danger: #dc3b33; --info: #2f7fd6;
  --c-green: #22a35a; --c-red: #e5484d; --c-orange: #f08c00; --c-blue: #2f7fd6; --c-purple: #7c5cd6;
  --c-teal: #12a39a; --c-pink: #d6458f; --c-slate: #5b6b7d; --c-amber: #c98a00;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,40,28,.06), 0 6px 20px rgba(16,40,28,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--brand-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 23px; margin: 4px 0 18px; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
h2 { font-size: 15.5px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 .small { margin-left: auto; font-weight: 500; }
h3 { font-size: 12px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
h1 .ico { width: 24px; height: 24px; color: var(--brand); }
h2 .ico { color: var(--brand); }

/* ---------- Structure : barre laterale + contenu ---------- */
body.app { display: flex; min-height: 100vh; }
.side { width: 250px; flex: none; background: linear-gradient(180deg, var(--side), #0b2418); color: var(--side-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.brand strong { color: #fff; font-size: 16px; display: block; }
.brand small { color: #8fbfa3; font-size: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #2bb56a, #127a46); box-shadow: 0 4px 14px rgba(43,181,106,.4); }
.brand-mark .ico { width: 22px; height: 22px; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6f9a82; padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--side-text); margin: 2px 0; font-weight: 500; }
.nav-item:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-item.on { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 var(--accent); }
.nav-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--accent); opacity: .92; }
.nav-ico .ico { width: 16px; height: 16px; }
.c-green { --accent: var(--c-green); } .c-red { --accent: var(--c-red); } .c-orange { --accent: var(--c-orange); }
.c-blue { --accent: var(--c-blue); } .c-purple { --accent: var(--c-purple); } .c-teal { --accent: var(--c-teal); }
.c-pink { --accent: var(--c-pink); } .c-slate { --accent: var(--c-slate); } .c-amber { --accent: var(--c-amber); }
/* Categories d'equipements : numerique (IP / NVR) en bleu, analogique (DVR) en orange */
.nav-group { --grp: #2f7fd6; --grp2: #5aa2f0; margin: 12px 0 4px; padding: 0 6px 6px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--grp) 45%, transparent); border-left: 4px solid var(--grp);
  background: linear-gradient(180deg, color-mix(in srgb, var(--grp) 22%, transparent), color-mix(in srgb, var(--grp) 6%, transparent)); }
.nav-group.grp-dvr { --grp: #e08e0b; --grp2: #f5b041; }
.nav-group .nav-sec { color: var(--grp2); font-weight: 700; padding-top: 10px; display: flex; align-items: center; gap: 7px; }
.grp-tag { background: var(--grp); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 9.5px; letter-spacing: .06em; }
.nav-group .nav-item { --accent: var(--grp); }
.nav-group .nav-item:nth-of-type(even) .nav-ico { background: var(--grp2); }
.nav-group .nav-item:hover { background: color-mix(in srgb, var(--grp) 18%, transparent); }
.side-foot { margin-top: auto; padding: 14px 8px 0; font-size: 11.5px; color: #7fa892; border-top: 1px solid rgba(255,255,255,.08); }
.pill { margin-left: auto; background: var(--c-red); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 11px; font-weight: 700; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 24px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.crumb { font-weight: 600; color: var(--muted); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 30px; background: var(--panel); }
.user-chip strong { display: block; font-size: 13px; line-height: 1.2; }
.user-chip small { color: var(--muted); font-size: 11px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: linear-gradient(135deg, var(--c-blue), var(--c-purple)); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }
.icon-btn.muted-sound { color: var(--danger); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c5cfc9; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(31,157,85,.15); }
.dot.ko { background: var(--danger); box-shadow: 0 0 0 4px rgba(220,59,51,.15); }
.burger { display: none; background: none; border: 0; color: var(--text); cursor: pointer; padding: 4px; }
.burger .ico { width: 24px; height: 24px; }

.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px; }
.head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.head h1 { margin-bottom: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card[class*="accent-"] { border-top: 4px solid var(--acc); }
.accent-green { --acc: var(--c-green); } .accent-blue { --acc: var(--c-blue); } .accent-orange { --acc: var(--c-orange); } .accent-red { --acc: var(--c-red); }
.grid2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
.grid2.even { grid-template-columns: 1fr 1fr; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + * { margin-top: 20px; }

/* ---------- Indicateurs colores ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { position: relative; overflow: hidden; border-radius: var(--radius); padding: 16px 18px; color: #fff; box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--g1), var(--g2)); }
.stat span { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat small { display: block; opacity: .85; }
.stat .ico { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; opacity: .35; }
.stat.s-blue { --g1: #3b8fe0; --g2: #2363b8; } .stat.s-green { --g1: #2bb56a; --g2: #15804a; }
.stat.s-red { --g1: #ee5a52; --g2: #c22d26; } .stat.s-orange { --g1: #f6a623; --g2: #db7a00; }
.stat.s-purple { --g1: #8d6ce4; --g2: #5d3fbf; } .stat.s-teal { --g1: #1fb8ad; --g2: #0d877f; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: #eef2ef; color: var(--muted); white-space: nowrap; }
.badge.ok { background: #dff5e8; color: #157a42; }
.badge.warn { background: #fdf0d6; color: #a76500; }
.badge.danger { background: #fde3e1; color: #b9261f; }
.badge.info { background: #e2eefc; color: #1f63b5; }

/* ---------- Boutons et formulaires ---------- */
.btn, button { font: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 500; transition: .15s; }
.btn:hover { border-color: var(--brand); color: var(--brand-d); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, #25a060, var(--brand-d)); border-color: transparent; color: #fff; box-shadow: 0 3px 10px rgba(31,138,82,.3); }
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
.btn.danger { background: #fff; border-color: #f2b8b4; color: var(--danger); }
.btn.danger:hover { background: #fdecea; }
.btn.small { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.ghost { background: none; border: 1px solid transparent; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.ghost:hover { color: var(--danger); border-color: var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.actions form, .inline-form { display: inline; margin: 0; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: #fbfdfc; border: 1px solid #d5dfd9; border-radius: 10px; padding: 9px 11px; transition: .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(31,138,82,.12); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
fieldset { border: 0; margin: 0; padding: 0; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: #f1f4f2; }
label { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
label input, label select, label textarea { margin-top: 5px; font-weight: 400; }
label small { font-weight: 400; display: block; margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); padding-top: 22px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.cols .wide { grid-column: 1 / -1; }
.cols label.check.wide { padding-top: 0; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
form.inline input { width: auto; flex: 1; min-width: 160px; }

/* ---------- Tableaux ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: var(--panel2); border-bottom: 1px solid var(--line); padding: 10px; }
.tbl th:first-child { border-radius: 10px 0 0 0; } .tbl th:last-child { border-radius: 0 10px 0 0; }
.tbl td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: middle; }
.tbl tr:hover td { background: #f8fbf9; }
.tbl tr.disabled td { opacity: .5; }
.profiles input { min-width: 120px; }
.sev-critique td:first-child { box-shadow: inset 4px 0 var(--danger); }
.sev-attention td:first-child { box-shadow: inset 4px 0 var(--warn); }
.snap-mini { width: 72px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }

/* ---------- Messages ---------- */
.flash { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; background: #e3f6eb; border: 1px solid #b5e4c8; color: #145c35; }
.flash.error { background: #fdecea; border-color: #f5c2bd; color: #a3241d; }
.task { padding: 12px 16px; border-radius: 12px; background: #e8f1fc; border: 1px solid #bcd5f3; color: #1d4f8a; margin-bottom: 14px; }
.task.ok { background: #e3f6eb; border-color: #b5e4c8; color: #145c35; }
.task.err { background: #fdecea; border-color: #f5c2bd; color: #a3241d; }

/* ---------- Alertes ---------- */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { padding: 9px 12px; border-left: 4px solid var(--info); margin-bottom: 7px; background: var(--panel2); border-radius: 0 10px 10px 0; }
.alerts li.sev-critique { border-left-color: var(--danger); background: #fff5f4; }
.alerts li.sev-attention { border-left-color: var(--warn); background: #fffaf0; }
.alerts li.acked { opacity: .55; }
.alerts time { color: var(--muted); font-size: 12px; margin-right: 8px; font-weight: 600; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--info); padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); max-width: 380px; animation: slide .25s ease-out; }
.toast.critique { border-left-color: var(--danger); } .toast.attention { border-left-color: var(--warn); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
body.alarm .top { animation: blink 1s 4; }
@keyframes blink { 50% { background: #fde3e1; } }

/* ---------- Apercus et direct ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.thumb { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--text); transition: .15s; }
.thumb:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #1d2a22; }
.thumb div { padding: 9px 11px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.thumb small { width: 100%; color: var(--muted); }
.live { display: grid; gap: 12px; }
.live.g1 { grid-template-columns: 1fr; } .live.g2 { grid-template-columns: repeat(2, 1fr); }
.live.g3 { grid-template-columns: repeat(3, 1fr); } .live.g4 { grid-template-columns: repeat(4, 1fr); }
.live.g8 { grid-template-columns: repeat(8, 1fr); gap: 6px; }
.cam-ip { font-family: ui-monospace, Consolas, monospace; font-size: .85em; color: #9be3b4; background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 6px; }
.live.g4 .tile figcaption, .live.g8 .tile figcaption { padding: 4px 8px; font-size: .8em; }
.live.g8 .tile figcaption small, .live.g8 .tile figcaption .badge { display: none; }
.tile { margin: 0; background: #000; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.tile iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; background: #000; }
.tile-img { aspect-ratio: 16/9; position: relative; display: grid; place-items: center; background: #000; }
.tile-img img, .tile-img video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.tile-img img[hidden], .tile-img video[hidden], .tile-wait[hidden] { display: none; }
.tile-wait { color: #9bb8a7; font-size: .9em; }
.tile-img[data-stream] { cursor: zoom-in; }
.tile-img.zoom { position: fixed; inset: 0; z-index: 1000; aspect-ratio: auto; width: 100vw; height: 100vh; height: 100dvh; cursor: zoom-out; }
body.zoomed { overflow: hidden; }
.tile-mode { position: absolute; top: 6px; right: 6px; z-index: 2; padding: 1px 7px; border-radius: 8px; font-size: .72em; font-weight: 600; color: #fff; background: rgba(0,0,0,.55); }
.tile-mode:empty { display: none; }
.tile-off { aspect-ratio: 16/9; display: grid; place-items: center; color: #ff8a83; background: #1a0d0c; font-weight: 600; }
.tile figcaption { padding: 8px 12px; background: #13261b; color: #e6efe9; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tile figcaption a { color: #fff; font-weight: 600; }
.tile figcaption small { color: #9bb8a7; }
.profiles-switch a { margin-right: 6px; padding: 1px 8px; border-radius: 6px; border: 1px solid #355443; font-size: 12px; font-weight: 500 !important; }
.profiles-switch a.on { background: var(--brand); border-color: var(--brand); }

/* ---------- Decouverte ---------- */
.bar { height: 10px; background: #e7eee9; border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--c-teal), var(--c-green)); transition: width .4s; }
.log { background: #0f1f17; color: #bfe0cc; border-radius: 10px; padding: 12px; max-height: 260px; overflow: auto; font: 12px/1.6 Consolas, monospace; white-space: pre-wrap; margin: 0; }
.pager { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager a { padding: 3px 10px; border: 1px solid var(--line); border-radius: 8px; }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Detection ---------- */
.det-card { border-left: 5px solid #cfd8d3; }
.det-card.on { border-left-color: var(--c-teal); }
.det-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.det-head h2 { margin-bottom: 4px; }
.det-head p { margin: 0 0 4px; }
.det-thumb { width: 150px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: #1d2a22; flex: none; }
.det-status { color: #0d7a72; }
.sched { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 14px; border-radius: 12px; background: #f1f8f6; border: 1px dashed #b8ddd7; }
.sched .lbl { width: 100%; font-weight: 700; color: #0d7a72; display: flex; gap: 6px; align-items: center; }
.sched > label { width: 130px; }
.sched small { width: 100%; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { padding: 0; }
.day input { display: none; }
.day span { display: inline-block; min-width: 44px; text-align: center; padding: 7px 8px; border-radius: 9px; border: 1px solid #c8d6cf; background: #fff; color: var(--muted); cursor: pointer; font-weight: 600; }
.day input:checked + span { background: var(--c-teal); border-color: var(--c-teal); color: #fff; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.toast img { display: block; width: 100%; border-radius: 8px; margin-top: 8px; }
.badge .ico { width: 13px; height: 13px; }

/* ---------- Poste de garde ---------- */
body.guard { background: #0b1712; color: #e8f1ec; min-height: 100vh; }
.g-top { display: flex; align-items: center; gap: 20px; padding: 14px 24px; background: #10241a; border-bottom: 1px solid #1f3a2b; flex-wrap: wrap; }
.g-top .brand { border: 0; padding: 0; margin: 0; }
.g-clock { font: 700 34px/1 Consolas, monospace; margin: 0 auto; letter-spacing: .04em; }
.g-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.g-actions .btn:not(.primary) { background: #173226; border-color: #2b4c3b; color: #e8f1ec; }
.g-main { padding: 22px; display: grid; gap: 22px; }
.g-calm { text-align: center; padding: 50px 20px; border-radius: 20px; background: radial-gradient(circle, #15392a, #0f2219); border: 1px solid #1f3a2b; }
.g-calm > .ico { width: 80px; height: 80px; color: #2bb56a; }
.g-calm h1 { justify-content: center; font-size: 30px; margin: 10px 0; }
.g-calm p { color: #9dbcaa; }
.g-hint { color: #f2c35a !important; }
.g-alarm { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; padding: 22px; border-radius: 20px; background: #3b0f0d; border: 3px solid #e5484d; }
.g-alarm-img img { width: 100%; border-radius: 12px; display: block; background: #000; }
.g-alarm-title { font-size: 42px; font-weight: 900; color: #ff6b66; display: flex; align-items: center; gap: 12px; letter-spacing: .05em; }
.g-alarm-title .ico { width: 46px; height: 46px; }
.g-alarm-msg { font-size: 24px; font-weight: 700; margin: 14px 0 6px; }
.g-alarm-time { font-size: 18px; color: #ffb3ae; margin: 0; }
.g-alarm-more { color: #f2c35a; }
.g-ack { display: flex; justify-content: center; width: 100%; font-size: 22px; font-weight: 800; padding: 18px; margin-top: 18px; background: #fff; color: #b9261f; border: 0; }
.g-ack:hover { background: #ffe9e7; color: #b9261f; }
.g-live { display: flex; justify-content: center; width: 100%; margin-top: 10px; background: transparent; color: #fff; border-color: #ff9a95; }
body.ringing .g-alarm { animation: gflash 1s infinite; }
@keyframes gflash { 50% { background: #7a1612; box-shadow: 0 0 60px #e5484d; } }
.g-recent h2 { color: #cfe3d7; }
.g-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.g-item { display: flex; gap: 10px; background: #13281d; border: 1px solid #1f3a2b; border-left: 4px solid var(--info); border-radius: 12px; padding: 8px; }
.g-item.sev-critique { border-left-color: #e5484d; } .g-item.sev-attention { border-left-color: #f08c00; }
.g-item.acked { opacity: .55; }
.g-item img, .g-item .noimg { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; flex: none; background: #0b1712; }
.g-item small { display: block; color: #8fb09c; }
.g-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
/* Detection animaux ferme : meme poste de garde, style vert distinct */
.g-alarm .g-farm-title { display: none; }
.g-alarm.farm { background: #0d2c19; border-color: #2bb56a; }
.g-alarm.farm .g-std-title { display: none; }
.g-alarm.farm .g-farm-title { display: flex; color: #5fe08f; }
.g-alarm.farm .g-alarm-time { color: #a8e0bd; }
body.ringing .g-alarm.farm, body.ringing .g-multi.farm { animation: gflashfarm 1.4s infinite; }
@keyframes gflashfarm { 50% { background: #1d5a33; box-shadow: 0 0 60px #2bb56a; } }
.g-cell.farm { background: #0c2416; border-color: #1f7a45; }
.g-cell.farm figcaption small { color: #a8e0bd; }
.g-farm-tag { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px; background: #2bb56a; color: #062012;
  font-weight: 900; font-size: 12px; padding: 3px 8px; border-radius: 6px; }
.g-farm-tag .ico { width: 14px; height: 14px; }
.g-farm-tag.inline { position: static; margin-bottom: 3px; font-size: 11px; padding: 2px 6px; }
.g-item.farm { border-left-color: #2bb56a; background: #10301f; }
.g-count-farm b { color: #5fe08f; }
.g-count-farm span .ico { width: 14px; height: 14px; vertical-align: -2px; }
.g-count-farm.hot { border-color: #2bb56a; box-shadow: 0 0 18px #2bb56a66; }
.g-count { background: #13281d; border: 1px solid #1f3a2b; border-radius: 14px; padding: 12px 16px; display: flex; align-items: baseline; gap: 10px; }
.g-count b { font: 800 40px/1 Consolas, monospace; color: #2bb56a; }
.g-count span { color: #9dbcaa; font-size: 14px; }
.g-count.hot { background: #3b0f0d; border-color: #e5484d; }
.g-count.hot b { color: #ff6b66; }
.g-count.bump b { animation: gbump .6s; }
@keyframes gbump { 30% { transform: scale(1.35); color: #fff; } }
.g-multi { padding: 18px; border-radius: 20px; background: #3b0f0d; border: 3px solid #e5484d; }
body.ringing .g-multi { animation: gflash 1s infinite; }
.g-multi-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.g-multi-head .g-alarm-title { font-size: 30px; }
.g-ackall { font-size: 18px; font-weight: 800; padding: 12px 20px; background: #fff; color: #b9261f; border: 0; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.g-cell { margin: 0; background: #1d0806; border: 2px solid #7a1612; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.g-cell.fresh { border-color: #f2c35a; box-shadow: 0 0 24px #f2c35a88; }
.g-cell-img { position: relative; aspect-ratio: 16 / 9; background: #000; }
.g-cell-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-cell-img .noimg { height: 100%; display: grid; place-items: center; color: #ffb3ae; }
.g-new { display: none; position: absolute; top: 8px; left: 8px; background: #f2c35a; color: #3b0f0d; font-weight: 900; font-size: 12px; padding: 3px 8px; border-radius: 6px; }
.g-cell.fresh .g-new { display: block; }
.g-cell figcaption { padding: 10px 12px; display: grid; gap: 4px; }
.g-cell figcaption strong { font-size: 16px; }
.g-cell figcaption small { color: #ffb3ae; }
.g-age { color: #f2c35a; font-weight: 700; }
.g-cell-act { display: flex; gap: 8px; margin-top: 4px; }
.g-ack1 { background: #fff; color: #b9261f; border: 0; font-weight: 800; }
.g-live1 { background: transparent; color: #fff; border-color: #ff9a95; }
@media (max-width: 900px) { .g-alarm { grid-template-columns: 1fr; } .g-clock { font-size: 24px; } .g-counters { grid-template-columns: repeat(2, 1fr); } .g-count b { font-size: 30px; } }

/* ---------- Connexion ---------- */
body.guest { min-height: 100vh; background: radial-gradient(circle at 20% 20%, #2bb56a33, transparent 40%), radial-gradient(circle at 80% 80%, #2f7fd633, transparent 40%), linear-gradient(135deg, #0f2e1f, #123a52); }
.login { min-height: 92vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 34px; box-shadow: 0 25px 60px rgba(0,0,0,.35); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-mark { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 18px; }
.login-brand .brand-mark .ico { width: 34px; height: 34px; }
.login-brand h1 { justify-content: center; margin: 0 0 4px; }
.login-brand p { color: var(--muted); margin: 0; font-size: 13px; }
.login form label { margin-bottom: 14px; }

/* Boitiers Mawjoud : commande d'installation */
.code-block { padding: 12px 14px; border-radius: 10px; background: #0f2e1f; color: #c8f2d8; font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; user-select: all; }

/* Liaison des appareils d'un site direct VPS (solutions A / B / C) */
.link-choices { display: grid; gap: 8px; margin-top: 8px; }
.link-choice { display: flex !important; flex-direction: row !important; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid #dfe7f1; cursor: pointer; }
.link-choice input { margin-top: 3px; flex: none; accent-color: #1f8f55; }
.link-choice small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.link-choice:has(input:checked) { border-color: #1f8f55; background: #f1faf4; }
.link-choice.off { opacity: .6; cursor: not-allowed; }
.cx-list { display: grid; gap: 8px; margin: 10px 0; }
.cx { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid #dfe7f1; }
.cx > div { min-width: 0; }
.cx-st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .8em; }
.cx-st.ok { background: #1f8f55; } .cx-st.warn { background: #c98a12; } .cx-st.ko { background: #c0392b; } .cx-st.na { background: #9aa8b6; } .cx-st.run { background: #3b6fb6; }
.cx small { display: block; color: var(--muted); }
.cx-val { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9em; white-space: nowrap; }

/* Mes notifications */
.switch-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border-radius: 12px; background: #f4f7fb; cursor: pointer; }
.switch-row input { width: 22px; height: 22px; flex: none; accent-color: #1f8f55; }
.switch-row small { display: block; color: var(--muted); font-weight: 400; }

/* Application mobile : connexion par telephone et telechargement */
.m-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 16px; background: #eef3f0; border-radius: 12px; }
.m-tabs a { padding: 9px; text-align: center; border-radius: 9px; font-weight: 700; color: var(--muted); text-decoration: none; }
.m-tabs a.on { background: #fff; color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.m-note { text-align: center; margin-top: 14px; }
.app-dl { margin-top: 10px; display: flex; gap: 6px; justify-content: center; }
.app-card { max-width: 720px; }
.app-dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }
.app-os { padding: 16px; border-radius: 14px; background: #f4f7fb; border: 1px solid #dfe7f1; }
.app-os h3 { margin: 0 0 10px; }
.app-os ol { padding-left: 18px; margin: 12px 0 0; }
.app-os li { margin-bottom: 6px; }
.app-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #0f2e1f, #1d5a7a); }
.app-banner > .ico { width: 30px; height: 30px; color: #7fe0a8; }
.app-banner div { flex: 1; min-width: 200px; }
.app-banner small { display: block; opacity: .8; }
@media (max-width: 600px) { .app-dl-grid { grid-template-columns: 1fr; } .login-card { padding: 24px 20px; } }

/* ---------- Mobile ---------- */
@media (max-width: 1000px) {
  .grid2, .grid2.even { grid-template-columns: 1fr; }
  .live.g3 { grid-template-columns: repeat(2, 1fr); }
  .live.g4, .live.g8 { grid-template-columns: repeat(4, 1fr); }
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 30px rgba(0,0,0,.3); }
  .side.open { transform: none; }
  .burger { display: block; }
  .user-chip div { display: none; }
  .user-chip { padding: 3px; }
  .tbl { display: block; overflow-x: auto; }
}
@media (max-width: 600px) {
  .wrap { padding: 14px; }
  .top { padding: 8px 14px; }
  .live.g2, .live.g3 { grid-template-columns: 1fr; }
  .live.g4, .live.g8 { grid-template-columns: repeat(2, 1fr); }
}

/* Sonnerie du poste de garde : toujours active, coupure reservee aux administrateurs */
.g-siren { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; background: #1f6f43; color: #fff; font-weight: 700; }
.g-siren.off { background: #8a5a00; }
.g-mute { background: #173226; border: 1px solid #2b4c3b; color: #e8f1ec; border-radius: 10px; padding: 8px 10px; }
.g-unlock { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(5, 15, 10, .88); cursor: pointer; }
.g-unlock[hidden] { display: none; }
.g-unlock > div { display: grid; justify-items: center; gap: 10px; max-width: 520px; padding: 30px; text-align: center; color: #fff; }
.g-unlock .ico { width: 70px; height: 70px; color: #f2c35a; animation: gbump 1.2s infinite; }
.g-unlock strong { font-size: 28px; }
.g-unlock small { color: #b9d3c3; font-size: 15px; }

/* Notifications : choix des cameras */
.cam-pick { padding: 14px; border-radius: 12px; background: #f4f7fb; border: 1px dashed #b9cbe3; }
.cam-pick .lbl { font-weight: 700; color: #2f5f9e; display: flex; gap: 6px; align-items: center; }
.cam-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; margin-top: 8px; }
.cam-list[hidden] { display: none; }
.cam-list label.check { padding-top: 0; }
.mail-switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-left: 5px solid #2bb56a; }
.mail-switch.off { border-left-color: #e5484d; background: #fff5f5; }
.mail-switch > span { display: grid; gap: 2px; }
.mail-switch > span .ico { display: none; }
.cam-lbl { display: inline-grid; line-height: 1.25; }
.cam-lbl small { color: #6b7a72; font-size: 12px; }
.cam-list label.check { align-items: flex-start; }
.g-stop { background: #fff; color: #b9261f; border: 0; font-weight: 900; font-size: 18px; padding: 12px 22px; animation: gstop 1s infinite; }
.g-stop[hidden] { display: none; }
@keyframes gstop { 50% { background: #ffd9d6; box-shadow: 0 0 24px #e5484d; } }

/* Etat du systeme et des connexions (tableau de bord) */
.sys-card { border-left: 5px solid #2bb56a; }
.sys-card.warn { border-left-color: #f08c00; }
.sys-card h2 { flex-wrap: wrap; gap: 8px; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.sys-m { background: #f3f7f5; border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.sys-m span { color: #5d6b63; font-size: 12px; }
.sys-m b { font-size: 22px; color: #13261b; }
.sys-m small { color: #6b7a72; font-size: 12px; }
.sys-m.hot { background: #fff1e6; } .sys-m.hot b { color: #c25100; }
.sys-svc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sys-warn { list-style: none; padding: 10px 12px; margin: 8px 0; background: #fff6e6; border-radius: 10px; color: #8a4b00; display: grid; gap: 4px; }
.sys-warn .ico { width: 15px; height: 15px; vertical-align: -2px; }
.sys-prob td { vertical-align: top; }
.sys-prob tr td:last-child { color: #b9261f; font-weight: 600; }
.sys-ok summary { cursor: pointer; color: #1f7a4c; font-weight: 600; padding: 6px 0; }

/* ---------- Poste de garde : tableau de surveillance (style centre de controle) ---------- */
body.gd { --gd-bg: #08132a; --gd-panel: #0e1d3a; --gd-line: #1d3260; --gd-text: #e6eefc; --gd-muted: #8ea3c7;
  background: radial-gradient(1200px 600px at 20% -10%, #12285a 0, transparent 60%), var(--gd-bg); color: var(--gd-text);
  display: flex; min-height: 100vh; font-size: 14px; }
.gd .ico { width: 18px; height: 18px; }
.gd-side { width: 230px; flex: none; background: linear-gradient(180deg, #0c1a36, #091327); border-right: 1px solid var(--gd-line);
  display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.gd-brand { display: flex; align-items: center; gap: 10px; }
.gd-brand strong { display: block; font-size: 20px; letter-spacing: .02em; }
.gd-brand small { color: var(--gd-muted); }
.gd-logo { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #2bb56a, #136b3c); color: #fff; }
.gd-logo .ico { width: 26px; height: 26px; }
.gd-side nav { display: grid; gap: 4px; }
.gd-side nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--gd-text); font-weight: 600; text-decoration: none; }
.gd-side nav a:hover { background: #142a52; }
.gd-side nav a.on { background: linear-gradient(90deg, #1f6fe0, #1a5bc0); box-shadow: 0 6px 18px #1f6fe055; }
.gd-pill { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: #e5484d; color: #fff; font-size: 12px; font-weight: 800; text-align: center; }
.gd-promo { margin-top: auto; border-radius: 14px; padding: 18px 14px; text-align: center; background: linear-gradient(160deg, #1d5a33, #0f2e1a); border: 1px solid #2b7a4b; }
.gd-promo .ico { width: 54px; height: 54px; color: #8ff0b4; }
.gd-promo p { margin: 6px 0 0; font-style: italic; font-weight: 700; color: #e8fff0; }
.gd-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gd-top { display: flex; align-items: center; gap: 16px; padding: 12px 22px; border-bottom: 1px solid var(--gd-line); background: #0b1834cc; flex-wrap: wrap; }
.gd-badge { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: #11335a; color: #4ade80; border: 1px solid #1f4f7d; }
.gd-badge .ico { width: 28px; height: 28px; }
.gd-title strong { display: block; font-size: 21px; }
.gd-title small { color: var(--gd-muted); font-style: italic; font-size: 14px; }
.gd-when { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.gd-when span { display: inline-flex; align-items: center; gap: 6px; color: var(--gd-muted); }
.gd-when b { color: var(--gd-text); }
.gd .g-clock { font: 700 26px/1 Consolas, monospace; margin: 0; }
.gd-sys { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: #0f3d26; border: 1px solid #1f7a45; color: #7ef0a8; font-weight: 700; }
.gd-sys.ko { background: #3b0f0d; border-color: #e5484d; color: #ff9a95; }
.gd-user { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.gd-burger { display: none; color: var(--gd-text); }
.gd-actions { padding: 10px 22px 0; }
.gd-actions .btn:not(.g-stop) { background: #142a52; border-color: #24407a; color: var(--gd-text); }
.gd .g-mute { background: #142a52; border-color: #24407a; color: var(--gd-text); width: auto; }
.gd [hidden] { display: none !important; }
.gd .inline-form { display: inline; }
.gd-show { background: #b9261f !important; border-color: #e5484d !important; color: #fff !important; font-weight: 800; animation: gstop 1s infinite; }
.gd-show[hidden] { display: none; }
.gd-main { padding: 16px 22px 22px; display: grid; gap: 16px; }
.gd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.gd-kpi { position: relative; display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto auto; column-gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 14px; border: 1px solid; min-height: 96px; }
.gd-kpi b { grid-column: 2; font: 800 34px/1 system-ui, sans-serif; color: #fff; }
.gd-kpi .lbl { grid-column: 2; font-weight: 600; color: #e6eefc; }
.gd-kpi .sub { grid-column: 2; font-weight: 700; }
.gd-kpi-ico { grid-row: 1 / 4; grid-column: 1; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: #ffffff1c; }
.gd-kpi-ico .ico { width: 34px; height: 34px; }
.gd-kpi.k-blue { background: linear-gradient(135deg, #12346b, #0f2550); border-color: #2d5bb0; } .k-blue .sub { color: #7ab8ff; }
.gd-kpi.k-red { background: linear-gradient(135deg, #5a1418, #3b0f12); border-color: #a3262c; } .k-red .sub { color: #ff9a95; } .k-red .gd-kpi-ico { color: #ff5a5f; }
.gd-kpi.k-green { background: linear-gradient(135deg, #0f4a2a, #0b321e); border-color: #22874d; } .k-green .sub { color: #7ef0a8; } .k-green .gd-kpi-ico { color: #8ff0b4; }
.gd-kpi.k-purple { background: linear-gradient(135deg, #3b1d6e, #28154d); border-color: #6a3fc0; } .k-purple .sub { color: #c4a6ff; } .k-purple .gd-kpi-ico { color: #c4a6ff; }
.gd-kpi.k-amber { background: linear-gradient(135deg, #6b4a0c, #4a3208); border-color: #c08a1d; } .k-amber .sub { color: #ffd277; } .k-amber .gd-kpi-ico { color: #ffc23d; }
.gd-kpi.hot { box-shadow: 0 0 22px #e5484d77; } .gd-kpi.k-green.hot { box-shadow: 0 0 22px #2bb56a88; }
.gd-kpi.bump b { animation: gbump .6s; }
.gd-panel { background: var(--gd-panel); border: 1px solid var(--gd-line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.gd-ph { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.gd-ph h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; color: #fff; }
.gd-muted { color: var(--gd-muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.gd-ph .gd-muted, .gd-ph .gd-link, .gd-ph .gd-ok, .gd-ph .gd-warn, .gd-ph .gd-soon { margin-left: auto; }
.gd-tools { margin-left: 10px; display: inline-flex; gap: 8px; align-items: center; }
.gd-link { color: #cfe0ff; font-size: 13px; }
.gd-ok { color: #4ade80; font-weight: 700; font-size: 13px; } .gd-warn { color: #ffc23d; font-weight: 700; font-size: 13px; }
.gd-soon { font-size: 12px; padding: 2px 8px; border-radius: 8px; background: #1d3260; color: #9fc1ff; }
.gd-row { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(300px, 1fr); gap: 16px; }
.gd-col { display: grid; gap: 16px; align-content: start; }
.gd-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.gd-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gd-tile { position: relative; margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid #23396a; background: #000; }
.gd-tile.alerting { border-color: #e5484d; box-shadow: 0 0 0 2px #e5484d66; }
.gd-tile-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: linear-gradient(180deg, #000c, transparent); font-size: 13px; pointer-events: none; }
.gd-tile-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-chip { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #14532d; color: #86efac; }
.gd-chip.ko { background: #5a1418; color: #ff9a95; }
.gd-tile-time { margin-left: auto; font: 12px Consolas, monospace; color: #fff; white-space: nowrap; }
.gd-tile-det { position: absolute; left: 8px; bottom: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 8px; font-weight: 700; font-size: 13px; color: #fff; max-width: calc(100% - 60px); pointer-events: none; }
.gd-tile-det span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-tile-det .ico { width: 16px; height: 16px; flex: none; }
.gd-tile-det.ok { background: #14532dd9; } .gd-tile-det.danger { background: #b9261fe6; } .gd-tile-det.info { background: #1f5bc0e6; }
.gd-tile-det.farm { background: #1f7a45f0; box-shadow: 0 0 14px #2bb56a; }
.gd-tile-btn { position: absolute; right: 8px; bottom: 8px; z-index: 2; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: #000a; color: #fff; }
.gd-empty { grid-column: 1 / -1; color: var(--gd-muted); display: flex; gap: 8px; align-items: center; padding: 30px; justify-content: center; }
.gd-calm { margin-top: 10px; display: flex; align-items: center; gap: 8px; color: #7ef0a8; font-weight: 600; }
.gd-calm[hidden] { display: none; }
.gd-map-box { position: relative; height: 230px; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #24412a, #31522e 40%, #3d5b2c 60%, #2b4627); }
.gd-map-grid { position: absolute; inset: 0; background-image: linear-gradient(#ffffff10 1px, transparent 1px), linear-gradient(90deg, #ffffff10 1px, transparent 1px); background-size: 28px 28px; }
.gd-map-msg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 4px; padding: 20px 120px 20px 20px; color: #fff; }
.gd-map-msg .ico { width: 40px; height: 40px; color: #ff6b66; }
.gd-map-msg small { color: #d8ecd9; }
.gd-legend { position: absolute; right: 8px; bottom: 8px; margin: 0; padding: 8px 10px; list-style: none; background: #0b1834e6; border-radius: 8px; font-size: 12px; display: grid; gap: 3px; }
.gd-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.l-blue { background: #3b82f6; } .l-red { background: #e5484d; } .l-green { background: #22c55e; } .l-amber { background: #f59e0b; }
.gd-alerts { border-color: #5a1f2a; background: linear-gradient(180deg, #2a1020, var(--gd-panel) 40%); }
.gd-alist { display: grid; gap: 6px; }
.gd-aitem { display: grid; grid-template-columns: 54px 22px 1fr auto; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; background: #ffffff08; }
.gd-aitem.acked { opacity: .55; }
.gd-aitem img, .gd-aitem .noimg { width: 54px; height: 38px; object-fit: cover; border-radius: 6px; background: #000; }
.gd-aitem strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-aitem small { display: block; color: var(--gd-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-aitem > div { min-width: 0; }
.gd-aico { color: #f59e0b; } .sev-critique .gd-aico { color: #ff5a5f; } .sev-info .gd-aico { color: #60a5fa; } .gd-aitem.farm .gd-aico { color: #4ade80; }
.gd-atime { display: grid; justify-items: end; gap: 3px; font: 12px Consolas, monospace; color: var(--gd-muted); }
.gd-sev { font: 700 11px system-ui, sans-serif; font-style: normal; padding: 2px 8px; border-radius: 8px; color: #fff; background: #1f5bc0; }
.gd-sev.critique { background: #dc2626; } .gd-sev.attention { background: #f59e0b; color: #1d1300; } .gd-sev.farm { background: #16a34a; }
.gd-states { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.gd-states div { display: grid; justify-items: center; gap: 4px; padding: 8px 2px; border-radius: 10px; background: #ffffff06; }
.gd-states .ico { width: 28px; height: 28px; }
.gd-states span { font-size: 12px; color: var(--gd-muted); }
.gd-states b { font-size: 13px; }
.gd-states .ok .ico, .gd-states .ok b { color: #4ade80; } .gd-states .ko .ico, .gd-states .ko b { color: #ff6b66; }
.gd-farm { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.gd-fcard { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: linear-gradient(135deg, #0f3d26, #0e2a1d); border: 1px solid #1f7a45; min-width: 0; }
.gd-fcard img, .gd-fimg { width: 74px; height: 74px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid #2bb56a; display: grid; place-items: center; background: #0b2416; color: #8ff0b4; }
.gd-fimg .ico { width: 40px; height: 40px; }
.gd-fcard > div { min-width: 0; display: grid; gap: 2px; }
.gd-fcard small { color: #c8e9d4; font-size: 12px; }
.gd-fst { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #8ea3c7; }
.gd-fst i { width: 9px; height: 9px; border-radius: 50%; background: #8ea3c7; } .gd-fst.on { color: #4ade80; } .gd-fst.on i { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.gd-fempty { display: flex; gap: 12px; align-items: center; color: var(--gd-muted); padding: 8px; }
.gd-fempty .ico { width: 54px; height: 54px; color: #4ade80; flex: none; }
.gd-fempty p { margin: 0; color: var(--gd-text); } .gd-fempty small { display: block; color: var(--gd-muted); }
.gd-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.gd-events li { display: grid; grid-template-columns: 12px 70px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.gd-events li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-events i { width: 10px; height: 10px; border-radius: 50%; background: #60a5fa; }
.gd-events .critique i { background: #ef4444; } .gd-events .attention i { background: #f59e0b; } .gd-events .farm i { background: #22c55e; }
.gd-events b { font: 12px Consolas, monospace; color: var(--gd-muted); }
.gd-overlay { position: fixed; inset: 0; z-index: 60; background: #050b18e8; overflow-y: auto; padding: 24px; display: grid; align-content: start; gap: 12px; }
.gd-overlay[hidden] { display: none; }
.gd-min { justify-self: end; background: #142a52; border-color: #24407a; color: #fff; }
/* Detections en direct : coeur du poste de garde, sans clic (direct de la camera + capture + "J'ai vu") */
.gd-det { border-color: #1f4f7d; }
.gd-det.on { border: 2px solid #e5484d; background: linear-gradient(180deg, #3a1018, var(--gd-panel) 60%); }
.ringing .gd-det.on { animation: gdetblink 1s infinite; }
@keyframes gdetblink { 50% { box-shadow: 0 0 0 4px #e5484d88, 0 0 30px #e5484d66; } }
.gd-det.farm.on { border-color: #2bb56a; background: linear-gradient(180deg, #0f3d26, var(--gd-panel) 60%); }
.gd-det .gd-ph h2 { font-size: 20px; }
.gd-det .g-ackall { margin-left: 8px; }
.gd-dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.gd-dgrid[data-n="0"] { display: none; }
.gd-dgrid[data-n="1"] { grid-template-columns: minmax(0, 900px); }
.gd-dgrid[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gd-dcam { margin: 0; border-radius: 12px; overflow: hidden; background: #0a1428; border: 2px solid #a3262c; display: flex; flex-direction: column; }
.gd-dcam.sev-attention { border-color: #c08a1d; } .gd-dcam.sev-info { border-color: #2d5bb0; } .gd-dcam.farm { border-color: #22874d; }
.gd-dcam.fresh { animation: gdetnew 1s 3; }
@keyframes gdetnew { 50% { transform: scale(1.01); box-shadow: 0 0 24px #e5484d; } }
.gd-dmedia { position: relative; aspect-ratio: 16 / 9; background: #000; }
.gd-dmedia .tile-img, .gd-dmedia .gd-dfull { position: absolute; inset: 0; width: 100%; height: 100%; }
.gd-dmedia .tile-img img, .gd-dmedia .tile-img video, .gd-dmedia .gd-dfull { width: 100%; height: 100%; object-fit: contain; display: block; }
.gd-dmedia .tile-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #9fb3d6; }
.gd-dmedia .noimg { display: grid; place-items: center; height: 100%; color: var(--gd-muted); }
.gd-dtag { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px;
  background: #b9261fe6; color: #fff; font-weight: 800; font-size: 15px; }
.gd-dcam.farm .gd-dtag { background: #1f7a45f0; } .gd-dcam.sev-attention .gd-dtag { background: #b7791fe6; } .gd-dcam.sev-info .gd-dtag { background: #1f5bc0e6; }
.gd-dlive { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px;
  background: #000a; color: #fff; font: 700 12px system-ui, sans-serif; letter-spacing: .05em; }
.gd-dlive i { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; animation: gstop 1s infinite; }
.gd-dsnap { position: absolute; right: 8px; bottom: 8px; width: 30%; max-width: 220px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 4px 14px #000a; }
.gd-dcam figcaption { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; flex-wrap: wrap; }
.gd-dcam figcaption > div { min-width: 0; display: grid; gap: 2px; }
.gd-dcam figcaption strong { font-size: 17px; color: #fff; }
.gd-dcam figcaption small { color: var(--gd-muted); }
.gd-dcam .gd-dmsg { color: #e6eefc; }
.gd-cact { display: flex; gap: 6px; align-items: center; }
.gd-cact .g-ack1 { background: #fff; color: #b9261f; border-color: #fff; font-weight: 800; font-size: 16px; padding: 10px 18px; }
.gd-cact .btn:not(.g-ack1) { background: #142a52; border-color: #24407a; color: var(--gd-text); }
.gd-det .gd-calm { margin: 0; padding: 14px; border-radius: 10px; background: #0f3d2633; font-size: 15px; }

/* Mosaique du poste de garde : 4, 8, 16 ou 32 cameras */
.gd-tiles.n8, .gd-tiles.n16 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gd-tiles.n32 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.gd-tiles.n8 .gd-tile-top, .gd-tiles.n16 .gd-tile-top, .gd-tiles.n32 .gd-tile-top { font-size: 11px; padding: 3px 5px; }
.gd-tiles.n16 .gd-chip, .gd-tiles.n16 .gd-tile-time, .gd-tiles.n32 .gd-chip, .gd-tiles.n32 .gd-tile-time { display: none; }
.gd-tiles.n16 .gd-tile-det, .gd-tiles.n32 .gd-tile-det { font-size: 11px; padding: 2px 6px; left: 4px; bottom: 4px; }
.gd-tiles.n16 .gd-tile-det span, .gd-tiles.n32 .gd-tile-det span, .gd-tiles.n32 .gd-tile-btn { display: none; }
@media (max-width: 1250px) { .gd-tiles.n32 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Notifications (cloche) et fiche detaillee d'une alerte */
.gd-top { position: sticky; top: 0; z-index: 50; }
.gd-bell { position: relative; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  background: #142a52; border: 1px solid #24407a; color: var(--gd-text); }
.gd-bell .ico { width: 22px; height: 22px; }
.gd-bell.hot { color: #ffd277; border-color: #c08a1d; }
.gd-bell-n { position: absolute; top: -6px; right: -6px; min-width: 20px; padding: 1px 5px; border-radius: 10px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 800; }
.gd-notif { position: absolute; top: calc(100% + 4px); right: 12px; width: min(440px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; z-index: 55;
  background: var(--gd-panel); border: 1px solid var(--gd-line); border-radius: 14px; padding: 10px; box-shadow: 0 18px 40px #000b; }
.gd-notif-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.gd-notif-head strong { display: inline-flex; align-items: center; gap: 6px; }
.gd-aitem[data-id] { cursor: pointer; } .gd-aitem[data-id]:hover { background: #ffffff14; }
.gd-aitem.unread { box-shadow: inset 3px 0 0 #ffc23d; }
.gd-detail { position: fixed; inset: 0; z-index: 80; background: #050b18d9; display: grid; place-items: center; padding: 14px; overflow-y: auto; }
.gd-dcard { position: relative; width: min(560px, 100%); background: var(--gd-panel); border: 1px solid var(--gd-line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.gd-detail.sev-critique .gd-dcard { border-color: #e5484d; } .gd-detail.farm .gd-dcard { border-color: #2bb56a; }
.gd-dclose { position: absolute; top: 10px; right: 10px; z-index: 2; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; background: #000a; border: 1px solid #24407a; color: #fff; }
.gd-dimg img { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 10px; background: #000; }
.gd-dcard h2 { margin: 0; font-size: 19px; display: flex; align-items: center; gap: 8px; color: #fff; }
.gd-detail.sev-critique h2 .ico { color: #ff5a5f; } .gd-detail.farm h2 .ico { color: #4ade80; }
.gd-dmsg { margin: 0; font-size: 15px; }
.gd-dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; margin: 0; }
.gd-dl dt { color: var(--gd-muted); } .gd-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.gd-dact { display: flex; flex-wrap: wrap; gap: 8px; }
.gd-dact .btn:not(.g-ack) { background: #142a52; border-color: #24407a; color: var(--gd-text); }
@media (max-width: 1250px) { .gd-row { grid-template-columns: 1fr; } .gd-row3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .gd-side { position: fixed; z-index: 70; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .gd-side.open { transform: none; box-shadow: 10px 0 30px #000a; }
  .gd-burger { display: block; } .gd-row3 { grid-template-columns: 1fr; } .gd-tiles { grid-template-columns: 1fr; }
  .gd-when { margin-left: 0; } .gd-user { display: none; } .gd-main, .gd-top, .gd-actions { padding-left: 12px; padding-right: 12px; }
  .gd-states { grid-template-columns: repeat(3, 1fr); }
  /* Telephone : menu, titre et cloche sur la premiere ligne, heure et etat en dessous */
  .gd-top { gap: 8px 10px; padding-top: 8px; padding-bottom: 8px; }
  .gd-badge, .gd-title small, .gd-tpre { display: none; }
  .gd-burger { order: 0; } .gd-title { order: 1; flex: 1; min-width: 0; } .gd-bell { order: 2; } .gd-when { order: 3; gap: 10px; } .gd-sys { order: 4; padding: 5px 10px; }
  .gd-title strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gd .g-clock { font-size: 18px; }
  .gd-notif { right: 8px; }
  .gd-actions { display: flex; flex-wrap: wrap; gap: 6px; } .gd-show { order: -1; width: 100%; justify-content: center; }
  .gd-tiles.n8, .gd-tiles.n16, .gd-tiles.n32 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .gd-dgrid, .gd-dgrid[data-n="1"], .gd-dgrid[data-n="2"] { grid-template-columns: 1fr; }
  .gd-cact { width: 100%; } .gd-cact .g-ack1 { flex: 1; justify-content: center; }
  .gd-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gd-kpi { grid-template-columns: 36px 1fr; column-gap: 8px; padding: 8px 10px; min-height: 0; }
  .gd-kpi-ico { width: 36px; height: 36px; } .gd-kpi-ico .ico { width: 20px; height: 20px; }
  .gd-kpi b { font-size: 24px; } .gd-kpi .lbl { font-size: 12px; } .gd-kpi .sub { font-size: 11px; }
  .gd-overlay { padding: 12px; } .gd .g-multi-head .g-alarm-title { font-size: 18px; flex-wrap: wrap; }
}
