:root {
  --bg: #02070d;
  --bg2: #04101a;
  --panel: rgba(6, 22, 34, .62);
  --panel-solid: #071824;
  --line: rgba(62, 230, 255, .22);
  --line-strong: rgba(62, 230, 255, .55);
  --cyan: #3ee6ff;
  --cyan-2: #8ff3ff;
  --cyan-dim: rgba(62, 230, 255, .45);
  --text: #d6f7ff;
  --muted: #6f9fb0;
  --amber: #ffb547;
  --amber-dim: rgba(255, 181, 71, .35);
  --red: #ff4d5e;
  --green: #4dffb0;
  --glow: 0 0 12px rgba(62, 230, 255, .45);
  --f-hud: "Orbitron", "Rajdhani", system-ui, sans-serif;
  --f-body: "Rajdhani", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 30% 20%, #072235 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16px;
  letter-spacing: .02em;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { display: block; }

.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image:
    linear-gradient(rgba(62,230,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62,230,255,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
.bg-scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px);
}
.bg-scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 140px;
  background: linear-gradient(180deg, transparent, rgba(62,230,255,.05), transparent);
  animation: sweep 9s linear infinite;
}
@keyframes sweep { from { top: -140px; } to { top: 100%; } }

/* ---------- BOOT ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--bg); transition: opacity .8s ease, visibility .8s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-inner { width: min(560px, 90vw); }
.boot-logo { font-family: var(--f-hud); font-size: clamp(32px, 7vw, 56px); font-weight: 700; color: var(--cyan); letter-spacing: .3em; text-shadow: var(--glow); }
.boot-sub { font-family: var(--f-hud); font-size: 11px; color: var(--muted); letter-spacing: .35em; text-transform: uppercase; margin: 6px 0 26px; }
.boot-log { font-family: ui-monospace, monospace; font-size: 13px; color: var(--cyan-2); min-height: 9.5em; margin: 0 0 18px; white-space: pre-wrap; }
.boot-bar { height: 3px; background: var(--line); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--cyan); box-shadow: var(--glow); transition: width .3s; }

.lock-form { margin-top: 26px; }
.lock-form[hidden] { display: none; }
.lock-form label { display: block; font-family: var(--f-hud); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--amber); margin-bottom: 10px; animation: pulse 1.6s ease-in-out infinite; }
.lock-row { display: flex; border: 1px solid var(--line-strong); }
.lock-row input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: 600 20px var(--f-hud); letter-spacing: .3em; padding: 12px 14px; }
.lock-row button { border: 0; background: var(--cyan); color: var(--bg); font-family: var(--f-hud); font-size: 12px; letter-spacing: .2em; padding: 0 18px; text-transform: uppercase; }
.lock-err { color: var(--red); min-height: 1.4em; margin-top: 8px; font-size: 15px; }

/* ---------- TOPBAR ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(2,7,13,.95), rgba(2,7,13,.75));
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand-mark { width: 38px; height: 38px; }
.bm-ring { fill: none; stroke: var(--cyan); stroke-width: 2; stroke-dasharray: 6 4; transform-origin: center; animation: spin 12s linear infinite; }
.bm-ring2 { fill: none; stroke: var(--cyan-dim); stroke-width: 2; }
.bm-core { fill: var(--cyan); filter: drop-shadow(0 0 6px var(--cyan)); animation: pulse 2.4s ease-in-out infinite; }
.brand-name { font-family: var(--f-hud); font-weight: 700; letter-spacing: .28em; color: var(--cyan); text-shadow: var(--glow); }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: .18em; text-transform: uppercase; }
.chips { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px;
  border: 1px solid var(--line); background: rgba(62,230,255,.04);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  font-size: 14px; white-space: nowrap;
}
.chip b { font-family: var(--f-hud); font-weight: 600; font-size: 13px; color: var(--cyan-2); }
.chip.amber b { color: var(--amber); }
.chip.ok { border-color: rgba(77,255,176,.6); background: rgba(77,255,176,.08); box-shadow: 0 0 14px rgba(77,255,176,.18); }
.chip.ok b { color: var(--green); }
.chip.ok svg { color: var(--green); }
.chip.warn { border-color: rgba(255,77,94,.5); }
.chip.warn b { color: var(--red); }
.chip.warn svg { color: var(--red); }
.chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; color: var(--cyan); }
.chip.amber svg { color: var(--amber); }
.top-right { display: flex; align-items: center; gap: 14px; flex: none; }
.link-status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.link-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.link-status.ok .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.link-status.ko .dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.user { font-family: var(--f-hud); font-size: 13px; letter-spacing: .12em; padding: 6px 12px; border: 1px solid var(--line); text-transform: uppercase; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; background: transparent;
  border: 1px solid var(--line); color: var(--muted); transition: .2s;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn:hover { color: var(--cyan); border-color: var(--line-strong); }
.icon-btn[aria-pressed="true"] { color: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow); }
.icon-btn[aria-pressed="false"] .voice-wave { opacity: .25; }

/* ---------- LAYOUT ---------- */
.hud {
  position: relative; z-index: 1;
  display: grid; gap: 16px; padding: 18px 22px 28px;
  grid-template-columns: minmax(330px, 1fr) minmax(0, 1.25fr) minmax(0, 1.25fr);
  grid-template-areas:
    "core energy energy"
    "weather cams cams"
    "climate climate ops"
    "climate climate term";
  max-width: 2000px; margin: 0 auto;
}
.p-core { grid-area: core; }
.p-weather { grid-area: weather; }
.p-energy { grid-area: energy; }
.p-climate { grid-area: climate; }
.p-cams { grid-area: cams; }
.p-ops { grid-area: ops; }
.p-term { grid-area: term; }

.panel {
  position: relative; padding: 14px 16px 16px; min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  animation: panel-in .7s ease both;
}
.panel::before, .panel::after {
  content: ""; position: absolute; width: 22px; height: 22px; pointer-events: none;
  border-color: var(--cyan); border-style: solid; opacity: .8;
}
.panel::before { top: 0; right: 0; border-width: 2px 2px 0 0; }
.panel::after { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-family: var(--f-hud); font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--cyan);
}
.panel-head .idx { color: var(--muted); }
.panel-head .idx::after { content: " //"; }
.head-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.head-meta { font-family: var(--f-body); font-size: 13px; letter-spacing: .1em; color: var(--muted); text-transform: none; }
.sub-head { font-family: var(--f-hud); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }

/* ---------- REACTOR ---------- */
.p-energy { display: flex; flex-direction: column; }
.p-energy .chart { flex: 1; min-height: 200px; }
.reactor-wrap { position: relative; width: min(100%, 270px); aspect-ratio: 1; margin: 0 auto; }
.reactor { width: 100%; height: 100%; overflow: visible; }
.reactor circle, .reactor path { fill: none; }
.r-outer { stroke: var(--line); stroke-width: 1; }
.r-dash1 { stroke: var(--cyan-dim); stroke-width: 2; stroke-dasharray: 2 10; }
.r-dash2 { stroke: var(--cyan); stroke-width: 6; stroke-dasharray: 60 18 8 18; opacity: .55; }
.r-dash3 { stroke: var(--cyan-2); stroke-width: 1.5; stroke-dasharray: 3 6; }
.r-inner { stroke: var(--cyan); stroke-width: 1.5; opacity: .7; }
.r-glow { opacity: .14; animation: pulse 3s ease-in-out infinite; }
.r-seg { fill: rgba(62,230,255,.16); stroke: var(--cyan); stroke-width: 1; }
.r-power-track { stroke: rgba(62,230,255,.08); stroke-width: 10; }
.r-power { stroke: var(--cyan); stroke-width: 10; stroke-linecap: butt; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 1s ease, stroke .5s; filter: drop-shadow(0 0 6px var(--cyan)); }
.spin-slow, .spin-med, .spin-rev, .spin-rev-slow { transform-origin: 200px 200px; }
.spin-slow { animation: spin 60s linear infinite; }
.spin-med { animation: spin 24s linear infinite; }
.spin-rev { animation: spin 40s linear infinite reverse; }
.spin-rev-slow { animation: spin 90s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }

.reactor-center {
  position: absolute; inset: 31%; border-radius: 50%; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.reactor-center:focus-visible { outline: 2px solid var(--cyan); outline-offset: 6px; }
.r-time { font-family: var(--f-hud); font-weight: 600; font-size: clamp(28px, 3vw, 38px); color: #effdff; text-shadow: 0 0 18px rgba(62,230,255,.8); line-height: 1; }
.r-sec { font-family: var(--f-hud); font-size: 13px; color: var(--cyan); letter-spacing: .2em; }
.r-date { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; text-align: center; }
.greeting { text-align: center; font-size: 18px; margin: 10px 0 16px; color: var(--cyan-2); min-height: 1.4em; }
.greeting .caret { display: inline-block; width: 9px; height: 1em; background: var(--cyan); vertical-align: -2px; margin-left: 3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.flow-item { text-align: center; padding: 10px 6px; border: 1px solid var(--line); background: rgba(62,230,255,.03); position: relative; overflow: hidden; }
.flow-item .lbl { font-family: var(--f-hud); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.flow-item .val { font-family: var(--f-hud); font-size: 22px; font-weight: 600; margin-top: 4px; color: var(--cyan-2); }
.flow-item .val small { font-size: 12px; color: var(--muted); margin-left: 3px; }
.flow-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.flow-item.solar .val { color: var(--amber); }
.flow-item.solar { border-color: var(--amber-dim); }
.flow-item .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--cyan); box-shadow: var(--glow); transition: width 1s; }
.flow-item.solar .bar { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

/* ---------- WEATHER ---------- */
.wx-now { display: flex; align-items: center; gap: 16px; }
.wx-icon { width: 64px; height: 64px; flex: none; color: var(--cyan); }
.wx-icon svg, .wx-mini svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wx-temp { font-family: var(--f-hud); font-size: 48px; font-weight: 500; line-height: 1; }
.wx-temp sup { font-size: 20px; color: var(--cyan); }
.wx-cond { color: var(--cyan-2); font-size: 17px; }
.wx-range { color: var(--muted); font-size: 14px; }
.wx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; margin: 14px 0; }
.wx-stat { border-left: 2px solid var(--line-strong); padding-left: 8px; }
.wx-stat .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.wx-stat .v { font-family: var(--f-hud); font-size: 15px; }
.wx-hours { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.wx-h { flex: none; width: 52px; text-align: center; padding: 6px 0; border: 1px solid var(--line); font-size: 13px; }
.wx-h .t { color: var(--muted); font-size: 12px; }
.wx-h .wx-mini { width: 22px; height: 22px; margin: 4px auto; color: var(--cyan); }
.wx-h b { font-family: var(--f-hud); font-weight: 500; font-size: 13px; }
.wx-days { margin-top: 10px; display: grid; gap: 4px; }
.wx-d { display: grid; grid-template-columns: 70px 24px 34px 1fr 34px 54px; align-items: center; gap: 8px; font-size: 14px; }
.wx-d .wx-mini { width: 22px; height: 22px; color: var(--cyan); }
.wx-d .lo { color: var(--muted); text-align: right; font-family: var(--f-hud); font-size: 12px; }
.wx-d .hi { font-family: var(--f-hud); font-size: 12px; }
.wx-d .rain { color: var(--cyan-2); font-size: 12px; text-align: right; }
.wx-track { height: 4px; background: rgba(62,230,255,.08); position: relative; }
.wx-track span { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, var(--cyan), var(--amber)); }

/* ---------- ENERGY ---------- */
.seg { display: flex; border: 1px solid var(--line); }
.seg button { background: transparent; border: 0; padding: 4px 10px; font-family: var(--f-hud); font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.seg button.on { color: var(--bg); background: var(--cyan); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { border: 1px solid var(--line); padding: 10px 12px; background: rgba(62,230,255,.03); }
.kpi .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .16em; }
.kpi .v { font-family: var(--f-hud); font-size: 24px; font-weight: 600; margin: 4px 0 2px; }
.kpi .v small { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 400; }
.kpi .s { font-size: 13px; color: var(--muted); }
.kpi .s .up { color: var(--red); }
.kpi .s .down { color: var(--green); }
.kpi.hot { border-color: var(--line-strong); box-shadow: inset 0 0 24px rgba(62,230,255,.08); }
.kpi.hot .v { color: var(--cyan-2); text-shadow: var(--glow); }
.kpi.solar .v { color: var(--amber); }
.chart { height: 220px; position: relative; overflow: hidden; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid { stroke: rgba(62,230,255,.07); stroke-width: 1; }
.chart text { fill: var(--muted); font-family: var(--f-hud); font-size: 10px; }
.chart .b-grid { fill: var(--cyan); filter: drop-shadow(0 0 4px rgba(62,230,255,.6)); }
.chart .b-prev { fill: rgba(62,230,255,.14); }
.chart .b-solar { fill: var(--amber); opacity: .85; }
.chart .now { stroke: var(--amber); stroke-dasharray: 3 3; }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; border: 1px dashed var(--line); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }

/* ---------- CLIMATE ---------- */
.climates { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.clim { border: 1px solid var(--line); padding: 12px; background: rgba(62,230,255,.03); position: relative; }
.clim.on { border-color: var(--line-strong); box-shadow: inset 0 0 30px rgba(62,230,255,.07); }
.clim.on.heat { border-color: rgba(255,181,71,.6); box-shadow: inset 0 0 30px rgba(255,181,71,.08); }
.clim-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.clim-name { font-family: var(--f-hud); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.clim-act { font-size: 13px; color: var(--muted); }
.clim-mid { display: flex; align-items: center; gap: 14px; margin: 10px 0; }
.clim-cur { font-family: var(--f-hud); font-size: 34px; font-weight: 500; line-height: 1; }
.clim-cur small { font-size: 14px; color: var(--muted); }
.clim-target { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.clim-target .t { font-family: var(--f-hud); font-size: 20px; min-width: 64px; text-align: center; color: var(--cyan-2); }
.clim.heat .clim-target .t { color: var(--amber); }
.round { width: 34px; height: 34px; border: 1px solid var(--line-strong); background: transparent; display: grid; place-items: center; font-size: 20px; line-height: 1; }
.round:hover { background: rgba(62,230,255,.12); }
.modes { display: flex; flex-wrap: wrap; gap: 5px; }
.mode { border: 1px solid var(--line); background: transparent; padding: 4px 9px; font-size: 13px; color: var(--muted); }
.mode:hover { color: var(--text); border-color: var(--line-strong); }
.mode.on { background: var(--cyan); color: var(--bg); border-color: var(--cyan); font-weight: 600; }
.mode.on.heat { background: var(--amber); border-color: var(--amber); }
.mode.on.off { background: #3a4a55; border-color: #3a4a55; color: var(--text); }

/* ---------- CAMERAS ---------- */
.cams { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.cam { position: relative; aspect-ratio: 16/9; border: 1px solid var(--line-strong); background: #000; overflow: hidden; padding: 0; text-align: left; }
.cam img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.85) contrast(1.05); }
.cam .tag { position: absolute; left: 10px; bottom: 10px; font-family: var(--f-hud); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; background: rgba(2,7,13,.75); padding: 4px 8px; border-left: 2px solid var(--cyan); }
.cam .rec { position: absolute; right: 10px; top: 10px; font-family: var(--f-hud); font-size: 10px; letter-spacing: .2em; color: var(--red); display: flex; align-items: center; gap: 6px; background: rgba(2,7,13,.6); padding: 3px 7px; }
.cam .rec, .cam.live .snap { display: none; }
.cam.live .rec { display: flex; }
.cam .snap { position: absolute; right: 10px; top: 10px; font-family: var(--f-hud); font-size: 10px; letter-spacing: .2em; color: var(--muted); background: rgba(2,7,13,.6); padding: 3px 7px; }
.cam .rec::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
.cam::after { content: ""; position: absolute; inset: 10px; pointer-events: none;
  background:
    linear-gradient(var(--cyan),var(--cyan)) top left / 18px 2px no-repeat, linear-gradient(var(--cyan),var(--cyan)) top left / 2px 18px no-repeat,
    linear-gradient(var(--cyan),var(--cyan)) top right / 18px 2px no-repeat, linear-gradient(var(--cyan),var(--cyan)) top right / 2px 18px no-repeat,
    linear-gradient(var(--cyan),var(--cyan)) bottom right / 18px 2px no-repeat, linear-gradient(var(--cyan),var(--cyan)) bottom right / 2px 18px no-repeat;
  opacity: .8; }
.cam:hover { border-color: var(--cyan); box-shadow: var(--glow); }
.cam.off img { opacity: .15; }
.cam video, .cam-big video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; background: transparent; }
.cam-big video { object-fit: contain; }
.cam.live video, .cam-big.live video { opacity: 1; }
.cam .offline { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-hud); font-size: 12px; letter-spacing: .2em; color: var(--muted); }

.empty { border: 1px dashed var(--line); padding: 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.empty b { color: var(--cyan-2); font-weight: 600; }
.empty ul { margin: 8px 0 0; padding-left: 18px; }

/* ---------- OPS ---------- */
.protos { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.proto { border: 1px solid var(--line); background: rgba(62,230,255,.04); padding: 10px; text-align: left; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.proto::before { content: "▸"; color: var(--cyan); }
.proto:hover { border-color: var(--cyan); box-shadow: var(--glow); }
.row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(62,230,255,.08); }
.row:last-child { border-bottom: 0; }
.row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .st { font-size: 13px; color: var(--muted); }
.row .st.on { color: var(--cyan-2); }
.sq { width: 32px; height: 30px; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; }
.sq svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sq:hover { border-color: var(--cyan); color: var(--cyan); }
.sq.on { color: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow); }
.vol { width: 90px; accent-color: var(--cyan); }
.hint { color: var(--muted); font-size: 14px; }

/* ---------- TERMINAL ---------- */
.term-log { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 13px; line-height: 1.55; height: 190px; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.term-log .l { white-space: pre-wrap; word-break: break-word; }
.term-log .ts { color: var(--muted); }
.term-log .sys { color: var(--cyan); }
.term-log .usr { color: #fff; }
.term-log .jv { color: var(--cyan-2); }
.term-log .ev { color: #a9d6e2; }
.term-log .err { color: var(--red); }
.term-input { display: flex; align-items: center; gap: 8px; margin-top: 10px; border: 1px solid var(--line-strong); padding: 4px 4px 4px 10px; }
.term-input .prompt { color: var(--cyan); font-family: var(--f-hud); }
.term-input input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: 15px var(--f-body); padding: 6px 0; }
.term-input button { border: 0; background: var(--cyan); color: var(--bg); font-family: var(--f-hud); font-size: 11px; letter-spacing: .16em; padding: 8px 12px; text-transform: uppercase; }

/* ---------- MODAL ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(1,4,8,.82); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-box { width: min(1200px, 100%); background: var(--panel-solid); border: 1px solid var(--line-strong); padding: 14px; }
.cam-big { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; touch-action: none; cursor: zoom-in; }
.cam-big.zoomed { cursor: grab; }
.cam-big img, .cam-big video { transform-origin: center; transition: transform .08s linear; }
.ptz-sep { width: 1px; background: var(--line); margin: 0 6px; }
.zoom-lvl { font-family: var(--f-hud); font-size: 12px; color: var(--cyan-2); min-width: 42px; text-align: center; align-self: center; }
.cam-big img { width: 100%; height: 100%; object-fit: contain; }
.cam-reticle { position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; transform: translate(-50%,-50%); border: 1px solid rgba(62,230,255,.5); border-radius: 50%; pointer-events: none; }
.cam-reticle::before, .cam-reticle::after { content: ""; position: absolute; background: rgba(62,230,255,.6); }
.cam-reticle::before { left: 50%; top: -14px; bottom: -14px; width: 1px; }
.cam-reticle::after { top: 50%; left: -14px; right: -14px; height: 1px; }
.ptz { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1280px) {
  .hud {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "core energy" "weather cams" "climate climate" "ops term";
  }
}
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .chips { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .top-right { margin-left: auto; }
  .user { display: none; }
  .hud { padding: 14px 16px 24px; grid-template-columns: 1fr; grid-template-areas: "core" "energy" "cams" "weather" "climate" "ops" "term"; }
  .wx-stats { grid-template-columns: repeat(2, 1fr); }
  .wx-d { grid-template-columns: 62px 22px 30px 1fr 30px 46px; gap: 6px; }
  .cams { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
