/* 万邦 SmartSandbox — 数智驾驶舱 PC 端 */
:root {
  --bg: #070b12;
  --bg-elevated: #0d121c;
  --sidebar: #0a101a;
  --card: #111827;
  --card-hover: #151f30;
  --border: #1e293b;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #38bdf8;
  --accent-dim: #0ea5e933;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --purple: #a78bfa;
  --gradient: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #a855f7 100%);
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.console-app { display: flex; min-height: 100vh; }

/* —— 侧栏 —— */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
}
.brand {
  display: flex; gap: 12px; align-items: center;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.brand-title { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 4px;
  border-radius: 8px; color: var(--muted);
  text-decoration: none; transition: .15s;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid #0ea5e944;
}
.nav-icon { width: 20px; text-align: center; opacity: .85; }
.sidebar-foot {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; font-size: 12px;
}
.sidebar-foot a { color: var(--muted); text-decoration: none; }
.sidebar-foot a:hover { color: var(--accent); }

/* —— 主区 —— */
.main-area {
  flex: 1; margin-left: var(--sidebar-w);
  min-width: 0; display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(13,18,28,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-left: 12px; }
.topbar-left { display: flex; align-items: baseline; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pulse { color: var(--ok); font-size: 10px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); padding: 6px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.content-area { padding: 20px 24px 40px; flex: 1; }

/* —— Tab —— */
.tab-bar {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 4px;
  background: var(--bg-elevated); border-radius: 10px;
  border: 1px solid var(--border);
}
.tab-btn {
  padding: 8px 16px; border: none; background: transparent;
  color: var(--muted); border-radius: 8px; cursor: pointer;
  font-size: 13px; transition: .15s;
}
.tab-btn:hover { color: var(--text); background: var(--card); }
.tab-btn.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px #0ea5e933;
}
.tab-pane { display: none; animation: fadeIn .25s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

/* —— KPI 卡片 —— */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.kpi-card:hover { border-color: #334155; transform: translateY(-1px); }
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient); opacity: .7;
}
.kpi-card b {
  display: block; font-size: 1.75rem; font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.kpi-card span { font-size: 12px; color: var(--muted); }
.kpi-card .spark {
  height: 28px; margin-top: 8px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
  border-radius: 4px; opacity: .6;
}

/* 兼容旧 stat 类 */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.stat b { display: block; font-size: 1.5rem; color: var(--accent); }
.stat span { font-size: 12px; color: var(--muted); }

/* —— 双栏布局 —— */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 16px;
}
@media (max-width: 1100px) { .split-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 12px; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.panel h2 .tag {
  font-size: 11px; font-weight: 400; color: var(--muted);
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.sub { color: var(--muted); font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0; line-height: 1.6; }

/* —— 可视化条 —— */
.viz-row { margin-bottom: 12px; }
.viz-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.viz-bar {
  height: 8px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden;
}
.viz-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  transition: width .6s ease;
}

.feedback-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 12px 0; padding: 10px 0; border-top: 1px solid var(--border);
}
.feedback-bar label { font-size: 12px; color: var(--muted); }
.feedback-bar select, .feedback-bar input {
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 6px 8px; font-size: 12px;
}
.feedback-bar input { flex: 1; min-width: 120px; }

/* —— 表格 —— */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:hover td { background: rgba(255,255,255,.02); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.s-pending { background: #422006; color: var(--warn); }
.s-ok { background: #064e3b; color: var(--ok); }
.s-bad { background: #450a0a; color: var(--bad); }

button { cursor: pointer; border: none; border-radius: 8px; padding: 6px 12px; font-size: 12px; margin-right: 6px; }
.btn-ok { background: #0284c7; color: #fff; }
.btn-ok:hover { background: #0ea5e9; }
.btn-no { background: #334155; color: #fff; }
.msg { margin-top: 8px; font-size: 12px; color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; }

input, select, textarea {
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text); font-size: 13px;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input { flex: 1; min-width: 200px; }

.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 200;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 720px; width: 100%;
  max-height: 85vh; overflow: auto; padding: 20px;
}
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal pre {
  white-space: pre-wrap; word-break: break-word;
  font-size: 12px; background: var(--bg-elevated);
  padding: 12px; border-radius: 8px; border: 1px solid var(--border);
}

#trace-output {
  font-size: 12px; background: var(--bg-elevated);
  padding: 12px; border-radius: 8px; max-height: 280px;
  overflow: auto; border: 1px solid var(--border);
}
.panel pre, #detail {
  white-space: pre-wrap; font-size: 12px;
  background: var(--bg-elevated); padding: 12px;
  border-radius: 8px; border: 1px solid var(--border);
  max-height: 360px; overflow: auto;
}
