.gateway-page {
  min-width: 0;
  width: 100%;
  margin: 0 auto;
}
.gateway-page .page-heading {
  margin-bottom: 22px;
}
.gateway-badge.official {
  color: #245fe5;
  background: #edf3ff;
}
.reference-disclaimer {
  margin-bottom: 20px;
}
.reference-scope {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.reference-source {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: auto;
}
.reference-source a {
  color: var(--blue);
}
.reference-tier-trigger {
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  min-height: 28px;
  justify-content: flex-start;
  gap: 4px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  text-align: left;
  white-space: normal;
}
@media (pointer: coarse) {
  .reference-tier-trigger { min-height: 42px; }
}
.reference-tier-trigger[aria-expanded="true"] {
  color: var(--blue-hover);
}
.reference-tier-popover {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  width: min(460px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 24px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 20px 20px;
  border: 1px solid #dbe5f3;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 16px 48px #183a6b26, 0 2px 8px #183a6b0d;
  z-index: 100;
}
.reference-tier-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: -16px;
  padding-top: 8px;
  padding-bottom: 8px;
  background: #fff;
  z-index: 1;
}
.reference-tier-header h3 {
  font-size: 14px;
  margin: 0;
  overflow-wrap: anywhere;
}
.reference-tier-header button {
  flex: 0 0 26px;
  min-height: 26px;
  padding: 2px;
  line-height: 20px;
}
.reference-tier {
  margin-block: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}
.reference-tier h3 {
  font-size: 11px;
  margin-bottom: 9px;
  overflow-wrap: anywhere;
}
.reference-tier dl {
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: 11px;
}
.reference-tier dl > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
}
.reference-tier dd {
  margin: 0;
}
.reference-tier-popover > .small-note {
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.reference-unverified {
  font-size: 13px;
  padding-block: 20px;
}
.gateway-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.gateway-nav a {
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--muted);
}
.gateway-nav a[aria-current="page"] {
  background: #edf3ff;
  color: #245fe5;
  font-weight: 600;
}
.gateway-notice {
  padding: 12px 15px;
  background: #f0f7fb;
  border: 1px solid #dfebf4;
  border-left: 3px solid #62bdca;
  border-radius: 7px;
  color: #4d677e;
  font-size: 12px;
}
.gateway-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}
.gateway-filters input {
  flex: 0 1 360px;
}
.gateway-filters select {
  flex: 0 1 210px;
}
.gateway-filters input,
.gateway-filters select {
  margin: 0;
  width: auto;
  min-width: 0;
  font-size: 12px;
}
.gateway-filters button {
  flex: 0 0 auto;
}
.gateway-model-grid {
  display: grid;
  /* Keep filtered results at the same readable card size as the full catalog. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}
.gateway-panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid #e0e8f1;
  border-radius: 13px;
  background: #fff;
  margin: 0 0 18px;
}
.gateway-panel h2 {
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 14px;
}
.gateway-model-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  gap: 11px;
}
.gateway-model-card h2 {
  font-size: 19px;
  overflow-wrap: anywhere;
  margin: 5px 0 0;
}
.gateway-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.gateway-provider {
  color: #697d96;
  font-size: 11px;
}
.gateway-badge {
  display: inline-block;
  font-size: 10px;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 5px;
  background: #edf2f9;
  color: #516b8a;
}
.gateway-badge.simulation {
  background: #e8f6f7;
  color: #287e8a;
}
.gateway-model-id {
  display: block;
  overflow-wrap: anywhere;
  font-size: 11px;
  color: #8292a7;
}
.gateway-model-prices {
  margin: 8px 0;
  display: grid;
  gap: 12px;
}
.gateway-model-prices > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.gateway-model-prices dt {
  font-size: 11px;
  color: #7a899e;
}
.gateway-model-prices dd {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}
.gateway-model-card p {
  margin: 0;
}
.gateway-model-limits {
  font-size: 10px;
  color: #7b8ba0;
  border-top: 1px solid #edf1f6;
  padding-top: 14px;
}
.gateway-model-card > button {
  align-self: flex-start;
  margin-top: auto;
  color: #245fe5;
  border: 0;
  padding-left: 0;
  background: none;
  font-size: 12px;
}
.gateway-wallet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}
.gateway-key-layout,
.gateway-wallet-overview,
.gateway-wallet-history,
.gateway-admin-grid,
.gateway-playground {
  display: grid;
  gap: 22px;
  align-items: start;
}
.gateway-key-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
}
.gateway-wallet-overview {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  align-items: stretch;
  margin-bottom: 22px;
}
.gateway-wallet-history {
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
}
.gateway-admin-grid {
  grid-template-columns: minmax(340px, min(38%, 500px)) minmax(0, 1fr);
}
.gateway-playground {
  grid-template-columns: clamp(360px, 32vw, 500px) minmax(0, 1fr);
  align-items: stretch;
}
.gateway-key-layout > .gateway-panel,
.gateway-wallet-overview > .gateway-panel,
.gateway-wallet-history > .gateway-panel,
.gateway-wallet-grid > .gateway-panel,
.gateway-playground > .gateway-panel {
  margin-bottom: 0;
}
.gateway-key-layout > *,
.gateway-wallet-overview > *,
.gateway-wallet-history > * {
  min-width: 0;
}
.gateway-key-create .gateway-fields {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
}
.gateway-topup-panel > p {
  max-width: 48ch;
}
.gateway-topup-panel .gateway-inline-form {
  margin-top: 20px;
}
.gateway-topup-panel .gateway-inline-form label {
  flex: 0 1 280px;
}
.gateway-wallet-card .gateway-badge {
  margin-bottom: 14px;
}
.gateway-wallet-card h2 {
  font-size: 13px;
  color: #6e8096;
}
.gateway-balance {
  display: block;
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -1px;
  margin: 15px 0 21px;
  overflow-wrap: anywhere;
}
.gateway-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}
.gateway-page label {
  font-size: 12px;
  margin: 12px 0 18px;
}
.gateway-page input,
.gateway-page select,
.gateway-page textarea {
  font-size: 13px;
}
.gateway-page input[readonly] {
  background: #f7f9fc;
}
.gateway-model-scope {
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  padding: 12px 15px;
  margin: 4px 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px 16px;
}
.gateway-model-scope legend {
  padding: 0 6px;
  font-size: 12px;
  color: #64778e;
}
.gateway-checkbox {
  display: flex;
  gap: 9px;
  align-items: center !important;
  min-width: 0;
  margin: 3px 0 !important;
}
.gateway-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
  display: inline-block;
  accent-color: #2563eb;
}
.gateway-checkbox span {
  min-width: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.gateway-checkbox small {
  display: block;
  color: #8a9aaf;
  font-size: 10px;
}
.gateway-record {
  padding: 18px 0;
  border-bottom: 1px solid #e7edf4;
  min-width: 0;
}
.gateway-record:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.gateway-record > code,
.gateway-record strong,
.gateway-record p {
  overflow-wrap: anywhere;
}
.gateway-record > code {
  display: block;
  font-size: 11px;
  color: #7c8fa8;
  margin: 7px 0;
}
.gateway-record > p {
  font-size: 12px;
  margin: 7px 0;
}
.gateway-record > button {
  font-size: 11px;
  padding-left: 0;
}
.gateway-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}
.gateway-config-grid > .gateway-record {
  padding: 16px;
  border: 1px solid #e7edf4;
  border-radius: 8px;
  background: #fafcfe;
}
.gateway-config-grid .gateway-row {
  align-items: flex-start;
}
.gateway-secret-panel {
  border-color: #b9d9e6;
  background: #f7fcfd;
}
.gateway-secret-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.gateway-secret-row input {
  flex: 1 1 220px;
  margin: 0;
  min-width: 0;
}
.gateway-secret-row button {
  font-size: 11px;
}
.gateway-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gateway-actions button {
  font-size: 12px;
}
.gateway-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}
.gateway-inline-form label {
  flex: 1 1 200px;
  margin: 0;
}
.gateway-inline-form button {
  margin-bottom: 0;
}
.gateway-empty {
  font-size: 12px;
  color: #8292a7;
  padding: 24px 0;
  text-align: center;
}
.gateway-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin-top: 14px;
}
.gateway-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}
.gateway-table th {
  font-size: 10px;
  color: #7a8da5;
  font-weight: 500;
  white-space: nowrap;
}
.gateway-table td,
.gateway-table th {
  padding: 13px 12px;
  border-bottom: 1px solid #e9eef5;
  vertical-align: top;
}
.gateway-table td strong {
  font-weight: 500;
  display: block;
  overflow-wrap: anywhere;
  max-width: 220px;
}
.gateway-table td small {
  display: block;
  color: #8a9ab0;
  margin-top: 4px;
}
.gateway-table td,
.gateway-table th {
  overflow-wrap: anywhere;
}
.gateway-usage-panel .gateway-table :is(th, td):first-child,
.gateway-ledger-panel .gateway-table :is(th, td):first-child {
  width: 180px;
}
.gateway-usage-panel .gateway-table :is(th, td):nth-child(3),
.gateway-usage-panel .gateway-table :is(th, td):last-child {
  width: 90px;
}
.gateway-usage-panel .gateway-table :is(th, td):is(:nth-child(4), :nth-child(5), :nth-child(6)) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gateway-usage-panel .gateway-table :is(th, td):is(:nth-child(4), :nth-child(5)) {
  width: 110px;
}
.gateway-usage-panel .gateway-table :is(th, td):nth-child(6) {
  width: 130px;
}
.gateway-ledger-panel .gateway-table :is(th, td):nth-child(4) {
  width: 130px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gateway-admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.gateway-admin-links button {
  font-size: 12px;
  padding: 8px 13px;
}
.gateway-admin-section {
  scroll-margin-top: 100px;
}
.gateway-admin-grid > .gateway-panel {
  margin-bottom: 22px;
}
.gateway-example {
  margin-top: 25px;
  border-top: 1px solid #e7edf4;
  padding-top: 17px;
}
.gateway-example summary {
  font-size: 12px;
  color: #5f7999;
  cursor: pointer;
}
.gateway-example pre {
  font-size: 10px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 15px;
  background: #f6f9fc;
  border-radius: 7px;
}
.gateway-response {
  display: flex;
  flex-direction: column;
  min-height: 360px;
}
.gateway-response > .gateway-empty {
  display: grid;
  place-items: center;
  flex: 1;
  margin: 0;
}
.gateway-response > .gateway-badge {
  align-self: flex-start;
}
.gateway-response > .small-note {
  margin-top: auto;
  padding-top: 20px;
}
.gateway-response-text {
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 22px 0;
  max-width: 80ch;
  color: #304b69;
}
#gateway-error:empty {
  display: none;
}
.gateway-page button:disabled {
  cursor: not-allowed;
}
.gateway-page .gateway-actions button {
  white-space: normal;
}
.gateway-admin-grid form {
  min-width: 0;
}
.gateway-page textarea {
  resize: vertical;
}
@media (max-width: 1050px) {
  .gateway-admin-grid,
  .gateway-key-layout,
  .gateway-wallet-overview,
  .gateway-wallet-history {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .gateway-playground {
    grid-template-columns: 1fr;
  }
  .gateway-response {
    min-height: 280px;
  }
}
@media (max-width: 720px) {
  .gateway-model-grid,
  .gateway-wallet-grid,
  .gateway-playground {
    grid-template-columns: 1fr;
  }
  .gateway-fields,
  .gateway-key-create .gateway-fields {
    grid-template-columns: 1fr;
  }
  .gateway-filters input {
    flex-basis: 100%;
  }
  .gateway-filters select {
    flex: 1 1 140px;
  }
  .gateway-topup-panel .gateway-inline-form label {
    flex: 1 1 180px;
  }
  .gateway-panel {
    padding: 20px;
  }
  .gateway-nav {
    gap: 4px;
  }
  .gateway-nav a {
    font-size: 11px;
    padding: 7px 9px;
  }
  .gateway-model-card h2 {
    font-size: 18px;
  }
  .gateway-balance {
    font-size: 28px;
  }
  .gateway-secret-row input {
    flex-basis: 100%;
  }
  .gateway-page .page-heading h1 {
    font-size: 25px;
  }
  .gateway-model-scope {
    grid-template-columns: 1fr;
  }
  .gateway-model-prices dd {
    font-size: 13px;
  }
  .gateway-response {
    min-height: 220px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gateway-page * {
    scroll-behavior: auto !important;
  }
}
