/* ============ 有谱实验室 · 静态演示版共用样式 ============
   每个演示页只需在自己的 <style> 里覆盖 :root 变量（品牌色、背景、字体），
   其余布局与组件直接复用。所有数据均为虚构。 */
:root {
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: rgba(37, 99, 235, .10);
  --on-brand: #ffffff;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e3e8f0;
  --text: #17223a;
  --muted: #6b7690;
  --ok: #16a34a; --ok-soft: rgba(22, 163, 74, .12);
  --warn: #d97706; --warn-soft: rgba(217, 119, 6, .14);
  --bad: #dc2626; --bad-soft: rgba(220, 38, 38, .12);
  --info: #0284c7; --info-soft: rgba(2, 132, 199, .12);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --sidebar-w: 224px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }

/* ---------- 顶部演示提示条 ---------- */
.demo-bar {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 6px 16px; font-size: 12.5px;
  background: #0b0f17; color: #c7d0de;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.demo-bar b { color: #34e0b4; font-weight: 700; }
.demo-bar a { color: #38bdf8; }
.demo-bar .sep { opacity: .35; }

/* ---------- 登录页 ---------- */
.login {
  min-height: calc(100vh - 32px);
  display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(700px 400px at 10% 0%, var(--brand-soft), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, var(--brand-soft), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 420px; padding: 36px 34px 30px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 20px 60px rgba(16, 24, 40, .10);
}
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-card .brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--on-brand); display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.login-card h1 { font-size: 20px; }
.login-card .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.login-card .lead { color: var(--muted); font-size: 13px; margin: 8px 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface); }
.login-hint {
  margin: 4px 0 16px; padding: 10px 12px; border-radius: 10px;
  background: var(--brand-soft); color: var(--text); font-size: 12.5px; line-height: 1.6;
}
.login-hint code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: var(--brand-2); }
.login-foot { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--brand); color: var(--on-brand); transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); filter: none; }
.btn.soft { background: var(--brand-soft); color: var(--brand-2); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.danger { background: var(--bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 应用壳 ---------- */
.app { display: none; min-height: calc(100vh - 32px); }
.app.on { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 32px; height: calc(100vh - 32px); overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; font-weight: 800; font-size: 15px; }
.sidebar .brand .brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--on-brand); display: grid; place-items: center; font-size: 15px;
}
.sidebar .brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.sidebar .group { font-size: 11px; letter-spacing: .12em; color: var(--muted); padding: 14px 10px 6px; text-transform: uppercase; }
.sidebar a.nav {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--text); font-weight: 500; font-size: 14px; transition: background .15s, color .15s;
}
.sidebar a.nav .ic { width: 20px; text-align: center; font-size: 15px; opacity: .85; }
.sidebar a.nav:hover { background: var(--surface-2); }
.sidebar a.nav.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 700; }
.sidebar a.nav .cnt { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.sidebar a.nav.active .cnt { background: var(--brand); color: var(--on-brand); }
.sidebar .spacer { flex: 1; }
.sidebar .me {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.sidebar .me .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.sidebar .me b { display: block; color: var(--text); font-size: 13.5px; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 32px; z-index: 50;
}
.topbar h2 { font-size: 18px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.topbar .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.content { padding: 24px 28px 48px; }

/* ---------- 视图切换 ---------- */
.view { display: none; }
.view.active { display: block; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h3 { font-size: 20px; }
.view-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.view-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 网格与卡片 ---------- */
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-head h4 { font-size: 14.5px; }
.panel-head .more { font-size: 12.5px; color: var(--muted); }
.panel-body { padding: 16px 18px; }
.panel-body.tight { padding: 0; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .k .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .d.up { color: var(--ok); } .stat .d.down { color: var(--bad); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted { color: var(--muted); }
.table .strong { font-weight: 600; }

/* ---------- 标签 / 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--brand-soft); color: var(--brand-2);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.gray { background: var(--surface-2); color: var(--muted); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 12px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 列表 ---------- */
.list { list-style: none; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.list .t { flex: 1; min-width: 0; }
.list .t b { display: block; font-weight: 600; font-size: 13.5px; }
.list .t span { color: var(--muted); font-size: 12.5px; }
.list .ic {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--brand-soft); display: grid; place-items: center; font-size: 16px;
}

/* ---------- 进度条 ---------- */
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  padding: 9px 14px; border: none; background: none; cursor: pointer; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button.active { color: var(--brand-2); border-bottom-color: var(--brand); }
.tab-pane { display: none; } .tab-pane.active { display: block; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none;
}
.field textarea { min-height: 90px; resize: vertical; }
.field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.callout {
  padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.6;
  border-left: 3px solid var(--brand); background: var(--brand-soft);
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout b { font-weight: 700; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 300; background: rgba(10, 14, 22, .45);
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-mask.on { display: flex; }
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 16px; border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25); animation: fadeUp .2s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h4 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  z-index: 400; padding: 10px 18px; border-radius: 10px; font-size: 13.5px;
  background: #17223a; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 空状态 / 小工具 ---------- */
.empty { text-align: center; color: var(--muted); padding: 36px 12px; font-size: 13.5px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.right { text-align: right; }
.hide { display: none !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .app.on { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    padding: 10px 12px; gap: 6px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .sidebar .brand { padding: 4px 8px; white-space: nowrap; }
  .sidebar .brand small, .sidebar .group, .sidebar .spacer, .sidebar .me { display: none; }
  .sidebar a.nav { white-space: nowrap; padding: 7px 10px; font-size: 13px; }
  .topbar { padding: 12px 16px; position: static; }
  .content { padding: 16px 16px 40px; }
  .grid.c2, .grid.c3, .grid.c4, .grid.side { grid-template-columns: minmax(0, 1fr); }
  .grid > * { min-width: 0; }
  .panel { min-width: 0; max-width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .kv { grid-template-columns: 80px 1fr; }
}
