:root {
  /* Legacy variable names kept so the ~130 existing var(--x) call
     sites across product-page.css/homepage.css/role-page.css don't
     all need individual edits — every one of them now resolves to a
     governed brand token from tokens.css instead of its own hex
     value. tokens.css is still the single source of truth (§6);
     nothing here re-declares a raw hex that isn't already in
     tokens.css. */
  --navy: var(--brand-navy-950);
  --navy-2: var(--brand-navy-900);
  --purple: var(--brand-purple-500);
  --purple-dark: var(--brand-indigo-700);
  --purple-soft: var(--brand-lavender-50);
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-default);
  --surface: var(--surface-card);
  --surface-2: var(--surface-page);
  --shadow: 0 16px 45px rgba(16, 27, 58, .14);
  --shadow-sm: 0 7px 22px rgba(16, 27, 58, .08);
  --radius: 18px;
  --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface-2);
  font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 3px;
  border-radius: 10px;
}

.shell { max-width: var(--max); margin: 0 auto; padding-left: 26px; padding-right: 26px; }

/* Header — PB-HC-UIUX-2A: white surface matching the Innovapptive
   website, official logo, navy nav text, purple interaction accents.
   This explicitly overrides UIUX-2's solid-navy header direction —
   header only; footer keeps the navy treatment from that round. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  text-decoration: none;
  min-width: 0;
}
.site-logo {
  width: auto;
  height: 32px;
  object-fit: contain;
  display: block;
}
.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--border-default);
  flex: 0 0 auto;
}
.site-context {
  font-weight: 600;
  font-size: 17px;
  color: var(--brand-navy-900);
  white-space: nowrap;
}

.main-nav { display: flex; align-items: center; gap: 8px; }
.product-menu { position: relative; }
.product-menu > summary { list-style: none; }
.product-menu > summary::-webkit-details-marker { display: none; }
.product-menu-chevron { margin-left: 5px; font-size: 12px; transition: transform .16s ease; }
.product-menu[open] .product-menu-chevron { transform: rotate(180deg); }
.product-menu-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  width: 330px; padding: 10px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px;
  background: var(--surface-card); border: 1px solid var(--border-default); border-radius: 14px;
  box-shadow: var(--shadow); color: var(--brand-navy-900);
}
.product-menu-panel a {
  min-height: 42px; display: flex; align-items: center; padding: 9px 11px; border-radius: 9px;
  text-decoration: none; font-size: 13px; font-weight: 600;
}
.product-menu-panel a:hover { background: var(--brand-lavender-50); color: var(--brand-purple-600); }
.product-menu-panel a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.nav-link {
  border: 0;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 13px;
  border-radius: 11px;
  cursor: pointer;
  background: transparent;
  color: var(--brand-navy-900);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav-link:hover { color: var(--brand-purple-600); text-decoration: underline; text-underline-offset: 3px; }
.nav-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Footer — same navy family as the header, compact */
.site-footer { background: var(--header-background); margin-top: 40px; }
.footer-inner { min-height: 56px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: rgba(255,255,255,.7); font-size: 13px; }
.footer-inner nav { display: flex; gap: 16px; }
.footer-inner a { text-decoration: none; color: rgba(255,255,255,.85); }
.footer-inner a:hover { color: var(--text-inverse); text-decoration: underline; }
.footer-inner a:focus-visible { outline: 2px solid var(--text-inverse); outline-offset: 2px; }

/* Breadcrumb */
.crumb { color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.crumb a { text-decoration: none; color: var(--purple-dark); font-weight: 700; }

/* Search + answer panel (shared across homepage/product/role pages) */
.help-search {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 17px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  gap: 7px;
  align-items: center;
  max-width: 720px;
}
.help-search input {
  flex: 1;
  min-width: 0;
  height: 47px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
  font-size: 15px;
}
.help-search button {
  min-height: 45px;
  border: 0;
  border-radius: 12px;
  padding: 0 20px;
  background: var(--button-primary-background);
  color: var(--text-inverse);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(63, 53, 152, .23);
}
.help-search button:hover { background: var(--button-primary-hover); }

.answer-panel {
  margin-top: 12px;
  max-width: 720px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow);
  text-align: left;
  overflow: hidden;
}
.answer-summary { padding: 18px 20px 16px; background: var(--brand-lavender-50); }
.answer-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.answer-label strong { font-size: 14px; }
.confidence { padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--status-success) 14%, white); color: var(--status-success); font-size: 11px; font-weight: 760; }
.answer-summary p { margin: 0; color: var(--text-primary); font-size: 14px; }
.answer-summary ol { margin: 9px 0 0 20px; padding: 0; font-size: 14px; }
.results-title { padding: 12px 20px 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-weight: 760; text-transform: uppercase; letter-spacing: .5px; }
.result-item { border-top: 1px solid var(--line); padding: 13px 20px; }
.result-item:hover { background: var(--surface-muted); }
.result-link { display: block; font-size: 14px; font-weight: 700; margin-bottom: 3px; color: var(--ink); text-decoration: none; }
.result-link:hover { text-decoration: underline; }
.result-meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.result-snippet { color: var(--muted); font-size: 13px; margin: 0; }
.answer-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface-muted); }
.mini-button { border: 1px solid var(--line); border-radius: 10px; background: white; padding: 8px 11px; font-weight: 700; color: var(--ink); cursor: pointer; font-size: 12px; }
.mini-button.primary { background: var(--purple-dark); border-color: var(--purple-dark); color: white; }
.answer-loading { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; font-weight: 700; }
.answer-error { padding: 16px 20px; text-align: center; color: var(--status-error); font-size: 14px; }
.answer-error .mini-button { margin-left: 8px; }

/* Chat — desktop uses the full "Ask Innovapptive Help" pill so the
   launcher is self-explanatory. Mobile remains an icon-only circle via
   responsive.css. */
.chat-launcher {
  position: fixed;
  right: max(26px, env(safe-area-inset-right, 0px));
  bottom: max(26px, env(safe-area-inset-bottom, 0px));
  z-index: 90;
  width: auto;
  min-width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--button-primary-background);
  color: var(--text-inverse);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(16, 27, 58, .22);
  transition: transform .16s ease, background .16s ease;
}
.chat-launcher:hover { transform: translateY(-2px); background: var(--button-primary-hover); }
.chat-launcher:focus-visible { outline: 2px solid var(--text-inverse); outline-offset: 3px; }
.chat-launcher-icon { font-size: 18px; line-height: 1; }
.chat-launcher-label { display: inline; white-space: nowrap; }
.chat-backdrop {
  position: fixed; inset: 0; z-index: 89; background: rgba(16, 27, 58, .32);
}
.chat-backdrop[hidden] { display: none !important; }
.chat-drawer {
  position: fixed;
  right: 26px;
  bottom: 92px;
  z-index: 91;
  width: min(800px, calc(100vw - 52px));
  height: min(760px, calc(100vh - 130px));
  max-width: calc(100vw - 52px);
  max-height: 82vh;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.chat-drawer[hidden] { display: none !important; }
.chat-drawer.open { display: flex; }
.chat-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 16px 16px 12px; border-radius: 18px 18px 0 0;
  background: var(--header-background); color: var(--text-inverse);
}
.chat-header h2 { margin: 0; font-size: 15px; color: var(--text-inverse); }
.chat-header p { margin: 4px 0 0; font-size: 12px; color: rgba(255,255,255,.7); }
.chat-close { border: 0; background: transparent; font-size: 20px; cursor: pointer; color: rgba(255,255,255,.85); line-height: 1; }
.chat-close:hover { color: var(--text-inverse); }
.chat-close:focus-visible { outline: 2px solid var(--text-inverse); outline-offset: 2px; }
.chat-context { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); }
.chat-context select { flex: 1; height: 34px; border: 1px solid var(--border-default); border-radius: 9px; padding: 0 8px; font-size: 12px; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { border-radius: 14px; padding: 10px 13px; font-size: 13px; max-width: 90%; line-height: var(--line-height-body); }
.bubble-help { background: var(--brand-lavender-50); border: 1px solid var(--brand-lavender-200); color: var(--text-primary); align-self: flex-start; }
.bubble-help-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 4px; }
.bubble-help h3 { margin: 0; font-size: 13px; color: var(--text-primary); }
.bubble-help ol { margin: 6px 0 0 18px; padding: 0; }
.bubble-help .source { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.bubble-help .source a { color: var(--link-default); }
.answer-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--brand-lavender-200); }
.answer-section:first-of-type { margin-top: 6px; padding-top: 0; border-top: none; }
.answer-section h4 { margin: 0 0 4px; font-size: 12.5px; color: var(--text-primary); }
.section-product-tag { font-size: 10.5px; font-weight: 600; color: var(--brand-lavender-600, #6c4fd6); }
.answer-notes, .answer-warnings { margin: 6px 0 0 18px; padding: 0; font-size: 11.5px; }
.answer-warnings { color: var(--text-warning, #92400e); }
.cross-product-note { margin: 4px 0; font-size: 11px; font-style: italic; color: var(--text-muted); }
.bubble-loading { color: var(--text-muted); font-style: italic; }
.bubble-error { color: var(--status-error); }
.bubble-user { background: var(--surface-muted); border: 1px solid var(--border-default); color: var(--text-primary); align-self: flex-end; }

.confidence-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.confidence-high { background: color-mix(in srgb, var(--status-success) 14%, white); color: var(--status-success); }
.confidence-medium { background: color-mix(in srgb, var(--status-warning) 14%, white); color: var(--status-warning); }
.confidence-insufficient_evidence { background: color-mix(in srgb, var(--status-error) 14%, white); color: var(--status-error); }

.missing-context { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.missing-context-row { margin-bottom: 6px; }
.missing-context-row > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.missing-context-choices { display: flex; flex-wrap: wrap; gap: 6px; }

.escalation { margin-top: 8px; }

.feedback-row { display: flex; gap: 6px; margin-top: 8px; }
.feedback-row .mini-button:disabled { opacity: .55; cursor: default; }
.feedback-chosen { border-color: var(--brand-indigo-700); color: var(--brand-indigo-700); }
.chat-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border-default); }
.chat-input textarea { flex: 1; resize: none; border: 1px solid var(--border-default); border-radius: 10px; padding: 8px 10px; font-size: 13px; max-height: 90px; }
.chat-send { border: 0; border-radius: 10px; padding: 0 16px; background: var(--button-primary-background); color: var(--text-inverse); font-weight: 700; cursor: pointer; min-height: 44px; }
.chat-send:hover { background: var(--button-primary-hover); }
.chat-send:focus-visible { outline: 2px solid var(--focus-outline); outline-offset: 2px; }

/* Shared card / chip / task components used on product and role pages */
.section-card { background: var(--surface-card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow-sm); }
.section-card h2 { margin: 0 0 4px; font-size: 18px; }
.section-card .card-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.chip:hover { border-color: rgba(91,70,223,.4); background: var(--purple-soft); color: var(--purple-dark); }
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.task-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); font-size: 14px; font-weight: 650; cursor: pointer; text-align: left; }
.task-item:hover { background: var(--purple-soft); border-color: rgba(91,70,223,.35); }
.legacy-badge { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--purple-dark); background: var(--purple-soft); padding: 2px 8px; border-radius: 999px; }
.icon-badge { width: 50px; height: 50px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-lavender-100); color: var(--brand-indigo-700); flex: 0 0 auto; }
.icon-badge svg, .icon-badge img { width: 24px; height: 24px; }
.video-placeholder {
  width: 100%; max-width: 640px; aspect-ratio: 16/9; border-radius: 14px;
  background: repeating-linear-gradient(135deg, var(--surface-muted), var(--surface-muted) 10px, var(--border-subtle) 10px, var(--border-subtle) 20px);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 700; font-size: 14px; border: 1px dashed var(--line);
}
.task-link {
  border: 0; background: transparent; padding: 0; margin: 0; color: var(--purple-dark);
  font: inherit; font-weight: 600; cursor: pointer; text-align: left; text-decoration: underline;
  text-decoration-color: rgba(91,70,223,.35);
}
.task-link:hover { text-decoration-color: var(--purple-dark); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Shared product/role browse-card component (§8.3/8.4, §16) — used on the
   homepage, /products/index.html, /roles/index.html, AND role pages, so
   it lives here rather than in homepage.css, which role pages never load. */
.main-stage { padding: 30px 0 104px; }

.browse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 1180px; margin: 0 auto; }
.browse-item {
  min-width: 0; min-height: 178px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-card); padding: 24px;
  text-decoration: none; text-align: left; cursor: pointer; position: relative;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.browse-item:hover { transform: translateY(-3px); border-color: rgba(163, 135, 255, .45); box-shadow: 0 13px 28px rgba(11, 31, 70, .10); }
.browse-item .icon-badge { position: absolute; right: 24px; bottom: 24px; width: 56px; height: 56px; }
.browse-item .icon-badge img { width: 100%; height: 100%; object-fit: contain; }
.browse-item strong { display: block; font-size: 19px; line-height: 1.25; padding-right: 90px; }
.browse-item small { display: block; color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 10px; padding-right: 90px; max-width: 90%; }
.browse-cta {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; padding: 10px 18px; border-radius: 8px;
  background: var(--button-primary-background); color: var(--text-inverse); font-size: 14px; font-weight: 600;
}
.browse-item:hover .browse-cta { background: var(--button-primary-hover); }
