:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --text: #182230;
  --muted: #667085;
  --border: #dbe2ea;
  --accent: #087d5b;
  --accent-dark: #056548;
  --accent-soft: #eaf7f1;
  --danger: #b42334;
  --warning-bg: #fff8e7;
  --warning-border: #ebcd81;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 "Segoe UI", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px max(24px, calc((100% - 1180px) / 2)); border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: grid; color: var(--text); text-decoration: none; line-height: 1.15; }
.brand strong { font-size: 16px; }
.brand span, .top-actions { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.layout { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 64px; }
.auth-view { min-height: calc(100vh - 140px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 430px); align-items: center; gap: 64px; }
.auth-rail { max-width: 500px; }
.auth-rail h2 { margin: 0 0 10px; font-size: 28px; line-height: 1.25; }
.auth-rail > p:not(.eyebrow) { max-width: 440px; color: var(--muted); font-size: 14px; }
.auth-points { display: grid; gap: 10px; margin-top: 24px; }
.auth-points span { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 12px; }
.auth-points strong { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font: 11px Consolas, monospace; }
.auth-panel { width: min(100%, 430px); border: 1px solid var(--border); border-radius: 8px; padding: 28px; background: var(--surface); box-shadow: 0 10px 28px rgba(16, 24, 40, .07); }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 26px; line-height: 1.25; }
h2 { margin-bottom: 5px; font-size: 16px; }
.auth-panel > p:not(.eyebrow), .panel-heading p, .console-heading p { color: var(--muted); font-size: 13px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 24px 0 18px; padding: 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-subtle); }
.segmented button { min-height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.field { display: grid; gap: 6px; margin: 13px 0; color: var(--text); font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 5px; padding: 9px 10px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(8, 125, 91, .2); outline-offset: 1px; border-color: var(--accent); }
.button { min-height: 36px; border: 1px solid transparent; border-radius: 5px; padding: 7px 13px; font-weight: 600; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.subtle { border-color: var(--border); background: var(--surface); color: var(--text); }
.button.danger { border-color: #f4c6cc; background: #fff; color: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.full { width: 100%; margin-top: 9px; }
.console-heading, .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.console-heading { margin-bottom: 20px; }
.console-heading p { margin-bottom: 0; }
.developer-nav { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 0 0 18px; padding: 4px; border: 1px solid var(--border); border-radius: 7px; background: rgba(255, 255, 255, .94); box-shadow: 0 4px 14px rgba(16, 24, 40, .05); }
.developer-nav-item { min-height: 38px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.developer-nav-item:hover { background: var(--surface-subtle); color: var(--text); }
.developer-nav-item.active { background: var(--accent-soft); color: var(--accent-dark); }
.panel { margin-top: 18px; border: 1px solid var(--border); border-radius: 8px; padding: 20px; background: var(--surface); }
.panel-heading { margin-bottom: 16px; }
.panel-heading p { margin-bottom: 0; }
.message { margin: 12px 0; border: 1px solid var(--warning-border); border-radius: 5px; padding: 10px 12px; background: var(--warning-bg); color: #7a5200; font-size: 12px; }
.inline-form { display: flex; align-items: center; gap: 10px; }
.inline-form input { max-width: 360px; }
.credential-output { margin-top: 14px; border: 1px solid var(--warning-border); border-radius: 6px; padding: 13px; background: var(--warning-bg); color: #6c4800; font-size: 12px; }
.credential-output strong { display: block; margin-bottom: 8px; }
.credential-output textarea { min-height: 132px; resize: vertical; font: 12px/1.6 Consolas, monospace; }
.credential-output .button { margin-top: 8px; }
.client-list { margin-top: 14px; }
.client-row { border-top: 1px solid var(--border); padding: 14px 0; }
.client-row:first-child { border-top: 0; }
.client-head, .client-meta, .client-actions { display: flex; align-items: center; gap: 10px; }
.client-head { justify-content: space-between; }
.client-name { min-width: 0; font-weight: 650; }
.client-name small { display: block; margin-top: 3px; color: var(--muted); font: 12px/1.4 Consolas, monospace; overflow-wrap: anywhere; }
.client-status { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; color: var(--muted); font-size: 11px; }
.client-status.active { border-color: #a9d7c6; background: var(--accent-soft); color: var(--accent-dark); }
.client-status.revoked { color: var(--danger); }
.client-meta { flex-wrap: wrap; margin-top: 9px; color: var(--muted); font-size: 12px; }
.client-actions { flex-wrap: wrap; margin-top: 12px; }
.client-actions .button { min-height: 31px; padding: 5px 9px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.full-span { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; gap: 8px; margin: 13px 0; color: var(--text); font-size: 12px; }
.check-field input { width: 15px; height: 15px; margin: 0; }
.endpoint-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.endpoint-grid div { min-height: 66px; padding: 11px 13px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.endpoint-grid div:nth-child(2n) { border-right: 0; }
.endpoint-grid div:nth-last-child(-n + 2) { border-bottom: 0; }
.endpoint-grid span { display: block; color: var(--muted); font-size: 11px; }
code { font-family: Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.endpoint-grid code { display: block; margin-top: 4px; color: var(--text); }
.docs-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.docs h3 { margin: 22px 0 8px; font-size: 14px; }
.docs pre { margin: 10px 0 14px; overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; padding: 12px; background: #101828; color: #e6edf5; }
.docs pre code { font-size: 11px; line-height: 1.65; white-space: pre; }
.docs-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 12px; }
.docs-table th, .docs-table td { border: 1px solid var(--border); padding: 8px 9px; text-align: left; vertical-align: top; }
.docs-table th { background: var(--surface-subtle); color: var(--muted); font-weight: 650; }
.model-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.model-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 6px; padding: 11px; background: var(--surface-subtle); }
.model-row strong { display: block; font-size: 13px; }
.model-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.model-row > div:first-child { min-width: 0; }
.model-side { flex: 0 0 auto; text-align: right; }
.model-channel { color: var(--muted); font-weight: 400; }
.model-details { max-width: 360px; }
.model-price { flex: 0 0 auto; color: var(--accent-dark); font-size: 12px; font-weight: 650; text-align: right; }
.empty { padding: 16px 0; color: var(--muted); font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 680px) {
  .topbar { padding: 12px 18px; }
  .layout { width: min(100% - 28px, 1040px); padding-top: 24px; }
  .auth-view { grid-template-columns: 1fr; gap: 24px; align-content: center; }
  .auth-rail { max-width: none; }
  .auth-rail h2 { font-size: 23px; }
  .inline-form, .console-heading { align-items: stretch; flex-direction: column; }
  .inline-form input { max-width: none; }
  .form-grid, .endpoint-grid, .model-list, .developer-nav { grid-template-columns: 1fr; }
  .endpoint-grid div, .endpoint-grid div:nth-child(2n) { border-right: 0; }
  .endpoint-grid div:nth-last-child(-n + 2) { border-bottom: 1px solid var(--border); }
  .endpoint-grid div:last-child { border-bottom: 0; }
}
