:root {
  --docs-max-width: 1180px;
  --docs-sidebar-width: 252px;
  --docs-gutter: 18px;
  --docs-shell-pad-x: 18px;
}

body {
  background: var(--bg);
}

.docsPage {
  min-height: 100vh;
  width: 100%;
  box-sizing: border-box;
}

.docsUtilityBar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: var(--surfaceToolbar);
  backdrop-filter: blur(8px);
}

.docsUtilityInner {
  max-width: var(--docs-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 12px var(--docs-shell-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
}

.docsBrandGroup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.docsBrand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--text);
}

.docsBrand:hover {
  color: var(--text);
}

.docsBrandMark {
  width: 1.3rem;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.docsBrandMark .mark-tri,
.docsBrandMark .mark-dot {
  fill: #ff3b30;
}

html[data-theme="dark"] .docsBrandMark .mark-dot {
  fill: #ffffff;
}

.docsBrandWord {
  height: 0.62rem;
  width: auto;
  display: block;
  flex: 0 0 auto;
  color: var(--text);
}

.docsBrandDivider {
  width: 1px;
  height: 18px;
  background: var(--textMuted);
  opacity: 0.45;
}

.docsSurfaceLabel {
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--textMuted);
  white-space: nowrap;
}

.docsUtilityActions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Portal-parity header actions — keep in sync with developers/src/styles.css */

.docsUtilityActions button {
  font: inherit;
  margin: 0;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.docsUtilityActions .iconToggle {
  display: inline-grid;
  place-items: center;
  width: var(--btn-height);
  height: var(--btn-height);
  padding: 0;
  border-radius: var(--btn-radius);
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  background: transparent;
  color: var(--textMuted);
  flex-shrink: 0;
  line-height: 0;
}

.docsUtilityActions .iconToggle:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surfaceMuted) 90%, var(--accent) 10%);
  border-color: color-mix(in srgb, var(--border) 55%, var(--accent) 45%);
}

.docsUtilityActions .iconToggleHeader {
  border-color: transparent;
  background: transparent;
}

.docsUtilityActions .iconToggleHeader:hover {
  background: color-mix(in srgb, var(--surfaceMuted) 88%, var(--accent) 12%);
  border-color: var(--borderSubtle);
}

html[data-theme="dark"] .docsUtilityActions .iconToggle {
  color: var(--textMuted);
}

html[data-theme="dark"] .docsUtilityActions .iconToggle:hover {
  color: var(--secondaryText);
  background: color-mix(in srgb, var(--surfaceMuted) 78%, var(--accent) 22%);
}

html[data-theme="dark"] .docsUtilityActions .iconToggleHeader:hover {
  background: color-mix(in srgb, var(--surfaceMuted) 75%, var(--accent) 25%);
}

.docsUtilityActions a.btnGhost {
  text-decoration: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-height);
  padding: 0 12px;
  border-radius: var(--btn-radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--textMuted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.docsUtilityActions a.btnGhost:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surfaceMuted) 88%, var(--accent) 12%);
  border-color: var(--borderSubtle);
}

.docsUtilityActions a.btnGhost:active {
  background: color-mix(in srgb, var(--surfaceMuted) 80%, var(--accent) 20%);
}

html[data-theme="dark"] .docsUtilityActions a.btnGhost {
  border-color: transparent;
}

html[data-theme="dark"] .docsUtilityActions a.btnGhost:hover {
  color: var(--secondaryText);
  background: color-mix(in srgb, var(--surfaceMuted) 75%, var(--accent) 25%);
  border-color: color-mix(in srgb, var(--border) 45%, var(--accent) 55%);
}

.docsUtilityBar .themeIcon {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.docsUtilityBar .themeIconMoon {
  fill: currentColor;
  stroke: none;
}

/* Mobile-first: one full-width column. A fixed sidebar + main only when the viewport is wide enough. */
.docsShell {
  max-width: var(--docs-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 18px var(--docs-shell-pad-x) 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--docs-gutter);
  box-sizing: border-box;
}

.docsShell > * {
  min-width: 0;
}

.docsSidebar {
  position: static;
  min-width: 0;
}

/* Matches developer portal .consoleBentoRail: muted shell + gutters between inner cards. */
.docsSidebarBento {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadowSm);
  background-color: var(--surfaceMuted);
}

.docsSidebarBento > .docsBentoSection {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
  background: var(--surface);
}

.docsSidebarBentoHeader {
  padding: 12px 14px;
}

.docsSidebarBentoNav {
  padding: 10px 10px;
}

.docsSidebarTitle {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--textMuted);
}

.docsNavList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  grid-template-columns: minmax(0, 1fr);
}

.docsNavLink {
  display: block;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: color-mix(in srgb, var(--text) 78%, var(--textMuted) 22%);
  text-decoration: none;
  font-size: 0.83rem;
  line-height: 1.33;
  transition:
    background-color 130ms ease,
    border-color 130ms ease,
    color 130ms ease;
}

.docsNavLink:hover {
  background: color-mix(in srgb, var(--surfaceMuted) 92%, var(--accent) 8%);
  border-color: var(--borderSubtle);
  color: var(--text);
}

.docsNavLink[aria-current="true"] {
  background: color-mix(in srgb, var(--surfaceMuted) 84%, var(--accent) 16%);
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
  color: var(--text);
  font-weight: 600;
}

.docsMain {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Portal-parity bento: muted shell, small gutters between inner cards (see developers/src/styles.css .consoleBento). */
.docsBento {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadowSm);
  background: var(--surfaceMuted);
}

.docsBento > .docsBentoSection,
.docsBento > section {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
  background: var(--surface);
  scroll-margin-top: 94px;
  min-width: 0;
}

.docsBentoIntro .lead {
  margin-bottom: 0;
}

.docsEyebrow {
  margin: 0 0 8px;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--textMuted);
}

main h1 {
  margin: 0 0 8px;
  font-size: clamp(1.48rem, 2.5vw, 1.82rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 26px;
  max-width: 54rem;
  color: var(--textMuted);
  font-size: 0.92rem;
  line-height: 1.55;
}

section {
  scroll-margin-top: 94px;
}

h2 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 1.03rem;
  letter-spacing: -0.01em;
}

h3 {
  margin: 16px 0 10px;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 11px;
  font-size: 0.92rem;
  line-height: 1.58;
}

ul,
ol {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 0.9rem;
  line-height: 1.56;
}

li + li {
  margin-top: 4px;
}

hr {
  border: 0;
  border-top: 1px solid var(--borderSubtle);
  margin: 16px 0;
}

code {
  font-size: 0.86em;
  background: var(--code-inline-bg);
  border: 1px solid var(--code-inline-border);
  border-radius: 6px;
  padding: 1px 5px;
}

pre {
  margin: 0 0 12px;
  padding: 13px 14px;
  border: 1px solid var(--code-block-border);
  border-radius: 10px;
  background: var(--code-block-bg);
  color: color-mix(in srgb, var(--text) 90%, #ffffff 10%);
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.58;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

table {
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
  border-collapse: collapse;
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .docsMain table {
    table-layout: fixed;
  }
}

.docsMain td,
.docsMain th {
  word-break: break-word;
  overflow-wrap: anywhere;
}

thead th {
  font-size: 0.73rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--textMuted);
  border-bottom-width: 1px;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

ul.errorList {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.docsFooter {
  border-top: 1px solid var(--borderSubtle);
  padding-top: 14px;
  margin-top: 4px;
  color: var(--textMuted);
  font-size: 0.81rem;
}

@media (min-width: 701px) and (max-width: 980px) {
  .docsNavList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .docsBento > .docsBentoSection,
  .docsBento > section {
    padding: 16px 18px;
  }
}

@media (min-width: 981px) {
  .docsShell {
    grid-template-columns: var(--docs-sidebar-width) minmax(0, 1fr);
    gap: var(--docs-gutter);
  }

  .docsSidebar {
    position: sticky;
    top: var(--docs-sticky-rail-top);
  }

  .docsBento > .docsBentoSection,
  .docsBento > section {
    padding: 18px 20px;
  }
}

@media (max-width: 700px) {
  .docsUtilityInner {
    flex-wrap: wrap;
    align-items: center;
  }

  .docsUtilityActions {
    width: 100%;
    justify-content: space-between;
  }

  .docsShell {
    padding: 14px 14px 34px;
  }

  .docsNavList {
    grid-template-columns: 1fr;
  }

  .docsBento > .docsBentoSection,
  .docsBento > section {
    padding: 14px 16px;
  }
}
