:root {
  --U: 26px;
  --bg: #0a0f1a; --panel: #0f1726; --panel2: #131d30; --line: #22304a;
  --text: #d8e3f2; --mut: #8494ad; --acc: #38bdf8;
  --ok: #22c55e; --warn: #f59e0b; --crit: #ef4444; --info: #60a5fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.35 "Segoe UI", system-ui, -apple-system, sans-serif; overflow: hidden; }
body { display: grid; grid-template-rows: auto 1fr 200px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden, [hidden] { display: none !important; }

/* ---------------------------------------------------------------- en-tête */
#top { display: flex; align-items: center; gap: 14px; padding: 7px 12px; background: linear-gradient(#111b2e, #0c1422); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.brand b { display: block; font-size: 15px; letter-spacing: .4px; }
.brand small { display: block; color: var(--mut); font-size: 11px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpis { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.kpi { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; white-space: nowrap; flex: none; }
.kpi small { display: block; color: var(--mut); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.kpi b { font-size: 14px; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; color: var(--mut); font-size: 11px; margin-left: 4px; }
.kpi.warn { border-color: #92400e; background: #2a1d0b; }
.kpi.crit { border-color: #991b1b; background: #2c1010; animation: kpiBlink 1s infinite alternate; }
@keyframes kpiBlink { to { background: #451414; } }
.who { display: flex; align-items: center; gap: 8px; flex: none; }
.conn { font-size: 14px; }
.conn.on { color: var(--ok); text-shadow: 0 0 6px var(--ok); }
.conn.off { color: var(--crit); }
#nick { width: 120px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }

/* ---------------------------------------------------------------- disposition */
#main { display: grid; grid-template-columns: 250px minmax(0, 1fr) 370px; min-height: 0; }
aside { background: var(--panel); overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: #2b3a55 transparent; }
#lib { border-right: 1px solid var(--line); }
#insp { border-left: 1px solid var(--line); }
.side-title { padding: 10px 12px 6px; font-weight: 600; font-size: 13px; }
.side-title small { color: var(--mut); font-weight: 400; margin-left: 4px; }
.search { width: calc(100% - 20px); margin: 0 10px 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }

/* bibliothèque */
.lib-cat { padding: 8px 12px 4px; color: var(--acc); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.lib-item { margin: 3px 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel2); cursor: grab; display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.lib-item:hover { border-color: #35507a; background: #172440; }
.lib-item:active { cursor: grabbing; }
.lib-item b { display: block; font-size: 12px; }
.lib-item small { display: block; color: var(--mut); font-size: 10.5px; line-height: 1.25; }
.lib-thumb { height: 22px; border-radius: 2px; position: relative; border: 1px solid #0006; }
.lib-thumb span { position: absolute; right: 2px; bottom: 1px; font-size: 8px; color: #fff; text-shadow: 0 0 2px #000; }

/* ---------------------------------------------------------------- scène */
#stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#toolbar { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); background: #0d1524; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { background: var(--panel2); border: 0; padding: 4px 10px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: #1d4ed8; color: #fff; }
.seg button:hover:not(.on) { background: #1a2a47; }
.zoom #zFit { min-width: 62px; font-variant-numeric: tabular-nums; }
.tl { display: inline-flex; align-items: center; gap: 5px; color: var(--mut); font-size: 12px; }
select { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.swatches { display: inline-flex; gap: 3px; }
.swatches button { width: 16px; height: 16px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatches button.on { border-color: #fff; }
.swatches button.auto { background: conic-gradient(#3b82f6, #22d3ee, #facc15, #ef4444, #3b82f6); }
.grow { flex: 1; }
.btn { background: #1d4ed8; border: 1px solid #2563eb; border-radius: 7px; padding: 4px 11px; color: #fff; }
.btn:hover { background: #2563eb; }
.btn.ghost { background: var(--panel2); border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: #1a2a47; }
.btn.danger { background: #7f1d1d; border-color: #b91c1c; }
.btn.danger:hover { background: #991b1b; }
.btn.okb { background: #14532d; border-color: #15803d; }
.btn.sm { padding: 2px 8px; font-size: 12px; }
#hint { position: absolute; left: 50%; top: 50px; transform: translateX(-50%); z-index: 20; background: #0c4a6e; border: 1px solid #0ea5e9; color: #e0f2fe; padding: 6px 14px; border-radius: 20px; box-shadow: 0 6px 20px #0008; white-space: nowrap; }

#viewport { flex: 1; overflow: auto; position: relative; min-height: 0;
  background-color: #0b111c;
  background-image: linear-gradient(#ffffff07 1px, transparent 1px), linear-gradient(90deg, #ffffff07 1px, transparent 1px);
  background-size: 60px 60px; cursor: default; scrollbar-color: #2b3a55 #0b111c; }
#viewport.panning { cursor: grabbing; }
#sizer { position: relative; }
#floor { position: absolute; left: 0; top: 0; transform-origin: 0 0; display: flex; align-items: flex-start; gap: 100px; padding: 92px 100px 70px; width: max-content; }
.tray { position: absolute; top: 26px; height: 34px; left: 60px; right: 60px; border: 1px solid #3c4658; border-radius: 3px;
  background: repeating-linear-gradient(90deg, #2e3747 0 3px, transparent 3px 26px), linear-gradient(#141a24, #1b2230); pointer-events: none; }
.tray::after { content: 'CHEMIN DE CÂBLES'; position: absolute; right: 8px; top: -15px; font-size: 9px; letter-spacing: 2px; color: #4b5a73; }

/* ---------------------------------------------------------------- baie */
.rack { width: 600px; flex: none; position: relative; background: #12161d; border: 1px solid #2b3340; border-radius: 6px 6px 3px 3px; box-shadow: 0 16px 40px #000a, inset 0 0 0 1px #0006; }
.rack-head { height: 46px; padding: 5px 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; background: linear-gradient(#1f2636, #171c28); border-bottom: 1px solid #2b3340; border-radius: 6px 6px 0 0; cursor: pointer; }
.rack-head:hover { background: linear-gradient(#253049, #1a2131); }
.rack.sel .rack-head { box-shadow: inset 0 0 0 2px var(--acc); }
.rk-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-kind { color: var(--mut); font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; }
.rk-stats { text-align: right; font-size: 11px; color: var(--mut); font-variant-numeric: tabular-nums; }
.rk-stats b { color: var(--text); }
.rk-bar { width: 110px; height: 4px; background: #0b0f16; border-radius: 2px; overflow: hidden; margin-top: 3px; margin-left: auto; }
.rk-bar i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .6s; }
.rack-body { display: grid; grid-template-columns: 30px 1fr 30px; position: relative; }
.rail { position: relative; background: #252a33 linear-gradient(transparent 0 2px, #07090c 2px 6px, transparent 6px) center top / 7px calc(var(--U) / 3) repeat-y; }
.rail::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #ffffff08, transparent 40%, #0005); pointer-events: none; }
.rail span { position: absolute; width: 100%; height: var(--U); font-size: 8.5px; color: #6b7686; display: flex; align-items: center; justify-content: flex-start; padding-left: 2px; font-variant-numeric: tabular-nums; }
.rail.r span { justify-content: flex-end; padding-right: 2px; }
.bay { position: relative; background: linear-gradient(90deg, #07090d, #0d1118 15%, #0d1118 85%, #07090d); }
.bay .slot-line { position: absolute; left: 0; right: 0; height: 1px; background: #ffffff05; }
.rack-foot { height: 24px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; font-size: 10.5px; color: var(--mut); background: #171c26; border-top: 1px solid #2b3340; border-radius: 0 0 3px 3px; }
.pdu { display: inline-flex; align-items: center; gap: 5px; }
.pdu::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 5px var(--ok); }
.pdu.off::before { background: var(--crit); box-shadow: 0 0 5px var(--crit); }
.pdu.dead::before { background: #374151; box-shadow: none; }
.dropghost { position: absolute; left: 0; right: 0; border: 2px dashed #22d3ee; background: #22d3ee1f; display: none; pointer-events: none; z-index: 6; border-radius: 2px; }
.dropghost.bad { border-color: var(--crit); background: #ef44441f; }
.dropghost span { position: absolute; left: 6px; top: 2px; font-size: 10px; color: #a5f3fc; }
.add-rack { width: 220px; flex: none; align-self: stretch; min-height: 400px; border: 2px dashed #2a3954; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--mut); cursor: pointer; }
.add-rack:hover { border-color: var(--acc); color: var(--acc); }
.add-rack b { font-size: 34px; font-weight: 300; }

/* ---------------------------------------------------------------- équipement */
.dev { position: absolute; left: -12px; right: -12px; display: flex; z-index: 2; border-radius: 2px; }
.dev:hover { z-index: 3; }
.dev:hover .face { box-shadow: inset 0 0 0 1px #60a5fa88; }
.dev.sel { z-index: 3; }
.dev.sel .face { box-shadow: inset 0 0 0 2px var(--acc), 0 0 14px #38bdf855; }
.dev.dragging { opacity: .4; }
.ear { width: 12px; flex: none; background: linear-gradient(90deg, #3a404a, #2a2f37); position: relative; border-radius: 2px; }
.ear::after { content: ''; position: absolute; left: 3px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: radial-gradient(#9aa3ad, #4b525c); box-shadow: inset 0 0 0 1px #0007; }
.face { flex: 1; display: flex; align-items: center; gap: 7px; padding: 0 7px; height: 100%; overflow: hidden; position: relative; min-width: 0; border-top: 1px solid #ffffff12; border-bottom: 1px solid #0008; cursor: pointer; }
.face .nm { font: 600 9.5px/1.1 ui-monospace, Consolas, monospace; white-space: nowrap; }
.face .md { font-size: 8px; opacity: .65; white-space: nowrap; }
.lbl { display: flex; flex-direction: column; min-width: 0; flex: none; }
.sp { flex: 1; min-width: 4px; }
.sled { width: 7px; height: 7px; border-radius: 50%; background: #2b2f36; flex: none; box-shadow: inset 0 0 0 1px #0007; }
.dev[data-st=up] .sled { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dev[data-st=booting] .sled { background: #60a5fa; box-shadow: 0 0 6px #60a5fa; animation: blink .5s steps(2) infinite; }
.dev[data-st=failed] .sled, .dev[data-st=thermal] .sled { background: var(--crit); box-shadow: 0 0 6px var(--crit); animation: blink .35s steps(2) infinite; }
.dev[data-red="1"] .sled { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.dev[data-st=off] .face, .dev[data-st=nopower] .face { filter: brightness(.42) saturate(.4); }
.dev[data-st=failed] .face { background-image: repeating-linear-gradient(135deg, #ef444433 0 6px, transparent 6px 12px) !important; }
.dev[data-st=thermal] .face { box-shadow: inset 0 0 18px #f97316aa; }
.badge { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); font: 700 9px/1 system-ui; padding: 3px 6px; border-radius: 3px; background: #000c; color: #fff; z-index: 4; pointer-events: none; letter-spacing: .5px; }
.badge.b-booting { background: #1e3a8acc; }
.badge.b-failed, .badge.b-thermal { background: #991b1bdd; }
.badge.b-nopower, .badge.b-off { background: #111827dd; color: #9ca3af; }
@keyframes blink { 50% { opacity: .15; } }

/* skins */
.skin-unifi .face { background: linear-gradient(180deg, #f3f5f7, #d5dae0); color: #1f2937; }
.skin-unifi .ear { background: linear-gradient(90deg, #e5e8ec, #c5cbd2); }
.skin-router .face, .skin-gpu .face { background: linear-gradient(#2e343d, #1e2229); color: #cbd5e1; }
.skin-server .face { background: linear-gradient(#2b2f36, #1c1f24); color: #d1d5db; }
.skin-nas .face { background: linear-gradient(#232a37, #171c26); color: #d1d5db; }
.skin-gpu .face { border-left: 3px solid #84cc16; }
.skin-patch .face { background: linear-gradient(#17191d, #0f1013); color: #e5e7eb; align-items: flex-end; padding-bottom: 2px; }
.skin-fiber .face { background: linear-gradient(#1d2127, #14171b); color: #e5e7eb; align-items: flex-end; padding-bottom: 2px; }
.skin-odf .face { background: linear-gradient(#23272e, #191c21); color: #fde68a; border-left: 4px solid #facc15; }
.skin-cablemgr .face { background: repeating-linear-gradient(90deg, #0b0c0f 0 9px, #262a31 9px 13px); cursor: default; }
.skin-cablemgr .face::before { content: ''; position: absolute; inset: 40% 0; background: #08090b; }
.skin-blank .face { background: linear-gradient(#191b20, #121418); }
.skin-ups .face { background: linear-gradient(#272b33, #1a1d23); color: #d1d5db; }
.skin-patch .lbl, .skin-fiber .lbl { align-self: center; }

.lcd { background: #04131f; color: #7dd3fc; font: 600 7.5px/1.2 ui-monospace, Consolas, monospace; padding: 2px 4px; border-radius: 2px; width: 64px; height: 19px; overflow: hidden; white-space: nowrap; flex: none; box-shadow: inset 0 0 0 1px #000; }
.dev[data-st=off] .lcd, .dev[data-st=nopower] .lcd, .dev[data-st=failed] .lcd { color: transparent; }
.ups-lcd { background: #052e16; color: #86efac; font: 600 9px/1.35 ui-monospace, Consolas, monospace; padding: 4px 7px; border-radius: 3px; width: 150px; box-shadow: inset 0 0 0 1px #000; }
.ups-lcd.batt { background: #3b2105; color: #fdba74; }
.ups-lcd.dead { background: #111; color: #444; }
.ups-btns { display: flex; gap: 6px; }
.ups-btns i { width: 14px; height: 14px; border-radius: 50%; background: #3a404a; box-shadow: inset 0 -2px 0 #0007; }
.grill { flex: 1; align-self: stretch; margin: 4px 0; background: radial-gradient(circle, #0b0c0f 1.4px, transparent 1.6px) 0 0 / 6px 6px; opacity: .8; }

.bays { display: grid; gap: 2px; flex: none; align-self: stretch; margin: 3px 0; }
.bays i { background: linear-gradient(#3b414a, #262a31); border-radius: 1px; position: relative; box-shadow: inset 0 0 0 1px #0006; }
.bays i::after { content: ''; position: absolute; right: 2px; top: 2px; width: 2px; height: 2px; border-radius: 50%; background: #1f2937; }
.dev[data-st=up] .bays i::after { background: #4ade80; animation: blink .9s steps(2) infinite; }
.dev[data-st=up] .bays i:nth-child(3n)::after { animation-duration: .45s; }
.dev[data-st=up] .bays i:nth-child(4n+1)::after { animation-duration: 1.3s; }
.tag { background: #e5e7eb; color: #111; font: 700 8.5px/1 ui-monospace, Consolas, monospace; padding: 2px 4px; border-radius: 2px; white-space: nowrap; }
.skin-unifi .tag { background: #1f2937; color: #f3f4f6; }

/* ---------------------------------------------------------------- ports */
.pg { display: grid; grid-auto-flow: column; gap: 2px 2px; flex: none; }
.pg.seq { grid-auto-flow: row; }
.port { position: relative; display: block; flex: none; cursor: crosshair; }
.p-rj { width: 12px; height: 9px; background: #0a0b0d; border: 1px solid #424852; border-radius: 1px; }
.p-rj::after { content: ''; position: absolute; left: 3px; right: 3px; bottom: -1px; height: 2px; background: inherit; border: 1px solid #424852; border-top: 0; }
.skin-unifi .p-rj { border-color: #8d949e; background: #22262b; }
.skin-unifi .p-rj::after { border-color: #8d949e; }
.p-sfp { width: 15px; height: 8px; background: linear-gradient(#c4cad1, #8f969f); border-radius: 1px; box-shadow: inset 0 0 0 1.5px #6b727b; }
.p-sfp::after { content: ''; position: absolute; inset: 2px 2px; background: #0b0c0e; }
.p-qsfp { width: 20px; height: 10px; background: linear-gradient(#c4cad1, #8f969f); border-radius: 1px; box-shadow: inset 0 0 0 1.5px #6b727b; }
.p-qsfp::after { content: ''; position: absolute; inset: 2px 2px; background: #0b0c0e; }
.p-lc { width: 12px; height: 10px; background: #0e7490; border-radius: 2px; box-shadow: inset 0 0 0 1px #0007; }
.p-lc::after { content: ''; position: absolute; left: 2px; top: 3px; width: 3px; height: 3px; border-radius: 50%; background: #062a33; box-shadow: 5px 0 0 #062a33; }
.skin-odf .p-lc { background: #15803d; width: 16px; height: 12px; }
.skin-odf .p-lc::after { left: 3px; top: 4px; box-shadow: 7px 0 0 #062a33; }
.port > i { position: absolute; top: 1px; right: 1px; width: 3px; height: 3px; border-radius: 50%; z-index: 2; }
.p-sfp > i, .p-qsfp > i { top: -3px; right: auto; left: 50%; margin-left: -1.5px; }
.port.num::before { content: attr(data-n); position: absolute; left: -3px; right: -3px; top: -10px; text-align: center; font: 7px/1 system-ui; color: #9ca3af; }
.skin-odf .port .ol { position: absolute; top: -10px; left: -6px; right: -6px; text-align: center; font: 600 6.5px/1 system-ui; color: #fde68a; white-space: nowrap; }
.port.plug { box-shadow: inset 0 0 0 30px var(--plug); }
.port.plug::after { background: var(--plug); }
.p-rj.plug::after { border-color: var(--plug); }
.port.off { outline: 1px dashed #ef4444aa; }
/* LED : couleur = vitesse négociée, clignotement = activité */
.lk-100 > i, .lk-25 > i, .lk-10 > i { background: #22c55e; box-shadow: 0 0 4px #22c55e; }
.lk-2 > i { background: #38bdf8; box-shadow: 0 0 4px #38bdf8; }
.lk-1 > i { background: #f59e0b; box-shadow: 0 0 4px #f59e0b; }
.lk-b > i { background: #f97316 !important; box-shadow: 0 0 4px #f97316 !important; }
.lk-l > i { animation: blink .5s steps(2) infinite; }
.a1 > i { animation: blink 1.4s steps(2) infinite; animation-delay: var(--d, 0s); }
.a2 > i { animation: blink .55s steps(2) infinite; animation-delay: var(--d, 0s); }
.a3 > i { animation: blink .2s steps(2) infinite; animation-delay: var(--d, 0s); }
.port:hover { outline: 2px solid #fbbf24; outline-offset: 1px; z-index: 4; }
#floor.cabling .port { opacity: .3; }
#floor.cabling .port.cand { opacity: 1; outline: 2px solid #22d3ee; outline-offset: 1px; animation: cand 1s ease-in-out infinite alternate; }
#floor.cabling .port.origin { opacity: 1; outline: 2px solid #fbbf24; outline-offset: 2px; }
@keyframes cand { to { outline-color: #22d3ee44; } }
.port.hl { outline: 2px solid #fbbf24; outline-offset: 1px; z-index: 4; }

/* ---------------------------------------------------------------- câbles */
#cables { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 5; }
#cables .hit { fill: none; stroke: transparent; stroke-width: 9; pointer-events: stroke; cursor: pointer; }
#cables .base { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .88; transition: opacity .2s; }
#cables .flow { fill: none; stroke: #fff; stroke-linecap: round; stroke-dasharray: .1 11; opacity: .9; }
#cables .st-B .base { stroke-dasharray: 7 5; }
#cables .st-B .flow, #cables .st-D .flow, #cables .st-O .flow, #cables .st-L .flow { display: none; }
#cables .st-D .base, #cables .st-O .base { opacity: .4; stroke-dasharray: 2 4; }
#cables .st-L .base { animation: learn .5s ease-in-out infinite alternate; }
@keyframes learn { to { opacity: .3; } }
#cables .cut .base { stroke: #ef4444 !important; stroke-dasharray: 5 3; opacity: 1; }
#cables .sat .flow { stroke: #fecaca; }
#cables .sat .base { filter: drop-shadow(0 0 3px #ef4444); }
#cables .dim { opacity: .1; }
#cables .gone { display: none; }
#cables .hl .base { stroke-width: 4.5 !important; opacity: 1; }
#cables .hl .flow { stroke-width: 3.2 !important; }
#cables .cut-mark { fill: #ef4444; font: 700 13px system-ui; }
#cables .rubber { fill: none; stroke: #fbbf24; stroke-width: 2; stroke-dasharray: 5 4; }
#floor.cabling #cables .hit { pointer-events: none; }
#floor.nocables #cables { display: none; }

/* ---------------------------------------------------------------- topologie */
#topoview { flex: 1; overflow: auto; position: relative; background: #0b111c radial-gradient(#ffffff0a 1px, transparent 1px) 0 0 / 22px 22px; min-height: 0; }
#topoSvg { display: block; }
.tn rect.box { fill: #131d30; stroke: #2c3e5e; stroke-width: 1.2; rx: 7; }
.tn:hover rect.box { stroke: var(--acc); }
.tn.sel rect.box { stroke: var(--acc); stroke-width: 2.4; }
.tn .stripe { rx: 2; }
.tn text { fill: var(--text); font: 600 11.5px system-ui; }
.tn text.sub { fill: var(--mut); font: 400 9.5px system-ui; }
.tn { cursor: pointer; }
.tn.inet rect.box { fill: #1a1a0c; stroke: #a16207; }
.tl-layer { fill: #4b5a73; font: 600 10px system-ui; letter-spacing: 1.5px; }
.te .base { fill: none; stroke-linecap: round; }
.te .flow { fill: none; stroke: #fff; stroke-dasharray: .1 12; stroke-linecap: round; }
.te.st-B .base { stroke-dasharray: 7 5; }
.te.st-B .flow, .te.st-D .flow, .te.st-O .flow, .te.st-L .flow { display: none; }
.te.st-D .base, .te.st-O .base { opacity: .35; stroke-dasharray: 2 5; }
.te.st-L .base { animation: learn .5s infinite alternate; }
.te.sat .flow { stroke: #fecaca; }
.te text { fill: #94a3b8; font: 9.5px system-ui; paint-order: stroke; stroke: #0b111c; stroke-width: 3px; }
.te { cursor: pointer; }
.te .hit { fill: none; stroke: transparent; stroke-width: 10; }

/* ---------------------------------------------------------------- inspecteur */
.ih { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(#131d30, #0f1726); position: sticky; top: 0; z-index: 2; }
.ih .kind { color: var(--acc); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; }
.ih input.title { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 5px; font-size: 17px; font-weight: 700; padding: 2px 4px; margin-left: -5px; }
.ih input.title:hover, .ih input.title:focus { border-color: var(--line); background: var(--panel2); outline: 0; }
.ih .sub { color: var(--mut); font-size: 11.5px; }
.isec { padding: 10px 14px; border-bottom: 1px solid #1a2539; }
.isec h4 { margin: 0 0 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--mut); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 6px; }
.stat { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.stat > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
.stat small { display: block; color: var(--mut); font-size: 10px; text-transform: uppercase; }
.stat b { font-size: 15px; font-variant-numeric: tabular-nums; }
.bar { height: 5px; background: #0b0f16; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .5s, background .5s; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: #1f2937; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.up { color: #4ade80; background: #052e16; }
.pill.booting { color: #93c5fd; background: #172554; }
.pill.off, .pill.nopower { color: #9ca3af; }
.pill.failed, .pill.thermal { color: #fca5a5; background: #450a0a; }
.pill.warn { color: #fcd34d; background: #422006; }
.pill.passive { color: #a5b4fc; background: #1e1b4b; }
label.f { display: grid; gap: 3px; font-size: 11px; color: var(--mut); }
label.f input, label.f select { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; color: var(--text); }
.ptable { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ptable th { text-align: left; color: var(--mut); font-weight: 500; font-size: 10px; text-transform: uppercase; padding: 3px 4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.ptable td { padding: 3px 4px; border-bottom: 1px solid #172236; vertical-align: middle; }
.ptable tr:hover td { background: #131f35; }
.ptable tr.sel td { background: #172a4a; }
.ptable .peer { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11px; color: var(--mut); }
.ptable button:hover { color: var(--text); border-color: var(--acc); }
.led { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2b2f36; }
.led.F { background: #22c55e; box-shadow: 0 0 5px #22c55e; }
.led.L { background: #60a5fa; animation: blink .5s steps(2) infinite; }
.led.B { background: #f97316; }
.led.D { background: #ef4444; }
.led.O { background: #6b7280; }
.ubar { width: 46px; height: 5px; background: #0b0f16; border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; }
.ubar i { display: block; height: 100%; width: 0; background: var(--ok); }
.chain { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.chain .hop { padding: 4px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); }
.chain .hop.pas { color: var(--mut); font-size: 11px; margin-left: 14px; }
.chain .lnk { margin-left: 14px; font-size: 10.5px; color: var(--mut); display: flex; align-items: center; gap: 5px; }
.chain .lnk i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.mini { width: 100%; height: 70px; display: block; background: #0b111c; border-radius: 6px; border: 1px solid var(--line); }
.legend { display: grid; grid-template-columns: auto 1fr; gap: 4px 9px; font-size: 11.5px; align-items: center; }
.legend i { width: 22px; height: 6px; border-radius: 3px; display: inline-block; }
.legend i.dot { width: 8px; height: 8px; border-radius: 50%; margin-left: 7px; }
.help { color: var(--mut); font-size: 12px; line-height: 1.5; margin: 0; padding-left: 16px; }
.help b { color: var(--text); }
.circ { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px solid #172236; }
.circ:last-child { border: 0; }
.toggle { position: relative; width: 34px; height: 18px; background: #374151; border-radius: 10px; border: 0; padding: 0; flex: none; transition: background .2s; }
.toggle::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle.on { background: #16a34a; }
.toggle.on::after { left: 18px; }
.devlist { display: flex; flex-direction: column; gap: 2px; }
.devlist button { display: flex; justify-content: space-between; gap: 8px; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 8px; font-size: 11.5px; }
.devlist button:hover { border-color: var(--acc); }
.devlist small { color: var(--mut); }

/* ---------------------------------------------------------------- dock */
#dock { display: grid; grid-template-columns: 1.25fr 1fr 1fr; border-top: 1px solid var(--line); background: var(--panel); min-height: 0; }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.pane:last-child { border-right: 0; }
.pane-h { padding: 6px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--mut); display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid #1a2539; }
.pane-h select { font-size: 11px; padding: 1px 4px; text-transform: none; }
.lg { text-transform: none; letter-spacing: 0; display: flex; gap: 4px; align-items: center; font-size: 10.5px; }
.lg i { width: 10px; height: 3px; display: inline-block; border-radius: 2px; margin-left: 6px; }
#log { flex: 1; overflow: auto; font-size: 11.5px; padding: 2px 0; scrollbar-width: thin; }
.ev { display: grid; grid-template-columns: 58px 1fr; gap: 6px; padding: 2px 10px; border-left: 3px solid transparent; }
.ev time { color: #64748b; font-variant-numeric: tabular-nums; }
.ev.ok { border-left-color: var(--ok); }
.ev.info { border-left-color: #334155; }
.ev.warn { border-left-color: var(--warn); color: #fde68a; }
.ev.crit { border-left-color: var(--crit); color: #fecaca; background: #ef444411; }
.ev .by { color: #64748b; margin-left: 4px; font-size: 10.5px; }
.ev.new { animation: evIn 1.2s; }
@keyframes evIn { from { background: #38bdf833; } }
#chart { flex: 1; width: 100%; min-height: 0; display: block; }
#incidents { flex: 1; overflow: auto; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
#incidents .btn { font-size: 12px; padding: 4px 9px; }
#incidents .lbl2 { width: 100%; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--mut); margin-top: 2px; }
#incidents input[type=range] { flex: 1; accent-color: var(--acc); }
.inc-on { background: #7f1d1d !important; border-color: #ef4444 !important; animation: kpiBlink 1s infinite alternate; }

/* ---------------------------------------------------------------- divers */
#tip { position: fixed; z-index: 100; pointer-events: none; background: #050a12f2; border: 1px solid #2c3e5e; border-radius: 7px; padding: 6px 9px; font-size: 11.5px; max-width: 320px; box-shadow: 0 8px 24px #000a; }
#tip b { color: #fff; }
#tip .m { color: var(--mut); }
#toasts { position: fixed; right: 16px; top: 64px; z-index: 120; display: flex; flex-direction: column; gap: 6px; }
.toast { background: #0f1726; border: 1px solid var(--line); border-left: 4px solid var(--info); padding: 8px 12px; border-radius: 7px; box-shadow: 0 8px 24px #000a; max-width: 360px; font-size: 12.5px; animation: tin .25s; }
.toast.err, .toast.crit { border-left-color: var(--crit); }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } }
#modal { position: fixed; inset: 0; background: #0009; z-index: 110; display: flex; align-items: center; justify-content: center; }
.mbox { width: 560px; max-width: 92vw; max-height: 82vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 20px 60px #000c; }
.mhead { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mhead button { background: none; border: 0; font-size: 16px; color: var(--mut); }
#mBody { padding: 10px 14px; overflow: auto; }
.pick-dev { margin-top: 8px; }
.pick-dev > b { display: block; font-size: 12px; margin-bottom: 3px; }
.pick-dev > b small { color: var(--mut); font-weight: 400; }
.pick-ports { display: flex; flex-wrap: wrap; gap: 4px; }
.pick-ports button { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; font-size: 11.5px; }
.pick-ports button:hover { border-color: var(--acc); background: #172a4a; }

/* ---------------------------------------------------------------- terrain */
#siteview { flex: 1; overflow: auto; position: relative; min-height: 0; background: #0d1a10; }
#siteSizer { position: relative; }
#site { position: absolute; left: 0; top: 0; transform-origin: 0 0; border-radius: 6px;
  background-color: #1f3a22;
  background-image:
    linear-gradient(#ffffff0d 1px, transparent 1px), linear-gradient(90deg, #ffffff0d 1px, transparent 1px),
    radial-gradient(circle at 20% 30%, #2a4a2c 0 18%, transparent 40%), radial-gradient(circle at 75% 70%, #1a321c 0 20%, transparent 45%);
  background-size: 40px 40px, 40px 40px, 100% 100%, 100% 100%;
  box-shadow: inset 0 0 0 3px #5b4a2f, inset 0 0 0 6px #2b2417, 0 10px 40px #000a; }
#site::before { content: 'TERRAIN'; position: absolute; right: 14px; bottom: 8px; font: 700 11px system-ui; letter-spacing: 4px; color: #ffffff22; }
.si { position: absolute; border-radius: 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; text-align: center; overflow: hidden; z-index: 2; box-shadow: 0 4px 10px #0008; user-select: none; }
.si:hover { box-shadow: 0 0 0 2px #60a5fa, 0 4px 10px #0008; z-index: 4; }
.si.sel { box-shadow: 0 0 0 3px var(--acc), 0 0 18px #38bdf888; z-index: 4; }
.si.dragging { opacity: .35; }
.si .nm { font: 700 10.5px/1.1 system-ui; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.si .val { font: 600 10px/1.1 ui-monospace, Consolas, monospace; color: #e2e8f0; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.si .ico { font-size: 18px; line-height: 1; filter: drop-shadow(0 1px 2px #000); }
.si .stb { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #475569; box-shadow: 0 0 0 1px #0008; }
.si[data-st=on] .stb, .si[data-st=charge] .stb { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.si[data-st=starting] .stb, .si[data-st=discharge] .stb { background: var(--warn); box-shadow: 0 0 6px var(--warn); animation: blink .5s steps(2) infinite; }
.si[data-st=failed] .stb, .si[data-st=nopower] .stb { background: var(--crit); box-shadow: 0 0 6px var(--crit); animation: blink .4s steps(2) infinite; }
.si[data-st=standby] .stb, .si[data-st=idle] .stb { background: #60a5fa; }
.si[data-st=failed] { background-image: repeating-linear-gradient(135deg, #ef444455 0 6px, transparent 6px 12px) !important; }
.si[data-st=off] { filter: saturate(.3) brightness(.7); }
/* bâtiments */
.si-salle { background: linear-gradient(#3b4252, #2a303c); border: 2px solid #5b6577; padding: 6px; justify-content: flex-start; align-items: stretch; }
.si-salle .roof { display: flex; justify-content: space-between; align-items: center; }
.si-salle .nm { font-size: 12px; }
.si-salle .racks { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin: 6px 4px; align-items: center; }
.si-salle .racks i { height: 70%; background: linear-gradient(#111827, #1f2937); border: 1px solid #4b5563; border-radius: 2px; position: relative; }
.si-salle .racks i::after { content: ''; position: absolute; left: 30%; right: 30%; top: 15%; height: 3px; background: #22c55e; box-shadow: 0 6px 0 #22c55e, 0 12px 0 #38bdf8; animation: blink 1.1s steps(2) infinite; }
.si-salle .racks i.slot { background: transparent; border: 1px dashed #ffffff22; }
.si-salle .racks i.slot::after { display: none; }
.si-salle .foot { display: flex; justify-content: space-between; font: 600 10px ui-monospace, Consolas, monospace; color: #cbd5e1; }
.si-salle .temp { padding: 1px 6px; border-radius: 10px; background: #166534; color: #fff; font: 700 10.5px system-ui; }
.si-salle .temp.warn { background: #b45309; }
.si-salle .temp.crit { background: #b91c1c; animation: kpiBlink 1s infinite alternate; }
.si-salle .shed { position: absolute; inset: 0; background: #000b; color: #fca5a5; font: 700 13px system-ui; display: none; align-items: center; justify-content: center; letter-spacing: 1px; }
.si-salle.is-shed .shed { display: flex; }
.si-salle .heat { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(#ef444400, #ef4444aa); opacity: 0; transition: opacity 1s; }
.si-salle .cool { height: 4px; background: #0b0f16; border-radius: 2px; overflow: hidden; }
.si-salle .cool i { display: block; height: 100%; background: #38bdf8; width: 0; transition: width .6s; }
.si-poste-hta { background: linear-gradient(#6b7280, #4b5563); border: 2px solid #9ca3af; }
.si-centrale-gaz { background: linear-gradient(#78716c, #57534e); border: 2px solid #a8a29e; }
.si-centrale-gaz .smoke { position: absolute; left: 14px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: #e7e5e4aa; opacity: 0; }
.si-centrale-gaz[data-st=on] .smoke { animation: smoke 2.2s ease-out infinite; }
@keyframes smoke { 0% { transform: translate(0, 10px) scale(.4); opacity: .8; } 100% { transform: translate(8px, -14px) scale(1.8); opacity: 0; } }
.si-centrale-solaire { background: #0b1f3a repeating-linear-gradient(90deg, transparent 0 21px, #94a3b8 21px 23px), #0b1f3a; border: 2px solid #94a3b8; }
.si-centrale-solaire::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 17px, #94a3b8aa 17px 18px), linear-gradient(135deg, #1e3a8a, #1e40af 40%, #3b82f6 50%, #1e40af 60%); opacity: .85; z-index: -1; }
.si-centrale-solaire .sunv { position: absolute; inset: 0; background: #fde04722; opacity: 0; transition: opacity 1s; pointer-events: none; }
.si-eolienne { background: radial-gradient(circle, #4d7c0f55, transparent 70%); box-shadow: none; overflow: visible; }
.si-eolienne svg { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); overflow: visible; }
.si-eolienne .nm, .si-eolienne .val { position: relative; top: 26px; }
.si-groupe-electrogene { background: linear-gradient(#ca8a04, #a16207); border: 2px solid #facc15; flex-direction: row; gap: 6px; }
.si-batteries { background: linear-gradient(#166534, #14532d); border: 2px solid #22c55e; }
.si-batteries .bat { width: 70%; height: 6px; background: #052e16; border-radius: 3px; overflow: hidden; }
.si-batteries .bat i { display: block; height: 100%; background: #4ade80; width: 0; transition: width .6s; }
.si-clim-crac, .si-groupe-froid { background: linear-gradient(#e2e8f0, #94a3b8); border: 2px solid #cbd5e1; }
.si-clim-crac .nm, .si-groupe-froid .nm { color: #0f172a; text-shadow: none; font-size: 9px; }
.si-clim-crac .val, .si-groupe-froid .val { color: #0f172a; text-shadow: none; font-size: 9px; }
.fan { width: 22px; height: 22px; border-radius: 50%; background: #1e293b; position: relative; box-shadow: inset 0 0 0 2px #475569; }
.fan svg { position: absolute; inset: 0; }
.si-clim-crac .fan { width: 20px; height: 20px; }
.si-clim-crac .nm { display: none; }
.fans { display: flex; gap: 4px; }
#siteSvg { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; overflow: visible; }
#siteSvg .pw { fill: none; stroke-linecap: round; stroke-linejoin: round; }
#siteSvg .pw.base { stroke: #a16207; stroke-width: 3; opacity: .55; }
#siteSvg .pw.flow { stroke: #fde047; stroke-width: 3.6; stroke-dasharray: .1 13; }
#siteSvg .cl.base { stroke: #0369a1; stroke-width: 4; opacity: .6; fill: none; }
#siteSvg .cl.flow { stroke: #7dd3fc; stroke-width: 4.4; stroke-dasharray: .1 12; fill: none; stroke-linecap: round; }
#siteSvg .idle .flow { display: none; }
#siteSvg .idle .base { stroke-dasharray: 3 5; opacity: .35; }
.siteghost { position: absolute; border: 2px dashed #22d3ee; background: #22d3ee22; border-radius: 5px; pointer-events: none; z-index: 6; display: none; }
.siteghost.bad { border-color: var(--crit); background: #ef444422; }
.mix { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #0b0f16; margin-top: 6px; }
.mix i { display: block; height: 100%; }
.te.mg { opacity: .28; }
.te.mg text { display: none; }

/* ---------------------------------------------------------------- serveur ouvert */
#srvwin { position: fixed; inset: 0; z-index: 105; background: #000a; display: flex; align-items: center; justify-content: center; }
.sw-box { width: min(1380px, 96vw); height: min(860px, 92vh); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 70px #000d; display: flex; flex-direction: column; overflow: hidden; }
.sw-head { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(#131d30, #0f1726); }
.sw-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sw-title .kind { color: var(--acc); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; }
.sw-title b { font-size: 19px; }
.sw-title small { color: var(--mut); font-size: 11.5px; }
.sw-actions { display: flex; gap: 6px; }
.sw-body { flex: 1; display: grid; grid-template-columns: 470px 1fr; min-height: 0; }
.sw-left { overflow: auto; padding: 10px 14px; border-right: 1px solid var(--line); }
.sw-left h4 { margin: 6px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--mut); }
.sw-left h4 small { text-transform: none; letter-spacing: 0; color: #64748b; margin-left: 4px; }
.fn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 12px; }
.fn { position: relative; display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 6px; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px; }
.fn:hover { border-color: #35507a; background: #172440; }
.fn.on { border-color: var(--acc); background: #0c2a44; box-shadow: inset 0 0 0 1px var(--acc); }
.fn .fi { grid-row: span 2; font-size: 19px; line-height: 26px; }
.fn b { font-size: 11.5px; line-height: 1.2; }
.fn small { font-size: 9.5px; color: var(--mut); line-height: 1.2; }
.fn em { position: absolute; top: 3px; right: 5px; font-style: normal; font-size: 9px; color: #fbbf24; }
.hw-row { display: grid; grid-template-columns: 1.25fr 1fr .65fr .9fr; gap: 6px; margin-bottom: 10px; }
.chassis { background: linear-gradient(#1c2230, #141924); border: 2px solid #3a4456; border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 7px; }
.ch-row { display: flex; gap: 5px; align-items: center; }
.ch-front { background: #0c0f15; padding: 4px; border-radius: 3px; }
.disk { flex: 1; height: 16px; border: 1px dashed #334155; border-radius: 2px; position: relative; }
.disk.on { border: 1px solid #475569; background: linear-gradient(#3b414a, #262a31); }
.disk.on::after { content: ''; position: absolute; right: 2px; top: 3px; width: 3px; height: 3px; border-radius: 50%; background: #1f2937; }
.disk.act::after { background: #4ade80; animation: blink .4s steps(2) infinite; animation-delay: var(--d); }
.ch-fans { justify-content: space-around; }
.ch-fans .fan { width: 34px; height: 34px; }
.ch-main { display: grid; grid-template-columns: 90px 1fr 90px 1fr; gap: 6px; align-items: stretch; }
.cpu { border-radius: 5px; padding: 6px 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #fff; background: #374151; transition: background 1s;
  background-image: repeating-linear-gradient(90deg, #ffffff22 0 2px, transparent 2px 6px) !important; min-height: 74px; }
.cpu b { font-size: 11px; } .cpu span { font-size: 9.5px; opacity: .85; } .cpu em { font-style: normal; font-size: 10px; font-weight: 700; margin-top: 3px; }
.dimms { display: flex; gap: 3px; align-items: stretch; }
.dimm { flex: 1; background: #1e2633; border: 1px solid #2c3647; border-radius: 1px; }
.dimm.on { background: #1d4ed8; border-color: #3b82f6; }
.dimm.used { background: #22c55e; border-color: #4ade80; }
.dimm.full { background: #ef4444; border-color: #f87171; }
.gpus { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.gpu { background: #10151d; border: 1px solid #365314; border-radius: 3px; padding: 3px 5px; font-size: 9.5px; color: #bef264; }
.ch-pcie { flex-wrap: wrap; }
.card { background: #0f3d2e; border: 1px solid #166534; border-radius: 3px; padding: 3px 6px; font-size: 9.5px; color: #bbf7d0; display: flex; flex-direction: column; gap: 3px; }
.card.bmc { background: #3b0d0d; border-color: #7f1d1d; color: #fecaca; }
.card div { display: flex; gap: 3px; }
.card i { width: 9px; height: 7px; background: #0b0f16; border: 1px solid #475569; border-radius: 1px; }
.card i.up { background: #22c55e; }
.card i.up.act { animation: blink .3s steps(2) infinite; }
.card i.wait { background: #f97316; }
.ch-rear { justify-content: flex-start; gap: 8px; }
.psu { padding: 6px 12px; border-radius: 4px; font: 700 10px system-ui; background: #374151; color: #9ca3af; border: 1px solid #4b5563; }
.psu.on { background: #14532d; color: #bbf7d0; border-color: #22c55e; }
.psu.off { background: #450a0a; color: #fca5a5; border-color: #ef4444; }
.ch-cap { margin-left: auto; font-size: 10.5px; color: var(--mut); }
.sw-right { padding: 12px 16px; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.monitor { flex: 1; display: flex; flex-direction: column; background: linear-gradient(#2a2f38, #1b1f26); border-radius: 14px; padding: 14px 14px 6px; box-shadow: 0 10px 30px #000a, inset 0 1px 0 #ffffff14; min-height: 0; }
.screen { flex: 1; background: #020805; border-radius: 6px; box-shadow: inset 0 0 40px #000, inset 0 0 0 2px #000; position: relative; overflow: hidden; min-height: 0;
  font: 12.5px/1.45 ui-monospace, Consolas, "Cascadia Mono", monospace; color: #b6f5c8; }
.screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, #ffffff05 0 1px, transparent 1px 3px); }
.scr-main { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 8px 10px; }
.scr-top { color: #0b1a10; background: #4ade80; padding: 1px 6px; border-radius: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.scr-dash { white-space: pre-wrap; padding: 6px 2px; border-bottom: 1px dashed #14532d; color: #d1fae5; }
.scr-dash b { color: #fff; }
.scr-dash .b { color: #4ade80; } .scr-dash .e { color: #14532d; }
.scr-dash.memwarn .b { color: #f87171; }
.scr-log { flex: 1; overflow: auto; padding: 4px 2px; min-height: 0; scrollbar-width: thin; scrollbar-color: #14532d transparent; }
.tln { white-space: pre-wrap; word-break: break-word; }
.tln.err, .scr-dash .err, .tln .err { color: #fca5a5; }
.tln.warn, .scr-dash .warn { color: #fde68a; }
.tln.sys { color: #93c5fd; }
.tln.dim { color: #4b7a5c; }
.tln.cmd { color: #fff; margin-top: 4px; }
.tln.ok, .scr-dash .ok { color: #86efac; }
.tln .ps { color: #4ade80; }
.tln .b { color: #4ade80; } .tln .e { color: #14532d; }
.scr-prompt { display: flex; gap: 8px; align-items: center; border-top: 1px dashed #14532d; padding-top: 5px; }
.scr-prompt span { color: #4ade80; white-space: nowrap; }
.term-in { flex: 1; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; caret-color: #4ade80; }
.scr-full { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.scr-full pre { margin: 0; white-space: pre-wrap; align-self: flex-start; width: 100%; font: inherit; }
.scr-full .boot { color: #d4d4d4; }
.scr-full .boot .cur { animation: blink .6s steps(2) infinite; }
.scr-full .panic { color: #fca5a5; }
.scr-full .panic.hot { color: #fdba74; }
.nosig { color: #475569; font: 600 18px system-ui; text-align: center; display: flex; flex-direction: column; gap: 6px; border: 1px solid #1e293b; padding: 14px 22px; border-radius: 6px; background: #050a12; }
.nosig small { font-size: 12px; font-weight: 400; color: #334155; }
.monitor-foot { display: flex; justify-content: space-between; align-items: center; padding: 5px 4px 0; font-size: 10px; color: #64748b; letter-spacing: .6px; }
.monitor-foot .pwr { width: 7px; height: 7px; border-radius: 50%; background: #374151; }
.monitor-foot .pwr.on { background: #22c55e; box-shadow: 0 0 6px #22c55e; }

/* ---------------------------------------------------------------- assistant de raccordement */
.mbox.wide { width: 820px; }
.asst h4 { margin: 12px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--mut); }
.asst h4 small { text-transform: none; letter-spacing: 0; }
.as-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.as-row { display: grid; grid-template-columns: 1fr 300px; gap: 8px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.as-row.none { opacity: .5; }
.as-row label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.as-row small { color: var(--mut); }
.as-row select { width: 100%; }
.as-dest { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.as-plan { background: #050a12; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: 12px/1.6 ui-monospace, Consolas, monospace; max-height: 190px; overflow: auto; }
.asst .err { color: #fca5a5; }
.asst .row label { display: inline-flex; gap: 5px; align-items: center; margin-right: 14px; }
.as-dest { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.as-dest select, .as-row select { width: 100%; min-width: 0; }
.as-row { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); }
.mbox.wide #mBody { overflow-x: hidden; }

/* ---------------------------------------------------------------- confirmation */
#confirm { position: fixed; inset: 0; z-index: 130; background: #0008; display: flex; align-items: center; justify-content: center; }
.cbox { width: 420px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; box-shadow: 0 20px 60px #000c; }
.cbox p { margin: 0 0 14px; font-size: 14px; line-height: 1.45; }

/* ---------------------------------------------------------------- onduleurs & PDU */
.pdu.onups::before { background: var(--warn); box-shadow: 0 0 6px var(--warn); animation: blink .8s steps(2) infinite; }
.pdu-row { display: grid; grid-template-columns: 46px 40px minmax(0, 1fr); gap: 6px; align-items: center; margin-top: 7px; }
.pdu-row small { grid-column: 3; color: var(--mut); font-size: 10.5px; }
.pdu-row select { min-width: 0; }
.pdu-src.site { color: #86efac; } .pdu-src.ups { color: #fcd34d; } .pdu-src.off { color: #fca5a5; }
.ups-feeds { display: flex; flex-direction: column; gap: 4px; }
.uf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 12px; }
.uf-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uf-row label { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.uf-row small { color: var(--mut); font-size: 10px; }

/* ---------------------------------------------------------------- lecture seule */
.lock { border-radius: 16px; padding: 3px 10px; font-size: 12px; border: 1px solid var(--line); background: var(--panel2); white-space: nowrap; }
.lock.ro { border-color: #a16207; background: #2a1d0b; color: #fde68a; }
.lock.tech { border-color: #15803d; background: #052e16; color: #bbf7d0; }
.asst .warn { color: #fde68a; }

/* ---------------------------------------------------------------- vue agrandie */
.port .pl { display: none; }
#bigface { position: fixed; inset: 0; z-index: 108; background: #000b; display: flex; align-items: center; justify-content: center; }
.bf-box { width: min(1500px, 96vw); max-height: 92vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 70px #000d; overflow: hidden; }
.bf-head { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(#131d30, #0f1726); }
.bf-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bf-title .kind { color: var(--acc); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; }
.bf-title b { font-size: 18px; }
.bf-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--mut); flex-wrap: wrap; }
.bf-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.bf-legend .pl-ex { border-radius: 2px; background: #22d3ee; }
.bf-hint { padding: 8px 16px; font-size: 12.5px; color: #bae6fd; background: #0c2a44; border-bottom: 1px solid var(--line); }
.bf-hint .cand-ex { outline: 2px solid #22d3ee; padding: 0 4px; border-radius: 3px; }
.bf-stage { padding: 26px 12px; display: flex; justify-content: center; overflow: auto; background: #0b111c radial-gradient(#ffffff08 1px, transparent 1px) 0 0 / 18px 18px; }
.bf-scale .dev { position: relative; left: auto; right: auto; width: 562px; height: auto !important; min-height: 26px; }
.bf-scale .face { height: auto; min-height: 26px; padding-top: 9px; padding-bottom: 9px; cursor: default; }
.bf-scale .pg { row-gap: 10px; }
.bf-scale .port { cursor: pointer; }
.bf-scale .port.num::before { display: none; }
.bf-scale .port .pl { display: block; position: absolute; left: -4px; right: -4px; top: calc(100% + 1px); text-align: center; font: 600 5.5px/1 system-ui; color: #cbd5e1; pointer-events: none; }
.bf-scale .skin-unifi .port .pl { color: #1f2937; }
.bf-scale .pg.r2 .port:nth-child(odd) .pl { top: auto; bottom: calc(100% + 1px); }
.bf-scale .skin-odf .port .ol { top: -9px; }
.bf-stage.cabling .port { opacity: .3; }
.bf-stage.cabling .port.cand { opacity: 1; outline: 1.5px solid #22d3ee; outline-offset: 1px; animation: cand 1s ease-in-out infinite alternate; }
.bf-stage.cabling .port.origin { opacity: 1; outline: 1.5px solid #fbbf24; }
.bf-list { padding: 10px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 4px 14px; overflow: auto; max-height: 28vh; border-top: 1px solid var(--line); }
.bf-pl { display: grid; grid-template-columns: 10px 48px 1fr; gap: 6px; align-items: center; font-size: 12px; padding: 2px 6px; border-radius: 5px; cursor: pointer; }
.bf-pl:hover { background: #172440; }
.bf-pl span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--mut); }

/* ---------------------------------------------------------------- bac à sable */
.lock.sb { border-color: #7c3aed; background: #1e1036; color: #ddd6fe; }
body.in-sandbox #top { background: linear-gradient(#1a1430, #0f0c1f); border-bottom-color: #4c1d95; }
.mode-list { display: flex; flex-direction: column; gap: 6px; }
.mode-opt { text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.mode-opt:hover { border-color: var(--acc); background: #172440; }
.mode-opt.on { border-color: #7c3aed; box-shadow: inset 0 0 0 1px #7c3aed; }
.mode-opt small { color: var(--mut); font-size: 11.5px; line-height: 1.35; }
.cbox:has(.mode-list) { width: 480px; }
