/* =========================================================
   哦维智能评分 · 后台样式
   清晰明亮 · 电光蓝(#3d5afe) + 青(#06b6d4) · 科技网格
========================================================= */
:root {
  --font-display: "Sora", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

  --brand-100: #e0e7ff;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #3d5afe;
  --brand-600: #304ffe;
  --brand-700: #2540e0;

  --bg-app: #f6f8fc;
  --bg-card: #ffffff;
  --bg-soft: #f0f3f9;
  --border-soft: #e4e8f0;
  --border-strong: #cbd5e1;

  --text-strong: #0b1230;
  --text-body: #1f2945;
  --text-muted: #5b6478;
  --text-faint: #8a93a6;

  --success: #16a34a;
  --success-bg: #d6f5e1;
  --danger: #ef4444;
  --danger-bg: #ffe1e1;

  --grad-electric: linear-gradient(135deg, #3d5afe, #06b6d4);
  --grad-iso: linear-gradient(135deg, #e8eeff, #d8e6ff);
  --grad-aero: radial-gradient(1200px 480px at 0% 0%, rgba(61,90,254,.06), transparent 55%),
               radial-gradient(900px 400px at 100% 100%, rgba(6,182,212,.06), transparent 55%);

  --shadow-soft: 0 6px 22px -10px rgba(11,18,48,.10), 0 2px 8px -4px rgba(11,18,48,.06);
  --shadow-brand: 0 14px 38px -16px rgba(61,90,254,.32), 0 4px 12px -6px rgba(61,90,254,.18);

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 22px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 14px; line-height: 1.55;
  color: var(--text-body); background: var(--bg-app);
  -webkit-font-smoothing: antialiased; min-height: 100vh; position: relative;
}
/* 科技网格背景 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    linear-gradient(rgba(61,90,254,.045) 1px, transparent 1px) 0 0/56px 56px,
    linear-gradient(90deg, rgba(61,90,254,.045) 1px, transparent 1px) 0 0/56px 56px,
    var(--grad-aero);
  -webkit-mask-image: radial-gradient(1100px 700px at 30% 20%, #000 38%, transparent 78%);
  mask-image: radial-gradient(1100px 700px at 30% 20%, #000 38%, transparent 78%);
}
a { color: var(--brand-600); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.grad-text {
  background: var(--grad-electric); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 6px; }

/* ---------------- 品牌标识 ---------------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--grad-electric); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  box-shadow: var(--shadow-brand);
}
.brand-text h1 { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text-strong); letter-spacing: -.01em; }
.brand-text p { font-size: 11.5px; color: var(--text-muted); letter-spacing: .04em; margin-top: 2px; }

/* ---------------- 登录页 ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.login-card {
  width: 100%; max-width: 400px; background: var(--bg-card);
  border: 1px solid var(--border-soft); border-radius: var(--r-xl);
  padding: 42px 36px; box-shadow: var(--shadow-soft);
}
.login-card .brand { margin-bottom: 30px; }
.login-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-strong); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 26px; }

.field { margin-bottom: 17px; }
.field label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 7px; font-weight: 500; }
.field input {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border-soft);
  border-radius: var(--r-sm); padding: 12px 14px; color: var(--text-strong); font-size: 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s;
}
.field input:focus { outline: none; background: #fff; border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(61,90,254,.14); }

.btn {
  width: 100%; background: var(--grad-electric); color: #fff; border: none;
  border-radius: var(--r-sm); padding: 13px; font-size: 14.5px; font-weight: 650;
  font-family: var(--font-display); letter-spacing: .02em;
  box-shadow: var(--shadow-brand); transition: filter .18s, transform .05s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-ghost {
  background: #fff; border: 1px solid var(--border-soft); color: var(--text-body);
  border-radius: var(--r-sm); padding: 8px 14px; font-size: 13px; font-weight: 550; width: auto;
  transition: border-color .18s, color .18s, background .18s;
}
.btn-ghost:hover { border-color: var(--brand-400); color: var(--brand-600); background: var(--bg-soft); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; width: auto; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

.msg { font-size: 13px; margin-top: 14px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }

/* ---------------- 后台布局 ---------------- */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg-card);
  border-right: 1px solid var(--border-soft); padding: 22px 16px;
  display: flex; flex-direction: column;
}
.sidebar .brand { margin-bottom: 24px; padding: 4px 6px 18px; border-bottom: 1px dashed var(--border-soft); }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; font-size: 13.5px; color: var(--text-body);
  transition: background .2s var(--ease), color .2s var(--ease); cursor: pointer;
}
.nav a svg { width: 18px; height: 18px; opacity: .75; flex-shrink: 0; }
.nav a:hover { background: var(--bg-soft); color: var(--text-strong); }
.nav a.active {
  background: linear-gradient(135deg, rgba(61,90,254,.10), rgba(6,182,212,.06));
  color: var(--brand-600); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(61,90,254,.16);
}
.nav a.active svg { opacity: 1; color: var(--brand-500); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex-shrink: 0; background: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.topbar h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text-strong); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { font-size: 13px; color: var(--text-muted); }
.who b { color: var(--text-strong); font-weight: 600; }
.content { padding: 26px 28px; overflow: auto; }

.view { display: none; }
.view.active { display: block; animation: fade .22s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------------- KPI 卡片 ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 20px 22px; box-shadow: var(--shadow-soft); position: relative; overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; right: 0; width: 100px; height: 100px;
  background: var(--grad-iso); opacity: .55; border-radius: 0 0 0 100%; pointer-events: none;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-brand); border-color: rgba(61,90,254,.2); }
.kpi-card .lbl { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); letter-spacing: .06em; margin-bottom: 9px; position: relative; z-index: 1; }
.kpi-card .num { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--text-strong); letter-spacing: -.025em; line-height: 1.1; position: relative; z-index: 1; }
.kpi-card .num .ok { color: var(--success); }
.kpi-card .num .bad { color: var(--danger); }
.kpi-card .num .sep { color: var(--text-faint); font-size: 20px; font-weight: 400; }

.panel {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow-soft);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-head h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text-strong); }
.panel-head .sub { font-size: 12px; color: var(--text-faint); }

.chart-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
@media (max-width: 980px) { .chart-row { grid-template-columns: 1fr; } }
canvas { width: 100%; display: block; }

.rank { display: flex; flex-direction: column; gap: 13px; }
.rank-item .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.rank-item .top .c { font-family: var(--font-mono); color: var(--text-muted); }
.bar { height: 8px; background: var(--bg-soft); border-radius: 5px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad-electric); border-radius: 5px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; letter-spacing: .04em; white-space: nowrap; }
td { color: var(--text-body); }
td.payload { font-family: var(--font-mono); color: var(--text-muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: var(--bg-soft); }
.score-val { font-family: var(--font-display); font-weight: 700; color: var(--brand-600); font-size: 14px; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.tag.ok, .tag.on { background: var(--success-bg); color: var(--success); }
.tag.bad, .tag.off { background: var(--danger-bg); color: var(--danger); }
.tag.off { background: #eef0f4; color: var(--text-faint); }

.token-cell { font-family: var(--font-mono); font-size: 12px; color: var(--brand-600); max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.token-cell:hover { text-decoration: underline; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
select, .toolbar input {
  background: var(--bg-soft); border: 1px solid var(--border-soft); color: var(--text-body);
  border-radius: var(--r-sm); padding: 8px 11px; font-size: 13px;
}
select:focus, .toolbar input:focus { outline: none; border-color: var(--brand-400); background: #fff; }
.empty { text-align: center; color: var(--text-faint); padding: 44px 0; font-size: 14px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(11,18,48,.45); backdrop-filter: blur(3px);
  display: none; place-items: center; z-index: 50; padding: 20px;
}
.modal-mask.show { display: grid; animation: fade .18s var(--ease); }
.modal {
  width: 100%; max-width: 440px; background: var(--bg-card);
  border: 1px solid var(--border-soft); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--shadow-brand);
}
.modal h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text-strong); margin-bottom: 8px; }
.modal .modal-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.6; }
.modal .field input { font-size: 13.5px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.modal-actions .btn { width: auto; padding: 10px 20px; }
.modal-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; }
.modal-icon.warn { background: var(--danger-bg); color: var(--danger); }
.modal-icon svg { width: 24px; height: 24px; }

.token-box {
  background: var(--bg-soft); border: 1px dashed var(--brand-400); border-radius: var(--r-sm);
  padding: 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--brand-700);
  word-break: break-all; margin: 12px 0;
}

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-strong); color: #fff; padding: 12px 22px; border-radius: var(--r-md);
  font-size: 13.5px; box-shadow: var(--shadow-brand); opacity: 0; transition: all .25s var(--ease);
  z-index: 100; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .sidebar { width: 66px; padding: 18px 8px; }
  .sidebar .brand-text, .nav a span { display: none; }
  .nav a { justify-content: center; }
  .content { padding: 18px 14px; }
  .topbar { padding: 0 16px; }
}
