/* ═══════════════════════════════════════════════════════════════
   API docs (Swagger UI + ReDoc) — standalone stylesheet.
   Mirrors web/src/styles/tokens.css so /api/docs/ and /api/redoc/ match
   the Next.js site. Theme is driven by [data-theme] on <html>, set by
   api/js/api-docs-theme.js from the shared localStorage "theme" key.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --yt-color-brand: #2563eb;
  --yt-color-brand-hover: #1d4ed8;
  --yt-color-brand-muted: rgba(37, 99, 235, 0.08);
  --yt-color-surface-page: #edf0f5;
  --yt-color-surface-primary: #ffffff;
  --yt-color-surface-secondary: #f5f7fa;
  --yt-color-surface-tertiary: #edf0f5;
  --yt-color-surface-glass: rgba(255, 255, 255, 0.85);
  --yt-color-surface-hover: rgba(0, 0, 0, 0.025);
  --yt-color-text-primary: #0f172a;
  --yt-color-text-secondary: #475569;
  --yt-color-text-muted: #64748b;
  --yt-color-text-brand: #2563eb;
  --yt-color-border: #d1d9e6;
  --yt-color-border-subtle: #e2e8f0;
  --yt-color-border-strong: #b8c5d8;
  --yt-color-success: #059669;
  --yt-color-error: #dc2626;
  --yt-color-focus-ring: rgba(37, 99, 235, 0.45);
  --yt-color-shadow: rgba(15, 23, 42, 0.06);
  --yt-gradient-brand: linear-gradient(135deg, #2563eb 0%, #6d3bf5 55%, #a855f7 100%);
  --yt-gradient-brand-button: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --yt-gradient-text: linear-gradient(120deg, #2563eb 0%, #7c3aed 45%, #a855f7 100%);
  --yt-mesh-hero:
    radial-gradient(60% 55% at 18% 12%, rgba(37, 99, 235, 0.16) 0%, transparent 60%),
    radial-gradient(50% 50% at 85% 8%, rgba(168, 85, 247, 0.14) 0%, transparent 55%);
  --yt-border-highlight: rgba(255, 255, 255, 0.7);
  --yt-elevation-card: 0 1px 3px rgba(16, 24, 40, 0.06), 0 4px 16px -4px rgba(16, 24, 40, 0.10);
  --yt-radius-md: 8px;
  --yt-radius-lg: 12px;
  --yt-font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --yt-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --docs-code-bg: #0f172a;
  --docs-code-border: #1e293b;
  --docs-code-text: #e2e8f0;
  --docs-inline-code-bg: rgba(15, 23, 42, 0.06);
  --docs-header-height: 60px;
  color-scheme: light;
}

[data-theme="dark"] {
  --yt-color-brand: #4f8ef7;
  --yt-color-brand-hover: #6fa3f9;
  --yt-color-brand-muted: rgba(79, 142, 247, 0.12);
  --yt-color-surface-page: #080809;
  --yt-color-surface-primary: #0d0d0f;
  --yt-color-surface-secondary: #141417;
  --yt-color-surface-tertiary: #1c1c21;
  --yt-color-surface-glass: rgba(20, 20, 23, 0.9);
  --yt-color-surface-hover: rgba(255, 255, 255, 0.04);
  --yt-color-text-primary: #eef0f3;
  --yt-color-text-secondary: #a1abba;
  --yt-color-text-muted: #7a8494;
  --yt-color-text-brand: #6fa3f9;
  --yt-color-border: #252529;
  --yt-color-border-subtle: #1a1a1e;
  --yt-color-border-strong: #353540;
  --yt-color-success: #34d399;
  --yt-color-error: #f87171;
  --yt-color-focus-ring: rgba(79, 142, 247, 0.5);
  --yt-color-shadow: rgba(0, 0, 0, 0.5);
  --yt-gradient-brand: linear-gradient(135deg, #3b82f6 0%, #7c5cf6 55%, #a855f7 100%);
  --yt-gradient-text: linear-gradient(120deg, #6fa3f9 0%, #a78bfa 50%, #c084fc 100%);
  --yt-mesh-hero:
    radial-gradient(60% 55% at 18% 10%, rgba(79, 142, 247, 0.20) 0%, transparent 60%),
    radial-gradient(50% 50% at 85% 6%, rgba(168, 85, 247, 0.18) 0%, transparent 55%);
  --yt-border-highlight: rgba(255, 255, 255, 0.06);
  --yt-elevation-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 22px -8px rgba(0, 0, 0, 0.55);

  --docs-code-bg: #050506;
  --docs-code-border: #252529;
  --docs-inline-code-bg: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

/* ─── Base ─────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
}

.docs-body {
  margin: 0;
  background: var(--yt-color-surface-page);
  color: var(--yt-color-text-primary);
  font-family: var(--yt-font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.docs-body a {
  color: var(--yt-color-text-brand);
}

.docs-skip {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--yt-radius-md);
  background: var(--yt-color-surface-primary);
  color: var(--yt-color-text-primary) !important;
  border: 1px solid var(--yt-color-border);
  text-decoration: none;
  font-weight: 600;
}

.docs-skip:focus {
  top: 12px;
}

.docs-code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--docs-inline-code-bg);
  font-family: var(--yt-font-mono);
  font-size: 0.8125em;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
.docs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--yt-radius-md);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.docs-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.docs-btn:focus-visible,
.docs-theme-toggle:focus-visible,
.docs-brand:focus-visible,
.docs-nav__link:focus-visible,
.docs-switch__item:focus-visible,
.docs-key__control:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--yt-color-focus-ring);
}

.docs-body a.docs-btn--primary,
.docs-btn--primary {
  background: var(--yt-gradient-brand-button);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.docs-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -4px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.docs-btn--primary:active {
  transform: translateY(0);
}

.docs-btn--primary[data-state="applied"] {
  background: var(--yt-color-success);
}

.docs-body a.docs-btn--ghost,
.docs-btn--ghost {
  background: transparent;
  border-color: var(--yt-color-border);
  color: var(--yt-color-text-primary);
}

.docs-btn--ghost:hover {
  background: var(--yt-color-surface-hover);
  border-color: var(--yt-color-border-strong);
}

/* ─── Header ───────────────────────────────────────────────────── */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--yt-color-surface-glass);
  border-bottom: 1px solid var(--yt-color-border);
  box-shadow: 0 1px 0 var(--yt-color-shadow), inset 0 1px 0 var(--yt-border-highlight);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}

.docs-body--redoc .docs-header {
  background: var(--yt-color-surface-primary);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.docs-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--docs-header-height);
  padding: 8px 24px;
}

.docs-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--yt-radius-md);
  color: var(--yt-color-text-primary) !important;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.docs-brand:hover {
  opacity: 0.85;
}

.docs-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--yt-radius-md);
  background: var(--yt-gradient-brand);
  color: #ffffff;
  box-shadow: var(--yt-elevation-card), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.docs-brand__mark svg {
  width: 17px;
  height: 17px;
}

.docs-header__tag {
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid var(--yt-color-border);
  background: var(--yt-color-brand-muted);
  color: var(--yt-color-text-brand);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.docs-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  margin-left: 8px;
}

.docs-body a.docs-nav__link {
  padding: 8px 12px;
  border-radius: var(--yt-radius-md);
  color: var(--yt-color-text-secondary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.docs-body a.docs-nav__link:hover {
  color: var(--yt-color-text-primary);
  background: var(--yt-color-surface-hover);
}

.docs-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--yt-radius-md);
  border: 1px solid var(--yt-color-border);
  background: var(--yt-color-surface-secondary);
}

.docs-body a.docs-switch__item {
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--yt-color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}

.docs-body a.docs-switch__item:hover {
  color: var(--yt-color-text-primary);
}

.docs-body a.docs-switch__item[aria-current="page"] {
  background: var(--yt-color-surface-primary);
  color: var(--yt-color-text-primary);
  box-shadow: 0 1px 2px var(--yt-color-shadow), 0 0 0 1px var(--yt-color-border);
}

.docs-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.docs-header__back {
  min-height: 40px;
}

.docs-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--yt-radius-md);
  border: 1px solid var(--yt-color-border);
  background: transparent;
  color: var(--yt-color-text-secondary);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.docs-theme-toggle:hover {
  background: var(--yt-color-surface-hover);
  border-color: var(--yt-color-border-strong);
  color: var(--yt-color-text-primary);
}

.docs-theme-toggle__icon {
  display: none;
  width: 16px;
  height: 16px;
}

html[data-theme-mode="light"] .docs-theme-toggle__icon--light,
html[data-theme-mode="dark"] .docs-theme-toggle__icon--dark,
html[data-theme-mode="system"] .docs-theme-toggle__icon--system {
  display: block;
}

/* ─── Page layout ──────────────────────────────────────────────── */
.docs-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.docs-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 32px;
  border-radius: var(--yt-radius-lg);
  border: 1px solid var(--yt-color-border);
  background: var(--yt-mesh-hero), var(--yt-color-surface-primary);
  box-shadow: var(--yt-elevation-card);
}

.docs-hero__eyebrow {
  margin: 0 0 8px;
  color: var(--yt-color-text-brand);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-hero__title {
  margin: 0;
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.docs-hero__lead {
  max-width: 60ch;
  margin: 12px 0 0;
  color: var(--yt-color-text-secondary);
  font-size: 1rem;
}

.docs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.docs-chip {
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid var(--yt-color-border);
  background: var(--yt-color-surface-secondary);
  color: var(--yt-color-text-secondary);
  font-family: var(--yt-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.docs-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.docs-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 24px;
  margin-bottom: 16px;
  padding: 24px;
  border-radius: var(--yt-radius-lg);
  border: 1px solid var(--yt-color-border);
  background: var(--yt-color-surface-primary);
  box-shadow: var(--yt-elevation-card);
}

.docs-panel__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.docs-panel__desc {
  margin: 6px 0 0;
  color: var(--yt-color-text-secondary);
}

.docs-panel__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  color: var(--yt-color-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.docs-panel__status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.docs-panel__status[data-state="success"] {
  color: var(--yt-color-success);
}

.docs-panel__status[data-state="error"] {
  color: var(--yt-color-error);
}

.docs-key {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.docs-key__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.docs-key__field {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.docs-key__field--grow {
  flex-basis: 260px;
}

.docs-key__label {
  color: var(--yt-color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.docs-key__control {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--yt-radius-md);
  border: 1px solid var(--yt-color-border);
  background: var(--yt-color-surface-secondary);
  color: var(--yt-color-text-primary);
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.docs-key__control:hover {
  border-color: var(--yt-color-border-strong);
}

.docs-key__control:focus-visible {
  border-color: var(--yt-color-brand);
}

.docs-key__control::placeholder {
  color: var(--yt-color-text-muted);
}

.docs-key__action {
  flex: 0 0 auto;
}

.docs-swagger {
  padding: 8px 24px 24px;
  border-radius: var(--yt-radius-lg);
  border: 1px solid var(--yt-color-border);
  background: var(--yt-color-surface-primary);
  box-shadow: var(--yt-elevation-card);
}

.docs-redoc {
  min-height: calc(100vh - var(--docs-header-height));
  background: var(--yt-color-surface-primary);
}

[data-theme="dark"] .docs-redoc h5 {
  color: var(--yt-color-text-secondary);
}

.docs-redoc .react-tabs__tab--selected.tab-success {
  color: #065f46 !important;
}

.docs-redoc .react-tabs__tab--selected.tab-error {
  color: #b91c1c !important;
}

[data-theme="dark"] .docs-redoc .react-tabs__tab--selected {
  background: #2a2a31 !important;
  color: var(--yt-color-text-primary) !important;
}

[data-theme="dark"] .docs-redoc .react-tabs__tab--selected.tab-success {
  color: var(--yt-color-success) !important;
}

[data-theme="dark"] .docs-redoc .react-tabs__tab--selected.tab-error {
  color: var(--yt-color-error) !important;
}

/* ─── Swagger UI: light + dark overrides ───────────────────────── */
html .docs-swagger .swagger-ui,
html .docs-swagger .swagger-ui .info .title,
html .docs-swagger .swagger-ui .info p,
html .docs-swagger .swagger-ui .info li,
html .docs-swagger .swagger-ui .info table,
html .docs-swagger .swagger-ui .opblock-tag,
html .docs-swagger .swagger-ui .opblock .opblock-summary-description,
html .docs-swagger .swagger-ui .opblock-description-wrapper p,
html .docs-swagger .swagger-ui .opblock-external-docs-wrapper p,
html .docs-swagger .swagger-ui .opblock-title_normal p,
html .docs-swagger .swagger-ui .opblock .opblock-section-header h4,
html .docs-swagger .swagger-ui .opblock .opblock-section-header label,
html .docs-swagger .swagger-ui table thead tr td,
html .docs-swagger .swagger-ui table thead tr th,
html .docs-swagger .swagger-ui table tbody tr td,
html .docs-swagger .swagger-ui .parameter__name,
html .docs-swagger .swagger-ui .response-col_status,
html .docs-swagger .swagger-ui .response-col_description,
html .docs-swagger .swagger-ui .responses-inner h4,
html .docs-swagger .swagger-ui .responses-inner h5,
html .docs-swagger .swagger-ui .tab li,
html .docs-swagger .swagger-ui label,
html .docs-swagger .swagger-ui .model-title,
html .docs-swagger .swagger-ui .model,
html .docs-swagger .swagger-ui .model-box,
html .docs-swagger .swagger-ui section.models h4,
html .docs-swagger .swagger-ui section.models h5,
html .docs-swagger .swagger-ui .models-control,
html .docs-swagger .swagger-ui .markdown p,
html .docs-swagger .swagger-ui .markdown li,
html .docs-swagger .swagger-ui .renderedMarkdown p,
html .docs-swagger .swagger-ui .renderedMarkdown li,
html .docs-swagger .swagger-ui .markdown h1,
html .docs-swagger .swagger-ui .markdown h2,
html .docs-swagger .swagger-ui .markdown h3,
html .docs-swagger .swagger-ui .markdown h4,
html .docs-swagger .swagger-ui .renderedMarkdown h1,
html .docs-swagger .swagger-ui .renderedMarkdown h2,
html .docs-swagger .swagger-ui .renderedMarkdown h3,
html .docs-swagger .swagger-ui .renderedMarkdown h4,
html .docs-swagger .swagger-ui .scheme-container .schemes > label,
html .docs-swagger .swagger-ui .dialog-ux .modal-ux-header h3,
html .docs-swagger .swagger-ui .dialog-ux .modal-ux-content p,
html .docs-swagger .swagger-ui .dialog-ux .modal-ux-content h4,
html .docs-swagger .swagger-ui .dialog-ux .modal-ux-content h5,
html .docs-swagger .swagger-ui .dialog-ux .modal-ux-content label,
html .docs-swagger .swagger-ui .auth-container h4,
html .docs-swagger .swagger-ui .auth-container h6,
html .docs-swagger .swagger-ui .auth-container .wrapper,
html .docs-swagger .swagger-ui .errors-wrapper hgroup h4,
html .docs-swagger .swagger-ui .loading-container .loading::after,
html .docs-swagger .swagger-ui .response-control-media-type__accept-message,
html .docs-swagger .swagger-ui .opblock-body .opblock-description-wrapper {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui,
html .docs-swagger .swagger-ui .info .title,
html .docs-swagger .swagger-ui .info p,
html .docs-swagger .swagger-ui .info li,
html .docs-swagger .swagger-ui .info table,
html .docs-swagger .swagger-ui .opblock-tag,
html .docs-swagger .swagger-ui .opblock .opblock-summary-description,
html .docs-swagger .swagger-ui table thead tr th,
html .docs-swagger .swagger-ui table tbody tr td,
html .docs-swagger .swagger-ui .tab li,
html .docs-swagger .swagger-ui label,
html .docs-swagger .swagger-ui .btn,
html .docs-swagger .swagger-ui select,
html .docs-swagger .swagger-ui input,
html .docs-swagger .swagger-ui textarea,
html .docs-swagger .swagger-ui .model-title,
html .docs-swagger .swagger-ui .model,
html .docs-swagger .swagger-ui section.models h4,
html .docs-swagger .swagger-ui .markdown p,
html .docs-swagger .swagger-ui .renderedMarkdown p,
html .docs-swagger .swagger-ui .dialog-ux .modal-ux-header h3,
html .docs-swagger .swagger-ui .dialog-ux .modal-ux-content h4,
html .docs-swagger .swagger-ui .opblock .opblock-section-header h4,
html .docs-swagger .swagger-ui .responses-inner h4,
html .docs-swagger .swagger-ui .responses-inner h5 {
  font-family: var(--yt-font-sans);
}

html .docs-swagger .swagger-ui .opblock .opblock-summary-path,
html .docs-swagger .swagger-ui .opblock .opblock-summary-path__deprecated,
html .docs-swagger .swagger-ui .parameter__name,
html .docs-swagger .swagger-ui .parameter__type,
html .docs-swagger .swagger-ui .parameter__in,
html .docs-swagger .swagger-ui .prop-type,
html .docs-swagger .swagger-ui .prop-format,
html .docs-swagger .swagger-ui .markdown code,
html .docs-swagger .swagger-ui .renderedMarkdown code,
html .docs-swagger .swagger-ui .info .base-url,
html .docs-swagger .swagger-ui .microlight,
html .docs-swagger .swagger-ui pre,
html .docs-swagger .swagger-ui code {
  font-family: var(--yt-font-mono);
}

html .docs-swagger .swagger-ui .wrapper {
  max-width: none;
  padding: 0;
}

html .docs-swagger .swagger-ui .info {
  margin: 24px 0;
}

html .docs-swagger .swagger-ui .info .title {
  font-weight: 800;
  letter-spacing: -0.02em;
}

html .docs-swagger .swagger-ui .info a,
html .docs-swagger .swagger-ui .markdown a,
html .docs-swagger .swagger-ui .renderedMarkdown a {
  color: var(--yt-color-text-brand);
}

html .docs-swagger .swagger-ui .info .base-url,
html .docs-swagger .swagger-ui .info h1,
html .docs-swagger .swagger-ui .info h2,
html .docs-swagger .swagger-ui .info h3,
html .docs-swagger .swagger-ui .info h4,
html .docs-swagger .swagger-ui .info h5 {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .info h2,
html .docs-swagger .swagger-ui .info h3 {
  margin-top: 1.5em;
  letter-spacing: -0.01em;
}

html .docs-swagger .swagger-ui .markdown code,
html .docs-swagger .swagger-ui .renderedMarkdown code,
html .docs-swagger .swagger-ui .info li code,
html .docs-swagger .swagger-ui .info p code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--docs-inline-code-bg);
  color: var(--yt-color-text-primary);
  font-size: 0.85em;
}

html .docs-swagger .swagger-ui .markdown pre,
html .docs-swagger .swagger-ui .renderedMarkdown pre,
html .docs-swagger .swagger-ui .info pre {
  padding: 12px 14px;
  border: 1px solid var(--docs-code-border);
  border-radius: var(--yt-radius-md);
  background: var(--docs-code-bg);
  color: var(--docs-code-text);
}

html .docs-swagger .swagger-ui .markdown pre code,
html .docs-swagger .swagger-ui .renderedMarkdown pre code,
html .docs-swagger .swagger-ui .info pre code {
  padding: 0;
  background: transparent;
  color: var(--docs-code-text);
}

html .docs-swagger .swagger-ui .info .title small {
  background: var(--yt-color-text-muted);
}

html .docs-swagger .swagger-ui .info .title small pre,
html .docs-swagger .swagger-ui .info .title small.version-stamp pre {
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
}

html .docs-swagger .swagger-ui {
  background: transparent;
}

html .docs-swagger .swagger-ui .scheme-container {
  margin: 0 0 16px;
  padding: 16px 0;
  background: transparent;
  box-shadow: none;
  border-bottom: 1px solid var(--yt-color-border-subtle);
}

html .docs-swagger .swagger-ui .filter-container {
  margin: 0 0 16px;
}

html .docs-swagger .swagger-ui .filter .operation-filter-input {
  margin: 0;
}

html .docs-swagger .swagger-ui .opblock-tag {
  border-bottom: 1px solid var(--yt-color-border-subtle);
  font-weight: 700;
  letter-spacing: -0.01em;
}

html .docs-swagger .swagger-ui .opblock-tag:hover {
  background: var(--yt-color-surface-hover);
}

html .docs-swagger .swagger-ui .opblock-tag small,
html .docs-swagger .swagger-ui .opblock-tag .markdown p,
html .docs-swagger .swagger-ui .opblock-tag .renderedMarkdown p {
  color: var(--yt-color-text-secondary);
}

html .docs-swagger .swagger-ui .opblock {
  margin: 0 0 12px;
  border-radius: var(--yt-radius-md);
}

html .docs-swagger .swagger-ui .opblock .opblock-summary-path,
html .docs-swagger .swagger-ui .opblock .opblock-summary-path__deprecated {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .opblock .opblock-summary-description {
  color: var(--yt-color-text-secondary);
}

html .docs-swagger .swagger-ui .opblock .opblock-summary-method {
  border-radius: 6px;
  color: #0b1220;
}

html .docs-swagger .swagger-ui .opblock-body pre.microlight,
html .docs-swagger .swagger-ui .opblock .highlight-code pre.microlight {
  padding: 12px 14px;
  border: 1px solid var(--docs-code-border);
  border-radius: var(--yt-radius-md);
  background: var(--docs-code-bg) !important;
  color: var(--docs-code-text) !important;
}

html .docs-swagger .swagger-ui .opblock .opblock-section-header {
  background: var(--yt-color-surface-secondary);
  box-shadow: 0 1px 2px var(--yt-color-shadow);
}

html .docs-swagger .swagger-ui .opblock-description-wrapper,
html .docs-swagger .swagger-ui .opblock-external-docs-wrapper,
html .docs-swagger .swagger-ui .opblock-title_normal {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .opblock-summary-control:focus-visible,
html .docs-swagger .swagger-ui .opblock-tag:focus-visible {
  outline: 2px solid var(--yt-color-brand);
  outline-offset: 2px;
}

html .docs-swagger .swagger-ui .parameter__type,
html .docs-swagger .swagger-ui .parameter__in,
html .docs-swagger .swagger-ui .parameter__deprecated,
html .docs-swagger .swagger-ui .prop-format,
html .docs-swagger .swagger-ui table.headers td,
html .docs-swagger .swagger-ui .model .property.primitive,
html .docs-swagger .swagger-ui .renderedMarkdown em {
  color: var(--yt-color-text-muted);
}

html .docs-swagger .swagger-ui .response-col_links {
  color: var(--yt-color-text-secondary);
}

html .docs-swagger .swagger-ui .prop-type {
  color: var(--yt-color-text-brand);
}

html .docs-swagger .swagger-ui .parameter__name.required span,
html .docs-swagger .swagger-ui .parameter__name.required::after,
html .docs-swagger .swagger-ui .response-col_status .response-undocumented {
  color: var(--yt-color-error);
}

html .docs-swagger .swagger-ui table thead tr td,
html .docs-swagger .swagger-ui table thead tr th {
  border-bottom: 1px solid var(--yt-color-border);
}

html .docs-swagger .swagger-ui .tab li {
  color: var(--yt-color-text-secondary);
}

html .docs-swagger .swagger-ui .tab li.active {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .responses-inner {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .response-col_description__inner div.markdown,
html .docs-swagger .swagger-ui .response-col_description__inner div.renderedMarkdown {
  background: transparent;
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .response-col_description__inner div.markdown p,
html .docs-swagger .swagger-ui .response-col_description__inner div.renderedMarkdown p {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui select,
html .docs-swagger .swagger-ui input[type="text"],
html .docs-swagger .swagger-ui input[type="password"],
html .docs-swagger .swagger-ui input[type="search"],
html .docs-swagger .swagger-ui input[type="email"],
html .docs-swagger .swagger-ui input[type="file"],
html .docs-swagger .swagger-ui textarea {
  border: 1px solid var(--yt-color-border-strong);
  border-radius: 6px;
  background: var(--yt-color-surface-secondary);
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui textarea::placeholder,
html .docs-swagger .swagger-ui input::placeholder {
  color: var(--yt-color-text-muted);
}

html .docs-swagger .swagger-ui textarea:focus,
html .docs-swagger .swagger-ui input[type="text"]:focus,
html .docs-swagger .swagger-ui input[type="password"]:focus,
html .docs-swagger .swagger-ui select:focus {
  outline: 0;
  border-color: var(--yt-color-brand);
  box-shadow: 0 0 0 3px var(--yt-color-focus-ring);
}

html .docs-swagger .swagger-ui .opblock-body select {
  background-color: var(--yt-color-surface-secondary);
}

html .docs-swagger .swagger-ui .btn {
  border: 1px solid var(--yt-color-border-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--yt-color-text-primary);
  box-shadow: none;
}

html .docs-swagger .swagger-ui .btn:hover {
  background: var(--yt-color-surface-hover);
  box-shadow: none;
}

html .docs-swagger .swagger-ui .btn.authorize {
  border-color: var(--yt-color-success);
  color: var(--yt-color-success);
}

html .docs-swagger .swagger-ui .btn.authorize svg {
  fill: var(--yt-color-success);
}

html .docs-swagger .swagger-ui .btn.execute {
  border-color: var(--yt-color-brand);
  background: var(--yt-gradient-brand-button);
  color: #ffffff;
}

html .docs-swagger .swagger-ui .btn.cancel {
  border-color: var(--yt-color-error);
  color: var(--yt-color-error);
}

html .docs-swagger .swagger-ui .btn-clear,
html .docs-swagger .swagger-ui .btn.btn-clear {
  border-color: var(--yt-color-border-strong);
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .btn.try-out__btn {
  border-color: var(--yt-color-border-strong);
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .authorization__btn svg,
html .docs-swagger .swagger-ui .expand-methods svg,
html .docs-swagger .swagger-ui .expand-operation svg,
html .docs-swagger .swagger-ui .opblock-control-arrow svg,
html .docs-swagger .swagger-ui .model-toggle::after,
html .docs-swagger .swagger-ui .opblock-summary-control svg,
html .docs-swagger .swagger-ui .models-control svg,
html .docs-swagger .swagger-ui .arrow {
  fill: var(--yt-color-text-secondary);
}

html .docs-swagger .swagger-ui .copy-to-clipboard {
  background: var(--yt-color-surface-tertiary);
}

html .docs-swagger .swagger-ui .copy-to-clipboard button {
  filter: none;
}

[data-theme="dark"] html .docs-swagger .swagger-ui .copy-to-clipboard button {
  filter: invert(1);
}

html .docs-swagger .swagger-ui section.models {
  margin: 24px 0 0;
  border: 1px solid var(--yt-color-border);
  border-radius: var(--yt-radius-md);
}

html .docs-swagger .swagger-ui section.models.is-open h4 {
  border-bottom: 1px solid var(--yt-color-border);
}

html .docs-swagger .swagger-ui section.models .model-container {
  margin: 0;
  border-radius: 0;
  background: var(--yt-color-surface-secondary);
}

html .docs-swagger .swagger-ui section.models .model-container:hover {
  background: var(--yt-color-surface-tertiary);
}

html .docs-swagger .swagger-ui .model-box {
  background: transparent;
}

html .docs-swagger .swagger-ui .model-title {
  font-size: 1rem;
}

html .docs-swagger .swagger-ui .model .property,
html .docs-swagger .swagger-ui .model span,
html .docs-swagger .swagger-ui .model .renderedMarkdown p {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .model .property-row td:first-child {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .model-toggle::after {
  background: center no-repeat;
}

html .docs-swagger .swagger-ui .model .prop-type,
html .docs-swagger .swagger-ui .model .prop-enum {
  color: var(--yt-color-text-brand);
}

html .docs-swagger .swagger-ui .dialog-ux .backdrop-ux {
  background: rgba(8, 8, 9, 0.6);
}

html .docs-swagger .swagger-ui .dialog-ux .modal-ux {
  border: 1px solid var(--yt-color-border);
  border-radius: var(--yt-radius-lg);
  background: var(--yt-color-surface-primary);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.5);
}

html .docs-swagger .swagger-ui .dialog-ux .modal-ux-header {
  border-bottom: 1px solid var(--yt-color-border);
}

html .docs-swagger .swagger-ui .dialog-ux .modal-ux-header .close-modal svg {
  fill: var(--yt-color-text-secondary);
}

html .docs-swagger .swagger-ui .dialog-ux .modal-ux-content a {
  color: var(--yt-color-text-brand);
}

html .docs-swagger .swagger-ui .auth-btn-wrapper .btn-done {
  border-color: var(--yt-color-border-strong);
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .errors-wrapper {
  border: 1px solid var(--yt-color-error);
  background: rgba(220, 38, 38, 0.1);
}

html .docs-swagger .swagger-ui .errors-wrapper .errors h4,
html .docs-swagger .swagger-ui .errors-wrapper .errors small {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .loading-container .loading::after {
  color: var(--yt-color-text-secondary);
}

html .docs-swagger .swagger-ui .response-control-media-type--accept-controller select {
  border-color: var(--yt-color-success);
}

html .docs-swagger .swagger-ui .live-responses-table .response-col_status,
html .docs-swagger .swagger-ui .live-responses-table .response-col_description {
  color: var(--yt-color-text-primary);
}

html .docs-swagger .swagger-ui .highlight-code > .microlight code {
  background: transparent;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 960px) {
  .docs-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 720px) {
  .docs-header__inner {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 16px;
  }

  .docs-header__tag {
    display: none;
  }

  .docs-nav {
    order: 3;
    flex: 1 0 100%;
    margin-left: 0;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .docs-redoc {
    min-height: calc(100vh - 110px);
  }
}

@media (max-width: 640px) {
  .docs-header__back-label {
    display: none;
  }

  .docs-header__back {
    width: 40px;
    padding: 0;
  }

  .docs-container {
    padding: 16px 16px 48px;
  }

  .docs-hero {
    padding: 24px 20px;
  }

  .docs-panel {
    padding: 20px 16px;
  }

  .docs-swagger {
    padding: 4px 12px 16px;
  }

  .docs-hero__actions .docs-btn {
    flex: 1 1 100%;
  }

  html .docs-swagger .swagger-ui .responses-table .response-col_links,
  html .docs-swagger .swagger-ui .responses-table thead .response-col_links {
    display: none;
  }

  .docs-key__action {
    flex: 1 1 calc(50% - 6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .docs-btn,
  .docs-theme-toggle,
  .docs-switch__item,
  .docs-key__control {
    transition: none;
  }

  .docs-btn--primary:hover {
    transform: none;
  }
}
