/* ============================================================
   APEX MARKET MENTOR & ADVISER — Course modules and sector reports
   ============================================================
   One design for every module and report, whatever the source
   looked like. The HTML is built by tools/build-courses.py and
   served by the API; the cards are on the academy pages.
   Loaded after styles.css and heritage.css.

     .cx-tile    a locked (or, for admins, open) card on a page
     .cx-deck    a module: dark green slides, one at a time
     .cx-report  a sector report: a long document on paper
   ============================================================ */

/* ---------- Cards on the academy pages ---------- */
.cx-groups { display: grid; gap: 56px; }
.cx-group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 24px; border-bottom: 1px solid var(--hx-rule); }
.cx-group__head h3 { margin: 0; font-family: var(--hx-serif); font-weight: 500; font-size: clamp(1.6rem, 2.6vw, 2rem); color: var(--hx-green); }
.cx-group__head p { margin: 0; font-size: 0.78rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--hx-gold-ink); }

.cx-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.cx-tiles--compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.cx-tile {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--hx-paper); border: 1px solid var(--hx-rule);
  box-shadow: 0 18px 40px -32px rgba(3, 42, 29, .55);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.cx-tile:hover { transform: translateY(-2px); border-color: var(--hx-gold); box-shadow: 0 24px 46px -30px rgba(3, 42, 29, .6); }
.cx-tile__top { position: relative; z-index: 1; padding: 22px 22px 14px; display: grid; gap: 8px; }
.cx-tile__kicker { margin: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 0.72rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--hx-gold-ink); }
.cx-tile__kicker span { font-family: var(--hx-serif); font-size: 2rem; font-weight: 500; letter-spacing: 0; line-height: .8; color: var(--hx-gold); }
.cx-tile__title { margin: 0; font-family: var(--hx-serif); font-weight: 600; font-size: 1.4rem; line-height: 1.15; color: var(--hx-green); }
.cx-tiles--compact .cx-tile__title { font-size: 1.25rem; }
.cx-tile__summary { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--hx-ink-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cx-tiles--compact .cx-tile__summary { -webkit-line-clamp: 2; }
.cx-tile__meta { margin: 0; font-size: 0.78rem; color: var(--hx-ink-muted); letter-spacing: .02em; }

/* The lower half: a blurred stand-in for the content (decoration only —
   no course text is in the page) under a lock. */
.cx-tile__veil {
  position: relative; flex: 1; min-height: 120px; margin-top: auto; padding: 18px 22px;
  display: grid; align-content: start; gap: 10px;
  background: var(--hx-green) linear-gradient(160deg, rgba(10, 74, 51, .9), rgba(2, 31, 21, .2));
  filter: blur(5px); transform: scale(1.06); transform-origin: top;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 38%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 38%);
}
.cx-tile__veil span { display: block; height: 9px; background: rgba(220, 183, 101, .55); }
.cx-tile__veil span:nth-child(1) { width: 62%; height: 14px; background: rgba(247, 242, 230, .75); }
.cx-tile__veil span:nth-child(2) { width: 88%; }
.cx-tile__veil span:nth-child(3) { width: 74%; }
.cx-tile__veil span:nth-child(4) { width: 46%; }
.cx-tile__lock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px 18px; }
.cx-tile__badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; background: rgba(2, 31, 21, .82); border: 1px solid rgba(220, 183, 101, .55); color: var(--hx-gold-bright); font-size: 0.72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; backdrop-filter: blur(4px); }
.cx-tile__badge svg { width: 14px; height: 14px; }
.cx-tile__open { display: none; padding: 8px 16px; background: var(--hx-gold-bright); color: var(--hx-green); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.cx-tile__open:hover, .cx-tile__open:focus-visible { background: #f0d481; }
/* Admins: the card opens. */
.cx-tile.is-open .cx-tile__open { display: inline-block; }
.cx-tile.is-open .cx-tile__badge { color: var(--hx-on-dark); border-color: rgba(247, 242, 230, .35); }
.cx-tile.is-open .cx-tile__open::after { content: ''; position: absolute; inset: 0; }
.cx-groups__note { margin: -24px 0 0; font-size: 0.9rem; color: var(--hx-ink-muted); }

/* The client's package, and under each section what unlocks it */
.cx-package { justify-self: start; margin: 0 0 -24px; padding: 10px 18px; background: var(--hx-paper); border: 1px solid var(--hx-rule); border-left: 3px solid var(--hx-gold); font-size: 0.95rem; color: var(--hx-ink); }
.cx-package strong { color: var(--hx-green); }
.cx-package a, .cx-access a { color: var(--hx-gold-ink); font-weight: 600; }
.cx-access { display: grid; gap: 6px; margin: -8px 0 24px; padding: 14px 18px; background: var(--hx-paper); border: 1px solid var(--hx-rule); font-size: 0.9rem; line-height: 1.55; color: var(--hx-ink-muted); }
.cx-access p { margin: 0; }
.cx-access__what { font-weight: 600; color: var(--hx-green); }
.cx-access__actions { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cx-package.is-expired, .cx-access.is-expired { border-left: 3px solid var(--hx-gold); }
.cx-access.is-open { border-left: 3px solid var(--hx-green); color: var(--hx-green); font-weight: 600; }

/* ---------- The viewer page (course.html) ---------- */
.cx-view { padding: 28px 0 72px; }
.cx-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 18px; font-size: 0.85rem; color: var(--hx-ink-muted); }
.cx-crumbs a { color: var(--hx-gold-ink); }
.cx-viewhead { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 22px; }
.cx-viewhead h1 { margin: 0; font-family: var(--hx-serif); font-weight: 500; font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.08; color: var(--hx-green); }
.cx-viewhead p { margin: 0; font-size: 0.8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--hx-gold-ink); }
.cx-gate { position: relative; overflow: hidden; min-height: 420px; display: grid; place-items: center; padding: 40px 20px; background: var(--hx-green); color: var(--hx-on-dark); text-align: center; }
.cx-gate::before { content: ''; position: absolute; inset: -20px; background: repeating-linear-gradient(180deg, rgba(220, 183, 101, .18) 0 10px, transparent 10px 34px), linear-gradient(160deg, rgba(10, 74, 51, .9), rgba(2, 31, 21, .3)); filter: blur(8px); }
.cx-gate > div { position: relative; max-width: 460px; display: grid; gap: 14px; justify-items: center; }
.cx-gate svg { width: 34px; height: 34px; color: var(--hx-gold-bright); }
.cx-gate h2 { margin: 0; font-family: var(--hx-serif); font-weight: 500; font-size: 1.9rem; color: #fff; }
.cx-gate p { margin: 0; color: var(--hx-on-dark-muted); line-height: 1.6; }
.cx-gate[hidden] { display: none; }
.cx-loading { margin: 0; padding: 48px 0; text-align: center; color: var(--hx-ink-muted); }
.cx-loading[hidden] { display: none; }
.cx-gate--notice { min-height: 260px; }
.cx-gate__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cx-gate__actions [hidden] { display: none; }

/* ============================================================
   Shared content (both modules and reports)
   Colours come from the container: --cx-* below.
   ============================================================ */
.cx {
  --cx-ink: #e8efe9; --cx-muted: #c3d3cd; --cx-head: #fff; --cx-line: rgba(220, 183, 101, .28);
  --cx-card: rgba(10, 73, 62, .55); --cx-card-line: rgba(143, 216, 176, .16); --cx-accent: var(--hx-gold-bright);
  --cx-gold: #f0d481; --cx-up: var(--hx-up-dark); --cx-down: var(--hx-down-dark); --cx-info: #9cc7ff;
  color: var(--cx-ink); font-size: 1rem; line-height: 1.6;
}
.cx p { margin: 0; }
/* The serif's default old-style figures read badly as data ("01" looks like "oı"). */
.cx, .cx-tile, .cx-viewhead { font-variant-numeric: lining-nums; }
.cx strong { color: var(--cx-head); font-weight: 600; }
.cx-mark { background: none; color: var(--cx-gold); font-weight: 600; }
.cx-eyebrow { margin: 0 0 8px; font-size: 0.74rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--cx-accent); }
.cx-lead { margin-top: 10px; max-width: 70ch; font-size: 1.06rem; line-height: 1.6; color: var(--cx-muted); }
.cx-tag { display: inline-block; align-self: flex-start; margin-bottom: 8px; padding: 3px 10px; border: 1px solid var(--cx-line); color: var(--cx-accent); font-size: 0.7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

.cx-text { display: grid; gap: 12px; max-width: 75ch; }
.cx-text p { color: var(--cx-muted); }
.cx-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--cx-muted); max-width: 75ch; }
.cx-list li::marker { color: var(--cx-accent); }

.cx-cards { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 16px; }
.cx-card { display: flex; flex-direction: column; padding: 20px 22px; background: var(--cx-card); border: 1px solid var(--cx-card-line); border-top: 2px solid var(--cx-accent); }
.cx-card h3, .cx-compare h3, .cx-steps h3 { margin: 0 0 8px; font-family: inherit; font-size: 1.05rem; font-weight: 600; line-height: 1.3; color: var(--cx-head); }
.cx-card p, .cx-compare p, .cx-steps p { color: var(--cx-muted); font-size: 0.95rem; }
.cx-card ul, .cx-compare ul, .cx-steps ul { margin: 8px 0 0; padding-left: 1.15em; display: grid; gap: 5px; color: var(--cx-muted); font-size: 0.95rem; }
.cx-card li::marker, .cx-compare li::marker, .cx-steps li::marker { color: var(--cx-accent); }

.cx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: none; }
.cx-steps > li { display: grid; grid-template-columns: 52px 1fr; gap: 16px; align-items: start; }
.cx-steps__n { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--cx-accent); border-radius: 50%; font-family: var(--hx-serif); font-size: 1.2rem; font-weight: 600; color: var(--cx-accent); }
.cx-steps__body { padding-top: 4px; }
.cx-steps--row { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 18px; position: relative; }
.cx-steps--row::before { content: ''; position: absolute; top: 22px; left: 22px; right: 22px; height: 1px; background: var(--cx-line); }
.cx-steps--row > li { grid-template-columns: 1fr; gap: 12px; position: relative; }
.cx-steps--row .cx-steps__n { background: var(--cx-bg, var(--hx-green)); }

.cx-compare { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); border: 1px solid var(--cx-card-line); background: var(--cx-card); }
.cx-compare__col { position: relative; padding: 22px 24px; }
.cx-compare__col + .cx-compare__col { border-left: 1px solid var(--cx-line); }
.cx-compare__vs { position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--cx-accent); color: var(--hx-green); font-family: var(--hx-serif); font-size: 0.95rem; font-style: italic; font-weight: 600; }

.cx-stats { margin: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 1px; background: var(--cx-line); border: 1px solid var(--cx-line); }
.cx-stat { padding: 20px 22px; background: var(--cx-bg, var(--hx-green)); display: flex; flex-direction: column; gap: 4px; }
.cx-stat dd { margin: 0; order: 0; font-family: var(--hx-serif); font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 600; line-height: 1.05; color: var(--cx-gold); }
.cx-stat dt { order: 1; font-size: 0.86rem; font-weight: 600; color: var(--cx-head); }
.cx-stat__note { order: 2; font-size: 0.82rem; color: var(--cx-muted); }

.cx-table-fig { margin: 0; display: grid; gap: 10px; }
.cx-table-wrap { overflow-x: auto; border: 1px solid var(--cx-card-line); }
.cx-table-wrap:focus-visible { outline: 2px solid var(--cx-accent); outline-offset: 2px; }
.cx-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.cx-table caption { caption-side: top; text-align: left; padding: 12px 14px; font-weight: 600; color: var(--cx-head); border-bottom: 1px solid var(--cx-card-line); }
.cx-table th, .cx-table td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--cx-card-line); }
.cx-table thead th { background: var(--cx-thead, rgba(2, 31, 21, .6)); color: var(--cx-accent); font-size: 0.72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; vertical-align: bottom; white-space: nowrap; }
.cx-table tbody th { font-weight: 600; color: var(--cx-head); }
.cx-table td { color: var(--cx-muted); }
.cx-table .num { text-align: right; white-space: nowrap; }
.cx-table tbody tr:last-child > * { border-bottom: 0; }
.cx-table--wide { font-size: 0.84rem; }
.cx-table--wide th, .cx-table--wide td { padding: 8px 10px; }
.cx-nil { opacity: .5; }
.cx-notes { display: grid; gap: 4px; font-size: 0.82rem; line-height: 1.5; color: var(--cx-muted); opacity: .9; }

.cx-formula { padding: 18px 22px; border: 1px solid var(--cx-line); background: var(--cx-card); display: grid; gap: 6px; }
.cx-formula__name { font-size: 0.74rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--cx-accent); }
.cx-formula__expr { font-family: var(--hx-serif); font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 600; line-height: 1.3; color: var(--cx-head); }
.cx-formula__note { font-size: 0.9rem; color: var(--cx-muted); }

.cx-quote { margin: 0; padding: 6px 0 6px 24px; border-left: 2px solid var(--cx-accent); }
.cx-quote blockquote { margin: 0; }
.cx-quote p { font-family: var(--hx-serif); font-size: clamp(1.3rem, 2.3vw, 1.75rem); font-style: italic; font-weight: 500; line-height: 1.35; color: var(--cx-head); }
.cx-quote figcaption { margin-top: 10px; font-size: 0.88rem; color: var(--cx-muted); }

.cx-callout { --tone: var(--cx-accent); padding: 16px 20px; border-left: 3px solid var(--tone); background: var(--cx-card); display: grid; gap: 4px; }
.cx-callout--warn { --tone: var(--cx-down); }
.cx-callout--good { --tone: var(--cx-up); }
.cx-callout--info { --tone: var(--cx-info); }
.cx-callout__title { font-size: 0.74rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--tone); }
.cx-callout p:not(.cx-callout__title) { color: var(--cx-head); font-weight: 500; }

.cx-statement { font-family: var(--hx-serif); font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 600; line-height: 1.22; color: var(--cx-head); max-width: 32ch; }

.cx-qa { margin: 0; display: grid; gap: 12px; }
.cx-qa > div { padding: 14px 18px; border: 1px solid var(--cx-card-line); background: var(--cx-card); }
.cx-qa dt { font-weight: 600; color: var(--cx-head); }
.cx-qa dd { margin: 6px 0 0; color: var(--cx-muted); }

.cx-chart { margin: 0; display: grid; gap: 10px; padding: 16px 18px; border: 1px solid var(--cx-card-line); background: var(--cx-card); }
.cx-chart svg { width: 100%; height: auto; max-height: 340px; display: block; }
.cx-chart__title { order: -1; font-weight: 600; color: var(--cx-head); }
.cx-grid { stroke: var(--cx-card-line); stroke-width: 1; }
.cx-axis, .cx-c-label { fill: var(--cx-muted); font-size: 12px; font-family: inherit; }
.cx-c-mark { fill: var(--cx-gold); font-size: 12px; font-weight: 600; font-family: inherit; }
.cx-c-wick { stroke: var(--cx-muted); stroke-width: 1.5; }
.cx-c-up { fill: var(--cx-up); }
.cx-c-down { fill: var(--cx-down); }
.cx-s0 { --s: var(--cx-gold); } .cx-s1 { --s: var(--cx-up); } .cx-s2 { --s: var(--cx-info); } .cx-s3 { --s: var(--cx-down); }
polyline[class^="cx-s"] { stroke: var(--s); stroke-width: 2.5; stroke-linejoin: round; }
circle[class^="cx-s"], rect[class^="cx-s"] { fill: var(--s); }
.cx-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; color: var(--cx-muted); }
.cx-legend span { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; background: var(--s); }
/* Screen-reader copy of a chart's data. A table ignores width: 1px unless it is a block. */
.cx-chart { position: relative; }
.cx-sr { position: absolute; display: block; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Modules: slides ---------- */
.cx-deck { --cx-bg: var(--hx-green); }
.cx-deck__slides { display: grid; gap: 24px; }
.cx-slide {
  position: relative; display: flex; flex-direction: column; gap: clamp(20px, 2.6vw, 30px);
  padding: clamp(28px, 4vw, 56px) clamp(22px, 4.4vw, 64px) clamp(44px, 5vw, 60px);
  background: var(--hx-green) radial-gradient(120% 90% at 100% 0%, rgba(10, 74, 51, .75), rgba(3, 42, 29, 0) 60%);
  border-top: 3px solid var(--hx-gold);
  box-shadow: 0 30px 60px -36px rgba(2, 31, 21, .8);
}
.cx-slide__head { max-width: 900px; }
.cx-slide__title { margin: 0; font-family: var(--hx-serif); font-weight: 500; font-size: clamp(1.75rem, 3.2vw, 2.6rem); line-height: 1.1; color: #fff; letter-spacing: -.005em; }
.cx-slide__body { display: grid; gap: 22px; }
.cx-slide__num { position: absolute; right: clamp(22px, 4.4vw, 64px); bottom: 16px; font-size: 0.75rem; font-weight: 600; letter-spacing: .14em; color: var(--hx-gold-bright); }
.cx-slide__num span { color: rgba(247, 242, 230, .45); }

.cx-slide--cover, .cx-slide--section, .cx-slide--closing { justify-content: center; min-height: 420px; }
.cx-slide--cover { background: var(--hx-green-3) radial-gradient(90% 120% at 85% 10%, rgba(201, 162, 75, .16), rgba(3, 42, 29, 0) 55%); }
.cx-slide--cover::after { content: ''; position: absolute; left: clamp(22px, 4.4vw, 64px); bottom: clamp(44px, 5vw, 60px); width: 72px; height: 2px; background: var(--hx-gold); }
.cx-slide--cover .cx-slide__title { font-size: clamp(2.3rem, 5vw, 3.8rem); max-width: 18ch; }
.cx-slide--section .cx-slide__title { font-size: clamp(2rem, 4vw, 3rem); max-width: 20ch; }
.cx-slide--cover .cx-lead, .cx-slide--section .cx-lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); }

/* With JavaScript: one slide at a time. */
.cx-deck.is-enhanced .cx-deck__slides { display: block; }
.cx-deck.is-enhanced .cx-slide { display: none; min-height: min(72vh, 660px); }
.cx-deck.is-enhanced .cx-slide.is-current { display: flex; }
.cx-deck.is-enhanced .cx-slide.is-current:focus { outline: none; }

.cx-controls { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 10px 12px; background: var(--hx-paper); border: 1px solid var(--hx-rule); box-shadow: 0 -10px 30px -24px rgba(3, 42, 29, .5); color: var(--hx-ink); }
.cx-controls[hidden] { display: none; }
.cx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 14px; border: 1px solid var(--hx-rule); background: #fff; color: var(--hx-green); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.cx-btn svg { width: 20px; height: 20px; }
.cx-btn:hover:not(:disabled) { border-color: var(--hx-gold); }
.cx-btn:disabled { opacity: .4; cursor: default; }
.cx-btn:focus-visible { outline: 2px solid var(--hx-gold); outline-offset: 2px; }
.cx-next { background: var(--hx-green); border-color: var(--hx-green); color: var(--hx-on-dark); }
.cx-next:hover:not(:disabled) { background: var(--hx-green-2); }
.cx-progress { flex: 1; display: grid; gap: 6px; min-width: 0; }
.cx-counter { font-size: 0.8rem; font-weight: 600; color: var(--hx-ink-muted); letter-spacing: .04em; }
.cx-progress__track { height: 4px; background: var(--hx-rule-2); overflow: hidden; }
.cx-progress__bar { display: block; height: 100%; width: 0; background: var(--hx-gold); transition: width .25s ease; }
.cx-outline { list-style: none; margin: 10px 0 0; padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 12px; background: var(--hx-paper); border: 1px solid var(--hx-rule); }
.cx-outline[hidden] { display: none; }
.cx-outline a { display: flex; gap: 12px; padding: 8px 10px; color: var(--hx-ink); text-decoration: none; font-size: 0.9rem; line-height: 1.35; }
.cx-outline a span { flex: none; font-weight: 600; color: var(--hx-gold-ink); font-variant-numeric: tabular-nums; }
.cx-outline a:hover, .cx-outline a[aria-current="true"] { background: var(--hx-parchment); }

/* ---------- Reports: a document on paper ---------- */
.cx-report {
  --cx-ink: var(--hx-ink); --cx-muted: var(--hx-ink-muted); --cx-head: var(--hx-green); --cx-line: var(--hx-rule);
  --cx-card: #fff; --cx-card-line: var(--hx-rule-2); --cx-accent: var(--hx-gold-ink); --cx-gold: var(--hx-gold-ink);
  --cx-up: var(--hx-up); --cx-down: var(--hx-down); --cx-info: #2f5f8f; --cx-bg: #fff; --cx-thead: var(--hx-green);
  background: var(--hx-paper); border: 1px solid var(--hx-rule);
}
.cx-report .cx-table thead th { color: var(--hx-on-dark); }
.cx-report .cx-table tbody tr:nth-child(even) > * { background: rgba(239, 232, 214, .45); }
.cx-report .cx-callout p:not(.cx-callout__title) { font-weight: 400; }
.cx-report__head { padding: clamp(28px, 4vw, 52px) clamp(22px, 4vw, 56px) 28px; background: var(--hx-green) radial-gradient(90% 120% at 90% 0%, rgba(201, 162, 75, .16), rgba(3, 42, 29, 0) 60%); color: var(--hx-on-dark); border-top: 3px solid var(--hx-gold); }
.cx-report__head .cx-eyebrow { color: var(--hx-gold-bright); }
.cx-report__head h1 { margin: 0; font-family: var(--hx-serif); font-weight: 500; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.08; color: #fff; }
.cx-report__head .cx-lead { color: var(--hx-on-dark-muted); }
.cx-basis { margin-top: 12px !important; font-size: 0.85rem; color: rgba(247, 242, 230, .65); max-width: 80ch; }
.cx-kpis { margin: 26px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: rgba(220, 183, 101, .3); border: 1px solid rgba(220, 183, 101, .3); }
.cx-kpis > div { padding: 14px 18px; background: var(--hx-green-3); display: flex; flex-direction: column; gap: 2px; }
.cx-kpis dd { margin: 0; font-family: var(--hx-serif); font-size: 1.8rem; font-weight: 600; line-height: 1.1; color: var(--hx-gold-bright); }
.cx-kpis dt { order: 1; font-size: 0.8rem; color: var(--hx-on-dark-muted); }
.cx-report__layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; padding: clamp(24px, 3.4vw, 44px) clamp(22px, 4vw, 56px) 48px; }
.cx-toc { position: sticky; top: 96px; align-self: start; font-size: 0.86rem; }
.cx-toc p { margin: 0 0 10px; font-size: 0.72rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--hx-gold-ink); }
.cx-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; border-left: 1px solid var(--hx-rule); }
.cx-toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--hx-ink-muted); text-decoration: none; line-height: 1.35; }
.cx-toc a:hover, .cx-toc a[aria-current="true"] { color: var(--hx-green); border-left-color: var(--hx-gold); }
.cx-report__body { display: grid; gap: 44px; min-width: 0; }
.cx-section { display: grid; gap: 18px; scroll-margin-top: 96px; }
.cx-section h2 { margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--hx-rule); font-family: var(--hx-serif); font-weight: 600; font-size: clamp(1.5rem, 2.4vw, 1.9rem); line-height: 1.15; color: var(--hx-green); }
.cx-report .cx-text p, .cx-report .cx-list { color: var(--hx-ink); }
.cx-disclaimer { padding-top: 18px; border-top: 1px solid var(--hx-rule); font-size: 0.8rem; color: var(--hx-ink-muted); }

/* ---------- Smaller screens ---------- */
@media (max-width: 900px) {
  .cx-cards, .cx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cx-steps--row { grid-template-columns: 1fr; }
  .cx-steps--row::before { display: none; }
  .cx-steps--row > li { grid-template-columns: 52px 1fr; gap: 16px; }
  .cx-report__layout { grid-template-columns: 1fr; gap: 28px; }
  .cx-toc { position: static; }
}
@media (max-width: 640px) {
  .cx-cards, .cx-stats, .cx-compare { grid-template-columns: 1fr; }
  .cx-compare__col + .cx-compare__col { border-left: 0; border-top: 1px solid var(--cx-line); }
  .cx-compare__vs { top: 0; left: 50%; }
  .cx-deck.is-enhanced .cx-slide { min-height: 0; }
  .cx-slide--cover, .cx-slide--section, .cx-slide--closing { min-height: 320px; }
  .cx-outline-toggle { display: none; }
  .cx-controls { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-tile, .cx-progress__bar { transition: none; }
}
@media print {
  .cx-controls, .cx-outline, .cx-toc { display: none !important; }
  .cx-deck.is-enhanced .cx-slide { display: flex !important; break-inside: avoid; }
}

/* ---------- Admin sign-in on course.html ---------- */
.cx-admin { margin-top: 10px; width: 100%; max-width: 320px; text-align: left; }
.cx-admin summary { cursor: pointer; text-align: center; font-size: 0.85rem; color: var(--hx-on-dark-muted); text-decoration: underline; text-underline-offset: 3px; }
.cx-admin[hidden] { display: none; }
.cx-admin__form { margin-top: 14px; display: grid; gap: 12px; }
.cx-admin__form label { display: grid; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--hx-on-dark); }
.cx-admin__form input { min-height: 44px; padding: 0 12px; border: 1px solid rgba(220, 183, 101, .45); background: rgba(2, 31, 21, .6); color: #fff; font: inherit; }
.cx-admin__form input:focus-visible { outline: 2px solid var(--hx-gold-bright); outline-offset: 1px; }
.cx-admin__form .form-alert { padding: 10px 12px; background: rgba(168, 85, 43, .25); border: 1px solid var(--hx-down-dark); color: #fff; font-size: 0.85rem; }
.cx-admin__form .form-alert[hidden] { display: none; }
.cx-admin-out[hidden] { display: none; }

/* Folded groups: first 8 cards, then "Show all" (apex-courses.js). */
.cx-group.is-collapsed .cx-tile:nth-child(n+9) { display: none; }
.cx-more { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 22px auto 0; min-height: 46px; padding: 0 24px; border-radius: 999px; border: 1px solid var(--hx-green); background: transparent; color: var(--hx-green); font: inherit; font-size: 0.86rem; font-weight: 600; letter-spacing: .04em; cursor: pointer; transition: background .2s ease, color .2s ease; }
.cx-more:hover { background: var(--hx-green); color: var(--hx-on-dark); }
.cx-more:focus-visible { outline: 2px solid var(--hx-gold); outline-offset: 3px; }
.cx-more[hidden] { display: none; }

/* Locked cards: the whole card leads to the packages page. */
.cx-tile__buy { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: linear-gradient(135deg, #f0d481, #c9a24b); color: #032a1d; font-size: 0.78rem; font-weight: 700; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.cx-tile__cover { position: absolute; inset: 0; z-index: 2; }
.cx-tile__lock { z-index: 3; }
.cx-tile__buy:focus-visible { outline: 2px solid #f0d481; outline-offset: 2px; }
.cx-tile.is-locked { cursor: pointer; }
.cx-tile.is-open .cx-tile__buy { display: none; }

/* Narrow cards (e.g. 2K screens fit more per row): badge and button wrap and stay centred. */
.cx-tile__lock { flex-wrap: wrap; justify-content: center; gap: 8px 10px; padding: 14px 16px 16px; }
.cx-tile__badge { padding: 6px 11px; letter-spacing: .1em; }
.cx-tile__buy, .cx-tile__open { padding: 7px 13px; }

/* Every course is free: the card's lower edge is a plain footer with the
   "Free" tag and the Open button (the blurred locked stand-in is gone). */
.cx-tile__lock { position: relative; margin-top: auto; justify-content: space-between; padding: 14px 22px 18px; border-top: 1px solid var(--hx-rule-2); }
.cx-tile.is-open .cx-tile__badge { background: rgba(15, 122, 82, .1); border-color: rgba(15, 122, 82, .35); color: #0f7a52; backdrop-filter: none; }
.cx-tile .cx-tile__open { border-radius: 999px; }
