/* AI 监控中心 — 严格对齐参考站宽屏布局 */
:root{
  --aim-blue:#2f6fed;
  --aim-bar-h:28px; /* 首页 bar 固定矮高度，对齐参考站细条 */
  --aim-bar-bg:linear-gradient(90deg,#eef5ff 0%,#f7faff 45%,#eef4ff 100%);
  --aim-bar-border:#d7e4f7;
}

#aim-root{position:relative;z-index:12000;}
#aim-root.aim-bar-hidden .aim-bar{display:none;}
#aim-root.aim-bar-hidden .aim-bar-spacer{height:0!important;min-height:0!important;}
#aim-root.aim-bar-hidden .aim-panel{top:0;max-height:100vh;}

/* —— 首页顶栏：固定 28px，禁止被内容撑高 —— */
.aim-bar{
  position:fixed;top:0;left:0;right:0;z-index:12030;
  height:var(--aim-bar-h);
  max-height:var(--aim-bar-h);
  overflow:hidden;
  background:var(--aim-bar-bg);
  border-bottom:1px solid var(--aim-bar-border);
  font:11px/var(--aim-bar-h) "Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  color:#334155;
  box-sizing:border-box;
}
.aim-bar-spacer{height:var(--aim-bar-h);min-height:var(--aim-bar-h);max-height:var(--aim-bar-h);}
.aim-bar-inner{
  max-width:1600px;margin:0 auto;padding:0 14px;
  height:100%;
  box-sizing:border-box;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  flex-wrap:nowrap;
}
.aim-bar-left,.aim-bar-mid,.aim-bar-right{
  display:flex;align-items:center;gap:12px;white-space:nowrap;flex-wrap:nowrap;
}
.aim-bar-mid{flex:1;justify-content:center;gap:18px;min-width:0;}
.aim-dot{
  width:5px;height:5px;border-radius:50%;background:var(--aim-blue);
  display:inline-block;margin-right:5px;vertical-align:middle;
  box-shadow:0 0 0 2px rgba(47,111,237,.14);
}
.aim-status-text{font-weight:600;color:#1e3a8a;font-size:11px;}
.aim-metric{display:inline-flex;align-items:center;gap:5px;font-size:11px;}
.aim-metric .aim-ico,
.aim-metric svg{
  /* 比参考站 14px 略放大，线框更清晰 */
  width:16px;height:16px;min-width:16px;color:var(--aim-blue);flex:0 0 auto;
  display:block;
}
.aim-metric b{color:var(--aim-blue);font-weight:700;font-variant-numeric:tabular-nums;}
.aim-lang{display:none!important;}
.aim-fw{color:#475569;font-size:11px;}
.aim-link{
  color:var(--aim-blue);cursor:pointer;font-weight:600;
  background:0;border:0;padding:0;font-size:11px;line-height:1;
}
.aim-link:hover{text-decoration:underline;}
.aim-close-x{
  width:16px;height:16px;border-radius:3px;border:1px solid #c9daf5;
  background:#fff;color:#64748b;cursor:pointer;line-height:14px;
  text-align:center;font-size:12px;padding:0;flex:0 0 auto;
}
.aim-close-x:hover{color:var(--aim-blue);border-color:var(--aim-blue);}

/*
 * 详情层（对齐参考 .ai-detail-panel）
 * - 贴顶栏下方，width:100%
 * - height:auto 随内容收口（关键：不拉满视口）
 * - max-height 限制，超出才滚动
 * - 面板结束后露出主站内容
 */
.aim-panel{
  display:none;
  position:fixed;
  left:0;right:0;
  top:var(--aim-bar-h);
  width:100%;
  z-index:12010;
  height:auto;
  max-height:calc(100vh - var(--aim-bar-h));
  overflow-x:hidden;
  overflow-y:auto;
  background:#050d1a;
  border-bottom:1px solid rgba(35,103,255,.48);
  box-shadow:0 18px 50px rgba(2,8,23,.38);
  color:#e2e8f0;
  font-family:"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  box-sizing:border-box;
}
.aim-panel.open{display:block;}

.aim-panel-inner{
  max-width:1600px;
  margin:0 auto;
  padding:12px 20px 14px;
  box-sizing:border-box;
}

.aim-panel-hd{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:10px;gap:12px;
}
.aim-panel-title{
  display:flex;align-items:center;gap:10px;
  margin:0;font-size:15px;font-weight:600;color:#e2e8f0;
}
.aim-badge{
  display:inline-flex;align-items:center;gap:6px;
  font-size:12px;font-weight:600;color:#bbf7d0;
  background:rgba(34,197,94,.12);border:1px solid rgba(34,197,94,.35);
  padding:2px 8px;border-radius:999px;
}
.aim-badge i{
  width:6px;height:6px;border-radius:50%;background:#22c55e;
  display:inline-block;
}
.aim-updated{font-size:12px;color:#94a3b8;}

/*
 * 宽屏网格（参考实测 1440）：
 * 12 列 × 2 行(202px)
 * 流量 1/5 行1 | 节点 5/8 行1 | 安全 8/11 行1 | 日志 11/13 跨两行
 * 访客 1/5 行2 | 负载 5/8 行2 | 受保护 8/11 行2
 */
.aim-grid{
  display:grid;
  grid-template-columns:repeat(12,minmax(0,1fr));
  grid-template-rows:202px 202px;
  gap:16px;
  margin-bottom:14px;
}
.aim-card{
  background:rgba(15,23,42,.95);
  border:1px solid rgba(35,103,255,.28);
  border-radius:8px;
  padding:16px 18px;
  box-sizing:border-box;
  overflow:hidden;
  min-width:0;
  display:flex;
  flex-direction:column;
}
.aim-card h4{
  margin:0 0 6px;font-size:12px;font-weight:600;color:#94a3b8;flex:0 0 auto;
}
.aim-card .aim-num{
  font-size:36px;font-weight:700;line-height:1.15;
  font-variant-numeric:tabular-nums;color:#f8fafc;flex:0 0 auto;
}
.aim-card .aim-sub{
  margin-top:auto;
  display:flex;align-items:flex-end;justify-content:space-between;gap:8px;
  font-size:12px;
}
.aim-up{color:#f5222d;}
.aim-down{color:#52c41a;}
.aim-flat{color:#f0a202;}
.aim-spark{width:100%;max-width:220px;height:40px;display:block;margin-left:auto;overflow:visible;flex:1 1 auto;}
.aim-card .aim-sub .aim-spark{min-width:160px;}
.aim-spark-line{
  stroke-dasharray:240;
  stroke-dashoffset:0;
  animation:aim-spark-draw .7s ease-out;
}
@keyframes aim-spark-draw{
  from{stroke-dashoffset:240;opacity:.35;}
  to{stroke-dashoffset:0;opacity:1;}
}
.aim-opt{font-size:12px;color:#52c41a;margin-left:8px;font-weight:600;}
.aim-node-cities{color:#722ed1;font-size:10px;font-weight:600;margin:2px 0 0;}
.aim-barline{
  margin-top:auto;height:6px;border-radius:3px;
  background:rgba(255,255,255,.08);overflow:hidden;
}
.aim-barline>i{
  display:block;height:100%;border-radius:3px;
  background:linear-gradient(90deg,#52c41a,#95de64);
}
.aim-sec-grade{font-size:36px;font-weight:700;color:#f8fafc;line-height:1.15;}
.aim-ok-txt{color:#52c41a;font-size:12px;margin-top:4px;}
.aim-sec-tag{
  display:inline-block;margin-top:auto;align-self:flex-start;
  padding:2px 10px;border-radius:4px;
  background:linear-gradient(90deg,#c9a227,#f0d078);
  color:#3b2a05;font-size:12px;font-weight:700;
}

.aim-c-traffic{grid-column:1 / 5;grid-row:1;}
.aim-c-visitors{grid-column:1 / 5;grid-row:2;}
.aim-c-nodes{grid-column:5 / 8;grid-row:1;}
.aim-c-security{grid-column:8 / 11;grid-row:1;}
.aim-c-load{grid-column:5 / 8;grid-row:2;}
.aim-c-protected{grid-column:8 / 11;grid-row:2;}
.aim-c-logs{
  grid-column:11 / 13;grid-row:1 / 3;
}

.aim-logs h4{margin-bottom:8px;}
.aim-log-hi{
  margin-bottom:8px;padding:8px 10px;border-radius:6px;
  background:rgba(245,34,45,.12);border:1px solid rgba(245,34,45,.35);
  font-size:12px;color:#fecaca;flex:0 0 auto;
}
/* 参考站滚动日志：固定高度 + 列表无缝上滚，不用渐变遮罩 */
.aim-log-scroll{
  flex:1;min-height:0;height:138px;
  overflow:hidden;position:relative;
  background:rgba(15,23,42,.72);
  border:1px solid rgba(148,163,184,.16);
  border-radius:8px;
  padding:8px 10px;
  box-sizing:border-box;
}
.aim-log-list{
  list-style:none;margin:0;padding:0;
  animation:aim-log-scroll 38s linear infinite;
  will-change:transform;
}
.aim-log-list:hover{animation-play-state:paused;}
@keyframes aim-log-scroll{
  0%{transform:translateY(0);}
  100%{transform:translateY(-50%);} /* 内容复制一份后滚一半即无缝 */
}
.aim-log-list li{
  display:flex;justify-content:space-between;gap:6px;align-items:center;
  height:28px;font-size:11px;color:#94a3b8;white-space:nowrap;
  border-bottom:1px solid rgba(148,163,184,.12);
  box-sizing:border-box;
}
.aim-log-list li .txt{overflow:hidden;text-overflow:ellipsis;}
.aim-log-list li .t{flex:0 0 auto;color:#64748b;font-size:10px;margin-left:8px;}
.aim-log-list li.high .txt{color:#fecaca;}
.aim-log-list li.medium .txt{color:#fde68a;}
.aim-log-list li.low .txt{color:#bfdbfe;}

.aim-services{
  display:grid;grid-template-columns:repeat(4,1fr);gap:12px;
}
.aim-svc{
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 14px;border-radius:8px;
  background:rgba(15,23,42,.95);border:1px solid rgba(35,103,255,.28);
  cursor:default;user-select:none;
}
.aim-svc span{font-size:13px;font-weight:600;}
.aim-svc em{
  font-style:normal;font-size:12px;color:#52c41a;
  display:inline-flex;align-items:center;gap:4px;
}
.aim-svc em i{width:6px;height:6px;border-radius:50%;background:#52c41a;}

@media (max-width:1100px){
  .aim-grid{
    grid-template-columns:1fr 1fr;
    grid-template-rows:auto;
  }
  .aim-c-traffic,.aim-c-visitors,.aim-c-nodes,.aim-c-security,
  .aim-c-load,.aim-c-protected{grid-column:auto;grid-row:auto;min-height:160px;}
  .aim-c-logs{grid-column:1 / -1;grid-row:auto;height:220px;}
  .aim-services{grid-template-columns:1fr 1fr;}
}
