/* ============================================================
 * components.css —— 实时部件与代码块（明亮主题）
 * ============================================================ */

/* ================= 代码块（浅色） ================= */
.code-block {
  background: #0f2f29;
  color: #d7efe6;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  font-size: 0.82rem;
  line-height: 1.75;
  overflow: auto;
  box-shadow: var(--shadow-md);
  margin: 0;
  tab-size: 4;
}
.code-block b { color: #6ee7c8; font-weight: 700; }
.code-block i { color: #7ea99b; font-style: italic; }
.code-block::-webkit-scrollbar { height: 8px; }
.code-block::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 4px; }

/* ================= 充电桩互斥网格 ================= */
.pile-board { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.pile-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  aspect-ratio: 1 / 1.05; border-radius: 12px;
  background: var(--surface-2); border: 1.5px solid var(--line);
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; color: var(--ink-lo);
  transition: background 0.4s var(--ease), border-color 0.4s, color 0.4s, transform 0.4s var(--ease), box-shadow 0.4s;
}
.pile-cell::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-lo); opacity: 0.4; transition: background 0.4s;
}
.pile-cell.is-on {
  background: var(--primary-soft); border-color: var(--primary);
  color: var(--primary-deep); box-shadow: 0 4px 14px rgba(0, 168, 120, 0.22);
  transform: translateY(-2px);
}
.pile-cell.is-on::before { background: var(--primary); box-shadow: 0 0 0 4px rgba(0,168,120,0.18); }
.pile-cell.is-fault {
  background: var(--danger-soft); border-color: rgba(229,72,77,0.5);
  color: var(--danger); animation: faultBlink 1.2s infinite;
}
.pile-cell.is-fault::before { background: var(--danger); }
@keyframes faultBlink { 50% { opacity: 0.55; } }

/* ================= 环形电池库 ================= */
.ring-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 7px; }
.slot {
  aspect-ratio: 1; border-radius: 8px;
  background: var(--surface-2); border: 1.5px dashed var(--line-strong);
  transition: background 0.35s var(--ease), border-color 0.35s, transform 0.35s var(--ease), box-shadow 0.35s;
}
.slot.is-full {
  background: linear-gradient(135deg, var(--primary), #22c1a3);
  border: none; box-shadow: 0 3px 10px rgba(0,168,120,0.3);
}
.slot.is-in { transform: scale(1.12); box-shadow: 0 0 0 4px rgba(0,168,120,0.2); }
.slot.is-out { transform: scale(0.86); opacity: 0.7; }

/* ================= 信号量 / 权重条 ================= */
.sem-row { display: grid; grid-template-columns: 150px 1fr 74px; gap: 12px; align-items: center; padding: 8px 0; }
.sem-row .sem-label { font-size: 0.84rem; font-weight: 700; color: var(--ink-mid); }
.sem-row .sem-label em { display: block; font-style: normal; font-size: 0.72rem; color: var(--ink-lo); font-weight: 500; }
.sem-bar {
  height: 12px; border-radius: 7px; background: var(--surface-3);
  overflow: hidden; position: relative;
}
.sem-bar i {
  display: block; height: 100%; width: 0;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--primary-deep), var(--primary));
  transition: width 0.6s var(--ease);
}
.sem-bar i.is-warn { background: linear-gradient(90deg, #d97706, var(--accent)); }
.sem-row .sem-val { font-size: 0.82rem; color: var(--ink-mid); text-align: right; }

.w-row { display: grid; grid-template-columns: 92px 1fr 60px; gap: 12px; align-items: center; padding: 7px 0; }
.w-row .body-s { font-size: 0.85rem; font-weight: 600; }
.w-row .sem-val { font-size: 0.82rem; text-align: right; }

/* ================= 调度推送流 ================= */
.plan-row {
  display: flex; justify-content: space-between; gap: 14px; align-items: baseline;
  padding: 10px 2px; border-bottom: 1px dashed var(--line);
  font-size: 0.84rem; color: var(--ink-mid);
  animation: streamIn 0.4s var(--ease);
}
.plan-row:last-child { border-bottom: none; }
.plan-row span:first-child { min-width: 0; }
.formula {
  display: inline-block;
  font-family: var(--font-mono); font-size: clamp(0.92rem, 1.4vw, 1.08rem);
  background: var(--surface); border: 1px solid var(--primary-line);
  border-radius: 14px; padding: 16px 24px; color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.formula span { color: var(--primary-deep); font-weight: 800; }

/* ================= 图例 / 表格 ================= */
.legend-dots { display: flex; gap: 16px; font-size: 0.8rem; color: var(--ink-mid); flex-wrap: wrap; }
.legend-dots i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ================= 分步说明（替代代码块，面向用户） ================= */
.flow-steps {
  list-style: none; margin: 6px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.flow-steps > li {
  display: grid; grid-template-columns: 38px 1fr; gap: 14px; align-items: start;
}
.flow-steps > li > div { min-width: 0; }
.flow-steps b {
  display: block; font-size: 0.95rem; color: var(--ink); font-weight: 800;
}
.flow-steps p { margin: 4px 0 0; }
.flow-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 34px; border-radius: 11px;
  background: var(--primary-soft); color: var(--primary-deep);
  border: 1px solid var(--primary-line);
  font-size: 0.84rem; font-weight: 800;
}

/* 技术备注折叠区：实现细节下沉，默认收起 */
.tech-note {
  margin-top: 16px; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: var(--surface-2);
  padding: 0;
}
.tech-note > summary {
  cursor: pointer; list-style: none;
  padding: 12px 18px;
  font-size: 0.84rem; font-weight: 700; color: var(--ink-mid);
  display: flex; align-items: center; gap: 8px;
}
.tech-note > summary::-webkit-details-marker { display: none; }
.tech-note > summary::before {
  content: "+"; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 6px;
  background: var(--surface-3); color: var(--ink-mid);
  font-size: 0.82rem; font-weight: 800; line-height: 1;
}
.tech-note[open] > summary::before { content: "−"; }
.tech-note[open] > summary { border-bottom: 1px dashed var(--line); }
.tech-note > p { padding: 0 18px; margin: 10px 0; }
.tech-note > p:last-child { padding-bottom: 14px; }

/* ================= 响应式 ================= */
@media (max-width: 880px) {
  .pile-board { grid-template-columns: repeat(4, 1fr); }
  .ring-grid { grid-template-columns: repeat(8, 1fr); }
  .sem-row { grid-template-columns: 110px 1fr 64px; }
  .code-block { font-size: 0.74rem; padding: 16px; }
}

/* ---------------- 分节宽幅横幅（首页 01/03 节配图） ---------------- */
.sec-banner {
  margin: 34px auto 0;
  max-width: 1080px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 18px 50px rgba(14, 60, 50, 0.14);
}
.sec-banner img {
  display: block;
  width: 100%;
  height: clamp(180px, 30vw, 320px);
  object-fit: cover;
}
.sec-banner figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 26px 22px 14px;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(10, 38, 32, 0.72));
  text-align: center;
  letter-spacing: 0.04em;
}

/* ================= 真实场站视图（与移动工作台同源） ================= */
.seg--view button { min-width: 72px; }
.real-store { margin-bottom: 20px; }
.real-store-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.real-store-head b { font-size: 0.95rem; color: var(--ink); }
.real-store-head .sub { font-size: 0.8rem; opacity: 0.72; }
.real-sub { opacity: 0.85; }
.real-v { font-family: var(--font-mono); opacity: 0.6; margin-left: 6px; }
.pile-cell.r-free { border-style: solid; }
.pile-cell.r-busy {
  background: var(--primary-soft); border-color: var(--primary);
  color: var(--primary-deep); box-shadow: 0 4px 14px rgba(0, 168, 120, 0.22);
}
.pile-cell.r-busy::before { background: var(--primary); box-shadow: 0 0 0 4px rgba(0,168,120,0.18); }
.pile-cell.r-overstay { background: var(--accent-soft); border-color: rgba(245, 158, 11, 0.5); color: #9a6206; }
.pile-cell.r-overstay::before { background: var(--accent); }
.pile-cell.r-occupied { opacity: 0.8; }
.pile-cell.r-occupied::before { background: var(--ink-lo); }
.pile-cell.r-fault {
  background: var(--danger-soft); border-color: rgba(229, 72, 77, 0.5);
  color: var(--danger); animation: faultBlink 1.2s infinite;
}
.pile-cell.r-fault::before { background: var(--danger); }
.pile-cell.r-stale { border-style: dashed; opacity: 0.85; }
.pile-cell.r-reserved { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.5); color: #1d4ed8; }
.pile-cell.r-reserved::before { background: #3b82f6; }
.rc-name { font-size: 0.72rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-state { font-size: 0.62rem; font-weight: 400; opacity: 0.85; }
.real-hb {
  font-size: 0.56rem; font-weight: 400; padding: 1px 6px; border-radius: 99px;
  font-family: var(--font-sans); letter-spacing: 0.02em;
}
.hb-fresh { background: rgba(0, 168, 120, 0.14); color: var(--primary-deep); }
.hb-stale { background: var(--accent-soft); color: #9a6206; }
.hb-never { background: var(--surface-3); color: var(--ink-lo); }

/* ==================== 成本收益报表（扩展项 4c，2026-10-23） ==================== */
.cost-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cost-kpi { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.cost-kpi .k { font-size: 0.78rem; color: var(--ink-lo); }
.cost-kpi .v { font-size: 1.35rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.cost-kpi .s { font-size: 0.75rem; color: var(--ink-lo); }
.cost-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.cost-chart-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.cost-chart-box h4 { margin: 0 0 8px; font-size: 0.85rem; color: var(--ink); }
.cost-chart-box svg { width: 100%; height: auto; display: block; }
.cost-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
