/* ============================================================
   REDA Financials Help Center — Global Stylesheet
   Layout: Sidebar-first (left nav + scrollable main)
   Brand: Navy #0B3558, Accent #006BF6
   Base: 16px Inter
   ============================================================ */

/* Poppins — the typeface of the REDA AI, REDA Connect and REDA One websites (portal restyle,
   Oct 2026). Supersedes Plus Jakarta Sans (16 Jul 2026), which matched the older KBs. */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  /* Ink, link blue and text tones follow the websites' shared tokens (--ink #0A2540, --link
     #075395, --sub #33506E, Connect --muted #52677D). Product pages override --accent inline. */
  --primary:      #0A2540;
  --primary-hover: #143A5E;
  --accent:       #075395;
  --accent-bg:    #EAF4FE;
  --text:         #0A2540;
  --text-2:       #33506E;
  --text-3:       #52677D;
  --text-muted:   #8fa3ba;
  --bg:           #ffffff;
  --bg-soft:      #f5f8fc;
  --bg-hover:     #f0f4f9;
  --border:       #DCE3EB;
  --border-light: #E8EDF3;
  --green:        #2E844A;
  --orange:       #e68a00;
  --red:          #c23934;
  --sidebar-w:    300px;
  /* Sticky portal header: 66px inner + 1px border. Anything that sticks below it offsets by
     this, or it scrolls underneath — which is what hid the TOC's "On this page" (2026-07-17). */
  --header-h:     67px;
  --r:            20px;
  --r-sm:         12px;
  --r-xs:         8px;
  --r-btn:        6px;   /* buttons — the websites' compact rounded corner */
  --shadow-sm:    0 1px 2px rgba(10,37,64,0.06);
  --shadow-md:    0 12px 32px rgba(10,37,64,0.08);
  --shadow-lg:    0 22px 70px rgba(18,46,75,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--primary); }

/* Links inside running prose must be identifiable without relying on colour alone —
   accent-on-body-text is a weak signal in dense copy, and it fails WCAG 1.4.1 for anyone
   who can't separate the two hues. Underline prose links only: navigation, cards, pills,
   the TOC and the footer are already obviously interactive from their shape/position,
   and underlining them would read as noise.

   Scoped to p/li/td/dd inside .kb-article, which by construction excludes the breadcrumb
   (its links sit in a bare <div>) and the TOC + sidebar + footer (all outside .kb-article).
   The underline is a tinted hairline at rest and goes solid on hover, so it reads as an
   affordance rather than shouting over the text. */
.kb-article p a,
.kb-article li a,
.kb-article td a,
.kb-article dd a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.kb-article p a:hover,
.kb-article li a:hover,
.kb-article td a:hover,
.kb-article dd a:hover {
  text-decoration-color: currentColor;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.22; color: var(--primary); }
h1 { font-size: 44px; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 16px; }
h2 { font-size: 24px; letter-spacing: -0.02em; margin-top: 48px; margin-bottom: 20px; }
h3 { font-size: 18px; margin-top: 32px; margin-bottom: 12px; }

p { margin-bottom: 16px; line-height: 1.7; }
img { max-width: 100%; height: auto; display: block; }

ul, ol { margin-bottom: 16px; padding-inline-start: 24px; }
li { margin-bottom: 6px; line-height: 1.7; }

code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 14px;
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--primary);
}
pre {
  background: #1e293b; color: #e2e8f0;
  padding: 20px; border-radius: var(--r-sm);
  overflow-x: auto; margin-bottom: 24px;
  font-size: 14px; line-height: 1.6; position: relative;
}
pre code { background: none; color: inherit; padding: 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
table th {
  background: var(--bg-soft); font-weight: 600; text-align: start;
  padding: 12px 16px; border-bottom: 2px solid var(--border);
  font-size: 14px; color: var(--primary);
}
table td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
table tr:hover td { background: var(--bg-soft); }
.kb-table-wrap { overflow-x: auto; margin-bottom: 24px; }
.kb-table-wrap table { margin-bottom: 0; }

/* Tables -> cards on phones. A 3-column table at 390px gives each column ~110px, so the reader
   gets a sideways-scrolling wall of wrapped words. Below 640px each ROW becomes a card and each
   CELL a "Label: value" line — the label comes from data-label, injected from the table's own
   <th> by build/fix-table-mobile.mjs (CSS can't read another element's text).
   Cells whose header was empty, and colspan/rowspan tables (unlabelled by design), degrade to a
   plain value line rather than showing a stray colon. */
@media (max-width: 640px) {
  .kb-table-wrap { overflow-x: visible; }
  .kb-table-wrap table,
  .kb-article table { display: block; width: 100%; }
  .kb-article thead { display: none; }              /* headers now live on each cell */
  .kb-article tbody,
  .kb-article tr,
  .kb-article td { display: block; }
  .kb-article tr {
    border: 1px solid var(--border-light); border-radius: var(--r-sm);
    padding: 4px 0; margin-bottom: 12px; background: var(--bg);
  }
  .kb-article tr:hover td { background: none; }     /* row hover is a table affordance, not a card one */
  .kb-article td {
    border-bottom: 1px solid var(--border-light);
    padding: 10px 16px; vertical-align: top;
  }
  .kb-article tr td:last-child { border-bottom: none; }
  .kb-article td[data-label]::before {
    content: attr(data-label);
    display: block; margin-bottom: 2px;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-3);
  }
}

/* Centred callout for a formula or worked calculation. */
.kb-formula {
  background: var(--bg-soft); border: 1px solid var(--border-light);
  border-radius: var(--r-xs); padding: 16px; text-align: center;
  line-height: 1.9;
}

/* ────────────────────────────────────────────────────────────
   SIDEBAR
─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-inline-end: 1px solid var(--border-light);
  background: var(--bg);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-inner {
  padding-block: 20px 32px;
  padding-inline: 24px 16px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Sidebar search */
.sidebar-search {
  position: relative;
  margin-bottom: 24px;
}
.sidebar-search input {
  width: 100%;
  padding-block: 8px;
  padding-inline: 36px 40px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.sidebar-search input:focus { border-color: var(--accent); }
.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search-icon {
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.sidebar-search-shortcut {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  pointer-events: none;
}

/* Sidebar primary nav */
.sidebar-nav-primary {
  margin-bottom: 20px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  border-radius: var(--r-xs);
  text-decoration: none;
  transition: background 0.1s;
}
.sidebar-link:hover { background: var(--bg-hover); text-decoration: none; }
.sidebar-link--active { color: var(--accent); }
.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Sidebar categories */
.sidebar-categories { flex: 1; }
.sidebar-categories-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  padding: 8px 12px 8px;
  text-transform: capitalize;
}
.sidebar-cat-list { list-style: none; margin: 0; padding: 0; }
.sidebar-cat-list li { margin: 0; }

.sidebar-cat-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  border-radius: var(--r-xs);
  cursor: pointer;
  font-family: inherit;
  text-align: start;
  transition: background 0.1s;
}
.sidebar-cat-toggle:hover { background: var(--bg-hover); }
.sidebar-cat-toggle svg {
  width: 16px; height: 16px; color: var(--text-3);
  transition: transform 0.2s; flex-shrink: 0;
}
.sidebar-cat-toggle.open svg { transform: rotate(90deg); }

.sidebar-cat-sub {
  list-style: none; padding: 0; padding-inline-start: 28px; margin: 0;
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
}
.sidebar-cat-sub.open { max-height: 3000px; }

/* Subcategory toggle (level 2) */
.sidebar-sub-toggle {
  display: block;
  width: 100%;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-radius: var(--r-xs);
  cursor: pointer;
  font-family: inherit;
  text-align: start;
  transition: background 0.1s, color 0.1s;
}
.sidebar-sub-toggle:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-sub-toggle.open { color: var(--primary); font-weight: 600; }

/* Article list under a subcategory */
.sidebar-sub-articles {
  list-style: none; padding: 0; padding-inline-start: 12px; margin: 0;
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
}
.sidebar-sub-articles.open { max-height: 1000px; }
/* REDA AI's KB_NAV is 2-level (category -> articles) where reda/financials are 3-level
   (category -> subcategory -> articles), so build/fix-chrome.mjs drops the synthetic
   subcategory row that used to render as a literal "null". That row was also the click target
   portal-kb.js binds to open .sidebar-sub-articles — so without it nothing could open ai's
   articles and its whole sidebar was inert (2026-07-17).
   :only-child IS the "there is no sub-toggle" test: a 3-level KB always emits the toggle as a
   sibling here, so this can only ever match the 2-level shape. Articles open with their category. */
.sidebar-cat-sub.open > .sidebar-sub-articles:only-child { max-height: 1000px; }
.sidebar-sub-articles a {
  display: block;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
  border-radius: var(--r-xs);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.sidebar-sub-articles a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sidebar-sub-articles a.active { color: var(--accent); font-weight: 600; }

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}
.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--r-xs);
  transition: background 0.1s, color 0.1s;
}
.sidebar-footer-link:hover { background: var(--bg-hover); color: var(--primary); text-decoration: none; }
.sidebar-footer-link svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Search results dropdown */
.kb-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  inset-inline: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto; z-index: 200;
}
.kb-search-result-item {
  display: block; padding: 12px 16px;
  text-decoration: none; border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.kb-search-result-item:hover { background: var(--bg-soft); text-decoration: none; }
.kb-search-result-title { font-weight: 600; color: var(--primary); font-size: 15px; }
.kb-search-result-section { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ── MOBILE HEADER ────────────────────────────────────────── */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 20px;
  align-items: center;
  gap: 12px;
}
.mobile-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text); padding: 4px;
}
.mobile-header-logo {
  font-size: 17px; font-weight: 700; color: var(--primary);
  text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.mobile-header-logo img {
  height: 22px; width: auto; display: block;
}

/* ────────────────────────────────────────────────────────────
   MAIN CONTENT
─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  padding: 80px 48px 48px;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}
.hero h1 {
  font-size: 48px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.hero-subtitle {
  font-size: 18px;
  color: var(--text-2);
  margin-bottom: 0;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Hero search */
.hero-search {
  position: relative;
  max-width: 780px;
  margin: 32px auto 0;
}
.hero-search input {
  width: 100%;
  padding: 20px 24px 20px 52px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.hero-search input::placeholder { color: var(--text-muted); }
.hero-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow-sm);
}
.hero-search-icon {
  position: absolute;
  inset-inline-start: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Popular searches */
.hero-popular {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  font-size: 15px;
  color: var(--text-3);
}
.hero-popular-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-2);
}
.hero-popular-icon { color: var(--accent); flex-shrink: 0; }
.hero-popular-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-popular a {
  display: inline-block;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 24px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.hero-popular a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); box-shadow: var(--shadow-sm); text-decoration: none; }

/* ── Home sections ────────────────────────────────────────── */
.home-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 48px 48px;
}
.home-section-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 20px;
}

/* Use-case cards (horizontal: icon + text) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.use-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--bg);
}
.use-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); text-decoration: none; }

.use-card-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg);
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.use-card-icon svg { width: 24px; height: 24px; color: var(--accent); }

.use-card-text h2,
.use-card-text h3 {
  font-size: 18px; font-weight: 600; color: var(--primary);
  margin: 0 0 4px;
}
.use-card-text p { font-size: 16px; color: var(--text-2); margin: 0; line-height: 1.4; }

/* ── CTA Section ──────────────────────────────────────────── */
.home-cta {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px;
  text-align: center;
  border-top: 1px solid var(--border-light);
}
.home-cta h2 { font-size: 36px; margin-bottom: 8px; }
.home-cta > p { font-size: 18px; color: var(--text-2); }

.cta-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 640px;
  margin: 24px auto 0;
}
.cta-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cta-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); text-decoration: none; }
.cta-card-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); border-radius: 50%; flex-shrink: 0;
}
.cta-card-icon svg { width: 20px; height: 20px; color: var(--text-2); }
.cta-card h3 { font-size: 16px; font-weight: 600; color: var(--primary); margin: 0 0 2px; }
.cta-card p { font-size: 14px; color: var(--text-2); margin: 0; }

/* ────────────────────────────────────────────────────────────
   SECTION INDEX PAGE
─────────────────────────────────────────────────────────── */
.section-hero {
  padding: 48px 48px 24px;
  max-width: 900px;
}
.section-hero h1 { font-size: 40px; margin-bottom: 8px; }
.section-hero .section-count { font-size: 16px; color: var(--text-3); margin-top: 8px; }
.section-hero .section-intro { font-size: 17px; color: var(--text-2); margin: 12px 0 0; max-width: 760px; }
.article-list h3.article-list-subhead { margin: 32px 0 12px; font-size: 16px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.03em; }
/* Human-facing site map page */
.sitemap-intro { color: var(--text-2); margin: 4px 0 8px; }
.sitemap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px 40px; margin-top: 28px; }
.sitemap-cat { break-inside: avoid; }
.sitemap-cat h2 { font-size: 18px; margin: 0 0 2px; }
.sitemap-cat h2 a { color: var(--primary); text-decoration: none; }
.sitemap-cat h2 a:hover { text-decoration: underline; }
.sitemap-cat h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); margin: 14px 0 4px; }
.sitemap-cat ul { list-style: none; margin: 0; padding: 0; }
.sitemap-cat li { margin: 3px 0; }
.sitemap-cat li a { font-size: 14px; color: var(--text-2); text-decoration: none; }
.sitemap-cat li a:hover { color: var(--accent); text-decoration: underline; }

.section-content { max-width: 900px; padding: 0 48px 80px; }

.article-list { display: flex; flex-direction: column; gap: 8px; }
.article-card {
  display: block; padding: 20px 24px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.article-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); text-decoration: none; }
.article-card h3 { font-size: 18px; font-weight: 600; color: var(--primary); margin: 0 0 6px; }
.article-card p { font-size: 16px; color: var(--text-2); margin: 0; line-height: 1.6; }
.article-card-meta { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* ────────────────────────────────────────────────────────────
   ARTICLE PAGE
─────────────────────────────────────────────────────────── */
.kb-page { display: flex; flex: 1; min-height: 100vh; }

.kb-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  border-inline-end: 1px solid var(--border-light);
  padding-block: 24px;
  padding-inline: 32px 16px;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.kb-sidebar-section { margin-bottom: 24px; }
.kb-sidebar-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-3); margin-bottom: 8px; padding: 0 8px;
}
.kb-sidebar-nav { list-style: none; padding: 0; margin: 0; }
.kb-sidebar-nav li { margin: 1px 0; }
.kb-sidebar-nav a {
  display: block; padding: 8px 12px; font-size: 15px; font-weight: 500;
  color: var(--text-2); border-radius: var(--r-xs);
  text-decoration: none; transition: background 0.1s;
}
.kb-sidebar-nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.kb-sidebar-nav a.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

.kb-main { flex: 1; min-width: 0; padding: 32px 48px 80px; overflow-y: auto; }
.kb-article { max-width: 800px; }

/* Breadcrumb */
.kb-breadcrumb {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.kb-breadcrumb a {
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s;
}
.kb-breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.kb-breadcrumb .current { color: var(--text-3); }
.kb-breadcrumb .sep { color: var(--text-muted); font-weight: 300; font-size: 16px; }

/* Article meta */
.kb-article-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 32px; font-size: 14px; color: var(--text-3);
}
.kb-meta-badge {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  padding: 4px 12px; border-radius: 6px;
}
.kb-meta-badge--admin { background: var(--accent-bg); color: var(--accent); }
.kb-meta-badge--user { background: #e8f5ed; color: var(--green); }
.kb-meta-badge--best { background: #e7ecf7; color: #1F3864; }

/* ── Checklist ────────────────────────────────────────────── */
.kb-checklist { list-style: none; margin: 20px 0; padding: 0; }
.kb-checklist > li {
  position: relative; padding-block: 12px;
  padding-inline: 38px 0;
  border-bottom: 1px solid var(--border-light); line-height: 1.65;
  cursor: pointer; transition: color 0.15s;
}
.kb-checklist > li:last-child { border-bottom: none; }
/* The box */
.kb-checklist > li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: 15px;
  width: 18px; height: 18px; box-sizing: border-box;
  border: 2px solid var(--accent); border-radius: 4px; background: #fff;
  transition: background 0.15s, border-color 0.15s;
}
/* The checkmark (hidden until checked) */
.kb-checklist > li::after {
  content: ""; position: absolute; inset-inline-start: 8px; top: 17px;
  width: 5px; height: 10px; box-sizing: border-box;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg); opacity: 0; transition: opacity 0.15s;
}
.kb-checklist > li:hover::before { border-color: var(--green); }
.kb-checklist > li.checked::before { background: var(--green); border-color: var(--green); }
.kb-checklist > li.checked::after { opacity: 1; }
.kb-checklist > li.checked { color: var(--text-3); }
.kb-checklist > li > strong:first-child { color: var(--primary); }
.kb-checklist > li.checked > strong:first-child { color: var(--text-3); }
.kb-checklist > li:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.kb-checklist-phase {
  margin: 28px 0 4px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent);
}

/* ── Example line ("In practice: …") ──────────────────────── */
.kb-example {
  margin: 6px 0 24px; padding: 10px 16px;
  background: var(--bg-soft); border-inline-start: 3px solid var(--border);
  border-radius: 4px; font-size: 15px; color: var(--text-2);
}
.kb-example em { color: var(--accent); font-style: normal; font-weight: 600; }

/* TOC */
.kb-toc {
  /* Clears the sticky header, then the same 32px breathing room it always had. */
  position: sticky; top: calc(var(--header-h) + 32px); width: 220px; flex-shrink: 0;
  margin-top: 32px;
  padding-inline-start: 32px; border-inline-start: 1px solid var(--border-light); align-self: flex-start;
}
.kb-toc-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 12px;
}
.kb-toc a { display: block; padding: 5px 0; font-size: 14px; color: var(--text-2); text-decoration: none; line-height: 1.5; }
.kb-toc a:hover { color: var(--accent); }
.kb-toc a.active { color: var(--accent); font-weight: 600; }

/* ── Callouts ─────────────────────────────────────────────── */
.kb-callout {
  padding: 16px 20px; border-radius: var(--r-sm); margin: 24px 0;
  font-size: 16px; line-height: 1.7; border-inline-start: 4px solid;
}
.kb-callout p:last-child { margin-bottom: 0; }
.kb-callout > strong:first-child { display: block; margin-bottom: 4px; }
.kb-callout--tip { background: #e8f5ed; border-color: var(--green); color: #1a5c2e; }
.kb-callout--warning { background: #fff8e1; border-color: var(--orange); color: #7c4a00; }
.kb-callout--info { background: var(--accent-bg); border-color: var(--accent); color: var(--primary); }
.kb-callout--danger { background: #fef2f2; border-color: var(--red); color: #7f1d1d; }
.kb-callout--compliance { background: #f0f0ff; border-color: #6366f1; color: #312e81; }
/* Illustrative, not advisory — a worked example rather than guidance, so it stays neutral
   instead of borrowing one of the advisory colours above. */
.kb-callout--example { background: var(--bg-soft); border-color: var(--text-3); color: var(--text); }

/* Icon + body layout, used where a callout leads with a glyph instead of a bold lead-in. */
.kb-callout:has(> .kb-callout__icon) { display: flex; gap: 12px; align-items: flex-start; }
.kb-callout__icon { flex: none; font-size: 18px; line-height: 1.55; opacity: .75; }
.kb-callout__body { flex: 1; min-width: 0; }
.kb-callout__body > strong:first-child { display: block; margin-bottom: 4px; }

/* ── Screenshot ──────────────────────────────────────────── */
.kb-screenshot { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; margin: 24px 0; box-shadow: var(--shadow-sm); }
.kb-screenshot img { width: 100%; display: block; }
.kb-screenshot-caption { padding: 10px 16px; background: var(--bg-soft); font-size: 14px; color: var(--text-3); text-align: center; }

/* ── Steps ────────────────────────────────────────────────── */
.kb-steps { counter-reset: step; margin: 24px 0; }
.kb-step { display: flex; gap: 16px; margin-bottom: 24px; }
.kb-step::before {
  counter-increment: step; content: counter(step);
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700; border-radius: 50%; flex-shrink: 0;
}
.kb-step-content { flex: 1; }
.kb-step-content h4 { font-size: 18px; font-weight: 600; margin: 0 0 6px; color: var(--primary); }

/* ── FAQ ──────────────────────────────────────────────────── */
.kb-faq { margin-top: 48px; }
.kb-faq-title { font-size: 24px; margin-bottom: 16px; }
.kb-faq-item { border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 8px; overflow: hidden; }
.kb-faq-question {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 16px 20px; border: none; background: var(--bg);
  cursor: pointer; font-family: inherit; font-size: 16px; font-weight: 600;
  color: var(--primary); text-align: start;
}
.kb-faq-question:hover { background: var(--bg-soft); }
.kb-faq-question::after { content: '+'; font-size: 20px; color: var(--text-3); margin-inline-start: 16px; }
.kb-faq-item.open .kb-faq-question::after { content: '\2212'; }
.kb-faq-answer {
  max-height: 0; overflow: hidden; padding: 0 20px;
  font-size: 16px; color: var(--text-2); line-height: 1.7;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

/* ── Feedback ─────────────────────────────────────────────── */
.kb-feedback { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); text-align: center; }
.kb-feedback-q { font-size: 16px; font-weight: 600; color: var(--primary); margin-bottom: 12px; }
.kb-feedback-btn {
  display: inline-block; padding: 8px 24px; margin: 0 6px;
  border: 1px solid var(--border); border-radius: var(--r-btn); background: var(--bg);
  color: var(--text-2); font-size: 15px; font-family: inherit; cursor: pointer;
}
.kb-feedback-btn:hover { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }

/* ── Related links ────────────────────────────────────────── */
/* Same end-of-article rhythm as .kb-feedback above. Two names for one component: reda/ ships
   .kb-related (sibling articles), ai/ ships .kb-related-help (outbound Salesforce docs).
   The list keeps the article's hairline-underline link affordance rather than overriding it. */
.kb-related,
.kb-related-help { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.kb-related h2,
.kb-related-help h3 { margin: 0 0 14px; font-size: 18px; color: var(--primary); }
.kb-related ul,
.kb-related-help ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kb-related li,
.kb-related-help li { margin: 0; }

/* ── Prev/next nav ────────────────────────────────────────── */
/* ai/ only — reda/ and financials/ ship no prev/next. Two shapes for one component: .kb-nav is
   a bare link pair, .kb-nav-footer adds a "Next"/"Previous" label; both get the same treatment.
   .kb-nav-prev is often an empty div (first article in a category) — flex: 1 keeps it holding
   its half so a lone Next still sits right. */
.kb-nav,
.kb-nav-footer {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border);
}
.kb-nav-prev,
.kb-nav-next { flex: 1 1 0; min-width: 0; }
.kb-nav-next { text-align: end; }
.kb-nav-title {
  font-size: 12.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-3); margin-bottom: 4px;
}
.kb-nav-prev a,
.kb-nav-next a { font-weight: 600; font-size: 15px; }

@media (max-width: 560px) {
  .kb-nav,
  .kb-nav-footer { flex-direction: column; gap: 20px; }
  .kb-nav-next { text-align: start; }
}

/* ── Article CTA ──────────────────────────────────────────── */
/* Deliberately the in-article sibling of .portal-support__card (portal.css): same brand-spectrum
   wash, same icon watermark, same pill button — so the demo ask reads as one recurring voice
   across the portal rather than a different box per surface. */
.kb-cta {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(100deg, rgba(37,72,96,.05), rgba(111,207,193,.09) 55%, rgba(82,176,80,.08));
  border: 1px solid var(--border-light); border-radius: var(--r);
  padding: 28px 30px; margin-top: 40px;
}
.kb-cta::after {
  content: ""; position: absolute; right: -30px; top: -40px; width: 220px; height: 124px;
  background: url("../img/brand/reda-icon-vector.svg") no-repeat center / contain;
  opacity: .07; pointer-events: none;
}
.kb-cta > * { position: relative; z-index: 1; }
.kb-cta-text { color: var(--text-2); font-size: 14.5px; line-height: 1.6; max-width: 560px; }
.kb-cta-text > strong:first-child { display: block; margin-bottom: 6px; font-size: 19px; color: var(--primary); }
/* Beats the global `a` (and `a:hover`, hence the explicit colour) so the pill never inherits
   the accent link colour on a navy background. */
.kb-cta-btn {
  flex: none; display: inline-block; text-decoration: none; white-space: nowrap;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 14.5px;
  padding: 13px 24px; border-radius: var(--r-btn);
}
.kb-cta-btn:hover { background: var(--primary-hover); color: #fff; }

@media (max-width: 700px) {
  .kb-cta { flex-direction: column; align-items: flex-start; padding: 24px 22px; }
}

/* ── Code copy ────────────────────────────────────────────── */
.kb-code-copy {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  color: #94a3b8; padding: 4px 12px; border-radius: 6px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.kb-code-copy:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  background: var(--bg-soft); border-top: 1px solid var(--border);
  padding: 24px 48px;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; color: var(--text-3);
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-3); }
.footer-links a:hover { color: var(--primary); }

/* ────────────────────────────────────────────────────────────
   RESPONSIVE
─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout-wrapper { flex-direction: column; }
  .sidebar {
    position: fixed; inset-inline-start: 0; inset-block: 0;
    transform: translateX(-100%); transition: transform 0.25s;
    box-shadow: var(--shadow-lg); z-index: 100;
    overflow-y: auto;                 /* 17+ categories are taller than any phone */
  }
  .sidebar.open { transform: translateX(0); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .sidebar.open { transform: translateX(0); }
  /* The drawer opener (audit A-02) is injected by portal-kb.js and styled entirely in
     portal.css — BOTH its base rule and its ≤900px override must live in the same stylesheet,
     because portal.css loads second and would otherwise beat an equal-specificity rule here.
     `.mobile-header` below is the older scaffold that no page ever rendered. */
  .mobile-header { display: flex; }
  .hero { padding: 48px 24px 32px; }
  .hero h1 { font-size: 32px; }
  .home-section { padding: 0 24px 32px; }
  .card-grid { grid-template-columns: 1fr; }
  .home-cta { padding: 32px 24px; }
  .cta-cards { grid-template-columns: 1fr; }
  .kb-main { padding: 24px; }
  .kb-toc { display: none; }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .hero-search input { padding-block: 16px; padding-inline: 44px 16px; }
  .hero-popular { flex-direction: column; }
}

/* ────────────────────────────────────────────────────────────
   TOP HEADER BAR
─────────────────────────────────────────────────────────── */
.top-header {
  background: var(--primary);
  color: #fff;
  height: 52px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 60;
}
.top-header-inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.top-header-brand:hover { text-decoration: none; color: #fff; }
.top-header-logo {
  height: 32px;
  padding: 0 9px;
  background: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.top-header-logo img {
  height: 20px;
  width: auto;
  display: block;
}
.top-header-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.top-header-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.25);
}
.top-header-section {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
}
.top-header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.top-header-nav a {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  transition: color 0.15s;
}
.top-header-nav a:hover { color: #fff; text-decoration: none; }

/* ── LAYOUT WRAPPER ───────────────────────────────────────── */
.layout-wrapper {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

/* Override body for vertical flow with header + wrapper + footer */
body {
  flex-direction: column;
}

/* Sidebar height + sticky offset match the portal header — see --header-h. */
.sidebar {
  height: calc(100vh - var(--header-h));
  top: var(--header-h);
}

/* ────────────────────────────────────────────────────────────
   SITE FOOTER (dark, REDA style)
─────────────────────────────────────────────────────────── */
.site-footer {
  background: #0c1628;
  color: rgba(255,255,255,0.8);
  padding: 40px 32px 0;
  flex-shrink: 0;
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-logo {
  height: 44px;
  padding: 0 12px;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.footer-logo img {
  height: 26px;
  width: auto;
  display: block;
}
.footer-product-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.footer-company {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.site-footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.site-footer-links a {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer-links a:hover { color: #fff; text-decoration: none; }

.site-footer-social {
  display: flex;
  gap: 16px;
}
.site-footer-social a {
  color: rgba(255,255,255,0.5);
  transition: color 0.15s;
  display: flex;
}
.site-footer-social a:hover { color: #fff; }
.site-footer-social svg { width: 20px; height: 20px; }

.site-footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  flex-wrap: wrap;
  gap: 8px;
}

/* ── RESPONSIVE: header + footer ──────────────────────────── */
@media (max-width: 900px) {
  /* Article pages: hide the navy bar; the injected mobile-header takes over */
  .top-header { display: none; }

  .site-footer-inner { flex-direction: column; align-items: flex-start; }
  .site-footer-bottom { flex-direction: column; text-align: center; align-items: center; }
}

@media (max-width: 640px) {
  .top-header-inner { padding: 0 16px; }
  .site-footer { padding: 32px 20px 0; }
}

/* ── Screenshot placeholder (pre-capture state; replaced by <img> at slotting) ── */
.kb-screenshot--placeholder { border-style: dashed; background: var(--bg-soft); }
.kb-screenshot--placeholder .kb-screenshot-caption { background: transparent; font-style: italic; }

/* ── Text utilities (replace legacy inline styles; keep all styling global) ── */
/* Hidden synonym keywords for Pagefind (build/add-search-keywords.mjs). Not shown to readers;
   Pagefind still indexes the text as a searchable data-pagefind-meta field. display:none is fine —
   Pagefind parses the DOM, not the rendered layout, so hidden text is still indexed (verified). */
.kb-search-keywords { display: none; }
.kb-muted { color: var(--text-muted); font-size: 13px; }
.kb-danger-text { color: var(--red); font-size: 13px; }
.kb-pos-text { color: var(--green); font-weight: 600; }
.kb-neg-text { color: var(--red); font-weight: 600; }
.kb-mt-sm { margin-top: 8px; }
.kb-mt-md { margin-top: 12px; }

/* ────────────────────────────────────────────────────────────
   RTL (Arabic) — the tail end of i18n support. The rules above use LOGICAL properties
   (margin/padding/border -inline-*, text-align:start/end, inset-inline-*), so under
   <html dir="rtl"> the whole layout mirrors automatically. These handle only what logical
   properties cannot express: transforms have no logical form, and code/keyboard runs must stay
   left-to-right regardless of page direction. Direction-agnostic motifs (brand-spectrum lane,
   gradients, the dots mark, the logo) are intentionally left unmirrored.
─────────────────────────────────────────────────────────── */
[dir="rtl"] pre,
[dir="rtl"] code,
[dir="rtl"] kbd { direction: ltr; }
