:root {
    color-scheme: light;
    font-family: var(--relay-font);
    --ink: var(--relay-ink);
    --muted: var(--relay-muted);
    --line: var(--relay-border);
    --blue: var(--relay-accent);
    --blue-bg: var(--relay-accent-soft);
    --page: var(--relay-bg);
    color: var(--ink);
    background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }
:where(a, button, input, summary):focus-visible { outline: 2px solid #1684bd; outline-offset: 3px; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
code, pre { font-family: "IBM Plex Mono", Consolas, ui-monospace, monospace; }

.topbar { background: white; border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: calc(var(--relay-header-height) - 1px); padding: 8px var(--relay-page-pad); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-layout { display: grid; grid-template-columns: var(--relay-sidebar-width) minmax(0, 1fr); min-height: calc(100vh - var(--relay-header-height)); }
.button { border: 1px solid var(--line); border-radius: 7px; min-height: 33px; padding: 5px 10px; display: inline-flex; align-items: center; justify-content: center; background: white; color: var(--ink); font-size: 12px; font-weight: 550; white-space: nowrap; }
.button:hover { text-decoration: none; border-color: #81b9d8; color: var(--blue); }
.button.primary { background: var(--relay-control); border-color: var(--relay-control); color: var(--relay-on-control); }
.button.primary:hover { filter: brightness(.93); }
main { min-width: 0; padding: 22px var(--relay-page-pad) 52px; }
.page-heading { margin-bottom: 18px; }
.page-heading h1 { font-size: 24px; line-height: 1.3; letter-spacing: -.02em; }
.page-heading p { margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.catalog-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 12px 24px; }
.catalog-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 14px; margin-bottom: 11px; }
.catalog-search { position: relative; flex: 1 1 240px; max-width: 420px; }
.catalog-search label { position: absolute; overflow: hidden; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; }
.search-icon { position: absolute; top: 11px; left: 13px; width: 11px; height: 11px; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ''; position: absolute; width: 6px; height: 1.5px; background: var(--muted); transform: rotate(45deg); top: 9px; left: 7px; }
.catalog-search input { width: 100%; min-height: 36px; padding: 7px 12px 7px 34px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font-size: 13px; }
.catalog-search input::placeholder { color: var(--muted); }
.catalog-filters { display: flex; gap: 4px; }
.catalog-filters [aria-pressed="true"] { border-color: #b7d5e6; color: var(--blue); background: var(--blue-bg); }
.catalog-group-picker { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; color: var(--muted); }
.catalog-group-picker label { flex-shrink: 0; }
.catalog-group-picker select { max-width: min(240px, 74vw); min-height: 34px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; font: inherit; }
.catalog-context { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 6px 12px; margin-bottom: 11px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.billing-tip { max-width: 44em; }
.billing-tip summary { color: var(--blue); cursor: pointer; }
.billing-tip p { margin-top: 5px; }
.notice { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; border: 1px solid #cbe4f2; border-radius: 8px; padding: 10px 13px; color: #28576e; background: var(--blue-bg); font-size: 13px; }

.catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 14px; }
#catalog { display: grid; gap: 12px; }
.group, .empty, .guide, .model-selection { border: 1px solid var(--line); border-radius: 11px; background: white; }
.group-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px 16px; padding: 15px 17px; }
.group-header h2 { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.multiplier { padding: 4px 8px; border-radius: 5px; background: var(--blue-bg); color: var(--blue); font-size: 11px; font-variant-numeric: tabular-nums; }
.group-models { border-top: 1px solid var(--line); }
.group-models summary { display: flex; align-items: center; gap: 10px; padding: 11px 17px; color: var(--blue); font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.group-models summary::-webkit-details-marker { display: none; }
.group-models summary:hover { background: #f4f9fc; }
.group-models summary::before { content: ''; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.group-models[open] summary::before { transform: rotate(45deg); }
.group-models[open] summary { border-bottom: 1px solid var(--line); }
.model-list { list-style: none; padding: 0; }
.model + .model { border-top: 1px solid var(--line); }
.model-pick { width: 100%; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 13px 16px; border: 0; border-inline-start: 3px solid transparent; background: transparent; color: var(--ink); text-align: start; }
.model-pick:hover { background: #f4f9fc; }
.model-pick[aria-pressed="true"] { border-inline-start-color: var(--relay-control); background: var(--blue-bg); }
.model-pick:focus-visible { outline-offset: -3px; }
.model-identity { display: grid; min-width: 0; gap: 3px; }
.model-name { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.model-vendor, .model-rate { font-size: 12px; color: var(--muted); line-height: 1.5; }
.model-rate { font-variant-numeric: tabular-nums; }
.protocols { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.protocol { padding: 3px 7px; border-radius: 5px; background: var(--blue-bg); color: var(--blue); font-size: 11px; }
.prices { display: flex; flex-wrap: wrap; gap: 5px 14px; }
.prices > div { display: grid; gap: 3px; }
.prices dt, .unit { color: var(--muted); font-size: 11px; }
.prices dd { font-size: 13px; font-variant-numeric: tabular-nums; }
.unit { margin-top: 5px; }
.price-link { font-size: 13px; }
.model-selection { min-width: 0; padding: 16px; }
.selection-label, .selection-group, .selection-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.model-selection h2 { margin-top: 3px; font-size: 18px; overflow-wrap: anywhere; }
.selection-group { margin-top: 4px; }
.selection-price { margin-block: 13px; padding-block: 10px; border-block: 1px solid var(--line); }
.selection-price > .price-link { display: inline-block; margin-top: 6px; }
.import-current { width: 100%; min-height: 38px; }
.import-current:disabled { cursor: default; opacity: .55; filter: none; }
.selection-hint { margin-top: 6px; }
.selection-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty strong { display: block; color: var(--ink); }
.empty p { margin-top: 6px; }
.empty .price-link { display: inline-block; margin-top: 12px; }

.connect-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 18px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 54px #172b4d26; color: var(--ink); }
.connect-dialog::backdrop { background: #172b4d66; }
.connect-dialog h2 { font-size: 18px; }
.connect-details { display: grid; gap: 6px; margin-block: 13px; padding: 10px; border-radius: 8px; background: var(--page); font-size: 13px; }
.connect-details > div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; }
.connect-details dt { color: var(--muted); }
.connect-details dd { overflow-wrap: anywhere; }
.connect-dialog label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; }
.connect-dialog input { width: 100%; min-height: 37px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; }
.connect-dialog p { margin-top: 7px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.dialog-actions { display: flex; justify-content: end; gap: 7px; margin-top: 13px; }

.welcome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .75fr); align-items: center; gap: 23px; padding: clamp(20px, 5vw, 48px); border: 1px solid #d8e8f1; border-radius: 14px; background: linear-gradient(118deg, white 48%, #e9f5fb); }
.welcome h1 { max-width: 14em; font-size: clamp(28px, 3.4vw, 48px); line-height: 1.12; letter-spacing: -.045em; }
.welcome-body p { margin-block: 13px 19px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.welcome-actions .button { min-height: 38px; padding-inline: 14px; }
.endpoint-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 15px; border: 1px solid #d5e4ef; border-radius: 10px; background: var(--relay-surface); }
.endpoint-box p { grid-column: 1 / -1; font-size: 12px; font-weight: 650; }
.endpoint-box code { overflow-wrap: anywhere; font-size: 13px; color: var(--blue); }
.getting-started { margin-top: 23px; }
.getting-started h2 { margin-bottom: 10px; font-size: 17px; }
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.start-grid a { display: grid; align-content: start; gap: 7px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--relay-surface); color: var(--ink); }
.start-grid a:hover { border-color: #8ebed4; text-decoration: none; }
.start-grid strong { color: var(--blue); font-size: 14px; }
.start-grid span { color: var(--muted); font-size: 13px; line-height: 1.55; }

.guide { max-width: 810px; padding: 0 19px; }
.guide section { padding-block: 17px; }
.guide section + section { border-top: 1px solid var(--line); }
.guide h2 { font-size: 16px; }
.guide summary { color: var(--blue); font-size: 14px; font-weight: 650; cursor: pointer; }
.guide p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.guide p a { text-decoration: underline; text-underline-offset: 2px; }
.doc-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; font-size: 13px; }
.doc-nav a { padding-block: 4px; }
.docs-guide section { scroll-margin-top: 14px; }
.docs-guide ol { margin-block: 8px 0; padding-inline-start: 22px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.docs-guide li + li { margin-top: 6px; }
.docs-guide p { font-size: 14px; }
.docs-guide details { margin-top: 11px; }
.docs-guide .price-notice { color: #28576e; }
.price-table-scroll { margin-top: 12px; overflow-x: auto; }
.doc-price-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.doc-price-table caption { padding-bottom: 8px; text-align: left; font-weight: 650; }
.doc-price-table :is(th, td) { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.doc-price-table thead { background: var(--blue-bg); color: #28576e; }
.doc-price-table tbody th { white-space: nowrap; font-weight: 550; }
.snippet { margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); }
.snippet > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.snippet pre { overflow: auto; margin: 0; padding: 11px; font-size: 12px; line-height: 1.6; }
.toast { position: fixed; inset: auto 15px 15px auto; padding: 9px 12px; border-radius: 7px; background: var(--ink); color: white; font-size: 13px; }

.creative-workspace { display: grid; min-height: max(500px, calc(100svh - 190px)); grid-template-rows: minmax(260px, 1fr) auto; border: 1px solid var(--line); border-radius: 13px; background: white; overflow: hidden; }
.creative-canvas { display: grid; grid-template-rows: auto 1fr; min-width: 0; background-color: #f8fafc; background-image: radial-gradient(#cdd9e3 1px, transparent 1px); background-size: 20px 20px; }
.creative-canvas > header { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; font-size: 12px; color: var(--muted); }
.creative-empty { align-self: center; justify-self: center; max-width: 100%; padding: 18px; text-align: center; }
.creative-mark { display: inline-grid; place-items: center; width: 43px; height: 43px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--blue); font-size: 24px; }
.creative-empty h2 { font-size: 20px; }
.creative-empty p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.creative-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 13px; }
.creative-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(225px, 100%), 300px)); align-content: start; justify-content: center; gap: 12px; padding: 14px; }
.creative-results figure { display: grid; gap: 8px; margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.creative-results img { display: block; width: 100%; height: auto; border-radius: 6px; }
.creative-results figcaption { display: flex; justify-content: end; }
.creative-composer { width: min(100%, 840px); justify-self: center; padding: 14px 16px; }
.creative-composer label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 650; }
.creative-composer :is(textarea, input) { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font: inherit; font-size: 14px; }
.creative-composer textarea { min-height: 62px; resize: vertical; }
.creative-composer details { margin-bottom: 8px; font-size: 13px; }
.creative-composer details summary { margin-bottom: 7px; color: var(--blue); cursor: pointer; }
.creative-composer details p { margin-top: 5px; color: var(--muted); }
.creative-footer, .creative-notice, .creative-specs, .creative-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.creative-footer, .creative-notice { justify-content: space-between; margin-top: 7px; }
.creative-specs :is(span, code) { padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; }
.creative-actions, .creative-notice { font-size: 12px; color: var(--muted); line-height: 1.5; }
.creative-actions button:disabled { cursor: default; opacity: .55; filter: none; }

@media (max-width: 900px) {
    .welcome { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1030px) {
    .catalog-layout:has(.model-selection:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(245px, 300px); }
    .model-selection { position: sticky; top: 15px; }
}

@media (max-width: 767px) {
    .site-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
}

@media (max-width: 640px) {
    .catalog-search { flex-basis: 100%; max-width: none; }
    .start-grid { grid-template-columns: minmax(0, 1fr); }
}
