:root {
  --bg: #0f1419;
  --panel: #171d24;
  --panel-2: #1d252e;
  --line: #2a3441;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #3fb950;
  --accent-2: #58a6ff;
  --danger: #f85149;
  --warn: #d29922;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
h1, h2, h3 { margin: 0 0 12px; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--muted); font-weight: 500; }
p { margin: 0 0 10px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px; flex: 0 0 208px; border-right: 1px solid var(--line);
  padding: 18px 12px; background: #0c1116;
}
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; padding: 0 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.brand strong { font-size: 15px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  padding: 9px 10px; border-radius: 8px; color: var(--muted); cursor: pointer;
}
.nav button:hover { background: var(--panel); color: var(--text); }
.nav button.active { background: var(--panel-2); color: var(--text); }
.sidebar-foot { margin-top: 24px; padding: 0 8px; color: var(--muted); font-size: 12px; }

.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar .who { color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.card .label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.card .value { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.card .hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.badge.ok { color: var(--accent); border-color: #1f6f33; }
.badge.warn { color: var(--warn); border-color: #6b4d0f; }
.badge.bad { color: var(--danger); border-color: #6d1f1f; }
.badge.muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); padding: 7px 11px; border-radius: 8px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #3d4c5c; }
.btn.primary { background: #1f6f33; border-color: #2e8b45; }
.btn.primary:hover { background: #268040; }
.btn.danger { background: #5a1e1e; border-color: #7a2a2a; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.sm { padding: 4px 8px; font-size: 12px; }

input, select, textarea {
  background: #0c1116; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent-2); border-color: var(--accent-2); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 220px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.error { color: var(--danger); }
.notice { color: var(--warn); }
.hidden { display: none !important; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); }
.login-card .card { padding: 22px; }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.totp-box { background: #0c1116; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 6, 10, 0.72); display: grid;
  place-items: center; padding: 20px; z-index: 20;
}
.modal { width: min(720px, 100%); max-height: 86vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.modal.wide { width: min(960px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.progress { height: 7px; border-radius: 999px; background: #0c1116; border: 1px solid var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.progress.warn > i { background: var(--warn); }
.progress.bad > i { background: var(--danger); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav button { white-space: nowrap; }
  .main { padding: 16px; }
}
