:root {
  --bg: #080c14;
  --bg-2: #0c121d;
  --panel: #101827;
  --panel-2: #141f30;
  --line: #223149;
  --line-soft: #1a2637;
  --text: #e8eef8;
  --muted: #8fa0b8;
  --accent: #3ddc97;
  --accent-2: #2aa8ff;
  --warn: #ffb020;
  --danger: #ff6b6b;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 88% -12%, rgba(42, 168, 255, 0.13), transparent 62%),
    radial-gradient(900px 520px at 6% 112%, rgba(61, 220, 151, 0.08), transparent 60%),
    var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.wide { width: 100%; }
.end { justify-content: flex-end; }
.wrap { flex-wrap: wrap; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 16px;
}
.brand em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 1.6px;
  color: var(--accent);
  border: 1px solid rgba(61, 220, 151, 0.35);
  background: rgba(61, 220, 151, 0.08);
  padding: 2px 6px;
  border-radius: 999px;
  vertical-align: 2px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #04110a;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px rgba(42, 168, 255, 0.22);
}

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-orb {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: conic-gradient(from 120deg, rgba(61, 220, 151, 0.15), rgba(42, 168, 255, 0.18), transparent 60%);
  filter: blur(30px);
  animation: spin 22s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-card {
  position: relative;
  width: min(400px, 100%);
  padding: 34px 30px 24px;
  border: 1px solid rgba(60, 90, 130, 0.45);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(20, 31, 48, 0.92), rgba(11, 17, 28, 0.96));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
}
.brand-login { margin-bottom: 26px; }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card > .muted { margin-bottom: 22px; }
.login-card .btn { margin-top: 6px; }
.login-foot { margin-top: 22px; font-size: 11px; color: var(--muted); text-align: center; }
.form-error { min-height: 18px; margin-top: 10px; color: #ff9b9b; font-size: 12px; }

/* ---------- shell ---------- */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(13, 20, 32, 0.92), rgba(8, 12, 20, 0.75));
  backdrop-filter: blur(10px);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: 0.15s ease;
}
.nav-item svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }
.nav-item.active {
  color: var(--text);
  border-color: rgba(61, 220, 151, 0.22);
  background: linear-gradient(90deg, rgba(61, 220, 151, 0.12), rgba(42, 168, 255, 0.04));
}
.nav-item.active svg { stroke: var(--accent); }
.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  padding: 10px 8px 0;
  border-top: 1px solid var(--line-soft);
}
.dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(61, 220, 151, 0.8);
  flex: 0 0 auto;
}
.link-btn {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 11px;
}
.link-btn:hover { color: var(--danger); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 34px 0;
}
.topbar h2 { font-size: 21px; letter-spacing: 0.2px; }
.topbar p { font-size: 12px; margin-top: 3px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.status-pill.ok { color: var(--accent); border-color: rgba(61, 220, 151, 0.35); background: rgba(61, 220, 151, 0.07); }
.status-pill.ok::before { background: var(--accent); box-shadow: 0 0 9px rgba(61, 220, 151, 0.8); }
.status-pill.warn { color: #ffd27a; border-color: rgba(255, 176, 32, 0.35); background: rgba(255, 176, 32, 0.07); }
.status-pill.warn::before { background: var(--warn); }
.status-pill.err { color: #ffb3b3; border-color: rgba(255, 107, 107, 0.35); background: rgba(255, 107, 107, 0.07); }
.status-pill.err::before { background: var(--danger); }

.content { padding: 22px 34px 52px; width: 100%; max-width: 1280px; }
.view { display: none; animation: fade 0.18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  position: relative;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20, 31, 48, 0.78), rgba(13, 20, 32, 0.66));
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(61, 220, 151, 0.4), transparent);
  opacity: 0.5;
}
.stat-label { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0.4px; }
.stat-card strong {
  display: block;
  margin: 7px 0 3px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-hint { font-size: 11px; color: var(--muted); }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}
.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 26, 40, 0.72), rgba(11, 17, 28, 0.62));
  padding: 18px 20px;
  margin-bottom: 16px;
  min-width: 0;
}
.two-col .panel { margin-bottom: 0; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-head h3 { font-size: 15px; font-weight: 650; }
.panel-head h4 { margin-top: 18px; margin-bottom: 8px; font-size: 13px; }
.panel > h4 { margin: 18px 0 8px; font-size: 13px; }
.panel-head .muted { margin-top: 3px; }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.15s ease;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
}
.btn.primary {
  color: #04110a;
  background: linear-gradient(135deg, var(--accent), #62e7b0);
  box-shadow: 0 8px 22px rgba(61, 220, 151, 0.16);
}
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
}
.btn.ghost:hover { border-color: rgba(61, 220, 151, 0.35); background: rgba(61, 220, 151, 0.06); }
.btn.danger { color: #ffb3b3; border-color: rgba(255, 107, 107, 0.3); background: rgba(255, 107, 107, 0.06); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.tiny { padding: 4px 8px; font-size: 11px; border-radius: 7px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button-row.end { justify-content: flex-end; margin-top: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 10, 17, 0.65);
  outline: none;
  transition: 0.15s ease;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(61, 220, 151, 0.55);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.09);
}
::placeholder { color: #5f7189; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.checkbox-field { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-field.inline { display: inline-flex; margin: 0; font-size: 12px; color: var(--muted); }
.checkbox-field input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; }

.switch { position: relative; display: inline-flex; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #26354a;
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: 0.18s ease;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #93a4bb;
  transition: 0.18s ease;
}
.switch input:checked + span { background: rgba(61, 220, 151, 0.25); border-color: rgba(61, 220, 151, 0.5); }
.switch input:checked + span::after { left: 21px; background: var(--accent); }

/* ---------- dashboard bits ---------- */
.active-panel { min-height: 132px; display: flex; flex-direction: column; justify-content: center; }
.account-hero { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 18px;
  color: #04110a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: 0 0 auto;
}
.account-name { font-size: 16px; font-weight: 650; }
.account-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.mini {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.015);
  min-width: 0;
}
.mini span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.mini b { display: block; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-mini { text-align: center; color: var(--muted); padding: 12px 0; }
.empty-mini b { display: block; color: var(--text); margin-bottom: 4px; }

.steps { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 11px; }
.steps li > span {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(61, 220, 151, 0.28);
  background: rgba(61, 220, 151, 0.07);
  flex: 0 0 auto;
}
.steps b { font-size: 12.5px; font-weight: 600; }
.steps p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.privacy-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(42, 168, 255, 0.18);
  border-radius: 12px;
  background: rgba(42, 168, 255, 0.05);
  color: var(--muted);
  font-size: 11.5px;
}
.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px rgba(42, 168, 255, 0.8);
  flex: 0 0 auto;
}

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
tbody tr.current { background: rgba(61, 220, 151, 0.035); }
.cell-name { font-weight: 600; }
.cell-uid { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.quota-num { font-family: var(--mono); font-size: 12px; }
.quota-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}
.badge.ok { color: var(--accent); border-color: rgba(61, 220, 151, 0.3); background: rgba(61, 220, 151, 0.06); }
.badge.warn { color: #ffd27a; border-color: rgba(255, 176, 32, 0.3); background: rgba(255, 176, 32, 0.06); }
.badge.err { color: #ffb3b3; border-color: rgba(255, 107, 107, 0.3); background: rgba(255, 107, 107, 0.06); }

.empty { text-align: center; padding: 52px 16px; }
.empty p { margin-bottom: 4px; }

/* ---------- keys ---------- */
.keys-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(6, 10, 17, 0.55);
}
.key-value {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.key-empty { color: var(--muted); font-size: 12px; padding: 10px 0; }
.notice {
  border: 1px solid rgba(255, 176, 32, 0.3);
  background: rgba(255, 176, 32, 0.07);
  color: #ffd27a;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 11.5px;
  margin-bottom: 10px;
}
.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12px;
}
.kv span { color: var(--muted); flex: 0 0 auto; }
.kv code { font-size: 11.5px; color: #b8d8ff; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.code, pre.output {
  margin: 0;
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #070c14;
  color: #d6e4f7;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}
pre.code { margin-bottom: 10px; max-height: 260px; }
.output { min-height: 190px; max-height: 460px; }
.output.tall { min-height: 360px; max-height: 60vh; }
.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.network-list { margin: 12px 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.network-list li { margin-bottom: 5px; }
.network-list code { color: #b8d8ff; }

/* ---------- dialog / toast ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #101827;
  color: var(--text);
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
}
dialog::backdrop { background: rgba(3, 6, 11, 0.72); backdrop-filter: blur(4px); }
.dialog-card { padding: 24px; }
.dialog-card h3 { margin-bottom: 6px; font-size: 17px; }
.dialog-card > .muted { margin-bottom: 16px; }
.dialog-card .field { margin-top: 14px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: 380px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #142033;
  color: var(--text);
  font-size: 12.5px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: rgba(255, 107, 107, 0.4); color: #ffb8b8; }
.toast.ok { border-color: rgba(61, 220, 151, 0.35); }

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .two-col .panel { margin-bottom: 16px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 2px; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .topbar { padding: 18px 18px 0; }
  .content { padding: 16px 18px 40px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .login-card { padding: 28px 22px 20px; }
}

.account-panel { max-width: 620px; }
.qoder-status { margin: 14px 0 4px; }
