/* ===================================================================
   admin.css · 情报雷达后台控制台
   独立样式，不复用前台 intel.css —— 后台是深色监控台，与前台产品分离
   =================================================================== */

:root {
  --bg: #0b1020;
  --bg-2: #111834;
  --panel: #151d3a;
  --panel-2: #1b2547;
  --line: #26325c;
  --text: #e8edfb;
  --muted: #8b9ac4;
  --accent: #4f8cff;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"], :root[data-theme="light"] {
    --bg: #f4f6fb; --bg-2: #eaeef7; --panel: #fff; --panel-2: #f7f9fd;
    --line: #e2e8f4; --text: #0f172a; --muted: #64748b;
    --shadow: 0 8px 24px rgba(15, 23, 42, .07);
  }
}
:root[data-theme="light"] {
  --bg: #f4f6fb; --bg-2: #eaeef7; --panel: #fff; --panel-2: #f7f9fd;
  --line: #e2e8f4; --text: #0f172a; --muted: #64748b;
  --shadow: 0 8px 24px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h3 { margin: 0 0 12px; font-size: 14.5px; font-weight: 650; letter-spacing: .2px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
h3 em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted); }
h3 small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12px; }

/* ───────────────── 登录 ───────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 34px 30px; box-shadow: var(--shadow); text-align: center;
}
.login-logo { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.login-box h1 { margin: 0 0 4px; font-size: 19px; font-weight: 680; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-box input {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 14px; outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-box button {
  width: 100%; margin-top: 12px; padding: 11px; border-radius: 10px; border: 0;
  background: linear-gradient(135deg, var(--accent), #7c5cff); color: #fff;
  font-size: 14.5px; font-weight: 650; cursor: pointer;
}
.login-box button:hover { filter: brightness(1.08); }
.login-box button:disabled { opacity: .6; cursor: default; }
.login-err { min-height: 20px; margin-top: 10px; color: var(--danger); font-size: 13px; }
.login-hint { margin-top: 12px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }

/* ───────────────── 布局 ───────────────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.tb-brand { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.tb-logo { font-size: 18px; }
.tb-ver { color: var(--muted); font-size: 12px; font-weight: 400; }
.tb-stats { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.tb-stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 4px 11px; min-width: 74px; text-align: center;
}
.tb-stat i { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); }
.tb-stat b { font-size: 16px; font-weight: 680; font-variant-numeric: tabular-nums; }
.tb-actions { display: flex; gap: 6px; align-items: center; }
.tb-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); cursor: pointer; font-size: 14px; display: grid; place-items: center; text-decoration: none;
}
.tb-btn:hover { border-color: var(--accent); color: var(--accent); }
.tb-btn.tb-danger:hover { border-color: var(--danger); color: var(--danger); }
.tb-select {
  height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 0 8px; font-size: 12.5px; cursor: pointer;
}

.body { flex: 1; display: flex; min-height: 0; }
.side {
  width: 168px; flex: none; padding: 14px 10px; border-right: 1px solid var(--line);
  background: var(--bg-2); display: flex; flex-direction: column; gap: 3px;
}
.side-i {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px;
  cursor: pointer; text-align: left; width: 100%;
}
.side-i span { font-size: 14px; }
.side-i:hover { background: var(--panel); color: var(--text); }
.side-i.on { background: var(--panel); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; padding: 10px 11px; color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.main { flex: 1; padding: 18px; overflow: auto; min-width: 0; }
.sec { display: none; }
.sec.on { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ───────────────── 卡片 / 网格 ───────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) {
  .grid-4, .grid-5, .two, .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .grid-4, .grid-5, .two, .grid-3 { grid-template-columns: 1fr; }
  .side { width: 60px; }
  .side-i { justify-content: center; }
  .side-i:not(.on) { font-size: 0; }
  .side-foot { display: none; }
}

.kpi { text-align: left; margin-bottom: 0; }
.kpi i { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); }
.kpi b { display: block; font-size: 27px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi s { display: block; text-decoration: none; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ───────────────── 表格 ───────────────── */
.tbl-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 9px; }
.tbl-wrap.tall { max-height: 560px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  position: sticky; top: 0; z-index: 2; background: var(--panel-2); color: var(--muted);
  text-align: left; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }
.tbl .mut { color: var(--muted); }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); background: var(--panel-2); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.pill.info { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); }

/* ───────────────── 条形图 ───────────────── */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 170px) 1fr 54px; gap: 10px; align-items: center; }
.bar-lbl { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--panel-2); border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  min-width: 3px; transition: width .4s ease;
}
.bar-val { font-size: 12px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 12.5px; padding: 14px 2px; }

/* ───────────────── 图表 ───────────────── */
.chart { width: 100%; overflow: hidden; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .lb { fill: var(--muted); font-size: 10px; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln2 { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ar { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.chart .dot2 { fill: var(--accent-2); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* ───────────────── 事件流 ───────────────── */
.feed { max-height: 430px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.feed-item {
  display: grid; grid-template-columns: 62px 78px 1fr; gap: 9px; align-items: baseline;
  padding: 5px 8px; border-radius: 7px; background: var(--panel-2); font-size: 12px;
  animation: slide .2s ease;
}
@keyframes slide { from { opacity: 0; transform: translateX(-5px); } to { opacity: 1; transform: none; } }
.feed-t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.feed-k { font-size: 10.5px; padding: 0 6px; border-radius: 999px; text-align: center; border: 1px solid var(--line); }
.feed-k.view { color: var(--accent-2); }
.feed-k.click { color: var(--accent); }
.feed-k.search { color: var(--warn); }
.feed-k.error { color: var(--danger); }
.feed-x { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────────────── 控件 ───────────────── */
.row-ctl { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.row-ctl:last-of-type { border-bottom: 0; }
.ctl-txt b { display: block; font-size: 13.5px; font-weight: 600; }
.ctl-txt s { display: block; text-decoration: none; color: var(--muted); font-size: 12px; margin-top: 1px; }
.sw { position: relative; flex: none; width: 40px; height: 22px; margin-top: 1px; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw span {
  position: absolute; inset: 0; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; transition: .16s;
}
.sw span::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); top: 2px; left: 2px; transition: .16s;
}
.sw input:checked + span { background: color-mix(in srgb, var(--accent) 32%, transparent); border-color: var(--accent); }
.sw input:checked + span::before { transform: translateX(18px); background: var(--accent); }
.sw input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.blk { display: block; margin: 11px 0; font-size: 12.5px; color: var(--muted); }
.blk input, .blk textarea, .blk select, .grid-3 input, .grid-2 input, .grid-2 select {
  display: block; width: 100%; margin-top: 5px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.blk textarea { resize: vertical; font-family: inherit; }
.blk input:focus, .blk textarea:focus, .blk select:focus { border-color: var(--accent); }
.ctl-nums { margin: 14px 0; }
.ctl-nums label { font-size: 12.5px; color: var(--muted); }
.ctl-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.btn {
  padding: 8px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #7c5cff); border-color: transparent; color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.ctl-msg { font-size: 12.5px; color: var(--muted); }
.ctl-msg.ok { color: var(--ok); }
.ctl-msg.err { color: var(--danger); }

.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tg {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer;
}
.tg:hover { border-color: var(--accent); }
.tg .ico { font-size: 15px; }
.tg .tx b { display: block; font-size: 13px; font-weight: 600; }
.tg .tx s { display: block; text-decoration: none; font-size: 11.5px; color: var(--muted); }
.tg.off { opacity: .45; }

.tool-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed var(--line);
}
.tool-row:last-child { border-bottom: 0; }
.tool-row b { display: block; font-size: 13.5px; }
.tool-row s { display: block; text-decoration: none; color: var(--muted); font-size: 12px; }
.notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.notes b { color: var(--text); }
.list-plain { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; }
.list-plain .row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.list-plain .row:last-child { border-bottom: 0; }
.list-plain .mut { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2);
  font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px;
}
.chip em { font-style: normal; color: var(--muted); font-size: 11px; }

/* ───────────────── toast ───────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(14px);
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 9px 18px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: .22s; box-shadow: var(--shadow); z-index: 99; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
