/* =====================================================================
   GUVNL SolarGuard AI — control-room theme (optimised for 1920 × 1080)
   ===================================================================== */
:root {
  --bg: #040a16;
  --bg-2: #071228;
  --panel: rgba(12, 26, 52, .58);
  --panel-solid: #0b1a35;
  --panel-hi: rgba(20, 42, 82, .55);
  --line: rgba(110, 180, 255, .13);
  --line-hi: rgba(110, 200, 255, .28);
  --text: #e6f1ff;
  --text-2: #a9bdd8;
  --muted: #6e86a8;
  --cyan: #22e5ff;
  --blue: #3d7bff;
  --violet: #8b5cff;
  --green: #2ee6a0;
  --amber: #ffb547;
  --red: #ff4d6d;
  --sun: #ffd166;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 70% -10%, #0c2350 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
b, strong { font-weight: 650; }
kbd {
  font: 600 11px var(--mono); padding: 1px 6px; border-radius: 5px;
  background: rgba(255,255,255,.07); border: 1px solid var(--line-hi); color: var(--text);
}
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ---------- animated background ---------- */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(60, 140, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 140, 255, .07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
  animation: gridMove 22s linear infinite;
}
@keyframes gridMove { to { background-position: 46px 46px, 46px 46px; } }
.bg-glow { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .32; pointer-events: none; z-index: 0; }
.bg-glow.a { width: 520px; height: 520px; background: #1846c8; top: -160px; right: 8%; animation: float 18s ease-in-out infinite; }
.bg-glow.b { width: 420px; height: 420px; background: #5a2bd6; bottom: -180px; left: 22%; animation: float 22s ease-in-out infinite reverse; }
@keyframes float { 50% { transform: translate(40px, 30px) scale(1.08); } }

/* ---------- shell ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; gap: 14px; padding: 22px 16px;
  background: linear-gradient(180deg, rgba(8, 20, 44, .92), rgba(5, 12, 28, .92));
  border-right: 1px solid var(--line); backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; border-bottom: 1px solid var(--line); }
.brand img { width: 42px; height: 42px; filter: drop-shadow(0 0 12px rgba(34, 229, 255, .45)); }
.brand strong { display: block; font-size: 17px; letter-spacing: .2px; }
.brand strong em { font-style: normal; background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { color: var(--muted); font-size: 11.5px; }
.side-label { color: var(--muted); font-size: 10.5px; letter-spacing: 1.6px; font-weight: 700; padding: 4px 10px 0; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px;
  border: 1px solid transparent; background: none; text-align: left; color: var(--text-2);
  font-weight: 550; transition: .2s; position: relative;
}
.nav-item i { width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); transition: .2s; }
.nav-item span { flex: 1; }
.nav-item:hover { background: rgba(80, 150, 255, .07); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(34, 229, 255, .14), rgba(61, 123, 255, .06));
  border-color: rgba(34, 229, 255, .25); color: #fff;
  box-shadow: inset 3px 0 0 var(--cyan);
}
.nav-item.active i { color: var(--cyan); }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; display: none; place-items: center; }
.nav-badge.show { display: grid; }
.nav-badge.warning { background: rgba(255, 181, 71, .18); color: var(--amber); }
.nav-badge.critical { background: rgba(255, 77, 109, .2); color: var(--red); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .45; } }

.tour-btn {
  margin-top: 6px; display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 14px;
  border-radius: 13px; border: 1px solid rgba(139, 92, 255, .4);
  background: linear-gradient(120deg, rgba(139, 92, 255, .22), rgba(34, 229, 255, .1));
  transition: .2s;
}
.tour-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(139, 92, 255, .25); }
.tour-btn i { color: #c7b4ff; }
.tour-btn b { display: block; font-size: 13.5px; }
.tour-btn small { color: var(--text-2); font-size: 11.5px; }
.engine-card { margin-top: auto; padding: 14px; border-radius: 13px; background: rgba(46, 230, 160, .05); border: 1px solid rgba(46, 230, 160, .18); }
.engine-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.engine-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(46, 230, 160, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 9px rgba(46, 230, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 230, 160, 0); } }
.engine-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); padding: 2px 0; }
.engine-row b { color: var(--text-2); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 16px 26px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 12, 28, .7), rgba(5, 12, 28, .2)); backdrop-filter: blur(10px);
}
.eyebrow { color: var(--cyan); font-size: 11px; font-weight: 700; letter-spacing: 1.8px; }
.topbar h1 { margin: 2px 0 2px; font-size: 23px; letter-spacing: -.2px; }
.topbar p { margin: 0; color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-block { min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.chip {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; white-space: nowrap;
}
.chip i { color: var(--sun); display: grid; }
.chip .sep { width: 1px; height: 16px; background: var(--line-hi); }
.live-chip b { color: var(--green); letter-spacing: 1px; font-size: 12px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); animation: ping 1.6s infinite; }
.live-chip.offline b { color: var(--red); }
.live-chip.offline .live-dot { background: var(--red); animation: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text-2); font-weight: 700; font-size: 16px; display: grid; place-items: center; transition: .2s;
}
.icon-btn:hover { color: #fff; border-color: var(--line-hi); }
.scenario-pill {
  display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 6px 0 14px; border-radius: 11px;
  background: rgba(46, 230, 160, .07); border: 1px solid rgba(46, 230, 160, .25); font-size: 13px; transition: .3s;
}
.sp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.sp-label { font-size: 10.5px; color: var(--muted); letter-spacing: 1.3px; font-weight: 700; }
.sp-reset { display: none; height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-hi); background: rgba(255,255,255,.06); font-size: 12px; }
.scenario-pill.active .sp-reset { display: block; }
.scenario-pill.sev-MEDIUM { background: rgba(255, 181, 71, .08); border-color: rgba(255, 181, 71, .35); }
.scenario-pill.sev-MEDIUM .sp-dot { background: var(--amber); }
.scenario-pill.sev-HIGH, .scenario-pill.sev-CRITICAL { background: rgba(255, 77, 109, .09); border-color: rgba(255, 77, 109, .4); }
.scenario-pill.sev-HIGH .sp-dot, .scenario-pill.sev-CRITICAL .sp-dot { background: var(--red); animation: blink 1s infinite; }

/* ---------- pages ---------- */
.page { display: none; flex: 1; overflow-y: auto; padding: 18px 26px 26px; animation: pageIn .35s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } }
.page::-webkit-scrollbar { width: 8px; }
.page::-webkit-scrollbar-thumb { background: rgba(110, 180, 255, .18); border-radius: 8px; }

.panel {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.panel::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(120, 200, 255, .07), transparent 40%);
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 2px 0 0; font-size: 16.5px; letter-spacing: -.1px; }
.kicker { color: var(--cyan); font-size: 10.5px; font-weight: 700; letter-spacing: 1.6px; }
.plain { color: var(--text-2); font-size: 13px; margin: 6px 0 0; }
.badge { font-size: 11px; padding: 4px 9px; border-radius: 8px; background: rgba(34, 229, 255, .12); color: var(--cyan); font-weight: 600; white-space: nowrap; }
.badge.subtle { background: rgba(255, 255, 255, .05); color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid rgba(34, 229, 255, .4); background: linear-gradient(120deg, rgba(34, 229, 255, .22), rgba(61, 123, 255, .2));
  color: #fff; font-weight: 650; font-size: 13px; text-decoration: none; transition: .2s; white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(34, 229, 255, .2); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: rgba(255, 255, 255, .04); border-color: var(--line-hi); color: var(--text-2); }
.btn.green { border-color: rgba(46, 230, 160, .5); background: linear-gradient(120deg, rgba(46, 230, 160, .25), rgba(34, 229, 255, .12)); }
.btn.warn { border-color: rgba(255, 181, 71, .5); background: rgba(255, 181, 71, .14); }
.btn i { display: grid; }

.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg.cyan { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.lg.amber { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.lg.red { background: var(--red); box-shadow: 0 0 8px var(--red); }
.lg.violet { background: var(--violet); box-shadow: 0 0 8px var(--violet); }

.risk-chip, .status-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 11px;
  font-weight: 700; letter-spacing: .6px; text-transform: uppercase; white-space: nowrap;
  background: rgba(46, 230, 160, .12); color: var(--green); border: 1px solid rgba(46, 230, 160, .25);
}
.risk-chip.MEDIUM, .status-chip.warning, .status-chip.Medium { background: rgba(255, 181, 71, .12); color: var(--amber); border-color: rgba(255, 181, 71, .3); }
.risk-chip.HIGH, .risk-chip.CRITICAL, .status-chip.critical, .status-chip.High { background: rgba(255, 77, 109, .13); color: var(--red); border-color: rgba(255, 77, 109, .35); }
.risk-chip.CRITICAL { animation: blink 1.2s infinite; }
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.kpi {
  position: relative; padding: 13px 15px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  overflow: hidden; transition: .3s; cursor: help;
}
.kpi::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--cyan), transparent); opacity: .7; }
.kpi-label { color: var(--text-2); font-size: 12px; font-weight: 550; }
.kpi strong { display: block; font-size: 27px; font-weight: 750; letter-spacing: -.6px; margin: 3px 0 1px; font-variant-numeric: tabular-nums; }
.kpi strong u { text-decoration: none; font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.kpi small { color: var(--muted); font-size: 11.5px; }
.kpi.bad { border-color: rgba(255, 77, 109, .35); background: linear-gradient(160deg, rgba(255, 77, 109, .12), var(--panel)); }
.kpi.bad::after { background: linear-gradient(90deg, var(--red), transparent); }
.kpi.bad strong { color: #ff8099; }
.kpi.warn { border-color: rgba(255, 181, 71, .3); background: linear-gradient(160deg, rgba(255, 181, 71, .1), var(--panel)); }
.kpi.warn::after { background: linear-gradient(90deg, var(--amber), transparent); }
.kpi.warn strong { color: #ffc874; }
.kpi.good strong { color: #7ff5c8; }
.kpi.flash { animation: kflash .8s; }
@keyframes kflash { 30% { box-shadow: 0 0 0 2px rgba(34, 229, 255, .5), 0 0 30px rgba(34, 229, 255, .25); } }

/* ---------- pipeline ---------- */
.pipeline { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; padding: 10px 12px; margin-top: 12px; }
.pipe-step { position: relative; display: flex; gap: 9px; align-items: center; padding: 6px 10px; border-radius: 10px; transition: .3s; min-width: 0; }
.pipe-step:not(:last-child)::after {
  content: ""; position: absolute; right: -7px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%) rotate(45deg);
  border-top: 2px solid var(--line-hi); border-right: 2px solid var(--line-hi);
}
.pipe-ico { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font: 700 12px var(--mono); background: rgba(46, 230, 160, .1); color: var(--green); border: 1px solid rgba(46, 230, 160, .25); }
.pipe-txt { min-width: 0; }
.pipe-txt b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-txt span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-step.active .pipe-ico { background: rgba(34, 229, 255, .15); color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 14px rgba(34, 229, 255, .45); animation: pulseIco 1.2s infinite; }
.pipe-step.active .pipe-txt span { color: var(--cyan); }
.pipe-step.alert .pipe-ico { background: rgba(255, 77, 109, .14); color: var(--red); border-color: rgba(255, 77, 109, .5); }
.pipe-step.alert .pipe-txt span { color: #ff8099; }
.pipe-step.current { background: rgba(255, 255, 255, .04); }
.pipe-step.idle .pipe-ico { background: rgba(255,255,255,.04); color: var(--muted); border-color: var(--line); }
@keyframes pulseIco { 50% { box-shadow: 0 0 2px rgba(34, 229, 255, .2); } }
.pipe-flow .pipe-step:not(:last-child)::after { border-color: var(--cyan); opacity: .7; }

/* ---------- dashboard grid ---------- */
.dash-grid {
  display: grid; margin-top: 12px; gap: 12px;
  grid-template-columns: minmax(0, 1fr) 410px;
  grid-template-areas: "twin side" "chart side";
  grid-template-rows: minmax(0, 1fr) 236px;
  height: calc(100vh - 352px); min-height: 640px;
}
.twin-panel { grid-area: twin; display: flex; flex-direction: column; padding-bottom: 12px; }
.side-col { grid-area: side; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.chart-panel { grid-area: chart; display: flex; flex-direction: column; }
.feed-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding-bottom: 10px; }
.feed-panel .panel-head { margin-bottom: 8px; }
.chart-box { position: relative; flex: 1; min-height: 160px; }
.chart-box.tall { height: 290px; flex: none; }
.twin-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.twin-wrap { position: relative; flex: 1; min-height: 340px; border-radius: 12px; overflow: hidden; border: 1px solid rgba(110, 180, 255, .08); transition: background 1.2s;
  background: linear-gradient(180deg, rgba(36, 104, 190, .42) 0%, rgba(18, 56, 112, .32) 52%, rgba(3, 8, 20, .45) 100%); }
.twin-wrap[data-sky="low"] { background: linear-gradient(180deg, rgba(60, 90, 170, .38) 0%, rgba(150, 110, 120, .22) 48%, rgba(3, 8, 20, .45) 100%); }
.twin-wrap[data-sky="twilight"] { background: linear-gradient(180deg, rgba(40, 30, 90, .55) 0%, rgba(255, 128, 64, .26) 50%, rgba(3, 8, 20, .5) 100%); }
.twin-wrap[data-sky="night"] { background: linear-gradient(180deg, rgba(2, 6, 20, .75) 0%, rgba(10, 24, 60, .45) 55%, rgba(2, 5, 14, .6) 100%); }

/* time HUD + controls on the 3D twin */
.time-hud {
  position: absolute; left: 12px; top: 12px; z-index: 4; width: 272px; padding: 10px 12px 8px; border-radius: 12px;
  background: rgba(4, 12, 28, .72); border: 1px solid rgba(255, 209, 102, .28); backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.th-head { display: flex; align-items: center; gap: 10px; }
.th-clock { font: 700 26px var(--mono); color: var(--sun); letter-spacing: -.5px; text-shadow: 0 0 16px rgba(255, 209, 102, .45); }
.time-hud[data-phase="night"] .th-clock { color: #9fb8ff; text-shadow: 0 0 16px rgba(120, 150, 255, .4); }
.th-title b { display: block; font-size: 13px; }
.th-title small { color: var(--muted); font-size: 10.5px; letter-spacing: .6px; font-weight: 700; }
.th-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 8px 0 6px; }
.th-stats span { display: block; color: var(--muted); font-size: 10.5px; }
.th-stats b { font-size: 13px; font-variant-numeric: tabular-nums; }
#dayCurve { display: block; width: 100%; height: 66px; cursor: default; }
.th-foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 2px; }
.th-foot b { color: var(--text-2); font-weight: 600; }
.time-ctrl {
  position: absolute; left: 12px; bottom: 10px; z-index: 4; display: flex; align-items: center; gap: 5px; padding: 5px 6px;
  border-radius: 11px; background: rgba(4, 12, 28, .75); border: 1px solid var(--line-hi); backdrop-filter: blur(8px);
}
.time-ctrl button {
  height: 28px; min-width: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
  color: var(--text-2); font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.time-ctrl button:hover { color: #fff; border-color: var(--line-hi); }
.time-ctrl button.on { color: #041022; background: var(--sun); border-color: var(--sun); }
.time-ctrl .tc-live.on { background: var(--green); border-color: var(--green); }
.time-ctrl input[type="range"] { width: 190px; accent-color: var(--sun); cursor: pointer; }
.twin-label em { font-style: normal; font-size: 10px; color: #ffd98a; font-weight: 600; margin-left: 3px; }
.twin-label.house .tl-box { display: inline-flex; align-items: baseline; gap: 5px; padding: 2px 7px; }
.twin-label.house span { display: inline; font-size: 11px; }
.twin-label.house em { margin-left: 0; }
.twin-label.sun .tl-box { border-color: rgba(255, 209, 102, .6); background: rgba(40, 26, 4, .7); }
.twin-label.sun b { color: var(--sun); }
.twin-label.hour-tick i { font: 600 9.5px var(--mono); font-style: normal; color: rgba(255, 217, 138, .8); }
.w-mode { font-size: 10px; font-weight: 800; letter-spacing: .8px; color: var(--sun); }
.twin-wrap canvas { display: block; outline: none; cursor: grab; }
.twin-wrap canvas:active { cursor: grabbing; }
.twin-hint { position: absolute; right: 12px; top: 10px; z-index: 3; font-size: 11.5px; color: var(--muted); background: rgba(4, 10, 22, .6); padding: 4px 9px; border-radius: 7px; pointer-events: none; }
.twin-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.twin-label { pointer-events: none; text-align: center; font-size: 11px; line-height: 1.25; transform: translateY(-6px); }
.twin-label .tl-box { display: inline-block; padding: 3px 7px; border-radius: 7px; background: rgba(4, 12, 28, .78); border: 1px solid rgba(34, 229, 255, .35); backdrop-filter: blur(4px); white-space: nowrap; transition: .3s; }
.twin-label b { font: 600 10.5px var(--mono); color: #cfe8ff; }
.twin-label span { display: block; font-weight: 700; color: var(--cyan); font-size: 11.5px; }
.twin-label.warning .tl-box { border-color: rgba(255, 181, 71, .6); }
.twin-label.warning span { color: var(--amber); }
.twin-label.critical .tl-box { border-color: rgba(255, 77, 109, .8); box-shadow: 0 0 14px rgba(255, 77, 109, .45); }
.twin-label.critical span { color: #ff7d95; }
.twin-label.big .tl-box { border-color: rgba(139, 92, 255, .5); }
.twin-label.big b { color: #fff; font-size: 11px; letter-spacing: .8px; }
.twin-label.attacker .tl-box { border-color: rgba(255, 77, 109, .9); background: rgba(60, 6, 20, .8); }
.twin-label.attacker b { color: #ff9fb1; }

/* gauge */
.gauge-panel { flex-shrink: 0; }
.gauge-row { display: flex; gap: 16px; align-items: center; }
.gauge { position: relative; width: 118px; height: 118px; flex-shrink: 0; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.g-track { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 10; }
.g-val { fill: none; stroke: var(--green); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 314; stroke-dashoffset: 314; transition: stroke-dashoffset .8s, stroke .5s; filter: drop-shadow(0 0 6px currentColor); }
.g-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.g-center strong { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.g-center small { color: var(--muted); font-size: 11.5px; }
.gauge-info { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.gi { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.gi b { color: var(--text); font-variant-numeric: tabular-nums; }

/* mini incident */
.incident-mini { flex-shrink: 0; display: flex; flex-direction: column; }
.im-empty { display: grid; place-content: center; text-align: center; gap: 6px; color: var(--text-2); padding: 4px 0 2px; }
.im-empty .big-ok { width: 44px; height: 44px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: rgba(46, 230, 160, .1); border: 1px solid rgba(46, 230, 160, .35); color: var(--green); font-size: 24px; box-shadow: 0 0 28px rgba(46, 230, 160, .18); }
.im-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.im-title { font-size: 16px; font-weight: 700; margin: 6px 0 2px; }
.im-sub { color: var(--text-2); font-size: 12.5px; }
.im-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.im-grid div { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); }
.im-grid span { display: block; color: var(--muted); font-size: 11px; }
.im-grid b { font-size: 14.5px; }
.im-actions { display: flex; gap: 8px; }
.im-actions .btn { flex: 1; justify-content: center; height: 36px; padding: 0 10px; }

.phase-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 10px 0 4px; }
.phase-track div { text-align: center; font-size: 10.5px; color: var(--muted); }
.phase-track div i { display: block; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .07); margin-bottom: 5px; transition: .4s; }
.phase-track div.done i { background: var(--cyan); box-shadow: 0 0 8px rgba(34, 229, 255, .6); }
.phase-track div.done { color: var(--text-2); }
.phase-track div.now i { background: linear-gradient(90deg, var(--cyan), var(--violet)); animation: blink 1s infinite; }
.phase-track div.now { color: var(--cyan); font-weight: 600; }

/* feed */
.feed { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.feed::-webkit-scrollbar { width: 5px; }
.feed::-webkit-scrollbar-thumb { background: rgba(110, 180, 255, .18); border-radius: 5px; }
.feed-item { display: grid; grid-template-columns: 62px 1fr; gap: 8px; font-size: 12.5px; padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, .025); border-left: 3px solid var(--cyan); animation: slideIn .4s; }
.feed-item time { font: 500 11px var(--mono); color: var(--muted); padding-top: 1px; }
.feed-item.ok { border-color: var(--green); }
.feed-item.warn { border-color: var(--amber); }
.feed-item.crit { border-color: var(--red); background: rgba(255, 77, 109, .06); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } }

/* ---------- fleet ---------- */
.fleet-layout { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 14px; align-items: start; }
.fleet-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 12px; }
.fleet-toolbar h2 { margin: 2px 0 0; font-size: 17px; }
.filters { display: flex; gap: 6px; flex-shrink: 0; }
.filters button { height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: var(--text-2); font-size: 12.5px; }
.filters button b { margin-left: 4px; color: var(--text); }
.filters button.active { border-color: var(--cyan); color: #fff; background: rgba(34, 229, 255, .1); }
.plant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plant-card {
  position: relative; padding: 15px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; transition: .25s; text-align: left; overflow: hidden;
}
.plant-card:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.plant-card.selected { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 10px 30px rgba(34, 229, 255, .15); }
.plant-card.critical { background: linear-gradient(150deg, rgba(255, 77, 109, .13), var(--panel) 55%); border-color: rgba(255, 77, 109, .4); }
.plant-card.warning { background: linear-gradient(150deg, rgba(255, 181, 71, .1), var(--panel) 55%); border-color: rgba(255, 181, 71, .3); }
.plant-card.critical.selected { box-shadow: 0 0 0 1px var(--red), 0 10px 30px rgba(255, 77, 109, .2); }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; }
.pc-id { font: 650 15px var(--mono); }
.pc-area { color: var(--muted); font-size: 12px; }
.pc-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 10px; }
.pc-nums span { display: block; color: var(--muted); font-size: 11px; }
.pc-nums b { font-size: 18px; font-variant-numeric: tabular-nums; }
.pc-nums b small { font-size: 11px; color: var(--muted); font-weight: 500; }
.pc-bar { position: relative; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: visible; }
.pc-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .8s; }
.pc-bar em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; border-radius: 2px; opacity: .7; }
.plant-card.warning .pc-bar i { background: linear-gradient(90deg, #c77d10, var(--amber)); }
.plant-card.critical .pc-bar i { background: linear-gradient(90deg, #b3203d, var(--red)); }
.pc-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.pc-foot b { color: var(--text); }
.pc-cause.cyber { color: #c7b4ff; }

.rca-panel { position: sticky; top: 0; padding: 18px 20px; }
.rca-top { display: flex; justify-content: space-between; align-items: center; }
.rca-id { font: 700 22px var(--mono); margin: 4px 0 2px; }
.rca-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.rca-nums div { padding: 10px 12px; border-radius: 11px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); }
.rca-nums span { display: block; color: var(--muted); font-size: 11px; }
.rca-nums b { font-size: 19px; font-variant-numeric: tabular-nums; }
.rca-nums .neg { color: #ff8099; }
.checks { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 12px; }
.check { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, .025); font-size: 13px; transition: .3s; }
.check .ci { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.check.ok .ci { background: rgba(46, 230, 160, .15); color: var(--green); }
.check.bad .ci { background: rgba(255, 77, 109, .18); color: var(--red); }
.check.info .ci { background: rgba(61, 123, 255, .2); color: #8fb3ff; }
.check.pending { opacity: .55; }
.check.pending .ci { border: 2px solid rgba(34, 229, 255, .25); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
.check.reveal { animation: reveal .5s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes reveal { from { background: rgba(34, 229, 255, .18); } }
.check b { font-weight: 650; font-size: 12.5px; text-align: right; }
.check.bad b { color: #ff8099; }
.check.info b { color: #a9c3ff; }
.check.ok b { color: var(--green); }
.check .cl { color: var(--text-2); }
.verdict { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 13px; background: linear-gradient(130deg, rgba(34, 229, 255, .1), rgba(139, 92, 255, .08)); border: 1px solid rgba(34, 229, 255, .25); }
.verdict.cyber { background: linear-gradient(130deg, rgba(255, 77, 109, .14), rgba(139, 92, 255, .14)); border-color: rgba(255, 77, 109, .4); }
.verdict.normal { background: rgba(46, 230, 160, .07); border-color: rgba(46, 230, 160, .3); }
.verdict.pending { background: rgba(255, 255, 255, .03); border-color: var(--line-hi); border-style: dashed; }
.ring { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .rt { stroke: rgba(255, 255, 255, .07); }
.ring .rv { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 201; transition: stroke-dashoffset 1s; }
.verdict.cyber .ring .rv { stroke: var(--red); }
.verdict.normal .ring .rv { stroke: var(--green); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-weight: 800; }
.verdict small { color: var(--muted); font-size: 10.5px; letter-spacing: 1.4px; font-weight: 700; }
.verdict h3 { margin: 2px 0 4px; font-size: 18px; }
.verdict p { margin: 0; color: var(--text-2); font-size: 12.5px; }
.verdict.cyber h3 { color: #ff8fa5; }
.cause-bars { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.cause-bar { display: grid; grid-template-columns: 190px 1fr 50px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.cause-bar .track { height: 7px; border-radius: 5px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.cause-bar .track i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .8s; }
.cause-bar:first-child .track i { background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.cause-bar b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.section-label { font-size: 10.5px; letter-spacing: 1.5px; color: var(--muted); font-weight: 700; margin: 14px 0 6px; }
.actions-list { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; }
.actions-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 7px 10px; border-radius: 9px; background: rgba(255, 255, 255, .025); animation: slideIn .4s backwards; }
.actions-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.actions-list.cyber li::before { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* ---------- analytics ---------- */
.how-ai { margin-bottom: 14px; }
.how-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.how { position: relative; padding: 14px 16px; border-radius: 13px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.how span { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #041022; margin-bottom: 8px; }
.how b { font-size: 15px; }
.how p { margin: 4px 0 0; color: var(--text-2); font-size: 12.5px; }
.how:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: var(--cyan); font-weight: 700; z-index: 2; }
.analytics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.an-chart { grid-column: span 2; min-height: 330px; display: flex; flex-direction: column; }
.an-scores { min-height: 330px; }
.model-card .big { font-size: 30px; font-weight: 800; letter-spacing: -.8px; }
.model-card .big small { font-size: 13px; color: var(--muted); font-weight: 600; }
.mc-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.mc-rows div { padding: 9px 11px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.mc-rows span { display: block; color: var(--muted); font-size: 11px; }
.mc-rows b { font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips span { font-size: 11.5px; padding: 4px 9px; border-radius: 7px; background: rgba(139, 92, 255, .12); color: #c7b4ff; border: 1px solid rgba(139, 92, 255, .25); }
.imp-row, .score-row { display: grid; grid-template-columns: 150px 1fr 48px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text-2); margin: 7px 0; }
.imp-row .track, .score-row .track { position: relative; height: 8px; border-radius: 5px; background: rgba(255, 255, 255, .06); }
.imp-row .track i, .score-row .track i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .8s; }
.score-row .track em { position: absolute; left: 65%; top: -4px; bottom: -4px; width: 2px; background: var(--amber); opacity: .7; }
.score-row.hi .track i { background: linear-gradient(90deg, #b3203d, var(--red)); }
.score-row.mid .track i { background: linear-gradient(90deg, #c77d10, var(--amber)); }
.imp-row b, .score-row b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.score-row span { font-family: var(--mono); font-size: 12px; }

/* ---------- grid health ---------- */
.feeder-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.feeder { padding: 15px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.feeder.High { border-color: rgba(255, 77, 109, .45); background: linear-gradient(160deg, rgba(255, 77, 109, .12), var(--panel)); }
.feeder.Medium { border-color: rgba(255, 181, 71, .35); background: linear-gradient(160deg, rgba(255, 181, 71, .08), var(--panel)); }
.fd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.fd-head b { font: 650 14px var(--mono); }
.fd-head small { display: block; color: var(--text-2); font-size: 12px; }
.fd-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 12px 0 10px; }
.fd-stats span { display: block; color: var(--muted); font-size: 11px; }
.fd-stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.fd-volt { font-size: 11.5px; color: var(--text-2); }
.fd-volt .meter { margin-top: 5px; }
.grid-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 14px; }
.meter-block { margin-bottom: 16px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.meter-top b { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.meter { position: relative; height: 9px; border-radius: 6px; background: rgba(255, 255, 255, .06); }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--green), var(--cyan)); transition: width .8s, background .5s; }
.meter i.warn { background: linear-gradient(90deg, var(--amber), #ff8a3d); }
.meter i.bad { background: linear-gradient(90deg, #ff8a3d, var(--red)); }
.meter em { position: absolute; top: -5px; bottom: -5px; width: 2px; background: #fff; opacity: .55; }
.meter-block small { color: var(--muted); font-size: 11.5px; }
.action-box { padding: 14px; border-radius: 12px; background: rgba(34, 229, 255, .05); border: 1px solid rgba(34, 229, 255, .18); }
.action-box ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.action-box li { margin: 4px 0; }

/* ---------- cyber ---------- */
.threat-banner { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 14px; margin-bottom: 14px; border: 1px solid rgba(46, 230, 160, .3); background: linear-gradient(100deg, rgba(46, 230, 160, .1), rgba(12, 26, 52, .5)); }
.threat-banner .tb-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(46, 230, 160, .14); color: var(--green); }
.threat-banner h3 { margin: 0; font-size: 17px; }
.threat-banner p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.threat-banner .risk-chip { margin-left: auto; font-size: 13px; padding: 7px 14px; }
.threat-banner.HIGH, .threat-banner.CRITICAL { border-color: rgba(255, 77, 109, .5); background: linear-gradient(100deg, rgba(255, 77, 109, .2), rgba(12, 26, 52, .5)); animation: alarm 2s infinite; }
.threat-banner.HIGH .tb-icon, .threat-banner.CRITICAL .tb-icon { background: rgba(255, 77, 109, .2); color: var(--red); }
@keyframes alarm { 50% { box-shadow: 0 0 34px rgba(255, 77, 109, .25); } }
.cyber-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.ctile { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.ctile span { color: var(--text-2); font-size: 12px; }
.ctile strong { display: block; font-size: 26px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.ctile small { color: var(--muted); font-size: 11.5px; }
.ctile.bad { border-color: rgba(255, 77, 109, .4); }
.ctile.bad strong { color: #ff8099; }
.ctile.good strong { color: #7ff5c8; }
.ctile.info strong { color: #a9c3ff; }
.cyber-layout { display: grid; grid-template-columns: minmax(0, 1fr) 520px; gap: 14px; }
.cluster-bars { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 14px; }
.cb-row { display: grid; grid-template-columns: 70px 1fr 80px; gap: 12px; align-items: center; font-size: 13px; color: var(--text-2); }
.cb-track { height: 26px; border-radius: 8px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.cb-track i { display: block; height: 100%; border-radius: 8px; transition: width 1s; background: repeating-linear-gradient(90deg, var(--cyan) 0 10px, rgba(34, 229, 255, .7) 10px 12px); box-shadow: 0 0 18px rgba(34, 229, 255, .35); }
.cb-track i.bad { background: repeating-linear-gradient(90deg, var(--red) 0 10px, rgba(255, 77, 109, .7) 10px 12px); box-shadow: 0 0 18px rgba(255, 77, 109, .45); }
.cb-row b { font-size: 18px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.cluster-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cluster-stats div { padding: 10px 12px; border-radius: 11px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.cluster-stats span { display: block; font-size: 11px; color: var(--muted); }
.cluster-stats b { font-size: 17px; }
.cluster-stats .bad b { color: #ff8099; }
.flow-title { margin: 18px 0 10px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.decision { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.dstep { position: relative; padding: 11px; border-radius: 11px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); font-size: 12px; }
.dstep b { display: block; font-size: 12.5px; margin-bottom: 3px; }
.dstep span { color: var(--muted); }
.dstep.yes { border-color: rgba(255, 77, 109, .45); background: rgba(255, 77, 109, .08); }
.dstep.yes span { color: #ff8fa5; }
.dstep.no { border-color: rgba(46, 230, 160, .3); }
.dstep.no span { color: var(--green); }
.dstep.final { background: linear-gradient(130deg, rgba(34, 229, 255, .12), rgba(139, 92, 255, .12)); border-color: rgba(139, 92, 255, .4); }
.dstep.final span { color: #fff; font-weight: 700; }
.event-list { display: flex; flex-direction: column; gap: 6px; max-height: 560px; overflow-y: auto; }
.playbook { margin-top: 18px; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); }
.playbook.on { background: rgba(255, 77, 109, .06); border-color: rgba(255, 77, 109, .3); }
.playbook ul { margin-top: 8px; }
.ev { display: grid; grid-template-columns: 64px 74px 1fr; gap: 10px; padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, .025); font-size: 12.5px; align-items: start; animation: slideIn .4s; }
.ev time { font: 500 11px var(--mono); color: var(--muted); padding-top: 2px; }
.ev .lv { font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; text-align: center; }
.ev .lv.low { background: rgba(255, 255, 255, .06); color: var(--muted); }
.ev .lv.medium { background: rgba(255, 181, 71, .14); color: var(--amber); }
.ev .lv.high, .ev .lv.critical { background: rgba(255, 77, 109, .16); color: var(--red); }
.ev b { display: block; font-size: 12px; color: var(--text); }
.ev p { margin: 1px 0 0; color: var(--text-2); }
.ev.critical { background: rgba(255, 77, 109, .07); }

/* ---------- simulation ---------- */
.sim-layout { display: grid; grid-template-columns: 560px minmax(0, 1fr); gap: 14px; align-items: start; }
.sim-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sim-btn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 104px; padding: 12px 13px;
  border-radius: 13px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); text-align: left; transition: .2s; overflow: hidden;
}
.sim-btn:hover { border-color: var(--line-hi); transform: translateY(-2px); background: rgba(34, 229, 255, .05); }
.sim-btn kbd { position: absolute; top: 10px; right: 10px; }
.sim-btn .sev { font-size: 9.5px; font-weight: 800; letter-spacing: 1px; padding: 2px 6px; border-radius: 5px; background: rgba(46, 230, 160, .12); color: var(--green); }
.sim-btn .sev.MEDIUM { background: rgba(255, 181, 71, .13); color: var(--amber); }
.sim-btn .sev.HIGH { background: rgba(255, 138, 61, .15); color: #ff9a55; }
.sim-btn .sev.CRITICAL { background: rgba(255, 77, 109, .16); color: var(--red); }
.sim-btn b { font-size: 13.5px; margin-top: 4px; line-height: 1.25; }
.sim-btn small { color: var(--muted); font-size: 11.5px; }
.sim-btn.cyber { border-color: rgba(139, 92, 255, .28); background: linear-gradient(150deg, rgba(139, 92, 255, .1), rgba(255, 255, 255, .02)); }
.sim-btn.active { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 26px rgba(34, 229, 255, .2); background: rgba(34, 229, 255, .08); }
.sim-btn.active kbd { visibility: hidden; }
.sim-btn.active::after { content: "● RUNNING"; position: absolute; top: 12px; right: 10px; font-size: 9.5px; font-weight: 800; letter-spacing: 1px; color: var(--cyan); animation: blink 1s infinite; }
.sim-note { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(46, 230, 160, .06); border: 1px solid rgba(46, 230, 160, .2); color: var(--text-2); font-size: 12.5px; }
.sim-note i { color: var(--green); display: grid; }
.sim-right { min-height: 640px; padding-bottom: 16px; }
.story { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.story div { padding: 11px 13px; border-radius: 11px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.story b { display: block; color: var(--text); font-size: 11px; letter-spacing: 1.2px; margin-bottom: 3px; }
.live-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.live-num { padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.live-num span { display: block; color: var(--muted); font-size: 11.5px; }
.live-num b { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.live-num b small { font-size: 13px; color: var(--muted); }
.live-num.bad b { color: #ff8099; }
.detect-card { margin-top: 12px; padding: 16px; border-radius: 14px; border: 1px solid rgba(255, 77, 109, .45); background: linear-gradient(120deg, rgba(255, 77, 109, .16), rgba(139, 92, 255, .06)); animation: popIn .45s; }
.detect-card.weather { border-color: rgba(255, 181, 71, .45); background: linear-gradient(120deg, rgba(255, 181, 71, .12), rgba(61, 123, 255, .06)); }
.detect-card.resolved { border-color: rgba(46, 230, 160, .45); background: linear-gradient(120deg, rgba(46, 230, 160, .12), rgba(34, 229, 255, .05)); }
@keyframes popIn { from { opacity: 0; transform: scale(.97); } }
.dc-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; letter-spacing: 1.2px; }
.dc-title .pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(255, 77, 109, .7); animation: pingRed 1.3s infinite; }
.detect-card.weather .pulse { background: var(--amber); animation: none; }
.detect-card.resolved .pulse { background: var(--green); animation: none; }
@keyframes pingRed { 70% { box-shadow: 0 0 0 12px rgba(255, 77, 109, 0); } }
.dc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.dc-grid div span { display: block; font-size: 11px; color: var(--text-2); }
.dc-grid div b { font-size: 17px; }
.inv { color: var(--amber); font-style: italic; }
.sim-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.mini-chart { height: 190px; margin-top: 4px; position: relative; }
.mit-bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; margin-top: 8px; }
.mit-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); transition: width .8s; }
.sim-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; }
.sim-right .sim-actions {
  position: sticky; bottom: -26px; z-index: 5; margin: 14px -18px -16px; padding: 12px 18px 14px;
  background: linear-gradient(180deg, rgba(10, 22, 46, .92), rgba(8, 18, 38, .98)); border-top: 1px solid var(--line-hi);
  border-radius: 0 0 var(--radius) var(--radius); backdrop-filter: blur(10px);
}
.mini-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--line); border-radius: 10px; }
.tips { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(139, 92, 255, .07); border: 1px solid rgba(139, 92, 255, .22); font-size: 13px; }
.tips ol { margin: 6px 0 0; padding-left: 20px; color: var(--text-2); }
.tips li { margin: 4px 0; }
.tips li b { color: var(--text); }
.sim-actions small { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.coord { margin-top: 12px; padding: 14px; border-radius: 13px; background: rgba(0, 0, 0, .2); border: 1px solid rgba(255, 77, 109, .3); }
.coord .cb-row { grid-template-columns: 70px 1fr 80px; margin: 6px 0; }
.coord-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.coord-stats div { text-align: center; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .04); }
.coord-stats b { display: block; font-size: 19px; color: #ff8fa5; }
.coord-stats span { font-size: 11px; color: var(--text-2); }
.sim-idle { display: grid; place-content: center; text-align: center; min-height: 560px; color: var(--text-2); gap: 10px; }
.sim-idle .orb { width: 92px; height: 92px; margin: 0 auto 6px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(34, 229, 255, .5), rgba(139, 92, 255, .2) 60%, transparent 70%); box-shadow: 0 0 60px rgba(34, 229, 255, .25); animation: float 6s ease-in-out infinite; }
.sim-idle h3 { margin: 0; color: var(--text); font-size: 20px; }

/* ---------- reports ---------- */
.report-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.report-actions { display: flex; gap: 8px; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line-hi); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--text-2); }
td b { color: var(--text); }
tr:hover td { background: rgba(34, 229, 255, .03); }
.empty-row td { text-align: center; color: var(--muted); padding: 30px; }

/* ---------- global banner / toasts ---------- */
.alert-banner {
  position: fixed; top: 14px; left: 50%; z-index: 60; transform: translate(-50%, -160%); opacity: 0; pointer-events: none;
  transition: transform .5s cubic-bezier(.2, .9, .3, 1.2), opacity .3s;
  display: flex; align-items: center; gap: 16px; padding: 12px 14px 12px 18px; border-radius: 14px; min-width: 620px;
  background: linear-gradient(110deg, rgba(120, 14, 40, .95), rgba(40, 14, 70, .95)); border: 1px solid rgba(255, 77, 109, .6);
  box-shadow: 0 20px 60px rgba(255, 30, 70, .3);
}
.alert-banner.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.alert-banner.weather { background: linear-gradient(110deg, rgba(110, 70, 10, .95), rgba(20, 40, 80, .95)); border-color: rgba(255, 181, 71, .6); box-shadow: 0 20px 60px rgba(255, 160, 40, .2); }
.alert-banner .ab-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); font-size: 20px; font-weight: 800; animation: blink 1s infinite; }
.alert-banner .ab-text { flex: 1; }
.alert-banner .ab-text small { display: block; font-size: 10.5px; letter-spacing: 1.6px; font-weight: 800; color: #ffc2cf; }
.alert-banner .ab-text b { font-size: 15px; }
.alert-banner .ab-close { background: none; border: 0; font-size: 20px; color: #ffc2cf; padding: 0 6px; }
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 55; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 300px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: rgba(10, 22, 46, .96); border: 1px solid var(--line-hi); box-shadow: var(--shadow); font-size: 13px; animation: toastIn .35s; }
.toast b { display: block; margin-bottom: 2px; }
.toast.ok { border-color: rgba(46, 230, 160, .5); }
.toast.warn { border-color: rgba(255, 181, 71, .5); }
.toast.crit { border-color: rgba(255, 77, 109, .6); }
.toast.out { opacity: 0; transform: translateX(20px); transition: .35s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }

/* ---------- tour ---------- */
.tour-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; width: min(1100px, calc(100vw - 40px));
  display: grid; grid-template-columns: 120px 1fr auto; gap: 18px; align-items: center; padding: 14px 16px 14px 20px; border-radius: 16px;
  background: linear-gradient(120deg, rgba(30, 16, 70, .97), rgba(8, 26, 56, .97)); border: 1px solid rgba(139, 92, 255, .55);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5), 0 0 40px rgba(139, 92, 255, .2); animation: popIn .4s;
}
.tour-step span { font: 700 13px var(--mono); color: #c7b4ff; }
.tour-progress { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .1); margin-top: 6px; overflow: hidden; }
.tour-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.tour-text b { font-size: 15px; }
.tour-text p { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
.tour-ctrl { display: flex; gap: 8px; }
.tour-ctrl .btn { height: 34px; padding: 0 12px; }
.tour-focus { outline: 2px solid rgba(139, 92, 255, .9); outline-offset: 3px; box-shadow: 0 0 40px rgba(139, 92, 255, .35) !important; transition: .3s; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; background: rgba(2, 6, 16, .7); backdrop-filter: blur(6px); }
.modal.open { display: grid; }
.modal-card { position: relative; width: min(760px, calc(100vw - 32px)); padding: 24px 26px; border-radius: 18px; background: var(--panel-solid); border: 1px solid var(--line-hi); box-shadow: var(--shadow); animation: popIn .3s; }
.modal-card h2 { margin: 4px 0 14px; }
.modal-card h3 { font-size: 13px; color: var(--text-2); margin: 18px 0 8px; letter-spacing: .4px; }
.modal-card .close { position: absolute; top: 14px; right: 14px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help-grid div { padding: 12px; border-radius: 11px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.help-grid p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.keys { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1600px) {
  .kpi strong { font-size: 23px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr) 360px; }
  .fleet-layout { grid-template-columns: minmax(0, 1fr) 420px; }
  .sim-layout { grid-template-columns: 480px minmax(0, 1fr); }
  .cyber-layout { grid-template-columns: minmax(0, 1fr) 440px; }
  .pipe-txt span { display: none; }
}
@media (max-height: 920px) and (min-width: 1281px) {
  .topbar { padding: 10px 26px 9px; }
  .topbar h1 { font-size: 20px; }
  .page { padding-top: 12px; }
  .kpi { padding: 9px 13px 8px; }
  .kpi strong { font-size: 22px; margin: 1px 0 0; }
  .kpi small { display: none; }
  .pipeline { margin-top: 10px; padding: 6px 10px; }
  .pipe-ico { width: 26px; height: 26px; }
  .dash-grid { margin-top: 10px; gap: 10px; height: calc(100vh - 272px); min-height: 480px; grid-template-rows: minmax(0, 1fr) 190px; }
  .side-col { gap: 10px; }
  .panel { padding: 12px 14px; }
  .panel-head { margin-bottom: 8px; }
  .gauge { width: 96px; height: 96px; }
  .g-center strong { font-size: 27px; }
  #gaugeText { display: none; }
  .phase-track { margin: 6px 0 2px; }
  .im-grid { margin: 6px 0; gap: 6px; }
  .im-grid div { padding: 6px 9px; }
  .twin-wrap { min-height: 260px; }
  .th-stats { display: none; }
  #dayCurve { height: 52px; }
  .time-ctrl input[type="range"] { width: 130px; }
}
@media (max-width: 1280px) {
  body { overflow: auto; }
  .app { grid-template-columns: 76px 1fr; }
  .brand div, .nav-item span, .side-label, .tour-btn span, .engine-card { display: none; }
  .nav-item { justify-content: center; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .pipeline { grid-template-columns: repeat(4, 1fr); row-gap: 6px; }
  .dash-grid { grid-template-columns: 1fr; grid-template-areas: "twin" "chart" "side"; grid-template-rows: 420px 260px auto; height: auto; }
  .fleet-layout, .sim-layout, .cyber-layout, .grid-layout { grid-template-columns: 1fr; }
  .feeder-grid, .cyber-tiles, .report-tiles { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid, .how-steps { grid-template-columns: 1fr 1fr; }
  .topbar { flex-wrap: wrap; }
  .alert-banner { min-width: 0; width: calc(100vw - 32px); }
}

@media print {
  body { background: #fff; color: #000; overflow: visible; }
  .sidebar, .topbar .top-actions, .bg-grid, .bg-glow, .tour-bar, .toasts, .alert-banner, .report-actions { display: none !important; }
  .app { display: block; height: auto; }
  .main { height: auto; overflow: visible; }
  .page { display: none !important; }
  #page-reports { display: block !important; overflow: visible; }
  .panel, .ctile { background: #fff; border-color: #ccc; box-shadow: none; backdrop-filter: none; color: #000; }
  td, th, .plain, .ctile span, .ctile small { color: #222; }
}

/* =====================================================================
   3D DIGITAL TWIN — full view page
   ===================================================================== */
.nav-badge.live-badge { display: grid; background: rgba(46, 230, 160, .14); color: var(--green); font-size: 9.5px; letter-spacing: .8px; padding: 0 6px; }
.twin-expand { height: 28px; padding: 0 10px; font-size: 12px; margin-left: 4px; }
.twin-legend { align-items: center; }
.lg.sunl { background: var(--sun); box-shadow: 0 0 8px var(--sun); border-radius: 50%; }
.lg.col { width: 6px; height: 12px; border-radius: 2px; background: linear-gradient(0deg, var(--cyan), rgba(34, 229, 255, .2)); }

.twin-page { padding-bottom: 18px; }
.tw-layout { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: 14px; height: calc(100vh - 150px); min-height: 560px; }

.tw-stage {
  position: relative; min-height: 0; border-radius: 20px; overflow: hidden; isolation: isolate;
  border: 1px solid rgba(34, 229, 255, .28);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 255, .12), 0 30px 80px rgba(0, 0, 0, .45), 0 0 70px rgba(34, 229, 255, .08);
  background: #040b18;
}
.tw-stage::after {   /* slow scan line across the top edge */
  content: ""; position: absolute; left: -30%; top: 0; width: 30%; height: 2px; z-index: 6; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); animation: scan 6s linear infinite; opacity: .8;
}
@keyframes scan { to { left: 100%; } }
.tw-stage .twin-wrap { position: absolute; inset: 0; min-height: 0; border: 0; border-radius: inherit; }
/* CSS2D labels get their own z-indexes; keep them inside the 3D layer so overlays stay on top */
.twin-wrap { z-index: 0; }
.twin-wrap .time-hud, .twin-wrap .time-ctrl { z-index: 60; }
.tw-stage .twin-wrap::after {  /* soft vignette */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(2, 6, 16, .55) 100%);
}
.tw-stage .twin-hint { display: none; }
.tw-stage .time-hud { left: 18px; top: 18px; width: 304px; padding: 12px 14px 10px; }
.tw-stage .th-clock { font-size: 32px; }
.tw-stage #dayCurve { height: 86px; }
.tw-stage .th-stats b { font-size: 14px; }
.tw-stage .time-ctrl { left: 18px; bottom: 16px; padding: 6px 7px; }
.tw-stage .time-ctrl input[type="range"] { width: 230px; }
.tw-stage .twin-label .tl-box { font-size: 12px; }
.tw-stage .twin-label.house span { font-size: 12px; }
.tw-stage .twin-label em { font-size: 11px; }

.tw-corner { position: absolute; z-index: 6; width: 26px; height: 26px; pointer-events: none; border-color: var(--cyan); border-style: solid; border-width: 0; filter: drop-shadow(0 0 6px rgba(34, 229, 255, .8)); }
.tw-corner.tl { left: 8px; top: 8px; border-left-width: 2px; border-top-width: 2px; border-top-left-radius: 8px; }
.tw-corner.tr { right: 8px; top: 8px; border-right-width: 2px; border-top-width: 2px; border-top-right-radius: 8px; }
.tw-corner.bl { left: 8px; bottom: 8px; border-left-width: 2px; border-bottom-width: 2px; border-bottom-left-radius: 8px; }
.tw-corner.br { right: 8px; bottom: 8px; border-right-width: 2px; border-bottom-width: 2px; border-bottom-right-radius: 8px; }

/* incident / status ribbon */
.tw-ribbon {
  position: absolute; z-index: 5; top: 18px; left: 340px; right: 132px; margin: 0 auto; width: fit-content; max-width: calc(100% - 472px);
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 12px; font-size: 12.5px; color: var(--text-2);
  background: rgba(4, 14, 30, .78); border: 1px solid rgba(46, 230, 160, .35); backdrop-filter: blur(10px); white-space: nowrap; overflow: hidden;
}
.tw-ribbon b { color: var(--text); }
.tw-ribbon .rb-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tw-ribbon i { color: var(--amber); }
.tw-ribbon .btn { height: 28px; padding: 0 10px; font-size: 12px; }
.rb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex-shrink: 0; box-shadow: 0 0 10px var(--green); }
.rb-sep { width: 1px; height: 14px; background: var(--line-hi); flex-shrink: 0; }
.tw-ribbon.warn { border-color: rgba(255, 181, 71, .55); background: linear-gradient(100deg, rgba(90, 56, 8, .85), rgba(4, 14, 30, .8)); }
.tw-ribbon.warn .rb-dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.tw-ribbon.crit { border-color: rgba(255, 77, 109, .6); background: linear-gradient(100deg, rgba(100, 10, 34, .88), rgba(30, 10, 60, .82)); box-shadow: 0 0 34px rgba(255, 77, 109, .25); }
.tw-ribbon.crit .rb-dot { background: var(--red); box-shadow: 0 0 0 0 rgba(255, 77, 109, .7); animation: pingRed 1.3s infinite; }

/* right-side vertical toolbar */
.tw-toolbar {
  position: absolute; z-index: 5; right: 16px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px;
  padding: 10px 8px; border-radius: 14px; background: rgba(4, 12, 28, .75); border: 1px solid var(--line-hi); backdrop-filter: blur(10px);
}
.tw-group { display: flex; flex-direction: column; gap: 4px; }
.tw-glabel { font-size: 9.5px; font-weight: 800; letter-spacing: 1.4px; color: var(--muted); padding: 0 4px 2px; }
.tw-toolbar button, .tw-scen button {
  height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
  color: var(--text-2); font-size: 11.5px; font-weight: 650; text-align: left; white-space: nowrap; transition: .15s;
}
.tw-toolbar button:hover, .tw-scen button:hover { color: #fff; border-color: var(--line-hi); background: rgba(34, 229, 255, .08); }
.tw-toolbar button.on { color: #041022; background: linear-gradient(120deg, var(--cyan), #7ff0ff); border-color: var(--cyan); box-shadow: 0 0 14px rgba(34, 229, 255, .35); }
.tw-toolbar .tw-fs { border-color: rgba(139, 92, 255, .45); background: rgba(139, 92, 255, .14); color: #d9ccff; }

/* bottom-right: legend + scenario chips */
.tw-bottom { position: absolute; z-index: 5; right: 16px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: calc(100% - 640px); }
.tw-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; padding: 7px 12px; border-radius: 10px; font-size: 11.5px; color: var(--text-2); background: rgba(4, 12, 28, .72); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.tw-scen { display: flex; align-items: flex-start; gap: 8px; padding: 7px 8px; border-radius: 12px; background: rgba(4, 12, 28, .75); border: 1px solid var(--line-hi); backdrop-filter: blur(8px); }
.tw-scen .tw-glabel { padding-top: 8px; }
#twScenarios { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 520px; }
.tw-scen button kbd { font-size: 9.5px; padding: 0 4px; margin-right: 5px; }
.tw-scen button.cyber { border-color: rgba(139, 92, 255, .35); }
.tw-scen button.on { border-color: var(--red); color: #fff; background: rgba(255, 77, 109, .2); box-shadow: 0 0 14px rgba(255, 77, 109, .3); }

/* side panels */
.tw-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-right: 2px; }
.tw-side::-webkit-scrollbar { width: 6px; }
.tw-side::-webkit-scrollbar-thumb { background: rgba(110, 180, 255, .2); border-radius: 6px; }
.tw-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex-shrink: 0; }
.twk { position: relative; padding: 11px 13px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.twk::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--cyan), transparent); opacity: .7; }
.twk span { display: block; color: var(--text-2); font-size: 11.5px; }
.twk b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin: 2px 0; }
.twk b u { text-decoration: none; font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 600; }
.twk small { color: var(--muted); font-size: 10.5px; }
.twk-bar { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .07); margin: 3px 0 4px; overflow: hidden; }
.twk-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), var(--cyan)); transition: width .8s; }

.tws-card { flex-shrink: 0; position: relative; padding: 14px 15px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.tws-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(135deg, rgba(120, 200, 255, .07), transparent 40%); }
.tws-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.tws-head h3 { margin: 2px 0 0; font-size: 16px; }
.tws-head p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.tws-head > div { min-width: 0; }
#twPlant .tws-head p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#twPlant .tws-head h3 { font: 700 20px var(--mono); }
.twp-big { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.twp-big div { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); }
.twp-big span { display: block; color: var(--muted); font-size: 10.5px; }
.twp-big b { font-size: 19px; font-variant-numeric: tabular-nums; }
.twp-big b u { text-decoration: none; font-size: 11px; color: var(--muted); margin-left: 2px; }
.neg { color: #ff8099 !important; }
.twp-cap { position: relative; height: 10px; margin-top: 10px; border-radius: 6px; background: rgba(255, 255, 255, .06); }
.twp-cap i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, #c79a2b, var(--sun)); box-shadow: 0 0 12px rgba(255, 209, 102, .35); transition: width .8s; }
.twp-cap em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; border-radius: 2px; opacity: .8; }
.twp-capl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.twp-spark { display: block; width: 100%; height: 74px; margin: 8px 0 4px; border-radius: 10px; background: rgba(0, 0, 0, .18); border: 1px solid var(--line); }
.twp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; margin: 8px 0; }
.twp-stats span { display: block; color: var(--muted); font-size: 10.5px; }
.twp-stats b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.twp-verdict { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; background: rgba(34, 229, 255, .07); border: 1px solid rgba(34, 229, 255, .25); }
.twp-verdict small { font-size: 9.5px; letter-spacing: 1.2px; color: var(--muted); font-weight: 800; }
.twp-verdict b { flex: 1; font-size: 13px; }
.twp-verdict em { font-style: normal; font-weight: 800; color: var(--cyan); }
.twp-verdict.cyber { background: rgba(255, 77, 109, .1); border-color: rgba(255, 77, 109, .4); }
.twp-verdict.cyber b, .twp-verdict.cyber em { color: #ff8fa5; }
.twp-verdict.normal { background: rgba(46, 230, 160, .07); border-color: rgba(46, 230, 160, .3); }
.twp-verdict.normal em { color: var(--green); }
.twp-verdict.weather em, .twp-verdict.physical em, .twp-verdict.grid em { color: var(--amber); }
.twp-verdict.pending { color: var(--amber); font-size: 12.5px; border-style: dashed; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 181, 71, .25); border-top-color: var(--amber); animation: spin .8s linear infinite; }
.twp-actions { display: flex; gap: 8px; margin-top: 10px; }
.twp-actions .btn { flex: 1; justify-content: center; height: 34px; }

.twf { padding: 7px 0; border-top: 1px dashed var(--line); }
.twf:first-of-type { border-top: 0; }
.twf-top { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.twf-top b { font: 650 11.5px var(--mono); }
.twf-top span { flex: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.twf-top em { font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; }
.risk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.risk-dot.Medium { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.risk-dot.High { background: var(--red); box-shadow: 0 0 8px var(--red); animation: blink 1s infinite; }
.twf-bar { position: relative; height: 7px; border-radius: 5px; background: rgba(255, 255, 255, .06); margin: 6px 0 3px; }
.twf-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .8s; }
.twf-bar i.bad { background: linear-gradient(90deg, #b3203d, var(--red)); }
.twf-bar em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; opacity: .6; }
.twf-num { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }

.twl { display: grid; grid-template-columns: 20px 58px 1fr 44px; gap: 8px; align-items: center; width: 100%; padding: 5px 6px; border-radius: 8px; border: 1px solid transparent; background: none; font-size: 12px; text-align: left; }
.twl:hover { background: rgba(34, 229, 255, .05); }
.twl.sel { border-color: rgba(34, 229, 255, .45); background: rgba(34, 229, 255, .08); }
.twl-rank { font: 700 11px var(--mono); color: var(--muted); }
.twl-id { font: 600 11.5px var(--mono); }
.twl-bar { height: 7px; border-radius: 5px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.twl-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #c79a2b, var(--sun)); }
.twl.critical .twl-bar i { background: linear-gradient(90deg, #b3203d, var(--red)); }
.twl.warning .twl-bar i { background: linear-gradient(90deg, #c77d10, var(--amber)); }
.twl b { text-align: right; font-variant-numeric: tabular-nums; color: #ffd98a; }

/* fullscreen */
#page-twin:fullscreen, #page-twin.is-fs { padding: 14px; background: radial-gradient(1200px 700px at 60% -10%, #0c2350 0%, transparent 60%), var(--bg); overflow: hidden; }
#page-twin:fullscreen .tw-layout, #page-twin.is-fs .tw-layout { height: calc(100vh - 28px); }

@media (max-height: 920px) and (min-width: 1281px) {
  .tw-layout { height: calc(100vh - 118px); }
  .tw-stage .time-hud { width: 280px; }
  .tw-stage #dayCurve { height: 60px; }
  .twp-spark { height: 56px; }
}
@media (max-width: 1600px) {
  .tw-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .tw-ribbon { left: 300px; right: 104px; max-width: calc(100% - 420px); font-size: 12px; }
  .tw-bottom { display: none; }               /* scenarios stay on keys 1-9 and the Simulation Lab */
  .tw-toolbar { right: 12px; padding: 8px 6px; gap: 8px; }
  .tw-toolbar button { height: 25px; padding: 0 8px; font-size: 11px; }
  .tw-stage .time-ctrl input[type="range"] { width: 150px; }
}
@media (max-width: 1280px) {
  .tw-layout { grid-template-columns: 1fr; height: auto; }
  .tw-stage { height: 620px; }
  .tw-bottom { display: none; }
}

/* ---------------- weather layers on the 3D twin ---------------- */
.wx-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.wx-overlay i { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s; }
.wx-cloud { background: linear-gradient(180deg, rgba(96, 110, 132, .72) 0%, rgba(58, 68, 86, .42) 50%, rgba(14, 18, 28, .32) 100%); }
.wx-haze { background: linear-gradient(180deg, rgba(150, 110, 60, .38) 0%, rgba(120, 90, 50, .22) 60%, rgba(60, 40, 20, .2) 100%); }
.wx-fog { background: linear-gradient(180deg, rgba(170, 186, 204, .30) 0%, rgba(150, 168, 188, .42) 55%, rgba(120, 138, 160, .30) 100%); }
.wx-heat { background: linear-gradient(180deg, rgba(255, 150, 60, .16) 0%, rgba(255, 90, 40, .05) 50%, rgba(255, 110, 40, .18) 100%); animation: heatPulse 3s ease-in-out infinite; }
@keyframes heatPulse { 50% { filter: brightness(1.25); } }
.wx-flash { background: radial-gradient(ellipse at 40% 10%, rgba(230, 240, 255, .9), rgba(200, 220, 255, .35) 60%, transparent 100%); transition: none !important; }

.wx-card {
  position: absolute; z-index: 5; left: 18px; bottom: 66px; width: 304px; padding: 10px 12px; border-radius: 12px;
  background: rgba(4, 12, 28, .76); border: 1px solid rgba(120, 190, 255, .3); backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.wx-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.wx-head b { font-size: 13px; }
.wx-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wx-chips button {
  height: 40px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); font-size: 17px; line-height: 1;
  display: grid; place-items: center; transition: .15s; position: relative;
}
.wx-chips button:hover { border-color: var(--line-hi); background: rgba(34, 229, 255, .08); transform: translateY(-1px); }
.wx-chips button.on { border-color: var(--sun); background: rgba(255, 209, 102, .16); box-shadow: 0 0 14px rgba(255, 209, 102, .3); }
.wx-impact { margin-top: 8px; font-size: 11.5px; color: var(--text-2); }
.wx-row { display: flex; justify-content: space-between; align-items: baseline; }
.wx-row b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.wx-row b.neg { color: #ff8099; }
.wx-bar { position: relative; height: 7px; border-radius: 5px; background: rgba(255, 255, 255, .07); margin: 5px 0 3px; overflow: hidden; }
.wx-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: linear-gradient(90deg, #c79a2b, var(--sun)); transition: width 1s; }
.wx-note { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; }

.tws-card.wx-resp .wx-ai { padding: 9px 11px; border-radius: 10px; background: rgba(46, 230, 160, .07); border: 1px solid rgba(46, 230, 160, .28); font-size: 12.5px; color: var(--text-2); }
.tws-card.wx-resp .wx-ai b { color: var(--green); display: block; font-size: 10px; letter-spacing: 1.2px; margin-bottom: 2px; }
.wx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.wx-stats div { padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); }
.wx-stats span { display: block; color: var(--muted); font-size: 10px; }
.wx-stats b { font-size: 14px; font-variant-numeric: tabular-nums; }

@media (max-height: 920px) and (min-width: 1281px) {
  .wx-card { bottom: 60px; width: 280px; padding: 8px 10px; }
  .wx-chips button { height: 32px; font-size: 15px; }
  .wx-note { display: none; }
}

.w-wx { font-size: 15px; line-height: 1; }

/* ---------------- layout fixes for laptop screens (from full test pass) ---------------- */
/* Simulation Lab: "RUNNING" tag sits at the bottom so it never covers the severity chip */
.sim-btn.active { padding-bottom: 24px; }
.sim-btn.active kbd { visibility: visible; }
.sim-btn.active::after { top: auto; bottom: 8px; right: 10px; }

/* Dashboard 3D panel: keep the time HUD compact on smaller screens so the scene stays visible */
@media (max-width: 1600px) {
  .twin-panel .time-hud { width: 214px; padding: 8px 10px; }
  .twin-panel .th-clock { font-size: 22px; }
  .twin-panel .th-stats, .twin-panel #dayCurve, .twin-panel .th-foot { display: none; }
}

/* 1281–1440 px (e.g. 1366 × 768 laptops): icon-rail sidebar gives the content ~170 px more */
@media (max-width: 1440px) and (min-width: 1281px) {
  .app { grid-template-columns: 76px 1fr; }
  .brand div, .nav-item span, .side-label, .tour-btn span, .engine-card, .nav-badge.live-badge { display: none !important; }
  .brand { justify-content: center; padding: 4px 0 14px; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-badge { position: absolute; top: 3px; right: 6px; min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; }
  .tour-btn { justify-content: center; padding: 12px 0; }
  .sidebar { padding: 22px 10px; }
  .kpi-label { font-size: 11px; }
  .kpi strong { font-size: 20px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr) 340px; }
  .tw-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .tw-stage .time-hud { width: 248px; }
  .tw-stage .th-stats { display: none; }
  .wx-card { width: 262px; }
  .wx-note { display: none; }
  .tw-ribbon { left: 270px; max-width: calc(100% - 390px); }
  .sim-layout { grid-template-columns: 430px minmax(0, 1fr); }
  .fleet-layout { grid-template-columns: minmax(0, 1fr) 390px; }
}

.wx-bar s { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(90deg, var(--red) 0 4px, rgba(255, 77, 109, .55) 4px 6px); text-decoration: none; transition: left 1s, width 1s; }
.wx-row.wx-scen span { color: #ffb0bf; }
.wx-scen-note { margin: 0 0 10px; padding: 8px 10px; border-radius: 9px; font-size: 12px; color: var(--text-2); background: rgba(255, 77, 109, .08); border: 1px solid rgba(255, 77, 109, .3); }
.wx-scen-note b { color: #ff9fb1; }
