:root {
  --ink: #18212f;
  --muted: #66758a;
  --faint: #8a96a7;
  --line: #dbe3ea;
  --soft-line: #edf2f6;
  --page: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #fbfcfd;
  --brand: #08756f;
  --brand-dark: #075f5a;
  --brand-soft: #e9f6f4;
  --navy: #17233a;
  --red: #b42318;
  --green: #12715b;
  --amber: #b76a10;
  --shadow: 0 16px 40px rgba(23, 35, 58, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(233, 246, 244, .72), rgba(246, 248, 251, 0) 320px),
    var(--page);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

button, .ghost-button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--brand);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

button:hover { background: var(--brand-dark); }
button:active { transform: translateY(1px); }

.ghost-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .76);
}

.ghost-button:hover {
  background: #ffffff;
}

input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  transition: border-color .16s ease, box-shadow .16s ease;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  color: var(--ink);
  background: #ffffff;
  resize: vertical;
}

input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 0;
  border-color: rgba(8, 117, 111, .5);
  box-shadow: 0 0 0 4px rgba(8, 117, 111, .12);
}

code {
  border-radius: 5px;
  padding: 2px 6px;
  color: #0d5f5b;
  background: #e6f4f1;
  font-size: .94em;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid rgba(219, 227, 234, .8);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 6px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: #ffffff;
  background: linear-gradient(135deg, #08756f, #0d9488);
  box-shadow: 0 10px 22px rgba(8, 117, 111, .22);
}

nav {
  display: grid;
  gap: 4px;
}

nav a {
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

nav a:hover {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.side-note {
  margin-top: 28px;
  border: 1px solid #d5ede8;
  border-radius: 9px;
  padding: 13px;
  color: #0d5f5b;
  background: linear-gradient(180deg, #f4fbfa, #effaf8);
}

.side-note strong,
.side-note span {
  display: block;
  overflow-wrap: anywhere;
}

.side-note strong {
  margin-bottom: 6px;
  font-size: 13px;
}

.side-note span {
  color: #0d5f5b;
  font-size: 12px;
  font-weight: 800;
}

main {
  min-width: 0;
  padding: 28px clamp(20px, 4vw, 48px) 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1.06; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: 0; }
h3 { margin-bottom: 7px; font-size: 15px; }
p { line-height: 1.6; }

.hidden { display: none !important; }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(350px, .72fr);
  gap: 18px;
  align-items: stretch;
}

.auth-hero {
  min-height: 430px;
  border-radius: 10px;
  padding: clamp(26px, 4vw, 44px);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(20, 36, 58, .96), rgba(8, 117, 111, .9)),
    url("https://images.unsplash.com/photo-1558494949-ef010cbdcc31?auto=format&fit=crop&w=1400&q=80") center / cover;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-hero h2 {
  max-width: 620px;
  margin-bottom: 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
}

.auth-hero p {
  max-width: 610px;
  color: #d9e8ec;
}

.auth-hero code {
  color: #d8fff9;
  background: rgba(255, 255, 255, .12);
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.auth-points span {
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .1);
  font-size: 13px;
  font-weight: 800;
}

.panel,
.metric,
.welcome-card,
.price-card {
  border: 1px solid rgba(219, 227, 234, .88);
  border-radius: 9px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 30px rgba(23, 35, 58, .045);
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.welcome-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 252, 251, .96));
}

.welcome-card h2 {
  margin-bottom: 8px;
  font-size: clamp(24px, 3vw, 34px);
}

.welcome-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  border-radius: 9px;
  padding: 4px;
  background: #f2f6f8;
}

.tab {
  color: var(--muted);
  border: 0;
  background: transparent;
}

.tab.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(23, 35, 58, .08);
}

.form-grid {
  display: grid;
  gap: 11px;
}

.auth-form {
  gap: 8px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.form-helper {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.form-message {
  display: none;
  margin-bottom: 12px;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 800;
}

.form-message.show { display: block; }
.form-message.error { color: var(--red); background: #fff1f0; }
.form-message.success { color: var(--green); background: #edf9f5; }

.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.form-grid.two-col button,
.form-grid.two-col input:nth-last-child(2) {
  grid-column: 1 / -1;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(190px, 320px) auto;
  gap: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 96px;
  padding: 15px;
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.22;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.billing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(239,250,248,.96));
}

.billing-hero h2 {
  margin-bottom: 8px;
  font-size: clamp(24px, 3vw, 34px);
}

.billing-hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.process-rail {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
}

.process-rail span {
  border: 1px solid #d5ede8;
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--brand-dark);
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.billing-grid {
  align-items: start;
}

.recharge-notice {
  border-color: #f2dcc0;
  color: #81500e;
  background: #fff7ed;
}

.amount-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.amount-presets button {
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  font-size: 13px;
}

.amount-presets button:hover,
.amount-presets button.active {
  color: var(--brand-dark);
  border-color: #bfe6df;
  background: var(--brand-soft);
}

.billing-form,
.verify-form {
  margin-bottom: 12px;
}

.status-guide,
.verify-checklist {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.status-guide div,
.verify-checklist span {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
}

.status-guide strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  font-size: 12px;
}

.status-guide span,
.verify-checklist span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.verify-checklist {
  border: 1px solid #d5ede8;
  border-radius: 9px;
  padding: 12px;
  background: #effaf8;
}

.verify-checklist strong {
  color: var(--brand-dark);
  font-size: 13px;
}

.verify-checklist span {
  border: 0;
  padding: 0;
  background: transparent;
}

.endpoint-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.endpoint-list div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.endpoint-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.price-list {
  display: grid;
  gap: 10px;
}

.price-card {
  padding: 15px;
  box-shadow: none;
}

.price-card p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--soft-line);
  padding-top: 8px;
}

dt { color: var(--muted); }
dd { margin: 0; font-weight: 900; text-align: right; }

.notice {
  margin-bottom: 14px;
  border: 1px solid #d5ede8;
  border-radius: 9px;
  padding: 11px 13px;
  color: #0d5f5b;
  background: #effaf8;
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--soft-line);
  border-radius: 9px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.compact-table table { min-width: 520px; }

th, td {
  border-bottom: 1px solid var(--soft-line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--faint);
  background: #f9fbfc;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfd; }
.empty { color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--amber);
  background: #fff7ed;
  font-size: 12px;
  font-weight: 900;
}

.pill.success { color: var(--green); background: #edf9f5; }
.pill.danger { color: var(--red); background: #fff1f0; }

pre {
  overflow: auto;
  margin: 12px 0 0;
  border-radius: 9px;
  padding: 14px;
  color: #d8fff9;
  background: #111827;
  font-size: 13px;
  line-height: 1.55;
}

pre:empty { display: none; }

pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

@media (max-width: 1120px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { display: flex; flex-wrap: wrap; }
  .auth-shell, .grid-two { grid-template-columns: 1fr; }
  .billing-hero { grid-template-columns: 1fr; }
  .process-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  main { padding: 18px; }
  .topbar, .top-actions, .panel-head, .welcome-card, .inline-form, .form-grid.two-col, .endpoint-list div {
    display: grid;
    grid-template-columns: 1fr;
  }
  .metrics { grid-template-columns: 1fr; }
  .form-grid.two-col button,
  .form-grid.two-col input:nth-last-child(2) {
    grid-column: auto;
  }
}

/* ===== 移动端增强 ===== */
/* 汉堡菜单按钮 - 移动端显示 */
.sidebar-toggle { display: none; }

@media (max-width: 768px) {
  body {
    display: block;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .sidebar .brand { margin-bottom: 0; }
  .sidebar nav {
    display: none;
    width: 100%;
    order: 3;
    flex-wrap: wrap;
    gap: 4px;
  }
  .sidebar nav.open { display: flex; }
  .sidebar nav a { font-size: 13px; padding: 8px 10px; }
  .side-note { display: none; }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    font-size: 20px;
    color: var(--ink);
  }

  .sidebar-toggle:hover { background: var(--brand-soft); }

  main { padding: 16px 12px 48px; }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .top-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .top-actions .ghost-button { font-size: 13px; padding: 0 10px; min-height: 36px; }

  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { min-height: auto; padding: 24px; }
  .auth-hero h2 { font-size: 24px; }

  .welcome-card {
    display: grid;
    grid-template-columns: 1fr;
  }
  .welcome-card h2 { font-size: 20px; }
  .status-stack { justify-content: flex-start; }

  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: auto; padding: 12px; }
  .metric strong { font-size: 16px; }

  .grid-two { grid-template-columns: 1fr; }

  .panel-head, .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-grid.two-col { grid-template-columns: 1fr; }
  .form-grid.two-col button,
  .form-grid.two-col input:nth-last-child(2) { grid-column: auto; }

  .endpoint-list div { grid-template-columns: 1fr; }
  .process-rail { grid-template-columns: 1fr; }

  table { min-width: 560px; font-size: 12px; }
  th, td { padding: 8px 6px; }

  .tabs { gap: 4px; }
  .tab { font-size: 13px; padding: 0 8px; min-height: 36px; }

  h1 { font-size: 24px; }
}

@media (max-width: 480px) {
  .sidebar { padding: 8px 10px; }
  .top-actions { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  table { min-width: 480px; }
  .sidebar nav a { font-size: 12px; }
}

/* ===== Page routing ===== */
.view-page { display: none; }
.view-page.active { display: block; }

nav a.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
}
