:root {
  --bg: #f4f7fb;
  --ink: #1c2430;
  --muted: #5c6b7a;
  --line: #d5dee7;
  --surface: #ffffff;
  --panel: #ffffff;
  --bar: #ffffff;
  --track: #e6eef4;
  --track-line: #d0dbe4;
  --hud: rgba(255, 255, 255, .94);
  --hover: #f3f7fb;
  --active: #e5f4f8;
  --primary: #0b8eae;
  --open: #14915f;
  --closed: #6d7d8c;
  --offline: #e3533a;
  --rain: #1a7ed6;
  --error: #d64545;
  --on-primary: #ffffff;
  --on-shut: #ffffff;
}

/* 夜间风格。html 加上 data-theme="night" 即恢复这次改白之前的配色。 */
html[data-theme="night"] {
  --bg: #0e141b;
  --ink: #e7eef4;
  --muted: #8ea0b0;
  --line: #2a3848;
  --surface: #161e28;
  --panel: #101820;
  --bar: #121922;
  --track: #0c141c;
  --track-line: #24384a;
  --hud: rgba(14, 20, 27, .9);
  --hover: #101820;
  --active: #eef1f4;
  --primary: #2ec8e6;
  --open: #3ddc97;
  --closed: #8ea0b0;
  --offline: #ff6b4a;
  --rain: #3aa0ff;
  --error: #ff8d7a;
  --on-primary: #062028;
  --on-shut: #2a0c08;
}
html[data-theme="night"] .gate {
  background:
    radial-gradient(ellipse at 18% 12%, rgba(78, 196, 245, .16), transparent 34%),
    radial-gradient(ellipse at 86% 88%, rgba(42, 62, 200, .2), transparent 36%),
    var(--bg);
}
html[data-theme="night"] .gate-card {
  border-color: rgba(255, 255, 255, .08);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; font-weight: 680; }
h2 { font-size: 13px; color: var(--primary); font-weight: 700; letter-spacing: .12em; }
.kicker { color: var(--muted); letter-spacing: .08em; font-size: 11px; }
.sub, .hint, .muted, .quiet p { color: var(--muted); }
.grow { flex: 1; min-width: 0; }

.nexus { display: flex; flex-direction: column; height: 100%; min-height: 100vh; background: var(--bg); }
.scada-bar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bar);
}
.scada-brand { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: inherit; text-align: left; }
.scada-brand b { display: block; letter-spacing: .04em; font-size: 14px; white-space: nowrap; }
.scada-brand small { color: var(--muted); letter-spacing: .14em; font-size: 10px; }
.scada-nav { display: flex; gap: 4px; }
.scada-nav button {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 12px; letter-spacing: .08em;
}
.scada-nav button.active { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
.scada-status { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nominal {
  border: 1px solid rgba(61, 220, 151, .45); color: var(--open);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; letter-spacing: .06em;
}
.nominal.warn { border-color: rgba(255, 107, 74, .5); color: var(--offline); }
#scada-clock { font-variant-numeric: tabular-nums; color: var(--muted); }
.dock {
  width: 92px; flex: none;
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 8px; gap: 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand, .text-btn, .icon-btn { border: 0; background: transparent; color: var(--primary); }
.mark {
  display: block; width: 36px; height: 36px; border-radius: 50%;
  background:
    radial-gradient(circle at 35% 50%, #2a7fe8 0 6px, transparent 7px),
    radial-gradient(circle at 68% 50%, #49b4e4 0 6px, transparent 7px),
    #fff;
}
.dock-nav { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.dock-nav button {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 10px;
}
.dock-nav button b { font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.dock-nav button.active { color: var(--ink); background: var(--active); }
.dock-nav button.active b { color: var(--ink); }
.nav-count {
  margin-left: 4px; min-width: 14px; padding: 0 3px;
  border-radius: 8px; background: var(--offline); color: #fff;
  font-style: normal; font-size: 10px;
}
.user-link {
  margin-top: auto; border: 0; background: transparent; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px;
}
.scada-status .user-link { margin: 0; flex-direction: row; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--open); }
.viewport { flex: 1; min-width: 0; min-height: 0; height: auto; overflow: auto; position: relative; background: var(--bg); }
.hmi {
  height: 100%; min-height: 640px;
  display: grid; gap: 12px; padding: 12px;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  grid-template-rows: minmax(340px, 1.4fr) minmax(248px, .78fr);
}
.hmi-side { grid-row: 1 / span 2; overflow: auto; }
.hmi-canvas { grid-column: 2; grid-row: 1; min-height: 0; overflow: hidden; }
.hmi-log { grid-column: 2; grid-row: 2; min-height: 0; overflow: hidden; }
.hmi-matrix { grid-column: 3; grid-row: 1 / span 2; min-height: 0; overflow: auto; }
.hmi-canvas .map-wrap { flex: 1; height: auto; min-height: 0; border-radius: 8px; }
#home-trend { flex: 1; min-height: 0; }
#home-trend .trend { width: 100%; height: 100%; display: block; }
.trend-switch { display: flex; gap: 6px; }
.trend-switch button {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}
.trend-switch button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.hmi-side .rain-alert { position: static; width: auto; transform: none; }
.hmi-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hmi-kpis div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.hmi-kpis span { display: block; color: var(--muted); font-size: 12px; }
.hmi-kpis b { font-size: 28px; color: var(--primary); font-variant-numeric: tabular-nums; }
.hmi-kpis b.hot { color: var(--offline); }
.hmi-assets, .matrix-list { display: flex; flex-direction: column; gap: 8px; }
.asset, .tank {
  width: 100%; text-align: left; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.asset-top, .tank-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.asset small, .tank small { color: var(--muted); }
.asset strong, .tank strong { color: var(--primary); font-size: 22px; font-variant-numeric: tabular-nums; }
.asset strong span, .tank strong span { font-size: 12px; color: var(--muted); }
.badge { border: 1px solid var(--c); color: var(--c); border-radius: 999px; padding: 2px 8px; font-style: normal; font-size: 12px; }
.tank { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.tank-bar { grid-column: 1 / -1; height: 18px; border-radius: 4px; background: var(--track); overflow: hidden; border: 1px solid var(--track-line); }
.tank-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1d6fe0, #3ec4ff); }

.yard, .bay {
  height: 100%; min-height: 640px;
  display: grid; gap: 12px; padding: 12px;
}
.yard { grid-template-columns: 240px minmax(0, 1fr); }
.yard-side, .yard-board, .bay-controls { min-height: 0; overflow: auto; }
.seg-list { display: flex; flex-direction: column; gap: 8px; }
.seg {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--ink); text-align: left;
}
.seg.on { border-color: var(--primary); color: var(--primary); }
.seg b { font-size: 22px; font-variant-numeric: tabular-nums; }
.yard-side .search, .yard-side .primary { width: 100%; }
.yard-tools { display: flex; align-items: center; gap: 10px; }
.station-list { display: flex; flex-direction: column; gap: 8px; }
.station {
  width: 100%; display: grid; align-items: center; gap: 12px 16px; text-align: left; color: inherit;
  grid-template-columns: 78px minmax(150px, 1.1fr) minmax(200px, 1.5fr) minmax(150px, .9fr);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.station:hover { border-color: var(--primary); }
.station-id, .station-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.station-id b, .station-id small, .station-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-id small, .station-meta small { color: var(--muted); }
.station-read { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; align-items: center; }
.station-read strong { color: var(--primary); font-size: 26px; font-variant-numeric: tabular-nums; }
.station-read strong span { font-size: 12px; color: var(--muted); }
.bat { display: block; height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bat i { display: block; height: 100%; background: var(--primary); }
.bat.low i { background: var(--offline); }

.bay {
  grid-template-columns: 280px minmax(0, 1.35fr) minmax(260px, .85fr);
  grid-template-rows: minmax(280px, 1.2fr) minmax(200px, .8fr);
}
.bay-controls { grid-row: 1 / span 2; }
.bay-controls h1 { font-size: 24px; }
.bay-vision, .bay-map, .bay-chart { min-height: 0; }
.bay-vision .frame { flex: 1; min-height: 220px; background: #0c1218; border-radius: 8px; }
.bay-map .map-wrap { flex: 1; height: auto; min-height: 180px; border-radius: 8px; }
.bay-rain { grid-column: 2; }
.bay-level { grid-column: 3; }
.bay-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bay-actions button { min-height: 52px; font-size: 16px; letter-spacing: .06em; }
.primary.shut { background: var(--offline); border-color: var(--offline); color: var(--on-shut); }
.bay-kpis { grid-template-columns: 1fr 1fr; }
.bay-kpis b { font-size: 18px; }
.bay-kpis div:last-child { grid-column: 1 / -1; }
.bay-pad {
  width: max-content; margin: 4px auto 0;
  display: grid; grid-template-columns: 52px 64px 52px; grid-template-rows: 48px 64px 48px;
  gap: 8px; align-items: center; justify-items: center;
}
.bay-pad .pad-up { grid-column: 2; grid-row: 1; }
.bay-pad .pad-left { grid-column: 1; grid-row: 2; }
.bay-pad .pad-record { grid-column: 2; grid-row: 2; }
.bay-pad .pad-right { grid-column: 3; grid-row: 2; }
.bay-pad .pad-down { grid-column: 2; grid-row: 3; }
.bay-pad button {
  width: 52px; height: 44px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 14px;
}
.bay-pad button:hover { border-color: var(--primary); color: var(--primary); }
.bay-pad button:active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.bay-pad .pad-record {
  width: 64px; height: 64px; border-radius: 50%; font-size: 13px; font-weight: 700;
}
.bay-pad .pad-record.on,
.bay-pad .pad-record[aria-pressed="true"] {
  background: #fff1ee; border-color: var(--offline); color: var(--offline);
}
.bay-replay { display: flex; flex-direction: column; gap: 8px; margin-top: auto; min-height: 0; }
.bay-replay .film-list { max-height: 240px; overflow: auto; }
.bay-replay .clip { text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.bay-replay .clip:hover { background: var(--hover); }
.trend-slot { flex: 1; min-height: 120px; }
.trend-slot .trend { width: 100%; height: 100%; }

.radar { position: relative; height: 100%; min-height: 640px; }
.radar-map { position: absolute; inset: 0; height: auto; border: 0; }
.float {
  position: absolute; z-index: 3;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(23, 50, 70, .12);
}
.radar-top {
  top: 16px; left: 16px; right: 16px;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 16px;
}
.radar-title { min-width: 220px; }
.radar-title .legend { margin-top: 8px; }
.radar-feed .section-head { justify-content: flex-start; }
.radar-stats { display: flex; gap: 10px; margin-left: auto; }
.radar-top .line { flex: none; }
.ring-stat {
  position: relative; width: 74px; height: 74px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e6eef3 0);
  display: grid; place-items: center;
}
.ring-stat::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface);
}
.ring-stat div { position: relative; z-index: 1; text-align: center; }
.ring-stat b { display: block; font-size: 20px; line-height: 1; color: var(--ink); }
.ring-stat span { color: var(--muted); font-size: 11px; }
.radar-feed {
  top: 164px; right: 16px; bottom: 16px; left: auto; width: 380px;
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
}
.radar-feed > div {
  flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 14px 8px;
}
.radar-feed > div + div { border-top: 1px solid var(--line); }
.feed-scroll, .rank-row {
  display: flex; flex-direction: column; gap: 0;
  overflow: auto; margin: 0; flex: 1; min-height: 0;
}
.feed-scroll .feed-item, .rank-chip {
  width: 100%; display: flex; flex: none; flex-direction: row; align-items: center; gap: 8px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; padding: 10px 0; color: inherit; text-align: left;
}
.feed-item, .clip {
  display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: inherit; text-align: left;
}
.feed-item i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.feed-item span, .rank-chip span, .clip { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.feed-item small, .rank-chip small, .clip small, .tile-meta, .setting small { color: var(--muted); }
.feed-item em, .rank-chip em { margin-left: auto; font-style: normal; color: var(--ink); font-weight: 700; flex: none; }
.rank-chip b { width: 1.6em; flex: none; color: var(--muted); font-size: 13px; }
.rain-alert.float { top: 164px; left: 16px; transform: none; width: min(360px, calc(100% - 430px)); }

.page { padding: 22px 24px 32px; display: flex; flex-direction: column; gap: 16px; }
.page-head, .section-head, .actions, .toolbar { display: flex; align-items: center; gap: 12px; }
.page-head, .section-head { justify-content: space-between; }
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px; min-height: 168px; text-align: left; color: inherit;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: 0 8px 20px rgba(23, 50, 70, .05);
}
.tile:hover { border-color: #c5cdd6; box-shadow: 0 10px 24px rgba(28, 36, 48, .08); }
.tile-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.tile strong { font-size: 40px; line-height: 1; color: var(--primary); font-variant-numeric: tabular-nums; }
.tile strong small { margin-left: 4px; font-size: 14px; color: var(--muted); }
.tile-name { font-size: 16px; }

.ops { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100%; min-height: 640px; background: var(--bg); }
.ops-vision { position: relative; min-width: 0; background: #e8ebef; }
.ops-vision .detail-frame { position: absolute; inset: 0; border: 0; min-height: 0; }
.hud-top, .cinema-back { position: absolute; z-index: 3; }
.hud-top {
  top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  padding: 12px 14px; background: var(--hud); border: 1px solid var(--line); border-radius: 14px;
}
.hud-bar {
  position: absolute; z-index: 3; left: 16px; right: 16px; bottom: 16px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.hud-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 14px;
  background: var(--hud); border: 1px solid var(--line);
}
.hud-actions.is-open { box-shadow: inset 3px 0 0 var(--open); }
.hud-actions.is-closed { box-shadow: inset 3px 0 0 var(--closed); }
.hud-actions p { margin-right: 4px; }
.hud-actions button { min-width: 84px; padding: 10px 14px; font-weight: 700; }
.hud-metrics { display: flex; gap: 8px; flex-wrap: wrap; }
.meter {
  min-width: 88px; padding: 8px 12px; border-radius: 12px;
  background: var(--hud); border: 1px solid var(--line);
}
.meter span { display: block; color: var(--muted); font-size: 12px; }
.meter b { font-size: 16px; }
.ops-side { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); }
.detail-map-panel { padding: 0; overflow: hidden; border-radius: 14px; }
.detail-map-panel .map-wrap { height: 220px; min-height: 220px; border: 0; }

.cinema { position: relative; height: 100%; min-height: 640px; background: #0c1218; }
.cinema .frame { position: absolute; inset: 0 320px 0 0; border: 0; min-height: 0; }
.film-dock {
  position: absolute; top: 0; right: 0; bottom: 0; width: 320px;
  overflow: auto; padding: 64px 16px 16px;
  background: var(--surface); border-left: 1px solid var(--line);
}
.cinema-back { top: 16px; left: 16px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.timecode { display: block; font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.clip { width: 100%; padding: 10px 0; border-bottom: 1px solid var(--line); }
.clip.on { background: var(--hover); border-radius: 10px; padding: 10px; }
.film-list { display: flex; flex-direction: column; }

.desk {
  height: 100%; min-height: 640px;
  display: grid; gap: 12px; padding: 12px;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
.desk-id { grid-row: 1 / span 2; overflow: auto; }
.desk-id h1 { font-size: 26px; }
.desk-id .line { margin-top: auto; }
.desk-kpis { grid-template-columns: 1fr 1fr; }
.desk-kpis b { font-size: 22px; }
.desk-account, .desk-link { min-height: 0; overflow: auto; }
.desk-rows { display: flex; flex-direction: column; gap: 8px; }
.desk-row {
  width: 100%; display: grid; grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 12px; align-items: center; text-align: left; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px;
}
button.desk-row:hover { border-color: var(--primary); }
.desk-row.static { cursor: default; }
.desk-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-row em { font-style: normal; color: var(--primary); }
.desk-row.static em { color: var(--muted); }
.admin {
  height: 100%; min-height: 640px;
  display: grid; gap: 12px; padding: 12px;
  grid-template-columns: 240px minmax(0, 1fr);
}
.admin-side, .admin-main { min-height: 0; overflow: auto; }
.admin-tools { display: flex; gap: 8px; align-items: center; }
.admin-tools .search { flex: 1; width: auto; }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-list:has(.admin-user) {
  display: grid;
  grid-template-columns: 108px minmax(140px, 1fr) 120px 72px max-content;
  column-gap: 16px;
  row-gap: 8px;
}
.admin-row {
  display: grid; align-items: center; gap: 12px 16px;
  grid-template-columns: 78px minmax(160px, 1.1fr) minmax(140px, .9fr) auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.admin-user {
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  gap: 0 16px;
}
.admin-phone { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.admin-actions .line.on { border-color: var(--primary); color: var(--primary); }
.admin-tools .line.on { border-color: var(--primary); color: var(--primary); }
.log-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.log-row time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.role-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-choice {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; padding: 14px 10px;
  background: var(--panel); cursor: pointer;
}
.role-choice:has(input:checked) { border-color: var(--primary); color: var(--primary); }
.role-choice input { accent-color: var(--primary); }
.id-card {
  min-height: 280px; padding: 28px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--surface);
}
.id-count { margin-top: 28px; font-size: 64px; line-height: .9; color: var(--primary); }
.id-count small { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.id-commands { display: flex; flex-direction: column; gap: 16px; }

.panel, .card, .quiet, .warning-card, .dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.panel, .card, .quiet { padding: 16px 18px; }
.panel { display: flex; flex-direction: column; gap: 10px; }
.card strong { display: block; margin-top: 4px; font-size: 28px; color: var(--primary); }
.stats { display: flex; gap: 12px; }
.warning-list { display: flex; flex-direction: column; gap: 14px; }
.weather-fail { padding: 16px 18px; border-color: #f0c08a; background: #fff8ef; }
.weather-fail h2 { color: #9a5b12; }
.warning-card header, .warning-card .body { display: flex; gap: 12px; }
.warning-card .body { flex-direction: column; }
.level-pill { padding: 4px 8px; border: 1px solid currentColor; border-radius: 8px; font-size: 12px; font-weight: 700; }
.level-pill.red { color: #c2412d; }
.level-pill.yellow { color: #a16207; }
.level-pill.blue { color: #0369a1; }
.level-pill.orange { color: #c2410c; }
.rain-alert {
  display: flex; flex-direction: column; text-align: left; color: #1c2430;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid #f0c08a; background: #fff8ef;
}
.rain-alert.red { border-color: #e7b4b4; background: #fff1f1; }
.rain-alert.yellow { border-color: #ead48a; background: #fffbea; }
.rain-alert.blue { border-color: #b9d4ef; background: #f3f8fd; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.map-wrap { position: relative; height: 100%; overflow: hidden; background: #e7eef2; }
.map { width: 100%; height: 100%; }
.notice { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.legend { display: flex; gap: 10px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.fullscreen-btn, .close-map {
  position: absolute; z-index: 2; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.fullscreen-btn { top: 12px; right: 12px; padding: 6px 10px; }
.close-map { top: 16px; right: 16px; width: 36px; height: 36px; }
.marker { display: flex; flex-direction: column; align-items: center; }
.rain-label { background: var(--rain); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.pin { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid #fff; }
.pin.selected { width: 18px; height: 18px; }
.map-full { position: fixed; inset: 0; background: #e7eef2; z-index: 30; }
.map-full .map { height: 100%; }
.frame {
  background: #0c1218; min-height: 240px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden;
}
.frame:has(canvas) { cursor: zoom-in; }
.frame canvas, .frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.frame.live-open {
  position: fixed; inset: 0; z-index: 40; border-radius: 0; min-height: 0; cursor: zoom-out;
}
.frame.live-open canvas { object-fit: contain; }
.live-close {
  display: none; position: absolute; top: 16px; right: 16px; z-index: 2;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  padding: 8px 14px;
}
.frame.live-open .live-close { display: inline-flex; }
.play { display: flex; align-items: center; gap: 8px; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.status, .pill { display: inline-flex; align-items: center; gap: 6px; color: var(--c, var(--ink)); font-weight: 700; }
.status::before, .pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--primary));
}
.setting, .device {
  width: 100%; display: flex; gap: 12px; align-items: center;
  padding: 12px 0; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: inherit; text-align: left;
}
.settings { display: flex; flex-direction: column; }
.setting .grow { flex: 0 0 6em; }
.trend { width: 100%; height: auto; display: block; }
.trend text { fill: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.line, .primary, select, .search, .field, textarea.field {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 12px; border-radius: 10px;
}
.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 700; }
.primary.open { background: var(--open); border-color: var(--open); color: #fff; }
.line.danger { color: var(--error); }
.compact { width: auto; }
.search { width: min(320px, 100%); }
.field, textarea.field { width: 100%; }
.field[readonly] { color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
.toolbar { justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }

.gate {
  min-height: 100vh; height: 100%;
  display: grid; place-items: center; padding: 28px 20px;
  background:
    radial-gradient(ellipse at 18% 12%, rgba(78, 196, 245, .22), transparent 34%),
    radial-gradient(ellipse at 86% 88%, rgba(42, 110, 200, .1), transparent 36%),
    var(--bg);
}
.gate-card {
  width: min(980px, 100%); min-height: 560px;
  display: grid; grid-template-columns: .92fr 1.08fr;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(28, 48, 70, .1);
}
.gate-brand {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 36px; text-align: center; color: #fff;
  background: linear-gradient(155deg, #4ec4f5 0%, #2a86e8 46%, #3a4ed6 100%);
}
.gate-watermark {
  position: absolute; width: 340px; height: 255px;
  left: 50%; top: 46%; transform: translate(-50%, -50%);
}
.gate-copyblock { position: relative; z-index: 1; }
.group { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: .08em; color: #fff; }
.company {
  margin: 18px 0 0; padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .8);
  font-size: 30px; font-weight: 650; letter-spacing: .04em; line-height: 1.35; color: #fff;
}
.gate-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 56px; background: var(--bar); overflow: auto;
}
.auth { width: 100%; max-width: 340px; display: flex; flex-direction: column; }
.auth-mark { width: 64px; height: 48px; margin: 0 0 14px; }
.auth-system { margin: 0; font-size: 16px; font-weight: 650; color: var(--ink); }
.auth-mode { margin: 6px 0 4px; color: var(--muted); font-size: 13px; }
.auth label { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.auth .field {
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  padding: 8px 0 10px; color: var(--ink);
}
.auth .field:focus { outline: none; border-bottom-color: #2a86e8; }
.auth .field::placeholder { color: var(--muted); }
.code-line { display: flex; gap: 8px; align-items: flex-end; }
.code-line .field { flex: 1; }
.auth .code-send, .auth-forgot { border: 0; background: none; color: #49b4e4; padding: 0; }
.auth .code-send { padding: 8px 0 10px; white-space: nowrap; letter-spacing: 0; }
.auth .code-send:disabled { color: var(--muted); }
.auth-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.auth .remember { flex-direction: row; align-items: center; gap: 8px; margin: 0; letter-spacing: 0; font-size: 14px; color: var(--ink); }
.auth .remember input { width: 16px; height: 16px; margin: 0; accent-color: #2a86e8; }
.auth-actions { display: flex; gap: 12px; margin-top: 22px; }
.auth-actions .primary, .auth .ghost { flex: 1; min-height: 44px; border-radius: 999px; letter-spacing: .06em; }
.auth .primary { border: 0; color: #fff; background: linear-gradient(90deg, #3aa8ee, #2a6fe0); }
.auth .ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.auth .error { min-height: 1.2em; margin-top: 8px; }

.modal { position: fixed; inset: 0; background: rgba(23, 50, 70, .28); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.dialog { width: min(460px, 100%); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.help-dialog { width: min(760px, 100%); max-height: calc(100vh - 32px); }
.help-body { overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.help-body h3 { margin: 0; font-size: 15px; }
.help-body p, .help-body li { margin: 0; font-size: 14px; line-height: 1.65; }
.help-body ul { margin: 6px 0 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.help-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.help-table th, .help-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.help-table th { color: var(--muted); font-weight: 700; }
.help-table td:not(:first-child), .help-table th:not(:first-child) { white-space: nowrap; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 40;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 10px 24px rgba(23, 50, 70, .12);
}
.error { color: var(--error); }

html:not([data-theme="night"]) body,
html:not([data-theme="night"]) .nexus,
html:not([data-theme="night"]) .viewport {
  background:
    radial-gradient(880px 420px at -8% -18%, rgba(62, 196, 214, .2), transparent 62%),
    radial-gradient(640px 360px at 108% -8%, rgba(90, 150, 255, .12), transparent 58%),
    #f3f7fb;
}
html:not([data-theme="night"]) .scada-bar {
  background: linear-gradient(180deg, #ffffff, #f6fbfd);
  border-bottom-color: #d4e7ef;
}
html:not([data-theme="night"]) .scada-nav button.active {
  background: #e5f6fb;
  border-radius: 8px;
  box-shadow: none;
  color: #087f9c;
}
html:not([data-theme="night"]) .nominal { background: #e8f8ef; border-color: #b7e4c8; }
html:not([data-theme="night"]) .nominal.warn { background: #fff1ee; border-color: #f3c4ba; }
html:not([data-theme="night"]) .panel { box-shadow: 0 10px 26px rgba(40, 90, 120, .06); }
html:not([data-theme="night"]) .panel h2 { display: inline-flex; align-items: center; gap: 8px; }
html:not([data-theme="night"]) .panel h2::before {
  content: ""; width: 3px; height: 12px; border-radius: 2px;
  background: linear-gradient(#3ec4e6, #14915f);
}
html:not([data-theme="night"]) .badge { background: color-mix(in srgb, var(--c) 14%, #fff); }
html:not([data-theme="night"]) .asset,
html:not([data-theme="night"]) .station { box-shadow: inset 3px 0 0 var(--c, var(--primary)); }
html:not([data-theme="night"]) .tank { box-shadow: inset 3px 0 0 #1a7ed6; }
html:not([data-theme="night"]) .station:hover,
html:not([data-theme="night"]) .asset:hover,
html:not([data-theme="night"]) .tank:hover { background: #f7fcfe; }
html:not([data-theme="night"]) .kpi-fleet { background: #e8f3fc; border-color: #c5dff4; }
html:not([data-theme="night"]) .kpi-fleet b { color: #1a7ed6; }
html:not([data-theme="night"]) .kpi-online { background: #e7f7f4; border-color: #b7e4da; }
html:not([data-theme="night"]) .kpi-online b { color: #0e8a74; }
html:not([data-theme="night"]) .kpi-open { background: #e8f7ee; border-color: #b5e3c8; }
html:not([data-theme="night"]) .kpi-open b { color: #128a55; }
html:not([data-theme="night"]) .kpi-offline { background: #fff1ee; border-color: #f4c8bf; }
html:not([data-theme="night"]) .kpi-offline b { color: #e3533a; }
html:not([data-theme="night"]) .kpi-rain { background: #e8f3fc; border-color: #c3dff5; }
html:not([data-theme="night"]) .kpi-rain b { color: #1a7ed6; }
html:not([data-theme="night"]) .kpi-power { background: #eefaf3; border-color: #c6ead4; }
html:not([data-theme="night"]) .kpi-power b { color: #14915f; }
html:not([data-theme="night"]) .kpi-level { background: #e7f6fb; border-color: #c3e4f2; }
html:not([data-theme="night"]) .kpi-level b { color: #0b8eae; }
html:not([data-theme="night"]) .kpi-signal { background: #f3f1fb; border-color: #d9d2f2; }
html:not([data-theme="night"]) .kpi-signal b { color: #6558c7; }
html:not([data-theme="night"]) .seg.on[data-filter="open"] { background: #e8f7ee; color: #128a55; border-color: #8ed4b0; }
html:not([data-theme="night"]) .seg.on[data-filter="closed"] { background: #f3f6f9; color: #5c6b7a; border-color: #c9d3dc; }
html:not([data-theme="night"]) .seg.on[data-filter="offline"] { background: #fff1ee; color: #e3533a; border-color: #f3c2b8; }
html:not([data-theme="night"]) .seg.on[data-filter="all"],
html:not([data-theme="night"]) .seg.on:not([data-filter]) { background: #e7f6fb; }
html:not([data-theme="night"]) .tank-bar i { background: linear-gradient(90deg, #1288c8, #3ec8e6 68%, #7ddec8); }
html:not([data-theme="night"]) .bat i { background: linear-gradient(90deg, #14915f, #3ecf8e); }
html:not([data-theme="night"]) .primary {
  background: linear-gradient(180deg, #18a8c8, #0b86a6);
  box-shadow: 0 6px 14px rgba(11, 142, 174, .2);
}
html:not([data-theme="night"]) .primary.open {
  background: linear-gradient(180deg, #2cb67a, #14915f);
  box-shadow: 0 6px 14px rgba(20, 145, 95, .18);
}
html:not([data-theme="night"]) .primary.shut {
  background: linear-gradient(180deg, #f0745c, #e3533a);
  box-shadow: 0 6px 14px rgba(227, 83, 58, .18);
}

@media (max-width: 900px) {
  .nexus { flex-direction: column; height: auto; min-height: 100vh; }
  .dock { width: auto; flex-direction: row; padding: 8px; }
  .dock-nav { flex-direction: row; width: auto; overflow: auto; }
  .user-link { margin: 0 0 0 auto; flex-direction: row; }
  .viewport { height: auto; overflow: visible; }
  .hmi { height: auto; grid-template-columns: 1fr; grid-template-rows: auto; }
  .hmi-side, .hmi-matrix, .hmi-canvas, .hmi-log { grid-row: auto; grid-column: auto; }
  .hmi-canvas .map-wrap { height: 300px; flex: none; }
  #home-trend { min-height: 210px; height: 210px; }
  .radar-map { position: relative; height: 420px; order: 1; border-radius: 16px; }
  .radar-top, .radar-feed, .rain-alert.float { position: relative; top: auto; left: auto; right: auto; bottom: auto; width: auto; transform: none; }
  .radar-feed { max-height: none; }
  .feed-scroll, .rank-row { max-height: 280px; }
  .radar-stats { margin-left: 0; }
  .yard, .bay, .desk, .admin { height: auto; grid-template-columns: 1fr; grid-template-rows: auto; }
  .admin-list:has(.admin-user) { display: flex; flex-direction: column; }
  .admin-row, .admin-user { grid-template-columns: 1fr; }
  .gate-card { grid-template-columns: 1fr; min-height: 0; }
  .gate-brand { min-height: 200px; padding: 32px 20px; }
  .group { font-size: 20px; }
  .company { font-size: 22px; }
  .gate-panel { padding: 28px 20px 36px; }
  .auth-actions { flex-direction: column; }
  .desk-id { grid-row: auto; }
  .bay-controls, .bay-rain, .bay-level { grid-row: auto; grid-column: auto; }
  .bay-vision .frame { height: 52vh; flex: none; }
  .bay-map .map-wrap { height: 280px; flex: none; }
  .station { grid-template-columns: 1fr; }
  .ops-vision { min-height: 70vh; }
  .cinema { height: auto; min-height: 80vh; }
  .cinema .frame { position: relative; inset: auto; height: 52vh; }
  .film-dock { position: relative; width: auto; }
  .hud-bar, .page-head, .toolbar, .auth-actions, .hud-top { flex-direction: column; align-items: stretch; }
}
