/* ── Auth page (app.html): pure centered login/register card ─────────────── */
.auth-main {
  min-height: calc(100vh - 62px);
  display: grid;
  place-items: start center;
  padding: 48px 20px 64px;
}
.auth-card-wrap { width: 100%; max-width: 420px; }
.auth-brandline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  font-size: 19px;
  margin-bottom: 20px;
  color: var(--ink);
}
.auth-brandline .brand__mark { width: 30px; height: 30px; font-size: 13px; }
.auth-card { box-shadow: 0 18px 46px rgba(43, 85, 64, 0.12); }
.auth-foot { margin-top: 18px; text-align: center; font-size: 12px; }
.auth-foot.muted { color: var(--faint); }
.account-form__title { font-size: 20px; margin-top: 2px; }

.account-page {
  min-height: 100vh;
  background-color: var(--bg);
  /* soft brand wash + the same grid-paper texture as the homepage */
  background-image:
    linear-gradient(135deg, rgba(58, 107, 82, 0.10), transparent 32%),
    linear-gradient(215deg, rgba(58, 107, 82, 0.06), transparent 34%),
    linear-gradient(var(--green-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--green-soft) 1px, transparent 1px);
  background-size: auto, auto, 26px 26px, 26px 26px;
}

.account-page [hidden] {
  display: none !important;
}

.account-header {
  position: relative;
  transform: none;
  left: auto;
  margin: 0 auto;
}

.account-shell {
  width: min(var(--page), calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 96px;
}

.account-hero {
  max-width: 720px;
}

.account-hero h1 {
  margin-top: 12px;
  font-size: clamp(42px, 7vw, 82px);
  font-weight: 840;
  letter-spacing: 0;
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.account-hero p:not(.eyebrow) {
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  margin-top: 34px;
  align-items: start;
}

.account-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.account-auth-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.account-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.account-form__intro {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.account-form__title {
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.15;
}

/* Dev/staging-only API-address override, collapsed by default. */
.account-advanced {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}

.account-advanced > summary {
  cursor: pointer;
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.account-advanced[open] {
  padding-bottom: 12px;
}

/* Numeric OTP input: roomy, spaced digits. */
#otp-code {
  letter-spacing: 8px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.account-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(22, 32, 28, 0.10);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 4px;
}

.account-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

.account-tabs button.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(22, 32, 28, 0.08);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(22, 32, 28, 0.14);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  outline: none;
}

.field input:focus {
  border-color: rgba(58, 107, 82, 0.5);
  box-shadow: 0 0 0 3px rgba(58, 107, 82, 0.14);
}

.account-submit {
  width: 100%;
  margin-top: 4px;
}

.account-notice {
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green-strong);
  padding: 11px 12px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.account-notice[data-tone="success"] {
  background: rgba(58, 107, 82, 0.12);
  color: var(--green);
}

.account-notice[data-tone="error"] {
  background: rgba(192, 57, 43, 0.10);
  color: var(--red);
}

.account-state {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.account-state h2 {
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
}

.session-panel {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(22, 32, 28, 0.09);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 16px;
}

.session-badge {
  width: fit-content;
  border-radius: 999px;
  background: rgba(58, 107, 82, 0.12);
  color: var(--green);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 820;
}

.session-panel strong {
  color: var(--text);
  font-size: 18px;
}

.session-panel p {
  color: var(--muted);
  font-size: 14px;
}

.model-proxy-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(22, 32, 28, 0.09);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.model-proxy-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  cursor: pointer;
}

.model-proxy-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
}

.model-proxy-toggle span {
  display: grid;
  gap: 3px;
}

.model-proxy-toggle strong {
  color: var(--text);
  font-size: 14px;
}

.model-proxy-toggle em,
.model-proxy-panel p {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.45;
}

.account-state__actions {
  display: grid;
  gap: 10px;
}

.account-ghost {
  border-color: rgba(22, 32, 28, 0.16);
  background: transparent;
  color: var(--text);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 34px;
  padding: 18px 22px;
}

.admin-toolbar strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.admin-notice {
  width: min(100%, 720px);
  margin-top: 16px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.admin-stat {
  padding: 18px;
}

.admin-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.admin-stat strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 34px;
  line-height: 1;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.admin-grid--logs {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.admin-grid--controls {
  grid-template-columns: minmax(360px, 0.8fr) minmax(0, 1.2fr);
}

.admin-panel {
  min-width: 0;
  padding: 20px;
}

.admin-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-panel h2 {
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.1;
}

.admin-invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.admin-controls-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.admin-controls-form .admin-toggle-row {
  grid-column: 1 / -1;
}

.admin-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid rgba(22, 32, 28, 0.09);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.admin-table th {
  color: var(--muted);
  font-weight: 820;
  white-space: nowrap;
}

.admin-table td {
  color: var(--text);
}

.admin-table code {
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-mini-button {
  min-height: 28px;
  border: 1px solid rgba(22, 32, 28, 0.14);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  padding: 4px 8px;
  cursor: pointer;
}

.admin-mini-button:hover {
  border-color: rgba(58, 107, 82, 0.4);
  color: var(--green);
}

.admin-mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.admin-empty {
  color: var(--muted);
}

@media (max-width: 780px) {
  .account-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats,
  .admin-grid,
  .admin-invite-form,
  .admin-controls-form {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-shell {
    width: calc(100vw - 64px);
    max-width: 326px;
    padding-top: 36px;
  }

  .account-hero h1 {
    font-size: clamp(38px, 13vw, 58px);
  }

}

/* Forgot/reset links row and Turnstile slot (auth flows v0.1). */
.account-form__links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.account-form__links .account-ghost {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent, #2563eb);
  cursor: pointer;
}

.account-form__links .account-ghost[hidden] {
  display: none;
}

.turnstile-container {
  margin: 4px 0;
}

.turnstile-container[hidden] {
  display: none;
}

/* ── User model page (account.html #view-models) ─────────────────────────────
   Reuses the shared .mp-* card + modal system from app-shell.css; only a few
   page-specific bits live here. */
.umd-group-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted, #6b7280);
  text-transform: none;
  margin: 0 0 8px;
}

/* Provider card: right-aligned status + action, mirroring the plugin dialog. */
.mp-card .umd-status {
  font-size: 12px;
  color: var(--muted, #6b7280);
  margin-right: 4px;
  white-space: nowrap;
}
.mp-card .umd-status.is-current { color: var(--green-strong, #1a7a54); font-weight: 600; }
/* Subtle gray sublabel (not the blue endpoint link) — endpoint lives in modal. */
.umd-card-sub { font-size: 12px; color: var(--muted, #6b7280); margin-top: 3px; }
.umd-group[hidden] { display: none; }
/* Collapsible 订阅账号登录 section (§3.2) — folded away from the BYOK lists. */
.umd-subscription > summary {
  cursor: pointer;
  list-style: revert;
  user-select: none;
}
.umd-subscription > summary.umd-group-label { margin-bottom: 10px; }
/* Weak hint on a platform-disabled provider card — user's own key still works. */
.umd-card-note { font-size: 11px; color: var(--amber, #b7791f); margin-top: 3px; }
.umd-pro-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff4e5;
  color: var(--amber, #b7791f);
  border: 1px solid #eddcb6;
  margin-left: 6px;
}
.mp-field textarea,
.mp-field .umd-hint { font-size: 12px; color: var(--muted, #6b7280); }
.mp-field .umd-hint { margin: 6px 0 0; }
.mp-field a { color: var(--accent, #2563eb); }

/* ── Saved custom-model list (修复用户模型配置 §2) ──────────────────────────── */
.ump-list { display: flex; flex-direction: column; gap: 10px; }
.ump-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--card-bg, #fff);
}
.ump-row__meta { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; }
.ump-row__name { font-weight: 600; }
.ump-row__model { font-size: 13px; color: var(--muted, #6b7280); }
.ump-row__key {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted, #6b7280);
  border: 1px solid var(--border, #e5e7eb);
  margin-left: 4px;
}
.ump-row__key.is-set { background: #eafaf1; color: var(--green-strong, #1a7a54); border-color: #bfe6d2; }
.ump-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.mini-btn--danger { color: var(--danger, #b91c1c); }
