/* SBB Data API docs: the brand purple and teal from the SBB logo. */

:root {
  --background: #f7f5fc;
  --surface: #ffffff;
  --surface-alt: #eee9f8;
  --border: #ddd5f0;
  --ink: #24143f;
  --ink-soft: #3a2270;
  --text-primary: #24143f;
  --text-secondary: rgba(36, 20, 63, 0.68);
  --text-muted: rgba(36, 20, 63, 0.5);
  --accent: #4b2d8e;
  --accent-ink: #ffffff;
  --danger: #f04438;
  --danger-muted: rgba(240, 68, 56, 0.1);
  --warning: #f79009;
  --warning-muted: rgba(247, 144, 9, 0.1);
  --success: #12b76a;
  --success-muted: rgba(18, 183, 106, 0.1);
  --info: #2e6fdb;
  --info-muted: rgba(46, 111, 219, 0.1);
  --code-bg: #1c1033;
  --code-text: #ece6fa;
  --sidebar-width: 280px;
  --content-max: 760px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

a { color: inherit; }

code, pre, .mono { font-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(247, 245, 252, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; text-decoration: none; color: var(--text-primary); }
.topbar__brand img { height: 26px; width: auto; display: block; }
.topbar__spacer { flex: 1; }
.topbar__link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; text-decoration: none;
  padding: 9px 16px; border-radius: 8px;
  background: var(--ink); color: #fff;
}
.topbar__link:hover { background: var(--ink-soft); }
.topbar__menu-btn {
  display: none;
  border: none; background: var(--surface-alt); color: var(--text-primary);
  width: 36px; height: 36px; border-radius: 8px; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ---------- Layout ---------- */
.layout { display: flex; padding-top: 64px; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 64px; bottom: 0; left: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  padding: 24px 16px 60px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.sidebar__group { margin-bottom: 22px; }
.sidebar__link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
  text-decoration: none;
}
.sidebar__link:hover { background: var(--surface-alt); color: var(--text-primary); }
.sidebar__link.is-active { background: var(--accent); color: var(--accent-ink); }
.sidebar__method {
  font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 4px;
  min-width: 34px; text-align: center; letter-spacing: 0.02em;
}
.sidebar__method--get { background: var(--success-muted); color: var(--success); }
.sidebar__method--post { background: var(--info-muted); color: var(--info); }

.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 48px 32px 120px;
  max-width: calc(var(--content-max) + 64px);
}

/* ---------- Typography ---------- */
h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 10px; }
h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 6px; scroll-margin-top: 84px; }
h3 { font-size: 17px; font-weight: 800; margin: 0 0 4px; }
p { color: var(--text-secondary); margin: 0 0 16px; }
.lede { font-size: 16.5px; color: var(--text-secondary); max-width: var(--content-max); margin-bottom: 24px; }
.section { margin-bottom: 56px; padding-top: 12px; }
.section-intro { margin-bottom: 28px; }
.section-intro h2 { border: none; padding: 0; margin-bottom: 6px; }
.note { font-size: 13px; color: var(--text-muted); }
.note--tight { margin-top: 8px; }
.list-plain { color: var(--text-secondary); font-size: 14px; padding-left: 20px; }
.eyebrow { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 6px; }

/* ---------- Endpoint card ---------- */
.endpoint { margin-bottom: 48px; border-top: 1px solid var(--border); padding-top: 32px; }
.endpoint:first-of-type { border-top: none; padding-top: 0; }
.endpoint__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.method {
  font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 6px; letter-spacing: 0.03em;
}
.method--get { background: var(--success-muted); color: var(--success); }
.method--post { background: var(--info-muted); color: var(--info); }
.method--patch { background: var(--warning-muted); color: var(--warning); }
.method--delete { background: var(--danger-muted); color: var(--danger); }
.endpoint__path { font-family: 'SFMono-Regular', ui-monospace, monospace; font-size: 14.5px; font-weight: 700; color: var(--text-primary); word-break: break-all; }
.badge {
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-alt); color: var(--text-secondary);
}
.badge--auth { background: var(--ink); color: #fff; }

/* Endpoint header path/badge, mode-filtered: an endpoint that lists more
   than one shape (Native/MSORG/ADEX) used to show every shape's label and
   a single native-only path at once, regardless of which mode the global
   switcher had selected -- noise once you've picked a mode and only care
   about its own real path. One [data-mode-path]/[data-mode-badge] span per
   mode now; only the one matching html[data-api-mode] renders. An endpoint
   with no equivalent in a given mode (e.g. ADEX has no transaction-lookup)
   simply has no span for it, so the header goes quiet for that mode rather
   than showing something misleading. */
[data-mode-path], [data-mode-badge] { display: none; }
html[data-api-mode="native"] [data-mode-path="native"],
html[data-api-mode="msorg"] [data-mode-path="msorg"],
html[data-api-mode="adex"] [data-mode-path="adex"] { display: inline; }
html[data-api-mode="native"] [data-mode-badge="native"],
html[data-api-mode="msorg"] [data-mode-badge="msorg"],
html[data-api-mode="adex"] [data-mode-badge="adex"] { display: inline-block; }

/* ---------- Tables ---------- */
.param-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 13.5px; }
.param-table th {
  text-align: left; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.param-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: top; }
.param-table code { background: var(--surface-alt); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; color: var(--text-primary); }
.param-table .req { color: var(--danger); font-weight: 800; font-size: 11px; }
.param-table .opt { color: var(--text-muted); font-weight: 700; font-size: 11px; }

/* ---------- Code blocks ---------- */
.code-tabs { border-radius: 12px; overflow: hidden; margin: 16px 0 24px; background: var(--code-bg); }
.code-tabs__bar { display: flex; align-items: center; gap: 2px; padding: 8px 10px; background: rgba(255,255,255,0.04); }
.code-tabs__tab {
  border: none; background: transparent; color: rgba(236,230,250,0.6);
  font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  font-family: inherit;
}
.code-tabs__tab.is-active { background: rgba(255,255,255,0.1); color: var(--code-text); }
.code-tabs__copy {
  margin-left: auto; border: none; background: transparent; color: rgba(236,230,250,0.6);
  font-size: 11.5px; font-weight: 700; padding: 6px 10px; border-radius: 7px; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
}
.code-tabs__copy:hover { color: var(--code-text); }
.code-tabs__panel { display: none; }
.code-tabs__panel.is-active { display: block; }
.code-tabs__panel pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  color: var(--code-text); font-size: 12.8px; line-height: 1.65;
}

/* Minimal manual syntax coloring (no JS highlighter dependency) */
.tok-key { color: #7fe0d6; }
.tok-str { color: #ffd08a; }
.tok-num { color: #a3d9ff; }
.tok-bool { color: #f7a2c1; }
.tok-comment { color: rgba(236,230,250,0.45); font-style: italic; }
.tok-method { color: #ffb4a8; font-weight: 700; }

/* ---------- Callouts ---------- */
.callout { border-radius: 12px; padding: 16px 18px; margin: 16px 0 24px; font-size: 13.5px; }
.callout p:last-child { margin-bottom: 0; }
.callout__title { font-weight: 800; font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; gap: 7px; }
.callout--info { background: var(--info-muted); }
.callout--info .callout__title { color: var(--info); }
.callout--warn { background: var(--warning-muted); }
.callout--warn .callout__title { color: var(--warning); }
.callout--danger { background: var(--danger-muted); }
.callout--danger .callout__title { color: var(--danger); }
.callout p { color: var(--text-primary); opacity: 0.85; }

/* ---------- Misc ---------- */
.hr { height: 1px; background: var(--border); border: none; margin: 40px 0; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 20px; }
.pill { font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--surface-alt); color: var(--text-secondary); }
.err-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 16px 0; }
.err-table th { text-align: left; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--border); }
.err-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.status { font-family: monospace; font-weight: 800; font-size: 13px; }
.status--4 { color: var(--warning); }
.status--5 { color: var(--danger); }
.status--2 { color: var(--success); }
.cta-card {
  background: var(--ink); color: #fff; border-radius: 16px; padding: 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin-top: 8px;
}
.cta-card h3 { color: #fff; margin: 0 0 4px; }
.cta-card p { color: rgba(255,255,255,0.65); margin: 0; }
.cta-card a {
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13.5px;
  padding: 12px 20px; border-radius: 10px; text-decoration: none; white-space: nowrap;
}
footer { margin-left: var(--sidebar-width); padding: 28px 32px 60px; color: var(--text-muted); font-size: 12.5px; }

/* ---------- Sidebar search & collapsible groups ---------- */
.sidebar__search-wrap { position: relative; padding: 0 4px 14px; }
.sidebar__search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.sidebar__search {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-alt); color: var(--text-primary); font-size: 13px; font-family: inherit;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
.sidebar__search::placeholder { color: var(--text-muted); }
.sidebar__search:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.sidebar__search::-webkit-search-cancel-button,
.sidebar__search::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.sidebar__standalone-link {
  display: flex; align-items: center; gap: 9px; margin: 0 4px 18px; padding: 9px 12px;
  border-radius: 10px; background: var(--surface-alt); color: var(--ink);
  font-size: 13.5px; font-weight: 800; text-decoration: none;
}
.sidebar__standalone-link:hover { background: var(--accent); color: var(--accent-ink); }
.sidebar__standalone-link svg { flex-shrink: 0; }

.sidebar__group-title {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%;
  cursor: pointer; user-select: none; text-align: left;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: none; border: none; border-radius: 8px; box-shadow: none; margin: 0; outline: none;
  font: inherit; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: 6px 12px 8px;
}
.sidebar__group-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar__group-title:hover { color: var(--text-primary); }
.sidebar__group-title svg { transition: transform 0.15s ease; flex-shrink: 0; opacity: 0.6; }
.sidebar__group.is-collapsed .sidebar__group-title svg { transform: rotate(-90deg); }
.sidebar__group.is-collapsed .sidebar__links { display: none; }
.sidebar__group[hidden] { display: none; }
.sidebar__link[hidden] { display: none; }

/* ---------- Breadcrumb / location label ---------- */
.crumb {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  margin-bottom: 18px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.crumb__sep { opacity: 0.45; }
.crumb__current { color: var(--ink-soft); }

/* ---------- Global API mode switcher (Native / MSORG / ADEX) ---------- */
/* One page-wide control, not a per-endpoint one -- it sets data-api-mode on
   <html>, and every .mode-tabs__panel below reacts to that single attribute
   (see the visibility rules further down). Sticky so it's reachable from
   anywhere on the page, not just back at the top. */
.api-mode-switcher {
  position: sticky; top: 64px; z-index: 40;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; margin: 0 -32px 28px; border-bottom: 1px solid var(--border);
  background: rgba(247, 245, 252, 0.96); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.api-mode-switcher__label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.api-mode-switcher__tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
  font-size: 13px; font-weight: 800; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px;
}
.api-mode-switcher__tab:hover { color: var(--text-primary); }
.api-mode-switcher__tab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.api-mode-switcher__tag { font-size: 9.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--surface-alt); color: var(--text-muted); }
.api-mode-switcher__tab.is-active .api-mode-switcher__tag { background: rgba(255,255,255,0.18); color: #fff; }

/* ---------- Mode panels (each endpoint's Native/MSORG/ADEX content) ---------- */
/* No more per-endpoint tab bar -- the global switcher above drives which
   panel shows, everywhere on the page, via the html[data-api-mode] rules. */
.mode-tabs { margin: 18px 0 32px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.mode-tabs__panel { display: none; padding: 24px; }
.mode-tabs__panel > *:first-child { margin-top: 0; }
html[data-api-mode="native"] .mode-tabs__panel[data-mode-panel="native"] { display: block; }
html[data-api-mode="msorg"] .mode-tabs__panel[data-mode-panel="msorg"] { display: block; }
html[data-api-mode="adex"] .mode-tabs__panel[data-mode-panel="adex"] { display: block; }
.mode-tabs__unavailable { display: none; padding: 24px; color: var(--text-muted); font-size: 13.5px; }
html[data-api-mode="native"] .mode-tabs__unavailable[data-mode-panel="native"],
html[data-api-mode="msorg"] .mode-tabs__unavailable[data-mode-panel="msorg"],
html[data-api-mode="adex"] .mode-tabs__unavailable[data-mode-panel="adex"] { display: block; }

/* The MSORG/ADEX overview sections themselves (base URL, auth, error
   envelope, etc.) -- same switcher-driven visibility as the per-endpoint
   mode panels above. In Native mode neither shows: there's nothing
   compat-specific to say there, just the general intro paragraph above
   them (not gated, always visible). */
section[data-api-mode-panel] { display: none; }
html[data-api-mode="msorg"] section[data-api-mode-panel="msorg"] { display: block; }
html[data-api-mode="adex"] section[data-api-mode-panel="adex"] { display: block; }

/* ---------- Compat-specific bits ---------- */
.auth-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 700; color: var(--text-secondary);
  background: var(--surface-alt); padding: 10px 14px; border-radius: 10px; margin: 0 0 18px;
}
.auth-strip code { background: var(--surface); padding: 2px 7px; border-radius: 5px; color: var(--text-primary); }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0 20px; }
.mini-table th { text-align: left; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); padding: 7px 10px; border-bottom: 1px solid var(--border); }
.mini-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.mini-table code { background: var(--surface-alt); padding: 1px 6px; border-radius: 4px; color: var(--text-primary); }

/* ---------- Sandbox ("try it") ---------- */
.sandbox { border: 1px dashed var(--border); border-radius: 12px; padding: 18px 20px; margin: 18px 0 24px; background: var(--surface-alt); }
.sandbox__title { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.sandbox__hint { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.sandbox__row { margin-bottom: 12px; }
.sandbox__row label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 5px; }
.sandbox__row input, .sandbox__row textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
  font-family: 'SFMono-Regular', ui-monospace, monospace; font-size: 12.5px; background: var(--surface); color: var(--text-primary);
}
.sandbox__row textarea { min-height: 92px; resize: vertical; }
.sandbox__row input:focus, .sandbox__row textarea:focus { outline: none; border-color: var(--accent); }
.sandbox__actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.sandbox__send {
  border: none; background: var(--ink); color: #fff; font-weight: 800; font-size: 12.5px;
  padding: 10px 18px; border-radius: 8px; cursor: pointer;
}
.sandbox__send:hover { background: var(--ink-soft); }
.sandbox__send:disabled { opacity: 0.6; cursor: default; }
.sandbox__status { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.sandbox__result { margin-top: 14px; }
.sandbox__result[hidden] { display: none; }
.sandbox__result-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 6px; }
.sandbox__result pre {
  margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--code-bg); color: var(--code-text);
  font-size: 12.3px; line-height: 1.6; overflow-x: auto; max-height: 340px; white-space: pre-wrap; word-break: break-word;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.sandbox__result pre::-webkit-scrollbar { height: 6px; }
.sandbox__result pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 999px; }
.sandbox__auth-hint { margin: 6px 0 0; font-size: 11.5px; color: var(--text-muted); font-weight: 500; text-transform: none; letter-spacing: normal; }

/* ---------- Dedicated Sandbox page (#sandbox) ---------- */
.sandbox-page__controls { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin: 24px 0 18px; }
.sandbox-page__modes { display: flex; gap: 6px; flex-wrap: wrap; }
.sandbox-page__mode {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
  font-size: 13px; font-weight: 800; padding: 9px 16px; border-radius: 999px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px;
}
.sandbox-page__mode:hover { color: var(--text-primary); }
.sandbox-page__mode.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.sandbox-page__tag { font-size: 9.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--surface-alt); color: var(--text-muted); }
.sandbox-page__mode.is-active .sandbox-page__tag { background: rgba(255,255,255,0.18); color: #fff; }
.sandbox-page__endpoint-row { display: flex; flex-direction: column; gap: 5px; min-width: 220px; }
.sandbox-page__endpoint-row label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.sandbox-page__endpoint {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; background: var(--surface);
  color: var(--text-primary); font-size: 13.5px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.sandbox-page__endpoint:focus { outline: none; border-color: var(--accent); }
.sandbox-page__request-line {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 14px;
  background: var(--surface-alt); border-radius: 10px; font-family: 'SFMono-Regular', ui-monospace, monospace; font-size: 13px;
}
#sandbox-url-preview { color: var(--text-primary); word-break: break-all; }
#sandbox .sandbox { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; z-index: 60; box-shadow: 20px 0 40px rgba(0,0,0,0.08); }
  .sidebar.is-open { transform: translateX(0); }
  .content, footer { margin-left: 0; padding-left: 20px; padding-right: 20px; }
  .topbar__menu-btn { display: flex; }
  .topbar__link span { display: none; }
  h1 { font-size: 26px; }
  .backdrop { display: none; position: fixed; inset: 0; top: 64px; background: rgba(36,20,63,0.35); z-index: 55; }
  .backdrop.is-open { display: block; }
  .mode-tabs__panel { padding: 18px 14px; }
  .sandbox { padding: 16px; }
  .crumb { font-size: 11.5px; }
  .api-mode-switcher { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
  .sandbox-page__controls { flex-direction: column; align-items: stretch; gap: 14px; }
  .sandbox-page__endpoint-row { min-width: 0; }
  .sandbox-page__request-line { font-size: 11.5px; }

  /* Mode switcher becomes a full-width segmented control -- easier to read
     and tap with a thumb than three left-aligned pills, and it can't
     overflow the sticky bar's edges the way left-aligned pills with a
     label in front of them could on a narrow phone. */
  .api-mode-switcher { gap: 8px; }
  .api-mode-switcher__label { width: 100%; }
  .api-mode-switcher__tab { flex: 1; justify-content: center; padding: 10px 10px; font-size: 12.5px; }

  /* Tables never force the page itself to scroll horizontally -- each one
     scrolls within its own bounds instead, and content wraps rather than
     overflowing when it can (long union-type strings in the Type column,
     long endpoint paths). */
  .param-table, .err-table, .mini-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .param-table thead, .param-table tbody, .err-table thead, .err-table tbody, .mini-table thead, .mini-table tbody { display: table; width: 100%; }
  .param-table, .err-table, .mini-table { font-size: 12.5px; }
  .param-table th, .param-table td, .err-table th, .err-table td, .mini-table th, .mini-table td { padding: 8px 8px; word-break: break-word; }

  /* Endpoint header: path can be long (compat paths especially), so let it
     take its own line under the method/badge rather than cramming three
     flex items onto one row on a narrow screen. */
  .endpoint__head { gap: 8px 10px; }
  .endpoint__path { font-size: 13px; flex-basis: 100%; }

  /* Code blocks and callouts lose some of their desktop breathing room so
     more of a narrow screen is code/content, not padding. */
  .code-tabs__panel pre { padding: 14px; font-size: 12px; }
  .callout { padding: 14px; }

  /* Bigger, easier-to-hit tap targets throughout -- 36px+ everywhere a
     button/link is the only way to trigger something (no hover fallback
     on touch). */
  .code-tabs__tab, .code-tabs__copy { padding: 8px 12px; }
  .sidebar__link { padding: 10px 12px; }
  .sidebar__group-title { padding: 10px 12px 10px; }
  .topbar__menu-btn { width: 40px; height: 40px; }

  h2 { font-size: 21px; }
  .lede { font-size: 15px; }
}

@media (max-width: 480px) {
  .content { padding-left: 16px; padding-right: 16px; padding-top: 40px; }
  footer { padding-left: 16px; padding-right: 16px; }
  .api-mode-switcher { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .cta-card { padding: 20px; flex-direction: column; align-items: flex-start; }
  .cta-card a { width: 100%; text-align: center; }
}

/* Method badges sit in the same head row as the path, and only the active API's pair renders. */
.endpoint__head h2 { margin: 0; }
.endpoint > h2 { margin: 12px 0 6px; }
.mini-table code.mono { word-break: break-all; }

/* Keep long URLs, tables and code inside the screen on phones. */
.content { min-width: 0; }
.code-tabs, .mode-tabs, .endpoint, .sandbox { min-width: 0; max-width: 100%; }
.code-tabs__panel pre { overflow-x: auto; }
.endpoint__path, .auth-strip code, .callout code, #sandbox-url-preview { overflow-wrap: anywhere; }
@media (max-width: 920px) {
  .content { width: 100%; }
  .mini-table, .param-table { display: block; overflow-x: auto; }
  .sidebar:not(.is-open) { box-shadow: none; }
}
