/* ============ 设计变量 ============ */
:root {
  --sb-bg: #101828;
  --sb-hover: #1a2436;
  --sb-active: rgba(16, 185, 129, 0.14);
  --brand: #10b981;
  --brand-strong: #059669;
  --brand-soft: #ecfdf5;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e5e9f0;
  --text: #1a2233;
  --muted: #667085;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.10);
}

body { background: var(--bg); color: var(--text); font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif; }

/* ============ 侧边栏 ============ */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 228px; z-index: 100;
  background: var(--sb-bg); color: #cbd5e1;
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: #fff; padding: 6px 10px 20px; }
.brand i { color: var(--brand); font-size: 22px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 1px 0;
  color: #9aa7ba; text-decoration: none; border-radius: 9px; font-size: 14px;
  transition: background .12s, color .12s;
}
.side-nav a i { font-size: 16px; width: 20px; text-align: center; }
.side-nav a:hover { background: var(--sb-hover); color: #e2e8f0; }
.side-nav a.active { background: var(--sb-active); color: #34d399; font-weight: 600; }
.side-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.admin-chip { display: flex; align-items: center; gap: 9px; padding: 4px 10px; font-size: 13.5px; color: #e2e8f0; }
.admin-chip i { color: var(--brand); }
.btn-ghost { display: flex; align-items: center; gap: 9px; padding: 7px 10px; color: #9aa7ba; text-decoration: none; border-radius: 8px; font-size: 13.5px; }
.btn-ghost:hover { background: var(--sb-hover); color: #fff; }

/* ============ 主区域 ============ */
.main { margin-left: 228px; min-height: 100vh; display: flex; flex-direction: column; }
.page-head {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 15px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.page-head h5 { margin: 0; font-weight: 700; font-size: 17px; }
.content { padding: 24px 28px 40px; flex: 1; }

/* ============ 通用组件 ============ */
.card-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-panel .panel-head { padding: 16px 20px 0; display: flex; align-items: center; justify-content: space-between; }
.card-panel .panel-head h6 { margin: 0; font-weight: 700; font-size: 15px; }
.card-panel .panel-body { padding: 16px 20px 20px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.8px; }
table.data thead th {
  background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12.5px;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data thead th:first-child { border-top-left-radius: var(--radius); }
table.data thead th:last-child { border-top-right-radius: var(--radius); }
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid #f0f2f6; vertical-align: middle; }
table.data tbody tr:hover td { background: #fafbfd; }
table.data tbody tr:last-child td { border-bottom: none; }

.badge-soft { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.badge-soft.ok { background: var(--brand-soft); color: var(--brand-strong); }
.badge-soft.off { background: #f1f5f9; color: #64748b; }
.badge-soft.warn { background: #fef3c7; color: #b45309; }
.badge-soft.danger { background: #fee2e2; color: var(--danger); }
.badge-soft.info { background: #e0f2fe; color: #0369a1; }

.money-up { color: var(--brand-strong); font-weight: 700; }
.money-down { color: var(--danger); font-weight: 700; }

.btn-brand { background: var(--brand); border: none; color: #fff; font-weight: 600; }
.btn-brand:hover { background: var(--brand-strong); color: #fff; }
.btn-light-2 { background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 500; }
.btn-light-2:hover { background: #f8fafc; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.stat-ico {
  width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex: 0 0 auto;
}
.stat-ico.g { background: var(--brand-soft); color: var(--brand-strong); }
.stat-ico.b { background: #eff6ff; color: #2563eb; }
.stat-ico.o { background: #fef3c7; color: #b45309; }
.stat-ico.p { background: #f3e8ff; color: #7c3aed; }
.stat-ico.r { background: #fee2e2; color: var(--danger); }
.stat-ico.s { background: #f1f5f9; color: #475569; }
.stat-card .v { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-card .k { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.search-bar { display: flex; gap: 8px; max-width: 420px; }
.search-bar .form-control { border-radius: 9px; }

.form-label { font-size: 13px; font-weight: 600; color: #344054; margin-bottom: 5px; }
.form-control, .form-select { border-radius: 9px; border-color: #d5dae2; font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16,185,129,.13); }

.pagination { margin-bottom: 0; }
.page-link { border-radius: 8px !important; margin: 0 2px; border: 1px solid var(--line); color: var(--text); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }

.modal-content { border: none; border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--line); padding: 16px 20px; }
.modal-title { font-size: 15.5px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--line); padding: 13px 20px; }

.muted { color: var(--muted); }
.small-code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
textarea.prompt-area { min-height: 200px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.65; }

.empty-row { text-align: center; color: var(--muted); padding: 38px 0 !important; }
.empty-row i { font-size: 26px; display: block; margin-bottom: 8px; opacity: .5; }

/* ============ 登录页 ============ */
body.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #101828 0%, #1a2e4a 100%); }
.login-card { width: 390px; background: #fff; border-radius: 18px; padding: 36px 34px; box-shadow: var(--shadow-lg); }
.login-card .logo { text-align: center; margin-bottom: 26px; }
.login-card .logo i { font-size: 40px; color: var(--brand); }
.login-card h4 { font-weight: 800; margin: 10px 0 2px; }
.login-card .sub { color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .sidebar { width: 64px; padding: 14px 8px; }
  .sidebar .brand span, .side-nav a span-txt, .admin-chip span, .btn-ghost span-txt { display: none; }
  .side-nav a { justify-content: center; }
  .main { margin-left: 64px; }
}
