/* Shared finance design. Opt in on the template body after the base and feature styles. */
@font-face {
  font-family: "Moneyo Inter";
  src: url("./fonts/inter/Inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

body.moneyo-finance {
  --finance-font: "Moneyo Inter", "Segoe UI", Arial, sans-serif;
  --finance-line: #cedde3;
  --finance-bg: #f7fbff;
  --finance-paper: #fff;
  --finance-table-head: #163e42;
  --finance-cta: #125e94;
  --finance-cta-hover: #104c75;
  --finance-focus: #00856d;
  --finance-radius: 12px;
  --editorial-width: 1120px;
  --finance-h1: clamp(34px, 5vw, 66px);
  --finance-h2: clamp(26px, 3vw, 40px);
  --finance-h3: clamp(19px, 2vw, 26px);
  background: var(--finance-bg);
  color: var(--finance-text);
  font-family: var(--finance-font);
}

body.moneyo-finance.finance-data-wide { --editorial-width: 1200px; }
/* Baseline for new articles and calculators using the shared starter templates. */
.finance-template .breadcrumbs a { color: var(--finance-link); }
.finance-template .footer-bottom { color: var(--finance-text); }
.finance-template button.button-primary {
  min-height: 46px;
  background: var(--finance-cta);
  border-color: var(--finance-cta);
}
.finance-template button.button-primary:is(:hover, :focus-visible) { background: var(--finance-cta-hover); }
body.moneyo-finance main :is(input, select, textarea, button) { font-family: var(--finance-font); }
body.moneyo-finance main .finance-title {
  color: var(--finance-title-color);
  font: 700 var(--finance-h1)/1.07 var(--finance-font);
  letter-spacing: -.04em;
  overflow-wrap: break-word;
}
.moneyo-finance main .finance-panel {
  min-inline-size: 0;
  border-color: var(--finance-line);
  border-radius: var(--finance-radius);
}
body.moneyo-finance main .finance-panel > :is(h2, h3) {
  font-family: var(--finance-font);
  letter-spacing: -.025em;
  line-height: 1.2;
}
body.moneyo-finance main .finance-panel > h2 { font-size: var(--finance-h2); }
body.moneyo-finance main .finance-panel > h3 { font-size: var(--finance-h3); }
body.moneyo-finance main .finance-panel > p:not([class]) {font: 400 clamp(17px,1.35vw,18px)/1.65 var(--finance-font);}
.moneyo-finance main :is(.finance-panel,.article-content,.article-layout,.section-shell) > * {min-inline-size: 0;}
body.moneyo-finance main :is(.finance-table-scroll, .finance-table-host) {max-inline-size: 100%; min-inline-size: 0;}
body.moneyo-finance main .finance-table-host {overflow-x: auto; overscroll-behavior-x: contain;}
/* Let card layouts retain their cell labels and let wide data tables scroll in their own region. */
body.moneyo-finance main table thead th,
body.moneyo-finance main .finance-table-host table thead th {
  /* Legacy comparison themes style headers by table ID. This token owns the header surface. */
  color: white !important;
  background: var(--finance-table-head) !important;
  font-family: var(--finance-font);
}
body.moneyo-finance main table thead th :is(a, small, span) {color: inherit;}
body.moneyo-finance main table thead th a {text-decoration: underline;}
body.moneyo-finance main table thead th button {color: inherit; background-color: transparent;}
body.moneyo-finance main table thead th.is-current {box-shadow: inset 0 -3px #66c8af;}
body.moneyo-finance :is(main, header, footer, nav, button, input, select, textarea, .moneyo-paysend-promo) {
  font-family: var(--finance-font);
}
body.moneyo-finance main :is(h1, h2, h3, h4),
body.moneyo-finance .entry-header h1.entry-title {
  font-family: var(--finance-font);
}
body.moneyo-finance main :is(.article-hero, .ua-hero, .stocks-hero, .pr-hero, .entry-header) h1,
body.moneyo-finance .entry-header h1.entry-title {
  margin-block: 12px 16px;
  font-size: var(--finance-h1);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.07;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.moneyo-finance main :is(.article-content, .stocks-content, .ua-content > article, .moneyo-paysend-promo) {
  min-width: 0;
  font-family: var(--finance-font);
}
body.moneyo-finance main :is(.article-card-box, .ua-card, .stocks-panel) {
  min-width: 0;
  padding: clamp(16px, 2.3vw, 32px);
  color: var(--finance-text);
  background: var(--finance-paper);
  border: 1px solid var(--finance-line);
  border-radius: var(--finance-radius);
  box-shadow: none;
}
body.moneyo-finance main :is(.article-card-box, .ua-card, .stocks-panel, .moneyo-paysend-promo section, .patria-review section) > h2 {
  font-size: var(--finance-h2);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.18;
}
body.moneyo-finance main :is(.article-card-box, .ua-card, .stocks-panel, .moneyo-paysend-promo section, .patria-review section) > h3 {
  font-size: var(--finance-h3);
  font-weight: 700;
  line-height: 1.25;
}

body.moneyo-finance main :is(.article-card-box, .ua-card, .stocks-panel, .moneyo-paysend-promo section) > p:not([class]),
body.moneyo-finance .moneyo-paysend-promo > p:not([class]) {
  max-width: 75ch;
  color: var(--finance-text);
  font-size: clamp(17px, 1.35vw, 18px);
  line-height: 1.65;
}
.moneyo-finance main :is(.article-card-box, .ua-card, .stocks-panel, .moneyo-paysend-promo) > :is(ul, ol):not([class]) {
  padding-inline-start: 1.4em;
  line-height: 1.6;
}
.moneyo-finance main :is(.article-card-box, .ua-card, .stocks-panel, .moneyo-paysend-promo) > ul:not([class]) {list-style: disc;}
body.moneyo-finance .stocks-panel.stocks-verdict :is(h2, li, strong) {color: var(--finance-ink);}
body.moneyo-finance .stocks-panel.stocks-verdict a,
.moneyo-finance main :is(.article-card-box, .ua-card, .stocks-panel, .moneyo-paysend-promo) > p > a:not([class]) {
  color: var(--finance-link);
  text-underline-offset: .18em;
}
body.moneyo-finance main :is(.ua-callout, .promo-note, .revolut-note, .xtb-seo-note, .duel-warning) {
  padding: 16px 20px;
  color: var(--finance-ink);
  background: #edf5fa;
  border: 1px solid var(--finance-line);
  border-inline-start: 4px solid var(--finance-cta);
  border-radius: var(--finance-radius);
}
body.moneyo-finance main .duel-warning {
  color: #614318;
  background: #fff7e8;
  border-inline-start-color: #a96816;
}
body.moneyo-finance main a[rel~="sponsored"]:is(.button, .ua-cta, .promo-cta, .stocks-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--finance-cta);
  border-radius: 8px;
  color: #fff;
  background: var(--finance-cta);
  box-shadow: none;
  font: 700 1rem/1.35 var(--finance-font);
  text-decoration: none;
}
body.moneyo-finance main a[rel~="sponsored"]:is(.button, .ua-cta, .promo-cta, .stocks-button):hover {
  background: var(--finance-cta-hover);
}
.moneyo-finance :is(a, button, input, select, [tabindex="0"]):focus-visible {
  outline: 3px solid var(--finance-focus);
  outline-offset: 2px;
}

/* Preserve the native table and all column headers inside the scroll region. */
.moneyo-finance .finance-table-scroll {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--finance-line);
  border-radius: var(--finance-radius);
}
body.moneyo-finance main table {
  font-family: var(--finance-font);
  font-variant-numeric: tabular-nums;
}
body.moneyo-finance main :is(.finance-table-scroll, .ua-table-wrap, .plan-table-wrap, .promo-table-wrap, .pr-table) thead th {
  background: var(--finance-table-head);
  color: #fff;
  font-size: .9rem;
  line-height: 1.4;
  font-weight: 650;
  text-transform: none;
  letter-spacing: normal;
}
.moneyo-finance main table :is(th, td) {border-color: var(--finance-line);}

.moneyo-finance .duel-table table {width: 100%; min-width: 0;}
.moneyo-finance .duel-table :is(th, td) {overflow-wrap: break-word;}

@media (max-width: 760px) {
  body.moneyo-finance .finance-table-scroll > .rixo-table {
    display: table;
    min-width: 38rem;
    overflow: visible;
    white-space: normal;
    margin: 0;
  }
  .moneyo-finance :is(.finance-table-scroll, .finance-table-host, .plan-table-wrap, .ua-table-wrap, .promo-table-wrap, .pr-table):has(> table > caption) {
    container-type: inline-size;
  }
  .moneyo-finance :is(.finance-table-scroll, .finance-table-host, .plan-table-wrap, .ua-table-wrap, .promo-table-wrap, .pr-table) > table:has(> caption) {
    display: block;
  }
  body.moneyo-finance main :is(.finance-table-scroll, .finance-table-host, .plan-table-wrap, .ua-table-wrap, .promo-table-wrap, .pr-table) table > caption {
    box-sizing: border-box;
    display: block;
    width: 100%;
    max-width: 100cqi;
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 10px 12px 12px;
    text-align: start;
    line-height: 1.45;
  }
  /* The long brokerage table uses the same wrap as the short three-column model. */
  .moneyo-finance .duel-table table {min-width: 46rem;}
  /* The final brokerage scenario has three columns instead of the fee table's five. */
  .moneyo-finance .nvda-table--brokeri:has(thead th:nth-child(3):last-child) {min-width: 40rem;}
  .moneyo-finance .nvda-table--brokeri:has(thead th:nth-child(3):last-child) td {min-width: 0;}
  body.moneyo-finance main :is(.ua-table, .plan-table) tbody [data-label]::before {
    color: var(--finance-table-head);
    font-weight: 700;
  }
}

/* Astra's logo and menu are separate builder rows. Keep its toggle and menu hooks. */
body.moneyo-finance:is(.postid-27, .postid-246) #masthead {
  background: var(--finance-paper);
  border-bottom: 1px solid var(--finance-line);
}
body.moneyo-finance:is(.postid-27, .postid-246) #masthead :is(.ast-above-header-bar, .ast-primary-header-bar) {
  min-height: 0;
  background: transparent;
  border: 0;
}
.moneyo-finance:is(.postid-27, .postid-246) #masthead .custom-logo {width: 134px; height: auto;}
.moneyo-finance:is(.postid-27, .postid-246) #masthead .ast-site-identity {padding-block: 0;}
body.moneyo-finance:is(.postid-27, .postid-246) #masthead .ast-builder-grid-row {min-height: 0;}
body.moneyo-finance.postid-246 .site-content > .ast-container {
  width: min(calc(100% - 32px), var(--editorial-width));
  max-width: var(--editorial-width);
  margin-inline: auto;
  padding-inline: 0;
}
.moneyo-finance.postid-246 .site-main .ast-article-single {padding-inline: 0;}
body.moneyo-finance.postid-246 .entry-header,
body.moneyo-finance.postid-246 .entry-content > :is(.moneyo-paysend-promo, .moneyo-team) {
  max-width: 76ch;
  margin-inline: auto;
}
.moneyo-finance.postid-246 .moneyo-paysend-promo {font-size: 17px; line-height: 1.65;}
.moneyo-finance.postid-246 .entry-header {font-size: 17px;}
.moneyo-finance:is(.postid-27, .postid-246) #masthead .menu-link {font-family: var(--finance-font);color: var(--finance-ink);}
body.moneyo-finance:is(.postid-27, .postid-246):not(.ast-header-break-point) #ast-desktop-header,
body.moneyo-finance:is(.postid-27, .postid-246).ast-header-break-point #ast-mobile-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 68px;
  gap: 0 16px;
  max-width: var(--editorial-width);
  width: calc(100% - 32px);
  margin: 0 auto;
}
.moneyo-finance:is(.postid-27, .postid-246) #masthead .ast-main-header-wrap {justify-self: end;}
.moneyo-finance:is(.postid-27, .postid-246) #masthead .ast-mobile-header-content {grid-column: 1 / -1;}
.moneyo-finance:is(.postid-27, .postid-246) #masthead .ast-container {padding-inline: 0;}

/* Finance colours apply to both article layouts. Legacy components keep their own geometry. */
body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile)) {
  --finance-ink: #111827;
  --finance-text: #1f2937;
  --finance-muted: #4b5563;
  --finance-panel-paper: #f0f5f8;
  --finance-link: #075b82;
}
/* Light cards inside inverse panels restore the normal reading colours. */
:where(
  #etf-cost-message, #etf-goal-message, #etf-purchase-message, #etf-rebalance-message,
  .broker-conclusion-note, .broker-output-total, .ca-break-even, .diary-shot > figcaption,
  .hero-provider, .investing-refresh-visual, .sp-status-chip, .sp500-info-box, .su-result-note,
  .upvest-hero-panel, .upvest-note,
  .etf-tool .is-highlight, .upvest-warning,
  .wallet-result, .wallet-tool-note, [data-moneyo-surface="light"], body.editorial-finance,
  body.editorial-pilot, body.moneyo-finance, body:has(> main.author-profile)
) {
  --finance-title-color: var(--finance-ink);
  --finance-copy-color: var(--finance-text);
  --finance-caption-color: var(--finance-muted);
  --finance-inline-link: var(--finance-link);
}
/* Give formerly inverse reading panels a light backing for graphite text. Graphics, inverse sections and table headers keep their own surfaces. */
@layer moneyo-reading {
  @scope (:where(
    .ascended-cta, .bpi-example-result, .broker-conclusion, .broker-safety-checklist,
    .broker-tool, .ca-checklist, .ca-final, .ca-market-card, .ca-side-cta, .ca-stress-test,
    .ca-tool--navy, .ca-market-facts > div, .ca-tool--navy .ca-tool-badge, .ca-verdict, .calc-highlight, .chaos-cta, .cluster-formula, .corridor-panel,
    .tipli-cta-strip, .ppp-cta-strip, .lego-cta-strip, .wallet-cta-strip, .cta-band, .cta-strip, .demo-verdict-score, .diary-dashboard, .diary-shot, .doge-supply-panel,
    .dot-core, .epo-final-cta, .epo-tool-head, .etf-final, .etf-formula, .etf-side-cta,
    .etf-stress-test, .etf-tool, .etf-tool-results > div:not(.is-highlight), .etf-verdict, .fee-score, .fi-formula, .fire-result, .fl-score,
    .formula-band, .highlight-box, .hub-report, .iban-format, .ibkr-final-cta, .ibkr-fit-result,
    .ibkr-result-insight, .ibkr-scorecard, .earn-result-grid .featured, .inline-cta,
    .investment-navigation__check, .jo-verdict, .ks-summary, .mega-cta, .mh-result,
    .multi-cta-strip, .nord-tool__head, .np-result, .pc-result, .perfect-cta, .phantasmal-cta,
    .pokemon-lens__score, .pokemon-market-update, .pokemon-verdict, .portu-tool-head,
    .pp-rent-takeaway, .profit-calculator, .pt-map, .rating-summary__score, .rb-result, .rc-cover,
    .register-callout, .register-test-result, .report-mosaic figcaption, .ret-strategy-summary,
    .richest-calculator, .risk-panel, .rixo-cta-strip, .rx-output, .sale-callout, .sp-result,
    .sp500-final, .sp500-formula, .sp500-hours-advice, .sp500-market-card, .sp500-side-cta,
    .sp500-tool, .sp500-hours-grid .is-primary, .sp500-verdict,
    .stocks-checklist:not(.stocks-checklist-light), .stocks-conclusion, .stocks-formula,
    .stocks-market-card, .stocks-tool-result, .su-tool-result, .supply-pill, .tax-verdict-side,
    .transfer-sidebar-card, .true-cost-equation, .ua15-final, .upvest-final-cta,
    .upvest-mobile-cta, .upvest-score-summary, .upvest-security, .upvest-sidebar-cta,
    .upvest-tool-head, .ur15-footer, .vat-result, .vpn-cta-strip, .wallet-tool, .whisky-verdict,
    .withdraw-score, .xtb-score-card, .moneyo-finance .site-below-footer-wrap
  )) to (:where(svg, thead, .score-ring, .upvest-score-ring, [data-moneyo-surface="dark"])) {
    :scope {
      background-color: var(--finance-panel-paper) !important;
      background-image: none !important;
      color: var(--finance-text) !important;
      --finance-title-color: var(--finance-ink);
      --finance-copy-color: var(--finance-text);
      --finance-caption-color: var(--finance-muted);
      --finance-inline-link: var(--finance-link);
    }
    :where(div, label, span, strong, b, em, output, dt, dd, legend, summary, h4, tbody th) {
      color: inherit !important;
    }
    :is(.button-ghost, .button-outline-light, .button-secondary, .investment-navigation__check-link,
        .pt-map > a, .pc-result-actions button, .vat-result-actions button, .sp500-quick-values button,
        .sp500-risk-presets button) {
      color: #075b82 !important;
      background-color: #fff !important;
      border-color: #65758a;
    }
  }
}
/* Hero artwork and its text form one inverse surface. */
:where(
  .etf-hero-card, .fi-hero-plan, .finance-surface-dark, .moneyo-home .cta,
  .passive-page .article-hero-card, .slovakia-hero-card, .transfer-hero-card, .upvest-hero,
  [data-moneyo-surface="dark"]
) {
  --finance-title-color: #fff;
  --finance-copy-color: #f3f4f6;
  --finance-caption-color: #e5e7eb;
  --finance-inline-link: #c4e7ff;
}

/* Limit priority to foreground colours. Older feature sheets use IDs, inline colours and
   !important. The layer keeps headings, their linked titles and small-print roles consistent. */
@layer moneyo-reading {
  :where(body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile))),
  :where(body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile))) :where(p, li, td) {
    color: var(--finance-copy-color) !important;
  }
  :where(body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile))) :where(
    small, figcaption, caption, .subtitle, [class$="-subtitle"], .eyebrow, [class$="-eyebrow"],
    .kicker, [class$="-kicker"], .finance-muted, .affiliate-disclosure, .credit-review-label,
    .moneyo-credit time, footer, footer p, footer li, footer small, .footer-bottom
  ) { color: var(--finance-caption-color) !important; }
  :where(body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile))) :where(
    p, li, td, dd, small, figcaption, caption, .breadcrumbs, nav[class*="breadcrumb"],
    .hub-links, .hub-finance, .footer-contact, footer nav
  ) a:where(:not([class], [role="button"], [rel~="sponsored"], [aria-label])) {
    color: var(--finance-inline-link) !important;
  }
  :where(body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile))) a:is(
    .text-link, .card-link, .moneyo-topic-link, .etoro-order-secondary,
    .stock-visual-open, .stock-article-toc-top, .home-text-link
  ) { color: var(--finance-inline-link) !important; }
  :where(body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile))) :is(
    h1, h2, h3, h1 :is(a,span,strong,em), h2 :is(a,span,strong,em), h3 :is(a,span,strong,em),
    .card-title, .card__title, [class$="-card-title"], .investment-navigation__link strong,
    .home-categories strong, .home-tools strong
  ) { color: var(--finance-title-color) !important; }
  :where(body:is(.moneyo-finance, .editorial-finance, .editorial-pilot, :has(> main.author-profile))) thead th :is(a, small, span) {
    color: inherit !important;
  }
}

/* This broker template also styles plain prose links as filled CTAs. */
.stocks-broker-card p a:not([class]) {
  display: inline;
  margin: 0;
  padding: 0;
  background: transparent !important;
  text-decoration: underline;
}
@layer moneyo-reading {
  .report-mosaic figcaption { color: var(--finance-muted) !important; }
  .transfer-hero-kicker { color: #4b5563 !important; }
  .ibkr-mobile-cta small { color: inherit !important; }
}

/* Pressed controls remain distinguishable after the result cards switch to paper. */
@layer moneyo-reading {
  :is(.sp500-risk-presets, .sp500-quick-values) button:is([aria-pressed="true"], .is-active) {
    background-color: #125e94 !important;
    color: white !important;
  }
}
