:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080b12;
  color: #f6f8fc;
  --surface: rgba(18, 23, 34, .88);
  --line: #293143;
  --line-soft: rgba(255, 255, 255, .07);
  --text-muted: #98a2b5;
  --accent: #70e1ae;
  --accent-ink: #06120d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 12% -10%, rgba(51, 119, 91, .23), transparent 34%), radial-gradient(circle at 92% 0, rgba(74, 91, 140, .16), transparent 30%), #080b12;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 34px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(112, 225, 174, .45);
  border-radius: 15px;
  background: rgba(112, 225, 174, .12);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: inset 0 0 18px rgba(112, 225, 174, .08);
}
.brand-copy h1 {
  margin: 2px 0 3px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -.05em;
}
.brand-copy > p:last-child { margin: 0; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
}
.muted, .section-intro { color: var(--text-muted); }
.service-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(14, 18, 27, .7);
  color: #c6cedd;
  font-size: 12px;
  font-weight: 700;
}
.service-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

h2, h3, p { margin-top: 0; }
h2 { letter-spacing: -.035em; }

.message {
  min-height: 22px;
  margin: -12px 0 18px;
  color: #b8c2d3;
  font-size: 13px;
  transition: all .2s ease;
}
.message:not(:empty) {
  padding: 12px 16px;
  border: 1px solid rgba(112, 225, 174, .25);
  border-radius: 10px;
  background: rgba(112, 225, 174, .08);
}
.message[data-kind="error"] {
  color: #ff9bac;
  border-color: rgba(255, 91, 118, .3);
  background: rgba(255, 91, 118, .1);
}

.hidden { display: none !important; }

/* ── 认证卡片与切换器 ────────────────────────────────────────────────────────── */
.guest-panel {
  display: flex;
  justify-content: center;
  margin: 10px auto 40px;
}
.auth-container {
  width: min(100%, 460px);
  padding: 30px;
}
.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 24px;
  background: rgba(8, 12, 19, .6);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.tab-btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: all .16s ease;
}
.tab-btn:hover {
  color: #f6f8fc;
  background: rgba(255, 255, 255, .03);
}
.tab-btn.active {
  background: rgba(112, 225, 174, .14);
  color: var(--accent);
  border-color: rgba(112, 225, 174, .35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

.auth-view {
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-header h2 {
  margin-bottom: 6px;
  font-size: 24px;
}
.form-header .section-intro {
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.55;
}

label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: #c7cfdd;
  font-size: 12px;
  font-weight: 750;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

input, button { font: inherit; }
input {
  width: 100%;
  border: 1px solid #333c50;
  background: rgba(8, 12, 19, .72);
  color: #fff;
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input:hover { background: rgba(11, 16, 25, .95); }
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(112, 225, 174, .14);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 15px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s, filter .16s;
}
button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
button:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(112, 225, 174, .35);
  outline-offset: 2px;
}

.submit-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  font-size: 14px;
}
.link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s ease;
}
.link-btn:hover {
  color: #fff;
  text-decoration: underline;
}
.link-btn.highlight {
  color: var(--accent);
  font-weight: 750;
}
.switch-prompt {
  text-align: center;
  margin-top: 18px;
  margin-bottom: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .18);
  backdrop-filter: blur(18px);
}

.secondary {
  width: auto;
  margin: 0;
  background: #252d3d;
  color: #eef2f8;
}
.small-button {
  padding: 7px 12px;
  font-size: 11px;
}
.danger {
  width: auto;
  margin: 0;
  background: #512735;
  color: #ffc7d1;
}

/* ── 控制台仪表盘 ────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  gap: 16px;
  align-items: start;
}
.account-card, .admin-panel { min-width: 0; }
.account-heading, .token-list-heading, .token-row, .admin-user-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.account-heading {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.account-heading h2 {
  margin: 0 0 8px;
  font-size: clamp(21px, 3vw, 28px);
  overflow-wrap: anywhere;
}
.role-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(112, 225, 174, .13);
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 22px 0 4px;
}
.section-heading h3, .token-list-heading h3 { margin: 0; }
.section-heading > p {
  max-width: 220px;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  text-align: right;
}

.token-form {
  display: grid;
  grid-template-columns: 1fr 125px auto;
  align-items: end;
  gap: 10px;
  margin: 12px 0 22px;
}
.token-form label { margin: 0; }
.token-form button {
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.token-once {
  display: grid;
  gap: 10px;
  padding: 15px;
  margin-bottom: 22px;
  border: 1px solid rgba(112, 225, 174, .42);
  background: rgba(31, 89, 63, .2);
  border-radius: 12px;
}
code {
  overflow-wrap: anywhere;
  color: #acf3d0;
}
.token-list-heading { margin-bottom: 10px; }
.token-list { display: grid; gap: 8px; }
.token-row {
  padding: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(8, 12, 19, .34);
  border-radius: 10px;
}
.token-row p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.admin-panel { margin: 0; }
.admin-panel > .muted {
  font-size: 12px;
  line-height: 1.55;
}
.admin-users { display: grid; gap: 10px; margin-top: 16px; }
.admin-user {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(8, 12, 19, .34);
}
.admin-user > p { margin: 7px 0; font-size: 11px; }
.admin-token-list { display: grid; gap: 6px; margin-top: 10px; }
.admin-token-list p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #c7cfdd;
  font-size: 11px;
  line-height: 1.5;
}

/* ── 接入指南与模型配置 ──────────────────────────────────────────────────────── */
.guide {
  margin-top: 38px;
  padding-top: 30px;
  border-top: 1px solid var(--line-soft);
}
.guide-heading {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) 1.2fr;
  gap: 24px;
  align-items: end;
  margin-bottom: 16px;
}
.guide-heading h2 { margin-bottom: 0; font-size: 28px; }
.guide-heading > p { margin-bottom: 0; line-height: 1.6; }

.guide-basics {
  margin-bottom: 16px;
  padding: 20px 24px;
}
.base-url-block {
  margin-bottom: 16px;
}
.url-label {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  margin-bottom: 6px;
}
.base-url-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(8, 12, 19, .8);
  border: 1px solid rgba(112, 225, 174, .25);
  border-radius: 10px;
}
.base-url-row code {
  font-size: 13px;
  font-weight: 700;
}

.quick-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.quick-specs div { min-width: 0; }
.quick-specs dt {
  color: #7f8ca2;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
}
.quick-specs dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.model-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 270px;
  padding: 20px;
}
.model-card h3 {
  margin-bottom: 12px;
  font-size: 19px;
}
.model-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 8px;
  background: rgba(8, 12, 19, .5);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 8px;
}
.model-code-row code {
  font-size: 11px;
}
.copy-model-btn {
  padding: 2px 7px;
  font-size: 10px;
  background: #1e2636;
  color: var(--accent);
  border: 1px solid rgba(112, 225, 174, .2);
  border-radius: 5px;
  cursor: pointer;
  transition: all .14s;
}
.copy-model-btn:hover {
  background: rgba(112, 225, 174, .2);
}

.model-card .muted {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.55;
}
.model-card a {
  margin-top: auto;
  padding-top: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}
.provider-tag {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .14em;
}

.curl-example-card {
  margin-top: 14px;
  padding: 18px 20px;
}
.curl-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
pre {
  margin: 0;
  padding: 14px;
  background: rgba(8, 12, 19, .85);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow-x: auto;
}
pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #cee5ff;
}

.guide-note {
  margin: 14px 3px 0;
  color: #7f8ca2;
  font-size: 11px;
}

/* ── 响应式适配 ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .quick-specs { grid-template-columns: repeat(2, 1fr); }
  .model-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 600px); padding: 24px 0 50px; }
  .app-header { grid-template-columns: auto 1fr; gap: 12px; margin-bottom: 24px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
  .service-status { grid-column: 1 / -1; justify-self: start; }
  .auth-container { padding: 22px 18px; }
  .account-heading { align-items: flex-start; }
  .section-heading { display: block; }
  .section-heading > p { max-width: none; margin-top: 7px; text-align: left; }
  .token-form { grid-template-columns: 1fr; }
  .token-form button { width: 100%; }
  .guide-heading { grid-template-columns: 1fr; gap: 10px; }
  .model-card { min-height: 0; }
  .base-url-row { flex-direction: column; align-items: stretch; }
  .base-url-row button { width: 100%; }
}

@media (max-width: 420px) {
  .shell { width: min(100% - 18px, 600px); }
  .card { padding: 16px; border-radius: 15px; }
  .quick-specs { grid-template-columns: 1fr; }
  .account-heading { flex-direction: column; }
}
