/* ===================================================
   FINRATIO — MODULE REDESIGN v2
   Visual-only override. All content styles in
   module-style.css are preserved intact.
   =================================================== */

/* 1–5. Переменные, шапка, логотип и меню теперь задаёт assets/brand.css */

/* 6. Mod-hero — rich dark gradient with ambient orb */
.mod-hero {
  margin-top: var(--header-h, 64px) !important; /* под сплошную шапку из brand.css */
  padding: 72px 80px 56px;
  background: linear-gradient(160deg, #0D2218 0%, #07070D 55%, #0A1A10 100%);
  position: relative;
  overflow: hidden;
}
.mod-hero::before {
  content: '';
  position: absolute;
  top: -20%;
  right: 8%;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(26,76,45,.48) 0%, transparent 70%);
  pointer-events: none;
}
.mod-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.mod-hero-inner { position: relative; z-index: 2; }

/* Breadcrumb color */
.breadcrumb { color: rgba(138,154,142,.8); }
.breadcrumb a { color: rgba(138,154,142,.8); }
.breadcrumb a:hover { color: var(--gold); }

/* Badge — pill style */
.mod-num-badge { border-radius: 100px; }

/* Meta chips — pill */
.meta-chip { border-radius: 100px; }

/* ============================================================
   Visual components from Course 8 lessons — neutralised to the
   site palette (no bright kindergarten colours).
   ============================================================ */

/* Funnel (AARRR + similar) */
.funnel-wrap { display: flex; flex-direction: column; gap: 8px; margin: 24px 0; }
.funnel-step { display: flex; align-items: center; gap: 16px; }
.funnel-label {
  min-width: 130px;
  font-family: var(--font-label);
  font-size: .78rem; color: #666;
  text-transform: uppercase; letter-spacing: .08em;
}
.funnel-bar {
  flex: 0 0 auto;
  height: 44px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .92rem;
  color: var(--paper);
  transition: width .4s;
}
.funnel-bar.f1 { background: var(--ink);    width: 100%; }
.funnel-bar.f2 { background: var(--forest); width: 82%;  }
.funnel-bar.f3 { background: #244a39;       width: 62%;  }
.funnel-bar.f4 { background: var(--sage);   width: 42%;  }
.funnel-bar.f5 { background: var(--gold); color: var(--ink); width: 28%; }
.funnel-pct {
  min-width: 50px;
  font-family: var(--font-label);
  font-size: .82rem; color: #666; text-align: right;
}

/* Metric grid + cards (CPL, CR, MRR…) */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin: 22px 0;
}
.metric-card {
  background: var(--cream);
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 10px;
  padding: 18px 20px;
  text-align: left;
}
.metric-card .mc-name {
  font-family: var(--font-label);
  font-size: .74rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.metric-card .mc-formula {
  font-family: var(--font-code);
  font-size: .92rem; font-weight: 600;
  color: var(--ink);
  background: rgba(0,0,0,.04);
  padding: 6px 10px; border-radius: 4px;
  display: inline-block;
  margin-bottom: 10px;
}
.metric-card .mc-desc {
  font-size: .86rem; line-height: 1.55;
  color: #555;
}

/* Unit-economics table (CAC / LTV …) */
.unit-table {
  width: 100%; border-collapse: collapse;
  margin: 20px 0; font-size: .92rem;
}
.unit-table th {
  background: var(--ink); color: var(--paper);
  padding: 11px 14px; text-align: left;
  font-weight: 700; letter-spacing: .04em;
}
.unit-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  vertical-align: top;
}
.unit-table tr:nth-child(even) td { background: rgba(0,0,0,.025); }
.unit-table .good    { color: var(--sage);   font-weight: 700; }
.unit-table .bad     { color: var(--rust);   font-weight: 700; }
.unit-table .neutral { color: var(--gold);   font-weight: 700; }

/* Channel grid + cards */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px; margin: 22px 0;
}
.channel-card {
  background: var(--paper);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  padding: 18px 20px;
}
.channel-card .ch-type {
  font-family: var(--font-label);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 6px;
}
.channel-card .ch-type.paid     { color: var(--rust); }
.channel-card .ch-type.organic  { color: var(--sage); }
.channel-card .ch-type.partner  { color: var(--forest); }
.channel-card .ch-type.referral { color: var(--gold); }
.channel-card h4 {
  font-family: var(--font-display);
  font-size: 1.06rem; font-weight: 700;
  margin: 0 0 8px; color: var(--ink);
}
.channel-card p {
  font-size: .9rem; line-height: 1.6;
  color: #555; margin: 0 0 10px;
}
.channel-card .ch-cac {
  font-family: var(--font-label);
  font-size: .76rem; color: var(--gold);
  font-weight: 600;
}

/* Pricing strategy cards */
.price-strategy { display: grid; gap: 14px; margin: 22px 0; }
.ps-card {
  background: var(--cream);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
}
.ps-card.ps-cost  { border-left-color: var(--forest); }
.ps-card.ps-value { border-left-color: var(--sage); }
.ps-card.ps-comp  { border-left-color: var(--ink); }
.ps-card.ps-skim  { border-left-color: var(--gold); }
.ps-card.ps-pen   { border-left-color: var(--rust); }
.ps-card h4 {
  font-family: var(--font-display);
  font-size: 1.06rem; font-weight: 700;
  margin: 0 0 8px;
}
.ps-card .ps-formula {
  font-family: var(--font-code);
  font-size: .86rem; font-weight: 600;
  color: var(--ink);
  background: rgba(0,0,0,.05);
  padding: 5px 10px; border-radius: 4px;
  display: inline-block; margin-bottom: 8px;
}
.ps-card p {
  font-size: .9rem; line-height: 1.62;
  color: #444; margin: 0;
}

/* LTV / CAC visualisation */
.ltv-visual {
  display: flex; align-items: flex-end;
  gap: 28px; justify-content: center;
  margin: 28px 0;
}
.ltv-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ltv-bar {
  width: 80px; border-radius: 6px 6px 0 0;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 8px;
  font-weight: 700; font-size: .94rem;
  color: var(--paper);
}
.ltv-bar.cac-bar    { background: var(--rust);   height: 80px;  }
.ltv-bar.ltv-bar-el { background: var(--sage);   height: 200px; }
.ltv-bar.pb-bar     { background: var(--gold); color: var(--ink); height: 120px; }
.ltv-label {
  font-family: var(--font-label);
  font-size: .76rem; color: #666;
  text-transform: uppercase; letter-spacing: .08em;
}
.ltv-rule {
  text-align: center;
  margin: 16px auto;
  padding: 12px 22px;
  background: rgba(74,124,89,.10);
  border-left: 3px solid var(--sage);
  border-radius: 0 4px 4px 0;
  font-size: .92rem; font-weight: 600;
  color: var(--forest);
  max-width: 600px;
}

/* Marketing plan table */
.mplan-table {
  width: 100%; border-collapse: collapse;
  margin: 20px 0; font-size: .88rem;
}
.mplan-table th {
  background: var(--ink); color: var(--paper);
  padding: 10px 12px; text-align: left;
  font-weight: 700;
}
.mplan-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  vertical-align: top;
}
.mplan-table tr:nth-child(even) td { background: rgba(0,0,0,.025); }

/* Callouts (warn / success) */
.callout.warn {
  background: rgba(184,74,46,.07);
  border-left-color: var(--rust);
}
.callout.warn strong { color: var(--rust); }
.callout.success {
  background: rgba(74,124,89,.10);
  border-left-color: var(--sage);
}
.callout.success strong { color: var(--forest); }

/* Mini-test (alias of .test, used on c8m4-c8m7) — apply the same dark styling.
   The descendant selectors below the container need to inherit too, so we mirror
   every .test-* rule from module.css/module-style.css that depends on `.test` being
   the parent. */
.mini-test {
  background: var(--ink); color: var(--paper);
  padding: 36px; border-radius: 10px; margin-top: 44px;
}
.mini-test .test-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding-bottom: 18px; margin-bottom: 24px;
}
.mini-test .test-label {
  font-family: var(--font-label); font-size: .7rem;
  color: var(--gold); text-transform: uppercase; letter-spacing: .18em;
}
.mini-test .test-title {
  font-family: var(--font-display); font-size: 1.4rem;
  font-weight: 700; margin-top: 6px; line-height: 1.2; color: var(--paper);
}
.mini-test .test-meta {
  font-family: var(--font-label); font-size: .72rem;
  color: var(--mist); text-transform: uppercase;
}
.mini-test .test-q {
  padding: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.mini-test .test-q:last-of-type { border-bottom: none; }
.mini-test .test-q p,
.mini-test .test-q .q-text {
  font-size: 1rem; font-weight: 600; line-height: 1.55;
  margin-bottom: 14px; color: var(--paper);
}
.mini-test .test-q label {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  cursor: pointer; font-size: .92rem; line-height: 1.45;
  transition: background .2s, border-color .2s;
  margin-bottom: 8px;
  color: var(--paper);
}
.mini-test .test-q label:last-child { margin-bottom: 0; }
.mini-test .test-q label:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(200,168,75,.3);
}
.mini-test .test-q label input { accent-color: var(--gold); flex-shrink: 0; }
.mini-test.checked .test-q label { cursor: default; pointer-events: none; }
.mini-test.checked .test-q label.is-correct {
  background: rgba(74,124,89,.22); border-color: var(--sage);
}
.mini-test.checked .test-q label.is-wrong {
  background: rgba(184,74,46,.18); border-color: var(--rust);
}
.mini-test .test-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.mini-test .test-result {
  display: none; padding: 14px 18px;
  border-radius: 6px; font-weight: 700; font-size: .94rem;
}
.mini-test .test-result.passed {
  display: block; background: rgba(74,124,89,.2);
  border-left: 3px solid var(--sage); color: #9ad0aa;
}
.mini-test .test-result.failed {
  display: block; background: rgba(184,74,46,.18);
  border-left: 3px solid var(--rust); color: #e8a090;
}

/* Excel template download button — global so all modules look the same */
a.xls-dl,
.xls-dl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--forest);
  color: var(--paper);
  padding: 13px 22px;
  border-radius: 100px;
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .02em;
  margin: 8px 0 4px;
  border: 1px solid rgba(200,168,75,.25);
  transition: background .2s, border-color .2s, transform .15s;
}
a.xls-dl:hover,
.xls-dl:hover { background: #0e2a1c; border-color: var(--gold); transform: translateY(-1px); }
a.xls-dl:active,
.xls-dl:active { transform: translateY(0); }
.xls-dl .xi {
  font-family: var(--font-label);
  font-size: .68rem;
  font-weight: 700;
  background: rgba(200,168,75,.18);
  color: var(--gold);
  padding: 4px 9px;
  border-radius: 100px;
  letter-spacing: .08em;
}

/* Share button — sits inline at the end of .mod-meta-row */
.mod-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.share-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px 7px 14px;
  background: transparent;
  color: rgba(247,244,238,.75);
  font-family: var(--font-label);
  font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid rgba(200,168,75,.35);
  border-radius: 100px;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.share-btn:hover {
  background: rgba(200,168,75,.12);
  border-color: var(--gold);
  color: #F7F4EE;
}
.share-btn:active { transform: scale(.97); }
.share-btn.copied {
  background: rgba(74,124,89,.18);
  border-color: var(--sage);
  color: #d8eadb;
}
.share-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: rgba(200,168,75,.18);
  color: var(--gold);
  border-radius: 50%;
  font-size: .82rem; line-height: 1;
  transition: background .2s, color .2s;
}
.share-btn:hover .share-ico { background: var(--gold); color: var(--ink); }
.share-btn.copied .share-ico { background: var(--sage); color: #fff; }
@media (max-width: 640px) {
  .share-btn { margin-left: 0; }
  .share-lbl { display: none; }
  .share-btn { padding: 7px 12px; }
}

/* 7. Sidebar — под шапкой (64px) и полосой навигации по курсу (58px) */
.sidebar {
  top: 122px;
  height: calc(100vh - 122px);
  background: #F7F4EE;
  border-right: 1px solid rgba(0,0,0,.06);
  padding-bottom: 32px;
}

.mod-layout { min-height: calc(100vh - 122px); }

/* v2 template (c8m4-7) — no mod-hero, course-mod-nav provides top spacing */
.module-layout { margin-top: 0 !important; min-height: calc(100vh - 122px); }
.module-sidebar { top: 122px !important; height: calc(100vh - 122px) !important; padding-bottom: 32px !important; }

/* Lesson nav active state */
.lesson-nav-item.active { background: rgba(200,168,75,.1); border-left-color: var(--gold); }
.lesson-nav-item.active .lnav-num { background: var(--gold); color: var(--ink); }
.lesson-nav-item:hover { background: rgba(200,168,75,.05); }

/* Lesson sidebar nav — override the global `nav { display: flex }` so items stack
   vertically (sidebar lessons should be a column, not a row). */
.module-sidebar .lesson-nav,
.sidebar .lesson-nav {
  display: block !important;
  flex-direction: column !important;
  gap: 0 !important;
  padding: 0;
  width: 100%;
}
.module-sidebar .lesson-nav > .lnav-item,
.sidebar .lesson-nav > .lnav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .15s;
}
.module-sidebar .lesson-nav > .lnav-item > .lnav-title,
.sidebar .lesson-nav > .lnav-item > .lnav-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  white-space: normal;
}
.module-sidebar .lesson-nav > .lnav-item > .lnav-num,
.sidebar .lesson-nav > .lnav-item > .lnav-num {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,.08);
  font-family: var(--font-label);
  font-size: .6rem;
  font-weight: 700;
}
.module-sidebar .lesson-nav > .lnav-item.active,
.sidebar .lesson-nav > .lnav-item.active {
  background: rgba(200,168,75,.1);
  border-left-color: var(--gold);
}
.module-sidebar .lesson-nav > .lnav-item.active > .lnav-num,
.sidebar .lesson-nav > .lnav-item.active > .lnav-num {
  background: var(--gold);
  color: var(--ink);
}
.module-sidebar .lesson-nav > .lnav-item:hover,
.sidebar .lesson-nav > .lnav-item:hover {
  background: rgba(200,168,75,.05);
}

/* 8. Module course-nav — sits between dark mod-hero and white content.
   Static (in document flow): scrolls naturally with the page, like the dark hero.
   Sidebar (sticky) handles in-lesson navigation while reading. */
.course-mod-nav {
  position: static;
  z-index: 150;
  margin-top: var(--header-h, 64px); /* под шапку, когда нет mod-hero */
  background: var(--paper);
  border-top: 1px solid rgba(200,168,75,.2);
  border-bottom: 1px solid rgba(200,168,75,.14);
  padding: 0 40px;
}
/* When course-mod-nav follows mod-hero, no extra top margin is needed */
.mod-hero + .course-mod-nav { margin-top: 0; }

.cmn-item:hover { color: var(--ink); border-bottom-color: rgba(200,168,75,.4); background: rgba(200,168,75,.04); }
.cmn-item.active { color: var(--ink); border-bottom-color: var(--gold); background: rgba(200,168,75,.06); }

/* 9. Pill-shaped action buttons */
.btn-prev,
.btn-next,
.btn-submit,
.btn-check,
.btn-gate,
.btn-retry,
.btn-finish,
.pt-reveal-btn { border-radius: 100px; }

.btn-next { background: var(--ink); color: var(--paper); }
.btn-next:hover { background: #1a1a28; transform: translateX(2px); }
.btn-next.gold { background: var(--gold); color: var(--ink); }
.btn-next.gold:hover { background: var(--gold-lt); transform: translateX(2px); }

.btn-submit { background: var(--gold); color: var(--ink); }
.btn-submit:hover { background: var(--gold-lt); }

.btn-gate { border-radius: 100px; }

/* 10. Progress bar — gradient gold */
#progress {
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
  height: 2px;
  z-index: 400;
}

/* 11. Module gate — richer gradient */
.module-gate {
  background: linear-gradient(135deg, #0D2218 0%, #07070D 60%, #0A1A10 100%);
  border-radius: 12px;
  border: 1px solid rgba(200,168,75,.12);
}

/* 12. Course finish block */
.course-finish {
  background: linear-gradient(135deg, #0D2218 0%, #07070D 60%, #0A1A10 100%);
  border-radius: 12px;
  border: 1px solid rgba(200,168,75,.12);
}

/* 13. Footer */
footer {
  background: linear-gradient(135deg, #0D2218, #07070D);
  border-top: 1px solid rgba(200,168,75,.1);
}

/* 14. Responsive */
@media (max-width: 900px) {
  /* мобильная шапка — 64px (brand.css) + полоса курса 58px = 122px */
  .mod-hero {
    margin-top: 122px !important;
    padding: 56px 24px 40px;
  }
  .sidebar {
    top: 122px;
    height: calc(100vh - 122px);
  }
  .module-layout { margin-top: 122px !important; }
  .module-sidebar { top: 122px !important; height: calc(100vh - 122px) !important; }
}

/* 14b. Мобильное меню задаёт assets/brand.css */
@media (max-width: 820px) {
  /* Mobile fallback for in-flow course-mod-nav under header */
  .course-mod-nav { font-size: .82rem; }
}
