:root {
  color-scheme: dark;              /* 原生控件（滚动条/日期选择器/下拉）跟随深色 */
  --bg: #0f1419;
  --surface: #18202b;
  --surface-2: #1f2937;
  --surface-3: #283447;
  --border: #2b3850;
  --text: #e6edf3;
  --text-dim: #93a1b5;
  --text-mute: #64748b;
  --primary: #34d399;
  --primary-dim: #10b981;
  --accent: #fbbf24;
  --danger: #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --on-primary: #04130c;              /* 主色底上的文字色：深色主题主色为亮绿 → 用深字 */
  --on-primary-2: #06281c;            /* 同上（渐变主色按钮场景） */
  --tint-1: rgba(255,255,255,.02);    /* 行/面板的极淡提亮叠加 */
  --tint-2: rgba(255,255,255,.04);    /* 悬停/次级提亮叠加 */
  --tint-3: rgba(255,255,255,.07);    /* 分隔线级提亮 */
  --sheen: rgba(255,255,255,.35);     /* 进度条/图表渐变的高光末端 */
  --scrim: rgba(3,8,20,.72);          /* 遮罩层 */
  /* 图表专用令牌（charts.js 以 var() 直接写入 SVG，主题切换即时生效、无需重绘） */
  --chart-grid: #253247;              /* 网格线 */
  --chart-axis: #3a4a63;              /* 坐标轴 */
  --chart-c-this: #00d4ff;            /* 系列：今年实际 */
  --chart-c-forecast: #ffbf00;        /* 系列：今年预测 */
  --chart-c-last: #5b8def;            /* 系列：去年实际 */
  --chart-c-hl: #00ff88;              /* 系列：高亮/当月 */
  --tip-bg: rgba(11,19,43,.92);       /* 图表浮层提示底色 */
  --tip-border: rgba(255,255,255,.12);
  --tip-shadow: 0 8px 24px rgba(0,0,0,.4);

  /* 弹窗/编辑器组件所用别名变量（映射到上面的设计令牌） */
  --bg-card: var(--surface);          /* #18202b 卡片/弹窗底色 */
  --bg-subtle: var(--surface-2);      /* #1f2937 次级微妙背景 */
  --border-subtle: rgba(255,255,255,.07); /* 比 --border 更淡的分隔线 */
  --text-secondary: var(--text-dim);  /* #93a1b5 次级文字 */
  --text-muted: var(--text-mute);     /* #64748b 弱化文字 */

  /* 别名/历史遗留变量：把 JS 内联 var(--xxx) 引用统一收敛到上面的设计令牌。
     此前这些名字未定义、取值落空（深色下靠继承兜底），现补全以便主题整体切换。 */
  --text2: var(--text-dim);
  --text-2: var(--text-dim);
  --text-primary: var(--text);
  --c-text: var(--text);
  --c-muted: var(--text-dim);
  --muted: var(--text-mute);
  --color-text-secondary: var(--text-dim);
  --color-text-tertiary: var(--text-mute);
  --bg1: var(--surface-2);
  --bg2: var(--surface);
  --c-bg-2: var(--surface-2);
  --color-bg-secondary: var(--surface-2);
  --color-background-secondary: var(--surface-2);
  --border-color: var(--border);
  --border-light: var(--border);
  --color-border-tertiary: var(--border-subtle);
  --line: var(--border);
  --panel-2: var(--surface-3);
  --surface-hover: var(--tint-2);
  --surface-1: var(--tint-1);
  --text-soft: #c9d1d9;
  --border-soft: rgba(42,47,58,.5);
  --color-primary: var(--primary);
  --c-info: var(--info);
  --brand: var(--primary);
  --success: var(--primary);
  --err: var(--danger);
}

/* ===== 浅色主题（明暗双主题：由 html[data-theme] 切换，见 app.js getTheme/setTheme） =====
   设计取向「晨光纸感」：底色为带绿灰倾向的纸感浅色（非纯白），卡片纯白形成层次，
   主色由深色模式的高明度绿压深到 0e8f5c 以保证白底上的对比度 ≥4.5:1。 */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #e9eeea;
  --surface-3: #dde5df;
  --border: #ccd8d1;
  --text: #10231a;
  --text-dim: #4a5f55;
  --text-mute: #7a8c82;
  --primary: #0e8f5c;
  --primary-dim: #0a7550;
  --accent: #b45309;
  --danger: #c62828;
  --warn: #b45309;
  --info: #1a6fd4;
  --shadow: 0 8px 24px rgba(16, 40, 30, .10);
  --border-subtle: rgba(16, 40, 30, .08);
  --on-primary: #ffffff;              /* 浅色主题主色已压深 → 主色底上用白字 */
  --on-primary-2: #ffffff;
  --tint-1: rgba(16,40,30,.025);      /* 深色底改为深墨叠加，浅底上才看得见 */
  --tint-2: rgba(16,40,30,.055);
  --tint-3: rgba(16,40,30,.10);
  --sheen: rgba(16,40,30,.22);
  /* 图表令牌：浅底上把网格提亮、把霓虹系列色压深，保证可读性 */
  --chart-grid: #dfe7e1;
  --chart-axis: #b9c7be;
  --chart-c-this: #0b7fa8;
  --chart-c-forecast: #b45309;
  --chart-c-last: #3b6fc4;
  --chart-c-hl: #0d9463;
  --tip-bg: rgba(255,255,255,.98);
  --tip-border: rgba(16,40,30,.14);
  --tip-shadow: 0 8px 24px rgba(16,40,30,.16);
  --text-soft: var(--text-dim);
  --border-soft: rgba(16,40,30,.12);
  --scrim: rgba(20,35,28,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; }

/* 全局错误横幅（启动自检 / 运行时报错提示） */
.global-error {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #b91c1c; color: #fff; padding: 12px 16px;
  font-size: 13px; line-height: 1.55; white-space: pre-wrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
  border-bottom: 2px solid #fca5a5;
}

/* v1.12.81：暂时不计划按电站维度展示数据看板，隐藏顶部自检条与电站选择 toolbar（保留 DOM 与 JS 调用以便恢复） */
.dash-toolbar, .selfcheck { display: none !important; }

/* 看板系统自检条 */
.selfcheck {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.selfcheck .sc-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; color: var(--text-dim);
}
.selfcheck .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-mute); }
.selfcheck .dot.ok { background: var(--primary); }
.selfcheck .dot.err { background: var(--danger); }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录页（v1.14.6 分栏式 · 光伏板阵列背景） ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: stretch;
  background: #070b12; position: relative;
}
.login-pv { /* 左栏：光伏板阵列图形 */
  flex: 1.35; position: relative; overflow: hidden; min-width: 0;
}
.login-pv .pv-brand { position: absolute; left: 28px; bottom: 24px; z-index: 2; }
.login-pv .pv-brand h1 { font-size: 19px; font-weight: 700; color: #e2e8f0; margin: 0; letter-spacing: .04em; }
.login-pv .pv-brand p { font-size: 11px; color: #64748b; letter-spacing: .22em; margin: 5px 0 0; text-transform: uppercase; }
.login-panel { /* 右栏：登录卡片容器 */
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 36px 28px; background: rgba(10,15,24,.55);
}
.login-card {
  width: 100%; max-width: 320px;
  background: rgba(24,32,43,.74); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(52,211,153,.26); border-radius: 18px;
  padding: 30px 26px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: loginIn .5s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes loginIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-logo .pv-mark { /* 光伏板小图标（替代太阳） */
  width: 30px; height: 22px; flex-shrink: 0; border: 1.5px solid var(--primary); border-radius: 3px; position: relative;
}
.login-logo .pv-mark::before,
.login-logo .pv-mark::after { content: ''; position: absolute; left: 3px; right: 3px; height: 1px; background: var(--primary); opacity: .55; }
.login-logo .pv-mark::before { top: 6px; } .login-logo .pv-mark::after { top: 12px; }
.login-logo h1 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
.login-card .field { display: block; margin-bottom: 13px; }
.login-card .field span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.login-card .field input {
  width: 100%; box-sizing: border-box; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; font-size: 14px;
  transition: border-color .18s, box-shadow .18s;
}
.login-card .field input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52,211,153,.18);
}
.login-card form .btn {
  width: 100%; margin-top: 6px; border-radius: 9px; padding: 12px; font-size: 15px; font-weight: 600;
  background: linear-gradient(135deg, #34d399, #10b981); color: var(--on-primary-2); border: none; cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.login-card form .btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,185,129,.35); filter: brightness(1.06); }
.login-card form .btn:disabled { opacity: .65; cursor: not-allowed; }
/* 密码规则动态校验指示条 */
.pwd-rule { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-mute); }
.pwd-rule .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: background .15s; }
.pwd-rule.ok { color: var(--primary); }
.pwd-rule.ok .dot { background: var(--primary); box-shadow: 0 0 6px rgba(52,211,153,.5); }
.pwd-rule.bad { color: #f87171; }
.pwd-rule.bad .dot { background: #f87171; }
@media (max-width: 720px) {
  .login-pv { display: none; }           /* 移动端隐藏图形栏，卡片单列 */
  .login-panel { padding: 22px 16px; }
  .login-card { padding: 26px 20px 22px; border-radius: 16px; }
  .login-card .field input { font-size: 16px; padding: 12px 14px; height: auto; }
  .login-card form .btn { padding: 13px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .login-card { animation: none; } }

}

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
  transition: transform .25s ease;
}
.sidebar .brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.sidebar .brand .sun { width: 30px; height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 6px; filter: drop-shadow(0 0 6px rgba(52,211,153,.4)); }
.sidebar .brand .sun svg { display: block; }
.sidebar .brand b { font-size: 15px; }
.sidebar .brand small { display: block; color: var(--text-dim); font-size: 11px; }
.nav { padding: 10px; flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 100px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: var(--text-dim); font-size: 14px; margin-bottom: 4px; transition: .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(52,211,153,.18), transparent); color: var(--primary); font-weight: 600; }
.nav a .ico { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }

/* ---- 父子级菜单 ---- */
.nav .nav-parent { margin-bottom: 4px; }
.nav .nav-parent-label {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: var(--text-dim); font-size: 14px; cursor: pointer; transition: .15s;
  user-select: none;
}
.nav .nav-parent-label:hover { background: var(--surface-2); color: var(--text); }
.nav .nav-parent-label.active {
  background: linear-gradient(90deg, rgba(52,211,153,.12), transparent); color: var(--primary); font-weight: 600;
}
.nav .nav-arrow {
  margin-left: auto; font-size: 10px; transition: transform .2s;
  display: inline-block; width: 12px; text-align: center;
}
.nav .nav-parent.open > .nav-parent-label .nav-arrow { transform: rotate(90deg); }

.nav .nav-children {
  max-height: 0; overflow: hidden; transition: max-height .25s ease;
  padding-left: 16px; margin-left: 8px; border-left: 2px solid var(--border);
}
.nav .nav-parent.open > .nav-children { max-height: 500px; } /* 容纳系统设置等含10+子项的菜单 */
.nav .nav-children a {
  padding: 7px 12px 7px 10px; font-size: 13px; margin-bottom: 2px;
  display: flex; align-items: center; gap: 6px;
}

.sidebar .foot { padding: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-mute); flex-shrink: 0; background: var(--surface); }

.main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px; position: sticky; top: 0; z-index: 20;
}
.topbar .left { display: flex; align-items: center; gap: 12px; }
.topbar .menu-btn { display: none; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 16px; }
.topbar .title { font-size: 15px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 10px; color: var(--text-dim); }
.topbar .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; transition: background .2s, box-shadow .2s; }
.topbar .avatar:hover { background: var(--surface-2); box-shadow: 0 0 0 3px rgba(99,179,237,.15); }

/* 头像下拉菜单 */
.topbar .user { position: relative; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 160px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 0; z-index: 200;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
  box-shadow: 0 6px 20px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.12);
}
.user-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.user-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; color: var(--text); text-decoration: none;
  font-size: 13px; line-height: 1.3; cursor: pointer;
  transition: background .15s;
}
.user-menu a:hover { background: rgba(99,179,237,.08); color: var(--primary); }
.user-menu a svg { flex-shrink: 0; opacity: .65; }
.user-menu a:hover svg { opacity: 1; }
.content { padding: 20px; flex: 1; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; }
.overlay.show { display: block; }

/* ---------- 卡片/网格 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card .k { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }
.card .v { font-size: 26px; font-weight: 700; }
.card .v small { font-size: 13px; color: var(--text-dim); font-weight: 400; margin-left: 4px; }
.card .sub { margin-top: 6px; font-size: 12px; color: var(--text-mute); }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.panel h3 .actions { display: flex; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 表单/控件 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 14px; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 90px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.row-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.btn {
  background: var(--primary-dim); color: var(--on-primary); border: none; border-radius: 9px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--primary); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(248,113,113,.12); }
.btn.warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.btn.warn:hover { background: rgba(251,191,36,.12); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-dim); }
a.link { color: var(--primary, #3b82f6); text-decoration: none; cursor: pointer; }
a.link:hover { text-decoration: underline; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-dim); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
/* 可点击排序列头 */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: var(--surface-3, #eef2f7); color: var(--text); }
th .sort-ind { display: inline-block; margin-left: 3px; font-size: 10px; line-height: 1; color: var(--accent, #2563eb); font-weight: 700; }
/* v1.9.17：电费账单列表表头居中显示（不动 <td>，仅表头） */
.bills-table th { text-align: center; }
/* 表格加载遮罩：切换每页条数/翻页时避免闪烁 */
.table-wrap { position: relative; }
.table-wrap.loading::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(15,20,27,.55);
  backdrop-filter: blur(1px);
  display: flex; align-items: center; justify-content: center;
}
.table-wrap.loading::before {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgba(52,211,153,.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: tb-spin .8s linear infinite;
  z-index: 2;
}
@keyframes tb-spin { to { transform: rotate(360deg); } }
tbody tr:hover { background: var(--surface-2); }
tbody tr.ar-total-row { background: rgba(52,211,153,.08); font-weight: 600; }
tbody tr.ar-total-row:hover { background: rgba(52,211,153,.14); }
tbody tr.ar-total-row td { color: var(--text); border-top: 2px solid var(--primary-dim); }
td .ops { display: flex; gap: 6px; align-items: center; }
/* 抄表记录管理：每块电表仅末条可编辑，轻微高亮 */
.row-latest { background: rgba(96,165,250,.06); }
.row-latest:hover { background: rgba(96,165,250,.12); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.up { background: rgba(52,211,153,.16); color: var(--primary); }
.badge.down { background: rgba(248,113,113,.16); color: var(--danger); }
.badge.warn { background: rgba(251,191,36,.16); color: var(--warn); }
.badge.info { background: rgba(96,165,250,.16); color: var(--info); }
.badge.manual { background: rgba(52,211,153,.16); color: var(--primary); }
.badge.ai { background: rgba(167,139,250,.16); color: #a78bfa; }
/* 抄表模块 - 电表类型 */
.badge.gen { background: rgba(52,211,153,.16); color: var(--primary); }
.badge.grid { background: rgba(96,165,250,.16); color: var(--info); }
.badge.self { background: rgba(251,191,36,.16); color: var(--warn); }
.badge.park { background: rgba(167,139,250,.16); color: #a78bfa; }
/* 计费规则编辑器：变量 chip（中文名 + 占位符） */
.var-chips { display: flex; gap: 5px; flex-wrap: wrap; margin: 4px 0 8px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.var-chips.collapsed { display: none; }
.badge.manual.var-chip { display: inline-flex; align-items: center; gap: 0; padding: 0; font-size: 11.5px; line-height: 1.4; border: 1px solid rgba(96,165,250,.35); background: rgba(96,165,250,.12); color: #93c5fd; border-radius: 6px; cursor: pointer; transition: background .15s, transform .15s, box-shadow .15s; overflow: hidden; }
.badge.manual.var-chip:hover { background: rgba(96,165,250,.22); transform: translateY(-1px); box-shadow: 0 2px 6px rgba(96,165,250,.15); }
.badge.manual.var-chip .vc-zh { padding: 3px 8px; font-weight: 600; color: #e2e8f0; }
.badge.manual.var-chip .vc-en { padding: 3px 8px 3px 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: #93c5fd; background: rgba(96,165,250,.18); border-left: 1px solid rgba(96,165,250,.35); }
/* 计费规则科目 tab 选中态 */
#btCats > .btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 600; }
#btCats > .btn.sm { padding: 4px 12px; font-size: 12.5px; }
#btChipsToggle.active { background: rgba(96,165,250,.18); border-color: rgba(96,165,250,.45); color: #93c5fd; }
/* 计费规则编辑表格（紧凑布局） */
.bt-rules-table { min-width: 720px; font-size: 12.5px; }
.bt-rules-table > thead th { font-weight: 600; color: var(--text-dim); background: var(--surface-2); white-space: nowrap; padding: 8px 8px; }
.bt-rules-table > tbody td { padding: 6px 8px; vertical-align: middle; white-space: nowrap; }
.bt-rules-table .bt-in { font-size: 12.5px; padding: 4px 6px; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; }
.bt-rules-table .bt-in:focus { outline: none; border-color: var(--primary); }
.bt-rules-table .bt-in.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
.bt-rules-table .bt-cell-name { width: 110px; }
.bt-rules-table .bt-cell-label { width: 110px; }
.bt-rules-table .bt-cell-type { width: 56px; }
.bt-rules-table .bt-cell-mode { width: 92px; }
.bt-rules-table .bt-cell-toggle { width: 30px; text-align: center; padding: 6px 4px; }
.bt-rules-table .bt-cell-unit { width: 64px; }
.bt-rules-table .bt-cell-bool { width: 36px; text-align: center; }
.bt-rules-table .bt-cell-order { width: 56px; }
.bt-rules-table .bt-cell-del { width: 32px; text-align: center; }
/* v1.9.5：行下「取值配置」子面板 */
.bt-rules-table .bt-toggle { width: 22px; height: 22px; line-height: 1; padding: 0; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); border-radius: 6px; cursor: pointer; font-size: 12px; transition: .15s; }
.bt-rules-table .bt-toggle:hover { color: var(--text); border-color: var(--primary); }
.bt-rules-table .bt-toggle.open { color: var(--primary); border-color: var(--primary); background: rgba(52,211,153,.12); }
.bt-rules-table tr.bt-row-panel > td.bt-panel-cell { padding: 0; background: var(--tint-1); border-top: 0; }
.bt-rules-table tr.bt-optional + tr.bt-row-panel > td.bt-panel-cell { opacity: 0.42; }
.bt-rules-table tr.bt-optional + tr.bt-row-panel:hover > td.bt-panel-cell { opacity: 0.78; }
.bt-rules-table .bt-src-panel { padding: 10px 12px 12px 42px; border-top: 1px dashed var(--border); }
.bt-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bt-panel-mode { font-weight: 600; color: var(--text); font-size: 12.5px; }
.bt-panel-hint { font-size: 12px; color: var(--text-dim); }
.bt-panel-block { display: flex; flex-direction: column; gap: 8px; }
.bt-panel-line { display: flex; gap: 8px; align-items: center; }
.bt-panel-line > .bt-in { flex: 1 1 auto; min-width: 0; }
.bt-panel-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 8px; }
.bt-panel-field { display: flex; flex-direction: column; gap: 4px; }
.bt-panel-field > .bt-in { width: 100%; }
.bt-pf-label { font-size: 11.5px; color: var(--text-dim); font-weight: 500; }
.bt-pf-label small { color: var(--text-dim); opacity: .7; font-weight: 400; }
.bt-panel-note { font-size: 12.5px; color: var(--text-dim); padding: 4px 0; }
.bt-panel-chips-toggle { flex: 0 0 auto; }
.bt-rules-table tr.bt-optional { opacity: 0.42; }
.bt-rules-table tr.bt-optional:hover { opacity: 0.78; }
.bt-rules-table tr.bt-optional td { background: var(--tint-1); }
.bt-rules-table .bt-optional-tag { display: inline-block; font-size: 10.5px; line-height: 1; padding: 2px 6px; margin-left: 4px; border-radius: 4px; background: rgba(167,139,250,.18); color: #a78bfa; font-weight: 500; vertical-align: middle; }

/* ---------- 工具栏/分页 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--text-dim); }
.pager b { color: var(--text); font-weight: 600; margin: 0 3px; }

/* ---------- 报表查询：日/月/年 模式切换 ---------- */
.rep-tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 8px; border: 1px solid var(--border); }
.rep-tab { border: 0; background: transparent; color: var(--text-dim); padding: 6px 18px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: .15s; }
.rep-tab:hover { color: var(--text); }
.rep-tab.active { background: var(--primary); color: var(--on-primary); font-weight: 600; }

/* ---------- 报表查询：顶部图表条（一行紧凑布局） ---------- */
.rep-charts { display: flex; gap: 10px; align-items: stretch; margin-bottom: 14px; flex-wrap: wrap; }
.rep-chart-card { flex: 1 1 0; min-width: 180px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; display: flex; flex-direction: column; }
.rep-chart-card.wide { min-width: 200px; }   /* 辐照量合计：title + legend 单行显示 */
.rep-chart-card.weather { flex: 0 0 280px; min-width: 280px; }   /* 天气对比柱状图卡片：图表固定 240px，卡片固定 280px 不拉伸 */
/* 标题与图例同行：标题在左、去年/今年图例在右 */
.rep-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.rep-chart-head .rep-bar-legend { display: flex; gap: 8px; font-size: 11px; color: var(--text-dim); flex-wrap: wrap; white-space: nowrap; }
.rep-chart-head .rep-bar-legend span { display: inline-flex; align-items: center; gap: 4px; }
.rep-chart-card .rep-bar-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.rep-chart-card .rep-chart-body { display: flex; align-items: center; justify-content: center; }
.rep-chart-svg.bar { width: 100%; max-width: 240px; height: auto; display: block; }
.rep-chart-title { font-size: 12px; color: var(--text-dim); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-chart-body { display: flex; align-items: center; gap: 10px; }
.rep-chart-svg { flex: 0 0 auto; }
.rep-legend { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--text-dim); }
.rep-legend .lg-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.rep-legend .lg-dot { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.rep-legend .lg-val { color: var(--text); font-weight: 600; margin-left: auto; padding-left: 6px; }
.rep-summary { flex: 1 1 auto; display: flex; gap: 10px; min-width: 0; }
.rep-sum-card { flex: 1 1 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; min-height: 150px; }
.rep-sum-card .sc-label { font-size: 13px; color: var(--text-dim); margin-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-sum-card .sc-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.rep-sum-card .sc-unit { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.rep-sum-card.gen .sc-value { color: var(--primary); }
.rep-sum-card.grid .sc-value { color: #57b894; }
.rep-sum-card.park .sc-value { color: #b07ee0; }
.rep-sum-card.irr .sc-value { color: #4a90d9; }   /* 辐照量合计：蓝紫，区分电量卡 */
.rep-sum-card .sc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; min-width: 0; }
.rep-sum-card .sc-last { font-size: 12px; color: var(--text-dim); margin-top: auto; padding-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-sum-card .sc-last b { color: var(--text); font-weight: 600; }
.rep-sum-card .sc-bar { margin-top: 6px; }
.rep-sum-card .sc-bar-track { height: 5px; background: rgba(128,138,158,0.18); border-radius: 3px; overflow: hidden; }
.rep-sum-card .sc-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.rep-sum-card.gen .sc-bar-fill { background: linear-gradient(90deg, #4a90d9, var(--primary)); }
.rep-sum-card.grid .sc-bar-fill { background: linear-gradient(90deg, #4a90d9, #57b894); }
.rep-sum-card.park .sc-bar-fill { background: linear-gradient(90deg, #4a90d9, #b07ee0); }
.rep-sum-card.irr .sc-bar-fill { background: linear-gradient(90deg, #4a90d9, #6f9ad9); }
.sc-badge { flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; line-height: 1.5; white-space: nowrap; }
.sc-badge.up { color: #1f9d5b; background: rgba(31,157,91,.12); }
.sc-badge.down { color: #d64545; background: rgba(214,69,69,.12); }
.sc-badge.flat { color: var(--text-dim); background: rgba(128,128,128,.10); border: 1px solid var(--border); }
/* 月模式同比对比柱状图：满宽一行 */
.rep-chart-card.rep-month-compare,
.rep-chart-card.rep-period-compare { flex: 1 1 100%; min-width: 0; }
.rep-chart-card.rep-month-compare .rep-chart-body,
.rep-chart-card.rep-period-compare .rep-chart-body { display: block; overflow-x: auto; }
.rep-chart-card.rep-month-compare .rep-chart-body svg.rep-chart-svg,
.rep-chart-card.rep-period-compare .rep-chart-body svg.rep-chart-svg { width: auto; height: auto; max-width: 100%; display: block; margin: 0 auto; }
/* 同比小格子行（按月并排，flex 自适应） */
.rep-month-totals,
.rep-period-totals { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 6px 2px 10px; border-bottom: 1px dashed var(--border-subtle); margin-bottom: 8px; }
.rep-month-totals .rmt-item,
.rep-period-totals .rmt-item { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--text-dim); }
.rep-month-totals .rmt-label,
.rep-period-totals .rmt-label { color: var(--text-mute); font-size: 11px; }
.rep-month-totals .rmt-item b,
.rep-period-totals .rmt-item b { color: var(--text); font-size: 14px; font-weight: 600; letter-spacing: 0.2px; }
.rep-month-totals .rmt-unit,
.rep-period-totals .rmt-unit { font-size: 10px; color: var(--text-mute); }
.rep-month-totals .rmt-yoy,
.rep-period-totals .rmt-yoy { margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.rep-month-totals .rmt-yoy.up,
.rep-period-totals .rmt-yoy.up   { color: #1f9d5b; background: rgba(31,157,91,.12);  border: 1px solid rgba(31,157,91,.30); }
.rep-month-totals .rmt-yoy.down,
.rep-period-totals .rmt-yoy.down { color: #d64545; background: rgba(214,69,69,.10);  border: 1px solid rgba(214,69,69,.30); }
.rep-month-totals .rmt-yoy.flat,
.rep-period-totals .rmt-yoy.flat { color: var(--text-mute); background: rgba(149,163,180,.08); border: 1px solid var(--border-subtle); }

.rep-month-yoy,
.rep-period-yoy { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.rep-yoy-cell { flex: 1 1 0; min-width: 72px; text-align: center; font-size: 12px; padding: 6px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); line-height: 1.3; }
.rep-yoy-cell b { display: block; color: var(--text-dim); font-weight: normal; font-size: 10px; margin-bottom: 2px; }
.rep-yoy-cell.up { color: #1f9d5b; background: rgba(31,157,91,.10); border-color: rgba(31,157,91,.25); }
.rep-yoy-cell.down { color: #d64545; background: rgba(214,69,69,.10); border-color: rgba(214,69,69,.25); }
.rep-yoy-cell.flat { color: var(--text-dim); }
@media (max-width: 880px) { .rep-charts { flex-direction: column; } .rep-chart-card { flex: 1 1 auto; } .rep-summary { flex-wrap: wrap; } }

/* 实时 Tab 三联卡片（①源 ②钻取），紧凑秀气风 */
.cv-cards { display: flex; gap: 10px; margin-top: 10px; }
.cv-card { flex: 1 1 0; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 10px 8px; display: flex; flex-direction: column; }
.cv-card-title { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 6px; line-height: 1.3; display: flex; align-items: baseline; gap: 6px; }
.cv-card-title .cv-sub { font-weight: 400; font-size: 11px; color: var(--text-dim); }
.cv-card-title .cv-tag { font-size: 10px; color: var(--text-mute); }
.cv-card-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; line-height: 1.3; }
.cv-card-body { flex: 1; min-height: 0; }
.cv-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.cv-toolbar label { font-size: 12px; color: var(--text-dim); }
/* 覆盖全局 input/select/textarea { width:100% }；让选择器保持自然宽度，与模式按钮同行 */
.cv-toolbar select { width: auto; min-width: 100px; padding: 4px 8px; font-size: 12px; }
/* 模式切换三段式 */
.cv-mode { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cv-mode-btn { appearance: none; border: none; background: transparent; color: var(--text-dim); font-size: 12px; padding: 5px 16px; cursor: pointer; line-height: 1.2; }
.cv-mode-btn + .cv-mode-btn { border-left: 1px solid var(--border); }
.cv-mode-btn.active { background: var(--primary); color: var(--on-primary-2); font-weight: 600; }
@media (max-width: 900px) { .cv-cards { flex-direction: column; } }

/* ============ 发电量查询 · 汇总概览 ============ */
.rep-overview { margin-bottom: 14px; }
.rep-ov-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.rep-ov-sub { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.rep-ov-charts { display: flex; gap: 10px; flex-wrap: nowrap; margin-top: 12px; }
.rep-ov-charts .rep-chart-card { min-width: 0; }
/* 趋势 + 偏差率 占较大空间，饼图作为辅助占较小空间 */
.rep-ov-charts .ov-trend { flex: 2 1 0; }
.rep-ov-charts .ov-pie  { flex: 1 1 0; }
.rep-ov-charts .ov-dev  { flex: 2 1 0; }
.rep-ov-charts .rep-chart-body { height: 280px; padding: 8px; box-sizing: border-box; }
.rep-ov-charts .rep-chart-body svg { width: 100%; height: 100%; display: block; }
.ov-pie-body { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
@media (max-width: 880px) { .rep-ov-charts { flex-wrap: wrap; } .rep-ov-charts .rep-chart-card { flex: 1 1 100% !important; } }
/* 综合概览：改用以行为单位的 flex 布局，彻底避开 grid 在某些容器下的列宽计算异常 */
.overview-kpis,
.ov-insights {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}
.ov-insights { margin: 10px 0 6px; }
.overview-row {
  display: flex;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}
.overview-row > .rep-sum-card,
.overview-row > .ov-insight-card {
  flex: 1 1 0;
  min-width: 0;
}
.overview-row > .rep-sum-card { min-height: 150px; }

/* 第二行：发电达成率（父模块）+ 右侧 3 张子指标 */
.overview-row-mixed { display: flex; gap: 10px; }
.overview-row-mixed > .rep-sum-card.ach {
  flex: 1 1 48%;
  min-height: 150px;
}
.kpi-sub-group {
  flex: 1 1 52%;
  display: flex;
  gap: 10px;
  min-width: 0;
}
.kpi-sub-group > .rep-sum-card {
  flex: 1 1 0;
  min-width: 0;
  min-height: 150px;
}

/* 综合概览 · 洞察预警：左侧色条标识状态 */
.ov-insight-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px 14px 18px;
  position: relative;
  overflow: hidden;
  min-height: 150px;
}
.ov-insight-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--primary);
}
.ov-insight-card.warn::before { background: #d64545; }
.ov-insight-card.good::before { background: #1f9d5b; }
.ov-insight-card.mutedc::before { background: #888; }
.ov-insight-card.warn,
.ov-insight-card.good,
.ov-insight-card.mutedc { background: var(--surface-2); border-color: var(--border); }
.ov-insight-card .oic-val { font-size: 24px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ov-insight-card .oic-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.ov-insight-card .oic-sub { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* 分区小标题 */
.rep-ov-section { font-size: 14px; font-weight: 600; margin: 16px 0 8px; color: var(--text); }
.rep-ov-section:first-of-type { margin-top: 0; }

.rep-legend { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.lg-item { display: flex; align-items: center; gap: 6px; }
.lg-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.lg-val { margin-left: auto; font-weight: 600; }
@media (max-width: 880px) { .rep-ov-charts .rep-chart-card { flex: 1 1 100%; } }


/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: flex-start; justify-content: center; z-index: 50; overflow-y: auto; padding: 40px 16px; }
.modal-mask.show { display: flex; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 16px; font-size: 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); color: #ffd9d9; }
.toast.ok { border-color: var(--primary); }

.empty { text-align: center; color: var(--text-mute); padding: 40px 0; }
.text-muted { color: var(--text-mute); font-size: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; line-height: 1.4; }
.badge.up { background: rgba(52,211,153,.15); color: #34d399; }
.badge.down { background: rgba(248,113,113,.15); color: #f87171; }
.badge.warn { background: rgba(251,191,36,.15); color: #fbbf24; }
.badge.info { background: rgba(56,189,248,.15); color: #38bdf8; }
.alert-item { border-left: 3px solid var(--warn); background: var(--surface-2); padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }
.alert-item .meta { color: var(--text-dim); font-size: 12px; margin-bottom: 4px; }
.upload-zone { border: 1px dashed var(--border); border-radius: 10px; padding: 14px; background: var(--surface-2); }
.muted { color: var(--text-mute); }
.hint { font-size: 12px; color: var(--text-mute); margin-top: 6px; }

/* ---------- 日报列表宽表样式 ---------- */
.daily-table { min-width: 1200px; border-collapse: collapse; }
.daily-table th { font-size: 12px; white-space: nowrap; padding: 8px 6px; text-align: center; }
.daily-table td { padding: 7px 6px; font-size: 13px; vertical-align: middle; text-align: center; }
.daily-table .num-col { text-align: center; font-variant-numeric: tabular-nums; }
.daily-table .text-col { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.daily-table td.ai-summary { cursor: pointer; }
.daily-table td.ai-summary:hover { color: var(--primary, #4fc3f7); text-decoration: underline; }
.daily-table .highlight-gen { color: var(--primary, #4fc3f7); background: rgba(79,195,247,0.06); }
.daily-table .highlight-circuit { color: var(--accent, #81c784); background: rgba(129,199,132,0.06); }
.daily-table tbody tr:hover { background: var(--surface-hover, var(--tint-2)); }
.daily-table .ops { display: flex; gap: 4px; justify-content: center; }
.sync-log-table td { font-size: 12px; padding: 6px 8px; }

/* ---------- 电站管理：树形可展开分区 ---------- */
table th.tt-col, table td.tt-col { width: 28px; min-width: 28px; text-align: center; padding-left: 6px; padding-right: 0; }
.tree-toggle { cursor: pointer; color: var(--primary, #4fc3f7); font-size: 11px; user-select: none; transition: transform .15s; width: 28px; }
.tree-parent.st-name, .tree-parent .st-name { font-weight: 600; }
.tree-parent:hover { background: var(--surface-hover, var(--tint-2)); }
.tree-child > td { padding: 0 !important; background: var(--surface-2, var(--tint-1)); }
.zone-panel { padding: 10px 14px 16px 30px; }
.zone-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.zone-head > span { font-size: 13px; font-weight: 600; color: var(--text-soft, #c9d1d9); }
.zone-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.zone-table th { font-size: 12px; color: var(--text-mute, #8b949e); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border, #2a2f3a); white-space: nowrap; }
.zone-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-soft, rgba(42,47,58,0.5)); vertical-align: middle; }
.zone-table tbody tr:hover { background: var(--surface-hover, var(--tint-2)); }
.zone-table .z-grid { max-width: 220px; white-space: normal; line-height: 1.4; }
.zone-table .ops { display: flex; gap: 4px; }
.zone-rel-wrap { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.zone-rel { flex: 1 1 320px; min-width: 280px; background: var(--surface-1, var(--tint-2)); border: 1px solid var(--border-soft, rgba(42,47,58,0.5)); border-radius: 8px; padding: 10px 12px; }
.zone-rel .zr-title { font-size: 12px; color: var(--text-mute, #8b949e); margin-bottom: 6px; font-weight: 500; }
.zone-rel .zr-body { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; line-height: 1.6; }
.zone-rel .zr-col { flex: 1 1 140px; min-width: 130px; }
.zone-rel .zr-h { font-size: 11px; color: var(--text-mute, #8b949e); margin-bottom: 3px; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); width: 220px; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-block; }
  .row-2 { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}

/* ---- 报表模板配置页 ---- */
#rtTable input[type="text"],
#rtTable input[type="number"],
#rtTable select {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}
#rtTable input:focus,
#rtTable select:focus {
  border-color: var(--primary);
  outline: none;
}
#rtTable code {
  color: #93c5fd;
  background: rgba(59,130,246,0.1);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

/* ---- 日报锁定行样式 ---- */
.row-locked {
  background: rgba(239,68,68,0.04) !important;
  opacity: 0.8;
}
.row-locked td {
  color: var(--text-muted) !important;
}
.locked-badge {
  margin-left: 4px;
  font-size: 10px;
  padding: 1px 5px;
  background: #fecaca;
  color: #991b1b;
  border-radius: 3px;
  white-space: nowrap;
}

/* ===== 数据看板：电站选择器与单站头部 ===== */
.dash-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.tb-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.select {
  background: var(--panel-2, #1b2740); color: var(--text); border: 1px solid var(--border, #2c3a52);
  border-radius: 8px; padding: 7px 10px; font-size: 14px; min-width: 220px; outline: none; cursor: pointer;
}
.select:focus { border-color: var(--accent); }
.select.sm { padding: 4px 8px; font-size: 13px; min-width: 120px; }
/* ===== 应收中台：报表 tab 选中态 + 汇总行 ===== */
.rp-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
tr.sum-row td { background: var(--panel-2, #1b2740); border-top: 2px solid var(--border, #2c3a52); }
.station-head {
  margin-bottom: 14px; padding: 12px 16px; background: var(--panel-2, #1b2740);
  border: 1px solid var(--border, #2c3a52); border-radius: 12px;
}
.station-name { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.station-meta { font-size: 12px; color: var(--muted); }
.empty { padding: 24px; text-align: center; color: #64748b; }

/* 分页（表格底部右侧，单行不换行） */
.pagination { display: flex; align-items: center; justify-content: flex-end; padding: 10px 16px 6px; gap: 16px; flex-wrap: nowrap; }
.pag-left { font-size: 12px; color: var(--text-mute, #64748b); margin-right: auto; white-space: nowrap; flex-shrink: 0; }
.pag-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.pag-right .btn { flex-shrink: 0; white-space: nowrap; }
.pag-ellipsis { color: var(--text-mute, #64748b); font-size: 12px; padding: 0 2px; }
.btn.disabled { opacity: .35; pointer-events: none; }

/* ===== AI 分析师对话 ===== */
.ai-msg { display: flex; flex-direction: column; gap: 12px; }
.ai-msg .bubble { max-width: 82%; padding: 10px 14px; border-radius: 12px; line-height: 1.6; font-size: 14px; white-space: normal; word-break: break-word; }
.ai-msg .bubble.u { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 2px; }
.ai-msg .bubble.a { align-self: flex-start; background: var(--surface-3, #1e293b); color: var(--text, #e2e8f0); border: 1px solid var(--border, #334155); border-bottom-left-radius: 2px; }
.ai-msg .bubble.a code { background: rgba(148,163,184,.18); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ai-msg .bubble.a pre.code { background: rgba(2,6,23,.55); border: 1px solid var(--border, #334155); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; margin: 6px 0; }
.ai-msg .bubble.a strong { color: var(--primary); }
.ai-msg .typing { color: var(--text-mute, #64748b); font-style: italic; }
.typing::after { content: ''; animation: aiDot 1.2s steps(4, end) infinite; }
@keyframes aiDot { 0% { content: ''; } 25% { content: '·'; } 50% { content: '··'; } 75% { content: '···'; } }

/* AI 聊天气泡中的 Markdown 表格 */
.ai-msg .bubble.a .ai-table {
  display: table; width: 100%; border-collapse: collapse;
  font-size: 13px; margin: 8px 0;
}
.ai-msg .bubble.a .ai-table th,
.ai-msg .bubble.a .ai-table td {
  padding: 5px 10px; border: 1px solid var(--border, #334155);
}
.ai-msg .bubble.a .ai-table th {
  background: rgba(99,179,237,.08); color: var(--primary); font-weight: 600; white-space: nowrap;
}
.ai-msg .bubble.a .ai-table tr:nth-child(even) td { background: var(--tint-1); }
.ai-msg .bubble.a .ai-table tr:hover td { background: rgba(99,179,237,.06); }
/* 表格溢出时只在表格外层横向滚动；气泡本身不滚动，整体交给外层 #counselMsg 滚动 */
.ai-msg .bubble.a .ai-table-wrap { display: block; overflow-x: auto; max-width: 100%; }
.ai-msg .bubble.a .ai-table-wrap .ai-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }

/* AI 历史记录面板 */
#aiHistPanel { border: 1px solid var(--border); padding: 14px; }
#aiHistList::-webkit-scrollbar { width: 4px; }
#aiHistList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== AI 顾问 Tab ===== */
.counsel-tab {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.counsel-tab:hover { color: var(--text); border-color: var(--primary); }
.counsel-tab.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* ===== 手机版模式（仅 AI顾问 / AI抄表） ===== */
.mobile-shell { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.m-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.m-title { font-weight: 700; font-size: 16px; color: var(--text); }
.m-actions { display: flex; gap: 8px; }
.m-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.m-btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 600; }
.m-btn:active { transform: translateY(1px); }
.m-content { flex: 1; padding: 14px; overflow-x: hidden; }
.m-foot { text-align: center; font-size: 11px; color: var(--text-mute); padding: 10px; }
.m-home { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 520px; margin: 22px auto; }
.m-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; text-decoration: none; color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.06); transition: transform .12s, border-color .12s; }
.m-card:active { transform: scale(.97); }
.m-card-ico { width: 52px; height: 52px; color: var(--primary); display: flex; align-items: center; justify-content: center; }
.m-card-ico svg { width: 100%; height: 100%; }
.m-card-label { font-size: 19px; font-weight: 700; }
.m-card-sub { font-size: 12px; color: var(--text-mute); text-align: center; }
/* 手机版内承载的子页面：去除桌面侧栏带来的多余外边距，保证满宽 */
.m-content .panel { margin: 0; }

/* ===== AI 顾问·今日洞察 / 风险预警 markdown 容器 ===== */
.advisor-md { word-break: break-word; }
.advisor-md strong { color: var(--text); font-weight: 700; }
.advisor-md code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--primary); }
.advisor-md pre.code { margin: 8px 0; }
.advisor-md .ai-table { font-size: 12px; }

/* ---------- 手机端「日报填写」 ---------- */
.mobile-daily { max-width: 560px; margin: 0 auto; }
.mobile-daily .m-back { display: inline-block; margin-bottom: 12px; color: var(--primary); font-size: 14px; text-decoration: none; }
.mobile-daily .md-head { margin-bottom: 14px; }
.mobile-daily .block { display: block; width: 100%; }
/* 所有分组/平铺字段强制单列，适合单手竖向滚动 */
.mobile-daily .row-2,
.mobile-daily .row-3,
.mobile-daily .row-4,
.mobile-daily .row-5 { grid-template-columns: 1fr; gap: 0; }
.mobile-daily label.field { margin-bottom: 16px; }
.mobile-daily label.field > span { font-size: 14px; color: var(--text); font-weight: 600; margin-bottom: 7px; }
.mobile-daily .field input,
.mobile-daily .field select,
.mobile-daily .field textarea {
  width: 100%; font-size: 16px; padding: 13px 12px; border-radius: 10px; background: var(--surface-2);
}
.mobile-daily .field textarea { line-height: 1.6; }
.mobile-daily .field .muted { display: block; margin-top: 5px; }
.mobile-daily .md-error {
  background: rgba(248,113,113,.12); border: 1px solid var(--danger); color: var(--danger);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 4px 0 12px;
}
/* 底部吸底保存栏，单手可达 */
.mobile-daily .m-savebar {
  position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 0 6px;
  background: var(--bg); border-top: 1px solid var(--border); margin-top: 6px;
}
.mobile-daily .m-savebar .btn { padding: 13px 16px; font-size: 15px; }

/* ===== 电量电费对账单（v1.9.58） ===== */
.cfg-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 16px; padding: 12px 14px 16px; }
.cfg-col { min-width: 0; }
.cfg-h { font-weight: 600; margin: 4px 0 8px; color: var(--text); }
.meter-picker { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--surface-2); }
.meter-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 8px; }
.meter-row:hover { background: var(--bg); }
.meter-row .mn { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg-col label.tb-label { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.cfg-col label.tb-label input { flex: 1; min-width: 0; }
.tbl { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: 13px; }
.tbl th, .tbl td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.tbl th { background: var(--surface-2); color: var(--text); font-weight: 600; }
.tbl tr.tot td { font-weight: 700; background: var(--surface-2); }
.stmt-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 4px 0; }
.ss-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.ss-card.hl { border-color: var(--primary); background: rgba(45, 212, 140, .08); }
.ss-t { font-size: 13px; color: var(--text-mute); margin-bottom: 6px; }
.ss-v { font-size: 22px; font-weight: 700; color: var(--text); }
.ss-v span { font-size: 13px; font-weight: 400; color: var(--text-mute); margin-left: 4px; }
.warn-box { margin-top: 12px; background: rgba(248, 113, 113, .1); border: 1px solid var(--danger); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.warn-box ul { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 760px) { .cfg-wrap { grid-template-columns: 1fr; } }

/* ===== 经营驾驶舱 / 领导视角看板（v1.12.54 · 方案B 深色科技风 · 地图居中环绕） ===== */
.cmd {
  --cmd-bg: #0b132b;
  --cmd-panel: linear-gradient(180deg, #101b33 0%, #0c1730 100%);
  --cmd-panel2: #0e1830;
  --cmd-panel2-a: rgba(14, 24, 48, .78);
  --cmd-border: rgba(0, 212, 255, .16);
  --cmd-border-soft: rgba(138, 180, 248, .14);
  --cmd-text: #e6f1ff;
  --cmd-sub: #8ab4f8;
  --cmd-mute: #5f7099;
  --cmd-cyan: #00d4ff;
  --cmd-green: #00ff88;
  --cmd-red: #ff3355;
  --cmd-yellow: #ffbf00;
  --cmd-glow: 0 0 18px rgba(0, 212, 255, .25);
  --cmd-radius: 12px;
  color: var(--cmd-text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 212, 255, .06), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(0, 255, 136, .05), transparent 55%),
    var(--cmd-bg);
  padding: 14px 16px 20px;
  min-height: 100%;
}
.cmd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.cmd-title { font-size: 16px; font-weight: 700; letter-spacing: .5px; color: var(--cmd-text); display: flex; align-items: center; gap: 10px; }
.cmd-title .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cmd-green); box-shadow: 0 0 10px var(--cmd-green); animation: cmdBreath 2s infinite; }
.cmd-meta { font-size: 11px; color: var(--cmd-sub); display: flex; align-items: center; gap: 8px; }
.cmd-meta .live { display: inline-flex; align-items: center; gap: 5px; color: var(--cmd-green); }
.cmd-meta .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--cmd-green); box-shadow: 0 0 8px var(--cmd-green); animation: cmdBreath 2s infinite; }
@keyframes cmdBreath { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* 顶部 Hero 指标卡 */
.cmd-hero-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
/* 方案E 深色进度条 Hero 卡 */
.cmd-hero-card { background: var(--cmd-panel); border: 1px solid var(--cmd-border); border-top: 2px solid var(--hc); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cmd-hero-card .ch-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cmd-hero-card .ch-lab { font-size: 12px; color: var(--cmd-sub); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-hero-card .ch-yoy { font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmd-hero-card .ch-yoy.up { color: var(--cmd-green); }
.cmd-hero-card .ch-yoy.down { color: var(--cmd-red); }
.cmd-hero-card .ch-yoy.flat { color: var(--cmd-mute); }
.cmd-hero-card .ch-val { font-size: 26px; font-weight: 700; color: var(--cmd-text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cmd-hero-card .ch-val small { font-size: 12px; font-weight: 400; color: var(--cmd-sub); margin-left: 3px; }
.cmd-hero-card .ch-bar { height: 5px; border-radius: 3px; background: var(--cmd-border-soft); overflow: hidden; }
.cmd-hero-card .ch-bar i { display: block; height: 100%; border-radius: 3px; background: var(--hc); }
.cmd-hero-card .ch-foot { font-size: 11px; color: var(--cmd-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-hero-card .ch-foot b { color: var(--cmd-text); font-weight: 600; }
.cmd-hero-card .ch-foot-lab { color: var(--cmd-sub); }
.cmd-hero-card.c-blue { --hc: #38bdf8; }
.cmd-hero-card.c-teal { --hc: #2dd4bf; }
.cmd-hero-card.c-purple { --hc: #a78bfa; }
.cmd-hero-card.c-amber { --hc: #fbbf24; }
.cmd-hero-card.c-red { --hc: #f87171; }
.cmd-hero-card.c-green { --hc: #34d399; }

/* 次级指标胶囊 */
.cmd-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.cmd-chip { font-size: 11px; color: var(--cmd-sub); background: var(--cmd-panel2); border: 1px solid var(--cmd-border-soft); border-radius: 20px; padding: 4px 11px; display: inline-flex; align-items: center; gap: 6px; }
.cmd-chip b { color: var(--cmd-text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 中部三列环绕 */
.cmd-mid { display: grid; grid-template-columns: 332px 1fr 344px; gap: 12px; margin-top: 12px; align-items: stretch; }
.cmd-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cmd-center { min-width: 0; display: flex; flex-direction: column; }
.cmd-panel { background: var(--cmd-panel); border: 1px solid var(--cmd-border); border-radius: var(--cmd-radius); padding: 12px; position: relative; }
.cmd-panel .ph { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.cmd-panel .ph h3 { font-size: 13px; color: var(--cmd-text); font-weight: 600; letter-spacing: .3px; display: flex; align-items: center; gap: 7px; }
.cmd-panel .ph h3::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--cmd-cyan); box-shadow: 0 0 8px var(--cmd-cyan); }
.cmd-panel .ph .actions { display: flex; align-items: center; gap: 6px; }
.cmd-panel select { background: var(--cmd-panel2); color: var(--cmd-text); border: 1px solid var(--cmd-border-soft); border-radius: 7px; padding: 3px 8px; font-size: 11px; }
.cmd-map-wrap { flex: 1; min-height: 480px; display: flex; flex-direction: column; }
.cmd-map-wrap .cmd-map { flex: 1; min-height: 440px; }
.cmd-legend { display: flex; align-items: center; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--cmd-sub); flex-wrap: wrap; }
.cmd-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cmd-legend-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 5px currentColor; }

/* 卡片头部时段切换（参考能耗趋势样式，深色版） */
.cmd-period-tags { display: inline-flex; gap: 0; background: var(--cmd-panel2); border: 1px solid var(--cmd-border-soft); border-radius: 6px; overflow: hidden; }
.cmd-period-tags span { padding: 3px 9px; font-size: 10px; color: var(--cmd-sub); cursor: default; }
.cmd-period-tags span.active { background: var(--cmd-cyan); color: var(--cmd-bg); font-weight: 600; }

/* 预警通知 */
.cmd-alert { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-radius: 9px; margin-bottom: 7px; border-left: 3px solid var(--cmd-yellow); background: rgba(255, 191, 0, .07); }
.cmd-alert.critical { border-left-color: var(--cmd-red); background: rgba(255, 51, 85, .09); animation: cmdPulse 2s infinite; }
.cmd-alert.info { border-left-color: var(--cmd-cyan); background: rgba(0, 212, 255, .07); }
.cmd-alert .lv { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; flex: none; margin-top: 1px; }
.cmd-alert.critical .lv { color: var(--cmd-red); }
.cmd-alert .lv.critical { color: var(--cmd-red); background: rgba(255, 51, 85, .15); }
.cmd-alert .lv.warning { color: var(--cmd-yellow); background: rgba(255, 191, 0, .15); }
.cmd-alert .lv.info { color: var(--cmd-cyan); background: rgba(0, 212, 255, .15); }
.cmd-alert .body { min-width: 0; }
.cmd-alert .body .t { font-size: 12px; color: var(--cmd-text); font-weight: 600; }
.cmd-alert .body .d { font-size: 11px; color: var(--cmd-sub); margin-top: 2px; }
@keyframes cmdPulse { 0%, 100% { box-shadow: 0 0 0 rgba(255, 51, 85, 0); } 50% { box-shadow: 0 0 12px rgba(255, 51, 85, .35); } }
.cmd-banner { border-radius: 9px; padding: 9px 12px; font-size: 12px; margin-bottom: 9px; border-left: 3px solid var(--cmd-red); background: rgba(255, 51, 85, .1); color: #ffc9d3; }
.cmd-banner.ok { border-left-color: var(--cmd-green); background: rgba(0, 255, 136, .08); color: #b6ffe0; }
.cmd-alert.ok { border-left-color: var(--cmd-green); background: rgba(0, 255, 136, .07); }
.cmd-alert .lv.ok { color: var(--cmd-green); background: rgba(0, 255, 136, .15); }
.cmd-meta .live.static { color: var(--cmd-sub); }
.cmd-meta .live.static i { background: var(--cmd-sub); box-shadow: 0 0 6px var(--cmd-sub); animation: none; }

/* 地图电站悬停浮动窗（照片 + 名称 + 关键指标） */
.geo-tip { position: fixed; z-index: 1000; max-width: 240px; background: rgba(15, 23, 41, .96); border: 1px solid #2b3b52; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); padding: 8px; pointer-events: none; font-size: 12px; color: #e2e8f0; }
.geo-tip-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.geo-tip-img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid #334155; flex: none; }
.geo-tip-noimg { width: 64px; height: 48px; border-radius: 6px; border: 1px dashed #475569; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #64748b; flex: none; }
.geo-tip-name { font-weight: 700; font-size: 13px; color: #fff; line-height: 1.3; }
.geo-tip-body { color: #cbd5e1; line-height: 1.6; }
.geo-tip-body b { color: #00d4ff; font-weight: 600; }

/* 地图缩放/平移控件 */
.geo-wrap { position: relative; }
.geo-zoom-ctrl { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 5px; z-index: 5; }
.geo-zoom-ctrl button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #334155; background: rgba(15, 23, 41, .82); color: #cbd5e1; font-size: 15px; line-height: 1; cursor: pointer; padding: 0; transition: background .15s, border-color .15s; }
.geo-zoom-ctrl button:hover { background: rgba(30, 41, 59, .95); border-color: var(--cmd-cyan, #00d4ff); color: #fff; }
.geo-zoom-ctrl button:active { transform: scale(.94); }

/* 电站详情弹窗卡片（v1.12.75：更紧凑、更协调的卡片布局） */
.modal-wide { max-width: 540px; }
.modal-wide .modal {
  padding: 14px 16px 16px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 212, 255, .06), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(0, 255, 136, .05), transparent 55%),
    var(--cmd-bg);
  border: 1px solid var(--cmd-border);
  color: var(--cmd-text);
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.cmd-station-detail { font-size: 12px; color: var(--cmd-text); }
.cmd-station-detail .sd-loading, .cmd-station-detail .sd-err { padding: 24px; text-align: center; color: var(--cmd-sub); }
.cmd-station-detail .sd-err { color: var(--cmd-red); }

/* 头部：照片 + 名称/位置 + 档案 */
.sd-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--cmd-border-soft); }
.sd-photo { width: 72px; height: 54px; border-radius: 7px; object-fit: cover; border: 1px solid var(--cmd-border-soft); flex: none; background: var(--cmd-panel2-a); }
.sd-noimg { display: flex; align-items: center; justify-content: center; font-size: 11px; color: #64748b; }
.sd-head-info { flex: 1; min-width: 0; }
.sd-name { font-size: 15px; font-weight: 700; color: var(--cmd-text); line-height: 1.25; margin-bottom: 2px; }
.sd-sub { font-size: 11px; color: var(--cmd-sub); margin-bottom: 4px; }
.sd-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.sd-tag { font-size: 10px; padding: 2px 7px; border-radius: 5px; background: var(--cmd-panel2-a); color: var(--cmd-sub); border: 1px solid var(--cmd-border-soft); }

/* 分节：标题 + 内容 */
.sd-sec { margin-bottom: 14px; }
.sd-sec-h { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--cmd-cyan); font-weight: 600; margin-bottom: 8px; letter-spacing: .3px; text-transform: uppercase; }
.sd-sec-h::before { content: ''; width: 3px; height: 11px; border-radius: 2px; background: var(--cmd-cyan); }
.sd-tiles { display: flex; gap: 8px; }
.sd-tiles-3 { gap: 6px; }

/* 弹窗内 Hero 小卡片（更紧凑、可隐藏 yoy/bar） */
.sd-hero { flex: 1; min-width: 0; background: var(--cmd-panel2-a); border: 1px solid var(--cmd-border-soft); border-top: 2px solid var(--hc); border-radius: 9px; padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 3px; }
.sd-hero.no-yoy { padding-top: 9px; }
.sd-hero .sh-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 2px; }
.sd-hero .sh-lab { font-size: 10px; color: var(--cmd-sub); letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-hero .sh-yoy { font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; padding: 2px 7px; border-radius: 5px; background: var(--tint-2); letter-spacing: .2px; }
.sd-hero .sh-yoy.up { color: #34d399; background: rgba(52,211,153,.16); box-shadow: 0 0 10px rgba(52,211,153,.22); text-shadow: 0 0 6px rgba(52,211,153,.35); }
.sd-hero .sh-yoy.down { color: #f87171; background: rgba(248,113,113,.16); box-shadow: 0 0 10px rgba(248,113,113,.18); text-shadow: 0 0 6px rgba(248,113,113,.30); }
.sd-hero .sh-yoy.flat { color: var(--cmd-mute); }
.sd-hero .sh-val { font-size: 17px; font-weight: 700; color: var(--cmd-text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.sd-hero .sh-val small { font-size: 10px; font-weight: 400; color: var(--cmd-sub); margin-left: 2px; }
.sd-hero .sh-bar { height: 3px; border-radius: 2px; background: var(--cmd-border-soft); overflow: hidden; margin-top: 2px; }
.sd-hero .sh-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--hc), var(--sheen)); }
.sd-hero .sh-foot { font-size: 10px; color: var(--cmd-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.sd-hero .sh-foot-lab { color: var(--cmd-sub); }
.sd-hero.c-blue { --hc: #38bdf8; }
.sd-hero.c-teal { --hc: #2dd4bf; }
.sd-hero.c-purple { --hc: #a78bfa; }
.sd-hero.c-amber { --hc: #fbbf24; }
.sd-hero.c-red { --hc: #f87171; }
.sd-hero.c-green { --hc: #34d399; }

/* 兼容旧 tile 可能用到的工具色（保留） */
.sd-green { color: #34d399; }
.sd-amber { color: #fbbf24; }
.sd-yoy.up { color: #34d399; }
.sd-yoy.down { color: #f87171; }
.sd-yoy.flat { color: var(--cmd-sub); }

/* 欠费表 */
.sd-debt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; background: var(--cmd-panel2-a); border: 1px solid var(--cmd-border-soft); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.sd-debt th { text-align: left; padding: 6px 10px; color: var(--cmd-sub); font-weight: 500; background: rgba(0,0,0,.15); font-size: 10px; letter-spacing: .2px; }
.sd-debt td { padding: 6px 10px; border-top: 1px solid var(--cmd-border-soft); }
.sd-debt tr:first-child td { border-top: none; }
.sd-amt { color: var(--cmd-text); }
.sd-amt-bad { color: #f87171; font-weight: 600; }
.sd-ok { color: #34d399; }
.sd-bad { color: #f87171; font-weight: 600; }

/* 告警与档案 */
.sd-alarm-ok { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #34d399; }
.sd-alarm-ok::before { content: '✓'; width: 14px; height: 14px; border-radius: 50%; background: rgba(52,211,153,.12); display: flex; align-items: center; justify-content: center; font-size: 9px; }
.sd-alarm-item { font-size: 11px; padding: 6px 8px; border-radius: 6px; margin-bottom: 4px; border-left: 3px solid; }
.sd-alarm-item.crit { border-left-color: var(--cmd-red); background: rgba(255, 51, 85, .08); color: #fca5a5; }
.sd-alarm-item.warn { border-left-color: var(--cmd-yellow); background: rgba(255, 191, 0, .07); color: #fcd34d; }
.sd-archive { display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 4px; font-size: 11px; color: var(--cmd-sub); line-height: 1.5; }
.sd-archive-item { display: inline-flex; align-items: center; gap: 4px; }
.sd-archive-item::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--cmd-mute); }

/* 决策建议 / 运营洞察 */
.cmd-insight { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-radius: 9px; margin-bottom: 7px; border-left: 3px solid var(--cmd-cyan); background: rgba(0, 212, 255, .06); }
.cmd-insight.action { border-left-color: var(--cmd-red); background: rgba(255, 51, 85, .08); }
.cmd-insight.warn { border-left-color: var(--cmd-yellow); background: rgba(255, 191, 0, .07); }
.cmd-insight .ic { font-size: 13px; flex: none; }
.cmd-insight .t { font-size: 12px; color: var(--cmd-text); font-weight: 600; }
.cmd-insight .d { font-size: 11px; color: var(--cmd-sub); margin-top: 2px; line-height: 1.5; }

/* 右上角布局设置按钮 */
.cmd-layout-btn { background: var(--cmd-panel2); color: var(--cmd-sub); border: 1px solid var(--cmd-border-soft); border-radius: 7px; padding: 4px 10px; font-size: 11px; cursor: pointer; margin-left: 8px; }
.cmd-layout-btn:hover { color: var(--cmd-cyan); border-color: var(--cmd-cyan); }

/* 对标三图并排 */
.cmd-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cmd-trio-item { background: var(--cmd-panel2); border: 1px solid var(--cmd-border-soft); border-radius: 10px; padding: 8px; }
.cmd-trio-h { font-size: 11px; color: var(--cmd-sub); margin-bottom: 4px; text-align: center; }
.cmd-trio-chart { width: 100%; }

/* 布局设置弹窗 */
.cmd-layout-overlay { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.cmd-layout-modal { width: 680px; max-width: 96vw; max-height: 90vh; overflow: auto; background: linear-gradient(180deg, #101b33 0%, #0c1730 100%); border: 1px solid var(--cmd-border); border-radius: 14px; padding: 18px 20px; color: var(--cmd-text); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.cl-head { display: flex; align-items: center; justify-content: space-between; }
.cl-head h3 { font-size: 15px; margin: 0; font-weight: 600; }
.cl-close { background: none; border: none; color: var(--cmd-sub); font-size: 22px; cursor: pointer; line-height: 1; }
.cl-close:hover { color: var(--cmd-red); }
.cl-tip { font-size: 12px; color: var(--cmd-sub); margin: 6px 0 14px; }
.cl-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cl-col-h { font-size: 12px; color: var(--cmd-cyan); margin-bottom: 8px; font-weight: 600; }
.cl-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 72px; background: rgba(0, 0, 0, .12); border: 1px dashed rgba(148, 163, 184, .15); border-radius: 10px; transition: border-color .15s, background .15s; }
.cl-list.drag-over { border-color: var(--cmd-cyan); background: rgba(0, 212, 255, .08); }
.cl-hidden-zone { margin-top: 14px; }
.cl-hidden-zone .cl-list { min-height: 56px; border-style: dashed; border-color: rgba(100, 116, 139, .25); background: rgba(0, 0, 0, .06); }
.cl-item { display: flex; align-items: center; gap: 8px; background: var(--cmd-panel2); border: 1px solid var(--cmd-border-soft); border-radius: 8px; padding: 8px 10px; cursor: grab; }
.cl-item.dragging { opacity: .45; border-color: var(--cmd-cyan); box-shadow: 0 0 12px rgba(0, 212, 255, .25); }
.cl-item.off { opacity: .45; background: var(--tint-2); }
.cl-grip { color: var(--cmd-mute); font-size: 14px; cursor: grab; }
.cl-label { font-size: 12px; color: var(--cmd-text); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.cl-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; font-size: 13px; color: var(--cmd-sub); }
.cl-presets-h { color: var(--cmd-sub); }
.cl-preset, .cl-reset, .cl-cancel, .cl-apply { background: var(--cmd-panel2); color: var(--cmd-text); border: 1px solid var(--cmd-border-soft); border-radius: 7px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.cl-preset:hover, .cl-reset:hover, .cl-cancel:hover { border-color: var(--cmd-cyan); color: var(--cmd-cyan); }
.cl-apply { background: var(--cmd-cyan); color: var(--cmd-bg); border-color: var(--cmd-cyan); font-weight: 600; }
.cl-apply:hover { box-shadow: var(--cmd-glow); }
.cl-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* 响应式：移动端纵向堆叠（先全局后细节） */
@media (max-width: 1180px) {
  .cmd-mid { grid-template-columns: 1fr; }
  .cmd-hero-grid { grid-template-columns: repeat(3, 1fr); }
  .cmd-map-wrap { min-height: 420px; }
}
@media (max-width: 680px) {
  .cmd-hero-grid { grid-template-columns: repeat(2, 1fr); }
  .cmd-trio { grid-template-columns: 1fr; }
  .cl-cols { grid-template-columns: 1fr; }
  .cmd-layout-modal { width: 92vw; padding: 14px; }
}

/* =========================================================
   v1.12.112 通用弹窗 — 加大可用宽度 + 居中 + 主题感知
   ========================================================= */
.modal-mask {
  /* v1.12.115：垂直对齐从 center 改回 flex-start——
     当弹窗高度 > 视口高度时，align-items:center 会把弹窗顶部推出 mask 上边界，
     用户无法看到顶部内容(标题/数据同步按钮/必填提示)且 mask 滚动条不够用。
     改为 flex-start 后，弹窗顶部贴在 mask padding 顶部 (24px)，
     同时 .modal 加 max-height + overflow 内部滚动，既保证小弹窗水平垂直居中，
     又保证大弹窗顶部永远在视口内、内部可滚动访问。
  */
  align-items: flex-start;
  padding: 24px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
  background: rgba(0, 0, 0, .55);
}
.modal {
  /* 放开 max-width：长表单(换表/新增电表等)用足空间，小表单保底 480 */
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  /* 加 max-height + overflow-y: 大弹窗内部滚动，避免标题被推出视口 */
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  margin: auto; /* flex-start 模式下用 margin:auto 让小弹窗水平居中、大弹窗顶部贴 24px */
  padding: 24px 24px 18px;
  border-radius: 14px;
}
.modal h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 16px;
  display: flex; align-items: center; gap: 8px;
}
/* v1.12.114：日报录入/编辑/查阅弹窗字段多，用 .daily-form-wide 加宽至 880px；走 class 而非 inline style，避免破坏 modal-mask 的 flex 居中。注意不要与 .modal-wide（BI 详情弹窗专用，含深色背景渐变）冲突 */
.modal.daily-form-wide {
  width: min(880px, calc(100vw - 32px));
}
.modal .foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle, var(--tint-3));
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal .foot .btn { padding: 9px 18px; font-size: 14px; }
.modal .foot .btn.ghost { color: var(--text-secondary, #93a1b5); }
.modal .foot .btn.primary {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 4px 14px rgba(52,211,153,.18);
}

/* ---- 弹窗表单：卡片分组 + 字段统一外观 ---- */
.modal-form .group {
  background: var(--bg-subtle, var(--tint-1));
  border: 1px solid var(--border-subtle, var(--tint-3));
  border-radius: 10px;
  padding: 14px 14px 6px;
  margin: 0 0 12px;
}
.modal-form .group-title {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--text);
  background: var(--surface-3, var(--tint-2));
  border: 1px solid var(--border-subtle, var(--tint-3));
  padding: 4px 10px;
  border-radius: 999px;
  margin: -22px 0 12px; /* 浮在卡左上角 */
}
.modal-form label.field { margin-bottom: 12px; }
.modal-form label.field > span {
  font-size: 12.5px;
  color: var(--text-secondary, #93a1b5);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 4px;
}
.modal-form label.field > span .req { color: var(--danger); }
.modal-form input[type="text"],
.modal-form input[type="number"],
.modal-form input[type="date"],
.modal-form input[type="password"],
.modal-form select,
.modal-form textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: var(--surface-3, var(--tint-2));
  border: 1px solid var(--border, #2b3850);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal-form textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus {
  border-color: var(--primary, #34d399);
  box-shadow: 0 0 0 3px rgba(52,211,153,.18);
}
.modal-form input[disabled] { opacity: .7; cursor: not-allowed; }

/* ---- 弹窗警示条：主题感知 ---- */
.modal-form .alert {
  display: flex; gap: 8px; align-items: flex-start;
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.35);
  color: var(--text);
  font-size: 12.5px; line-height: 1.6;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 4px;
}
.modal-form .alert .ico { color: var(--warn, #fbbf24); font-weight: 700; }

/* ---- 弹窗窄屏自适应 ---- */
@media (max-width: 640px) {
  .modal { padding: 18px; }
  .modal-form .row-3 { grid-template-columns: 1fr; }
  .modal-form .row-2 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   浅色主题 · 局部覆盖（v1.16.21）
   仅覆盖无法通过设计令牌自动切换的硬编码样式。
   全部以 html[data-theme="light"] 限定，深色主题不受任何影响。
   ========================================================================== */

/* ---- 经营驾驶舱：自有科技风配色在浅色下的对应版本 ---- */
html[data-theme="light"] .cmd {
  --cmd-bg: #e8eef5;
  --cmd-panel: linear-gradient(180deg, #ffffff 0%, #f4f8fb 100%);
  --cmd-panel2: #f2f6fa;
  --cmd-panel2-a: rgba(255, 255, 255, .88);
  --cmd-border: rgba(8, 145, 178, .22);
  --cmd-border-soft: rgba(56, 110, 170, .18);
  --cmd-text: #14263c;
  --cmd-sub: #35618f;
  --cmd-mute: #7189a6;
  --cmd-cyan: #0e7490;
  --cmd-green: #0d9463;
  --cmd-red: #d02b3f;
  --cmd-yellow: #b45309;
  --cmd-glow: 0 0 18px rgba(14, 116, 144, .18);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(8, 145, 178, .07), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(13, 148, 99, .06), transparent 55%),
    var(--cmd-bg);
}
/* 浅底上减弱霓虹光晕，避免糊成一团 */
html[data-theme="light"] .cmd-title .dot,
html[data-theme="light"] .cmd-meta .live i { box-shadow: 0 0 8px rgba(13, 148, 99, .45); }
html[data-theme="light"] .sd-hero .sh-yoy.up { text-shadow: none; box-shadow: none; background: rgba(13, 148, 99, .14); color: #0a7d4e; }
html[data-theme="light"] .sd-hero .sh-yoy.down { text-shadow: none; box-shadow: none; background: rgba(198, 40, 40, .12); color: #b91c1c; }

/* ---- 驾驶舱布局设置弹窗 ---- */
html[data-theme="light"] .cmd-layout-modal {
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fb 100%);
  box-shadow: 0 12px 40px rgba(16, 40, 30, .18);
}

/* ---- 地图悬浮提示卡 ---- */
html[data-theme="light"] .geo-tip {
  background: rgba(255, 255, 255, .98);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(16, 40, 30, .14);
  color: var(--text);
}
html[data-theme="light"] .geo-tip-name { color: var(--text); }
html[data-theme="light"] .geo-tip-body { color: var(--text-dim); }
html[data-theme="light"] .geo-tip-body b { color: #0e7490; }
html[data-theme="light"] .geo-tip-img { border-color: var(--border); }
html[data-theme="light"] .geo-tip-noimg { border-color: var(--border); color: var(--text-mute); }

/* ---- 登录页：深色光伏板阵列图在浅色下反转提亮，保留阵列图案质感 ---- */
html[data-theme="light"] .login-wrap { background: #eef2ef; }
html[data-theme="light"] .login-pv img {
  filter: invert(1) hue-rotate(160deg) saturate(.55) brightness(1.04);
  opacity: .5;
}
html[data-theme="light"] .login-pv .pv-brand h1 { color: var(--text); }
html[data-theme="light"] .login-pv .pv-brand p { color: var(--text-mute); }
html[data-theme="light"] .login-panel { background: rgba(238, 242, 239, .55); }
html[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, .82);
  border-color: rgba(14, 143, 92, .28);
  box-shadow: 0 24px 60px rgba(16, 40, 30, .13);
}

/* ==========================================================================
   顶栏主题切换器（v1.16.21）
   ========================================================================== */
.theme-picker { position: relative; display: flex; align-items: center; }
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-width: 32px; padding: 0 9px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; cursor: pointer; font-size: 12.5px; transition: .15s;
}
.theme-btn:hover { color: var(--text); border-color: var(--primary); background: var(--surface-3); }
.theme-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-btn svg { width: 16px; height: 16px; display: block; }
.theme-menu {
  position: absolute; right: 0; top: 38px; min-width: 156px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; display: none; z-index: 60;
}
.theme-menu.show { display: block; }
.theme-menu a {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; font-size: 13px;
  color: var(--text-dim); text-decoration: none; border-radius: 7px; white-space: nowrap;
}
.theme-menu a:hover { background: var(--surface-2); color: var(--text); }
.theme-menu a.active { color: var(--primary); font-weight: 600; }
.theme-menu a.active::after { content: "✓"; margin-left: auto; font-size: 12px; }
.theme-menu a svg { width: 15px; height: 15px; flex: none; }
