/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary: #1e2d44;
  --color-primary-dark: #0f1a2e;
  --color-primary-light: #3a4a63;
  --color-bg: #ffffff;
  --color-bg-light: #f7f8fa;
  --color-bg-muted: #f0f4f8;
  --color-text: #2d3748;
  --color-text-muted: #718096;
  --color-text-light: #a0aec0;
  --color-border: #e2e8f0;
  --color-border-light: #f0f0f0;
  --color-accent: #e8ecf5;
  --color-danger: #e53e3e;
  --color-success: #38a169;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --max-width: 1200px;
  --header-height: 60px;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

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

a:hover {
  text-decoration: underline;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#content {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* === Header === */
#site-header {
  background: var(--color-primary);
  color: white;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo:hover {
  text-decoration: none;
}

.header-logo-img {
  width: 32px;
  height: 32px;
}

.header-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.header-prompt-btn {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s;
  flex-shrink: 0;
}

.header-prompt-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  text-decoration: none;
}

.header-prompt-btn.active {
  background: rgba(255, 255, 255, 0.3);
}

/* === Footer === */
#site-footer {
  background: var(--color-primary-dark);
  color: var(--color-text-light);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.footer-logo-img {
  width: 24px;
  height: 24px;
}

.footer-title {
  font-weight: 600;
  color: white;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
}

.footer-nav a {
  color: var(--color-text-light);
  font-size: 0.85rem;
}

.footer-nav a:hover {
  color: white;
}


/* === Hero (homepage only, desktop) === */
#hero {
  background: linear-gradient(180deg, var(--color-bg-light) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid rgba(30, 45, 68, 0.08);
}

#hero:empty {
  display: none;
}

/* On home, ensure content can always be scrolled past the hero so that
   tab-switching while in the sticky-revealed state stays revealed
   (otherwise, a short tab's content would let the browser clamp the
   scroll back down below the threshold). */
body.home-mode #content {
  min-height: 100vh;
}

/* Hidden on mobile — mobile home goes straight into sticky nav + subnav */
@media (max-width: 640px) {
  #hero {
    display: none;
  }
}

/* ====================================================================
   Sticky main nav (dark navy). Behavior:
   - Home: hidden on load, slides in past 180px scroll
   - Other pages: always visible from page load
   ==================================================================== */
#site-header.is-sticky-hero {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-primary-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

#site-header.is-sticky-hero.is-revealed {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Content padding when fixed headers are always visible (non-home pages).
   Main nav: 56px desktop / 100px mobile.
   Subnav (when present): ~62px desktop / ~62px mobile (incl. top padding).
   Add breathing room beneath the final fixed band. */
body.sticky-always #content {
  padding-top: calc(64px + 2rem);
}

body.sticky-always.has-subnav #content {
  padding-top: calc(64px + var(--subnav-height, 66px) + 2.25rem);
}


@media (max-width: 640px) {
  body.sticky-always #content {
    padding-top: calc(64px + 1.5rem);
  }

  body.sticky-always.has-subnav #content {
    padding-top: calc(64px + var(--subnav-height, 66px) + 1.4rem);
  }
}

/* Nav band: 56px desktop. Controls at 30px so they sit comfortably inside
   the band with 13px of breathing room above and below. Logo 30px matches. */
.sticky-hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
}
/* Tagline aligns to the title's text baseline */
.sticky-title, .sticky-tagline {
  line-height: 1.2;
}

.sticky-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: white;
  text-decoration: none;
  flex-shrink: 0;
}

.sticky-brand:hover {
  text-decoration: none;
}

.sticky-logo-img {
  width: 36px;
  height: 36px;
  display: block;
}

.sticky-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: var(--font-weight-bold);
  color: white;
  letter-spacing: -0.025em;
  line-height: 1;
}

.sticky-tagline {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search + CTA always right-aligned as a group */
.sticky-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  margin-left: auto;
}

.sticky-search {
  flex: 0 0 auto;
}
.sticky-search .search-bar-wrapper {
  width: auto;
  flex: 0 0 auto;
}
.sticky-search .search-bar {
  width: auto;
}

/* Search bar inside dark nav — styled as button, right-aligned with CTA */
.sticky-search .search-bar {
  height: 34px;
  padding: 0 0.85rem;
  font-size: 0.84rem;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  border-radius: 6px;
  font-weight: var(--font-weight-semibold);
  gap: 0.45rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.sticky-search .search-bar:hover,
.sticky-search .search-bar:focus-visible {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.sticky-search .search-bar-icon {
  color: inherit;
  flex-shrink: 0;
}

.sticky-search .search-bar:hover .search-bar-icon {
  color: inherit;
}

/* Build Prompt CTA — 30px to match search */
.sticky-cta {
  height: 34px;
  padding: 0 0.85rem;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

.sticky-cta:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
  color: white;
  text-decoration: none;
}

.sticky-cta.active {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

/* ====================================================================
   Sticky sub-nav (topic + custom pages only)
   Sits directly below the main nav as a second fixed band.
   Contains the topic title + tabs.
   ==================================================================== */
#sub-header.is-subnav {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 99;
  background: #f3f4f6;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* === Home subnav (desktop) ===
   Lives in document flow below the hero so it's visible by default.
   Becomes sticky once scrolled past, then transitions from top: 0 to
   top: 56px when the main sticky nav reveals. */

/* Apply the same inner topic-banner overrides as the fixed subnav */
#sub-header.is-home-subnav .topic-banner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.4rem 1rem 1.2rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  min-height: 68px;
}

#sub-header.is-home-subnav .topic-banner-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}
#sub-header.is-home-subnav .topic-banner-titlegroup {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

#sub-header.is-home-subnav .topic-banner-title {
  font-size: 1.3rem;
  line-height: 1.15;
}

#sub-header.is-home-subnav .topic-banner-accent {
  height: 26px;
  width: 3.5px;
}

#sub-header.is-home-subnav .topic-banner-tabs {
  gap: 1.25rem;
  align-items: center;
}

#sub-header.is-home-subnav .topic-banner-tabs .tab-pill {
  font-size: 0.85rem;
  padding: 0.4rem 0 0.4rem;
}

#sub-header.is-subnav .topic-banner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.4rem 2rem 1.2rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  min-height: 68px;
}

#sub-header.is-subnav .topic-banner-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}
#sub-header.is-subnav .topic-banner-titlegroup {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

#sub-header.is-subnav .topic-banner-title {
  font-size: 1.3rem;
  line-height: 1.15;
}

#sub-header.is-subnav .topic-banner-accent {
  height: 26px;
  width: 3.5px;
}

#sub-header.is-subnav .topic-banner-tabs {
  gap: 1.25rem;
  align-items: center;
}


/* Mobile-only sections (Related/Featured Topics card panels) — visible
   only when active on mobile via tab. Hidden entirely on desktop. */
@media (min-width: 1024px) {
  .is-mobile-only { display: none !important; }
}

#sub-header.is-subnav .topic-banner-tabs .tab-pill {
  font-size: 0.85rem;
  padding: 0.4rem 0 0.4rem;
}

/* Below the desktop breakpoint the tabs are the primary nav in the
   subnav row — give them a thin vertical divider from the title group
   so there's a clear visual separator between page title and subnav
   options on tablet + mobile. */
@media (max-width: 899.98px) {
  #sub-header.is-subnav .topic-banner-row,
  #sub-header.is-home-subnav .topic-banner-row {
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    align-items: center;
  }
  #sub-header.is-subnav .topic-banner-tabs,
  #sub-header.is-home-subnav .topic-banner-tabs {
    gap: 0.9rem;
    align-items: center;
  }
}

@media (max-width: 640px) {
  #sub-header.is-subnav {
    top: 54px;
  }

  #sub-header.is-subnav .topic-banner {
    padding: 0.7rem 0.9rem;
    min-height: 48px;
  }

  #sub-header.is-subnav .topic-banner-title {
    font-size: 1.15rem;
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
  }

  #sub-header.is-subnav .topic-banner-accent {
    height: 22px;
  }
}

/* Extra-small screens: shrink title further for long names */
@media (max-width: 400px) {
  #sub-header.is-subnav .topic-banner-title {
    font-size: 1rem;
    max-width: 35vw;
  }
}

/* Default: show full CTA text, hide short */
.sticky-cta-short { display: none; }
.sticky-cta-full { display: inline; }

/* Mobile: single row (brand + search + CTA all fit together). */
@media (max-width: 640px) {
  .sticky-hero-inner {
    flex-wrap: nowrap;
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
    min-height: 54px;
  }

  .sticky-brand {
    gap: 0.45rem;
  }

  .sticky-logo-img {
    width: 26px;
    height: 26px;
  }

  .sticky-title {
    font-size: 1.15rem;
  }

  .sticky-tagline {
    display: none;
  }

  .sticky-actions {
    margin-left: auto;
    gap: 0.35rem;
  }

  .sticky-cta,
  .sticky-search .search-bar {
    height: 28px !important;
    font-size: 0.68rem !important;
    padding: 0 0.6rem !important;
    border-radius: 5px !important;
    border-width: 1.5px !important;
    font-weight: var(--font-weight-semibold) !important;
    gap: 0.35rem !important;
  }

  .sticky-cta-full { display: none !important; }
  .sticky-cta-short { display: inline !important; }

  .sticky-search {
    flex: 0 0 auto;
    min-width: 0;
  }

  .feeds-pill {
    font-size: 0.62rem;
    font-weight: 400;
    color: var(--color-text-light);
  }
  .feeds-pill-label-full { display: none !important; }
  .feeds-pill-label-short { display: inline !important; }
  .sticky-search .search-bar-wrapper {
    padding: 0;
    max-width: none;
  }

  /* Condensed sticky search on mobile: real search bar, just narrow
     enough to fit alongside brand + Build Prompt on one row. Full
     label swaps to a shortened "Search topics" placeholder. */
  .sticky-search .search-bar.is-compact {
    width: 100%;
    height: 30px;
    padding: 0 0.7rem;
    font-size: 0.78rem;
    gap: 0.4rem;
  }
  .sticky-search .search-bar.is-compact .search-bar-label-full {
    display: none;
  }
  .sticky-search .search-bar.is-compact .search-bar-label-short {
    display: inline;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sticky-search .search-bar.is-compact .search-bar-label {
    min-width: 0;
    overflow: hidden;
  }

  /* Non-compact fallback stays on its own row */
  .sticky-search:has(.search-bar:not(.is-compact)) {
    order: 3;
    flex: 0 0 100%;
    margin: 0;
  }
  .sticky-search:has(.search-bar:not(.is-compact)) .search-bar {
    height: 30px;
    font-size: 0.82rem;
    padding: 0 0.8rem;
  }
}

/* By default (non-mobile), show the full label and hide the short one */
.search-bar-label-short { display: none; }
.search-bar-label-full { display: inline; }

/* H2 condensed hero — ~25% shorter than original */
.hero-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.75rem 1rem 1.5rem;
  text-align: center;
}

.hero-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  color: var(--color-primary);
  text-decoration: none;
}

.hero-brand:hover {
  text-decoration: none;
}

.hero-brand-logo {
  width: 34px;
  height: 34px;
}

.hero-brand-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.03em;
  color: var(--color-primary);
  margin: 0;
  line-height: 1;
}

/* T2: bigger, bolder tagline */
.hero-tagline {
  font-size: 1.05rem;
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 0.95rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.hero-search-wrap {
  max-width: 440px;
  margin: 0 auto;
}

/* Search trigger inside the hero — H2 proportions */
.hero-search-wrap .search-bar {
  padding: 0.6rem 0.9rem;
  font-size: 0.88rem;
  border-width: 2px;
}

.hero-chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin: 0.6rem auto 0;
  max-width: 440px;
}

.hero-chip-label {
  font-size: 0.72rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-weight-semibold);
  margin-right: 0.15rem;
}

.hero-chip {
  font-size: 0.78rem;
  background: var(--color-bg);
  color: var(--color-text);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  border: 1px solid var(--color-border);
}

.hero-chip:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  text-decoration: none;
}

/* B4: lead-in copy + bold navy underlined link */
.hero-build-callout {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
  margin: 1.1rem 0 0;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.hero-build-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.35rem;
  color: #4a6bbf;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: color 0.15s;
}

.hero-build-link:hover {
  color: #2e4a9f;
}

.hero-build-link:hover .hero-build-arrow {
  transform: translateX(2px);
}

.hero-build-arrow {
  line-height: 1;
  font-weight: var(--font-weight-medium);
  transition: transform 0.15s;
}

@media (max-width: 768px) {
  .hero-inner {
    padding: 2rem 1rem 1.75rem;
  }

  .hero-brand {
    gap: 0.55rem;
    margin-bottom: 0.7rem;
  }

  .hero-brand-logo {
    width: 36px;
    height: 36px;
  }

  .hero-brand-title {
    font-size: 1.55rem;
  }

  .hero-tagline {
    font-size: 0.88rem;
    margin-bottom: 0.95rem;
  }

  .hero-chips {
    gap: 0.3rem;
    margin-top: 0.65rem;
  }

  .hero-chip,
  .hero-chip-label {
    font-size: 0.72rem;
  }

  .hero-chip {
    padding: 0.2rem 0.65rem;
  }

  .hero-build-callout {
    font-size: 0.78rem;
    margin-top: 0.75rem;
  }

}

/* === Hero C: logo+title inline, search center, CTA right ======== */
@media (min-width: 900px) {
  .hero-C {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    text-align: left;
  }
  .hero-C .hero-brand {
    margin-bottom: 0;
    flex-shrink: 0;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }
  .hero-C .hero-brand-logo { width: 32px; height: 32px; }
  .hero-C .hero-brand-title { font-size: 1.3rem; }
  .hero-C .hero-tagline {
    font-size: 0.82rem;
    margin: 0;
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Search + CTA grouped right */
  .hero-C .hero-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
  }
  .hero-C .hero-search-wrap {
    margin: 0;
    max-width: none;
  }
  .hero-C .hero-search-wrap,
  .hero-C .hero-search-wrap .search-bar-wrapper {
    width: auto;
    flex: none;
  }
  .hero-C .hero-search-wrap .search-bar {
    width: auto;
    height: 34px;
    padding: 0 0.85rem;
    font-size: 0.84rem;
    border-width: 1.5px;
    border-radius: 6px;
  }
  .hero-C .hero-search-wrap .search-bar-icon {
    color: inherit;
  }
  .hero-C .hero-build-link {
    font-size: 0.84rem;
    height: 34px;
    padding: 0 0.85rem;
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    white-space: nowrap;
    text-decoration: none;
    transition: border-color 0.12s, color 0.12s;
  }
  .hero-C .hero-build-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
  }
}


/* Hide tagline below 1200px — prevents truncated partial text */
@media (max-width: 1200px) {
  .sticky-tagline { display: none !important; }
}

/* Mobile: hero-C reverts to centered stacked layout */
@media (max-width: 899.98px) {
  .hero-C {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.75rem 1rem 1.5rem;
    text-align: center;
    display: block;
  }
  .hero-C .hero-tagline { display: block; }
  .hero-C .hero-actions {
    display: block;
    margin: 0;
  }
  .hero-C .hero-build-link {
    display: inline-flex;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: #4a6bbf;
    border: none;
    padding: 0;
    height: auto;
    background: none;
  }
}

/* === Tabs === */
.tabs-row {
  display: flex;
  gap: 0.5rem;
}

.tab-pill {
  padding: 0.45rem 0 0.45rem;
  font-size: 0.9rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.tab-pill:hover {
  color: var(--color-text);
  text-decoration: none;
}

.tab-pill.active {
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

/* Desktop / non-tabular: tabs are plain jump links — no active
   styling at all (no underline, no bold, no color shift). */
@media (min-width: 900px) {
  #sub-header .tab-pill.active {
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
    border-bottom-color: transparent;
  }
  #sub-header .tab-pill:hover {
    color: var(--color-primary);
    background: transparent;
    border-bottom-color: var(--color-primary);
  }
}

/* Tabular nav (mobile): underline + bold + primary color on active
   tab — critical visual cue since sections aren't scrollable. */
@media (max-width: 899.98px) {
  .tab-pill.active {
    border-bottom-color: var(--color-primary);
  }
}


/* === Section Headers === */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  letter-spacing: -0.012em;
  line-height: 1;
}

.section-icon {
  font-size: 1.1rem;
  opacity: 0.8;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 640px) {
  .section-header h2 {
    font-size: 1rem;
  }
  .section-icon {
    font-size: 0.95rem;
  }
}

/* === News Feed === */
.newsfeed-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.newsfeed-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1.5px solid #d1d5db;
}

.newsfeed-card-icon {
  font-size: 1rem;
  opacity: 0.85;
}

.newsfeed-card-title {
  font-family: var(--font-family);
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 650;
  color: #2d3748;
  flex-basis: 100%;
  letter-spacing: -0.015em;
  margin: 0;
}

/* "Additional Content Feeds" action — quiet editorial link, not a
   heavy button. Sits to the right in the news feed card header. */
.feeds-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-primary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: color 0.12s;
  flex-shrink: 0;
}

.feeds-pill:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.feeds-pill-icon {
  font-size: 0.85rem;
  line-height: 1;
  color: inherit;
  font-weight: inherit;
}


.newsfeed-embed {
  background: var(--color-bg);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  margin-left: -1.35rem;
  margin-right: -1.35rem;
  width: calc(100% + 2.7rem);
  max-width: 100vw;
}

.newsfeed-iframe {
  display: block;
  width: 100%;
  min-height: 600px;
  border: none;
}

@media (max-width: 1023px) {
  .newsfeed-embed {
    margin-left: -1.15rem;
    margin-right: -1.15rem;
    width: calc(100% + 2.3rem);
  }
}

/* Prevent horizontal overflow on any screen */
#app {
  overflow-x: hidden;
}

/* === Custom-search feed CTAs — full-width rows like shortcuts ==== */
.custom-feeds-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.custom-feed-cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

.custom-feed-cta:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.custom-feed-cta:active { transform: translateY(1px); }

.custom-feed-cta-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.custom-feed-cta-name {
  flex: 1;
  font-weight: var(--font-weight-semibold);
  font-size: 0.95rem;
}

.custom-feed-cta-arrow {
  color: var(--color-text-light);
  font-size: 1rem;
  transition: color 0.15s, transform 0.15s;
}

.custom-feed-cta:hover .custom-feed-cta-arrow {
  color: var(--color-primary);
  transform: translate(2px, -2px);
}

.newsfeed-placeholder {
  background: var(--color-bg-light);
  border-radius: 8px;
  padding: 3rem;
  text-align: center;
  color: var(--color-text-muted);
  min-height: 1000px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === AI Shortcuts === */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.shortcut-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  font-size: 0.85rem;
  font-family: var(--font-family);
  color: var(--color-text);
}

.shortcut-card:hover {
  background: var(--color-bg-light);
  border-color: var(--color-primary-light);
}

.shortcut-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.shortcut-name {
  font-weight: 500;
}

.shortcuts-section-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 1rem 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 768px) {
  .shortcuts-grid {
    grid-template-columns: 1fr;
  }
}

/* === Search Bar === */
.search-bar-wrapper {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 0.95rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition: border-color 0.15s;
}

.search-bar:hover,
.search-bar:focus-visible {
  border-color: var(--color-primary);
  outline: none;
}

/* === Search Overlay (SR2 — full-screen takeover) === */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 26, 46, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1rem 1rem;
  animation: search-overlay-in 0.1s ease-out;
}

@keyframes search-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-overlay-card {
  background: var(--color-bg);
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  animation: search-card-in 0.12s ease-out;
  color: var(--color-text);
  text-align: left;
}

@keyframes search-card-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-overlay-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.search-overlay-hint {
  margin: 0;
  padding: 0.7rem 1.15rem;
  background: var(--color-bg-light, #f6f7f9);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  flex-shrink: 0;
}
.search-overlay-hint em {
  color: var(--color-primary);
  font-style: normal;
  font-weight: var(--font-weight-semibold);
}

/* Section labels in the body */
.search-overlay-section-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  margin: 0.35rem 0 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

.search-overlay-results-block {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.search-overlay-browse .search-overlay-section-label {
  margin-top: 0.25rem;
}

.search-overlay-icon {
  font-size: 1.2rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.search-overlay-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.1rem;
  font-family: var(--font-family);
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
  background: transparent;
  min-width: 0;
}

.search-overlay-input::placeholder {
  color: var(--color-text-light);
  font-weight: var(--font-weight-regular);
}

.search-overlay-esc {
  font-size: 0.7rem;
  background: var(--color-bg-light);
  color: var(--color-text-muted);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 600;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.search-overlay-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-bg-light, #f3f4f6);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  font-size: 1rem;
  color: var(--color-text);
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.12s;
}
.search-overlay-close:hover {
  background: var(--color-border);
}

.search-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.15rem 1.15rem;
}

.search-overlay-group {
  margin-bottom: 0;
}
.search-overlay-group:last-child {
  margin-bottom: 0;
}

/* Shared parent/subtopic treatment for search + all-topics modals */
.search-parent-icon,
.all-topics-modal-parent-icon { display: none; }

.search-overlay-group-empty {
  font-size: 0.78rem;
  color: var(--color-text-light);
  font-style: italic;
  padding: 0.4rem 2.2rem;
}

/* Filtered search results (shown when user is typing) */
.search-overlay-custom {
  padding: 0.7rem 0.85rem;
  border-radius: 6px;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  margin-bottom: 0.6rem;
  color: var(--color-text);
  font-size: 0.88rem;
  font-weight: var(--font-weight-medium);
}

.search-overlay-custom:hover,
.search-overlay-custom.highlighted {
  background: #dde4f8;
}

.search-custom-badge {
  background: var(--color-primary);
  color: white;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: var(--font-weight-bold);
}

.search-overlay-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.06em;
  margin: 0.6rem 0 0.4rem;
}

.search-overlay-result {
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text);
}

.search-overlay-result:hover,
.search-overlay-result.highlighted {
  background: var(--color-accent);
}

.search-overlay-result-parent {
  color: var(--color-text-light);
  font-size: 0.76rem;
  margin-left: 0.5rem;
}

.search-overlay-empty {
  padding: 0.85rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 640px) {
  .search-overlay {
    padding: 0 0 0 0;
    align-items: stretch;
  }

  .search-overlay-card {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    animation: search-card-in-mobile 0.2s ease;
  }

  @keyframes search-card-in-mobile {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .search-overlay-input {
    font-size: 1rem;
  }

  .search-overlay-esc {
    display: none;
  }

  .search-overlay-close {
    display: inline-block;
  }
}

/* === Prompt Preview Modal (M2 — compact card) === */
.prompt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 46, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: prompt-modal-overlay-in 0.12s ease-out;
}

@keyframes prompt-modal-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.prompt-modal {
  background: white;
  border-radius: 14px;
  padding: 1.15rem 1.15rem 1rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: prompt-modal-card-in 0.14s ease-out;
}

@keyframes prompt-modal-card-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.prompt-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.4rem 0.55rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.prompt-modal-close:hover {
  background: var(--color-bg-light);
  color: var(--color-text);
}

.prompt-modal-shortcut {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-right: 1.5rem; /* leave room for close button */
}

.prompt-modal-shortcut-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.prompt-modal-shortcut-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  letter-spacing: -0.015em;
}

.prompt-modal-preview {
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--color-text);
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-bottom: 0.95rem;
}

.prompt-modal-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.prompt-modal-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.06em;
}

.prompt-modal-copy-link {
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.prompt-modal-copy-link:hover {
  background: white;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.prompt-modal-copy-icon {
  flex-shrink: 0;
  color: currentColor;
}

.prompt-modal-copy-text {
  white-space: nowrap;
}

.prompt-modal-models {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.prompt-modal-model-btn {
  border: 2px solid var(--color-border);
  border-radius: 7px;
  padding: 0.5rem 0.4rem;
  text-align: center;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-family);
  color: var(--color-text);
  background: white;
  transition: border-color 0.15s, background 0.15s;
}

.prompt-modal-model-btn:hover {
  border-color: var(--color-primary-light);
}

.prompt-modal-model-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-accent);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.model-copy-tag {
  font-size: 0.62rem;
  color: var(--color-text-light);
  text-transform: lowercase;
  font-weight: var(--font-weight-regular);
}

.prompt-modal-warning {
  background: #fffbeb;
  border: 1px solid #f6e05e;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  color: #744210;
  margin-bottom: 0.85rem;
  line-height: 1.5;
}

.prompt-modal-submit {
  width: 100%;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  font-family: var(--font-family);
  margin-bottom: 0.65rem;
  transition: background 0.15s;
  letter-spacing: -0.01em;
}

.prompt-modal-submit:hover {
  background: var(--color-primary-dark);
}

.prompt-modal-disclaimer {
  font-size: 0.7rem;
  color: var(--color-text-light);
  text-align: center;
  line-height: 1.45;
  margin: 0;
}

@media (max-width: 640px) {
  .prompt-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .prompt-modal {
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    padding: 1rem 1rem 0.9rem;
    animation: prompt-modal-card-in-mobile 0.18s ease-out;
  }

  @keyframes prompt-modal-card-in-mobile {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .prompt-modal-models {
    grid-template-columns: repeat(2, 1fr);
  }

  .prompt-modal-shortcut-name {
    font-size: 0.92rem;
  }
}

/* === Related Topics === */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.related-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.15s, border-color 0.15s;
}

.related-card:hover {
  background: var(--color-bg-light);
  border-color: var(--color-primary-light);
  text-decoration: none;
}

.related-card.active-page {
  background: var(--color-accent);
  border-color: var(--color-primary);
  cursor: default;
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.related-card.active-page:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
}

.related-card.active-page .related-name {
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.related-card.active-page .related-dot {
  background: var(--color-primary);
}

.related-card.active-page .related-arrow {
  display: none;
}

.related-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

.related-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
}

.related-arrow {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

.related-active-label {
  font-size: 0.65rem;
  color: white;
  background: var(--color-primary);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.related-empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem;
}

@media (max-width: 768px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}

/* === Tab panels =============================================== */
/* Tabular nav: only the active panel visible (matches tab pill breakpoint). */
@media (max-width: 1023.98px) {
  [data-tab-panel] { display: none; }
  body.active-tab-newsfeed [data-tab-panel="newsfeed"],
  body.active-tab-shortcuts [data-tab-panel="shortcuts"],
  body.active-tab-related [data-tab-panel="related"] {
    display: block;
  }
}

/* Subnav inline topics (desktop) — sits on the title row */
.subnav-topics-inline {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--color-border);
}

.subnav-topics-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: -0.005em;
  flex-shrink: 0;
}

.subnav-topic-link {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: color 0.12s;
}
.subnav-topic-link:hover {
  color: var(--color-primary);
}
/* "ALL TOPICS +" — matches FEATURED label style */
.subnav-action-link {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 0.65rem;
  padding-right: 0.65rem;
  border-right: 1px solid var(--color-border);
  transition: color 0.12s;
}
.subnav-action-link:hover {
  color: var(--color-primary);
}

/* "More +" — always visible at end, never clipped */
.subnav-more-link {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text-light);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  transition: color 0.12s;
}
.subnav-more-link:hover {
  color: var(--color-primary);
}

/* Desktop: show inline topics, hide mobile tabs.
   Break to tabs at 1024px to prevent text overflow. */
@media (min-width: 1024px) {
  .topic-banner-tabs-mobile { display: none !important; }
  /* Hide old jump-link tabs on desktop — only inline topics show */
  #sub-header .topic-banner-tabs:not(#prompt-gen-steps):not(.topic-banner-tabs-mobile) {
    display: none;
  }
}
@media (max-width: 1023.98px) {
  .subnav-topics-inline { display: none; }
  .topic-banner-tabs-mobile,
  #sub-header .topic-banner-tabs:not(#prompt-gen-steps) {
    display: flex;
    gap: 1rem;
    align-items: center;
  }
  /* Active tab cue — subtle but clear */
  .topic-banner-tabs-mobile .tab-pill.active,
  #sub-header .topic-banner-tabs:not(#prompt-gen-steps) .tab-pill.active {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
    border-bottom: 1.5px solid var(--color-primary);
    padding-bottom: 0.35rem;
  }
}

/* Legacy home topics bar — now replaced by subnav inline topics */
.home-topics-bar {
  display: none;
}
.home-topics-bar-inner {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.home-topics-bar-inner::-webkit-scrollbar { display: none; }
.home-topics-bar-label {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-right: 1.25rem;
}
.home-topics-bar-link {
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.25rem 0;
  transition: color 0.12s;
}
.home-topics-bar-link:hover {
  color: var(--color-primary);
}
/* Thin separator between links */
.home-topics-bar-link + .home-topics-bar-link {
  margin-left: 1.1rem;
}
.home-topics-bar-link + .home-topics-bar-link::before {
  content: '';
  display: inline-block;
  width: 1px;
  height: 12px;
  background: var(--color-border);
  margin-right: 1.1rem;
  vertical-align: -1px;
}
.home-topics-bar-all {
  margin-left: auto;
  padding-left: 1.1rem;
  border-left: 1px solid var(--color-border);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
}
.home-topics-bar-all::before {
  display: none;
}

/* Homepage AI Shortcuts: 3-column grid */
@media (min-width: 900px) {
  .shortcuts-sidebar .sidebar-shortcut-list {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 1rem;
  }
  body.home-mode .shortcuts-sidebar .sidebar-shortcut-list {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
  body.home-mode .shortcuts-sidebar .sidebar-shortcut {
    font-size: 0.82rem;
    padding: 0.48rem 0.55rem;
  }
}

@media (max-width: 899.98px) {
  .home-topics-bar { display: none; }
}


/* === Split topic layout: Shortcuts + Related on top, News below == */
.topic-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  /* Topic pages: shortcuts + related top row, news below */
  .topic-layout.is-split.is-home-split {
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    grid-template-areas:
      "shortcuts related"
      "newsfeed newsfeed";
    gap: 1.25rem;
    align-items: stretch;
  }
  .topic-layout.is-home-split .panel-shortcuts,
  .topic-layout.is-home-split .panel-related { display: flex; }
  .topic-layout.is-home-split .panel-shortcuts > .sidebar-card,
  .topic-layout.is-home-split .panel-related > .sidebar-card {
    flex: 1; display: flex; flex-direction: column;
  }
  .topic-layout.is-home-split .topics-card-footer { margin-top: auto; }
  /* Custom pages: single-column (no Related). */
  .topic-layout.is-split.is-custom {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "shortcuts"
      "newsfeed";
  }

  /* Content Shortcuts on custom pages: 2-column grid like AI Shortcuts */
  .topic-layout.is-split.is-custom .panel-newsfeed .shortcuts-sidebar .sidebar-shortcut-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
  }

  .topic-layout.is-split .panel-shortcuts .sidebar-card {
    padding: 0.85rem 0.95rem;
  }

  /* Grid areas shared across all variants */
  .topic-layout.is-split .panel-shortcuts { grid-area: shortcuts; }
  .topic-layout.is-split .panel-related { grid-area: related; }
  .topic-layout.is-split .panel-newsfeed { grid-area: newsfeed; }
}

.layout-section {
  scroll-margin-top: 130px;
  margin-bottom: 2rem;
}
.layout-section:last-child {
  margin-bottom: 0;
}

.sidebar-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.sidebar-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1.5px solid #d1d5db;
}

.sidebar-card-desc {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--color-text-muted);
  letter-spacing: -0.005em;
}

.sidebar-card-icon {
  font-size: 1rem;
  opacity: 0.85;
}

.sidebar-card-title {
  font-family: var(--font-family);
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 650;
  color: #2d3748;
  flex-basis: 100%;
  letter-spacing: -0.015em;
  margin: 0;
}


/* Shortcuts list inside sidebar card */
.sidebar-group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-light);
  margin: 0.65rem 0 0.4rem;
}
.sidebar-group-label:first-child { margin-top: 0; }

.sidebar-shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

/* AI Shortcuts — flat list rows with icon + name + chevron.
   Hairline dividers between items, subtle hover highlight. */
.shortcuts-sidebar .sidebar-shortcut-list {
  gap: 0;
  margin-bottom: 0.4rem;
}
.shortcuts-sidebar .sidebar-shortcut {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  text-align: left;
  font-family: var(--font-family);
  font-size: 0.85rem;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.shortcuts-sidebar .sidebar-shortcut:hover {
  background: var(--color-bg-light, #f6f7f9);
  color: var(--color-primary);
}
.shortcuts-sidebar .sidebar-shortcut-icon {
  font-size: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
}
.shortcuts-sidebar .sidebar-shortcut-name {
  flex: 1;
  font-weight: var(--font-weight-medium);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-shortcut-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.12s;
}
.sidebar-shortcut:hover .sidebar-shortcut-dot {
  opacity: 1;
}
.sidebar-shortcut-chev {
  color: var(--color-text-light);
  font-size: 1rem;
  line-height: 1;
  opacity: 0.5;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s, color 0.15s;
}
.shortcuts-sidebar .sidebar-shortcut:hover .sidebar-shortcut-chev {
  opacity: 1;
  transform: translateX(2px);
  color: var(--color-primary);
}

/* In the wider desktop split layout, use a 2-column grid so long
   lists don't stretch too far vertically. */
@media (min-width: 900px) {
  .topic-layout.is-split .panel-shortcuts .shortcuts-sidebar .sidebar-shortcut-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
  }

}


.sidebar-shortcut {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: var(--font-family);
  font-size: 0.83rem;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-shortcut:hover {
  background: var(--color-bg-light);
  border-color: var(--color-primary-light);
}

.sidebar-shortcut-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.sidebar-shortcut-name {
  flex: 1;
  font-weight: var(--font-weight-medium);
}

/* Topics list */
.sidebar-topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Condensed related/featured list on desktop split layout:
   tighter rows, no arrow, smaller dot. */
@media (min-width: 900px) {
  .topic-layout.is-split .panel-related .sidebar-topic {
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
    gap: 0.45rem;
  }
  .topic-layout.is-split .panel-related .sidebar-topic-dot {
    width: 6px;
    height: 6px;
  }
  .topic-layout.is-split .panel-related .sidebar-topic-arrow {
    display: none;
  }
  .topic-layout.is-split .panel-related .sidebar-topic-list {
    gap: 0.25rem;
  }
}

/* Topics card "View All Topics +" CTA */

/* Overflow related items: hidden on desktop, always visible on mobile
   (tabular nav shows the full list since it's the dedicated panel). */
@media (min-width: 900px) {
  .shortcuts-sidebar .sidebar-shortcut.is-overflow-related { display: none; }
}

/* CTA links at the bottom of Topics / Related Topics cards */
.topics-card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  white-space: nowrap;
}
.topics-card-footer-link {
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -0.005em;
  padding: 0.35rem 0.7rem;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s;
}
.topics-card-footer-link:hover {
  background: var(--color-accent);
}
.topics-card-footer-link + .topics-card-footer-link {
  margin-left: 0.15rem;
  padding-left: 0.85rem;
  border-left: 1px solid var(--color-border);
  border-radius: 0 3px 3px 0;
}

/* Related Topics modal */
.related-topics-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.related-modal-card {
  position: relative;
  background: var(--color-bg);
  border-radius: 6px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  animation: modalPop 0.18s ease-out;
}
.related-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 30px;
  height: 30px;
  background: var(--color-bg-light, #f3f4f6);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.related-modal-close:hover {
  background: var(--color-bg-light);
  color: var(--color-text);
}
.related-modal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
}
.related-modal-icon { font-size: 0.95rem; opacity: 0.85; }
.related-modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  letter-spacing: -0.01em;
  margin: 0;
}
.related-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.related-modal-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.15rem;
  color: var(--color-text);
  text-decoration: none !important;
  transition: background 0.12s, color 0.12s;
}
.related-modal-row:hover {
  background: var(--color-bg-light, #f6f7f9);
  color: var(--color-primary);
}
.related-modal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.55;
  flex-shrink: 0;
}
.related-modal-row:hover .related-modal-dot { opacity: 1; }
.related-modal-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: var(--font-weight-medium);
}
.related-modal-chev {
  color: var(--color-text-light);
  font-size: 1rem;
  opacity: 0.4;
}
.related-modal-row:hover .related-modal-chev {
  opacity: 1;
  color: var(--color-primary);
}
.related-modal-footer {
  padding: 0.65rem 1.15rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-light, #f6f7f9);
  text-align: center;
}
.related-modal-all {
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  text-decoration: none;
}
.related-modal-all:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Home's "All Topics" panel — full catalog grouped by parent */
.all-topics-sidebar-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.all-topics-sidebar-group {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.85rem;
}
.all-topics-sidebar-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.all-topics-sidebar-parent {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  text-decoration: none;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.all-topics-sidebar-parent:hover { text-decoration: underline; }

.all-topics-sidebar-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
}
.all-topics-sidebar-sub {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--color-bg-light, #f4f5f7);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  font-size: 0.78rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.all-topics-sidebar-sub:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* "Featured" pill label beside the card title */
.sidebar-card-label {
  margin-left: auto;
  padding: 0.12rem 0.55rem;
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-topic {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: var(--font-weight-medium);
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-topic:hover {
  background: var(--color-bg-light);
  border-color: var(--color-primary-light);
  text-decoration: none;
}

.sidebar-topic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

.sidebar-topic-name {
  flex: 1;
}

.sidebar-topic-arrow {
  color: var(--color-text-light);
  font-size: 0.85rem;
}

.sidebar-more-note {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-style: italic;
  padding: 0.35rem 0 0;
  text-align: center;
}

.sidebar-empty {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

/* On mobile — when sections become full-width tab panels, use slightly
   wider padding so they feel like proper sections rather than compressed
   sidebar cards. Also ensure nothing clips height / introduces internal
   scroll — page scroll handles overflow naturally. */
@media (max-width: 899px) {
  .sidebar-card,
  .newsfeed-card {
    padding: 0;
    max-height: none;
    overflow: visible;
  }
  .sidebar-card-title,
  .newsfeed-card-title {
    font-size: 1.2rem;
  }
  .sidebar-shortcut-list,
  .sidebar-topic-list {
    max-height: none;
    overflow: visible;
  }
}


/* === All Topics view (homepage's "All Topics" tab) === */
.all-topics-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.all-topics-group {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1.1rem;
}

.all-topics-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.all-topics-parent {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--color-text);
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.95rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

.all-topics-parent:hover {
  text-decoration: none;
  background: var(--color-accent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.all-topics-parent:active {
  transform: translateY(1px);
}

.all-topics-parent-accent {
  width: 4px;
  height: 22px;
  background: var(--color-primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.all-topics-parent-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.015em;
  flex: 1;
}

.all-topics-parent-arrow {
  color: var(--color-text-light);
  font-size: 1rem;
  transition: color 0.15s, transform 0.15s;
}

.all-topics-parent:hover .all-topics-parent-arrow {
  color: var(--color-primary);
  transform: translate(2px, -2px);
}

.all-topics-subgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.all-topics-sub {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: var(--font-weight-medium);
  transition: background 0.15s, border-color 0.15s;
}

.all-topics-sub:hover {
  background: var(--color-bg-light);
  border-color: var(--color-primary-light);
  text-decoration: none;
}

.all-topics-note {
  margin-top: 1.5rem;
  padding: 1rem 1.15rem;
  background: var(--color-bg-light);
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.all-topics-search-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  font-family: var(--font-family);
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
  font-size: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(30, 45, 68, 0.3);
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
}

.all-topics-search-link:hover {
  text-decoration-color: var(--color-primary);
}

@media (max-width: 640px) {
  .all-topics-subgrid {
    grid-template-columns: 1fr;
  }

  .all-topics-parent-name {
    font-size: 1.05rem;
  }
}

/* === Wizard topic picker (Primary/Secondary topic step) === */
/* Multi-select topic chips row (primary/secondary topics) */
.wiz-topic-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.wiz-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem 0.4rem 0.75rem;
  background: var(--color-primary);
  color: white;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: var(--font-weight-medium);
}

.wiz-topic-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.15s;
}

.wiz-topic-chip-remove:hover {
  background: rgba(255, 255, 255, 0.35);
}

.wiz-topic-add {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.7rem;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.wiz-topic-add:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
  border-style: solid;
  color: var(--color-primary);
}

.wiz-topic-picker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.92rem;
  color: var(--color-text);
  text-align: left;
  transition: border-color 0.15s;
}

.wiz-topic-picker:hover {
  border-color: var(--color-primary);
}

.wiz-topic-picker-icon {
  color: var(--color-primary);
  font-size: 1rem;
  flex-shrink: 0;
}

.wiz-topic-picker-value {
  flex: 1;
  font-weight: var(--font-weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wiz-topic-picker-placeholder {
  color: var(--color-text-light);
  font-weight: var(--font-weight-regular);
}

.wiz-topic-picker-chevron {
  color: var(--color-text-light);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.wiz-topic-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15, 26, 46, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1rem 1rem;
  animation: search-overlay-in 0.1s ease-out;
}

.wiz-topic-overlay-card {
  background: var(--color-bg);
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 75vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  animation: search-card-in 0.12s ease-out;
}

/* New multi-select picker head + selected row + footer */
.wiz-topic-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.wiz-topic-overlay-label {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.wiz-topic-overlay-selected {
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
  max-height: 120px;
  overflow-y: auto;
}
.wiz-topic-overlay-empty {
  color: var(--color-text-light);
  font-size: 0.82rem;
}
.wiz-topic-overlay-sel {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.45rem 0.3rem 0.7rem;
  background: var(--color-primary);
  color: white;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: var(--font-weight-medium);
}
.wiz-topic-overlay-sel-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1;
}
.wiz-topic-overlay-sel-remove:hover { background: rgba(255, 255, 255, 0.35); }

.wiz-topic-overlay-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-bg-light, #f6f7f9);
}
.wiz-topic-overlay-count {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: var(--font-weight-medium);
}
.wiz-topic-overlay-done {
  padding: 0.5rem 1.25rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: var(--font-weight-semibold);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}
.wiz-topic-overlay-done:hover {
  background: var(--color-primary-dark, var(--color-primary));
}

.wiz-topic-overlay-check {
  margin-left: auto;
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
}
.wiz-topic-overlay-result.is-selected {
  background: var(--color-accent);
  color: var(--color-primary);
}
.wiz-topic-overlay-chip.is-selected {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.wiz-topic-overlay-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.wiz-topic-overlay-icon {
  font-size: 1.15rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.wiz-topic-overlay-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  font-family: var(--font-family);
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
  background: transparent;
  min-width: 0;
}

.wiz-topic-overlay-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.wiz-topic-overlay-close:hover {
  color: var(--color-text);
}

.wiz-topic-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.15rem 1.15rem;
}

.wiz-topic-overlay-group {
  margin-bottom: 1rem;
}

.wiz-topic-overlay-group:last-child {
  margin-bottom: 0;
}

.wiz-topic-overlay-group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}

.wiz-topic-overlay-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.wiz-topic-overlay-chip {
  padding: 0.32rem 0.75rem;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-family: var(--font-family);
  cursor: pointer;
  color: var(--color-text);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wiz-topic-overlay-chip:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.wiz-topic-overlay-chip-parent {
  font-weight: var(--font-weight-semibold);
  background: white;
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

.wiz-topic-overlay-result {
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wiz-topic-overlay-result:hover,
.wiz-topic-overlay-result.highlighted {
  background: var(--color-accent);
}

.wiz-topic-overlay-result-custom {
  background: var(--color-accent);
  margin-bottom: 0.5rem;
}

.wiz-topic-overlay-badge {
  background: var(--color-primary);
  color: white;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.wiz-topic-overlay-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.06em;
  margin: 0.6rem 0 0.4rem;
}

.wiz-topic-overlay-result-parent {
  color: var(--color-text-light);
  font-size: 0.78rem;
  margin-left: 0.4rem;
}

@media (max-width: 640px) {
  .wiz-topic-overlay {
    padding: 0;
    align-items: stretch;
  }
  .wiz-topic-overlay-card {
    max-width: none;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* === Knowledge Prompt Generator — Wizard Mode === */
/* Single-column prompt builder with bottom action bar */
.wiz-two-panel {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
.wiz-fields {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.wiz-intro {
  margin: 0 0 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1.5px solid #d1d5db;
}
.wiz-intro-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
}

/* Field layout */
.wiz-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.wiz-field-half { min-width: 0; }
.wiz-field-group { }

.wiz-field-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  color: #2d3748;
  margin-bottom: 0.45rem;
}
.wiz-req { color: #e53e3e; font-weight: var(--font-weight-medium); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
.wiz-opt { color: var(--color-text-light); font-weight: var(--font-weight-regular); font-size: 0.75rem; }

/* Inline topic chips */
.wiz-topic-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
}
.wiz-inline-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.35rem 0.2rem 0.55rem;
  background: var(--color-primary);
  color: white;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: var(--font-weight-medium);
}
.wiz-inline-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}
.wiz-inline-chip-x:hover { background: rgba(255,255,255,0.35); }

.wiz-topic-add-inline {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  padding: 0.2rem 0.3rem;
}
.wiz-topic-add-inline:hover { color: var(--color-primary); }

/* Clean topic rows in the prompt generator picker — no underlines or bottom borders */
.wiz-topic-picker-card .sidebar-shortcut:hover,
.wiz-topic-picker-card .wiz-topic-row:hover,
.wiz-topic-picker-card .wiz-topic-result:hover {
  text-decoration: none !important;
}
.wiz-topic-picker-card .sidebar-shortcut {
  border-bottom: none;
}
.wiz-topic-add-inline:hover { text-decoration: underline; }

/* Custom instructions textarea */
.wiz-custom-textarea {
  width: 100%;
  min-height: 70px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: var(--font-family);
  font-size: 0.84rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  color: var(--color-text);
}
.wiz-custom-textarea:focus { border-color: var(--color-primary); }

/* Action bar — sticky at bottom on all screen sizes */
.wiz-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 90;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 0.85rem 0;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.wiz-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1.25rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: background 0.12s;
}
.wiz-action-btn:hover { background: var(--color-primary-dark, #162238); }
.wiz-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.wiz-action-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.wiz-action-indicator.has-content { background: #4ade80; }

.wiz-action-restart {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wiz-action-restart:hover { color: var(--color-primary); }

@media (max-width: 1023.98px) {
  .wiz-field-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Submit modal — full experience: preview, edit, model, submit */
.wiz-submit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.wiz-submit-card {
  position: relative;
  background: var(--color-bg);
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.4);
  animation: modalPop 0.18s ease-out;
}
.wiz-submit-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  cursor: pointer;
}
.wiz-submit-close:hover { background: var(--color-bg-light); color: var(--color-text); }

.wiz-submit-section {
  margin-bottom: 1.25rem;
}
.wiz-submit-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.wiz-submit-label {
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 650;
  color: #2d3748;
  margin: 0;
}
.wiz-submit-prompt-actions {
  display: flex;
  gap: 0.35rem;
}
.wiz-submit-action-btn {
  padding: 0.25rem 0.65rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  color: var(--color-text);
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.wiz-submit-action-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

.wiz-submit-prompt-text {
  background: #f8f9fb;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--color-text);
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
}
.wiz-submit-textarea {
  width: 100%;
  min-height: 200px;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--color-primary);
  border-radius: 4px;
  font-family: var(--font-family);
  font-size: 0.88rem;
  line-height: 1.65;
  resize: vertical;
  outline: none;
  color: var(--color-text);
}
.wiz-submit-reset {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-top: 0.4rem;
  display: inline-block;
}
.wiz-submit-reset:hover { color: var(--color-primary); }

.wiz-submit-models {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.wiz-submit-model {
  padding: 0.45rem 0.85rem;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 4px;
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.wiz-submit-model:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.wiz-submit-model.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  font-weight: var(--font-weight-semibold);
}

.wiz-submit-go {
  width: 100%;
  padding: 0.75rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  margin-top: 0.25rem;
  transition: background 0.12s;
}
.wiz-submit-go:hover { background: var(--color-primary-dark, #162238); }
.wiz-submit-go:disabled { opacity: 0.4; cursor: not-allowed; }

.wiz-submit-disclaimer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--color-text-light);
  margin: 0.65rem 0 0;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .wiz-submit-card {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    padding: 1.25rem;
  }
  .wiz-submit-overlay { padding: 0; }
}

/* Topic picker: search-modal-style with multi-select checkmarks */
.wiz-topic-picker-card {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wiz-topic-picker-card .search-overlay-body {
  flex: 1;
  overflow-y: auto;
}
@media (max-width: 640px) {
  .wiz-topic-picker-card {
    max-width: none;
    height: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }
  .wiz-topic-overlay {
    padding: 0;
    align-items: stretch;
  }
}
.wiz-topic-selected-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--color-border);
  min-height: 42px;
  align-items: center;
}
.wiz-topic-selected-row:empty::after {
  content: 'No topics selected';
  color: var(--color-text-light);
  font-size: 0.8rem;
}
.wiz-topic-check {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: white;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg);
  transition: background 0.12s, border-color 0.12s;
}
.wiz-topic-row.is-selected .wiz-topic-check,
.wiz-topic-result.is-selected .wiz-topic-check {
  background: #22c55e;
  border-color: #22c55e;
}
.wiz-topic-row {
  cursor: pointer;
}
.wiz-topic-row.is-selected {
  background: var(--color-accent);
}
/* Parent rows in topic picker — clearly clickable */
.wiz-topic-picker-card .search-parent-row {
  cursor: pointer;
}
.wiz-topic-picker-card .search-parent-row:hover {
  background: #e8eaef;
}
.wiz-topic-parent-hint {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-text-light);
}
.wiz-topic-result {
  cursor: pointer;
}
.wiz-topic-result.is-selected {
  background: var(--color-accent);
}
.wiz-topic-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-light, #f6f7f9);
  position: sticky;
  bottom: 0;
  z-index: 10;
  flex-shrink: 0;
}
.wiz-topic-picker-count {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.wiz-topic-picker-done {
  padding: 0.45rem 1.1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: var(--font-weight-semibold);
  font-size: 0.85rem;
  cursor: pointer;
}
.wiz-topic-picker-done:hover { background: var(--color-primary-dark, #162238); }

/* Legacy .wiz — keep for any remaining styles */
.wiz {
  max-width: 720px;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.wiz-head {
  margin-bottom: 1.5rem;
}

.wiz-head-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.wiz-head-icon {
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.wiz-head-text {
  flex: 1;
  min-width: 0;
}

.wiz-head-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.wiz-head-step {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
  margin-top: 0.15rem;
}

/* Clickable horizontal stepper — compact numbered markers, all 8
   visible at once. Only the CURRENT step also shows its label so the
   row never overflows. The label for other steps is a hover tooltip. */
.wiz-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  padding: 0.4rem 0.1rem 0.25rem;
  width: 100%;
}

.wiz-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.3rem;
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-family);
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.wiz-step:hover:not(.is-blocked) {
  background: var(--color-bg-light);
  color: var(--color-text);
}

.wiz-step.is-blocked {
  cursor: not-allowed;
  opacity: 0.45;
}

.wiz-step-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  font-size: 0.74rem;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.wiz-step-label {
  font-weight: var(--font-weight-bold);
  font-size: 0.82rem;
  letter-spacing: -0.01em;
}

.wiz-step-sep {
  flex: 1;
  height: 3px;
  background: var(--color-border);
  margin: 0 0.2rem;
  border-radius: 2px;
  min-width: 12px;
}

/* Separator after a completed step fills with primary to show progress. */
.wiz-step.is-complete + .wiz-step-sep,
.wiz-step.is-current + .wiz-step-sep {
  background: linear-gradient(to right, var(--color-primary) 50%, var(--color-border) 50%);
}
.wiz-step.is-complete:has(+ .wiz-step-sep + .wiz-step.is-complete) + .wiz-step-sep,
.wiz-step.is-complete:has(+ .wiz-step-sep + .wiz-step.is-current) + .wiz-step-sep {
  background: var(--color-primary);
}

/* States */
.wiz-step.is-current {
  color: var(--color-primary);
  background: var(--color-accent);
  padding-right: 0.7rem;
}
.wiz-step.is-current .wiz-step-marker {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 0 0 3px white, 0 0 0 5px var(--color-primary);
}

.wiz-step.is-complete .wiz-step-marker {
  background: var(--color-primary);
  color: white;
}
.wiz-step.is-complete {
  color: var(--color-primary);
}

.wiz-step.is-visited:not(.is-current):not(.is-complete) {
  color: var(--color-text);
}
.wiz-step.is-visited:not(.is-current):not(.is-complete) .wiz-step-marker {
  background: var(--color-bg-light);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.wiz-step.is-future {
  opacity: 0.55;
}

@media (max-width: 640px) {
  .wiz-stepper {
    padding: 0.3rem 0;
  }

  .wiz-step-marker {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .wiz-step-label {
    font-size: 0.72rem;
  }

  .wiz-step.is-current {
    padding-right: 0.5rem;
  }

  .wiz-step-sep {
    min-width: 8px;
  }
}

/* Very narrow widths — hide labels for non-current steps to keep tracker compact */
@media (max-width: 440px) {
  .wiz-step:not(.is-current) .wiz-step-label {
    display: none;
  }
}

.wiz-body {
  margin-bottom: 1.25rem;
}

.wiz-step-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0 0 0.35rem;
}

.wiz-step-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 1rem;
}

.wiz-step-content {
  margin-bottom: 1rem;
}

/* Inputs */
.wiz-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
  margin-bottom: 0.55rem;
}

.wiz-required {
  color: var(--color-primary);
}

.wiz-optional {
  color: var(--color-text-light);
  font-weight: var(--font-weight-regular);
  font-size: 0.85em;
}

.wiz-input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-family);
  color: var(--color-text);
  background: white;
  transition: border-color 0.15s;
}

.wiz-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.wiz-textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: var(--font-family);
  color: var(--color-text);
  background: white;
  min-height: 90px;
  resize: vertical;
  transition: border-color 0.15s;
}

.wiz-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Popular topic chips on Step 1 */
.wiz-popular-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.wiz-popular-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-right: 0.2rem;
}

.wiz-pop-chip {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg-light);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.wiz-pop-chip:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Card grid (Content Type) */
.wiz-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.wiz-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 0.95rem;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-family);
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

.wiz-card:hover {
  border-color: var(--color-primary-light);
  background: var(--color-bg-light);
}

.wiz-card.selected {
  border-color: var(--color-primary);
  background: var(--color-accent);
}

.wiz-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.45rem;
  line-height: 1;
}

.wiz-card-label {
  font-size: 0.92rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.wiz-card.selected .wiz-card-label {
  color: var(--color-primary);
}

/* Chip grid (most steps) */
.wiz-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: -0.1rem;
}

.wiz-chip {
  padding: 0.3rem 0.65rem;
  border: 1.5px solid var(--color-border);
  background: white;
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: var(--font-family);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.wiz-chip:hover {
  border-color: var(--color-primary-light);
  background: var(--color-bg-light);
}

.wiz-chip.selected {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

/* Custom value chip (selected by default, has remove button) */
.wiz-chip.wiz-chip-custom {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding-right: 0.4rem;
}

.wiz-chip-remove {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.wiz-chip-remove:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* "+ Add custom" chip — quiet, outlined, dashed */
.wiz-chip-add {
  border-style: dashed;
  border-color: var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

.wiz-chip-add:hover {
  border-style: solid;
  border-color: var(--color-primary);
  background: var(--color-accent);
  color: var(--color-primary);
}

/* Custom card (for content type step) */
.wiz-card.wiz-card-custom {
  position: relative;
}

.wiz-card-remove {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(30, 45, 68, 0.1);
  color: var(--color-primary);
  border: none;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.wiz-card-remove:hover {
  background: var(--color-primary);
  color: white;
}

.wiz-card.wiz-card-add {
  border-style: dashed;
  border-color: var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
}

.wiz-card.wiz-card-add:hover {
  border-style: solid;
  border-color: var(--color-primary);
  background: var(--color-accent);
  color: var(--color-primary);
}

.wiz-card.wiz-card-add .wiz-card-icon,
.wiz-card.wiz-card-add .wiz-card-label {
  color: var(--color-primary);
}

/* Inline custom-input wrap (replaces the "+ Add custom" chip when clicked) */
.wiz-custom-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 2px solid var(--color-primary);
  background: white;
  border-radius: 999px;
  padding: 0.25rem 0.4rem 0.25rem 0.85rem;
}

.wiz-custom-input {
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 0.88rem;
  background: transparent;
  color: var(--color-text);
  width: 180px;
  min-width: 100px;
  padding: 0;
}

.wiz-custom-add-btn {
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family);
  cursor: pointer;
}

.wiz-custom-add-btn:hover {
  background: var(--color-primary-dark);
}

.wiz-custom-cancel-btn {
  background: none;
  color: var(--color-text-muted);
  border: none;
  padding: 0.2rem 0.4rem;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.wiz-custom-cancel-btn:hover {
  color: var(--color-text);
}

/* Extra inputs (for requiresInput options like "Compare to what?") */
.wiz-extras {
  margin-top: 0.75rem;
}

.wiz-extra-input {
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--color-accent);
  border-radius: 8px;
  border-left: 3px solid var(--color-primary);
}

.wiz-extra-input:last-child {
  margin-bottom: 0;
}

.wiz-extra-label {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.4rem;
}

.wiz-extra-context {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
  font-size: 0.85em;
}

.wiz-extra-field {
  font-size: 0.88rem !important;
  padding: 0.5rem 0.75rem !important;
}

/* Sub-sections (steps that combine multiple choices) */
.wiz-sub-section {
  margin-bottom: 1.25rem;
}

.wiz-sub-section:last-child {
  margin-bottom: 0;
}

.wiz-sub-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
  margin-bottom: 0.55rem;
}

/* Live prompt preview — neutral but with real presence */
.wiz-preview {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.wiz-preview-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.95rem;
  background: var(--color-bg-light, #f6f7f9);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: -0.005em;
}
.wiz-preview-head::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

.wiz-preview-body {
  padding: 0.85rem 0.95rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-wrap;
  background: var(--color-bg);
}

.wiz-preview-body.wiz-preview-empty {
  color: var(--color-text-light);
  font-style: italic;
}

/* Footer nav */
.wiz-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--color-border);
  position: sticky;
  bottom: 0;
  background: var(--color-bg);
  z-index: 5;
}

.wiz-foot-right {
  display: flex;
  gap: 0.5rem;
}

.wiz-btn-back,
.wiz-btn-skip,
.wiz-btn-next {
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wiz-btn-back {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.wiz-btn-back:hover:not(:disabled) {
  border-color: var(--color-primary-light);
  color: var(--color-text);
}

.wiz-btn-back:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wiz-btn-skip {
  background: transparent;
  color: var(--color-text-muted);
  border: none;
}

.wiz-btn-skip:hover {
  color: var(--color-text);
}

.wiz-btn-next {
  background: var(--color-primary);
  color: white;
  border: none;
}

.wiz-btn-next:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.wiz-btn-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Review step */
.wiz-review {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.wiz-review-section {
  display: flex;
  flex-direction: column;
}

.wiz-prompt-box {
  background: var(--color-bg-light, #f6f7f9);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1rem 1.15rem;
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 0.6rem;
  max-height: 320px;
  overflow-y: auto;
}

.wiz-prompt-edit {
  width: 100%;
  min-height: 240px;
  max-height: 420px;
  padding: 1rem 1.15rem;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1.5px solid var(--color-primary);
  border-radius: 4px;
  font-family: var(--font-family);
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  margin-bottom: 0.6rem;
}

.wiz-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.wiz-review-actions {
  display: flex;
  gap: 0.35rem;
}

.wiz-btn-inline {
  padding: 0.3rem 0.7rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.wiz-btn-inline:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.wiz-prompt-reset {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0.2rem 0;
}
.wiz-prompt-reset:hover { color: var(--color-primary); }

/* Prompt generator: step pills in the sticky subnav */
.wiz-subnav-step.tab-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.25rem;
}

/* "Preview" action in the prompt-generator subnav — opens the live
   prompt preview modal from anywhere in the wizard. */
.wiz-subnav-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.85rem;
  padding: 0.35rem 0.8rem;
  background: var(--color-accent);
  border: 1px solid var(--color-primary-light, var(--color-border));
  border-radius: 999px;
  color: var(--color-primary);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.wiz-subnav-preview:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
}
.wiz-subnav-preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-bg);
  animation: wiz-subnav-preview-pulse 2s ease-in-out infinite;
}
.wiz-subnav-preview:hover .wiz-subnav-preview-dot {
  background: white;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}
@keyframes wiz-subnav-preview-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Live prompt preview modal */
.prompt-preview-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.prompt-preview-modal-card {
  position: relative;
  background: var(--color-bg);
  border-radius: 6px;
  width: 100%;
  max-width: 620px;
  max-height: 82vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  animation: modalPop 0.18s ease-out;
}
.prompt-preview-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--color-text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.prompt-preview-modal-close:hover {
  background: var(--color-bg-light);
  color: var(--color-text);
}
.prompt-preview-modal-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-light, #f6f7f9);
}
.prompt-preview-modal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}
.prompt-preview-modal-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin: 0;
}
.prompt-preview-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--color-text);
  white-space: pre-wrap;
}
.prompt-preview-modal-body.is-empty {
  color: var(--color-text-light);
  font-style: italic;
  text-align: center;
  padding: 2rem 1.25rem;
}
.prompt-preview-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-light, #f6f7f9);
}
.prompt-preview-modal-copy {
  padding: 0.45rem 0.9rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background 0.15s;
}
.prompt-preview-modal-copy:hover {
  background: var(--color-primary-dark, var(--color-primary));
}
.prompt-preview-modal-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.wiz-subnav-step[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.wiz-subnav-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-bg-light, #f4f5f7);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: var(--font-weight-bold);
  border: 1px solid var(--color-border);
}
.wiz-subnav-step.active .wiz-subnav-num {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.wiz-subnav-step.is-complete:not(.active) .wiz-subnav-num {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.wiz-subnav-step.is-complete:not(.active) {
  color: var(--color-text);
}

.wiz-btn-secondary {
  align-self: flex-start;
  padding: 0.45rem 0.9rem;
  background: white;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  font-family: var(--font-family);
}

.wiz-btn-secondary:hover {
  border-color: var(--color-primary-light);
  color: var(--color-text);
}

.wiz-model-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.wiz-model-btn {
  padding: 0.65rem 0.5rem;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-family);
  color: var(--color-text);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.wiz-model-btn:hover {
  border-color: var(--color-primary-light);
}

.wiz-model-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-accent);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.wiz-model-tag {
  font-size: 0.7em;
  color: var(--color-text-light);
}

.wiz-warning {
  padding: 0.7rem 0.85rem;
  background: #fffbeb;
  border: 1px solid #f6e05e;
  color: #744210;
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.wiz-btn-submit {
  width: 100%;
  padding: 0.95rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  font-family: var(--font-family);
  letter-spacing: -0.01em;
  transition: background 0.15s;
}

.wiz-btn-submit:hover {
  background: var(--color-primary-dark);
}

.wiz-btn-restart {
  width: 100%;
  padding: 0.7rem;
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-family);
  text-decoration: underline;
  text-decoration-color: rgba(113, 128, 150, 0.3);
  text-underline-offset: 3px;
}

.wiz-btn-restart:hover {
  color: var(--color-primary);
}

.wiz-disclaimer {
  font-size: 0.72rem;
  color: var(--color-text-light);
  text-align: center;
  line-height: 1.5;
  margin: 0;
}

/* Mobile */
@media (max-width: 640px) {
  .wiz-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .wiz-step-title {
    font-size: 1.1rem;
  }

  .wiz-step-desc {
    font-size: 0.82rem;
    margin-bottom: 0.85rem;
  }

  .wiz-head-icon {
    width: 36px;
    height: 36px;
    font-size: 1.05rem;
  }

  .wiz-head-title {
    font-size: 1.05rem;
  }

  .wiz-model-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wiz-foot {
    padding-top: 0.7rem;
  }

  .wiz-btn-back,
  .wiz-btn-skip,
  .wiz-btn-next {
    padding: 0.55rem 0.85rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 400px) {
  .wiz-cards {
    grid-template-columns: 1fr;
  }

  .wiz-model-grid {
    grid-template-columns: 1fr;
  }
}

/* === About Page === */
.about-page {
  max-width: 700px;
}

.about-section {
  margin-bottom: 1.5rem;
}

.about-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.about-section p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--color-text);
}

.about-section ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.8;
}

.about-section li {
  margin-bottom: 0.25rem;
}

/* === Not Found === */
.not-found {
  text-align: center;
  padding: 3rem 1rem;
}

.not-found h2 {
  margin-bottom: 0.5rem;
}

/* === Typography === */
body {
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, .header-title, .footer-title, .section-header h2 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
}

.header-title {
  font-weight: var(--font-weight-bold);
}

.header-prompt-btn,
.footer-title,
.section-header h2 {
  font-weight: var(--font-weight-semibold);
}

.tab-pill,
.shortcut-name,
.related-name {
  font-weight: var(--font-weight-medium);
}

.tab-pill.active {
  font-weight: var(--font-weight-semibold);
}

.pg-btn,
.prompt-modal-submit {
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.005em;
}

.pg-label,
.prompt-modal-label,
.search-result-header,
.search-result-section-label,
.shortcuts-section-label {
  font-weight: var(--font-weight-semibold);
}

.pg-field-label {
  font-weight: var(--font-weight-medium);
}

/* === Enhanced Search Bar (prominent) === */
.search-bar {
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  font-weight: var(--font-weight-medium);
  gap: 0.7rem;
  border-radius: 8px;
  width: 100%;
}

.search-bar-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  color: var(--color-primary);
}

.search-bar-label {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.search-bar-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

/* === Prompt Generator extras === */
.pg-summary-empty {
  color: var(--color-text-light) !important;
  font-style: italic;
}

.pg-summary-error {
  color: var(--color-danger) !important;
  background: #fff5f5 !important;
  border-color: #fc8181 !important;
}

/* === Topic Banner (with integrated tabs) === */
.topic-banner {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(30, 45, 68, 0.12);
  border-radius: 0;
  margin-bottom: 1.5rem;
  padding: 0.25rem 0 1.15rem;
}

.topic-banner-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
  row-gap: 0.6rem;
}

/* TP3: subtle vertical divider between title group and tabs */
.topic-banner-row .topic-banner-tabs {
  position: relative;
  padding-left: 1.25rem;
}

.topic-banner-row .topic-banner-tabs::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 22px;
  background: var(--color-border);
}

/* Hide the divider when tabs wrap to a second line (mobile / narrow widths) */
@media (max-width: 640px) {
  .topic-banner-row .topic-banner-tabs {
    padding-left: 0;
  }
  .topic-banner-row .topic-banner-tabs::before {
    display: none;
  }
}

.topic-banner-titlegroup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 0 0 auto;
}

.topic-banner-accent {
  width: 4px;
  height: 32px;
  background: var(--color-primary);
  border-radius: 2px;
  flex-shrink: 0;
  align-self: center;
}

.topic-banner-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--color-primary);
  margin: 0;
  word-break: break-word;
}

.topic-banner-tabs {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: flex-end;
}

.topic-banner-tabs .tab-pill {
  font-size: 0.9rem;
}

.tab-content-area {
  width: 100%;
}

@media (max-width: 768px) {
  .topic-banner {
    padding: 0.15rem 0 0.85rem;
    margin-bottom: 1rem;
  }

  .topic-banner-accent {
    height: 26px;
  }

  .topic-banner-title {
    font-size: 1.4rem;
  }
}

/* === Discover / All Topics modals =========================== */
.discover-modal-overlay,
.all-topics-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.discover-modal-card,
.all-topics-modal-card {
  position: relative;
  background: var(--color-bg);
  border-radius: 6px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  animation: modalPop 0.18s ease-out;
}

.all-topics-modal-card { max-width: 560px; }

@media (max-width: 640px) {
  .discover-modal-card,
  .all-topics-modal-card {
    max-width: none;
    max-height: 85vh;
    border-radius: 10px 10px 0 0;
    padding: 1.15rem;
    animation: none;
    align-self: flex-end;
  }
  .discover-modal-overlay,
  .all-topics-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .discover-modal-card .sidebar-card-title {
    font-size: 1.1rem;
  }
  .discover-modal-card .discover-modal-sub {
    font-size: 0.75rem;
    margin-bottom: 0.65rem;
  }
}

@keyframes modalPop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.discover-modal-close,
.all-topics-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 30px;
  height: 30px;
  background: var(--color-bg-light, #f3f4f6);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.discover-modal-close:hover,
.all-topics-modal-close:hover {
  background: var(--color-bg-light);
  color: var(--color-text);
}

.discover-modal-header,
.all-topics-modal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--color-border);
}

.discover-modal-header-icon,
.all-topics-modal-header-icon {
  font-size: 0.95rem;
  opacity: 0.85;
}

.discover-modal-title,
.all-topics-modal-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.discover-modal-sub {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0 0 0.9rem;
}
.discover-modal-sub strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.discover-modal-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
@media (max-width: 480px) {
  .discover-modal-list { grid-template-columns: 1fr; }
}

.discover-modal-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.discover-modal-row:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.discover-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.discover-modal-name {
  flex: 1;
  font-weight: var(--font-weight-medium);
  font-size: 0.82rem;
  min-width: 0;
  letter-spacing: -0.005em;
}

.discover-modal-arrow {
  color: var(--color-text-light);
  font-size: 0.78rem;
  transition: color 0.15s, transform 0.15s;
}

.discover-modal-row:hover .discover-modal-arrow {
  color: var(--color-primary);
  transform: translate(2px, -2px);
}

/* All Topics modal body */
/* All Topics modal — flat list matching AI Shortcuts / Related style */
.all-topics-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.all-topics-modal-group {
  margin-bottom: 0;
}
.all-topics-modal-body {
  padding: 0;
  gap: 0;
}

/* Parent topic: section header with left accent bar — reads as a
   category label, clearly distinct from the subtopic list items. */
/* Subtopic container */
.all-topics-modal-subs {
  display: flex;
  flex-direction: column;
}

/* Shared: parent topic rows in modals + search */
.all-topics-modal-parent.sidebar-shortcut,
.search-parent-row.sidebar-shortcut {
  background: #f0f1f4;
  border-bottom: none;
  border-radius: 0;
  padding: 0.65rem 0.85rem;
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--color-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none !important;
}
.all-topics-modal-group:first-child .all-topics-modal-parent.sidebar-shortcut,
.search-overlay-group:first-child .search-parent-row.sidebar-shortcut {
  margin-top: 0;
}
.all-topics-modal-parent.sidebar-shortcut:hover,
.search-parent-row.sidebar-shortcut:hover {
  background: #e6e8ed;
  color: var(--color-primary);
}
.all-topics-modal-parent.sidebar-shortcut .sidebar-shortcut-chev,
.search-parent-row.sidebar-shortcut .sidebar-shortcut-chev {
  opacity: 0.35;
  font-size: 0.85rem;
}
.all-topics-modal-parent.sidebar-shortcut:hover .sidebar-shortcut-chev,
.search-parent-row.sidebar-shortcut:hover .sidebar-shortcut-chev {
  opacity: 0.8;
  color: var(--color-primary);
}
.all-topics-modal-parent.sidebar-shortcut .sidebar-shortcut-name,
.search-parent-row.sidebar-shortcut .sidebar-shortcut-name {
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Shared: subtopic rows in modals + search */
.all-topics-modal-sub.sidebar-shortcut,
.search-subtopic-row.sidebar-shortcut {
  padding-left: 1.5rem;
  font-size: 0.84rem;
  font-weight: var(--font-weight-medium);
  text-decoration: none !important;
}

/* Bottom breathing room after each subtopic group before the next parent */
.all-topics-modal-subs,
.search-subtopic-list {
  margin-bottom: 0.35rem;
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: none !important;
}

.search-subtopic-list:last-child,
.all-topics-modal-subs:last-child {
  margin-bottom: 0;
}

/* Subtle "View all topics" link in Featured Topics card */
.sidebar-view-all-topics {
  display: inline-block;
  margin-top: 0.65rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-link, #2563eb);
  font-size: 0.78rem;
  font-weight: var(--font-weight-medium);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.sidebar-view-all-topics:hover {
  color: var(--color-primary);
  text-decoration-thickness: 2px;
}
