:root {
  --bg: #f5f7fa; --panel: #ffffff; --text: #1f2937; --muted: #6b7280;
  --line: #e5e7eb; --primary: #2563eb; --primary-hover: #1d4ed8;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --sidebar: #111827; --sidebar-text: #d1d5db;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.err { color: var(--bad); min-height: 18px; margin: 6px 0; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef2ff, #f8fafc 55%, #e0f2fe); }
.login-card { width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 34px 32px; box-shadow: 0 18px 50px rgba(15,23,42,.10); }
.login-card h1 { font-size: 22px; margin: 14px 0 4px; }
.login-card p { margin: 4px 0 20px; }
.login-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; letter-spacing: 1px; }
label { display: block; margin: 12px 0; font-weight: 600; }
input, select, textarea { width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus { outline: 2px solid #93c5fd; border-color: var(--primary); }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex: none; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; font-size: 15px; padding: 4px 8px 22px; }
.brand-mark { background: var(--primary); border-radius: 8px; padding: 5px 7px; font-size: 12px; }
#nav button { display: block; width: 100%; text-align: left; padding: 11px 12px; margin: 3px 0; border: 0; border-radius: 8px; background: transparent; color: var(--sidebar-text); font: inherit; cursor: pointer; }
#nav button:hover { background: #1f2937; color: #fff; }
#nav button.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #374151; }
.sidebar-foot .muted { color: #9ca3af; }
.main { flex: 1; min-width: 0; padding: 22px 28px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.topbar h2 { margin: 0; font-size: 20px; }
.topbar p { margin: 4px 0 0; }
.top-actions { display: flex; align-items: center; gap: 12px; }

/* 通用组件 */
button { font: inherit; }
.primary, .ghost { padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.primary { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.primary:hover { background: var(--primary-hover); }
.ghost { background: #fff; color: var(--text); border: 1px solid #d1d5db; }
.ghost:hover { background: #f3f4f6; }
.danger { background: #fff; color: var(--bad); border: 1px solid #fecaca; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.panel.narrow { max-width: 480px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-head h3 { margin: 0; }
.panel-head > div { display: flex; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 22px; font-weight: 700; margin: 6px 0 2px; }
.card .d { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.list .row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.list .row:last-child { border-bottom: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.bad { background: #fee2e2; color: #b91c1c; }
.badge.info { background: #dbeafe; color: #1d4ed8; }
.badge.warn { background: #fef3c7; color: #b45309; }
.resource { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bar { height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--primary); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; background: #f9fafb; }
.table tr:hover td { background: #f8fafc; }
.table td .mini { padding: 4px 8px; font-size: 12px; margin-right: 4px; }
.toast { position: fixed; right: 22px; bottom: 22px; background: #111827; color: #fff; padding: 11px 16px; border-radius: 8px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { width: 440px; max-width: 94vw; background: #fff; border-radius: 14px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-card h3 { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 170px; }
  .main { padding: 16px; }
}
