:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
  --accent: #4f46e5;
  --accent2: #0891b2;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --radius: 14px;
  --radius2: 18px;
  --pad: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

html[data-theme="light"] {
  --bg: #f7f7fb;
  --panel: rgba(0, 0, 0, 0.04);
  --panel2: rgba(0, 0, 0, 0.06);
  --text: rgba(0, 0, 0, 0.86);
  --muted: rgba(0, 0, 0, 0.58);
  --border: rgba(0, 0, 0, 0.12);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 12% 18%, rgba(79, 70, 229, 0.18), transparent 60%),
    radial-gradient(1000px 700px at 82% 26%, rgba(8, 145, 178, 0.12), transparent 60%),
    radial-gradient(1200px 900px at 48% 92%, rgba(34, 197, 94, 0.10), transparent 55%),
    var(--bg);
}

a { color: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 80%);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 14px;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.95), rgba(8, 145, 178, 0.92));
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.14);
}

.brand h1 {
  font-size: 15px;
  margin: 0;
  letter-spacing: 0.2px;
}

.muted { color: var(--muted); font-size: 12px; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
}

.nav button:hover {
  background: rgba(255, 255, 255, 0.05);
}

.nav button.active {
  background: rgba(79, 70, 229, 0.14);
  border-color: rgba(79, 70, 229, 0.45);
}

.nav .hint {
  font-size: 11px;
  color: var(--muted);
}

.main {
  padding: 18px 18px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius2);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.topbar .left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar .title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar .right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--muted);
}

.btn {
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
}

.btn:hover { background: rgba(255, 255, 255, 0.08); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn.primary {
  border-color: rgba(79, 70, 229, 0.55);
  background: rgba(79, 70, 229, 0.14);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: rgba(251, 113, 133, 0.55);
  background: rgba(251, 113, 133, 0.14);
}

.field {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.field:focus {
  border-color: rgba(79, 70, 229, 0.50);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: var(--pad);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi .value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.kpi .sub {
  color: var(--muted);
  font-size: 12px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row.stretch > * { flex: 1; min-width: 160px; }

.section {
  margin-top: 12px;
}

.section h2 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

th { text-align: left; color: var(--muted); font-weight: 600; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.04); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--muted);
}

.chip.ok { border-color: rgba(52, 211, 153, 0.5); color: rgba(52, 211, 153, 0.95); }
.chip.warn { border-color: rgba(251, 191, 36, 0.5); color: rgba(251, 191, 36, 0.95); }
.chip.err { border-color: rgba(251, 113, 133, 0.5); color: rgba(251, 113, 133, 0.95); }

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 14px 2px;
}

.error {
  color: rgba(255, 180, 180, 0.95);
  font-size: 12px;
  margin-top: 8px;
  white-space: pre-wrap;
}

.loginShell {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 18px 60px;
}

.loginGrid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.tabs {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.tabs button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  cursor: pointer;
}

.tabs button.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.modalMask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modalMask.open { display: flex; }

.modal {
  width: 100%;
  max-width: 680px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
}

.modalHead .title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.modalBody { padding: 14px; }
.modalFoot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--panel2);
}

.toastWrap {
  position: fixed;
  right: 14px;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 60;
}

.toast {
  width: 320px;
  max-width: calc(100vw - 28px);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow);
  padding: 12px 12px;
}

.toast .t { font-weight: 800; font-size: 13px; }
.toast .d { color: var(--muted); font-size: 12px; margin-top: 4px; white-space: pre-wrap; }
.toast.ok { border-color: rgba(52, 211, 153, 0.5); }
.toast.err { border-color: rgba(251, 113, 133, 0.55); }
.toast.warn { border-color: rgba(251, 191, 36, 0.55); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .loginGrid { grid-template-columns: 1fr; }
  .col-8, .col-6, .col-4 { grid-column: span 12; }
}
