:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #93c5fd;
  --bg: #ffffff;
  --bg-card: #ffffff;
  --accent: #eff4fe;
  --text: #323638;
  --text-light: #656c7b;
  --border: #e5e7eb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

html.dark {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #93c5fd;
  --bg: #ffffff;
  --bg-card: #ffffff;
  --accent: #eff4fe;
  --text: #323638;
  --text-light: #656c7b;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  color-scheme: light;
}

.help-content a { color: var(--primary-dark); text-decoration: none; }
.help-content a:hover { color: var(--primary); text-decoration: underline; }

/* Published article pages still emit `<a class="sidebar-back">` (style.css is
   not linked). Give it the same button chrome as the "Show topics" FAB — the
   Tailwind classes on `[data-all-topics]` are restated here because those
   pages may not link the Tailwind bundle. Keep in sync with
   `show-sidebar-fab` in ArticleView.tsx (ink-200 #dde2eb, ink-700 #404757,
   brand-primary #2563eb). */
.sidebar-back,
#docs-side-nav [data-all-topics] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2rem;
  /* Published pages bake the row with a negative inset and no extra drop
     under the site header. This margin is the single spacing source for
     both overlay-only deploys and regenerated ArticleView pages — do not
     also put mt-2 on the template row or the gaps stack. */
  margin: 0.75rem 0.5rem 0.25rem;
  padding: 0 0.75rem;
  border: 1px solid #dde2eb;
  border-radius: 0.375rem;
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
  color: #404757;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
/* The collapse button shares that row, so it takes the same drop and the two
   stay on one baseline (28px box + 8px vs the 32px button + 12px). */
#docs-side-nav [data-hide-sidebar] {
  margin-top: 0.5rem;
}
.sidebar-back:hover,
#docs-side-nav [data-all-topics]:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
  text-decoration: none;
}

img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* Injected article HTML — typography only (shell is Tailwind) */
.help-content h1 { font-size: 1.75rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 1rem; }
.help-content h2 { font-size: 1.375rem; font-weight: 700; color: var(--text); margin: 1.5rem 0 0.75rem; }
.help-content h3 { font-size: 1.125rem; font-weight: 700; color: var(--text); margin: 1.25rem 0 0.5rem; }
.help-content h4 { font-size: 1rem; font-weight: 600; margin: 1rem 0 0.5rem; }
.help-content p { margin: 0.75rem 0; }
.help-content ul, .help-content ol { padding-left: 1.5rem; margin: 0.75rem 0; }
.help-content ul { list-style-type: disc; }
.help-content ol { list-style-type: decimal; }
.help-content li { margin: 0.25rem 0; }
.help-content li::marker { color: var(--text-light); }
.table-scroll {
  overflow-x: auto;
  margin: 1rem 0;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { margin: 0; }
/* Table design ported from the zen-design help-site prototype: rounded
   container, tinted header, row separators only (no cell grid). */
.table-scroll {
  border: 1px solid rgb(221 226 235);
  border-radius: 12px;
}
.help-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9375rem;
}
.help-content thead { background: rgb(247 249 252); }
.help-content th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: rgb(64 71 87);
  border: none;
  border-bottom: 1px solid rgb(221 226 235);
}
.help-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
  color: rgb(64 71 87);
  border: none;
}
.help-content tbody tr + tr td { border-top: 1px solid rgb(221 226 235); }
.help-content tbody tr:hover { background: rgb(247 249 252 / 0.5); }
.help-content td:first-child { font-weight: 600; color: rgb(15 20 25); }
.help-content code {
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.875em;
}
.help-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
}
.help-content pre code { background: none; padding: 0; color: inherit; }
.help-content blockquote {
  border-left: 4px solid #52a8ea;
  padding: 1rem;
  margin: 1rem 0;
  color: var(--text-light);
  background: #e8f3fc;
  border-radius: 12px;
}
.help-content blockquote:not([class]) > p:first-child::before {
  content: "\24D8";
  display: inline-block;
  margin-right: 0.4em;
  color: #095997;
  font-weight: 700;
}
.help-content blockquote.admonition-action-required {
  border-left-color: #d97706;
  background: #fffbeb;
}
.help-content blockquote.admonition-breaking-change {
  border-left-color: #dc2626;
  background: #fef2f2;
}
.help-content blockquote.admonition-deprecated {
  border-left-color: #6b7280;
  background: #f3f4f6;
}
.help-content img {
  display: block;
  margin: 1rem auto;
  box-shadow: var(--shadow);
}
.help-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Video Cards — inline Wistia video embeds */
.video-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.video-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(37,99,235,0.1);
}
.video-thumbnail {
  position: relative;
  width: 80px;
  height: 52px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-play-btn {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.video-card:hover .video-play-btn { transform: scale(1.1); }
.video-play-btn svg { width: 12px; height: 12px; margin-left: 2px; }
.video-duration {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 0.625rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 0 0.25rem;
  border-radius: 2px;
  line-height: 1.4;
}
.video-info { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.video-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-dark);
  line-height: 1.3;
}
.video-desc {
  font-size: 0.8125rem;
  color: var(--text-light);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  animation: overlay-in 0.15s ease-out;
}
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.video-modal-overlay.open { display: flex; }
.video-modal {
  width: 90vw;
  max-width: 900px;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  animation: modal-in 0.15s ease-out;
  position: relative;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: #111;
  color: #fff;
}
.video-modal-title {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-modal-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.1s;
}
.video-modal-close:hover { color: #fff; }
.video-modal-body { position: relative; width: 100%; padding-top: 56.25%; }
.video-modal-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
/* "Show topics" FAB: `[hidden]` is a UA-stylesheet rule, so the button's own
   `inline-flex` utility outranks it and the button paints beside an open
   sidebar. This rule holds the initial paint on pages published before
   `article-page.js` learned to drive `style.display`. */
.show-sidebar-fab[hidden] { display: none; }

@media (max-width: 640px) {
  .video-card { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .video-thumbnail { width: 100%; height: 0; padding-top: 56.25%; }
  .video-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
  .video-card:hover .video-play-btn { transform: translate(-50%, -50%) scale(1.1); }
  .video-duration { bottom: 6px; right: 8px; }
  .video-modal { width: 95vw; }
}

/* ---- Ported from the articles repo (scripts/lib/css-builder.ts) ---- */
.prose-article.help-content { max-width: 80ch; line-height: 1.75; }
/* Sidebar links: article-prose's global hover underline doesn't belong in nav. */
#docs-side-nav a:hover { text-decoration: none; }
/* text-ink-600 is absent from the vendored Tailwind bundle. */
.text-ink-600 { color: rgb(86 93 110); }
/* Active nav/TOC item colors from the zen-design help-site prototype. */
#docs-side-nav .text-brand-primary, #toc-list .text-brand-primary { color: #1a78c1; }
#docs-side-nav .bg-brand-primary\/10 { background-color: rgb(26 120 193 / 0.1); }
#docs-side-nav .border-brand-accent, #toc-list .border-brand-primary { border-color: #52a8ea; }
/* Avatar/logo gradient: prototype uses the deeper CTA blue pair. */
.bg-gradient-brand { background-image: linear-gradient(135deg, #1a78c1 0%, #095997 100%); }
/* Body links: prototype CTA blue, always underlined with a 2px offset. */
.help-content p a,
.help-content li a,
.help-content td a {
  color: #1a78c1;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.help-content p a:hover,
.help-content li a:hover,
.help-content td a:hover {
  color: #52a8ea;
  text-decoration: underline;
}

/* Print: the article only (Share > Print, Ctrl+P, File > Print). Drops the
   site chrome, both rails, the after-article blocks and script overlays; keeps
   the content card (title, meta, body) and strips its card styling. Selectors
   use hooks both renderers emit, so no page needs regenerating. Keep this
   block byte-identical in both copies: ARTICLE_PROSE_CSS in the articles
   repo's scripts/lib/css-builder.ts, and customer-svc-help-answers
   client/public/help/v2/css/article-prose.css (what the CDN serves).
   Each :has() / complex :not() rule stands alone — one unsupported selector
   voids its whole list, and the plain rule must still hide the rails. */
@media print {
  @page { margin: 16mm 14mm; }
  html, body { background: #fff !important; }
  #docs-side-nav,
  [data-show-sidebar],
  .article-main > .grid > aside,
  .af-floating-btn, .af-toolbar, .af-modal-overlay, .video-modal-overlay {
    display: none !important;
  }
  /* Site header/footer; the article card's own <header> (h1 + meta) stays. */
  header:not(.article-main header), footer:not(.article-main footer) { display: none !important; }
  /* Feedback, Ask Zeenie, Related, prev/next: every article child that is not the body card. */
  .article-main article > :not(:has(.prose-article)) { display: none !important; }
  /* The body's "On this page" link to that Related card, unless the body still
     carries its own related-articles section (which does print). English only:
     locale pages keep their translated section in the body. */
  .prose-article:not(:has(#related-articles)) li:has(> a[href="#related-articles"]) { display: none !important; }
  div:has(> .article-main) { display: block !important; min-height: 0 !important; background: #fff !important; }
  .article-main { padding: 0 !important; }
  .article-main > .grid { display: block !important; }
  .article-main article > div:has(.prose-article) {
    border: 0 !important; box-shadow: none !important; border-radius: 0 !important; padding: 0 !important;
  }
  .prose-article h1, .prose-article h2, .prose-article h3, .prose-article h4 { break-after: avoid; }
  .prose-article tr, .prose-article img, .prose-article figure,
  .prose-article pre, .prose-article blockquote { break-inside: avoid; }
}
