:root {
  --bg: #e8eef5;
  --panel: #ffffff;
  --line: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --thead: linear-gradient(90deg, #5b9dff 0%, #3b82f6 100%);
  --hero: linear-gradient(135deg, #4f8cff 0%, #2563eb 55%, #1d4ed8 100%);
  --shadow: 0 4px 18px rgba(37, 99, 235, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

/* ===== 左右布局：大菜单侧栏 + 主区 ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.app-shell.side-right { flex-direction: row-reverse; }

.side-nav {
  width: 220px;
  flex-shrink: 0;
  background: #0f1b2d;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.05rem 1.1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.side-brand i { color: #60a5fa; font-size: 1.25rem; }
.side-menu {
  flex: 1;
  padding: 0.75rem 0.65rem;
  overflow-y: auto;
}
.side-menu a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
}
.side-menu a i { font-size: 1.15rem; }
.side-menu a:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}
.side-menu a.active {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.side-foot {
  padding: 0.85rem 1rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}
.side-user { color: #94a3b8; margin-bottom: 0.45rem; }
.side-logout {
  color: #cbd5e1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.side-logout:hover { color: #fff; }

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 顶部：当前大菜单的子菜单 */
.sub-nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.sub-nav-title {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-right: 0.75rem;
  border-right: 1px solid var(--line);
}
.sub-nav-title i { color: #2563eb; }
.sub-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  overflow-x: auto;
  flex: 1;
}
.sub-nav-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.85rem 0.85rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-weight: 500;
}
.sub-nav-tabs a i { font-size: 1rem; }
.sub-nav-tabs a:hover { color: var(--accent); }
.sub-nav-tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.sub-nav-right { margin-left: auto; white-space: nowrap; }

.page-wrap {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 2rem;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.page-title i { color: #2563eb; font-size: 1.35rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.panel {
  background: var(--panel);
  border: 1px solid #edf2f7;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
}
.panel-h {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}
.panel-h span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.panel-h i { color: #64748b; }
.panel-b { padding: 1rem; }
.chart-box { height: 200px; }

.stat-card {
  background: var(--panel);
  border: 1px solid #edf2f7;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  height: 100%;
}
.stat-num {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
  color: #0f172a;
}
.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.hero-kpi {
  background: var(--hero);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.28);
  padding: 1.15rem 1.25rem;
  height: 100%;
}
.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.hero-ico {
  font-size: 2.2rem;
  opacity: 0.85;
}
.hero-kpi .label { opacity: 0.92; font-size: 13px; }
.hero-kpi .num {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.05;
  margin: 0.35rem 0 0.65rem;
}
.hero-kpi .meta { font-size: 12px; opacity: 0.95; }
.progress-lite {
  height: 6px;
  background: rgba(255,255,255,0.28);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.55rem;
}
.progress-lite > span {
  display: block;
  height: 100%;
  background: #fff;
  border-radius: 99px;
}

.metric-list { list-style: none; margin: 0; padding: 0; }
.metric-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.metric-list li:last-child { border-bottom: 0; }
.metric-list .k {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.metric-list .k i { font-size: 1.05rem; }
.metric-list .v { font-weight: 700; color: #0f172a; }

.ico-blue { color: #3b82f6; }
.ico-cyan { color: #06b6d4; }
.ico-orange { color: #f59e0b; }
.ico-green { color: #22c55e; }
.ico-purple { color: #8b5cf6; }
.ico-red { color: #ef4444; }

.table {
  --bs-table-bg: #fff;
  --bs-table-color: var(--text);
  --bs-table-border-color: #eef2f7;
  --bs-table-hover-bg: #f8fbff;
  margin-bottom: 0;
  font-size: 13px;
}
.table thead th {
  background: var(--thead) !important;
  color: #fff !important;
  border: 0 !important;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.65rem 0.75rem;
}
.table tbody td {
  padding: 0.6rem 0.75rem;
  vertical-align: middle;
  border-color: #eef2f7;
}

.form-control, .form-select {
  background: #fff;
  border-color: #dbe3ee;
  color: var(--text);
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}
.form-label { color: #475569; font-weight: 500; font-size: 13px; }

.btn-primary {
  background: #2563eb;
  border: 0;
  border-radius: 8px;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-outline-primary, .btn-outline-secondary, .btn-outline-danger {
  border-radius: 8px;
}

.mono, .json-view {
  font-family: Consolas, "Cascadia Mono", Monaco, monospace;
}
.json-view {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 62vh;
  overflow: auto;
  font-size: 0.82rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
.text-secondary { color: var(--muted) !important; }
code { color: #2563eb; background: #eff6ff; padding: 0.1rem 0.35rem; border-radius: 4px; }

.badge-soft {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.badge-soft-ok { background: #dcfce7; color: #15803d; }
.badge-soft-bad { background: #fee2e2; color: #b91c1c; }
.badge-soft-warn { background: #fef3c7; color: #b45309; }
.badge-soft-info { background: #dbeafe; color: #1d4ed8; }

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.login-ico {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  margin-bottom: 0.85rem;
}

.alert { border: none; border-radius: 8px; }

@media (max-width: 992px) {
  .side-nav { width: 72px; }
  .side-brand span,
  .side-menu a span,
  .side-user,
  .side-logout span { display: none; }
  .side-menu a { justify-content: center; padding: 0.85rem 0.5rem; }
  .side-brand { justify-content: center; }
  .page-wrap { padding: 0.85rem; }
  .hero-kpi .num { font-size: 2rem; }
  .sub-nav-title { display: none; }
}
