/* ============================================================
   妙淘算电协同 · 数据驾驶舱 样式
   暗色科技风 / 作战室
   ============================================================ */
:root {
  --green: #00e08a;
  --green-2: #00b96b;
  --cyan: #2fe6e6;
  --blue: #4d9bff;
  --blue-2: #1677ff;
  --amber: #ffb547;
  --red: #ff5d6c;
  --bg: #050d10;
  --bg-2: #08171b;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-border: rgba(0, 224, 138, 0.16);
  --panel-glow: rgba(0, 224, 138, 0.08);
  --ink: #e8f6f0;
  --ink-2: #9fc4ba;
  --muted: #5f7d76;
  --grid-line: rgba(255, 255, 255, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Hiragino Sans GB", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(22, 119, 255, 0.14), transparent 60%),
    radial-gradient(1000px 600px at 0% 110%, rgba(0, 224, 138, 0.12), transparent 60%);
  line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh;
  padding: 0 22px 40px;
}
a { color: inherit; text-decoration: none; }

/* ===== 顶部状态栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 16px 4px; margin-bottom: 22px;
  background: linear-gradient(180deg, rgba(5, 13, 16, 0.95), rgba(5, 13, 16, 0.7));
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--panel-border);
}
.topbar__brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--green), var(--blue)); font-size: 20px;
  box-shadow: 0 0 22px rgba(0, 224, 138, 0.4);
}
.topbar__title { font-size: 19px; font-weight: 800; letter-spacing: .5px; }
.topbar__sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.topbar__status { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
  padding: 7px 14px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--panel-border); color: var(--ink-2);
}
.pill b { color: var(--green); font-family: var(--mono); }
.pill--live { color: var(--green); }
.pill--clock { font-family: var(--mono); color: var(--ink); letter-spacing: 1px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 1.6s infinite; }
.dot--live { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.back { font-size: 13px; color: var(--ink-2); border: 1px solid var(--panel-border); padding: 8px 14px; border-radius: 999px; transition: .2s; }
.back:hover { color: var(--green); border-color: var(--green); }

/* ===== KPI ===== */
.kpis {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 22px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px;
  padding: 18px 18px 16px; position: relative; overflow: hidden;
  box-shadow: inset 0 0 30px var(--panel-glow);
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); opacity: .7; }
.kpi__label { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi__icon { font-size: 15px; }
.kpi__num { font-size: 26px; font-weight: 800; font-family: var(--mono); margin-top: 10px; letter-spacing: .5px; color: #fff; }
.kpi__num small { font-size: 14px; color: var(--ink-2); font-weight: 600; margin-left: 2px; }
.kpi__delta { font-size: 12px; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.kpi__delta.up { color: var(--green); }
.kpi__delta.down { color: var(--red); }
.kpi__spark { position: absolute; right: 10px; bottom: 8px; width: 64px; height: 26px; opacity: .8; }

/* ===== 通用面板 ===== */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px;
  padding: 18px; box-shadow: inset 0 0 30px var(--panel-glow); position: relative;
}
.panel--lg { grid-column: span 2; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel__head h3 { font-size: 15.5px; font-weight: 700; color: #fff; }
.panel__hint { font-size: 11.5px; color: var(--muted); }
.panel__body { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart--sm { height: 120px; }

/* 图例 */
.legend { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw--load { background: var(--amber); }
.sw--compute { background: var(--cyan); }

/* 环形图 */
.donut-wrap { display: flex; flex-direction: column; align-items: center; }
.donut { width: 180px; height: 180px; }
.donut-center { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); text-align: center; margin-top: 34px; pointer-events: none; }
.donut-center__num { font-size: 28px; font-weight: 800; font-family: var(--mono); color: #fff; }
.donut-center__label { font-size: 11px; color: var(--muted); }
.legend-list { list-style: none; width: 100%; margin-top: 14px; display: grid; gap: 8px; }
.legend-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); }
.legend-list .lg-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-list .lg-val { margin-left: auto; font-family: var(--mono); color: var(--ink); font-weight: 700; }
.legend-list .lg-pct { color: var(--muted); font-size: 12px; width: 46px; text-align: right; }

/* 大数字 */
.big-num { font-size: 30px; font-weight: 800; font-family: var(--mono); color: var(--green); text-shadow: 0 0 18px rgba(0, 224, 138, .4); }
.sub { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.sub b { color: var(--cyan); font-family: var(--mono); }

/* ===== 底部 ===== */
.bottom { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.panel--stream .stream { list-style: none; max-height: 340px; overflow: hidden; display: flex; flex-direction: column; gap: 8px; }
.evt {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--green); font-size: 13px;
  animation: slideIn .5s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.evt__time { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.evt__txt { color: var(--ink); }
.evt__txt b { color: #fff; }
.evt__amt { font-family: var(--mono); font-weight: 700; color: var(--green); }
.evt--settle { border-left-color: var(--blue); }
.evt--settle .evt__amt { color: var(--blue); }
.evt--dispatch { border-left-color: var(--cyan); }
.evt--dispatch .evt__amt { color: var(--cyan); }
.evt--bid { border-left-color: var(--amber); }
.evt--bid .evt__amt { color: var(--amber); }
.evt--carbon { border-left-color: var(--green-2); }
.evt--carbon .evt__amt { color: var(--green-2); }

/* 调度仪表 */
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gauge { text-align: center; }
.gauge__ring { position: relative; width: 104px; height: 104px; margin: 0 auto; }
.gauge__ring svg { transform: rotate(-90deg); }
.gauge__val { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: 20px; color: #fff; }
.gauge__label { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }

.cockpit-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .panel--lg { grid-column: span 2; }
  .bottom { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .panel--lg { grid-column: span 1; }
  .gauges { grid-template-columns: 1fr 1fr; }
  .topbar__status { width: 100%; margin-left: 0; }
  body { padding: 0 14px 30px; }
}
