/* ==========================================================================
   app.css — 用量查询页专用样式
   依赖：tokens.css / base.css / components.css / console.css
   约束：颜色只走语义 token；圆角只走 --radius 派生；不出现字面量色值。
   ========================================================================== */

/* ---------- KPI 卡组（三格，参考 shadcn dashboard 的指标卡） ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 108px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}
.kpi-label { font-size: 12.5px; color: var(--muted-foreground); }
.kpi-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi-note { margin-top: auto; font-size: 12px; color: var(--muted-foreground); }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 指标条四列（服务器状态卡里的 4 项指标） ---------- */

.verdict-metrics.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) {
  .verdict-metrics.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .verdict-metrics.cols-4 { grid-template-columns: minmax(0, 1fr); }
}
.verdict-metrics.cols-4 .verdict-metric { padding: 14px 16px; gap: 4px; }
.verdict-metrics.cols-4 .verdict-metric-value { font-size: 20px; }
.verdict-metric-note { font-size: 11.5px; color: var(--muted-foreground); }

/* ---------- 区块切分（服务器状态 / 用量统计 两个独立区） ---------- */

.block-head--divide {
  border-top: 1px solid var(--border);
  padding-top: 40px;
  margin-top: 24px;
  align-items: flex-end;
}

/* ---------- 图表 ---------- */

.chart--trend { height: 260px; }

.chart-host { position: relative; }
.chart-tip {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -100%);
  margin-top: -6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms var(--ease);
}
.chart-tip.is-on { opacity: 1; }
/* 命中圈：fill:none 默认不参与命中测试，必须显式 pointer-events:all */
.pt-hit { fill: none; pointer-events: all; cursor: pointer; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; }
.chart-axis-text { fill: var(--muted-foreground); font-size: 10px; font-family: inherit; }

/* ---------- 表格宿主 ---------- */

.table-host { display: block; }
.table-wrap.scroll-sm { max-height: 380px; overflow: auto; }
.table-wrap.scroll-sm thead th { position: sticky; top: 0; z-index: 1; background: var(--card); }

/* ---------- 骨架屏 ---------- */

.sk-line { height: 12px; width: 60%; margin-bottom: 8px; }
.sk-value { height: 22px; width: 45%; }

/* ---------- 页脚说明 ---------- */

.footer-note {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.7;
}

/* ---------- 顶栏（服务器状态区与统计区之间的空隙微调） ---------- */

.content .block-head { margin-bottom: 16px; }
.content .block-head h1 { font-size: 26px; letter-spacing: -0.03em; }
.content .block-head h3 { font-size: 16px; }

/* ---------- 尊重「减少动态效果」 ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- 段控（文字版：当天 / 近七天 / 总量） ----------
   库里的 .seg button 是为图标定的固定 30px 宽 —— 直接塞中文会挤成一团。
   这里只把宽度交还给内容、补足左右内边距与 nowrap；
   容器胶囊、选中白底 + 阴影、悬停、焦点环全部沿用库里的。 */
.seg { flex: none; }
.seg button { white-space: nowrap; }
.seg button svg { display: block; }
.seg--text button {
  width: auto;
  min-width: 58px;
  height: 26px;
  padding: 0 10px;
  font-size: 12.5px;
}

/* 顶栏时间戳是"参考信息"、不是控件：窗口一窄就让它先走，别把右边那组挤变形 */
@media (max-width: 1180px) {
  .topbar .topbar-when { display: none; }
}

/* ---------- 移动端（≤900px）侧边栏退化为单行横滚条 ----------
   base.css 把 .sidebar 改成横排后，内部两个 nav-group 仍是纵向、被挤成多行乱排。
   这里统一拉平成一行：品牌 + 全部导航项横向排列，放不下就横向滚动。 */
@media (max-width: 900px) {
  .sidebar { flex-wrap: nowrap; }
  .sidebar .brand { flex: none; }
  .sidebar .nav-group { flex-direction: row; flex: none; }
  .sidebar .nav-list { flex: none; flex-direction: row; }
  .sidebar .grow { display: none; }
  .sidebar [data-hook="sidebar-foot"] { display: none; }
  .sidebar .nav-item { white-space: nowrap; padding: 6px 10px; }
}
