:root {
  --bg: #0f1419;
  --panel: #1a2330;
  --line: #2a3646;
  --text: #e7eef7;
  --muted: #8b9bb0;
  --accent: #3d8bfd;
  --danger: #e35d6a;
  --ok: #3dd68c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 ui-sans-serif, system-ui, sans-serif; }
a { color: var(--accent); }
button, input, select, textarea {
  font: inherit; color: var(--text); background: #121a24; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}
button { cursor: pointer; background: var(--accent); border-color: transparent; color: #fff; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: var(--danger); }
.layout { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side { padding: 20px 14px; border-right: 1px solid var(--line); background: #121821; }
.side h1 { font-size: 16px; margin: 0 0 20px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav button { text-align: left; background: transparent; border: 0; color: var(--muted); padding: 8px 10px; }
.nav button.active, .nav button:hover { background: var(--panel); color: var(--text); }
.main { padding: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.login { max-width: 360px; margin: 12vh auto; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #243044; font-size: 12px; }
.err { color: var(--danger); margin: 8px 0; }
.ok { color: var(--ok); }
input, select, textarea { min-width: 160px; }
textarea { width: 100%; min-height: 80px; }
.pill.warn { background: #3a2f12; color: #f0b429; }
.pill.danger { background: #3a1820; color: #ff8a96; }
.pill.ok { background: #143325; color: #3dd68c; }
/* 可点的数字/标签：AI 页「未生效命中」「生效命中」两列的数字点开看命中的请求。
   不做成按钮是为了不把表格挤乱，但要有明确的可点反馈。 */
.link { cursor: pointer; }
.link:hover { filter: brightness(1.3); text-decoration: underline; }
/* 「未生效命中」点开后的明细行：压暗底色，和上面那条规则分开 */
tr.hit-row > td { background: #0f1620; padding: 12px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.page-head h2 { margin: 0 0 4px; font-size: 20px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { background: #121a24; color: var(--muted); border: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: linear-gradient(180deg, #1e2836, var(--panel)); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-height: 92px; }
.stat .n { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 6px; }
.stat .s { color: var(--muted); font-size: 11px; margin-top: 4px; }
.stat.block .n { color: var(--danger); }
.stat.ban .n { color: #f0b429; }
.stat.ok .n { color: var(--ok); }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.grid-2.equal { grid-template-columns: 1fr 1fr; }
.chart-wrap { height: 180px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; }
/* 报表的「攻击源 TOP」「命中规则 TOP」整行可点：点进攻击日志并按这个来源/规则筛。
   两张卡片共用同一个网格——第 4 格是固定的「日志 →」入口（不放在 .k 里，否则长规则名
   一截断就看不到"能点"），第 5 格是行内动作（封禁按钮），没有动作的那张留空。 */
.bar-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.5fr) 52px 48px 72px; gap: 10px; align-items: center; margin: 10px 0; }
.bar-row .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.bar-track { height: 8px; background: #121a24; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #3d8bfd, #7cb1ff); }
.bar-fill.hot { background: linear-gradient(90deg, #e35d6a, #f0a1a9); }
.bar-row.clickable { cursor: pointer; padding: 2px 8px; margin: 8px -8px; border-radius: 8px; }
.bar-row.clickable:hover { background: #131c27; }
.bar-row.clickable:hover .k { color: #fff; }
.bar-row.clickable .goto { color: var(--muted); font-size: 12px; }
.bar-row.clickable:hover .goto { color: var(--accent); }
.donut { display: flex; align-items: center; gap: 18px; }
.donut svg { width: 120px; height: 120px; }
.donut-list { display: flex; flex-direction: column; gap: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }
.tiny { font-size: 12px; }
td.nowrap { white-space: nowrap; }
/* 攻击日志的「内容」列：可能很长（攻击 payload、误报上报的说明），截断显示、悬浮看全文 */
td.payload { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
@media (max-width: 980px) {
  .stats, .grid-2, .grid-2.equal { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
}
.warn-banner { background: rgba(240, 180, 41, .12); border: 1px solid rgba(240, 180, 41, .45); color: #f0b429; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
/* 攻击日志的筛选条与翻页条：标签在上、控件在下，窄屏自动换行 */
.filters { margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.filters input, .filters select { min-width: 150px; padding: 6px 8px; }
.pager { margin-top: 12px; justify-content: flex-end; align-items: center; }
button:disabled { opacity: .45; cursor: not-allowed; }
