/* BSPCE calculator: uses the theme's type, colour and spacing tokens. */
.tm-bspce {
  --bspce-link: var(--button-primary-background);
  --bspce-error: #b42318;
  max-width: 1200px;
}
.dark .tm-bspce { --bspce-link: hsl(var(--primary)); --bspce-error: #ffb4a8; }
.tm-bspce [hidden] { display: none !important; }
.tm-bspce *, .tm-bspce *::before, .tm-bspce *::after { box-sizing: border-box; }
.tm-bspce :is(a, button, input, select, summary, [tabindex]):focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 4px; }
.tm-bspce :is(section, aside) { scroll-margin-top: 7rem; }
.tm-bspce a { color: var(--bspce-link); text-decoration: underline; text-underline-offset: 4px; }
.tm-bspce a:hover { text-decoration-thickness: 2px; }
.tm-bspce-breadcrumb { margin-top: -1.5rem; margin-bottom: 2rem; color: hsl(var(--muted-foreground)); font-size: .875rem; }
.tm-bspce-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; gap: .5rem; padding: 0; }
.tm-bspce-breadcrumb li + li::before { content: "/"; margin-right: .5rem; color: hsl(var(--muted-foreground)); }
.tm-bspce-breadcrumb a { display: inline-flex; min-height: 2.75rem; align-items: center; }
.tm-bspce-heading { margin-bottom: 2.5rem; max-width: 56rem; }
.tm-bspce-eyebrow { font-size: .875rem; font-weight: 500; color: var(--bspce-link); margin-bottom: 1rem; }
.tm-bspce-heading h1 { max-width: 26ch; }
.tm-bspce-intro { margin-top: 1.5rem; max-width: 64ch; font-size: 1.125rem; line-height: 1.75; color: hsl(var(--muted-foreground)); }
.tm-bspce-meta { margin-top: 1rem; color: hsl(var(--muted-foreground)); font-size: .8125rem; line-height: 1.6; }
.tm-bspce-calculator { border: 1px solid hsl(var(--border)); border-radius: var(--radius); overflow: hidden; background: hsl(var(--card)); }
.tm-bspce-calculator-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.5rem; border-bottom: 1px solid hsl(var(--border)); }
.tm-bspce-calculator-heading h2, .tm-bspce-results h2 { font-size: 1.375rem; line-height: 1.4; font-weight: 600; }
.tm-bspce-calculator-heading p { margin-top: .5rem; color: hsl(var(--muted-foreground)); font-size: .875rem; line-height: 1.6; }
.tm-bspce-method-link { display: inline-flex; min-height: 2.75rem; align-items: center; font-size: .875rem; font-weight: 500; }
.tm-bspce-timeline { display: flex; flex-wrap: wrap; column-gap: 1.5rem; row-gap: .5rem; list-style: none; padding: 1rem 1.5rem; margin: 0; border-bottom: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); font-size: .8125rem; line-height: 1.6; }
.tm-bspce-timeline strong { font-weight: 500; color: hsl(var(--foreground)); }
.tm-bspce-fields { min-width: 0; border: 0; margin: 0; padding: 0; }
.tm-bspce-form-grid { display: grid; min-width: 0; }
.tm-bspce-shared, .tm-bspce-scenarios { min-width: 0; padding: 1.5rem; }
.tm-bspce-shared h3, .tm-bspce-scenarios h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.5; }
.tm-bspce-section-hint { color: hsl(var(--muted-foreground)); margin-top: .25rem; margin-bottom: 1.5rem; font-size: .875rem; line-height: 1.6; }
.tm-bspce-scenarios { background: hsl(var(--muted) / .5); border-top: 1px solid hsl(var(--border)); }
.tm-bspce-field { min-width: 0; margin-top: 1.25rem; }
.tm-bspce-field label { display: block; font-size: .875rem; font-weight: 500; line-height: 1.5; margin-bottom: .5rem; }
.tm-bspce-field :is(input, select) { display: block; min-width: 0; width: 100%; min-height: 3rem; padding: .625rem .75rem; font: inherit; font-variant-numeric: tabular-nums; border: 1px solid hsl(var(--input)); border-radius: .375rem; background: hsl(var(--background)); color: hsl(var(--foreground)); }
.tm-bspce-field :is(input, select)[aria-invalid="true"] { border-color: var(--bspce-error); }
.tm-bspce-field select { padding-right: 1.5rem; }
.tm-bspce-hint { margin-top: .5rem; font-size: .8125rem; line-height: 1.55; color: hsl(var(--muted-foreground)); }
.tm-bspce-field-error { margin-top: .5rem; font-size: .875rem; line-height: 1.5; color: var(--bspce-error); }
.tm-bspce-scenario-field label span { display: block; color: hsl(var(--muted-foreground)); font-size: .8125rem; font-weight: 400; margin-top: .25rem; }
.tm-bspce-scenario-note { border-top: 1px solid hsl(var(--border)); padding-top: 1rem; margin-top: 1.5rem; color: hsl(var(--muted-foreground)); font-size: .875rem; line-height: 1.6; }
.tm-bspce-form-footer { padding: 1.5rem; border-top: 1px solid hsl(var(--border)); }
.tm-bspce-scope { max-width: 80ch; }
.tm-bspce-scope label { display: flex; gap: .75rem; align-items: flex-start; min-height: 2.75rem; font-size: .875rem; line-height: 1.6; cursor: pointer; }
.tm-bspce-scope input { flex: none; width: 1.125rem; height: 1.125rem; margin-top: .125rem; accent-color: var(--button-primary-background); }
.tm-bspce-scope > p { margin-left: 1.875rem; }
.tm-bspce-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.tm-bspce-actions button { min-height: 2.75rem; padding: .75rem 1rem; border-radius: .375rem; font-size: .875rem; line-height: 1.5; font-weight: 500; }
.tm-bspce-secondary { color: hsl(var(--foreground)); background: hsl(var(--background)); border: 1px solid hsl(var(--border)); }
.tm-bspce-secondary:hover { background: hsl(var(--muted)); }
.tm-bspce-text-button { color: var(--bspce-link); text-decoration: underline; text-underline-offset: 4px; }
.tm-bspce-actions button:disabled { cursor: not-allowed; }
.tm-bspce-errors, .tm-bspce-notice { margin: 1.5rem; padding: 1rem; border: 1px solid hsl(var(--border)); border-radius: .375rem; font-size: .875rem; line-height: 1.65; background: hsl(var(--muted)); }
.tm-bspce-errors { border-color: var(--bspce-error); color: var(--bspce-error); }
.tm-bspce-errors ul { list-style: disc; padding-left: 1.25rem; margin-top: .5rem; }
.tm-bspce-errors a { color: inherit; }
.tm-bspce-status { font-size: .875rem; line-height: 1.6; padding: 0 1.5rem; }
.tm-bspce-status:empty { display: none; }
.tm-bspce-status:not(:empty) { padding-bottom: 1.5rem; }
.tm-bspce-empty { padding: 1.5rem; border-top: 1px solid hsl(var(--border)); background: hsl(var(--muted) / .35); }
.tm-bspce-empty p { max-width: 70ch; font-size: .9375rem; line-height: 1.7; color: hsl(var(--muted-foreground)); }
.tm-bspce-empty p + p { margin-top: .5rem; }
.tm-bspce-empty strong { font-weight: 500; color: hsl(var(--foreground)); }
.tm-bspce-results { min-width: 0; padding: 1.5rem; border-top: 1px solid hsl(var(--border)); }
.tm-bspce-results .tm-bspce-notice { margin: 1rem 0; }
.tm-bspce-comparison { max-width: 100%; overflow-x: auto; margin-top: 1rem; overscroll-behavior-x: contain; }
.tm-bspce-table { width: 100%; border-collapse: collapse; font-size: .875rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
.tm-bspce-table caption { text-align: left; color: hsl(var(--muted-foreground)); padding-bottom: 1rem; font-size: .8125rem; }
.tm-bspce-table th, .tm-bspce-table td { padding: .875rem .75rem; border-bottom: 1px solid hsl(var(--border)); text-align: right; vertical-align: top; }
.tm-bspce-table th { font-weight: 500; }
.tm-bspce-table th:first-child { text-align: left; padding-left: 0; }
.tm-bspce-table thead th { white-space: nowrap; color: hsl(var(--muted-foreground)); font-size: .8125rem; }
.tm-bspce-table thead small { display: block; margin-top: .25rem; font-weight: 400; }
.tm-bspce-table td { white-space: nowrap; }
.tm-bspce-table .tm-bspce-net, .tm-bspce-table tfoot { background: hsl(var(--muted)); }
.tm-bspce-table :is(.tm-bspce-net, tfoot) :is(th, td) { padding-top: 1.25rem; padding-bottom: 1.25rem; font-weight: 600; }
.tm-bspce-table :is(.tm-bspce-net, tfoot) th:first-child { padding-left: .75rem; }
.tm-bspce-table .tm-bspce-negative { color: var(--bspce-error); }
.tm-bspce-mobile { display: none; }
.tm-bspce-result-note { max-width: 80ch; margin-top: 1rem; color: hsl(var(--muted-foreground)); font-size: .8125rem; line-height: 1.65; }
.tm-bspce-loss-note { max-width: 80ch; margin-top: 1rem; font-size: .875rem; line-height: 1.65; }
.tm-bspce-limits { margin-top: 1.5rem; max-width: 90ch; }
.tm-bspce-limits h2 { font-size: .875rem; font-weight: 600; }
.tm-bspce-limits p { color: hsl(var(--muted-foreground)); font-size: .8125rem; line-height: 1.75; margin-top: .5rem; }
.tm-bspce-newsletter { display: grid; gap: 1.5rem; align-items: center; padding: 2rem 0; margin: 3rem 0; border-top: 1px solid hsl(var(--border)); border-bottom: 1px solid hsl(var(--border)); }
.tm-bspce-newsletter .tm-bspce-eyebrow { margin-bottom: .75rem; }
.tm-bspce-newsletter h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
.tm-bspce-newsletter p:not(.tm-bspce-eyebrow) { margin-top: 1rem; max-width: 62ch; font-size: 1rem; line-height: 1.75; color: hsl(var(--muted-foreground)); }
.tm-bspce-newsletter a { display: inline-flex; align-items: center; min-height: 2.75rem; margin-top: .5rem; font-size: .875rem; }
.tm-bspce-newsletter-form { min-width: 0; }
.tm-bspce-newsletter-form .jc-newsletter-form { grid-template-columns: minmax(0, 1fr); }
.tm-bspce-newsletter-form .jc-newsletter-form .sib-form-block__button { width: 100%; }
.tm-bspce-guide-layout { display: grid; gap: 2.5rem; min-width: 0; }
.tm-bspce-guide-nav { display: flex; flex-wrap: wrap; align-content: start; align-items: start; column-gap: 1.5rem; border-bottom: 1px solid hsl(var(--border)); padding-bottom: 1.5rem; }
.tm-bspce-guide-nav p { width: 100%; margin-bottom: .5rem; font-size: .875rem; font-weight: 600; }
.tm-bspce-guide-nav a { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: .875rem; line-height: 1.5; }
.tm-bspce-guide { min-width: 0; }
.tm-bspce-guide section + section { margin-top: 3rem; }
.tm-bspce-guide h2 { margin-bottom: 1.5rem; font-size: clamp(1.5rem, 1.2rem + .7vw, 1.875rem); line-height: 1.25; font-weight: 600; }
.tm-bspce-guide h3 { margin-top: 1.5rem; margin-bottom: .75rem; font-size: 1.125rem; line-height: 1.5; font-weight: 600; }
.tm-bspce-guide p + p, .tm-bspce-guide :is(ul, ol, dl) + p { margin-top: 1rem; }
.tm-bspce-guide ul { list-style: disc; padding-left: 1.25rem; margin-top: 1rem; }
.tm-bspce-guide li + li { margin-top: .5rem; }
.tm-bspce-steps { list-style: decimal; padding-left: 1.5rem; margin-top: 1.5rem; }
.tm-bspce-steps li { padding-left: .5rem; }
.tm-bspce-steps li::marker { color: var(--bspce-link); font-weight: 600; }
.tm-bspce-steps h3 { margin-bottom: .5rem; }
.tm-bspce-steps p { margin: 0; }
.tm-bspce-formulas { margin-top: 1.5rem; border-top: 1px solid hsl(var(--border)); font-size: 1rem; line-height: 1.75; }
.tm-bspce-formulas div { padding: 1rem 0; border-bottom: 1px solid hsl(var(--border)); }
.tm-bspce-formulas dt { font-weight: 600; }
.tm-bspce-formulas dd { margin-top: .25rem; color: hsl(var(--muted-foreground)); }
.tm-bspce-faq details { border-top: 1px solid hsl(var(--border)); }
.tm-bspce-faq details:last-child { border-bottom: 1px solid hsl(var(--border)); }
.tm-bspce-faq summary { cursor: pointer; padding: 1rem 0; font-size: 1rem; font-weight: 500; line-height: 1.6; }
.tm-bspce-faq summary::marker { color: var(--bspce-link); }
.tm-bspce-faq details p { margin: 0 0 1.5rem; }
.tm-bspce-sources { border-top: 1px solid hsl(var(--border)); padding-top: 2rem; }
.tm-bspce-sources p, .tm-bspce-sources ul { font-size: .875rem; line-height: 1.75; color: hsl(var(--muted-foreground)); }
.tm-bspce-sources a { overflow-wrap: anywhere; }
@media (min-width: 520px) {
  .tm-bspce-price-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .tm-bspce-price-pair label { min-height: 2.625rem; }
  .tm-bspce-scenario-field { display: grid; grid-template-columns: minmax(0, 1fr) 9rem; column-gap: 1.5rem; align-items: center; }
  .tm-bspce-scenario-field label { margin-bottom: 0; }
  .tm-bspce-scenario-field > p { grid-column: 2; }
}
@media (min-width: 900px) {
  .tm-bspce-form-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .tm-bspce-shared, .tm-bspce-scenarios { padding: 2rem; }
  .tm-bspce-scenarios { border-top: 0; border-left: 1px solid hsl(var(--border)); }
  .tm-bspce-scenario-field { margin-top: 1.75rem; }
  .tm-bspce-scenario-field > p { grid-column: 1 / -1; }
  .tm-bspce-calculator-heading, .tm-bspce-form-footer, .tm-bspce-results, .tm-bspce-empty { padding: 1.5rem 2rem; }
  .tm-bspce-timeline { padding-right: 2rem; padding-left: 2rem; }
  .tm-bspce-newsletter { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 4rem; padding: 2.5rem 0; margin: 4rem 0; }
  .tm-bspce-guide-layout { grid-template-columns: 13rem minmax(0, 1fr); column-gap: 4rem; }
  .tm-bspce-guide-nav { display: flex; flex-direction: column; border: 0; }
  .tm-bspce-guide-nav a { padding: .5rem 0; }
}
@media (max-width: 519px) {
  .tm-bspce-calculator-heading, .tm-bspce-shared, .tm-bspce-scenarios, .tm-bspce-form-footer, .tm-bspce-results, .tm-bspce-empty { padding: 1.25rem; }
  .tm-bspce-timeline { padding-right: 1.25rem; padding-left: 1.25rem; }
  .tm-bspce-actions { align-items: stretch; }
  .tm-bspce-actions button { flex: 1 0 100%; }
}
@media (max-width: 767px) {
  .tm-bspce-table { display: none; }
  .tm-bspce-mobile { display: grid; gap: 1.5rem; }
  .tm-bspce-mobile-scenario { min-width: 0; padding-bottom: 1.5rem; border-bottom: 1px solid hsl(var(--border)); }
  .tm-bspce-mobile-scenario h3 { font-size: 1rem; font-weight: 600; }
  .tm-bspce-mobile-price { margin-top: .25rem; color: hsl(var(--muted-foreground)); font-size: .875rem; overflow-wrap: anywhere; }
  .tm-bspce-mobile-net { margin: 1rem 0 .5rem; padding: .875rem; background: hsl(var(--muted)); }
  .tm-bspce-mobile-net dt { font-size: .8125rem; line-height: 1.5; }
  .tm-bspce-mobile-net dd { margin-top: .375rem; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .tm-bspce-mobile summary { min-height: 2.75rem; padding: .75rem 0; color: var(--bspce-link); cursor: pointer; font-size: .875rem; }
  .tm-bspce-mobile-breakdown > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 0; border-bottom: 1px solid hsl(var(--border)); font-size: .8125rem; }
  .tm-bspce-mobile-breakdown dt { flex: 1 1 8rem; color: hsl(var(--muted-foreground)); }
  .tm-bspce-mobile-breakdown dd { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .tm-bspce-mobile .tm-bspce-negative { color: var(--bspce-error); }
}
@media (prefers-reduced-motion: reduce) {
  .tm-bspce * { scroll-behavior: auto; transition: none; }
}
