  /* ── Layout ── */
  .docs-shell {
    width: min(1360px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 1.25rem;
  }

  .docs-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
  }

  /* ── Topbar ── */
  .docs-topbar {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .docs-topbar__left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
  }

  .docs-topbar__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--brand-strong);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 140ms ease, background 140ms ease;
  }

  .docs-topbar__back:hover {
    transform: translateY(-1px);
    background: var(--surface-strong);
  }

  .docs-topbar__title {
    margin: 0;
    font-size: clamp(1rem, 1.4vw, 1.3rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--brand-strong);
  }

  .docs-topbar__links {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
  }

  .docs-topbar__extlink {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--brand-strong);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: transform 140ms ease, background 140ms ease;
  }

  .docs-topbar__extlink:hover {
    transform: translateY(-1px);
    background: var(--surface-strong);
  }

  /* ── Sidebar ── */
  .docs-sidebar {
    position: sticky;
    top: 1.25rem;
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 1.1rem 0.6rem;
    overflow-y: auto;
    max-height: calc(100vh - 2.5rem);
  }

  .docs-nav__label {
    padding: 0 0.7rem;
    margin: 0 0 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
  }

  .docs-nav__group {
    margin-bottom: 1.1rem;
  }

  .docs-nav__link {
    display: block;
    padding: 0.38rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.83rem;
    line-height: 1.4;
    transition: background 120ms ease, color 120ms ease;
  }

  .docs-nav__link:hover {
    background: var(--brand-soft);
    color: var(--brand-strong);
  }

  .docs-nav__link.is-active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
  }

  .docs-nav__method {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: "Fira Code", monospace;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.18);
    color: #15803d;
    margin-right: 0.3rem;
    vertical-align: middle;
  }

  html[data-theme="dark"] .docs-nav__method,
  html.dark .docs-nav__method {
    background: rgba(34, 197, 94, 0.22);
    color: #4ade80;
  }

  /* ── Main content ── */
  .docs-main {
    display: grid;
    gap: 1.5rem;
  }

  /* ── Section panels ── */
  .docs-section {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 1.75rem 2rem;
    display: grid;
    gap: 1.25rem;
  }

  .docs-section__title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--line);
  }

  .docs-section__intro {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.96rem;
  }

  /* ── Hero ── */
  .docs-hero {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
    padding: 2.25rem 2rem;
    display: grid;
    gap: 1rem;
  }

  .docs-hero__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand);
  }

  .docs-hero__title {
    margin: 0;
    font-size: clamp(1.5rem, 2.5vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--brand-strong);
  }

  .docs-hero__desc {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 1rem;
  }

  .docs-hero__badges {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
  }

  .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: "Fira Code", monospace;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
  }

  .badge--version {
    background: var(--brand-soft);
    color: var(--brand-strong);
    border-color: rgba(3, 105, 161, 0.2);
  }

  html[data-theme="dark"] .badge--version,
  html.dark .badge--version {
    border-color: rgba(56, 189, 248, 0.28);
  }

  .badge--readonly {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.2);
  }

  html[data-theme="dark"] .badge--readonly,
  html.dark .badge--readonly {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.26);
  }

  .badge--noauth {
    background: rgba(168, 85, 247, 0.1);
    color: #7c3aed;
    border-color: rgba(168, 85, 247, 0.22);
  }

  html[data-theme="dark"] .badge--noauth,
  html.dark .badge--noauth {
    background: rgba(192, 132, 252, 0.14);
    color: #c084fc;
    border-color: rgba(192, 132, 252, 0.26);
  }

  /* ── Info grid for auth/base-url ── */
  .docs-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }

  .docs-info-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    padding: 1.1rem 1.2rem;
    display: grid;
    gap: 0.55rem;
  }

  .docs-info-card__label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
  }

  .docs-info-card__value {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
  }

  .docs-info-card__note {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
  }

  /* ── Endpoint block ── */
  .endpoint {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .endpoint__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .method-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-family: "Fira Code", monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(34, 197, 94, 0.16);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.25);
    flex-shrink: 0;
  }

  html[data-theme="dark"] .method-badge,
  html.dark .method-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.3);
  }

  .endpoint__path {
    font-family: "Fira Code", monospace;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
  }

  .endpoint__summary {
    margin-left: auto;
    font-size: 0.84rem;
    color: var(--text-muted);
    white-space: nowrap;
  }

  .endpoint__body {
    padding: 1.25rem;
    display: grid;
    gap: 1.25rem;
    background: var(--surface-strong);
  }

  .endpoint__desc {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.92rem;
  }

  .endpoint__desc strong {
    color: var(--text);
  }

  /* ── Parameter / response tables ── */
  .param-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
  }

  .param-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
  }

  .param-table th {
    padding: 0.55rem 0.85rem;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
  }

  .param-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.87rem;
    color: var(--text);
    vertical-align: top;
    line-height: 1.5;
  }

  .param-table tbody tr:last-child td {
    border-bottom: 0;
  }

  .param-table code {
    font-family: "Fira Code", monospace;
    font-size: 0.82rem;
    background: var(--brand-soft);
    color: var(--brand-strong);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
  }

  .param-table td:nth-child(3) {
    text-align: center;
  }

  .required-yes {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b; /* red-800: higher contrast than #b91c1c on light bg (WCAG 1.4.3) */
    font-size: 0.74rem;
    font-weight: 700;
    font-family: "Fira Code", monospace;
  }

  html[data-theme="dark"] .required-yes,
  html.dark .required-yes {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
  }

  .required-no {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    font-family: "Fira Code", monospace;
  }

  /* ── Response table ── */
  .status-200 {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: "Fira Code", monospace;
  }

  html[data-theme="dark"] .status-200,
  html.dark .status-200 {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
  }

  .status-400 {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.14);
    color: #92400e; /* amber-800: higher contrast than #b45309 at small size (WCAG 1.4.3) */
    font-size: 0.78rem;
    font-weight: 700;
    font-family: "Fira Code", monospace;
  }

  html[data-theme="dark"] .status-400,
  html.dark .status-400 {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
  }

  .status-404 {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: "Fira Code", monospace;
  }

  html[data-theme="dark"] .status-404,
  html.dark .status-404 {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
  }

  .status-503 {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(168, 85, 247, 0.12);
    color: #5b21b6; /* violet-800: higher contrast than #7c3aed at small size (WCAG 1.4.3) */
    font-size: 0.78rem;
    font-weight: 700;
    font-family: "Fira Code", monospace;
  }

  html[data-theme="dark"] .status-503,
  html.dark .status-503 {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
  }

  /* ── Code tabs ── */
  .code-tabs {
    display: grid;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .code-tabs__nav {
    display: flex;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    gap: 0;
    overflow-x: auto;
  }

  html[data-theme="dark"] .code-tabs__nav,
  html.dark .code-tabs__nav {
    background: #020617;
  }

  .code-tab-btn {
    padding: 0.55rem 1rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-family: "Fira Code", monospace;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 120ms ease, border-color 120ms ease;
  }

  .code-tab-btn:hover {
    color: #e2e8f0;
  }

  .code-tab-btn.is-active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
  }

  .code-tab-panel {
    display: none;
    position: relative;
  }

  .code-tab-panel.is-active {
    display: block;
  }

  .code-block {
    margin: 0;
    padding: 1.1rem 1.25rem;
    background: #0f172a;
    color: #e2e8f0;
    font-family: "Fira Code", monospace;
    font-size: 0.83rem;
    line-height: 1.65;
    overflow-x: auto;
    white-space: pre;
    tab-size: 2;
  }

  html[data-theme="dark"] .code-block,
  html.dark .code-block {
    background: #020617;
  }

  /* Syntax colours */
  .tok-comment { color: #64748b; font-style: italic; }
  .tok-keyword { color: #93c5fd; }
  .tok-string  { color: #86efac; }
  .tok-number  { color: #fbbf24; }
  .tok-builtin { color: #f0abfc; }
  .tok-url     { color: #38bdf8; }
  .tok-param   { color: #fcd34d; }
  .tok-flag    { color: #c084fc; }

  .copy-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.9);
    color: #94a3b8;
    font-family: "Fira Code", monospace;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    z-index: 1;
  }

  .copy-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
  }

  .copy-btn.is-copied {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.35);
  }

  /* ── Sub-heading ── */
  .docs-subhead {
    margin: 0;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
    color: var(--text-muted);
  }

  /* ── Config variable table ── */
  .config-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
  }

  .config-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
  }

  .config-table th {
    padding: 0.55rem 0.85rem;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    text-align: left;
    border-bottom: 1px solid var(--line);
  }

  .config-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.87rem;
    color: var(--text);
    line-height: 1.5;
    vertical-align: top;
  }

  .config-table tbody tr:last-child td {
    border-bottom: 0;
  }

  .config-table code {
    font-family: "Fira Code", monospace;
    font-size: 0.82rem;
    background: var(--brand-soft);
    color: var(--brand-strong);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
  }

  /* ── Error catalogue ── */
  .error-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .error-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    padding: 1rem 1.1rem;
    display: grid;
    gap: 0.35rem;
  }

  .error-card__code {
    font-family: "Fira Code", monospace;
    font-size: 1.15rem;
    font-weight: 700;
  }

  .error-card__title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
  }

  .error-card__desc {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.55;
  }

  /* ── Mobile sidebar toggle ── */
  .docs-mobile-nav-toggle {
    display: none;
    width: 100%;
    padding: 0.75rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--brand-strong);
    font-weight: 700;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
  }

  /* ── Responsive ── */
  @media (max-width: 860px) {
    .docs-layout {
      grid-template-columns: 1fr;
    }

    .docs-sidebar {
      position: static;
      max-height: none;
      display: none;
    }

    .docs-sidebar.is-open {
      display: block;
    }

    .docs-mobile-nav-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .docs-info-grid {
      grid-template-columns: 1fr;
    }

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

    .docs-section {
      padding: 1.25rem 1.1rem;
    }

    .docs-hero {
      padding: 1.5rem 1.1rem;
    }

    .endpoint__summary {
      display: none;
    }
  }

  @media (max-width: 540px) {
    .docs-topbar {
      flex-direction: column;
      align-items: flex-start;
    }

    .docs-hero__badges {
      gap: 0.45rem;
    }
  }

  /* ── Data Dictionary: card stack on narrow phones (WCAG mobile readability) ── */
  @media (max-width: 720px) {
    #section-data-dictionary .param-table-wrap {
      overflow-x: visible;
      border: none;
      border-radius: 0;
    }

    #section-data-dictionary .param-table {
      min-width: 0;
      width: 100%;
    }

    #section-data-dictionary .param-table thead {
      display: none;
    }

    #section-data-dictionary .param-table tbody tr {
      display: block;
      border-top: 1px solid var(--line);
      padding: 0.6rem 0;
    }

    #section-data-dictionary .param-table tbody tr:first-child {
      border-top: none;
    }

    #section-data-dictionary .param-table td {
      display: block;
      border-bottom: none;
      padding: 0.2rem 0.1rem;
      font-size: 0.85rem;
    }

    #section-data-dictionary .param-table td::before {
      content: attr(data-label) ": ";
      font-weight: 600;
      color: var(--text-muted);
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    #section-data-dictionary .param-table td:empty {
      display: none;
    }
  }
