:root {
  color-scheme: light;
  --ink: #172027;
  --muted: #6d777b;
  --faint: #9aa4a5;
  --paper: #f5f4ee;
  --surface: #fffefa;
  --line: #dfe3dc;
  --line-strong: #cbd3ca;
  --sidebar: #172027;
  --sidebar-muted: #a2b0ae;
  --teal: #008f83;
  --teal-dark: #006a63;
  --coral: #d9644c;
  --plum: #6f5a7f;
  --amber: #c58a2b;
  --good: #16856f;
  --danger: #b34d4d;
  --shadow: 0 12px 32px rgba(23, 32, 39, .06);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }

.is-hidden { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  color: #f3f7f3;
  background: var(--sidebar);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: #f8fbf6; text-decoration: none; margin: 0 10px 42px; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; color: var(--sidebar); background: #f4b860; border-radius: 8px; font-size: 21px; font-weight: 800; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 16px; letter-spacing: .2px; }
.brand small { margin-top: 4px; color: #a9bab6; font-size: 11px; letter-spacing: .5px; }
.side-label { margin: 0 13px 10px; color: #7f9491; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.nav-list { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 13px; color: var(--sidebar-muted); background: transparent; border: 1px solid transparent; border-radius: 7px; text-align: left; }
.nav-item:hover { color: #f7faf4; background: rgba(255, 255, 255, .06); }
.nav-item.is-active { color: #f8fff9; background: rgba(0, 143, 131, .28); border-color: rgba(66, 191, 179, .32); }
.nav-icon { width: 18px; color: #78c7bd; font-size: 17px; text-align: center; }
.nav-item:not(.is-active) .nav-icon { color: #819795; }
.sidebar-spacer { flex: 1; min-height: 28px; }
.side-status { display: flex; align-items: center; gap: 9px; padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.09); }
.side-status strong, .side-status small { display: block; }
.side-status strong { color: #e7f1ec; font-size: 12px; }
.side-status small { margin-top: 3px; color: #849a96; font-size: 11px; }
.status-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #31b595; box-shadow: 0 0 0 3px rgba(49, 181, 149, .12); }
.side-endpoint { display: block; padding: 10px 12px; color: #bad2ca; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 6px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link { margin: 16px 12px 0; color: #e7b56e; font-size: 12px; text-decoration: none; }
.side-link:hover { color: #ffd18c; }

.main-content { min-width: 0; padding: 0 44px 64px; }
.topbar { min-height: 106px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker { color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: 1.35px; }
.topbar h1 { margin: 7px 0 0; color: var(--ink); font-size: 25px; letter-spacing: -.3px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-button, .button, .copy-button, .text-button, .profile-button { border: 0; }
.icon-button { width: 37px; height: 37px; color: var(--muted); background: transparent; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 20px; line-height: 1; }
.icon-button:hover { color: var(--ink); background: var(--surface); }
.button { min-height: 38px; padding: 0 16px; border-radius: 7px; font-size: 13px; font-weight: 700; transition: border-color .15s, background .15s, color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--teal); border: 1px solid var(--teal); }
.button-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.button-quiet { color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); }
.button-quiet:hover { background: #eef1eb; border-color: #aebbb0; }
.button-wide { width: 100%; justify-content: center; }
.profile-button { display: flex; align-items: center; gap: 8px; min-height: 37px; padding: 0 9px 0 5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; font-size: 12px; }
.profile-button:hover { border-color: var(--teal); }
.avatar { width: 27px; height: 27px; display: grid; place-items: center; color: #fff; background: var(--plum); border-radius: 6px; font-size: 11px; font-weight: 800; }
.profile-chevron { color: var(--faint); font-size: 15px; }
.notice { margin: 20px 0 0; padding: 11px 14px; color: var(--teal-dark); background: #e6f3ef; border: 1px solid #addbd0; border-radius: 7px; font-size: 13px; }
.notice.error { color: #873d3d; background: #fae9e5; border-color: #edb8ab; }

.guest-view, .dashboard-view { padding-top: 42px; }
.guest-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); align-items: end; gap: 42px; padding: 15px 0 43px; }
.hero-copy h2 { max-width: 690px; margin: 12px 0 15px; font-size: clamp(31px, 4.1vw, 57px); line-height: 1.06; letter-spacing: -1.8px; }
.hero-copy p { max-width: 650px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-actions { display: flex; align-items: center; gap: 10px; margin-top: 25px; }
.endpoint-card { align-self: center; padding: 20px; background: var(--ink); border: 1px solid #26343a; border-radius: 8px; box-shadow: var(--shadow); }
.endpoint-card-head { display: flex; align-items: center; justify-content: space-between; color: #9fb3af; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; }
.endpoint-card > code { display: block; margin: 18px 0 16px; color: #f4bc72; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 16px; overflow: auto; white-space: nowrap; }
.endpoint-meta { display: flex; align-items: center; gap: 8px; color: #92aaa5; font-size: 11px; }
.separator { color: #4e6562; }
.copy-button { min-height: 26px; padding: 0 9px; color: var(--teal-dark); background: #e1f2ed; border: 1px solid #b1d8ce; border-radius: 5px; font-size: 11px; font-weight: 700; }
.copy-button:hover { color: #fff; background: var(--teal); border-color: var(--teal); }
.endpoint-card .copy-button { color: #d1f2e9; background: rgba(75, 195, 177, .12); border-color: rgba(75, 195, 177, .35); }
.endpoint-card .copy-button:hover { color: var(--ink); background: #d1f2e9; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-height: 128px; padding: 18px 19px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 18px rgba(23, 32, 39, .025); }
.metric-card-accent { background: #f5efe4; border-color: #e6d8bd; }
.metric-label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .25px; }
.metric-card strong { display: block; margin-top: 15px; color: var(--ink); font-size: 25px; letter-spacing: -.5px; }
.metric-card small, .metric-card a { display: block; margin-top: 7px; color: var(--faint); font-size: 11px; text-decoration: none; }
.metric-card-accent strong { color: var(--coral); }
.metric-card-accent a { color: #9a6c24; font-weight: 700; }
.guest-lower-grid, .overview-grid { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(300px, .84fr); gap: 12px; margin-top: 30px; }
.panel { min-width: 0; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 18px rgba(23, 32, 39, .025); }
.panel-head, .view-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-head h3 { margin: 7px 0 0; font-size: 16px; letter-spacing: -.1px; }
.text-button { padding: 0; color: var(--teal-dark); background: transparent; font-size: 12px; font-weight: 700; }
.text-button:hover { color: var(--coral); }
.model-preview-list { display: grid; gap: 0; margin-top: 20px; }
.model-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 15px; min-height: 56px; border-top: 1px solid var(--line); }
.model-row:first-child { border-top: 0; }
.model-row strong, .model-row small { display: block; }
.model-row strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.model-row small { margin-top: 4px; color: var(--faint); font-size: 11px; }
.model-pill { padding: 4px 7px; color: var(--good); background: #e7f4ef; border: 1px solid #c1e4d8; border-radius: 5px; font-size: 10px; font-weight: 700; }
.model-pill.offline { color: var(--muted); background: #f0f1ee; border-color: var(--line); }
.steps-list { display: grid; gap: 18px; margin: 22px 0 0; padding: 0; list-style: none; }
.steps-list li { display: flex; align-items: center; gap: 13px; }
.steps-list li > span { width: 31px; height: 31px; display: grid; place-items: center; color: var(--plum); background: #eee9f2; border: 1px solid #ded3e5; border-radius: 6px; font-size: 10px; font-weight: 800; }
.steps-list strong, .steps-list small { display: block; }
.steps-list strong { font-size: 13px; }
.steps-list small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.loading-row { padding: 24px 0; color: var(--faint); font-size: 12px; text-align: center; }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 46px 20px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 14px; }
.empty-state span { margin-bottom: 8px; font-size: 12px; }
.cell-sub { display: block; margin-top: 4px; color: var(--faint); font-size: 10px; }
.amount-cell { color: var(--coral); font-weight: 700; }

.view-heading { align-items: end; margin-bottom: 22px; }
.view-heading h2 { margin: 7px 0 7px; font-size: 26px; letter-spacing: -.5px; }
.view-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.catalog-origin, .table-caption { color: var(--faint); font-size: 11px; }
.dashboard-stats { margin-bottom: 12px; }
.dashboard-stats .metric-card { min-height: 118px; }
.endpoint-panel .large-code { display: block; margin: 21px 0 19px; padding: 13px 14px; color: var(--teal-dark); background: #edf7f2; border: 1px solid #cde8dd; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; overflow: auto; white-space: nowrap; }
.callout { display: flex; gap: 9px; margin: 0 0 18px; padding: 11px 12px; color: var(--muted); background: #f6f4ed; border-left: 3px solid var(--amber); font-size: 11px; line-height: 1.55; }
.callout-icon { width: 16px; height: 16px; display: inline-grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--amber); border-radius: 50%; font-size: 10px; font-weight: 800; }
.callout p { margin: 0; }
.recent-panel { min-height: 287px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 14px 10px; color: var(--faint); border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .65px; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 10px; color: var(--muted); border-bottom: 1px solid #edf0eb; vertical-align: middle; white-space: nowrap; }
tbody tr:hover { background: #fafaf6; }
td strong { color: var(--ink); font-size: 12px; font-weight: 700; }
.compact-table th, .compact-table td { padding: 12px 7px; }
.status-tag { display: inline-block; padding: 4px 7px; border-radius: 5px; color: var(--good); background: #e7f4ef; font-size: 10px; font-weight: 700; }
.status-tag.disabled, .status-tag.failed { color: var(--danger); background: #fae9e5; }
.status-tag.pending { color: #9a6c24; background: #fbf1da; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.mini-button { min-height: 27px; padding: 0 8px; color: var(--teal-dark); background: transparent; border: 1px solid var(--line-strong); border-radius: 5px; font-size: 10px; font-weight: 700; }
.mini-button:hover { color: #fff; background: var(--teal); border-color: var(--teal); }
.mini-button.danger { color: var(--danger); }
.mini-button.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.billing-panel { margin-top: 12px; }
.usage-stats { margin-bottom: 12px; }
.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.doc-card pre { min-height: 240px; margin: 20px 0 0; padding: 17px; color: #d8ece5; background: #1c292b; border-radius: 6px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.75; }
.doc-notes { margin-top: 12px; }
.endpoint-list { display: grid; gap: 0; margin-top: 16px; }
.endpoint-list > div { display: grid; grid-template-columns: 48px minmax(180px, 1fr) minmax(0, 1.2fr); align-items: center; gap: 13px; min-height: 50px; border-top: 1px solid var(--line); }
.endpoint-list > div:first-child { border-top: 0; }
.endpoint-list code { color: var(--teal-dark); font-size: 10px; font-weight: 800; }
.endpoint-list span { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.endpoint-list small { color: var(--muted); font-size: 11px; }

.dialog { width: min(440px, calc(100% - 28px)); padding: 0; color: var(--ink); background: transparent; border: 0; }
.dialog::backdrop { background: rgba(11, 19, 23, .52); }
.dialog-card { position: relative; display: grid; gap: 13px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 24px 60px rgba(15, 25, 30, .2); }
.dialog-close { position: absolute; top: 11px; right: 13px; width: 29px; height: 29px; color: var(--muted); background: transparent; border: 0; border-radius: 5px; font-size: 23px; line-height: 1; }
.dialog-close:hover { color: var(--ink); background: #eff1eb; }
.dialog-card h2 { margin: 0; font-size: 23px; letter-spacing: -.4px; }
.dialog-subtitle { margin: -4px 0 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.field-label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field-label input { width: 100%; height: 42px; padding: 0 11px; color: var(--ink); background: #fbfcf8; border: 1px solid var(--line-strong); border-radius: 6px; outline: 0; font-size: 13px; }
.field-label input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0, 143, 131, .1); }
.dialog-error { padding: 9px 10px; color: #873d3d; background: #fae9e5; border: 1px solid #edb8ab; border-radius: 6px; font-size: 11px; line-height: 1.45; }
.dialog-switch { justify-self: center; margin-top: 2px; }
.secret-field { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 7px 8px 7px 12px; background: #edf7f2; border: 1px solid #b9ddd0; border-radius: 6px; }
.secret-field code { min-width: 0; flex: 1; color: var(--teal-dark); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; overflow: auto; white-space: nowrap; }

@media (max-width: 1040px) {
  .main-content { padding: 0 28px 54px; }
  .guest-hero { grid-template-columns: 1fr; gap: 25px; }
  .endpoint-card { width: min(100%, 620px); }
  .guest-lower-grid, .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; display: block; padding: 13px 14px; }
  .brand { margin: 0 5px 14px; }
  .side-label, .sidebar-spacer, .side-status, .side-endpoint, .side-link { display: none; }
  .nav-list { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 1px; }
  .nav-item { width: auto; min-width: max-content; min-height: 36px; padding: 0 10px; }
  .nav-icon { display: none; }
  .main-content { padding: 0 16px 42px; }
  .topbar { min-height: 88px; align-items: center; }
  .topbar h1 { font-size: 21px; }
  .eyebrow { font-size: 9px; }
  .top-actions { gap: 5px; }
  .top-actions .button-quiet { display: none; }
  .profile-button { max-width: 125px; overflow: hidden; }
  .profile-button #profileText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .guest-view, .dashboard-view { padding-top: 27px; }
  .hero-copy h2 { font-size: 35px; letter-spacing: -1px; }
  .hero-copy p { font-size: 14px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 114px; padding: 15px; }
  .metric-card strong { margin-top: 12px; font-size: 21px; }
  .panel { padding: 17px; }
  .view-heading { align-items: flex-start; flex-direction: column; }
  .view-heading .button { width: 100%; }
  .docs-grid { grid-template-columns: 1fr; }
  .endpoint-list > div { grid-template-columns: 42px 1fr; gap: 8px; padding: 10px 0; }
  .endpoint-list small { grid-column: 2; }
}

@media (max-width: 420px) {
  .stats-grid { gap: 8px; }
  .metric-card { padding: 12px; }
  .metric-label { font-size: 10px; }
  .metric-card strong { font-size: 18px; }
  .endpoint-card > code { font-size: 13px; }
}
