/* SensorOne · MKSolution Thermal — 중립 다크(Primer 계열) · VMS/Datadog 밀도 */
:root {
  --bg: #06080c; --surface: #0a0d13; --surface-2: #0f131b; --panel: #0d111a;
  --border: #1a212c; --border-2: #2a323f; --hover: #161c26;
  --text: #eef1f6; --text-2: #97a4b6; --text-3: #5a6675;
  --accent: #4d8dff; --accent-dim: rgba(77,141,255,0.16);
  --ok: #3ddc84; --warn: #f5a623; --crit: #ff4d4d; --off: #5a6675;
  --thermal: linear-gradient(135deg, #5b1466 0%, #c0392b 45%, #e7602a 70%, #f5c451 100%);
  --elev: 0 1px 0 rgba(255,255,255,0.04) inset, 0 6px 18px rgba(0,0,0,0.35);
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --r: 7px; --r2: 4px;
  font-family: -apple-system, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); overflow: hidden; -webkit-font-smoothing: antialiased; font-size: 13px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── App bar ── */
.appbar { height: 52px; display: flex; align-items: center; gap: 22px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.brand .mark { width: 18px; height: 18px; border-radius: 4px; background: var(--thermal); box-shadow: 0 0 12px rgba(231,96,42,0.4); }
.brand .bt { font-weight: 700; font-size: 14px; letter-spacing: -0.2px; }
.brand .bs { font-size: 11px; color: var(--text-3); padding-left: 8px; border-left: 1px solid var(--border-2); }
.tabs { display: flex; gap: 2px; }
.tab { padding: 7px 16px; border-radius: var(--r2); border: 0; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.tab:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.tab.active { background: var(--accent-dim); color: #cfe0ff; }
.tab:disabled { opacity: 0.35; cursor: default; }
.statusbar { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.sysstat { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 10px; border: 1px solid var(--border-2); border-radius: var(--r2); background: var(--surface-2); }
.sysstat .sd { width: 9px; height: 9px; border-radius: 50%; background: var(--off); box-shadow: 0 0 0 3px rgba(90,102,117,0.15); }
.sysstat.ok .sd { background: var(--ok); box-shadow: 0 0 0 3px rgba(61,220,132,0.18); }
.sysstat.warn .sd { background: var(--warn); box-shadow: 0 0 0 3px rgba(245,166,35,0.18); }
.sysstat.alert .sd { background: var(--crit); box-shadow: 0 0 0 3px rgba(255,77,77,0.22); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255,77,77,0.06); } }
.ss-t { font-size: 12px; font-weight: 800; letter-spacing: 1px; line-height: 1.1; }
.sysstat.ok .ss-t { color: var(--ok); } .sysstat.warn .ss-t { color: var(--warn); } .sysstat.alert .ss-t { color: var(--crit); }
.ss-s { font-size: 10px; color: var(--text-3); }
.sb-chip { font-size: 12px; color: var(--text-2); } .sb-chip b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.sb-chip.crit b { color: var(--crit); } .sb-chip.warn b { color: var(--warn); }
.sep { width: 1px; height: 20px; background: var(--border-2); }
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.led.on { background: var(--ok); } .led.off { background: var(--crit); }
.clock { font-family: var(--mono); font-size: 13px; color: var(--text-2); }

.view { height: calc(100vh - 52px); display: flex; flex-direction: column; }

/* ── Generic toolbar ── */
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r2); overflow: hidden; }
.seg button { padding: 6px 14px; border: 0; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; border-right: 1px solid var(--border-2); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent); color: #fff; }
.tb-right { display: flex; align-items: center; gap: 14px; }
.sel, .search { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r2); color: var(--text); padding: 6px 10px; font-size: 12px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.pager { display: flex; align-items: center; gap: 8px; }
.ic { width: 28px; height: 28px; border: 1px solid var(--border-2); border-radius: var(--r2); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 14px; }
.ic:hover { border-color: var(--accent); }
#page-info { font-size: 12px; color: var(--text-2); min-width: 44px; text-align: center; }

/* ── Video wall (장비 쿼드) ── */
.wall-info { font-size: 13px; color: var(--text-2); }
.wall-info b { color: var(--text); font-variant-numeric: tabular-nums; }
.wall-hint { color: var(--text-3); }
.wall-grid { flex: 1; display: grid; gap: 12px; padding: 14px; background: #000; overflow-y: auto; align-content: start; justify-items: center; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); }
.qcell { width: 100%; max-width: 1120px; aspect-ratio: 16 / 9; position: relative; background: #000; border: 1px solid #1a212c; border-radius: 6px; overflow: hidden; }
.qimg { width: 100%; height: 100%; object-fit: fill; display: block; }
/* OSD 오버레이 (HTML) — 순수 열화상 위에 텍스트/상태를 그린다 */
.qovl { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.qq { position: relative; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; }
.qq.NORMAL { border-color: rgba(61,220,132,0.85); }
.qq.WARNING { border-color: rgba(245,166,35,0.9); }
.qq.CRITICAL { border-color: var(--crit); box-shadow: inset 0 0 22px rgba(255,77,77,0.3); animation: qblink 1s infinite; }
.qq.OFFLINE { border-color: rgba(90,102,117,0.5); }
@keyframes qblink { 50% { border-color: rgba(255,77,77,0.35); } }
.qq:hover { border-color: var(--accent) !important; }
.qq-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 7px; padding: 6px 10px; background: linear-gradient(0deg, rgba(0,0,0,0.74), transparent); }
.qq-led { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.qq-name { color: #fff; font-size: 13px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qq-temp { margin-left: auto; color: #fff; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.qdev { position: absolute; top: 0; left: 50%; transform: translateX(-50%); background: rgba(4,6,10,0.6); color: #cfe0ff; font-size: 11px; font-weight: 700; padding: 3px 12px; border-radius: 0 0 6px 6px; pointer-events: none; }

/* ── Data view ── */
#view-data { padding: 14px; gap: 12px; overflow: hidden; }
.stat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--elev); }
.stat .s-val { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat .s-lbl { font-size: 11px; color: var(--text-3); margin-top: 4px; letter-spacing: 0.3px; }
.data-main { flex: 1; display: grid; grid-template-rows: 220px 1fr; gap: 12px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; overflow: hidden; box-shadow: var(--elev); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); }
.panel-head .ph-note { color: var(--text-3); font-weight: 400; }
.panel-head .search { margin-left: auto; width: 260px; }
.panel-body { flex: 1; position: relative; padding: 10px 12px; min-height: 0; }
.chart-panel .panel-body { display: flex; gap: 12px; }
#multi-trend { flex: 1; height: 100%; min-width: 0; }
.legend { width: 150px; display: flex; flex-direction: column; gap: 5px; font-size: 11px; overflow-y: auto; }
.legend .lg { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.legend .lg i { width: 9px; height: 3px; border-radius: 2px; }
.legend .lg b { margin-left: auto; color: var(--text); font-family: var(--mono); }

/* ── Data table ── */
.table-wrap { flex: 1; overflow-y: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dtable thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-3); font-weight: 600; font-size: 11px; letter-spacing: 0.4px; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border-2); cursor: pointer; white-space: nowrap; user-select: none; }
.dtable thead th.num { text-align: right; }
.dtable thead th.sorted { color: var(--accent); }
.dtable tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dtable tbody td.num { text-align: right; font-family: var(--mono); }
.dtable tbody tr { cursor: pointer; }
.dtable tbody tr:hover { background: var(--hover); }
.st-cell { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.st-cell .dot { width: 8px; height: 8px; border-radius: 50%; }
.td-name { font-weight: 600; color: var(--text); } .td-sub { color: var(--text-3); }
.td-alarm { font-weight: 700; }

/* ── Detail ── */
.detail-bar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.db-title { flex: 1; font-size: 15px; font-weight: 700; } .db-dev { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 10px; }
.btn { border: 1px solid var(--border-2); border-radius: var(--r2); background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; padding: 7px 13px; }
.btn:hover { border-color: var(--accent); }
.btn.full { width: 100%; } .btn.xs { padding: 2px 9px; font-size: 11px; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 20px; border: 1px solid; }
.pill.NORMAL { color: var(--ok); border-color: var(--ok); background: rgba(63,185,80,0.1); }
.pill.WARNING { color: var(--warn); border-color: var(--warn); background: rgba(214,160,21,0.1); }
.pill.CRITICAL { color: var(--crit); border-color: var(--crit); background: rgba(240,80,60,0.12); }
.pill.OFFLINE { color: var(--off); border-color: var(--border-2); }

.dlayout { flex: 1; display: grid; grid-template-columns: 200px 1fr 290px; gap: 12px; padding: 12px; min-height: 0; }
.dcol { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.sect { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-3); text-transform: uppercase; margin: 6px 0 2px; display: flex; justify-content: space-between; align-items: center; }
.sect .sub { font-weight: 400; text-transform: none; } .sect:first-child { margin-top: 0; }
.box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; box-shadow: var(--elev); }

.chan-list { display: flex; flex-direction: column; gap: 6px; }
.ci { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--off); border-radius: var(--r2); padding: 8px 10px; cursor: pointer; }
.ci:hover { background: var(--hover); } .ci.active { border-color: var(--accent); border-left-color: var(--accent); }
.ci.NORMAL { border-left-color: var(--ok); } .ci.WARNING { border-left-color: var(--warn); } .ci.CRITICAL { border-left-color: var(--crit); }
.ci-top { display: flex; justify-content: space-between; font-size: 12px; } .ci-name { font-weight: 600; } .ci-ch { color: var(--text-3); font-family: var(--mono); }
.ci-temp { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 3px; }
.apibox { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r2); padding: 10px; }
.apibox code { display: block; font-family: var(--mono); font-size: 10px; color: var(--accent); word-break: break-all; line-height: 1.4; }
.apinote { font-size: 10px; color: var(--text-3); margin-top: 6px; }

.dmain { display: flex; flex-direction: column; gap: 12px; min-width: 0; overflow: hidden; }
.hero { display: grid; grid-template-columns: 1fr 250px; gap: 12px; flex: 1; min-height: 0; }
.hm-card { background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--elev); }
.hm-card.alarm { border-color: var(--crit); }
.hm-head { display: flex; justify-content: space-between; padding: 9px 13px; font-size: 12px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.hm-head .mono { color: var(--accent); }
.hm-body { flex: 1; position: relative; display: flex; padding: 12px; gap: 9px; min-height: 0; }
.heatmap { flex: 1; min-width: 0; border-radius: var(--r2); cursor: crosshair; background: #05070a; box-shadow: inset 0 0 60px rgba(0,0,0,0.45); }

/* 세련된 온도 스케일 (그라데이션 + 임계 마커 + 라이브 포인터) */
.tscale { position: relative; width: 58px; flex-shrink: 0; }
.tscale-bar { position: absolute; left: 0; top: 6px; bottom: 6px; width: 9px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), 0 0 10px rgba(0,0,0,0.4); }
.tscale-ov { position: absolute; left: 0; top: 6px; bottom: 6px; right: 0; }
.t-end { position: absolute; left: 16px; font-family: var(--mono); font-size: 9px; color: var(--text-3); transform: translateY(-50%); }
.t-mark { position: absolute; left: 0; display: flex; align-items: center; transform: translateY(-50%); pointer-events: none; }
.t-mark .tk { width: 13px; height: 0; border-top: 1.5px dashed currentColor; opacity: 0.9; }
.t-mark .tt { font-family: var(--mono); font-size: 9px; margin-left: 4px; font-weight: 700; }
.t-mark.warn { color: var(--warn); } .t-mark.crit { color: var(--crit); }
.t-max { position: absolute; left: 9px; transform: translateY(-50%); display: flex; align-items: center; pointer-events: none; }
.t-max .tri { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 7px solid #fff; filter: drop-shadow(0 0 2px rgba(0,0,0,0.6)); }
.t-max .tv { font-family: var(--mono); font-size: 10px; font-weight: 800; color: #fff; margin-left: 3px; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.hm-off { position: absolute; inset: 12px; display: flex; align-items: center; justify-content: center; background: rgba(5,7,10,0.86); color: var(--off); font-size: 16px; font-weight: 700; }

.metrics { display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.met { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 13px; }
.met .m-l { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.met .m-v { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.met .m-v small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 2px; }
.met.dual { display: flex; justify-content: space-between; } .met.dual .mm:last-child { text-align: right; }
.met .m-s { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: 180px; }
.cc { width: 100%; height: 100%; }

.thr { display: flex; gap: 9px; margin-bottom: 10px; }
.thr label { flex: 1; font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 5px; }
.thr input { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r2); color: var(--text); padding: 7px; font-size: 14px; font-family: var(--mono); }
.lvls { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-bottom: 10px; }
.lvl { padding: 9px 0; border: 1px solid var(--border-2); border-radius: var(--r2); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.lvl:hover { color: var(--text); }
.lvl[data-level="normal"].active { border-color: var(--ok); color: var(--ok); }
.lvl[data-level="warning"].active { border-color: var(--warn); color: var(--warn); }
.lvl[data-level="critical"].active { border-color: var(--crit); color: var(--crit); }
.trow { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 5px 0; }
.sw { position: relative; width: 40px; height: 22px; display: inline-block; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw i { position: absolute; inset: 0; background: var(--border-2); border-radius: 22px; transition: 0.15s; cursor: pointer; }
.sw i:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.15s; }
.sw input:checked + i { background: var(--accent); } .sw input:checked + i:before { transform: translateX(18px); }

.integ { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.integ .iv { font-size: 16px; font-weight: 700; font-family: var(--mono); } .integ .il { font-size: 10px; color: var(--text-3); }

.alarms { display: flex; flex-direction: column; gap: 6px; }
.al { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--r2); padding: 7px 10px; cursor: pointer; }
.al.CRITICAL { border-left-color: var(--crit); }
.al-top { display: flex; justify-content: space-between; font-size: 11px; } .al-lv { font-weight: 700; } .al-lv.WARNING { color: var(--warn); } .al-lv.CRITICAL { color: var(--crit); }
.al-where { color: var(--text-2); font-weight: 600; } .al-time { color: var(--text-3); font-family: var(--mono); }
.al-text { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.empty { font-size: 12px; color: var(--text-3); padding: 6px 2px; }
.rtsp-line { font-size: 10px; color: var(--text-3); margin-top: 8px; word-break: break-all; }

::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }

/* ── Insights view ── */
#view-insights { padding: 14px; gap: 12px; overflow: hidden; }
.ins-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ins-kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 13px 15px; box-shadow: var(--elev); position: relative; overflow: hidden; }
.ins-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.ins-kpi.crit::before { background: var(--crit); } .ins-kpi.warn::before { background: var(--warn); }
.ins-kpi .k-v { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.ins-kpi .k-l { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.ins-kpi .k-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.ins-main { flex: 1; display: grid; grid-template-columns: 1fr 380px; gap: 12px; min-height: 0; }
.ins-side { display: grid; grid-template-rows: 1fr 1fr; gap: 12px; min-height: 0; }
.scroll { overflow-y: auto; }

/* risk ranking row */
.risk-list { display: flex; flex-direction: column; gap: 8px; }
.risk-row { display: grid; grid-template-columns: 26px 52px 1fr; align-items: center; gap: 14px; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.risk-row:hover { border-color: var(--border-2); transform: translateX(2px); }
.risk-rank { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text-3); text-align: center; }
.gauge { position: relative; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; }
.gauge::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface-2); }
.gauge .gv { position: relative; z-index: 1; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.risk-body { min-width: 0; }
.risk-line1 { display: flex; align-items: baseline; gap: 8px; }
.risk-name { font-size: 14px; font-weight: 700; } .risk-dev { font-size: 11px; color: var(--text-3); }
.risk-hint { font-size: 12px; margin: 3px 0 6px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip2 { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--panel); border: 1px solid var(--border-2); color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.chip2.up { color: var(--crit); border-color: rgba(255,77,77,0.4); } .chip2.eta { color: var(--warn); border-color: rgba(245,166,35,0.4); }
.chip2.anom { color: #c084fc; border-color: rgba(192,132,252,0.4); } .chip2.peer { color: var(--accent); border-color: rgba(77,141,255,0.4); }

/* mini lists (predictive / anomaly) */
.mini-list { display: flex; flex-direction: column; gap: 7px; }
.mini { display: flex; align-items: center; gap: 11px; padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--r2); cursor: pointer; }
.mini:hover { border-color: var(--border-2); }
.mini.crit { border-left-color: var(--crit); } .mini.anom { border-left-color: #c084fc; } .mini.peer { border-left-color: var(--accent); }
.mini-big { font-size: 20px; font-weight: 800; font-family: var(--mono); min-width: 64px; text-align: center; }
.mini-tx { min-width: 0; } .mini-n { font-size: 13px; font-weight: 600; } .mini-s { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ── Insights educational guide ── */
.guide { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--elev); overflow: hidden; flex-shrink: 0; }
.guide-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.guide.collapsed .guide-head { border-bottom: 0; }
.gh-title { font-size: 13px; font-weight: 700; }
.gh-title span { font-weight: 400; color: var(--text-3); font-size: 11px; margin-left: 8px; }
.guide-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.gcard { padding: 12px 15px 14px; border-right: 1px solid var(--border); min-width: 0; }
.gcard:last-child { border-right: 0; }
.gc-fig { height: 88px; margin-bottom: 8px; border-radius: var(--r2); background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.22)); overflow: hidden; }
.gc-fig .ganim { width: 100%; height: 100%; display: block; }
.gc-step { font-size: 11px; font-weight: 600; line-height: 1.4; min-height: 30px; margin-bottom: 7px; color: var(--text-2); transition: color 0.25s; }
.gc-tag { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.gc-tag i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.gc-key { font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.45; margin-bottom: 5px; }
.gc-key b { color: var(--accent); }
.gc-desc { font-size: 11px; color: var(--text-3); line-height: 1.5; }
@media (max-width: 1300px) { .guide-grid { grid-template-columns: repeat(3, 1fr); } .gcard:nth-child(3) { border-right: 0; } }


/* ── 가이드 카드 클릭 유도 ── */
.gcard { cursor: pointer; transition: background 0.15s; position: relative; }
.gcard:hover { background: var(--hover); }
.gcard::after { content: '실전 데이터로 보기 →'; display: block; margin-top: 9px; font-size: 11px; font-weight: 600; color: var(--accent); opacity: 0.75; }
.gcard:hover::after { opacity: 1; }

/* ── Insight Lab 모달 ── */
.lab-overlay { position: fixed; inset: 0; background: rgba(3,5,8,0.72); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; }
.lab-panel { width: min(1120px, 94vw); height: min(680px, 90vh); background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); display: flex; flex-direction: column; overflow: hidden; }
.lab-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.lab-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.lab-htext { flex: 1; min-width: 0; }
.lab-title { font-size: 15px; font-weight: 700; }
.lab-recap { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.lab-close { width: 30px; height: 30px; border-radius: var(--r2); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 13px; flex-shrink: 0; }
.lab-close:hover { border-color: var(--crit); color: var(--crit); }
.lab-body { flex: 1; min-height: 0; padding: 16px; }
.lab-foot { padding: 9px 18px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.lab-foot .lab-fk { color: var(--accent); font-weight: 700; margin-right: 8px; font-family: var(--font); }
.lab-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-3); font-size: 13px; }

.lab-full { height: 100%; display: flex; flex-direction: column; }
.lab-split { height: 100%; display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.lab-main { position: relative; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); }
.lab-cv { width: 100%; height: 100%; display: block; }
.lab-side { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); overflow: hidden; }
.side-h { padding: 10px 13px; font-size: 12px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); }
.side-list { flex: 1; overflow-y: auto; padding: 6px; }
.sl-row { display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-radius: var(--r2); cursor: pointer; }
.sl-row:hover { background: var(--hover); } .sl-row.sel { background: var(--accent-dim); }
.sl-eta { font-family: var(--mono); font-weight: 800; font-size: 15px; min-width: 46px; text-align: right; }
.sl-meta { min-width: 0; } .sl-meta b { font-size: 13px; font-weight: 600; display: block; } .sl-meta span { font-size: 11px; color: var(--text-3); }

/* risk decomposition */
.lab-legend { display: flex; gap: 16px; margin-bottom: 12px; }
.lgi { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); } .lgi i { width: 10px; height: 10px; border-radius: 2px; }
.rk-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.rk-row { display: grid; grid-template-columns: 24px 40px 200px 1fr; align-items: center; gap: 12px; padding: 7px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r2); cursor: pointer; }
.rk-row:hover { border-color: var(--border-2); }
.rk-rank { font-family: var(--mono); color: var(--text-3); text-align: center; font-size: 12px; }
.rk-score { font-family: var(--mono); font-weight: 800; font-size: 19px; text-align: center; }
.rk-meta b { font-size: 13px; font-weight: 600; display: block; } .rk-meta span { font-size: 11px; color: var(--text-3); }
.rk-bar { display: flex; height: 16px; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
.rk-seg { height: 100%; }

/* ΔT / peer shared */
.pg-wrap { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.pgrp { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 13px; }
.pg-h { font-size: 13px; font-weight: 700; margin-bottom: 9px; } .pg-h span { color: var(--text-3); font-weight: 400; font-size: 11px; }
.pbar-row { display: grid; grid-template-columns: 78px 1fr 54px; align-items: center; gap: 9px; margin: 5px 0; }
.pbar-n { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbar-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 3px; }
.pbar-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 3px; }
.pbar-med { position: absolute; top: -2px; width: 2px; height: 16px; background: var(--text); border-radius: 1px; }
.pbar-v { font-family: var(--mono); font-size: 12px; font-weight: 700; text-align: right; }
.pg-leg { display: flex; gap: 18px; margin-top: 12px; font-size: 11px; color: var(--text-2); }
.pg-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.pg-medk { color: var(--text-2); }
@media (max-width: 900px) { .lab-split { grid-template-columns: 1fr; } .pg-wrap { grid-template-columns: 1fr; } }

/* ── 비디오월 채널 정보 사이드 패널 ── */
.wall-body { flex: 1; display: flex; min-height: 0; position: relative; }
.wall-side { position: absolute; top: 0; right: 0; bottom: 0; width: 340px; z-index: 20; background: var(--surface); border-left: 1px solid var(--border-2); box-shadow: -14px 0 44px rgba(0,0,0,0.55); overflow-y: auto; display: flex; flex-direction: column; animation: wsbIn 0.18s ease; }
@keyframes wsbIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.wsb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--border); }
.wsb-name { font-size: 15px; font-weight: 700; }
.wsb-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.wsb-x { width: 26px; height: 26px; flex-shrink: 0; border: 1px solid var(--border-2); border-radius: var(--r2); background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 12px; }
.wsb-x:hover { border-color: var(--crit); color: var(--crit); }
.wsb-hmwrap { position: relative; margin: 12px 14px; aspect-ratio: 16 / 9; border-radius: var(--r2); overflow: hidden; border: 1px solid var(--border-2); }
.wsb-hm { width: 100%; height: 100%; display: block; background: #04060a; cursor: crosshair; }
.wsb-hmwrap .pill { position: absolute; top: 8px; left: 8px; font-size: 11px; padding: 3px 10px; }
.wsb-readout { position: absolute; bottom: 6px; right: 8px; font-size: 11px; color: #fff; background: rgba(0,0,0,0.5); padding: 2px 7px; border-radius: 4px; }
.wsb-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 0 14px 2px; }
.wsb-mv { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.wsb-mv small { font-size: 15px; color: var(--text-3); font-weight: 500; margin-left: 2px; }
.wsb-ml { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.wsb-gauge { text-align: center; }
.wsb-gv { font-size: 26px; font-weight: 800; font-family: var(--mono); line-height: 1; }
.wsb-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 14px 6px; }
.kv-k { font-size: 10px; color: var(--text-3); }
.kv-v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.wsb-sect { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-3); text-transform: uppercase; padding: 6px 14px 5px; }
.wsb-sect span { font-weight: 400; text-transform: none; }
.wsb-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 14px 6px; }
.wsb-trend { width: calc(100% - 28px); height: 60px; margin: 0 14px; display: block; }
#wsb-alarm:not(:empty) { padding: 8px 14px 0; }
#wsb-alarm .al { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--r2); padding: 7px 10px; }
#wsb-alarm .al.CRITICAL { border-left-color: var(--crit); }
#wsb-alarm .al-text { font-size: 11.5px; color: var(--text-2); }
.wsb-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
#wsb-thr { font-size: 11px; color: var(--text-3); }
.qq.sel { border-color: var(--accent) !important; box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px rgba(77,141,255,0.4); }

/* ── 사이드바 공간/열화상 토글 + 3D 스테이지 ── */
.wsb-tabs { display: flex; align-items: center; gap: 6px; padding: 10px 14px 0; }
.ht { padding: 5px 13px; border-radius: var(--r2); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.ht.active { border-color: var(--accent); color: #cfe0ff; background: var(--accent-dim); }
.wsb-tabs .pill { margin-left: auto; font-size: 11px; padding: 3px 10px; }
.wsb-stage { position: relative; margin: 10px 14px; aspect-ratio: 16 / 10; border-radius: var(--r2); overflow: hidden; border: 1px solid var(--border-2); background: #070a10; }
.wsb-pane { position: absolute; inset: 0; }
.wsb-3d { width: 100%; height: 100%; display: block; }
.wsb-3dctl { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.wsb-3dctl button { padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border-2); background: rgba(8,11,17,0.72); color: var(--text-2); font-size: 11px; font-weight: 600; cursor: pointer; }
.wsb-3dctl button.on { border-color: var(--accent); color: #cfe0ff; background: var(--accent-dim); }
.wsb-3dctl button:hover { color: var(--text); }
.wsb-hint { position: absolute; bottom: 6px; right: 8px; font-size: 10px; color: var(--text-3); pointer-events: none; }
.wsb-pane .wsb-hm { width: 100%; height: 100%; }

/* ── 사이드바 미리보기(열화상+공간) ── */
.wsb-htitle { font-size: 11px; color: var(--text-3); }
.wsb-previews { position: relative; display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 14px; cursor: pointer; }
.wsb-prev { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--border-2); border-radius: var(--r2); overflow: hidden; background: #070a10; }
.wsb-prev canvas { width: 100%; height: 100%; display: block; }
.wsb-pl { position: absolute; bottom: 4px; left: 6px; font-size: 10px; color: #cfe0ff; background: rgba(6,9,14,0.62); padding: 1px 6px; border-radius: 3px; }
.wsb-expand { position: absolute; top: 5px; right: 5px; font-size: 10px; color: #cfe0ff; background: rgba(6,9,14,0.7); border: 1px solid var(--border-2); padding: 2px 7px; border-radius: 4px; opacity: 0.65; transition: 0.15s; }
.wsb-previews:hover .wsb-expand { opacity: 1; border-color: var(--accent); }

/* ── 채널 큰 모달 ── */
.wmodal { position: fixed; inset: 0; background: rgba(3,5,8,0.74); backdrop-filter: blur(3px); z-index: 120; display: flex; align-items: center; justify-content: center; }
.wmodal-panel { width: min(1180px, 95vw); height: min(720px, 92vh); background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); display: flex; flex-direction: column; overflow: hidden; }
.wmodal-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.wm-title { flex: 1; font-size: 15px; font-weight: 700; } .wm-sub { font-size: 12px; color: var(--text-3); margin-left: 10px; font-weight: 500; }
.wmodal-body { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px; min-height: 0; }
.wm-col { display: flex; flex-direction: column; min-height: 0; }
.wm-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.wm-label .mono { color: var(--accent); }
.wm-ctl { margin-left: auto; display: flex; gap: 4px; }
.wm-ctl button { padding: 4px 11px; border-radius: 4px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 600; cursor: pointer; }
.wm-ctl button.on { border-color: var(--accent); color: #cfe0ff; background: var(--accent-dim); }
.wm-hmwrap { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border-2); border-radius: var(--r2); overflow: hidden; background: #04060a; box-shadow: inset 0 0 60px rgba(0,0,0,0.45); }
.wm-hm { width: 100%; height: 100%; display: block; cursor: crosshair; }
.wm-3dwrap { position: relative; flex: 1; min-height: 0; border: 1px solid var(--border-2); border-radius: var(--r2); overflow: hidden; background: #070a10; }
.wm-3d { width: 100%; height: 100%; display: block; }
.wm-hint { position: absolute; bottom: 8px; right: 10px; font-size: 11px; color: var(--text-3); pointer-events: none; }
.wm-metrics { margin-top: 10px; flex-shrink: 0; }
.wm-big { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.wm-big small { font-size: 15px; color: var(--text-3); font-weight: 500; margin-left: 2px; }
.wm-risk { font-size: 13px; color: var(--text-2); margin-left: 12px; font-weight: 700; }
.wm-kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.wm-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }

/* 3D 캔버스 드래그 안정화 (텍스트 선택/터치 스크롤 차단) */
.wm-3d, .wsb-3d { touch-action: none; user-select: none; -webkit-user-select: none; }
