/* ============================================================
   绿电园区 · GREEN GRID — 界面样式
   视觉母题：旧工业园区的能源调度值班室 / 电费账单与黄铜仪表
   - 深松绿底 + 米色纸张 + 木纹 + 黄铜 + 电网青 + 光伏蓝 + 太阳能黄
   - 硬像素阴影 4px 4px 0；mono 数字；方格纸底纹；无毛玻璃、无现代扁平
   手写样式：零框架、零 @import、零外链字体（全系统字体栈）
   ============================================================ */

/* ------------------------------------------------------------
   1. 设计令牌
   ------------------------------------------------------------ */
:root {

  /* 墨与松绿 */
  --ink: #131d18; --ink-2: #1b2a22; --ink-3: #26382d; --pine: #0e1713; --pine-2: #13211a; --pine-3: #182b21;
  --pine-4: #20382b;

  /* 纸张 */
  --paper: #f2e8d4; --paper-2: #e9dcc2; --paper-3: #dccbaa; --line: #c7b795; --line-soft: #b9a983;
  --muted: #776b52; --muted-2: #5c6a52;

  /* 黄铜 */
  --brass: #c9a24a; --brass-2: #a67f2f; --brass-3: #6f5420; --brass-hi: #ecd08a;

  /* 电网青 / 太阳能黄 / 光伏蓝 / 储能绿 / 告警红 */
  --grid: #5bd6d6; --grid-2: #2f9ea6; --grid-3: #1d5c63; --solar: #f2b544; --solar-2: #c98a20;
  --solar-hi: #ffd97a; --pv: #2f5fa8; --pv-2: #1f4278; --pv-light: #9fc7ec; --batt: #7fbf6a;
  --batt-2: #4d8a45; --alarm: #d4553f; --alarm-2: #8d2f20; --stamp: #b8442f;

  /* 硬阴影 */
  --shadow: rgba(4, 9, 7, 0.42); --shadow-hard: 4px 4px 0 rgba(4, 9, 7, 0.42);
  --shadow-soft: 2px 2px 0 rgba(23, 33, 28, 0.2);
  --font-ui: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", "Courier New", monospace;
  --font-serif: "SimSun", "Songti SC", "Noto Serif SC", serif;
}

/* ------------------------------------------------------------
   2. 基础重置与页面底纹（深松绿 + 蓝图网格）
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background-color: #0d1612;
  background-image: radial-gradient(1200px 640px at 50% -12%, rgba(91, 214, 214, 0.07), transparent 72%),
    radial-gradient(900px 520px at 92% 112%, rgba(201, 162, 74, 0.06), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 40px),
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, 22px 22px; color: var(--paper); font-family: var(--font-ui);
  font-size: 13px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
b, strong { font-weight: 800; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: square;
  stroke-linejoin: miter; flex: none;
}

/* 键盘焦点：像素虚线描边，不用柔和光晕 */
button:focus-visible, input:focus-visible, [tabindex]:focus-visible, .client-card:focus-visible, .side-tab:focus-visible { outline: 2px dashed var(--alarm); outline-offset: 2px; }

/* 滚动条：旧抽屉的铜轨 */
.side-scroll, .clients-body, .intro-modal { scrollbar-width: thin; scrollbar-color: #b8a682 transparent; }
.side-scroll::-webkit-scrollbar, .clients-body::-webkit-scrollbar, .intro-modal::-webkit-scrollbar { width: 9px; height: 9px; }
.side-scroll::-webkit-scrollbar-thumb, .clients-body::-webkit-scrollbar-thumb, .intro-modal::-webkit-scrollbar-thumb { background: #b8a682; border: 2px solid var(--paper); }

/* ------------------------------------------------------------
   3. 应用骨架
   ------------------------------------------------------------ */
.app { display: flex; flex-direction: column; height: 100vh; min-height: 660px; overflow: hidden; }

/* ------------------------------------------------------------
   4. 顶栏：园区调度室的门楣
   ------------------------------------------------------------ */
.topbar {
  position: relative; z-index: 5; flex: none; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; padding: 12px 22px 11px; border-bottom: 2px solid #050b08;
  background-color: #0e1814;
  background-image: repeating-linear-gradient(90deg, #0e1814 0 3px, #0f1a15 3px 8px, #101c17 8px 11px),
    radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: auto, 14px 14px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.24),
    inset 0 -1px 0 rgba(201, 162, 74, 0.22);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: rgba(242, 232, 212, 0.13);
}

/* ---- 品牌 ---- */
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-home { display: grid; justify-items: center; gap: 3px; flex: none; padding: 2px 3px; border-radius: 4px; color: #b8ddd0; text-decoration: none; font: 12px/1.2 system-ui, sans-serif; white-space: nowrap; }
.brand-home:hover { color: #f2e8d4; text-decoration: underline; }
.brand-home:focus-visible { outline: 2px solid #9ee6e0; outline-offset: 3px; }
.brand-mark { display: block; flex: none; width: 52px; height: 52px; object-fit: contain; }
.brand-text { min-width: 0; }
.brand-eyebrow {
  display: flex; align-items: center; gap: 10px; margin-bottom: 1px; color: #93a796; font-size: 10px;
  letter-spacing: 0.16em;
}
.brand-eyebrow > span:first-child { font-family: var(--font-serif); }
.eyebrow-hint { padding-left: 10px; border-left: 1px solid #2a3d33; color: #5c7367; font-size: 9.5px; letter-spacing: 0.02em; }
.company-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 34px; }
.company-name {
  display: inline-flex; align-items: center; max-width: min(38vw, 500px); color: var(--paper);
  font-size: 26px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.15;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-tag {
  flex: none; padding: 2px 7px 1px; border: 1px solid var(--grid-3); background: rgba(91, 214, 214, 0.08);
  color: #9ee6e0; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; line-height: 1.4; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.brand-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 2px; color: #8ba294;
  font-size: 10.5px; letter-spacing: 0.03em;
}
.brand-meta #metaPrice { font-family: var(--font-mono); font-size: 9.5px; color: var(--solar-hi); }
.live-dot {
  width: 6px; height: 6px; flex: none; background: var(--grid);
  box-shadow: 0 0 0 2px rgba(91, 214, 214, 0.16); animation: live-blink 2.6s steps(1) infinite;
}
.meta-divider { color: #405448; }
@keyframes live-blink {
  0%, 70% { opacity: 1; }
  74%, 92% { opacity: 0.25; }
  100% { opacity: 1; }
}
.top-right { display: flex; align-items: center; gap: 12px; flex: none; }

/* ---- 资金卡：黄铜边框的能源仪表 ---- */
.money-card {
  position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 300px;
  padding: 7px 14px 8px; border: 2px solid #050b08; background-color: #122019;
  background-image: radial-gradient(120% 100% at 50% 130%, rgba(242, 181, 68, 0.14), transparent 62%),
    radial-gradient(circle at 7px 7px, var(--brass-hi) 0 1.5px, var(--brass-3) 1.5px 2.5px, transparent 2.5px),
    radial-gradient(circle at calc(100% - 7px) 7px, var(--brass-hi) 0 1.5px, var(--brass-3) 1.5px 2.5px, transparent 2.5px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 3px);
  color: var(--paper); text-align: left;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.42),
    inset 0 0 0 2px #a67f2f,
    inset 0 0 0 3px #16251d;
  transition: transform 0.1s steps(2, end), box-shadow 0.12s steps(2, end);
}
.money-card::after {
  content: ""; position: absolute; left: 9px; right: 9px; bottom: 3px; height: 3px;
  background: repeating-linear-gradient(90deg, rgba(201, 162, 74, 0.5) 0 1px, transparent 1px 6px);
  opacity: 0.45; pointer-events: none;
}
.money-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.42),
    inset 0 0 0 2px var(--brass-hi),
    inset 0 0 0 3px #16251d;
}
.money-card:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px #a67f2f,
    inset 0 0 0 3px #16251d;
}
.money-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.money-label { display: inline-flex; align-items: center; gap: 5px; color: #d8c398; font-size: 9.5px; letter-spacing: 0.2em; }
.money-label .icon { width: 13px; height: 13px; color: var(--solar); }
.money-no { color: #8e7a4d; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.08em; white-space: nowrap; }
.money-value {
  display: flex; align-items: baseline; gap: 3px; color: var(--solar-hi); font-family: var(--font-mono);
  font-size: 30px; font-weight: 700; letter-spacing: -0.01em; line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(242, 181, 68, 0.28),
    2px 2px 0 rgba(0, 0, 0, 0.45);
}
.money-value .yen { color: var(--solar); font-size: 16px; font-weight: 700; transform: translateY(-3px); }
.money-foot {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: #7f9a8d;
  font-family: var(--font-mono); font-size: 9.5px; line-height: 1.4;
}
.money-foot .profit { color: #b7e3a8; }
.money-foot .profit.is-neg { color: #ffb0a0; }
.kpi b.is-neg { color: #ffb0a0; }
.money-foot .total { padding-left: 9px; border-left: 1px solid #2c4236; color: #b9a15f; }
.barcode {
  position: absolute; right: 12px; bottom: 7px; width: 64px; height: 10px; opacity: 0.28;
  background: repeating-linear-gradient(
    90deg,
    var(--paper) 0 1px,
    transparent 1px 3px,
    var(--paper) 3px 5px,
    transparent 5px 6px,
    var(--paper) 6px 7px,
    transparent 7px 10px
  );
  pointer-events: none;
}

/* ---- 顶栏操作按钮 ---- */
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: 38px; height: 38px;
  padding: 0; border: 2px solid #33483c; background: var(--pine-3); color: #b7c6b8;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.1s steps(2, end), background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--brass-2); background: #263b30; color: var(--paper); transform: translate(-1px, -1px); }
.icon-btn:active { transform: translate(1px, 1px); box-shadow: none; }
.icon-btn.danger:hover { border-color: #6d3a30; background: #3a2520; color: #f0b9a8; }
.icon-btn.label-btn { width: auto; padding: 0 9px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; }
.icon-btn.label-btn span { white-space: nowrap; }
.icon-btn.label-btn .icon { width: 15px; height: 15px; color: var(--grid); }
.icon-btn[aria-pressed="false"] .icon-sound-on { display: none; }
.icon-btn[aria-pressed="true"] .icon-sound-off { display: none; }
#btnSound.is-muted { color: #70857a; border-color: #2a3d33; }
#btnSound.is-muted:hover { color: var(--paper); }
#btnFlow.is-off { color: #6d8175; border-color: #2a3d33; background: #111d17; }
#btnFlow.is-off:hover { color: var(--paper); border-color: var(--brass-2); }

/* ------------------------------------------------------------
   5. 工作区
   ------------------------------------------------------------ */
.workspace {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 398px; gap: 16px; min-height: 0;
  padding: 14px 22px 10px;
}

/* ------------------------------------------------------------
   6. 舞台面板
   ------------------------------------------------------------ */
.stage-panel {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border: 2px solid #050b08; background: #0a1511;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(201, 162, 74, 0.14);
}

/* ---- 舞台头：行情 / 时钟 / 速度 ---- */
.stage-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px;
  padding: 6px 12px; border-bottom: 1px solid #23382d; background-color: #0f1e18;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 2px, transparent 2px 6px);
}
.stage-title {
  display: flex; align-items: center; gap: 9px; min-width: 0; color: #d5ddcf; font-size: 12px;
  letter-spacing: 0.02em;
}
.stage-title strong { color: var(--paper); font-size: 13px; font-weight: 700; white-space: nowrap; }
.cam-dot {
  width: 7px; height: 7px; flex: none; background: var(--grid);
  box-shadow: 0 0 0 2px rgba(91, 214, 214, 0.16); animation: live-blink 2s steps(1) infinite;
}
.stage-sub { color: #84998a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-head-right { display: flex; align-items: center; gap: 8px; flex: none; }

/* 电价行情条 */
.market-ticker {
  display: flex; align-items: center; gap: 6px; padding: 3px 9px; border: 2px solid #050b08;
  background: rgba(9, 17, 13, 0.72); box-shadow: inset 0 0 0 1px rgba(201, 162, 74, 0.24);
  white-space: nowrap;
}
.ticker-label { color: #8fa89a; font-size: 8.5px; letter-spacing: 0.14em; }
#tickerPrice {
  color: var(--solar-hi); font-family: var(--font-mono); font-size: 14px; font-weight: 700;
  letter-spacing: -0.01em;
}
.ticker-factor {
  padding-left: 6px; border-left: 1px solid #2c4236; color: #9a8c70; font-family: var(--font-mono);
  font-size: 8.5px;
}

/* 电价标签 */
.tag {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 15px;
  padding: 0 4px; border: 1px solid; font-family: var(--font-mono); font-size: 8.5px; font-weight: 700;
  line-height: 1; letter-spacing: 0.04em; white-space: nowrap;
}
.tag.peak { border-color: #8d3f2f; background: rgba(212, 85, 63, 0.22); color: #ffb9a4; }
.tag.flat { border-color: #8a6d2f; background: rgba(242, 181, 68, 0.18); color: var(--solar-hi); }
.tag.valley { border-color: #3d7c52; background: rgba(127, 191, 106, 0.18); color: #b7e3a8; }

/* 时钟 */
.clock-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid #3a5747;
  background: rgba(20, 35, 28, 0.6); white-space: nowrap;
}
.clock-chip .icon { width: 13px; height: 13px; color: var(--grid); }
#clockText { color: var(--paper); font-family: var(--font-mono); font-size: 11px; letter-spacing: -0.01em; }

/* 速度组 */
.speed-group { display: flex; gap: 3px; padding: 2px; background: #0b1511; border: 1px solid #2a3f34; }
.speed-btn {
  min-width: 28px; height: 24px; padding: 0 5px; border: 1px solid #32473b; background: #15251d;
  color: #8fa89a; font-family: var(--font-mono); font-size: 10px; font-weight: 700; line-height: 1;
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s steps(2, end);
}
.speed-btn:hover { background: #1f362a; color: var(--paper); }
.speed-btn.is-active {
  border-color: #0a120d;
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-2) 100%);
  color: #2b1f08; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.speed-btn.pause-btn { display: flex; align-items: center; justify-content: center; width: 28px; padding: 0; }
.speed-btn.pause-btn .icon { width: 12px; height: 12px; }
#pauseBtn.is-active {
  border-color: #0a120d; background: linear-gradient(180deg, #e4765c, var(--alarm)); color: #fff3e3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ------------------------------------------------------------
   7. 画布区与地图覆盖层
   ------------------------------------------------------------ */
.canvas-wrap {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;

  /* 横向 24 / 纵向 18，与 scene.fit() 预留一致 */
  padding: 10px 12px 8px; overflow: hidden; background-color: #0c1712;
  background-image: radial-gradient(ellipse 64% 56% at 50% 58%, rgba(91, 214, 214, 0.05), transparent 70%),
    radial-gradient(ellipse 90% 44% at 50% 100%, rgba(201, 162, 74, 0.045), transparent 72%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 30px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 30px);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 74, 0.1);
}
.canvas-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.6);
}
#parkCanvas {
  position: relative; z-index: 2; display: block; max-width: 100%; max-height: 100%;
  box-shadow: 0 0 0 1px rgba(6, 12, 9, 0.85), 0 0 0 2px rgba(201, 162, 74, 0.13);
  image-rendering: pixelated; image-rendering: crisp-edges; cursor: grab; touch-action: none;
}
#parkCanvas:active { cursor: grabbing; }

/* 天气牌：画布左上角的纸贴纸 */
.weather-badge {
  position: absolute; z-index: 4; top: 12px; left: 14px; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em; box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-1deg); pointer-events: none;
}
.weather-icon { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: var(--solar-2); }
.weather-icon .icon { width: 15px; height: 15px; stroke-width: 2; }

/* 选中企业卡：贴在画布左下 */
.select-card {
  position: absolute; z-index: 6; left: 14px; bottom: 14px; width: 272px; padding: 10px 11px 11px;
  border: 2px solid var(--ink); background-color: var(--paper);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 50%),
    repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.03) 0 1px, transparent 1px 5px);
  color: var(--ink); box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.45); animation: card-in 0.16s steps(3, end);
}
.select-card::before {
  content: ""; position: absolute; top: -6px; left: 14px; width: 42px; height: 11px; transform: rotate(-2deg);
  background: rgba(91, 214, 214, 0.45); border: 1px solid rgba(47, 158, 166, 0.6); pointer-events: none;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.select-close {
  position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center;
  justify-content: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line);
  background: transparent; color: var(--muted);
}
.select-close:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.select-close .icon { width: 12px; height: 12px; }
.sc-head { display: flex; align-items: center; gap: 9px; padding-right: 20px; }
.sc-avatar {
  display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; padding: 2px; flex: none;
  border: 2px solid var(--ink); background-color: #26372e;
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.05) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 8px 8px; background-position: 0 0, 4px 4px; image-rendering: pixelated;
}
.sc-avatar canvas { width: 44px; height: 44px; image-rendering: pixelated; }
.sc-head h3 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.25; }
#scSector { margin: 1px 0 0; color: #7d6c4c; font-size: 9.5px; line-height: 1.4; }
.sc-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin: 8px 0 0; padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.sc-stats > div { min-width: 0; }
.sc-stats dt { color: #8a7c60; font-size: 8.5px; letter-spacing: 0.02em; white-space: nowrap; }
.sc-stats dd {
  margin: 1px 0 0; overflow: hidden; color: var(--ink); font-family: var(--font-mono); font-size: 10.5px;
  font-weight: 700; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap;
}
.sc-pv-state {
  margin: 7px 0 0; padding: 4px 7px; border-left: 3px solid var(--pv); background: rgba(47, 95, 168, 0.07);
  color: #5d6a5c; font-size: 9.5px; line-height: 1.5;
}
.select-card .cta-btn { margin-top: 8px; min-height: 32px; font-size: 10.5px; }

/* 飘字层 */
.float-layer { position: absolute; inset: 0; z-index: 8; overflow: hidden; pointer-events: none; }
.float-num {
  position: absolute; left: 0; top: 0; color: #c4f0a8; font-family: var(--font-mono); font-size: 14px;
  font-weight: 700; line-height: 1; white-space: nowrap; text-shadow: 2px 2px 0 rgba(4, 10, 8, 0.65);
  animation: float-rise 1s steps(10, end) forwards;
}
.float-num.is-down, .float-num.is-cost, .float-num.is-bad { color: #ffb8a4; text-shadow: 2px 2px 0 rgba(60, 16, 10, 0.65); }
@keyframes float-rise {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.9); }
  14% { opacity: 1; transform: translate(-50%, -6px) scale(1); }
  68% { opacity: 1; transform: translate(-50%, -30px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}

/* 悬停提示 */
.scene-tip {
  position: absolute; z-index: 9; max-width: 230px; padding: 4px 8px; border: 1px solid #4d7a63;
  background: rgba(14, 26, 20, 0.96); color: #e7efe4; font-size: 10px; line-height: 1.5;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.34); pointer-events: none; transform: translate(0, -100%);
}

/* 底部提示 */
.scene-hint {
  position: absolute; z-index: 5; left: 50%; bottom: 8px; transform: translateX(-50%); max-width: 88%;
  padding: 4px 11px; border: 1px solid rgba(77, 122, 99, 0.75); background: rgba(16, 30, 24, 0.84);
  color: #b7e3c9; font-size: 10.5px; letter-spacing: 0.02em; line-height: 1.5; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28); pointer-events: none;
}

/* ------------------------------------------------------------
   8. 舞台脚：KPI 仪表条
   ------------------------------------------------------------ */
.stage-foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px;
  padding: 6px 12px; border-top: 1px solid #23382d; background-color: #0f1e18;
  background-image: repeating-linear-gradient(90deg, rgba(201, 162, 74, 0.045) 0 1px, transparent 1px 9px);
}
.kpi-strip { display: flex; align-items: stretch; flex: 1; min-width: 0; }
.kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 0 11px;
  border-right: 1px solid #24382d;
}
.kpi:first-child { padding-left: 2px; }
.kpi:last-child { border-right: 0; }
.kpi i { color: #86a08f; font-style: normal; font-size: 8.5px; letter-spacing: 0.12em; white-space: nowrap; }
.kpi b {
  overflow: hidden; max-width: 100%; color: #e0e9e0; font-family: var(--font-mono); font-size: 11.5px;
  font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.35;
  text-overflow: ellipsis; white-space: nowrap;
}
.kpi.profit b { color: var(--solar-hi); }
.kpi.profit i { color: #b9a15f; }
.stage-foot-right { display: flex; align-items: center; gap: 8px; flex: none; }
.save-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 7px; color: #8ea394; font-size: 10px;
  white-space: nowrap;
}
.save-dot { width: 5px; height: 5px; flex: none; background: var(--grid); }
.save-chip.is-saving .save-dot { background: var(--brass); animation: live-blink 1s steps(1) infinite; }
.save-chip.is-error { color: #e2a491; }
.save-chip.is-error .save-dot { background: var(--alarm); }
.text-btn {
  padding: 2px 0; border: 0; background: transparent; color: #a7b7a9; font-size: 10.5px;
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; white-space: nowrap;
}
.text-btn:hover { color: var(--paper); }

/* ------------------------------------------------------------
   9. 运营台（右侧纸面台账）
   ------------------------------------------------------------ */
.side-panel {
  position: relative; display: flex; flex-direction: column; min-height: 0; border: 2px solid var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 34%),
    repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.022) 0 1px, transparent 1px 5px);
  color: var(--ink); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.32); overflow: hidden;
}

/* 左侧装订脊 */
.side-panel::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; z-index: 2;
  background: repeating-linear-gradient(
    0deg,
    var(--brass) 0 9px,
    var(--brass-2) 9px 11px,
    var(--brass-3) 11px 12px
  );
  pointer-events: none; box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25);
}
.side-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 13px 13px 8px 20px; border-bottom: 1px dashed var(--line);
}
.side-kicker {
  display: block; margin-bottom: 1px; color: var(--stamp); font-family: var(--font-serif); font-size: 9px;
  letter-spacing: 0.2em;
}
.side-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.15; }
.side-badge {
  flex: none; padding: 2px 7px; border: 1px solid var(--grid-2); background: rgba(91, 214, 214, 0.14);
  color: #1f6472; font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  white-space: nowrap;
}

/* tab 贴纸 */
.side-tabs { display: flex; gap: 3px; padding: 0 11px 0 20px; border-bottom: 2px solid var(--ink); flex: none; }
.side-tab {
  position: relative; top: 2px; flex: 1; min-width: 0; padding: 6px 3px; border: 2px solid var(--ink);
  border-bottom: none; background: var(--paper-3); color: #625744; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.04em; white-space: nowrap; transition: background 0.12s ease, color 0.12s ease;
}
.side-tab:hover { background: #e6d6b6; color: var(--ink); }
.side-tab.is-active { top: 0; z-index: 1; padding-bottom: 9px; background: var(--paper); color: var(--ink); }
.side-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--paper); }
.side-tab.is-active::before {
  content: ""; position: absolute; top: 3px; left: 50%; width: 14px; height: 2px; margin-left: -7px;
  background: var(--alarm); opacity: 0.7;
}
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tab-panel { padding: 11px 13px 18px 20px; }

/* ------------------------------------------------------------
   10. 客户 tab：折扣、台账、目标
   ------------------------------------------------------------ */
.discount-box {
  padding: 10px; border: 2px solid var(--ink); background-color: var(--paper-2);
  background-image: repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.025) 0 1px, transparent 1px 5px);
  box-shadow: 3px 3px 0 rgba(23, 33, 28, 0.18);
}

/* 共享的范围标题 */
.range-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #5f563f;
  font-size: 10.5px; letter-spacing: 0.03em; line-height: 1.4;
}
.range-head b {
  color: var(--ink); font-family: var(--font-mono); font-size: 15px; font-weight: 700;
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.range-row { display: flex; align-items: center; gap: 8px; }

/* 方角滑杆：铜轨 + 黄铜滑块 */
.slider {
  display: block; width: 100%; height: 22px; margin: 4px 0 7px; padding: 0; background: transparent;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 8px; border: 1px solid #7d6c4c; background-color: var(--paper-3);
  background-image: repeating-linear-gradient(90deg, rgba(23, 33, 28, 0.16) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 80%);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 18px; margin-top: -5px; border: 2px solid #0a120d;
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-2) 100%);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.slider:hover::-webkit-slider-thumb { background: linear-gradient(180deg, #f6e0a8, var(--brass-hi)); }
.slider::-moz-range-track {
  height: 8px; border: 1px solid #7d6c4c; background-color: var(--paper-3);
  background-image: repeating-linear-gradient(90deg, rgba(23, 33, 28, 0.16) 0 1px, transparent 1px 12px);
}
.slider::-moz-range-thumb {
  width: 12px; height: 16px; border: 2px solid #0a120d; border-radius: 0;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}
.price-preview {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding-top: 6px;
  border-top: 1px dashed var(--line); color: var(--muted); font-family: var(--font-mono); font-size: 9.5px;
}
.price-preview b { color: var(--ink); font-size: 11px; letter-spacing: -0.01em; }
.price-preview span:nth-child(1) b { color: var(--alarm-2); }
.price-preview span:nth-child(3) b { color: #3f6b3f; }
.hint { margin-top: 6px; color: var(--muted); font-size: 9.5px; line-height: 1.55; }
#discountHint { margin-top: 7px; }
.client-stats {
  margin: 9px 0 0; padding: 7px 0; border-bottom: 1px dashed var(--line); color: #6f6249;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.01em;
}

/* 客户卡：企业用电档案 */
.client-list { margin-top: 6px; }
.client-card {
  position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center;
  gap: 8px; padding: 7px 6px 7px 9px; border-bottom: 1px dashed var(--line);
  background-image: repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.02) 0 1px, transparent 1px 9px);
  cursor: pointer; transition: background-color 0.12s ease;
}
.client-card::before { content: ""; position: absolute; left: 1px; top: 7px; bottom: 7px; width: 3px; background: transparent; }
.client-card:hover { background-color: rgba(255, 255, 255, 0.45); }
.client-card.is-signed::before { background: var(--batt-2); }
.client-card.is-signed { background-color: rgba(127, 191, 106, 0.07); }
.cc-avatar {
  display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 2px; flex: none;
  border: 2px solid var(--ink); background-color: #26372e;
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.05) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 8px 8px; background-position: 0 0, 4px 4px; box-shadow: 2px 2px 0 rgba(23, 33, 28, 0.18);
}
.cc-avatar canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.cc-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cc-name {
  overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 800; letter-spacing: 0.01em;
  line-height: 1.3; text-overflow: ellipsis; white-space: nowrap;
}
.cc-meta {
  overflow: hidden; color: #8a7c60; font-family: var(--font-mono); font-size: 8.5px; line-height: 1.4;
  text-overflow: ellipsis; white-space: nowrap;
}
.cc-req {
  overflow: hidden; color: #8a6d3b; font-family: var(--font-mono); font-size: 8.5px; line-height: 1.4;
  text-overflow: ellipsis; white-space: nowrap;
}
.cc-status {
  align-self: start; margin-top: 2px; padding: 1px 5px; border: 1px solid #a99776;
  background: #e2d3b4; color: #5f563f;
  font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.client-card.is-signed .cc-status { border-style: solid; border-color: var(--batt-2); background: rgba(127, 191, 106, 0.16); color: #3f6b3f; }
.client-card.is-idle .cc-name { color: #5f563f; }

/* 目标清单 */
.goal-box { margin-top: 13px; }
.goal-list { margin-top: 1px; }
.goal-box h3 {
  margin: 0 0 3px; padding-top: 9px; border-top: 2px solid var(--ink); color: var(--ink);
  font-family: var(--font-serif); font-size: 10px; font-weight: 700; letter-spacing: 0.18em;
}
.goal-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 0; border-bottom: 1px dashed var(--line);
  color: var(--muted); font-size: 10px; line-height: 1.45;
}
.goal-item::before { content: ""; width: 9px; height: 9px; flex: none; border: 1px solid #a99776; background: var(--paper-3); }
.goal-item.is-done { color: #4d7a5c; }
.goal-item.is-done::before {
  content: "✓"; display: flex; align-items: center; justify-content: center; width: 9px; height: 9px;
  border-color: var(--batt-2); background: var(--batt); color: #12301a; font-family: var(--font-mono);
  font-size: 7px; font-weight: 700; line-height: 1;
}
.goal-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.goal-progress {
  flex: none; color: #8a7c60; font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  white-space: nowrap;
}
.goal-item.is-done .goal-progress { color: #3f6b3f; }

/* ------------------------------------------------------------
   11. 资产 tab
   ------------------------------------------------------------ */
.asset-summary {
  padding: 7px 9px; border-left: 3px solid var(--brass); background: rgba(255, 255, 255, 0.22);
  color: #5f563f; font-family: var(--font-mono); font-size: 10px; line-height: 1.5;
}
.asset-group { margin-top: 13px; }
.asset-list { margin-top: 1px; }
.asset-group h3 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 2px;
  padding-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 11px;
  font-weight: 800; letter-spacing: 0.05em;
}
.asset-group h3 span { color: var(--muted); font-family: var(--font-mono); font-size: 9px; font-weight: 600; }
.pv-summary { padding: 7px 0 5px; color: var(--muted); font-size: 9.5px; line-height: 1.55; }
.asset-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name state"
    "meta state"; align-items: center; gap: 1px 8px; padding: 6px 0;
  cursor: pointer; transition: background-color 0.12s ease;
  border-bottom: 1px dashed var(--line);
}
.as-name {
  grid-area: name; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 700; line-height: 1.4;
  text-overflow: ellipsis; white-space: nowrap;
}
.as-meta {
  grid-area: meta; overflow: hidden; color: #8a7c60; font-family: var(--font-mono); font-size: 8.5px;
  line-height: 1.4; text-overflow: ellipsis; white-space: nowrap;
}
.as-state {
  grid-area: state; align-self: center; padding: 1px 5px; border: 1px solid #a99776; background: #e2d3b4; color: #5f563f;
  font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.asset-row:hover { background-color: rgba(255, 255, 255, 0.42); }
.asset-row.is-built .as-state { border-style: solid; border-color: var(--batt-2); background: rgba(127, 191, 106, 0.14); color: #3f6b3f; }
.asset-row.is-built .as-name::before { content: "▪ "; color: var(--batt-2); }

/* ------------------------------------------------------------
   12. 策略 tab：SOC 与 24h 曲线
   ------------------------------------------------------------ */
.strategy-box {
  padding: 10px; border: 2px solid var(--ink); background-color: var(--paper-2);
  background-image: repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.025) 0 1px, transparent 1px 5px);
  box-shadow: 3px 3px 0 rgba(23, 33, 28, 0.18);
}
.strategy-box .range-head + .slider { margin-bottom: 2px; }
.strategy-box .range-head:not(:first-child) { margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); }
.soc-card {
  margin-top: 10px; padding: 9px 10px 10px; border: 2px solid #050b08; background-color: #14231c;
  background-image: radial-gradient(120% 100% at 50% 130%, rgba(127, 191, 106, 0.16), transparent 62%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 3px);
  color: var(--paper);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px var(--brass-2),
    inset 0 0 0 3px #0e1a14;
}
.soc-card .range-head { color: #d8c398; }
.soc-card .range-head b { color: var(--batt); font-size: 11.5px; }
.soc-bar {
  height: 12px; margin-top: 4px; border: 1px solid var(--brass-3); background-color: #0b1611;
  background-image: repeating-linear-gradient(90deg, rgba(201, 162, 74, 0.16) 0 1px, transparent 1px 8px);
  overflow: hidden;
}
.soc-fill {
  width: 0; height: 100%; background-color: var(--batt);
  background-image: repeating-linear-gradient(
    90deg,
    var(--batt) 0 7px,
    var(--batt-2) 7px 8px,
    transparent 8px 10px
  );
  box-shadow: 0 0 6px rgba(127, 191, 106, 0.35); transition: width 0.35s steps(8, end);
}
.soc-card .hint { color: #8e9c88; }
#tabStrategy::after {
  content: "口诀 · 谷充峰放：电网便宜时给储能充电，电网贵时放电卖给企业；弃电为 0、SOC 不满不空才是好调度。";
  display: block; margin-top: 12px; padding: 8px 10px; border: 1px dashed var(--line-soft);
  background: rgba(255, 255, 255, 0.18); color: #8a7c60; font-family: var(--font-serif);
  font-size: 9.5px; line-height: 1.6; letter-spacing: 0.02em;
}
.chart-wrap {
  margin-top: 11px; padding: 8px 9px 9px; border: 2px solid var(--ink); background-color: #f7efdd;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 60%),
    repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.03) 0 1px, transparent 1px 5px);
  box-shadow: 3px 3px 0 rgba(23, 33, 28, 0.14);
}
.chart-wrap h3 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 6px;
  color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
}
.chart-wrap h3 span { color: var(--muted); font-family: var(--font-mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0; }
.chart-wrap canvas {
  display: block; width: 100%; height: auto; border: 1px solid var(--line); background: #efe3c8;
  image-rendering: auto;
}

/* ------------------------------------------------------------
   13. 市场 tab
   ------------------------------------------------------------ */
.market-now {
  padding: 9px 10px; border: 2px solid var(--ink); background-color: var(--paper-2);
  background-image: repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.025) 0 1px, transparent 1px 5px);
  box-shadow: 3px 3px 0 rgba(23, 33, 28, 0.18);
}
.market-now .range-head b { font-size: 22px; color: var(--alarm-2); text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3); }
.market-meta {
  display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--muted);
  font-family: var(--font-mono); font-size: 9.5px;
}
.event-box { margin-top: 12px; }
.event-box h3 {
  margin: 0 0 3px; padding-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--ink);
  font-size: 11px; font-weight: 800; letter-spacing: 0.05em;
}
.event-log { max-height: 210px; overflow-y: auto; }
.event-item {
  display: flex; gap: 7px; padding: 6px 0; border-bottom: 1px dashed var(--line); color: var(--muted);
  font-size: 9.5px; line-height: 1.5;
}
.event-item::before {
  content: ""; width: 5px; height: 5px; flex: none; margin-top: 4px; background: var(--grid-2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.event-time { flex: none; color: #8a7c60; font-family: var(--font-mono); font-size: 8.5px; white-space: nowrap; }
.event-text { min-width: 0; }
.event-log:empty::before, #eventLog:empty::before { content: "暂无电网公告。"; display: block; padding: 12px 0; color: var(--muted); font-size: 9.5px; }

/* ------------------------------------------------------------
   14. 共享按钮（侧栏 CTA / 弹窗）
   ------------------------------------------------------------ */
.cta-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 33px;
  margin-top: 8px; padding: 6px 9px; border: 2px solid var(--ink); background: var(--ink);
  color: var(--paper); font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; line-height: 1.3;
  box-shadow: 2px 2px 0 rgba(23, 33, 28, 0.25);
  transition: transform 0.08s steps(2, end), background 0.12s ease;
}
.cta-btn:hover { background: #2d4236; transform: translate(-1px, -1px); }
.cta-btn:active { transform: translate(1px, 1px); box-shadow: none; }
.cta-btn:disabled {
  border-color: #8c7d63; background: #a39377; color: #f5eddd; box-shadow: none; cursor: not-allowed;
  transform: none;
}
.cta-btn.primary {
  border-color: var(--ink);
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-2) 100%);
  color: #2b1f08; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}
.cta-btn.primary:hover { background: linear-gradient(180deg, #f8e6b4, var(--brass-hi)); transform: translate(-1px, -1px); }

/* ------------------------------------------------------------
   15. 页脚
   ------------------------------------------------------------ */
.app-foot {
  flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 22px 9px;
  color: #617468; font-size: 9.5px; letter-spacing: 0.02em;
}
.foot-sep { color: #3f5247; }
#footSave { font-family: var(--font-mono); }

/* ------------------------------------------------------------
   16. Toast / 飘字
   ------------------------------------------------------------ */
.toast-stack {
  position: fixed; z-index: 90; top: 162px; right: 436px; left: auto; bottom: auto; display: flex;
  flex-direction: column; align-items: flex-end; gap: 7px; width: max-content; max-width: 340px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border: 2px solid var(--ink);
  background: var(--paper); color: var(--ink); font-size: 11.5px; font-weight: 600; line-height: 1.5;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.38); animation: toast-in 0.18s steps(3, end);
}
.toast::before { content: ""; width: 6px; height: 6px; flex: none; background: var(--batt); }
.toast.is-good { border-left: 4px solid var(--batt-2); }
.toast.is-good::before { background: var(--batt); }
.toast.is-bad { border-left: 4px solid var(--stamp); }
.toast.is-bad::before { background: var(--stamp); }

/* 电网公告：青蓝边 + 小闪电的气势 */
.toast.is-event { border-color: #0a120d; border-left: 4px solid var(--grid-2); background: #eef6ee; color: #1c302b; }
.toast.is-event::before { background: var(--grid-2); box-shadow: 0 0 0 2px rgba(47, 158, 166, 0.18); }
.toast.is-leaving { opacity: 0; transform: translateY(5px); transition: opacity 0.2s ease, transform 0.2s ease; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   17. 弹窗：调度室档案夹
   ------------------------------------------------------------ */
.modal-layer {
  position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 22px;
}
.modal-scrim {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 40%, rgba(12, 26, 21, 0.72), rgba(3, 7, 5, 0.9));
}
.modal {
  position: relative; z-index: 1; color: var(--ink); background-color: var(--paper);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 40%),
    repeating-linear-gradient(0deg, rgba(23, 33, 28, 0.022) 0 1px, transparent 1px 5px);
  border: 3px solid var(--ink); box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.44);
  animation: modal-in 0.18s steps(3, end);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 15px 20px 11px;
  border-bottom: 2px solid var(--ink);
}
.modal-kicker {
  display: block; margin-bottom: 1px; color: var(--stamp); font-family: var(--font-serif); font-size: 9.5px;
  letter-spacing: 0.22em;
}
.modal-head h2, .confirm-modal h2 { margin: 0; color: var(--ink); font-size: 24px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.2; }
.close-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none;
  padding: 0; border: 2px solid var(--ink); background: transparent; color: var(--ink);
  transition: background 0.12s ease, color 0.12s ease;
}
.close-btn:hover { background: var(--ink); color: var(--paper); }
.close-btn .icon { width: 14px; height: 14px; }
.modal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 20px;
  border-top: 1px dashed var(--line); color: var(--muted); font-size: 9.5px;
}
.modal-foot .action-btn { flex: none; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 通用弹窗按钮 */
.action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px;
  padding: 6px 10px; border: 2px solid var(--ink); background: var(--paper-2); color: var(--ink);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; box-shadow: 2px 2px 0 rgba(23, 33, 28, 0.2);
  transition: transform 0.08s steps(2, end), background 0.12s ease;
}
.action-btn:hover { background: #f8efdc; transform: translate(-1px, -1px); }
.action-btn:active { transform: translate(1px, 1px); box-shadow: none; }
.action-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.action-btn.primary {
  border-color: var(--ink); background: var(--ink); color: var(--paper);
  box-shadow: 3px 3px 0 rgba(23, 33, 28, 0.3);
}
.action-btn.primary:hover { background: #2d4236; }
.intro-modal .action-btn.primary::after { content: "→"; margin-left: 2px; font-family: var(--font-mono); font-weight: 700; }

/* 纸面上的文字按钮压深 */
.modal .text-btn, .modal-foot .text-btn { color: #6d644f; }
.modal .text-btn:hover, .modal-foot .text-btn:hover { color: var(--ink); }

/* ------------------------------------------------------------
   18. 开场弹窗：CSS 像素厂房插画
   ------------------------------------------------------------ */
.intro-modal {
  width: min(600px, calc(100vw - 32px)); max-height: min(92vh, 780px); overflow-y: auto; padding-top: 118px;
  padding-bottom: 20px;
}

/* 插画：黄昏园区 —— 硬边像素块拼出云 / 厂房 / 亮窗 / 光伏阵 / 风机 / 落日 */
.intro-modal::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 112px;
  border-bottom: 2px solid var(--ink); background-color: #1b3134;
  background-image:
    /* 烟囱白烟 */ radial-gradient(circle at 31% 22%, rgba(222, 234, 220, 0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 33% 15%, rgba(222, 234, 220, 0.42) 0 2px, transparent 3px),
    radial-gradient(circle at 35% 20%, rgba(222, 234, 220, 0.3) 0 2px, transparent 3px),
    radial-gradient(circle at 76% 28%, rgba(222, 234, 220, 0.35) 0 2px, transparent 3px),
    /* 星点 */ radial-gradient(circle at 22% 14%, rgba(216, 244, 255, 0.6) 0 1px, transparent 2px),
    radial-gradient(circle at 56% 18%, rgba(216, 244, 255, 0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 34% 9%, rgba(216, 244, 255, 0.45) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 12%, rgba(216, 244, 255, 0.4) 0 1px, transparent 2px),
    /* 像素云 */ linear-gradient(#2c434c, #2c434c), linear-gradient(#2c434c, #2c434c), linear-gradient(#2c434c, #2c434c),
    /* 厂房 B 亮窗 */ repeating-linear-gradient(90deg, #ffcf6a 0 3px, transparent 3px 8px),
    repeating-linear-gradient(90deg, #ffcf6a 0 3px, transparent 3px 8px),
    /* 厂房 D 亮窗 */ repeating-linear-gradient(90deg, #ffcf6a 0 2px, transparent 2px 6px),
    repeating-linear-gradient(90deg, #ffcf6a 0 2px, transparent 2px 6px),
    repeating-linear-gradient(90deg, #ffcf6a 0 2px, transparent 2px 6px),
    /* 厂房 A / E 亮窗 */ repeating-linear-gradient(90deg, #ffcf6a 0 3px, transparent 3px 9px),
    repeating-linear-gradient(90deg, #ffcf6a 0 3px, transparent 3px 8px),
    /* 烟囱 */ linear-gradient(#1c2f27, #1c2f27), linear-gradient(#1c2f27, #1c2f27),
    /* 屋顶 */ linear-gradient(#4d6d55, #3a5743), linear-gradient(#4a6a52, #37533f),
    linear-gradient(#42624b, #34503c), linear-gradient(#4d6d55, #3a5743), linear-gradient(#48684f, #36523e),
    /* 厂房体 */ linear-gradient(180deg, #35553f, #22382c), linear-gradient(180deg, #2b4a38, #1d3127),
    linear-gradient(180deg, #3a5a44, #27402f), linear-gradient(180deg, #2f4c3a, #1f3429),
    linear-gradient(180deg, #2a4634, #1b2f24),
    /* 光伏阵 */ repeating-linear-gradient(90deg, #2f5fa8 0 9px, #1f4278 9px 11px, #9fc7ec 11px 12px),
    repeating-linear-gradient(90deg, #2f5fa8 0 7px, #1f4278 7px 9px, #9fc7ec 9px 10px),
    /* 地面亮边 + 地面 */ linear-gradient(#45664f, #45664f), linear-gradient(#1a2c23, #14211b),
    /* 远山 */ linear-gradient(153deg, transparent 55%, #13231e 55% 100%),
    linear-gradient(333deg, transparent 58%, #101e19 58% 100%),
    /* 地平线暖光 */ linear-gradient(180deg, rgba(242, 181, 68, 0.12), transparent 78%),
    /* 落日 */ radial-gradient(circle at 78% 26%, rgba(255, 196, 90, 0.22) 0 15px, rgba(255, 196, 90, 0.08) 15px 20px, transparent 21px),
    radial-gradient(circle at 78% 26%, #ffe9a8 0 6px, #ffd97a 6px 9px, #f2b544 9px 10px, transparent 11px),
    /* 黄昏天空 */ linear-gradient(180deg, #16262f 0 32%, #1e3a39 32% 62%, #35564a 62% 100%);
  background-repeat: no-repeat;
  background-size:
    100% 100%, 100% 100%, 100% 100%, 100% 100%,
    100% 100%, 100% 100%, 100% 100%, 100% 100%,
    16% 4px, 10% 4px, 14% 3px,
    13% 3px, 13% 3px,
    8% 2px, 8% 2px, 8% 2px,
    9% 2px, 6% 2px,
    2.5% 20px, 2% 22px,
    15% 4px, 17% 4px, 15% 4px, 12% 4px, 13% 4px,
    15% 34px, 17% 46px, 15% 24px, 12% 50px, 13% 32px,
    24% 7px, 18% 5px,
    100% 2px, 100% 18px,
    62% 50%, 58% 46%,
    100% 27px,
    100% 100%, 100% 100%, 100% 100%;
  background-position:
    0 0, 0 0, 0 0, 0 0,
    0 0, 0 0, 0 0, 0 0,
    9% 20px, 12% 16px, 52% 26px,
    23% 56px, 23% 68px,
    60% 52px, 60% 62px, 60% 72px,
    7% 70px, 74% 72px,
    33% 28px, 75% 36px,
    4% 56px, 21% 44px, 41% 66px, 58% 40px, 72% 58px,
    4% 60px, 21% 48px, 41% 70px, 58% 44px, 72% 62px,
    24% 96px, 42% 102px,
    0 92px, 0 100%,
    0 88%, 100% 90%,
    0 62px,
    0 0, 0 0, 0 0;
  box-shadow: inset 0 0 0 2px var(--brass-2), inset 0 0 0 3px #0b1511;
}

/* 插画下沿的小铭牌 */
.intro-modal::after {
  content: "GREEN GRID · 30 DAYS · NO.001"; position: absolute; right: 18px; bottom: 7px; color: #a3947a;
  font-family: var(--font-mono); font-size: 7.5px; letter-spacing: 0.18em; pointer-events: none;
}
.intro-modal .modal-head { padding: 12px 22px 4px; border-bottom: 0; }
.intro-modal .modal-head h2 { font-size: 25px; line-height: 1.25; }
.intro-rules { margin: 4px 20px 0; border-top: 1px dashed var(--line); }
.intro-rules li {
  position: relative; padding: 8px 0 8px 20px; border-bottom: 1px dashed var(--line); color: var(--muted);
  font-size: 11.5px; line-height: 1.65;
}
.intro-rules li::before {
  content: ""; position: absolute; left: 3px; top: 13px; width: 7px; height: 7px; background: var(--solar);
  box-shadow: 2px 2px 0 rgba(201, 138, 32, 0.22);
}
.intro-rules li:nth-child(2)::before { background: var(--grid-2); }
.intro-rules li:nth-child(3)::before { background: var(--pv); }
.intro-rules li:nth-child(4)::before { background: var(--batt); }
.intro-rules li:nth-child(5)::before { background: var(--alarm); }
.intro-rules b {
  display: inline-block; margin-right: 5px; padding: 0 4px; background: rgba(23, 33, 28, 0.06);
  color: var(--ink); font-weight: 800; letter-spacing: 0.08em;
}
.intro-stats {
  margin: 12px 20px 0; padding: 7px 10px; border: 1px solid var(--line-soft);
  border-left: 3px solid var(--brass); background: rgba(255, 255, 255, 0.24); color: #6f6249;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.01em;
}
.intro-modal .action-btn.primary {
  display: flex; width: calc(100% - 40px); min-height: 42px; margin: 14px 20px 0; font-size: 13px;
  letter-spacing: 0.12em;
}

/* ------------------------------------------------------------
   19. 客户名录弹窗 + 数据长表
   ------------------------------------------------------------ */
.clients-modal { display: flex; flex-direction: column; width: min(1000px, 96vw); max-height: min(86vh, 780px); overflow: hidden; }
.clients-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 20px;
  border-bottom: 1px dashed var(--line); background: rgba(255, 255, 255, 0.2);
}
.clients-toolbar .hint { margin: 0; font-size: 9.5px; }
.clients-body { flex: 1; min-height: 0; overflow: auto; padding: 0 0 4px; }
.clients-body:empty::before {
  content: "正在调取园区用电档案…"; display: block; padding: 34px 20px; color: var(--muted);
  font-family: var(--font-serif); font-size: 11px; letter-spacing: 0.1em; text-align: center;
}
.status-pill {
  flex: none; padding: 2px 7px; border: 1px solid var(--grid-2); background: rgba(91, 214, 214, 0.14);
  color: #1f6472; font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.05em;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.data-table th {
  padding: 7px 9px; border-bottom: 2px solid var(--ink); color: #6d624c; font-size: 9px;
  font-weight: 700; letter-spacing: 0.06em; text-align: left; white-space: nowrap;
}
.data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--paper-2); }
.data-table td { padding: 6px 9px; border-bottom: 1px dashed var(--line); vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.38); }
.data-table tbody th { padding: 6px 9px; border-bottom: 1px dashed var(--line); color: #6f6249; font-size: 10px; font-weight: 700; text-align: left; white-space: nowrap; }
/* 日报里的明细表：左边标签、右边 mono 数值 */
.report-body .data-table { margin-top: 10px; }
.report-body .data-table tbody th { width: 42%; background: rgba(255, 255, 255, 0.16); }
.report-body .data-table tbody td { text-align: right; font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.report-body .data-table tbody tr:hover { background: transparent; }
.report-body .data-table tbody tr:nth-child(even) th,
.report-body .data-table tbody tr:nth-child(even) td { background: rgba(201, 162, 74, 0.045); }
.data-table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .dim { color: var(--muted); }
.data-table tr.is-signed { background: rgba(127, 191, 106, 0.09); }
.data-table tr.is-signed td:first-child { box-shadow: inset 3px 0 0 var(--batt-2); }
.data-table tr.is-signed:hover { background: rgba(127, 191, 106, 0.16); }
.data-table tr.is-signed .tag { border-color: var(--batt-2); background: rgba(127, 191, 106, 0.16); color: #3f6b3f; }
.data-table tr.is-idle .tag { border-color: #a99776; background: #e2d3b4; color: #5f563f; }
.data-table tbody tr { cursor: pointer; }
.data-table .tag { vertical-align: middle; }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }

/* ------------------------------------------------------------
   20. 日报弹窗
   ------------------------------------------------------------ */
.report-modal {
  display: flex; flex-direction: column; width: min(620px, calc(100vw - 32px)); max-height: min(90vh, 780px);
  overflow: hidden;
}
.report-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 16px; }
.report-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.report-day { color: #6f6249; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; }
.report-grade {
  display: flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 2px solid var(--stamp); color: var(--stamp); font-family: var(--font-mono); font-size: 20px;
  font-weight: 800; transform: rotate(-6deg); box-shadow: inset 0 0 0 2px rgba(184, 68, 47, 0.14);
}
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 11px; }
.report-stat { min-width: 0; padding: 8px 9px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.26); }
.report-stat i {
  display: block; overflow: hidden; color: #8a7c60; font-style: normal; font-size: 8.5px;
  letter-spacing: 0.06em; text-overflow: ellipsis; white-space: nowrap;
}
.report-stat b {
  display: block; margin-top: 2px; overflow: hidden; color: var(--ink); font-family: var(--font-mono);
  font-size: 15px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; text-overflow: ellipsis;
  white-space: nowrap;
}
.report-stat.is-good b { color: #3f6b3f; }
.report-stat.is-bad b { color: var(--alarm-2); }
.report-note {
  margin-top: 11px; padding: 7px 9px; border-left: 3px solid var(--brass);
  background: rgba(201, 162, 74, 0.08); color: #6f6249; font-size: 10px; line-height: 1.55;
}
#reportBody > .data-table { margin-top: 8px; }

/* ------------------------------------------------------------
   21. 30 天评级弹窗（大印章）
   ------------------------------------------------------------ */
.final-modal {
  display: flex; flex-direction: column; width: min(520px, calc(100vw - 32px)); max-height: min(90vh, 760px);
  overflow: hidden;
}
.final-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 20px; text-align: center; }
.final-grade {
  display: flex; align-items: center; justify-content: center; width: 92px; height: 92px; margin: 0 auto 12px;
  border: 3px solid var(--stamp); color: var(--stamp); font-family: var(--font-mono); font-size: 52px;
  font-weight: 800; line-height: 1; transform: rotate(-5deg);
  box-shadow: inset 0 0 0 3px rgba(184, 68, 47, 0.16),
    5px 5px 0 rgba(23, 33, 28, 0.16);
}
.final-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0; text-align: left; }
.final-stats > div { padding: 7px 8px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.24); }
.final-stats dt { color: #8a7c60; font-size: 8.5px; letter-spacing: 0.04em; }
.final-stats dd {
  margin: 2px 0 0; color: var(--ink); font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  letter-spacing: -0.01em; white-space: nowrap;
}
.final-note {
  margin-top: 12px; color: #6f6249; font-family: var(--font-serif); font-size: 10.5px; line-height: 1.7;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------
   22. 帮助 / 确认弹窗
   ------------------------------------------------------------ */
.help-modal { width: min(620px, calc(100vw - 32px)); max-height: min(90vh, 760px); overflow-y: auto; }
.help-modal .intro-rules li::before { background: var(--grid-2); }
.confirm-modal { width: min(420px, calc(100vw - 32px)); padding: 24px 26px 20px; text-align: center; }
.confirm-stamp {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 auto 12px;
  border: 2px solid var(--stamp); color: var(--stamp); font-family: var(--font-serif); font-size: 20px;
  font-weight: 800; transform: rotate(-6deg); box-shadow: inset 0 0 0 2px rgba(184, 68, 47, 0.15);
}
.confirm-modal h2 { font-size: 20px; }
.confirm-modal p { max-width: 34ch; margin: 8px auto 0; color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.confirm-actions .action-btn { min-height: 38px; }

/* ------------------------------------------------------------
   23. 响应式：1240 / 1180 / 1080 / 980 / 760 / 460
   ------------------------------------------------------------ */
@media (max-width: 1240px) {
  .topbar { gap: 14px; padding-left: 18px; padding-right: 18px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 356px; gap: 14px; padding: 12px 18px 9px; }
  .money-card { min-width: 268px; padding-left: 11px; padding-right: 11px; }
  .money-value { font-size: 27px; }
  .company-name { font-size: 23px; }
  .toast-stack { top: 158px; right: 390px; max-width: 320px; }
  .app-foot { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 1180px) {
  .top-actions { gap: 4px; }
  .icon-btn.label-btn { padding: 0 7px; }
  .money-card { min-width: 246px; }
  .stage-title strong { font-size: 12px; }
  .market-ticker { padding: 2px 7px; }
  .ticker-factor { display: none; }
}
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; }
  .toast-stack { top: 154px; right: 358px; }
  .money-card { min-width: 226px; }
  .money-value { font-size: 25px; }
  .side-head h2 { font-size: 20px; }
  .side-badge { font-size: 8.5px; }
  .speed-btn { min-width: 26px; }
  .clock-chip { padding: 2px 6px; }
  .kpi { padding: 0 8px; }
  .kpi b { font-size: 11px; }
}

/* ---- 单列：侧栏变底部抽屉，页面纵向滚动 ---- */
@media (max-width: 980px) {
  body { overflow-y: auto; }
  .app { height: auto; min-height: 100vh; overflow: visible; }
  .toast-stack { top: auto; bottom: 18px; right: 12px; left: auto; align-items: flex-end; max-width: calc(100vw - 24px); }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .top-right { margin-left: auto; }
  .workspace { display: flex; flex-direction: column; gap: 12px; padding: 12px 13px 10px; }
  .stage-panel { flex: none; min-height: 0; }
  .canvas-wrap { flex: none; height: clamp(320px, 54vh, 560px); min-height: 0; }
  .side-panel { flex: none; max-height: 56vh; border-top: 3px solid var(--brass-2); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3); }
  .side-panel::after {
    content: ""; position: absolute; top: 4px; left: 50%; width: 42px; height: 3px; margin-left: -21px;
    background: rgba(23, 33, 28, 0.22); pointer-events: none;
  }
  .side-scroll { max-height: none; }
  .app-foot { padding-bottom: 14px; }
}

/* ---- 手机：顶栏折行、字号收敛 ---- */
@media (max-width: 760px) {
  body { font-size: 12px; }
  .topbar { align-items: flex-start; gap: 10px; padding: 11px 12px 10px; }
  .brand { gap: 10px; width: 100%; }
  .brand-mark { width: 44px; height: 44px; }
  .brand-eyebrow { font-size: 9px; letter-spacing: 0.1em; }
  .eyebrow-hint { display: none; }
  .company-name { max-width: 62vw; font-size: 20px; }
  .brand-meta { font-size: 9.5px; gap: 5px; }
  .top-right { width: 100%; gap: 8px; align-items: stretch; flex-wrap: wrap; }
  .money-card { flex: 1 1 240px; min-width: 0; padding: 6px 10px 7px; }
  .money-label { font-size: 9px; letter-spacing: 0.14em; }
  .money-no { display: none; }
  .money-value { font-size: 25px; }
  .money-foot { font-size: 9px; gap: 6px; }
  .top-actions { flex-wrap: wrap; align-content: center; justify-content: flex-end; gap: 5px; flex: none; margin-left: auto; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn.label-btn { height: 34px; padding: 0 6px; font-size: 9.5px; }
  .icon-btn.label-btn .icon { width: 13px; height: 13px; }
  .workspace { padding: 10px 12px 8px; gap: 10px; }
  .stage-head { flex-wrap: wrap; gap: 5px; padding: 6px 10px; }
  .stage-title { width: 100%; }
  .stage-head-right { width: 100%; flex-wrap: wrap; gap: 6px; }
  .market-ticker { order: 1; flex: 1; }
  .clock-chip { order: 2; }
  .speed-group { order: 3; margin-left: auto; }
  .stage-sub { display: none; }
  .canvas-wrap { height: clamp(300px, 50vh, 460px); padding: 9px 12px 9px; }
  .weather-badge { top: 8px; left: 8px; padding: 3px 7px; font-size: 9px; }
  .select-card { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .sc-pv-state { margin-top: 5px; padding: 3px 6px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .scene-hint { top: 8px; bottom: auto; max-width: 92%; font-size: 9.5px; padding: 3px 8px; }
  .weather-badge { display: none; }
  .stage-foot { flex-wrap: wrap; gap: 6px; padding: 6px 9px; }
  .kpi-strip {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; width: 100%; background: #24382d;
    border: 1px solid #24382d;
  }
  .kpi { padding: 4px 6px; border-right: 0; background: #0f1e18; }
  .kpi i { font-size: 8px; letter-spacing: 0.06em; }
  .kpi b { font-size: 10.5px; }
  .stage-foot-right { width: 100%; justify-content: space-between; }
  .side-panel { max-height: 54vh; }
  .side-head { padding: 10px 12px 7px 18px; }
  .side-head h2 { font-size: 19px; }
  .side-tabs { padding: 0 9px 0 16px; gap: 3px; }
  .side-tab { padding: 5px 3px; font-size: 10.5px; }
  .side-tab.is-active { padding-bottom: 8px; }
  .tab-panel { padding: 9px 11px 14px 18px; }
  .client-card { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 7px; padding: 6px 4px 6px 8px; }
  .cc-avatar { width: 48px; height: 48px; }
  .cc-avatar canvas { width: 40px; height: 40px; }
  .client-stats { font-size: 9.5px; }
  .app-foot { padding: 0 12px 12px; gap: 6px; font-size: 9px; line-height: 1.5; }
  .app-foot span:nth-child(4), .app-foot span:nth-child(5) { display: none; }
  .modal-layer { padding: 10px; }
  .modal-head { padding: 12px 13px 9px; }
  .modal-head h2 { font-size: 20px; }
  .modal { box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.44); }
  .intro-modal { width: 100%; padding-top: 118px; padding-bottom: 15px; }
  .intro-modal .modal-head { padding: 10px 13px 2px; }
  .intro-modal .modal-head h2 { font-size: 20px; }
  .intro-rules { margin: 2px 13px 0; }
  .intro-rules li { padding: 7px 0 7px 18px; font-size: 11px; }
  .intro-stats { margin: 9px 13px 0; font-size: 9.5px; }
  .intro-modal .action-btn.primary { width: calc(100% - 26px); margin: 11px 13px 0; min-height: 40px; font-size: 12px; }
  .clients-modal, .report-modal, .final-modal, .help-modal { width: 100%; }
  .clients-modal { max-height: 92vh; }
  .clients-toolbar { padding: 6px 13px; }
  .data-table { min-width: 560px; }
  .data-table th:first-child, .data-table td:first-child { padding-left: 13px; }
  .data-table th:last-child, .data-table td:last-child { padding-right: 13px; }
  .report-body { padding: 11px 13px 13px; }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-stat b { font-size: 13px; }
  .final-body { padding: 14px 15px 16px; }
  .final-grade { width: 76px; height: 76px; font-size: 42px; }
  .final-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-foot { padding: 8px 13px; font-size: 9px; }
  .confirm-modal { padding: 20px 18px 16px; }
  .toast-stack { bottom: 12px; right: 10px; max-width: calc(100vw - 20px); }
  .toast { font-size: 10.5px; padding: 6px 10px; }
}

/* ---- 430 宽：紧凑排版，无横向溢出 ---- */
@media (max-width: 460px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .company-name { font-size: 18px; max-width: 56vw; }
  .top-right { flex-wrap: wrap; }
  .money-card { flex: 1 1 100%; }
  .top-actions { width: 100%; justify-content: space-between; }
  .icon-btn { width: 36px; height: 34px; }
  .icon-btn.label-btn { flex: 1; justify-content: center; }
  .workspace { padding-left: 10px; padding-right: 10px; }
  .canvas-wrap { height: clamp(280px, 46vh, 380px); padding: 9px 12px 9px; }
  .scene-hint { font-size: 9px; padding: 3px 6px; }
  .select-card { width: auto; padding: 8px 9px 9px; }
  .sc-avatar { width: 52px; height: 52px; }
  .sc-avatar canvas { width: 44px; height: 44px; }
  .sc-head h3 { font-size: 12.5px; }
  .sc-pv-state { display: none; }
  .sc-stats { margin-top: 6px; padding-top: 5px; }
  .select-card .cta-btn { min-height: 30px; margin-top: 6px; font-size: 10px; }
  .sc-stats dd { font-size: 9.5px; }
  .market-ticker { padding: 2px 6px; }
  .ticker-label { display: none; }
  #tickerPrice { font-size: 12.5px; }
  .clock-chip { font-size: 9px; }
  #clockText { font-size: 10px; }
  .speed-btn { min-width: 24px; height: 22px; font-size: 9px; }
  .speed-btn.pause-btn { width: 24px; }
  .kpi i { font-size: 7.5px; }
  .kpi b { font-size: 10px; }
  .side-head h2 { font-size: 18px; }
  .side-badge { font-size: 8px; padding: 1px 5px; }
  .side-tab { font-size: 10px; letter-spacing: 0; }
  .tab-panel { padding: 8px 9px 12px 16px; }
  .client-card { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .cc-avatar { width: 48px; height: 48px; }
  .cc-avatar canvas { width: 40px; height: 40px; }
  .cc-status { font-size: 8px; padding: 0 4px; }
  .range-head b { font-size: 13.5px; }
  .price-preview { font-size: 9px; }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .report-stat b { font-size: 12px; }
  .final-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .final-grade { width: 68px; height: 68px; font-size: 36px; }
  .clients-toolbar .hint { font-size: 9px; }
  .data-table { min-width: 520px; font-size: 10px; }
  .modal-head h2 { font-size: 18px; }
  .confirm-modal h2 { font-size: 17px; }
  .intro-modal .modal-head h2 { font-size: 18px; }
  .toast { max-width: calc(100vw - 20px); }
}

/* ------------------------------------------------------------
   24. 降低动效偏好
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}

/* Hourly tariff chart */
.tou-frame {
  container-type: inline-size;
  padding: 9px 8px 5px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #f6ecd8, #eee1c5);
}
.tou-current { margin: 0 0 12px; color: #283b30; font: 600 12px/1.4 var(--font-mono); }
#touChart {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  margin: 0; padding: 0; list-style: none;
}
#touChart::before {
  content: ''; position: absolute; z-index: -1; inset: 0 0 18px;
  background: repeating-linear-gradient(to top, #5a59461a 0 1px, transparent 1px 25%);
}
#touChart li {
  display: grid; grid-template-rows: clamp(76px, 19cqw, 138px) 18px;
  min-width: 0; text-align: center;
}
.tou-bar {
  align-self: end; margin-inline: 1px; border-radius: 2px 2px 0 0;
  background-image: linear-gradient(to top, #fff2, transparent);
}
.tou-bar.peak { background-color: #ce6a89; }
.tou-bar.flat { background-color: #bd984b; }
.tou-bar.valley { background-color: #69af94; }
.tou-tick {
  padding-top: 4px; border-top: 1px solid #a99a7c; white-space: nowrap;
  color: #4d4436; font: clamp(8px, 2.85cqw, 10px)/1.15 Arial, sans-serif; font-variant-numeric: tabular-nums;
}
#touChart li[aria-current=time] .tou-bar {
  position: relative; background-color: #28776b;
  box-shadow: inset 0 1px 0 #164e46;
}
#touChart li[aria-current=time] .tou-bar::before {
  content: ''; position: absolute; width: 7px; height: 7px;
  left: var(--hour-progress, 50%); top: 0; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid #235c51;
  background: radial-gradient(circle at 33% 29%, #fffdf1 10%, #ffdd85 49%, #d29a3a 100%);
  box-shadow: 0 0 0 2px #fff7d799, 0 1px 4px #164b434a;
  transition: left 160ms linear;
}
#touChart li[aria-current=time] .tou-tick { color: #144f45; font-weight: 700; border-top: 2px solid #28776b; padding-top: 3px; }

.money-pair { display:flex; gap:8px; align-items:stretch; min-width:0; }
.account-qr { flex:0 0 var(--card-height,72px); position:relative; padding:0; background:white; border:0; cursor:zoom-in; }
.account-qr img { position:absolute; inset:0; width:100%; height:100%; padding:9%; box-sizing:border-box; object-fit:contain; image-rendering:pixelated; }
.account-qr:focus-visible { outline:2px solid #f4c666; outline-offset:2px; }
#wechat-qr { position:fixed; inset:0; margin:auto; width:min(286px,90vw); height:fit-content; padding:12px; border:2px solid #283e31; background:white; color:#1c3025; }
#wechat-qr::backdrop { background:#09150cc4; }
#wechat-qr div { display:flex; align-items:center; justify-content:space-between; }
#wechat-qr button { padding:5px 8px; cursor:pointer; }
#wechat-qr img { display:block; width:100%; height:auto; padding:18px; box-sizing:border-box; image-rendering:pixelated; }
@media (max-width:760px) { .money-pair { flex:1 1 300px; } }

#btnTheme { anchor-name: --theme-trigger; }
#themePicker {
  position:fixed; position-anchor:--theme-trigger; inset:auto 12px auto auto;
  top:84px; top:anchor(bottom,84px); margin:6px 0 0; width:196px; max-width:calc(100vw - 24px);
  padding:12px; background:var(--paper); color:var(--ink); border:2px solid var(--ink); box-shadow:var(--shadow-hard);
}
#themeHeading { display:block; margin-bottom:6px; }
.theme-options { display:grid; gap:5px; }
.theme-options button { display:flex; align-items:center; gap:9px; padding:7px 9px; background:var(--paper-2); border:1px solid var(--line); text-align:left; }
.theme-options button[aria-pressed=true] { border-color:var(--ink); font-weight:700; }
.theme-options button[aria-pressed=true]::after { content:'✓'; margin-left:auto; }
.theme-options i { width:24px; height:17px; border:1px solid #0004; background:linear-gradient(120deg,#1b3728 65%,#ddc99e 65%); }
.theme-options [data-choice=bay] i { background:linear-gradient(120deg,#173e63 65%,#c1e4f6 65%); }
.theme-options [data-choice=amber] i { background:linear-gradient(120deg,#513039 65%,#f2ca95 65%); }
:root[data-theme=bay] { --shell:#0e2a44; --shell-mid:#1b425e; --shell-edge:#466c80; --paper:#f0f7fd; --paper-2:#dcecf7; --paper-3:#c0dcea; --line:#9cb9ce; --pine-3:#24465e; }
:root[data-theme=amber] { --shell:#302028; --shell-mid:#54343b; --shell-edge:#806054; --paper:#fff0db; --paper-2:#f2dfc3; --paper-3:#e4c8a3; --line:#c6a98c; --pine-3:#543b3e; }
:root:is([data-theme=bay],[data-theme=amber]) body,
:root:is([data-theme=bay],[data-theme=amber]) .canvas-wrap { background-color:var(--shell); }
:root:is([data-theme=bay],[data-theme=amber]) :is(.topbar,.stage-head,.stage-foot,.stage-panel,.app-foot) {
  background-color:var(--shell-mid); background-image:linear-gradient(105deg,var(--shell-mid),var(--shell)); border-color:var(--shell-edge);
}
:root:is([data-theme=bay],[data-theme=amber]) :is(.icon-btn,.money-card) { background-color:var(--shell-mid); }
