/* ============================================================
   shared.css — global chrome shared by every member-area page.

   Owns:
     · responsive design tokens (--page-padding-*, --content-max, etc.)
     · the left sidebar (.sidebar-nav and its full class family)
     · the mobile hamburger + slide-out drawer (≤900px)
     · the curiosity / upsell pop-up (.popup-* family)
     · a couple of utility classes (.scroll-locked, .hidden)

   Loaded by partials/head.php BEFORE each page's own inline <style>.
   Inline page styles take precedence for page-specific layout; this
   file deliberately scopes its overrides under body.has-mobile-nav
   so mobile-drawer behavior beats the per-page `.main { margin-left:
   var(--sidebar-width) }` rule via specificity, without touching the
   shared --sidebar-width token (which pages re-declare anyway).
   ============================================================ */


/* ============================================================
   CROSS-DOCUMENT VIEW TRANSITIONS
   Opt-in to the Cross-Document View Transitions API so same-origin
   MPA navigations (dashboard → /resources/proven-niches?lockdrop=bump,
   then onward through the chain) cross-fade instead of cutting hard
   to white during the browser's paint gap. Bridges the visual seam
   even when the destination page is still rendering — the OLD page's
   snapshot stays on screen until the new one is ready.

   - `navigation: auto` enables the transition for every same-origin
     same-document navigation. The browser handles the cross-fade.
   - Custom timing keeps it short so it doesn't compete with the
     compressed celebration animations (which run ~280ms total).
   - Honors prefers-reduced-motion: the spec says the browser
     auto-disables view transitions when the user has reduced motion
     on, so we don't have to gate it ourselves.

   Browser support (May 2026): Chromium 126+, Safari 18+ (recent),
   Firefox is still flagged. Unsupported browsers ignore @view-transition
   entirely — no fallback work needed, navigation just cuts as before.
   ============================================================ */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* During the cross-fade, the OLD page is displayed for a moment. We
   want it to fade OUT cleanly while the new one fades IN, so they
   don't visually stack at full opacity. The defaults already do this
   but tighten the keyframes a touch so the perceived transition is
   tighter than the 250ms default. */
::view-transition-old(root) {
  animation-name: vt-fade-out;
}
::view-transition-new(root) {
  animation-name: vt-fade-in;
}
@keyframes vt-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes vt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ============================================================
   DESIGN TOKENS — colors, fonts, spacing, layout.
   Defined site-wide here so every page inherits identical
   values. Dashboard.php duplicates the color/font block in its
   own :root for historical reasons; that's harmless (same
   values overriding themselves). Other pages reference these
   vars (var(--g), var(--card-border), etc.) and rely on this
   file to define them.
   ============================================================ */
:root {
  /* Backgrounds */
  --bg:             #141820;
  --bg2:            #1A1F2B;
  --bg3:            #1F2535;
  --bg4:            #262D3D;
  --card-bg:        #1C2230;
  --card-border:    #2A3040;
  --sidebar-bg:     #0F131B;
  --sidebar-border: #1F2535;

  /* Greens (primary CTA, success) */
  --g:  #22C55E;
  --gl: #4ADE80;
  --gd: #15803D;
  --ga: rgba(34, 197, 94, 0.07);

  /* Gold (premium / headline highlights) */
  --gold:        #D4A843;
  --gold-bright: #F5C842;

  /* Warnings */
  --red:   #C0392B;
  --coral: #EF5350;

  /* Text scale (brightest → dimmest) */
  --w:  #FFFFFF;
  --t0: #E8E8E8;
  --t1: #C8CDD6;
  --t2: #8A95A8;
  --t3: #5C6678;

  /* Typography */
  --serif: 'Playfair Display', Georgia, serif;
  --sans:  'Figtree', system-ui, sans-serif;
  --mono:  'IBM Plex Mono', monospace;

  /* Layout */
  --sidebar-width: 248px;
  --content-max:   1320px;

  --page-padding-top:    48px;
  --page-padding-x:      40px;
  --page-padding-bottom: 80px;
}


/* ============================================================
   PRELOAD GUARD
   While <html> has .preload, no element animates or transitions.
   head.php adds the class before the first paint; footer.php
   removes it after DOMContentLoaded + a double rAF, which gives
   page JS time to apply its conditional classes (hide/show cards,
   collapse modules) without the user seeing intermediate states.
   After removal, transitions resume for user-triggered interactions
   (toggling a module, opening the upsell pop-up, etc.).
   ============================================================ */
html.preload,
html.preload *,
html.preload *::before,
html.preload *::after {
  transition: none !important;
  animation-duration: 0.001s !important;
  animation-delay: 0s !important;
}


/* ============================================================
   UNIVERSAL RESET + BASE
   Same shape dashboard.php declares inline so course/lesson/
   account/support/upgrade pages get the same baseline.
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--t1);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

@media (max-width: 1180px) {
  :root {
    --page-padding-x: 32px;
  }
}

@media (max-width: 900px) {
  :root {
    --page-padding-top: 78px;       /* clears the 56px hamburger + gap */
    --page-padding-x: 22px;
    --page-padding-bottom: 56px;
  }
}

@media (max-width: 520px) {
  :root {
    --page-padding-x: 16px;
    --page-padding-bottom: 44px;
  }
}


/* ============================================================
   LEFT SIDEBAR — desktop default
   Color tokens (--sidebar-bg, --t1, etc.) are defined per-page in
   their own :root; we fall back to literals for safety.
   ============================================================ */
.sidebar-nav {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: 248px;
  background: var(--sidebar-bg, #0F131B);
  border-right: 1px solid var(--sidebar-border, #1F2535);
  display: flex;
  flex-direction: column;
  padding: 24px 14px 18px;
  z-index: 60;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sb-logo {
  padding: 8px 16px 20px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--sidebar-border, #1F2535);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sb-logo a {
  display: block;
  width: 100%;
}
.sb-logo img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.sb-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Scroll when content exceeds the available height — happens when a
     buyer owns U1 + U2 (extra Specializations entries) AND Resources +
     Tools groups are both expanded. Without this, content visually
     overlaps the .sb-footer which is pinned to the bottom via
     margin-top: auto. overscroll-behavior: contain prevents the page
     behind from scrolling when the sidebar reaches its end. */
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Thin scrollbar that matches the dark theme */
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border, #1F2535) transparent;
}
.sb-body::-webkit-scrollbar { width: 6px; }
.sb-body::-webkit-scrollbar-track { background: transparent; }
.sb-body::-webkit-scrollbar-thumb {
  background: var(--sidebar-border, #1F2535);
  border-radius: 3px;
}
.sb-body::-webkit-scrollbar-thumb:hover { background: var(--t3, #5C6678); }

.sb-section-label {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--t3, #5C6678);
  font-weight: 600;
  padding: 16px 12px 6px;
}

/* Base nav row — used by .sb-item directly, and visually paired with .sb-sub */
.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--t1, #C8CDD6);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.sb-item .sb-icon {
  width: 22px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--t2, #8A95A8);
  line-height: 1;
}

@media (hover: hover) {
  .sb-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--w, #fff);
  }
  .sb-item:hover .sb-icon { color: var(--t0, #E8E8E8); }
}

.sb-item.active {
  background: rgba(34, 197, 94, 0.08);
  color: var(--w, #fff);
}
.sb-item.active .sb-icon { color: var(--g, #22C55E); }
.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--g, #22C55E);
  border-radius: 0 2px 2px 0;
}

/* Collapsible group (Resources, Tools) */
.sb-group { margin-top: 2px; }

.sb-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--t1, #C8CDD6);
  font-size: 14px;
  font-weight: 500;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}
@media (hover: hover) {
  .sb-group-head:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--w, #fff);
  }
}

.sb-group-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.sb-group-icon {
  width: 22px;
  display: inline-flex;
  justify-content: center;
  font-size: 16px;
  color: var(--t2, #8A95A8);
}

.chev {
  font-size: 11px;
  color: var(--t3, #5C6678);
  transition: transform 0.2s ease;
}
.sb-group.collapsed .chev { transform: rotate(-90deg); }

.sb-group-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  /* padding-left: 34px aligns sub-item text with the parent header text.
     The group head's text sits at 14 (nav pad) + 12 (head pad) + 22 (icon)
     + 12 (gap) = 60px from the sidebar's left edge. Sub-items have their
     own 12px padding-left, so 34 + 12 = 46px... wait, no — sub-items have
     no icon, so their text starts at 14 (nav pad) + 34 (this) + 12 (sb-sub
     pad) = 60px. Matches the header. Was 24px which produced 50px — the
     reason the user saw sub-items appearing LEFT of their parent label. */
  padding: 4px 0 6px 34px;
  overflow: hidden;
  max-height: 800px;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
}
.sb-group.collapsed .sb-group-items {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Sub item under a group */
.sb-sub {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 6px;
  color: var(--t2, #8A95A8);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.sb-sub .sub-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (hover: hover) {
  .sb-sub:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--w, #fff);
  }
}
.sb-sub.active {
  background: rgba(34, 197, 94, 0.08);
  color: var(--w, #fff);
}

/* Bump entry (Proven Niches) — locked vs owned swap */
.sb-sub-bump .sb-bump-lock,
.sb-sub-bump .sb-bump-check {
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold, #D4A843);
}
.sb-sub-bump .sb-bump-lock svg,
.sb-sub-bump .sb-bump-check svg {
  width: 100%;
  height: 100%;
  display: block;
}
.sb-sub-bump .sb-bump-check {
  display: none;
  color: var(--g, #22C55E);
}
.sb-sub-bump.is-owned .sb-bump-lock { display: none; }
.sb-sub-bump.is-owned .sb-bump-check { display: inline-flex; }

/* Specialization entries (U1 / U2) — premium gold treatment.
   Layout: [diamond icon] [Name] ............ [check ✓]
   The diamond is the row's icon (like Dashboard's home icon, Course's
   grid icon) so the row aligns with Dashboard/Course in the top-level
   text column. When the row is owned, a green check appears on the
   far right; the diamond stays as the visual identity, just shifts
   color from gold → green to mark "owned premium content."

   DOM order is [diamond, check, text] — flex `order` reorders visually
   to [diamond, text, check] without touching the markup (celebration JS
   relies on the existing structure). */
.sb-item-specialization {
  color: var(--gold-bright, #F5C842);
  /* No extra padding — inherits sb-item's `padding: 9px 12px` so the
     text column aligns with Dashboard/Course (icon-left, text-after). */
}
.sb-item-specialization .sb-icon {
  color: var(--gold, #D4A843);
  order: 1; /* visually first — leftmost icon, like other sb-item icons */
}
.sb-item-specialization > span:last-child {
  /* The text span ("DFY Funnel Kit") — visually second, immediately
     after the icon, with the parent's gap: 12px between them. Matches
     the [icon][text] pairing of Dashboard / Course / Account. */
  order: 2;
}

@media (hover: hover) {
  .sb-item-specialization:hover {
    background: rgba(212, 168, 67, 0.08);
    color: var(--w, #fff);
  }
  /* Brighten the diamond on hover ONLY when the row isn't owned — once
     owned, the icon is green (var(--g)) and shouldn't snap back to gold
     when the user mouses over. */
  .sb-item-specialization:not(.is-owned):hover .sb-icon {
    color: var(--gold-bright, #F5C842);
  }
}

.sb-item-specialization .sb-spec-check {
  width: 14px;
  height: 14px;
  display: none;
  color: var(--g, #22C55E);
  /* Sits tight against the name (just the parent's gap: 12px between
     them) — same close pairing as "Proven Niches ✓". No margin-left:
     auto, because that pushed the check to the row's far edge and
     made the "Name … ✓" gap read as disconnected. */
  order: 3;
}
.sb-item-specialization .sb-spec-check svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Owned state — text shifts gold → green to match the diamond + check,
   so the whole row reads in one color theme: "owned premium." Locked
   rows stay gold (premium tier hint); owned rows go green (ownership
   confirmation). Transition keeps the celebration moment smooth. */
.sb-item-specialization.is-owned {
  color: var(--g, #22C55E);
  transition: color 0.25s ease-out;
}
.sb-item-specialization.is-owned .sb-icon {
  color: var(--g, #22C55E);
  transition: color 0.25s ease-out;
}
.sb-item-specialization.is-owned .sb-spec-check {
  display: inline-flex;
  /* Bouncy pop-in when ownership flips on. Mirrors the bump's check
     reveal animation in resources/proven-niches.php — keeps the
     celebration visual language consistent across all three unlocks. */
  animation: specCheckReveal 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: center;
}
@keyframes specCheckReveal {
  0%   { opacity: 0; transform: scale(0.35); }
  60%  { opacity: 1; transform: scale(1.18); }
  100% { opacity: 1; transform: scale(1); }
}
/* Reduced-motion respect — no animation, just instant display. */
@media (prefers-reduced-motion: reduce) {
  .sb-item-specialization.is-owned .sb-spec-check { animation: none; }
  .sb-item-specialization.is-owned .sb-icon { transition: none; }
}

/* Bottom-anchored items (Account, Support, Sign-out) */
.sb-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-border, #1F2535);
}
.sb-item-logout { color: var(--coral, #EF5350); }
.sb-item-logout .sb-icon { color: var(--coral, #EF5350); }
@media (hover: hover) {
  .sb-item-logout:hover {
    background: rgba(239, 83, 80, 0.08);
    color: var(--w, #fff);
  }
  .sb-item-logout:hover .sb-icon { color: var(--coral, #EF5350); }
}

/* ------------------------------------------------------------------
   Profile menu — single bottom row (avatar + name) that opens a
   popover with Account / Support / Sign out. Replaces the old 3-row
   footer so the Specializations entries (esp. The Ad Vault) aren't
   pushed into the scroll-clipped zone on shorter viewports.
   ------------------------------------------------------------------ */
.sb-profile { position: relative; }

.sb-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--t1, #C7CBD4);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}
@media (hover: hover) {
  .sb-profile-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--sidebar-border, #1F2535);
  }
}
.sb-profile.open .sb-profile-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--sidebar-border, #1F2535);
}

.sb-avatar {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.14);
  color: var(--g, #22C55E);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}

.sb-profile-id {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.sb-profile-name {
  color: var(--w, #fff);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-profile-email {
  color: var(--t3, #5C6678);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-profile-chev {
  flex: 0 0 auto;
  color: var(--t3, #5C6678);
  font-size: 11px;
  transition: transform 0.18s ease;
}
.sb-profile.open .sb-profile-chev { transform: rotate(180deg); }

.sb-profile-menu {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% + 8px);
  background: var(--sidebar-bg, #0F131B);
  /* Subtle lift over the rail (theme-agnostic — works in light + dark). */
  background-image: linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--sidebar-border, #1F2535);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 70;
  display: none;
}
.sb-profile.open .sb-profile-menu { display: block; }
.sb-profile-menu .sb-item { border-radius: 8px; }

/* ===== Pending sidebar entries (Tools section) =====
   Rows rendered as <span> instead of <a> so they don't navigate. The
   "Soon" pill on the right tells the buyer the feature is real but not
   yet shipped, matching the same honest-pending UX used on the kit-page
   downloads (.download-row.is-pending). */
.sb-sub-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 36px;
  font-size: 13.5px;
  color: var(--t3, #8A95A8);
  cursor: default;
  opacity: 0.72;
  user-select: none;
}
.sb-sub-pending .sub-label { flex: 1; min-width: 0; }
.sb-sub-pill {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t2, #9CA3AF);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border, #1F2535);
}

/* "Nope, locked" shake — JS adds .is-shaking for ~260ms on locked-row click */
@keyframes sb-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-3px); }
  40%      { transform: translateX(3px); }
  60%      { transform: translateX(-2px); }
  80%      { transform: translateX(2px); }
}
.sb-sub.is-shaking,
.sb-item.is-shaking { animation: sb-shake 0.26s ease; }


/* ============================================================
   MOBILE HAMBURGER + DRAWER (≤900px)
   The button and overlay are in the DOM at all viewport sizes
   (emitted by sidebar.php) — hidden on desktop, shown only when
   the body opts in via .has-mobile-nav.
   ============================================================ */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--sidebar-bg, #0F131B);
  border: 1px solid var(--sidebar-border, #1F2535);
  color: var(--t0, #E8E8E8);
  z-index: 70;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}
@media (hover: hover) {
  .mobile-menu-btn:hover {
    background: var(--bg2, #1A1F2B);
    border-color: rgba(255, 255, 255, 0.12);
  }
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 18, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 55;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.mobile-overlay.show { opacity: 1; }

@media (max-width: 900px) {
  /* Reveal the chrome only on pages that opted in */
  body.has-mobile-nav .mobile-menu-btn { display: inline-flex; }
  body.has-mobile-nav .mobile-overlay   { display: block; }

  /* Sidebar becomes a slide-out drawer */
  body.has-mobile-nav .sidebar-nav {
    width: 284px;
    max-width: 86vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  }
  body.has-mobile-nav .sidebar-nav.mobile-open {
    transform: translateX(0);
  }

  /* Collapse the desktop sidebar gutter so content fills the viewport.
     Pages set `.main { margin-left: var(--sidebar-width) }` (or the
     same on .main-wrap) outside any media query — this override wins
     by adding body-class specificity. */
  body.has-mobile-nav .main,
  body.has-mobile-nav .main-wrap {
    margin-left: 0 !important;
  }
}


/* ============================================================
   BODY UTILITY STATES
   ============================================================ */

/* Safety net: prevent horizontal scroll on mobile when a wide
   inline element (long card, blockquote, video iframe) would
   push the viewport. Dashboard already sets this; do it
   site-wide so course/lesson/resources pages get the same
   guarantee without each having to remember. */
body { overflow-x: hidden; }

body.scroll-locked { overflow: hidden; }

.hidden { display: none !important; }

/* ============================================================
   PRESSED FEEDBACK
   When the user submits a form by pressing Enter (rather than
   clicking the button), we add `.is-pressed` to the relevant
   button so they get a "your tap registered" visual confirmation
   before the page navigates / the fetch fires. Mimics the
   browser's natural :active state via a quick scale-down +
   brightness dip. Removed by JS or by the page reload after
   submit.
   ============================================================ */
.is-pressed {
  transform: scale(0.96) !important;
  filter: brightness(0.92) !important;
  transition: transform 0.06s ease, filter 0.06s ease !important;
}


/* ============================================================
   UPSELL CURIOSITY POP-UP
   Markup lives in partials/upsell-popup.php (auto-included via
   footer.php). JS in /js/upsell-popup.js opens it by removing
   [hidden] then adding .is-open for the fade/scale-in.
   ============================================================ */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 18, 0.74);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.popup-overlay[hidden] { display: none; }
.popup-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.popup-card {
  background: var(--card-bg, #1C2230);
  border: 1px solid var(--card-border, #2A3040);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 36px 32px 28px;
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.popup-overlay.is-open .popup-card {
  transform: translateY(0) scale(1);
}

.popup-close-x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--t2, #8A95A8);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.popup-close-x svg {
  width: 16px;
  height: 16px;
}
@media (hover: hover) {
  .popup-close-x:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--w, #fff);
  }
}

.popup-eyebrow {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright, #F5C842);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.popup-eyebrow .dot {
  width: 7px;
  height: 7px;
  background: var(--gold-bright, #F5C842);
  border-radius: 50%;
}

.popup-title {
  font-family: var(--serif, 'Playfair Display', Georgia, serif);
  font-size: clamp(24px, 4.6vw, 32px);
  font-weight: 600;
  color: var(--w, #fff);
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 14px;
}
.popup-title em {
  font-style: italic;
  color: var(--gold-bright, #F5C842);
}

.popup-what {
  color: var(--t1, #C8CDD6);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 20px;
}

.popup-problem {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--card-border, #2A3040);
  border-radius: 10px;
  padding: 14px 18px 16px;
  margin-bottom: 22px;
}
.popup-problem-label {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--t2, #8A95A8);
  font-weight: 600;
  margin-bottom: 10px;
}
.popup-problem-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.popup-problem-list li {
  color: var(--t1, #C8CDD6);
  font-size: 14px;
  line-height: 1.5;
  padding-left: 18px;
  position: relative;
}
.popup-problem-list li::before {
  content: '–';
  position: absolute;
  left: 4px;
  top: 0;
  color: var(--gold, #D4A843);
}

.popup-price {
  text-align: center;
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  color: var(--t2, #8A95A8);
  font-size: 12.5px;
  margin-bottom: 22px;
  letter-spacing: 0.04em;
}
.popup-price .amount {
  color: var(--w, #fff);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
}
.popup-price .sep {
  margin: 0 10px;
  opacity: 0.5;
}

.popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 9px;
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}
.popup-btn-close {
  background: transparent;
  color: var(--t1, #C8CDD6);
  border-color: var(--card-border, #2A3040);
}
.popup-btn-buy {
  background: var(--gold, #D4A843);
  color: #0F131B;
  border-color: var(--gold, #D4A843);
}
.popup-btn-buy .arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}
@media (hover: hover) {
  .popup-btn-close:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--w, #fff);
    border-color: rgba(255, 255, 255, 0.18);
  }
  .popup-btn-buy:hover {
    background: var(--gold-bright, #F5C842);
    border-color: var(--gold-bright, #F5C842);
  }
  .popup-btn-buy:hover .arrow { transform: translateX(3px); }
}

@media (max-width: 480px) {
  .popup-overlay { padding: 12px; }
  .popup-card {
    padding: 28px 22px 22px;
    max-height: calc(100vh - 24px);
  }
  .popup-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .popup-btn-close { order: 2; }
  .popup-btn-buy   { order: 1; }
}


/* ============================================================
   WELCOME TUTORIAL — first-login spotlight tour.
   Markup in partials/welcome-tutorial.php, JS in
   /js/welcome-tutorial.js. Auto-fires on dashboard for users
   without the localStorage seen-flag.

   The full spotlight choreography (animated mask hole + ring
   that glide between targets) is driven by JS; we just need
   the chrome — backdrop, the centered welcome card for step 0,
   and the tooltip for steps 1-3.
   ============================================================ */
.tutorial-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.tutorial-root.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

.tutorial-mask-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.tutorial-ring {
  fill: none;
  stroke: rgba(34, 197, 94, 0.6);
  stroke-width: 2;
  pointer-events: none;
}
.tutorial-block {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

/* Step 0 — centered welcome card (only visible when root has .is-step-0) */
.welcome-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px));
  background: var(--card-bg, #1C2230);
  border: 1px solid var(--card-border, #2A3040);
  border-radius: 14px;
  padding: 36px 32px 28px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  display: none;
}
.tutorial-root.is-step-0 .welcome-card { display: block; }

.welcome-mark {
  display: inline-flex;
  gap: 5px;
  margin-bottom: 18px;
}
.welcome-mark span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g, #22C55E);
}
.welcome-mark span:nth-child(2) { background: var(--gold, #D4A843); }
.welcome-mark span:nth-child(3) { background: var(--coral, #EF5350); }

.welcome-eyebrow {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--t2, #8A95A8);
  font-weight: 600;
  margin-bottom: 12px;
}
.welcome-title {
  font-family: var(--serif, 'Playfair Display', Georgia, serif);
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 600;
  color: var(--w, #fff);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 14px;
}
.welcome-title em {
  font-style: italic;
  color: var(--gold-bright, #F5C842);
}
.welcome-body {
  color: var(--t1, #C8CDD6);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 22px;
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

/* Steps 1-3 — spotlight tooltip. JS sets inline top/left to track
   the spotlight target; we just give it the chrome. */
.tutorial-tooltip {
  position: absolute;
  width: min(360px, calc(100vw - 32px));
  background: var(--card-bg, #1C2230);
  border: 1px solid var(--card-border, #2A3040);
  border-radius: 12px;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: none;
}
.tutorial-root:not(.is-step-0) .tutorial-tooltip { display: block; }

.tt-x {
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 6px;
  color: var(--t2, #8A95A8);
  font-size: 14px;
  background: transparent;
}
@media (hover: hover) {
  .tt-x:hover { background: rgba(255,255,255,0.06); color: var(--w, #fff); }
}

.tt-eyebrow {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright, #F5C842);
  font-weight: 600;
  margin-bottom: 10px;
}
.tt-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.tt-title {
  font-family: var(--serif, 'Playfair Display', Georgia, serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--w, #fff);
  line-height: 1.2;
}
.tt-step-counter {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 11px;
  color: var(--t3, #5C6678);
  letter-spacing: 0.08em;
}
.tt-body {
  color: var(--t1, #C8CDD6);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 16px;
}
.tt-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.tt-actions-left { display: flex; gap: 8px; }
.tt-progress {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  justify-content: center;
}
.tt-pip {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
}
.tt-pip.is-active { background: var(--g, #22C55E); }
.tt-pip.is-done   { background: rgba(34, 197, 94, 0.4); }

/* Shared button family used inside the tutorial */
.tt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tt-btn-primary {
  background: var(--g, #22C55E);
  color: #0F131B;
  border-color: var(--g, #22C55E);
}
.tt-btn-ghost,
.tt-btn-back {
  background: transparent;
  color: var(--t1, #C8CDD6);
  border-color: var(--card-border, #2A3040);
}
@media (hover: hover) {
  .tt-btn-primary:hover {
    background: var(--gl, #4ADE80);
    border-color: var(--gl, #4ADE80);
  }
  .tt-btn-ghost:hover,
  .tt-btn-back:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--w, #fff);
    border-color: rgba(255, 255, 255, 0.18);
  }
}
.tt-btn .arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}
@media (hover: hover) {
  .tt-btn-primary:hover .arrow { transform: translateX(2px); }
}

/* Phone: pin the tooltip to the bottom edge instead of trying to
   anchor to a spotlight — small viewports don't have room for both. */
@media (max-width: 600px) {
  .tutorial-tooltip {
    top: auto !important;
    left: 50% !important;
    bottom: 16px;
    transform: translateX(-50%);
  }
  .welcome-card { padding: 28px 22px 22px; }
}
