:root {
  --bg: #070a11;
  --panel: #0e1420;
  --panel-2: #121a29;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e9eef9;
  --muted: #8b97ad;
  --muted-2: #64708a;
  --accent: #6d8bff;
  --accent-2: #35d0c0;
  --green: #3ddc97;
  --red: #ff6b81;
  --amber: #ffc857;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px 420px at 12% -8%, rgba(109, 139, 255, 0.18), transparent 70%),
    radial-gradient(620px 380px at 96% 4%, rgba(53, 208, 192, 0.12), transparent 70%),
    radial-gradient(900px 500px at 50% 110%, rgba(109, 139, 255, 0.07), transparent 70%);
}

a { color: var(--accent); }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; }
p { margin: 0; }

.muted { color: var(--muted); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- shell ---------- */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 20px 20px 72px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  background: rgba(7, 10, 17, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.01em; }
.logo {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #060a12; font-size: 15px; font-weight: 800;
}
.who { display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px; color: var(--text);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0.012));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card, .card + .grid, .grid + .card, .card + .section { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid.tight { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.grid.stats6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.stats3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .grid.stats6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.stats3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .stat { padding: 12px; }
  .stat .v { font-size: 20px; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 26px;
  border: 1px solid rgba(109, 139, 255, 0.28);
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(109, 139, 255, 0.22), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
}
.hero-label { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.hero-num {
  font-size: clamp(38px, 7vw, 58px);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.03em;
  margin: 6px 0 8px;
  font-variant-numeric: tabular-nums;
}
.hero-num span { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.hero-sub { color: var(--muted); font-size: 13px; }
.hero-side { display: flex; gap: 26px; text-align: right; }
.hero-side .k { font-size: 11.5px; color: var(--muted-2); }
.hero-side .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
form { display: block; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(6, 10, 18, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--muted-2); }
input:focus, select:focus { border-color: rgba(109, 139, 255, 0.7); box-shadow: 0 0 0 3px rgba(109, 139, 255, 0.16); }
select { cursor: pointer; }
select option { background: #0e1420; }
.select { width: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: linear-gradient(140deg, var(--accent), #5566e8);
  color: #fff; font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: rgba(255,255,255,0.04); border-color: var(--line-strong); color: var(--text); }
.btn.ghost:hover { background: rgba(255,255,255,0.08); }
.btn.danger { background: rgba(255, 107, 129, 0.14); border-color: rgba(255, 107, 129, 0.4); color: #ff9aa9; }
.btn.ok { background: rgba(61, 220, 151, 0.14); border-color: rgba(61, 220, 151, 0.4); color: #7ff0bd; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; }
th {
  font-size: 11.5px; font-weight: 600; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--line);
}
tbody tr { border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
td.right, th.right { text-align: right; }
td .small { color: var(--muted); font-size: 12px; }
.amt-pos { color: var(--green); font-weight: 600; }
.amt-neg { color: var(--red); font-weight: 600; }
td.note { white-space: normal; min-width: 140px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
  flex-shrink: 0; white-space: nowrap;
}
.badge.green { color: #7ff0bd; background: rgba(61, 220, 151, 0.1); border-color: rgba(61, 220, 151, 0.28); }
.badge.amber { color: #ffd88a; background: rgba(255, 200, 87, 0.1); border-color: rgba(255, 200, 87, 0.28); }
.badge.red { color: #ff9aa9; background: rgba(255, 107, 129, 0.1); border-color: rgba(255, 107, 129, 0.28); }
.badge.gray { color: var(--muted); background: rgba(255, 255, 255, 0.05); border-color: var(--line-strong); }
.badge.blue { color: #a9bcff; background: rgba(109, 139, 255, 0.12); border-color: rgba(109, 139, 255, 0.3); }

.empty { padding: 30px 12px; text-align: center; color: var(--muted-2); font-size: 13px; }

/* ---------- stats ---------- */
.stat { padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); margin-bottom: 16px; overflow-x: auto; }
.tab { flex: 1; padding: 9px 14px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { background: rgba(109, 139, 255, 0.16); color: #cdd7ff; box-shadow: inset 0 0 0 1px rgba(109, 139, 255, 0.32); }

/* ---------- auth ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; padding: 26px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 17px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 20px; }
.auth-switch { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }
.auth-switch button { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0 2px; }
.hint { font-size: 12px; color: var(--muted-2); margin-top: 8px; margin-bottom: 12px; }
.hint:first-child { margin-top: 0; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 10, 0.68); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade 0.14s ease; }
.modal { width: 100%; max-width: 420px; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 16px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); animation: pop 0.16s ease; }
.modal h3 { margin-bottom: 16px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
@keyframes pop { from { transform: scale(0.97) translateY(6px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  z-index: 80; padding: 11px 18px; border-radius: 12px;
  background: #172033; border: 1px solid var(--line-strong);
  color: var(--text); font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s; box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  max-width: min(92vw, 520px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(61, 220, 151, 0.45); }
.toast.err { border-color: rgba(255, 107, 129, 0.55); color: #ffc2cb; }

/* ---------- misc ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.12); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.section { margin-top: 16px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; letter-spacing: 0.02em; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.kbd { font-family: "Cascadia Mono", Consolas, monospace; background: rgba(255,255,255,0.06); border: 1px solid var(--line-strong); border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; padding: 0; }

/* ---------- v2：提示 / 工具条 / 机器人 key ---------- */
.alert {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px;
  font-size: 12.8px; line-height: 1.55;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.03); color: var(--muted);
}
.alert strong { color: var(--text); font-size: 13.5px; font-weight: 650; }
.alert.red { border-color: rgba(255, 107, 129, 0.42); background: rgba(255, 107, 129, 0.09); color: #ffc2cb; }
.alert.red strong { color: #ff9aa9; }
.alert.amber { border-color: rgba(255, 200, 87, 0.38); background: rgba(255, 200, 87, 0.08); color: #ffe0a3; }
.alert.amber strong { color: #ffd88a; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { width: auto; flex: 1 1 200px; min-width: 160px; }
.toolbar .select { width: auto; }
.modal-text { white-space: pre-line; color: var(--muted); font-size: 12.5px; margin: -6px 0 14px; line-height: 1.6; }
.mono-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px dashed rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.06);
}
.mono-box code { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; color: #7ff0bd; word-break: break-all; flex: 1 1 220px; }

@media (max-width: 700px) {
  .container { padding: 14px 14px 60px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .hero-side { text-align: left; }
  .row { grid-template-columns: 1fr; }
  th, td { padding: 9px 10px; }
  .hide-sm { display: none; }
  td .inline { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  td:last-child { min-width: 150px; }
  .btn.sm { padding: 6px 9px; font-size: 12px; }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .brand { font-size: 15px; white-space: nowrap; }
  .brand .logo { width: 24px; height: 24px; border-radius: 8px; font-size: 13px; }
  .chip { font-size: 11.5px; padding: 4px 9px; white-space: nowrap; }
  .chip .role { display: none; }
  .topbar .btn.sm { padding: 5px 9px; font-size: 12px; }
}
