/* Beszel PHP 版 - 仿 Beszel 深色主题 */
:root {
  --background: #17181b;
  --foreground: #f7f7f8;
  --card: #1b1c1f;
  --card-foreground: #f7f7f8;
  --secondary: #26282c;
  --secondary-foreground: #fafafa;
  --muted: #26282c;
  --muted-foreground: #a9abb1;
  --accent: #26282c;
  --border: #282a2d;
  --input: #383a3f;
  --destructive: #d64545;
  --green: #3b9e5f;
  --green-dim: rgba(59, 158, 95, 0.15);
  --blue: #4f7df3;
  --blue-dim: rgba(79, 125, 243, 0.15);
  --orange: #e08a3c;
  --orange-dim: rgba(224, 138, 60, 0.15);
  --purple: #9b6de0;
  --purple-dim: rgba(155, 109, 224, 0.15);
  --red: #d64545;
  --radius: 0.8rem;
  --container: 1500px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; overflow-x: hidden; }

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-variant-ligatures: no-contextual;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }

/* ===== 顶部导航栏（仿 Beszel navbar） ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.6rem;
  padding: 0 1.5rem;
  background: rgba(23, 24, 27, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.navbar .container { display: flex; align-items: center; gap: 1.5rem; width: 100%; }

.logo { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; flex-shrink: 0; flex-wrap: nowrap; white-space: nowrap; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; max-width: 1.6rem; max-height: 1.6rem; flex-shrink: 0;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, #3b9e5f 0%, #4f7df3 50%, #9b6de0 100%);
  color: #fff; font-size: 0.75rem; font-weight: 800;
  object-fit: cover; overflow: hidden;
}
.logo-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nav-link {
  color: var(--muted-foreground);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.6rem;
  border-radius: 0.45rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { color: var(--foreground); background: var(--accent); }
.nav-link.active { color: var(--foreground); background: var(--secondary); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--muted-foreground); }

/* ===== 页面标题 ===== */
.page-head { display: flex; align-items: baseline; gap: 0.75rem; padding: 1.5rem 0 0.75rem; }
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--muted-foreground); font-size: 0.9rem; }

/* ===== 系统卡片网格（仿 Beszel 系统列表） ===== */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  padding: 1rem 0 2rem;
}
.sys-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: border-color 0.15s, transform 0.15s;
}
.sys-card:hover { border-color: var(--input); transform: translateY(-1px); }
.sys-card-head { display: flex; align-items: center; gap: 0.6rem; }
.sys-status-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex-shrink: 0; }
.sys-status-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(59, 158, 95, 0.8); }
.sys-status-dot.offline { background: var(--muted-foreground); }
.sys-name { font-weight: 600; font-size: 1.05rem; }
.sys-name a:hover { text-decoration: underline; }
.sys-meta { margin-left: auto; font-size: 0.75rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.sys-sub { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--muted-foreground); flex-wrap: wrap; }

.sys-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-label { font-size: 0.72rem; color: var(--muted-foreground); display: flex; align-items: center; gap: 0.3rem; }
.stat-value { font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 0.75rem; color: var(--muted-foreground); font-weight: 450; }

.mini-bar { height: 4px; border-radius: 2px; background: var(--secondary); overflow: hidden; }
.mini-bar > i { display: block; height: 100%; border-radius: 2px; transition: width 0.4s; }
.bar-green > i { background: var(--green); }
.bar-blue > i { background: var(--blue); }
.bar-orange > i { background: var(--orange); }

.sys-card .spark { height: 3.2rem; margin-top: 0.2rem; }

/* ===== InfoBar（仿 Beszel 详情页信息条） ===== */
.info-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 0 1rem;
}
.info-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.info-label { font-size: 0.72rem; color: var(--muted-foreground); }
.info-value { font-size: 0.95rem; font-weight: 600; word-break: break-all; }
.info-value small { font-weight: 450; color: var(--muted-foreground); }

/* 去掉移动端点击高亮（蓝色闪烁） */
* { -webkit-tap-highlight-color: transparent; }
button:focus, .range-tab:focus { outline: none; }

/* ===== 指标大卡片 ===== */
.metric-cards { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; padding: 0.5rem 0 1rem; }
.metric-group {
  flex: 1 1 200px;
  min-width: 0;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.metric-group .metric-card { flex: 1 1 auto; }
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.metric-card.clickable { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.metric-card.clickable:hover { border-color: var(--foreground); transform: translateY(-1px); }
.metric-title { font-size: 0.85rem; font-weight: 550; display: flex; align-items: center; gap: 0.4rem; }
.metric-big { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.metric-big small { font-size: 0.9rem; color: var(--muted-foreground); font-weight: 500; }
.metric-detail { font-size: 0.78rem; color: var(--muted-foreground); }

/* ===== 图表卡片（点击指标卡后在其正下方展开，宽度与对应卡片一致） ===== */
.chart-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
/* 独立负载图（无对应指标卡）仍占满整行 */
.metric-cards > .chart-card { flex-basis: 100%; }

/* 图表 canvas 防溢出 */
.chart-card canvas { max-width: 100%; }
.metric-group, .chart-card { min-width: 0; max-width: 100%; }

/* 图表展开/收起动画 */
.chart-card.anim-in { animation: chartIn 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.chart-card.anim-out { animation: chartOut 0.18s ease forwards; }
@keyframes chartIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes chartOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}
.chart-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.chart-title { font-size: 1.1rem; font-weight: 650; }
.chart-sub { font-size: 0.75rem; color: var(--muted-foreground); }
.chart-body { position: relative; height: 220px; }
.chart-body.tall { height: 260px; }
.chart-body canvas { width: 100% !important; height: 100% !important; }

.range-tabs { display: flex; gap: 0.25rem; margin-left: auto; background: var(--secondary); padding: 0.2rem; border-radius: 0.5rem; }
.range-tab {
  border: none; background: transparent; color: var(--muted-foreground);
  font-size: 0.8rem; padding: 0.3rem 0.7rem; border-radius: 0.35rem;
  transition: background 0.15s, color 0.15s;
}
.range-tab.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

/* ===== 状态提示 ===== */
.empty {
  text-align: center; padding: 4rem 1rem; color: var(--muted-foreground);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty h2 { font-size: 1.2rem; margin-bottom: 0.4rem; color: var(--foreground); }
.empty code { background: var(--secondary); padding: 0.15rem 0.4rem; border-radius: 0.3rem; font-size: 0.85rem; }

/* ===== 页脚 ===== */
.footer { text-align: center; padding: 1.5rem 0 2.5rem; font-size: 0.8rem; color: var(--muted-foreground); }
.footer a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .navbar .container { gap: 0.8rem; }
  .page-title { font-size: 1.25rem; }
}
