/* ==========================================================================
   SmartMill365 — Palm Oil Mill Digital Twin · base styles (foundation)
   Fixed 1920x1080 stage scaled to fit. Topbar 64px; each .view is the
   1920x1016 area below it (padding 14px 16px → 1888x988 content box).

   SHARED COMPONENT CLASSES (use these in every view; view CSS files only add
   layout, and every selector in css/<view>.css is prefixed #view-<key>):

   Status modifier vocabulary used by all components:
     ok (green · Running/Stable) · watch (amber · Watch/Medium) · crit (red · Attention/High/Stopped)
     info (cyan/blue) · off (grey · Standby/Idle)
   SM.ui.clsOf(anyStatusWord) maps sim words ('running','attention','stopped','standby','high',...) to these.
   NB: station status 'attention' → watch (amber, as concept-4); the red "Attention" is the mill class M.cls 'crit'.

   .panel                 card container (flex column). Children: .panel-h, .panel-b
     .panel.ok|watch|crit  coloured border (and red glow for crit)
     .panel.flat            no corner accents
   .panel-h               title row: <div class="panel-h"><span class="ico">svg</span>
                            <div class="ttl">Title <small>· last 6 hours</small></div>
                            <div class="r">right-side chip / legend / select</div></div>
     .panel-h.caps          uppercase title (group page style)
   .panel-b               body (flex:1, padding 0 14px 12px)
   .kpi-row               grid of KPI tiles, height 92px. .k3 .k4 .k5 .k6 = column count
   .kpi                   KPI tile — build with SM.ui.kpi(opts), update with SM.ui.kpiSet(el, opts)
                            .kpi-ic (icon slot, round) | .kpi-img (picture slot) | .kpi-b > .kpi-l label,
                            .kpi-v (.v value .u unit .kpi-d delta), .kpi-s sub line | .kpi-spark (sparkbars)
     .kpi.big               larger icon (group page style)
   .status-tile           big state tile (RUNNING / ATTENTION / STOPPED) — SM.ui.statusTile / statusSet
                            .ok .watch .crit .off ; children .st-l label, .st-ic icon, .st-txt state, .st-note
   .badge                 pill: .ok .watch .crit .info .off ; + .solid (filled) ; + .dot (leading dot)
                            (legacy aliases .b-ok .b-watch .b-crit .b-info .b-off .b-maint still work)
   .chip                  small square-ish tag (e.g. AUTO, DIGESTER ON): .ok .watch .crit .info .off .ghost
   .bar                   progress bar: <div class="bar [watch|crit|cyan|off|violet]"><i style="width:60%"></i></div>
                            .bar.thin (4px) .bar.thick (10px) ; <i class="tail"> optional second segment
   .bar-row               label | bar | value grid row: <div class="bar-row"><span class="l"/>.bar<span class="v"/></div>
   .seg                   segmented buttons: <div class="seg"><button class="on">Today</button>…</div> ; .seg.sm
   .gauge-wrap            needle gauge block: <div class="gauge-wrap"><div class="g-l">MOTOR</div>
                            SM.ui.gauge({...}) <div class="g-v num">48.3<small>A</small></div></div>
                            .gauge-wrap.sm (small, value hidden inside svg) ; .gauge-wrap.lg
   .mini-table            compact table: <table class="mini-table"> th/td; tr.ok|watch|crit gets a left stripe;
                            td.num right-aligned tabular numbers ; tr.click hover highlight
   .trend-panel           .panel with a chart: .panel-h (title + .legend) then <div class="trend-body"><canvas></canvas></div>
                            draw with SM.ui.trend(canvas, series, opts) ; legend HTML from SM.ui.legend(items)
   .legend                inline legend: <div class="legend"><span><i style="background:#f00"></i>BPV</span></div>
   .unit-card             equipment card (use with .panel): .uc-h header row (.uc-id, .uc-sub, badge, .chip AUTO),
                            .uc-prog (cycle line + .bar), .uc-body grid (.render slot + .uc-side),
                            .uc-alarm (amber/red strip). .unit-card.ok|watch|crit|off colours the border.
   .render                3D slot measured by SM.three.MultiView (dark radial backdrop). Overlays inside it:
                            <div class="ovl tl|tr|bl|br|bc">…</div> are drawn ABOVE the shared WebGL canvas.
   .mv-canvas             the shared MultiView canvas (absolute, inset 0, pointer-events none, z-index 5)
   .valve-row             label | bar | % | state : <div class="valve-row open|throttle|closed">… — SM.ui.valveRow / valveSet
   .level-bar             vertical tank level with FULL / LOW / EMPTY text — SM.ui.levelBar / levelSet
   .info-grid             small key/value boxes (Door CLOSED): .c2 .c3 .c4 columns; .ib > .k + .v(.ok|.watch|.crit)
   .cap                   small uppercase section caption (VALVE POSITION, CYCLE INFO)
   .alert-list/.alert-row attention list rows — SM.ui.alertRow(alert)
   .st-icon               round coloured station icon — SM.ui.stIcon(key)
   .tbtn                  small toggle button (.on)
   Text helpers: .num .muted .dim .c-green .c-amber .c-red .c-cyan .c-violet ; .up/.dn delta colours
   ========================================================================== */

/* Barlow (SIL OFL 1.1, see assets/fonts/OFL.txt) — used where Bahnschrift / Segoe UI are not installed */
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/barlow-semi-condensed-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/barlow-semi-condensed-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/barlow-semi-condensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('../assets/fonts/barlow-semi-condensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/barlow-600.woff2') format('woff2'); }

:root {
  --bg0: #020814;
  --bg1: #061226;
  --bg2: #0a1b36;
  --panel: rgba(8, 22, 46, 0.82);
  --panel-solid: #0a1a35;
  --panel-hi: rgba(20, 48, 92, 0.55);
  --border: rgba(64, 145, 255, 0.24);
  --border-hi: rgba(64, 190, 255, 0.55);
  --line: rgba(120, 170, 255, 0.10);
  --text: #e8f1ff;
  --text-dim: #93acd0;
  --text-mute: #6681a8;
  --cyan: #2fd4ff;
  --blue: #3d8bff;
  --green: #22d982;
  --brand-green: #3ccf4e;
  --amber: #ffb224;
  --red: #ff4b5c;
  --violet: #a98bff;
  --pink: #ff6bd5;
  --grey: #7f8ea6;
  --ok: var(--green); --watch: var(--amber); --crit: var(--red); --info: var(--cyan); --off: var(--grey);
  --num: 'Bahnschrift SemiCondensed', 'Bahnschrift', 'Barlow Semi Condensed', 'Segoe UI', Arial, sans-serif;
  --ui: 'Segoe UI', 'Barlow', Roboto, Arial, sans-serif;
  --tb-h: 64px;
  --r: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #01050d; }
body { font-family: var(--ui); color: var(--text); -webkit-font-smoothing: antialiased; user-select: none; font-size: 14px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
table { border-collapse: collapse; }

#stage {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  overflow: hidden; overflow: clip;
  background:
    radial-gradient(1200px 700px at 50% 45%, rgba(18, 60, 130, 0.32), transparent 70%),
    radial-gradient(900px 500px at 85% 100%, rgba(0, 140, 200, 0.10), transparent 70%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}
#stage::before { /* faint tech grid */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image:
    linear-gradient(rgba(80, 140, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 140, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.c-green { color: var(--green); } .c-amber { color: var(--amber); } .c-red { color: var(--red); } .c-cyan { color: var(--cyan); } .c-violet { color: var(--violet); } .c-grey { color: var(--grey); }
.up { color: var(--green); } .dn { color: var(--red); }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes critglow { 50% { box-shadow: 0 0 22px rgba(255, 75, 92, 0.5) inset, 0 0 14px rgba(255, 75, 92, 0.35); } }
@keyframes watchglow { 50% { box-shadow: 0 0 18px rgba(255, 178, 36, 0.35) inset; } }

/* ================================================================== TOPBAR */
#topbar {
  position: absolute; left: 0; right: 0; top: 0; height: var(--tb-h); z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 0 22px;
  background: linear-gradient(180deg, rgba(6, 20, 44, 0.96), rgba(4, 14, 32, 0.88));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}
#topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: 0.55;
}
#topbar.tb-group .m-only, #topbar.tb-mill .g-only { display: none !important; }

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: none; }
.brand svg { width: 42px; height: 42px; filter: drop-shadow(0 0 8px rgba(47, 212, 255, 0.45)); }
.brand .word { font-family: var(--num); font-size: 28px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; }
.brand .word i { font-style: normal; color: #9fd2ff; }
.brand .word b { color: var(--brand-green); font-weight: 700; }
.tb-sep { width: 1px; height: 36px; background: var(--border); flex: none; }
.tb-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tb-title .t1 { font-family: var(--num); font-weight: 700; font-size: 19px; letter-spacing: 1.4px; color: #7cc4ff; text-transform: uppercase; white-space: nowrap; }
.tb-title .t2 { font-size: 14px; color: var(--text-mute); letter-spacing: 0.4px; white-space: nowrap; }

.tb-back { display: flex; align-items: center; gap: 7px; font-size: 15px; color: var(--text-dim); padding: 6px 4px; white-space: nowrap; flex: none; }
.tb-back .ar { font-size: 17px; }
.tb-back:hover { color: var(--cyan); }
.tb-mtitle { display: flex; flex-direction: column; line-height: 1.12; flex: none; min-width: 0; }
.tb-mtitle .mt1 { font-family: var(--num); font-size: 25px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; }
.tb-mtitle .mt2 { font-size: 14px; color: var(--text-dim); white-space: nowrap; }

.st-tabs { display: flex; align-items: center; gap: 2px; padding: 3px; margin-left: 6px; border: 1px solid var(--border); border-radius: 8px; background: rgba(4, 14, 34, 0.7); flex: none; }
.st-tabs button { position: relative; padding: 7px 13px; font-size: 14.5px; color: var(--text-dim); border-radius: 6px; white-space: nowrap; transition: background .2s, color .2s; }
.st-tabs button:hover { color: var(--text); background: rgba(47, 140, 255, 0.10); }
.st-tabs button.on { color: #fff; background: linear-gradient(180deg, #1e6fe0, #1553b5); box-shadow: 0 0 12px rgba(30, 111, 224, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.st-tabs button .sd { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; display: none; }
.st-tabs button.s-watch .sd { display: block; background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.st-tabs button.s-crit .sd { display: block; background: var(--red); box-shadow: 0 0 8px var(--red); animation: blink 1s infinite; }

.tb-spacer { flex: 1; min-width: 0; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; flex: none; }
.seg button { padding: 7px 18px; font-size: 14px; color: var(--text-dim); border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--text); }
.seg button.on { background: linear-gradient(180deg, #1e6fe0, #1553b5); color: #fff; }
.seg.sm button { padding: 4px 10px; font-size: 14px; }

.date-chip { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 7px; background: rgba(4, 14, 34, 0.7); font-family: var(--num); font-size: 15px; white-space: nowrap; flex: none; }
.date-chip .ic { width: 18px; height: 18px; color: #ff6b6b; display: grid; place-items: center; }
.date-chip .ic svg { width: 18px; height: 18px; }
/* drop-down chevron drawn in CSS: the "⌄" glyph rendered as a tiny low "v" in the number font */
.date-chip i.chev, .pill-sel::after { content: ''; display: inline-block; width: 7px; height: 7px; border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim);
  transform: translateY(-2px) rotate(45deg); margin-left: 2px; flex: none; }
.date-chip:hover { border-color: var(--border-hi); }

#ai-btn { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 10px; border-radius: 18px; font-size: 14px; font-weight: 600; color: #fff; white-space: nowrap; flex: none;
  background: linear-gradient(90deg, #5b3fd6, #7d5cff); box-shadow: 0 0 16px rgba(125, 92, 255, 0.5); border: 1px solid rgba(200, 180, 255, 0.6); }
#ai-btn svg { width: 18px; height: 18px; }
#ai-btn:hover { filter: brightness(1.15); }

.live { display: flex; align-items: center; gap: 7px; font-family: var(--num); font-size: 16px; font-weight: 700; color: var(--green); letter-spacing: 1px; flex: none; }
.live .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 1.6s infinite; }
.clock { text-align: right; line-height: 1.2; font-family: var(--num); white-space: nowrap; flex: none; }
.clock .d { font-size: 14px; color: var(--text-dim); }
.clock .t { font-size: 18px; font-weight: 600; letter-spacing: 0.5px; }
#topbar.tb-mill .clock .d { display: none; }
#topbar.tb-mill .clock .t { font-size: 19px; }
/* "Powered by" caption stacked over the logo: legible (13.5 px) and narrower than the old one-line chip */
.nv-chip { background: rgba(255, 255, 255, 0.96); border-radius: 6px; padding: 2px 10px 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 44px; flex: none; }
.nv-chip span { font-size: 13.5px; line-height: 15px; font-weight: 500; letter-spacing: 0.3px; color: #727a83; white-space: nowrap; }
.nv-chip img { height: 23px; display: block; }

/* =================================================================== VIEWS */
.view {
  position: absolute; left: 0; right: 0; top: var(--tb-h); bottom: 0;
  padding: 14px 16px;
  opacity: 0; pointer-events: none; transform: scale(1.025); visibility: hidden;
  transition: opacity .55s ease, transform .7s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .7s;
}
.view.on { opacity: 1; pointer-events: auto; transform: none; visibility: visible; transition: opacity .55s ease, transform .7s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.view.leaving { opacity: 0; transform: scale(0.975); visibility: visible; }
.view-err { position: absolute; inset: 40px; display: grid; place-items: center; text-align: center; color: var(--text-dim); font-size: 16px; }
.view-err b { display: block; font-family: var(--num); font-size: 26px; color: var(--amber); margin-bottom: 6px; }

/* shared MultiView canvas (one per station view, created by SM.three.MultiView.create(viewEl)) */
.mv-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; display: block; }
.view .ovl, .render .ovl { z-index: 6; }

/* ------------------------------------------------------------------ panels */
.panel {
  position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(120, 180, 255, 0.07);
}
.panel::before, .panel::after { content: ''; position: absolute; width: 12px; height: 12px; pointer-events: none; z-index: 1; }
.panel::before { left: -1px; top: -1px; border-left: 2px solid var(--cyan); border-top: 2px solid var(--cyan); border-top-left-radius: var(--r); opacity: 0.7; }
.panel::after { right: -1px; bottom: -1px; border-right: 2px solid var(--cyan); border-bottom: 2px solid var(--cyan); border-bottom-right-radius: var(--r); opacity: 0.4; }
.panel.flat::before, .panel.flat::after { display: none; }
.panel.ok { border-color: rgba(34, 217, 130, 0.45); }
.panel.watch { border-color: rgba(255, 178, 36, 0.6); }
.panel.crit { border-color: rgba(255, 75, 92, 0.75); animation: critglow 1.4s infinite; }
.panel.off { border-color: rgba(127, 142, 166, 0.35); }
.panel.ok::before, .panel.ok::after { border-color: var(--green); }
.panel.watch::before, .panel.watch::after { border-color: var(--amber); }
.panel.crit::before, .panel.crit::after { border-color: var(--red); }
.panel.off::before, .panel.off::after { border-color: var(--grey); }
.panel-h { display: flex; align-items: center; gap: 9px; padding: 12px 16px 9px; flex: none; min-width: 0; }
.panel-h .ttl { font-family: var(--num); font-size: 17px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-h .ttl small { font-family: var(--ui); font-size: 14px; font-weight: 400; color: var(--text-mute); letter-spacing: 0.2px; margin-left: 4px; }
.panel-h .ttl small.blk { display: block; margin-left: 0; }
.panel-h.caps .ttl { text-transform: uppercase; letter-spacing: 1px; font-weight: 700; font-size: 18px; }
.panel-h .ico { width: 22px; height: 22px; color: var(--cyan); flex: none; display: grid; place-items: center; }
.panel-h .ico svg { width: 22px; height: 22px; }
.panel-h .r { margin-left: auto; font-size: 14px; color: var(--text-mute); display: flex; gap: 8px; align-items: center; flex: none; }
.panel-h .r a, .panel-h .r .link { color: var(--cyan); cursor: pointer; font-size: 14px; }
.panel-b { padding: 0 16px 14px; flex: 1; min-height: 0; position: relative; }
.pill-sel { border: 1px solid var(--border); border-radius: 5px; padding: 3px 9px; font-size: 14px; color: var(--text-dim); white-space: nowrap; }
.pill-sel::after { width: 6px; height: 6px; border-width: 0 1.5px 1.5px 0; margin-left: 8px; transform: translateY(-3px) rotate(45deg); }
.cap { font-family: var(--num); font-size: 14px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-mute); }

/* -------------------------------------------------------------------- KPIs */
.kpi-row { display: grid; gap: 14px; height: 92px; margin-bottom: 14px; flex: none; }
.kpi-row.k3 { grid-template-columns: repeat(3, 1fr); }
.kpi-row.k4 { grid-template-columns: repeat(4, 1fr); }
.kpi-row.k5 { grid-template-columns: repeat(5, 1fr); }
.kpi-row.k6 { grid-template-columns: repeat(6, 1fr); }

.kpi {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 0 16px; min-width: 0; height: 100%;
  background: linear-gradient(180deg, rgba(16, 40, 80, 0.88), rgba(7, 20, 44, 0.9));
  border: 1px solid rgba(70, 150, 255, 0.32); border-radius: var(--r); overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(140, 200, 255, 0.10), inset 0 0 22px rgba(47, 140, 255, 0.06);
}
.kpi::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent, var(--cyan)), transparent); opacity: 0.45; }
.kpi-ic { width: 50px; height: 50px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(47, 160, 255, 0.30), rgba(47, 160, 255, 0.05));
  border: 1px solid rgba(80, 180, 255, 0.45); color: var(--accent, #9fdcff); box-shadow: 0 0 14px rgba(47, 140, 255, 0.25); }
.kpi-ic svg { width: 26px; height: 26px; }
.kpi.big .kpi-ic { width: 62px; height: 62px; } .kpi.big .kpi-ic svg { width: 32px; height: 32px; }
.kpi-img { width: 76px; height: 76px; flex: none; display: grid; place-items: center; }
.kpi-img img, .kpi-img svg { max-width: 100%; max-height: 100%; }
.kpi-b { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.kpi-l { font-size: 15.5px; color: #c6d6ee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-v { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; line-height: 1.08; margin-top: 2px; }
.kpi-v .v { font-family: var(--num); font-size: 36px; font-weight: 700; letter-spacing: 0.3px; color: #fff; }
.kpi-v .u { font-family: var(--num); font-size: 21px; font-weight: 600; color: #d8e6fa; margin-left: 2px; }
.kpi.big .kpi-v .v { font-size: 38px; color: #bfe3ff; }
.kpi-d { margin-left: 10px; font-family: var(--num); font-size: 16px; font-weight: 600; }
.kpi-d:empty { display: none; }
.kpi-s { font-size: 14px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
/* the sub line may run on under the sparkbars (they sit higher, centred on the value row) */
.kpi:not(:has(.kpi-img)):has(.kpi-spark:not(:empty)) .kpi-s { margin-right: -86px; }
.kpi-s:empty { display: none; }
.kpi-spark { flex: none; align-self: center; }
.kpi-spark:empty { display: none; }
.kpi-spark .spark { width: 72px; height: 38px; display: block; }
.delta { font-family: var(--num); font-weight: 600; white-space: nowrap; }
.delta.good { color: var(--green); } .delta.bad { color: var(--red); } .delta.flat { color: var(--text-mute); }
.kpi.watch { border-color: rgba(255, 178, 36, 0.55); } .kpi.crit { border-color: rgba(255, 75, 92, 0.7); animation: critglow 1.4s infinite; }

/* ----------------------------------------------------------- status tile */
.status-tile {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 18px; height: 100%; min-width: 0;
  border-radius: var(--r); border: 1px solid rgba(34, 217, 130, 0.55); overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 92, 56, 0.6), rgba(6, 42, 30, 0.7));
  box-shadow: inset 0 0 26px rgba(34, 217, 130, 0.12);
}
.status-tile .st-l { font-size: 15.5px; color: #d6efe2; }
.status-tile .st-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-tile .st-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--green); color: #03301c; box-shadow: 0 0 16px var(--green); }
.status-tile .st-ic svg { width: 22px; height: 22px; stroke-width: 2.6; }
.status-tile .st-txt { font-family: var(--num); font-size: 26px; font-weight: 700; letter-spacing: 1px; color: #3ff09a; white-space: nowrap; }
.status-tile .st-note { margin-left: auto; font-size: 14px; line-height: 1.22; color: #cfe3da; text-align: right; overflow: hidden; min-width: 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.status-tile.watch { border-color: rgba(255, 178, 36, 0.65); background: linear-gradient(180deg, rgba(112, 74, 8, 0.62), rgba(52, 34, 6, 0.72)); box-shadow: inset 0 0 26px rgba(255, 178, 36, 0.14); animation: watchglow 2s infinite; }
.status-tile.watch .st-l { color: #f6e2bd; }
.status-tile.watch .st-ic { background: var(--amber); color: #3a2400; box-shadow: 0 0 16px var(--amber); }
.status-tile.watch .st-txt { color: #ffc23d; }
.status-tile.watch .st-note { color: #f3dcb0; }
.status-tile.crit { border-color: rgba(255, 75, 92, 0.75); background: linear-gradient(180deg, rgba(124, 18, 30, 0.66), rgba(60, 8, 14, 0.72)); animation: critglow 1.2s infinite; }
.status-tile.crit .st-l { color: #ffd9dd; }
.status-tile.crit .st-ic { background: var(--red); color: #fff; box-shadow: 0 0 16px var(--red); }
.status-tile.crit .st-txt { color: #ff8a95; }
.status-tile.crit .st-note { color: #ffd0d5; }
.status-tile.off { border-color: rgba(127, 142, 166, 0.5); background: linear-gradient(180deg, rgba(40, 52, 72, 0.7), rgba(22, 30, 46, 0.75)); box-shadow: none; }
.status-tile.off .st-ic { background: #6b7890; color: #e6ebf3; box-shadow: none; }
.status-tile.off .st-txt { color: #b7c3d6; }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 12px; font-size: 14px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; line-height: 1.25;
  background: rgba(34, 217, 130, 0.16); color: #4ff0a2; border: 1px solid rgba(34, 217, 130, 0.45); }
.badge.ok, .b-ok { background: rgba(34, 217, 130, 0.16); color: #4ff0a2; border: 1px solid rgba(34, 217, 130, 0.45); }
.badge.watch, .b-watch { background: rgba(255, 178, 36, 0.16); color: #ffc65a; border: 1px solid rgba(255, 178, 36, 0.5); }
.badge.crit, .b-crit { background: rgba(255, 75, 92, 0.18); color: #ff8592; border: 1px solid rgba(255, 75, 92, 0.6); }
.badge.info, .b-info { background: rgba(47, 140, 255, 0.16); color: #8cc8ff; border: 1px solid rgba(47, 140, 255, 0.5); }
.badge.off, .b-off { background: rgba(120, 140, 170, 0.14); color: #a9b7cc; border: 1px solid rgba(120, 140, 170, 0.4); }
.b-maint { background: rgba(169, 139, 255, 0.16); color: #c3b0ff; border: 1px solid rgba(169, 139, 255, 0.5); }
.badge.solid.ok, .badge.solid.b-ok { background: #17b56c; color: #fff; border-color: #17b56c; }
.badge.solid.watch, .badge.solid.b-watch { background: #f0a91a; color: #241600; border-color: #f0a91a; }
.badge.solid.crit, .badge.solid.b-crit { background: #e23447; color: #fff; border-color: #e23447; }
.badge.solid.info, .badge.solid.b-info { background: #2a6fe0; color: #fff; border-color: #2a6fe0; }
.badge.solid.off, .badge.solid.b-off { background: #56637a; color: #eef2f8; border-color: #56637a; }
.badge.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; flex: none; }
.badge.lg { font-size: 14px; padding: 4px 13px; }
.badge.sq { border-radius: 5px; }
.dotc { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* ------------------------------------------------------------------- chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 5px; font-family: var(--num); font-size: 14px; font-weight: 700; letter-spacing: 0.7px; white-space: nowrap; line-height: 1.2;
  background: rgba(10, 30, 60, 0.85); color: #cfe0f7; border: 1px solid rgba(100, 150, 220, 0.4); }
.chip b { font-weight: 700; }
.chip.ok { color: #4ff0a2; border-color: rgba(34, 217, 130, 0.5); background: rgba(10, 60, 38, 0.75); }
.chip.watch { color: #ffc65a; border-color: rgba(255, 178, 36, 0.55); background: rgba(70, 46, 6, 0.75); }
.chip.crit { color: #ff8592; border-color: rgba(255, 75, 92, 0.6); background: rgba(80, 12, 22, 0.8); }
.chip.info { color: #7fe3ff; border-color: rgba(47, 212, 255, 0.5); background: rgba(8, 44, 70, 0.8); }
.chip.off { color: #9fb0c8; border-color: rgba(120, 140, 170, 0.4); background: rgba(24, 32, 48, 0.8); }
.chip.ghost { background: transparent; }
.chip .k { color: var(--text-dim); font-weight: 600; }

/* --------------------------------------------------------------------- bars */
.bar { position: relative; display: flex; height: 7px; background: rgba(120, 160, 220, 0.15); border-radius: 4px; overflow: hidden; min-width: 20px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #17b56c, #3cf0a0); transition: width .8s ease; flex: none; }
.bar > i.tail { border-radius: 0 4px 4px 0; background: linear-gradient(90deg, #ff8a2a, #ffb224); margin-left: -2px; }
.bar.watch > i { background: linear-gradient(90deg, #d98a0b, #ffc65a); }
.bar.crit > i { background: linear-gradient(90deg, #c4202f, #ff6a78); }
.bar.cyan > i, .bar.info > i { background: linear-gradient(90deg, #1667d9, #2fd4ff); }
.bar.violet > i { background: linear-gradient(90deg, #6d4ae0, #b39cff); }
.bar.off > i { background: linear-gradient(90deg, #47546a, #7f8ea6); }
.bar.thin { height: 4px; } .bar.thick { height: 10px; border-radius: 5px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 54px; align-items: center; gap: 12px; font-size: 14.5px; min-height: 30px; }
.bar-row .l { display: flex; align-items: center; gap: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .v { font-family: var(--num); font-size: 17px; font-weight: 600; text-align: right; }

/* ------------------------------------------------------------- tbtn / misc */
.tbtn { padding: 6px 12px; font-size: 14px; border: 1px solid var(--border); border-radius: 6px; background: rgba(6, 20, 44, 0.8); color: var(--text-dim); white-space: nowrap; }
.tbtn:hover, .tbtn.on { border-color: var(--border-hi); color: var(--cyan); }
.tbtn.on { background: rgba(47, 212, 255, 0.12); }
.link { color: var(--cyan); cursor: pointer; }

/* -------------------------------------------------------------- gauge-wrap */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.gauge-wrap .g-l { font-family: var(--num); font-size: 14px; font-weight: 600; letter-spacing: 1px; color: var(--text-mute); text-transform: uppercase; }
.gauge-wrap svg { width: 100%; max-width: 170px; height: auto; display: block; overflow: visible; }
.gauge-wrap .g-v { font-family: var(--num); font-size: 22px; font-weight: 700; line-height: 1; margin-top: -2px; white-space: nowrap; }
.gauge-wrap .g-v small { font-size: 14px; color: var(--text-dim); font-weight: 600; margin-left: 2px; }
.gauge-wrap.sm svg { max-width: 96px; }
.gauge-wrap.sm .gval, .gauge-wrap.novalue .gval { display: none; }
.gauge-wrap.lg svg { max-width: 220px; }
.gauge-wrap.lg .g-v { font-size: 30px; }

/* -------------------------------------------------------------- mini-table */
.mini-table { width: 100%; font-size: 14.5px; }
.mini-table th { font-size: 14px; font-weight: 500; color: var(--text-mute); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table td { padding: 7px 8px; border-bottom: 1px solid rgba(120, 170, 255, 0.06); white-space: nowrap; }
.mini-table td.num, .mini-table th.num { text-align: right; font-family: var(--num); }
.mini-table td.num { font-size: 16px; font-weight: 600; }
.mini-table td.c, .mini-table th.c { text-align: center; }
.mini-table tr > td:first-child { border-left: 3px solid transparent; }
.mini-table tr.ok > td:first-child { border-left-color: var(--green); }
.mini-table tr.watch > td:first-child { border-left-color: var(--amber); }
.mini-table tr.crit > td:first-child { border-left-color: var(--red); }
.mini-table tr.off > td:first-child { border-left-color: var(--grey); }
.mini-table tr.click { cursor: pointer; }
.mini-table tr.click:hover td { background: rgba(47, 140, 255, 0.08); }

/* ------------------------------------------------------------------ legend */
.legend { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--text-dim); white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
.legend i.dash { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed; background: none !important; box-shadow: none; }
.legend i.line { width: 16px; height: 3px; border-radius: 2px; }

/* ------------------------------------------------------------- trend-panel */
.trend-panel .panel-h { padding-bottom: 4px; }
.trend-panel .trend-body { flex: 1; min-height: 0; position: relative; padding: 0 12px 8px 6px; }
.trend-panel canvas, .trend-body canvas { display: block; width: 100%; height: 100%; }

/* --------------------------------------------------------------- unit-card */
.unit-card { padding: 0; }
.unit-card .uc-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; min-width: 0; flex: none; }
.unit-card .uc-id { font-family: var(--num); font-size: 21px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; white-space: nowrap; }
.unit-card .uc-id small { font-size: 15px; font-weight: 500; color: var(--text-dim); text-transform: none; letter-spacing: 0.2px; margin-left: 4px; }
.unit-card .uc-h .sp { flex: 1; }
.unit-card .uc-prog { padding: 0 16px 8px; font-family: var(--num); font-size: 14.5px; color: var(--text-dim); flex: none; }
.unit-card .uc-prog .bar { margin-top: 7px; height: 5px; }
.unit-card .uc-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 4px 16px 14px; }
.unit-card .uc-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.unit-card .uc-alarm { flex: none; margin: 0 14px 8px; padding: 6px 10px; border-radius: 4px; text-align: center; font-family: var(--num); font-size: 15px; font-weight: 700; letter-spacing: 0.6px;
  background: linear-gradient(90deg, #e39a12, #ffb224); color: #241600; display: flex; align-items: center; justify-content: center; gap: 7px; }
.unit-card .uc-alarm.crit { background: linear-gradient(90deg, #c4202f, #ff4b5c); color: #fff; }
.unit-card .uc-alarm svg { width: 16px; height: 16px; }
.unit-card .uc-alarm:empty { display: none; }
.unit-card.ok { border-color: rgba(34, 217, 130, 0.35); }
.unit-card.watch { border-color: rgba(255, 178, 36, 0.6); }
.unit-card.crit { border-color: rgba(255, 75, 92, 0.75); }
.unit-card.off { border-color: rgba(127, 142, 166, 0.3); }

/* 3D slot (rendered by SM.three.MultiView through the shared view canvas) */
.render {
  position: relative; min-height: 120px; border-radius: 8px; overflow: hidden;
  background:
    radial-gradient(70% 70% at 50% 45%, rgba(40, 90, 160, 0.30), rgba(4, 12, 28, 0) 70%),
    linear-gradient(180deg, #071a36, #030b1a);
  border: 1px solid rgba(64, 145, 255, 0.16);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.55);
  cursor: grab; touch-action: none;
}
.render:active { cursor: grabbing; }
.render.off { filter: saturate(0.4); }
.render .ovl { position: absolute; display: flex; gap: 6px; align-items: center; pointer-events: none; }
.render .ovl.tl { left: 10px; top: 10px; } .render .ovl.tr { right: 10px; top: 10px; }
.render .ovl.bl { left: 10px; bottom: 10px; } .render .ovl.br { right: 10px; bottom: 10px; }
.render .ovl.bc { left: 50%; bottom: 10px; transform: translateX(-50%); }
.render .ovl.tc { left: 50%; top: 10px; transform: translateX(-50%); }

/* -------------------------------------------------------------- valve-row */
.valve-row { display: grid; grid-template-columns: minmax(118px, 1.1fr) 1fr 50px 84px; align-items: center; gap: 10px; font-size: 14.5px; min-height: 28px; }
.valve-row .vl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #d4e2f6; }
.valve-row .vl small { font-size: 14px; color: var(--text-mute); margin-left: 3px; }
.valve-row .vp { font-family: var(--num); font-size: 17px; font-weight: 700; text-align: right; }
.valve-row .vs { font-family: var(--num); font-size: 14px; font-weight: 700; letter-spacing: 0.4px; color: var(--grey); white-space: nowrap; }
.valve-row .bar > i { background: linear-gradient(90deg, #47546a, #7f8ea6); }
.valve-row.open .bar > i { background: linear-gradient(90deg, #17b56c, #3cf0a0); } .valve-row.open .vs { color: var(--green); }
.valve-row.throttle .bar > i { background: linear-gradient(90deg, #d98a0b, #ffc65a); } .valve-row.throttle .vs { color: var(--amber); }
.valve-row.closed .vp { color: var(--text-dim); }

/* -------------------------------------------------------------- level-bar */
.level-bar { display: flex; align-items: stretch; gap: 10px; min-height: 0; }
.level-bar .lv-tube { position: relative; width: 34px; min-height: 70px; flex: none; border-radius: 6px; border: 1.5px solid rgba(140, 180, 230, 0.45); background: rgba(2, 8, 20, 0.85); overflow: hidden; box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8); }
.level-bar .lv-tube > i { position: absolute; left: 2px; right: 2px; bottom: 2px; border-radius: 3px; transition: height .8s ease;
  background: linear-gradient(180deg, #3cf0a0, #129a5a); box-shadow: 0 0 12px rgba(34, 217, 130, 0.5); }
.level-bar .lv-tube::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 calc(25% - 1px), rgba(200, 220, 255, 0.18) calc(25% - 1px) 25%); pointer-events: none; }
.level-bar.mid .lv-tube > i { background: linear-gradient(180deg, #5fe8ff, #1a8fb8); box-shadow: 0 0 12px rgba(47, 212, 255, 0.5); }
.level-bar.low .lv-tube > i { background: linear-gradient(180deg, #ffc65a, #b8700a); box-shadow: 0 0 12px rgba(255, 178, 36, 0.5); }
.level-bar.empty .lv-tube > i { background: #3a4558; box-shadow: none; }
.level-bar .lv-txt { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.level-bar .lv-txt b { font-family: var(--num); font-size: 22px; font-weight: 700; letter-spacing: 0.5px; color: #3ff09a; white-space: nowrap; }
.level-bar.mid .lv-txt b { color: #5fe8ff; } .level-bar.low .lv-txt b { color: #ffc23d; } .level-bar.empty .lv-txt b { color: #8d9ab0; }
.level-bar .lv-txt small { font-size: 14px; color: var(--text-mute); white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.level-bar .lv-txt small::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.level-bar.h .lv-tube { width: auto; min-height: 0; height: 22px; flex: 1; }
.level-bar.h .lv-tube > i { top: 2px; bottom: 2px; right: auto; height: auto !important; }

/* -------------------------------------------------------------- info-grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-grid.c3 { grid-template-columns: repeat(3, 1fr); } .info-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.info-grid .ib { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 11px; border-radius: 6px; min-width: 0;
  background: rgba(14, 34, 66, 0.7); border: 1px solid rgba(80, 140, 230, 0.18); }
.info-grid .ib .k { font-size: 14px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-grid .ib .v { font-family: var(--num); font-size: 15.5px; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; }
.info-grid .ib .v.ok { color: var(--green); } .info-grid .ib .v.watch { color: var(--amber); } .info-grid .ib .v.crit { color: var(--red); } .info-grid .ib .v.off { color: var(--grey); } .info-grid .ib .v.info { color: var(--cyan); }
.info-grid.stack .ib { flex-direction: column; align-items: flex-start; gap: 1px; }

/* ------------------------------------------------------------- alert rows */
.alert-list { display: flex; flex-direction: column; gap: 4px; }
.alert-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: start; padding: 9px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.alert-row:hover { background: rgba(47, 140, 255, 0.07); }
.alert-row .ai { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--num); font-weight: 800; font-size: 17px; margin-top: 1px; }
.alert-row.crit .ai { background: #e23447; color: #fff; box-shadow: 0 0 10px rgba(255, 75, 92, 0.6); }
.alert-row.watch .ai { background: #f0a91a; color: #2a1a00; box-shadow: 0 0 10px rgba(255, 178, 36, 0.5); }
.alert-row.info .ai { background: #2a6fe0; color: #fff; box-shadow: 0 0 10px rgba(47, 140, 255, 0.5); }
.alert-row .at { font-size: 15px; font-weight: 600; color: #eaf2ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-row .am { font-size: 14px; color: var(--text-dim); margin-top: 2px; line-height: 1.35; }
.alert-row .ar { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 14px; color: var(--text-mute); white-space: nowrap; }

/* ------------------------------------------------------------ station icon */
.st-icon { --c: var(--cyan); width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; color: var(--c);
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 30%, transparent), color-mix(in srgb, var(--c) 6%, transparent));
  border: 1.5px solid color-mix(in srgb, var(--c) 70%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); }
.st-icon svg { width: 58%; height: 58%; }
.st-icon.sm { width: 30px; height: 30px; } .st-icon.lg { width: 52px; height: 52px; }

/* ================================================================ OVERLAYS */
#sweep { position: absolute; inset: var(--tb-h) 0 0 0; z-index: 25; pointer-events: none; opacity: 0; background: linear-gradient(180deg, transparent, rgba(47, 212, 255, 0.12) 48%, rgba(47, 212, 255, 0.5) 50%, transparent 52%); background-size: 100% 300%; }
#sweep.go { animation: sweep .9s ease; }
@keyframes sweep { 0% { opacity: 1; background-position: 0 100%; } 100% { opacity: 1; background-position: 0 0%; } }

#alert-banner {
  position: absolute; left: 50%; top: 76px; transform: translate(-50%, -24px); z-index: 40; opacity: 0; visibility: hidden; pointer-events: none;
  min-width: 860px; padding: 12px 18px; display: flex; align-items: center; gap: 16px;
  background: linear-gradient(90deg, rgba(150, 14, 30, 0.96), rgba(210, 30, 50, 0.96), rgba(150, 14, 30, 0.96));
  border: 1px solid #ff8592; border-radius: 8px; box-shadow: 0 0 50px rgba(255, 40, 60, 0.6);
  transition: transform .5s cubic-bezier(.2, .9, .3, 1.2), opacity .35s, visibility .35s;
}
#alert-banner.on { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; }
#alert-banner .ic { width: 46px; height: 46px; border-radius: 50%; background: #fff; color: #d61f35; display: grid; place-items: center; animation: blink 0.8s infinite; flex: none; }
#alert-banner .ic svg { width: 28px; height: 28px; }
#alert-banner .t { font-family: var(--num); font-size: 22px; font-weight: 700; letter-spacing: 1px; }
#alert-banner .s { font-size: 14.5px; color: #ffe1e4; }
#alert-banner .go { margin-left: auto; padding: 8px 16px; background: #fff; color: #b3172a; font-weight: 700; border-radius: 5px; font-size: 14px; }
/* compact strip (scenarios collapse the banner after a few seconds): sits low over the trend area so the KPI row stays readable */
#alert-banner.mini { top: 960px; min-width: 0; max-width: 900px; padding: 7px 10px 7px 12px; gap: 12px; box-shadow: 0 0 26px rgba(255, 40, 60, 0.45); transition: opacity .35s, visibility .35s; }
#alert-banner.mini .ic { width: 34px; height: 34px; }
#alert-banner.mini .ic svg { width: 20px; height: 20px; }
#alert-banner.mini .bt { display: flex; align-items: baseline; gap: 12px; min-width: 0; white-space: nowrap; }
#alert-banner.mini .t { font-size: 18px; }
#alert-banner.mini .s { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
#alert-banner.mini .go { padding: 4px 10px; }
#stage.alerting::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 30; box-shadow: inset 0 0 160px rgba(255, 30, 50, 0.5); animation: blink 1.2s infinite; }

#toasts { position: absolute; right: 18px; top: 78px; z-index: 35; display: flex; flex-direction: column; gap: 9px; width: 390px; pointer-events: none; }
.toast {
  display: grid; grid-template-columns: 38px 1fr; gap: 11px; padding: 11px 13px; border-radius: 8px; pointer-events: auto;
  background: rgba(8, 24, 50, 0.97); border: 1px solid var(--border-hi); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn .45s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.out { animation: toastOut .4s forwards; }
.toast .ic { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: rgba(47, 212, 255, 0.15); color: var(--cyan); }
.toast .ic svg { width: 21px; height: 21px; }
.toast.crit { border-color: rgba(255, 75, 92, 0.8); } .toast.crit .ic { background: rgba(255, 75, 92, 0.2); color: var(--red); }
.toast.watch { border-color: rgba(255, 178, 36, 0.8); } .toast.watch .ic { background: rgba(255, 178, 36, 0.18); color: var(--amber); }
.toast.ok { border-color: rgba(34, 217, 130, 0.7); } .toast.ok .ic { background: rgba(34, 217, 130, 0.18); color: var(--green); }
.toast.ai { border-color: rgba(169, 139, 255, 0.8); } .toast.ai .ic { background: rgba(169, 139, 255, 0.2); color: var(--violet); }
.toast .t { font-size: 14.5px; font-weight: 700; }
.toast .s { font-size: 14px; color: var(--text-dim); margin-top: 2px; line-height: 1.38; }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }
#stage.ai-open #toasts { right: 502px; }
#stage.ai-open #phone { right: 516px; }   /* AI panel 470 + 16 margin, plus a gap: the phone stays visible beside it */
#stage.hold .toast, #stage.hold #phone, #stage.hold #sweep { animation: none !important; transition: none !important; }

/* phone mock — Telegram-style alert bot */
#phone {
  position: absolute; right: 30px; bottom: 26px; z-index: 36; width: 320px; height: 600px;
  border-radius: 40px; background: #0b0f14; border: 3px solid #2a3442; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75), 0 0 0 9px #0d131b;
  transform: translateY(125%); transition: transform .6s cubic-bezier(.2, .9, .3, 1.1); overflow: hidden;
}
#phone.on { transform: none; }
#phone .notch { position: absolute; left: 50%; top: 8px; width: 96px; height: 24px; border-radius: 12px; background: #000; transform: translateX(-50%); z-index: 3; }
#phone .scr { position: absolute; inset: 0; padding: 38px 0 12px; display: flex; flex-direction: column;
  background: #0e1621 radial-gradient(circle at 30% 20%, rgba(40, 80, 120, 0.25), transparent 60%); }
#phone .tg-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px; background: #17212b; border-bottom: 1px solid #0b1118; }
#phone .tg-back { font-size: 26px; color: #6ab2f2; line-height: 1; margin-top: -3px; }
#phone .av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, #2a9d5c, #3ccf4e); color: #fff; }
#phone .av svg { width: 22px; height: 22px; }
#phone .who .n { font-size: 14.5px; font-weight: 700; color: #f5f8fb; }
#phone .who .st { font-size: 14px; color: #6ab2f2; }
#phone .msgs { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 4px; justify-content: flex-end; }
#phone .msg { background: #182533; border-radius: 12px 12px 12px 4px; padding: 8px 11px; font-size: 14px; line-height: 1.42; max-width: 94%; animation: toastIn .4s; color: #e4ecf4; }
#phone .msg b { color: #fff; }
#phone .msg .tm { font-size: 14px; line-height: 1.15; color: #6d8299; text-align: right; margin-top: 2px; }
#phone .msg.alert { border-left: 3px solid var(--red); }
#phone .msg.warn { border-left: 3px solid var(--amber); }
#phone .msg.ok { border-left: 3px solid var(--green); }
#phone .msg .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 7px; }
#phone .msg .btns span { text-align: center; font-size: 14px; padding: 5px 4px; border-radius: 6px; background: rgba(106, 178, 242, 0.16); color: #8cc8ff; }
#phone .chan { display: flex; gap: 4px; justify-content: center; padding: 8px 6px 0; }
#phone .chan span { font-size: 14px; line-height: 1.2; padding: 3px 7px; border-radius: 10px; background: #16283a; color: #8fb3d9; white-space: nowrap; }
#phone .chan span.on { background: #2b5278; color: #fff; }

/* presenter controls */
#demo-btn { position: absolute; left: 16px; bottom: 14px; z-index: 45; width: 36px; height: 36px; border-radius: 50%; opacity: 0.22; border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-dim); transition: opacity .2s; background: rgba(4, 14, 32, 0.7); }
#demo-btn:hover { opacity: 1; }
#demo-btn svg { width: 18px; height: 18px; }
#demo-panel {
  position: absolute; left: 16px; bottom: 58px; z-index: 45; width: 430px; padding: 14px; border-radius: 10px;
  background: rgba(6, 18, 40, 0.97); border: 1px solid var(--border-hi); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: none;
}
#demo-panel.on { display: block; }
#demo-panel h4 { font-family: var(--num); font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: #8cc8ff; margin-bottom: 9px; }
#demo-panel button.sc { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
#demo-panel button.sc:hover { border-color: var(--border-hi); background: rgba(47, 212, 255, 0.07); }
#demo-panel button.sc.on { border-color: var(--amber); background: rgba(255, 178, 36, 0.10); }
#demo-panel button.sc svg { width: 19px; height: 19px; flex: none; color: var(--cyan); }
#demo-panel kbd { margin-left: auto; font-family: var(--num); font-size: 14px; line-height: 1.25; color: var(--text-mute); border: 1px solid var(--border); border-radius: 3px; padding: 0 6px; flex: none; }
#demo-panel .tbtn kbd { margin-left: 6px; }
#demo-panel .row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; font-size: 14px; color: var(--text-dim); margin-top: 8px; }
#demo-panel .row > span:first-child { min-width: 78px; }
#demo-panel .row.full > span:first-child { flex-basis: 100%; }
#demo-panel .tbtn { padding: 5px 10px; font-size: 14px; }
#demo-panel .row.full .tbtn { padding: 5px 9px; }
#demo-panel .hint { font-size: 14px; color: var(--text-mute); margin-top: 10px; line-height: 1.45; }
#demo-panel .hint b { color: var(--text-dim); font-weight: 600; }
#demo-panel .row > kbd { margin-left: auto; }
/* mill buttons grouped by region: caption line + one grid row of up to 8 ids per region */
#demo-panel .mills { margin-top: 10px; }
#demo-panel .mttl { font-size: 14px; color: var(--text-dim); margin-bottom: 4px; }
#demo-panel .mrow + .mrow { margin-top: 6px; }
#demo-panel .mcap { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: #8cc8ff; font-weight: 600; letter-spacing: 0.3px; margin-bottom: 4px; }
#demo-panel .mcap i { font-style: normal; font-weight: 400; color: var(--text-mute); }
#demo-panel .mgrid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
#demo-panel .mgrid .tbtn { padding: 4px 0; text-align: center; font-family: var(--num); font-weight: 600; letter-spacing: 0.3px; }
#demo-panel .mgrid .tbtn.s-watch { box-shadow: inset 0 -3px 0 var(--amber); }
#demo-panel .mgrid .tbtn.s-crit { box-shadow: inset 0 -3px 0 var(--red); }
/* group subtitle: region names focus the map (js/app.js) */
.tb-title .t2 .rg { cursor: pointer; transition: color .2s; }
.tb-title .t2 .rg:hover { color: var(--text-dim); }
.tb-title .t2 .rg.on { color: var(--cyan); font-weight: 600; }

/* AI assistant panel (content owned by js/copilot.js) */
/* full height of the content area under the topbar (76 → 1066), opaque so the page never shows through */
#ai-panel { position: absolute; right: 16px; top: 76px; bottom: 14px; width: 470px; z-index: 38; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0e1336 0%, #0a0e28 60%, #090c22 100%); border: 1px solid rgba(169, 139, 255, 0.6); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(125, 92, 255, 0.25);
  transform: translateX(112%); visibility: hidden; transition: transform .45s cubic-bezier(.2, .9, .3, 1.1), visibility 0s linear .45s; overflow: hidden; }
#ai-panel.on { transform: none; visibility: visible; transition: transform .45s cubic-bezier(.2, .9, .3, 1.1), visibility 0s; }
.ai-h { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid rgba(169, 139, 255, 0.25); flex: none; }
.ai-h > svg { width: 28px; height: 28px; color: #c3b0ff; filter: drop-shadow(0 0 6px #7d5cff); flex: none; }
.ai-h b { font-family: var(--num); font-size: 18px; letter-spacing: 0.5px; display: block; }
.ai-h small { font-size: 14px; color: #a99fd6; }
.ai-h .x { margin-left: auto; color: var(--text-dim); font-size: 17px; padding: 4px 8px; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 12px 15px; display: flex; flex-direction: column; gap: 10px; }
.ai-m { font-size: 14px; line-height: 1.5; padding: 9px 12px; border-radius: 10px; max-width: 94%; }
.ai-m.ai { background: #241d5c; border: 1px solid rgba(169, 139, 255, 0.35); border-top-left-radius: 3px; align-self: flex-start; color: #e9e4ff; }
.ai-m.ai b { color: #fff; } .ai-m.ai .dim { color: #b0a8d8; font-size: 14px; }
.ai-m.me { background: #1e6fe0; align-self: flex-end; border-top-right-radius: 3px; }
.ai-m .typing { letter-spacing: 3px; color: #a98bff; animation: blink 1s infinite; }
.ai-m .caret { color: #a98bff; animation: blink .7s infinite; }
.ai-sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 15px; border-top: 1px solid rgba(169, 139, 255, 0.18); flex: none; }
.ai-sug button { font-size: 14px; padding: 5px 11px; border-radius: 13px; border: 1px solid rgba(169, 139, 255, 0.5); color: #d9d0ff; background: rgba(90, 60, 200, 0.15); }
.ai-sug button:hover { background: rgba(125, 92, 255, 0.35); }
.ai-in { display: flex; gap: 8px; padding: 10px 15px 15px; flex: none; }
.ai-in input { flex: 1; background: rgba(4, 8, 24, 0.9); border: 1px solid rgba(169, 139, 255, 0.45); border-radius: 8px; padding: 10px 12px; color: #fff; font: inherit; font-size: 14px; outline: none; user-select: text; }
.ai-in input:focus { border-color: #a98bff; box-shadow: 0 0 10px rgba(125, 92, 255, 0.4); }
.ai-in button { width: 42px; border-radius: 8px; background: #6d4ae0; display: grid; place-items: center; }
.ai-in button svg { width: 17px; height: 17px; }

/* layout helpers */
.col-stack { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }
.col-stack > .panel { flex: none; }
.col-stack > .panel.grow, .col-stack > .grow { flex: 1; min-height: 0; }
.row-flex { display: flex; gap: 14px; min-width: 0; }
.fill { flex: 1; min-width: 0; min-height: 0; }

/* stub placeholder (removed when real views land) */
.stub-note { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 7; font-size: 14px; color: #ffd27a; background: rgba(60, 40, 0, 0.85); border: 1px dashed rgba(255, 178, 36, 0.7); padding: 6px 14px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.stub-fill { display: grid; place-items: center; height: 100%; color: var(--text-mute); font-size: 15px; border: 1px dashed rgba(100, 150, 220, 0.25); border-radius: 8px; text-align: center; }
