/* Financial Benchmarks Phase 4: emergency-savings Resilience analysis */

.bm4r-analysis {
  display: grid;
  max-width: 1100px;
  margin: 0 auto 32px;
  padding: 0 20px;
  gap: 18px;
}

.bm4r-view-stack {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.bm4r-view-stack[hidden] {
  display: none !important;
}

.bm4r-cohort-status {
  padding: 12px 14px;
  border: 1px solid rgba(119, 215, 204, 0.28);
  border-left: 4px solid #2a9d8f;
  border-radius: 9px;
  background: rgba(42, 157, 143, 0.09);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.84rem;
  line-height: 1.55;
}

.bm4r-cohort-status[data-state="unavailable"],
.bm4r-cohort-status[data-state="rejected"] {
  border-color: rgba(230, 149, 58, 0.4);
  border-left-color: #e6953a;
  background: rgba(230, 149, 58, 0.09);
}

.bm4r-view {
  min-width: 0;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 16px 38px rgba(7, 14, 30, 0.14);
}

.bm4r-view[data-bm4r-view="national-peers"] {
  border-color: rgba(119, 215, 204, 0.24);
  background:
    radial-gradient(
      circle at 8% 4%,
      rgba(42, 157, 143, 0.18),
      transparent 34%
    ),
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.055),
      rgba(13, 24, 47, 0.7)
    );
}

.bm4r-view-header {
  max-width: 820px;
  margin-bottom: 20px;
}

.bm4r-view-header > p:first-child {
  margin: 0 0 8px;
  color: #8ce8dd;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bm4r-view-header h2,
.bm4r-view > h2 {
  margin: 0;
  color: #f3f7fb;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.2;
}

.bm4r-view-header > p:last-child,
.bm4r-view > p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.88rem;
  line-height: 1.62;
}

.bm4r-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.bm4r-module {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(7, 15, 31, 0.48);
}

.bm4r-module[data-state="not_conditioned"] {
  border-color: rgba(119, 215, 204, 0.34);
}

.bm4r-module-header {
  padding: 20px 20px 0;
}

.bm4r-module-header > p:first-child {
  margin: 0 0 9px;
  color: #8ce8dd;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bm4r-module h3 {
  margin: 0;
  color: #f3f7fb;
  font-family: var(--font-display);
  font-size: 1.16rem;
  line-height: 1.3;
}

.bm4r-module-header > p:last-child {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.79rem;
  line-height: 1.55;
}

.bm4r-key-result {
  margin: 17px 20px 0;
  padding: 16px;
  border: 1px solid rgba(42, 157, 143, 0.28);
  border-radius: 13px;
  background: linear-gradient(
    135deg,
    rgba(42, 157, 143, 0.15),
    rgba(42, 157, 143, 0.04)
  );
}

.bm4r-key-result > span {
  display: block;
  color: rgba(255, 255, 255, 0.73);
  font-size: 0.73rem;
  line-height: 1.52;
}

.bm4r-key-result > span:first-child {
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
}

.bm4r-key-result > strong {
  display: block;
  margin: 5px 0 4px;
  color: #f4fbfa;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.4vw, 2.1rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bm4r-scope {
  margin: 12px 20px 0;
  padding-left: 11px;
  border-left: 3px solid rgba(140, 232, 221, 0.55);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.74rem;
  line-height: 1.55;
}

.bm4r-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 20px 0;
}

.bm4r-meta div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.bm4r-meta dt {
  margin-bottom: 3px;
  color: #8ce8dd;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bm4r-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.7rem;
  line-height: 1.42;
}

.bm4r-table-region {
  max-width: 100%;
  overflow-x: auto;
  margin-top: 17px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  scrollbar-color: rgba(119, 215, 204, 0.55) rgba(255, 255, 255, 0.05);
}

.bm4r-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
}

.bm4r-table caption {
  padding: 14px 20px 10px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
  text-align: left;
}

.bm4r-table th,
.bm4r-table td {
  padding: 10px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: right;
}

.bm4r-table th:first-child,
.bm4r-table td:first-child {
  text-align: left;
}

.bm4r-table thead th {
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.67rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.bm4r-method {
  margin: 16px 20px 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.bm4r-method summary {
  color: #baf3ec;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.bm4r-method p {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  line-height: 1.55;
}

.bm4r-module-footer {
  padding: 16px 20px 20px;
}

.bm4r-module-footer p {
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.71rem;
  line-height: 1.5;
}

.bm4r-module-footer a,
.bm4r-view li a {
  color: #8ce8dd;
}

.bm4r-view > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 0 0;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.bm4r-table-region:focus-visible,
.bm4r-method summary:focus-visible,
.bm4r-view a:focus-visible {
  outline: 3px solid #8ce8dd;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .bm4r-module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .bm4r-analysis {
    padding: 0 14px;
  }

  .bm4r-view {
    padding: 18px 14px;
  }

  .bm4r-meta {
    grid-template-columns: 1fr;
  }

  .bm4r-module-header,
  .bm4r-module-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .bm4r-key-result,
  .bm4r-scope,
  .bm4r-meta,
  .bm4r-method {
    margin-left: 16px;
    margin-right: 16px;
  }
}

@media (forced-colors: active) {
  .bm4r-view,
  .bm4r-module,
  .bm4r-key-result,
  .bm4r-cohort-status {
    border: 1px solid CanvasText;
  }
}

@media print {
  .bm4r-analysis {
    display: block;
    max-width: none;
    margin: 20px 0;
    padding: 0;
  }

  .bm4r-view-stack,
  .bm4r-module-grid {
    display: block !important;
  }

  .bm4r-view,
  .bm4r-module {
    break-inside: avoid;
    margin-bottom: 16px;
    box-shadow: none;
  }

  .bm4r-table {
    min-width: 0;
  }

  .bm4r-table-region {
    overflow: visible;
  }

  .bm4r-method > * {
    display: block !important;
  }
}

/*
 * Benchmarks presentation hotfix
 *
 * The benchmark modules intentionally use light type. Keep the complete page on
 * the same navy canvas in both OS color schemes so global light-theme rules
 * cannot place that type on a white surface. This final-loaded stylesheet also
 * owns the two shared, script-injected page components used on this route.
 */
html {
  background: #1b2a4a;
}

body,
#main-content {
  background: #1b2a4a !important;
}

#main-content {
  --teal: #8ce8dd;
  min-width: 0;
  overflow-x: clip;
  color: #d4dde9;
}

/* Preserve the dark information hierarchy and strengthen quiet copy. */
#main-content :where(h1, h2, h3, h4) {
  color: #f4f7fb;
}

#main-content :where(
  .bm-hero .sub,
  .bm3-filter-help,
  .bm-method-summary-meta,
  .bm-comm-footnote,
  .bm-journey-title,
  .bm-journey-cats,
  .bm-card-step-desc,
  .bm-active-bracket,
  .bm-big-label,
  .bm-row .label,
  .bm-source,
  .bm-ptext,
  .bm-methodology p,
  .bm-midpromo-sub,
  .bm-midpromo-secondary,
  .bm-consol-personal,
  .bm-consol-feat span,
  .bm-consol-secondary,
  .bm-last-updated,
  .bm-ach-progress,
  .bm-ach-desc,
  .bm-ach-footer,
  .bm-you-pctl-label,
  .bm-you-insight,
  .bm-aff-row .aff-detail,
  .bm-aff-note,
  .bm-no-data p,
  .bm-email label,
  .bm-delta-item .cat,
  .bm-premium-cta span,
  .bm-peer-inner .peer-reset,
  .bm-digest-inner p,
  .bm-pdf-inner p,
  .bm-pulse-item,
  .bm-pulse-item .time,
  .bm-integrity-state p,
  .bm-definition,
  .bm-row-context,
  .bm-integrity-fact span
) {
  color: #c5d0de !important;
}

#main-content :where(.bm3-dashboard, [class$="-analysis"])
  :where(p, li, dd, caption) {
  color: #d4dde9;
}

#main-content :where(
  .bm3-eyebrow,
  .bm3-module-kicker > span:first-child,
  [class$="-view-header"] > p:first-child,
  [class$="-module-kicker"] > span:first-child,
  [class$="-module-header"] > p:first-child,
  [class$="-meta"] dt
) {
  color: #8ce8dd;
}

#main-content :where(
  .bm-method-summary-text strong,
  .bm-method-chevron,
  .bm-comm-footnote-icon,
  .bm-journey-title strong,
  .bm-bracket-text strong,
  .bm-hero-echo-prefix,
  .bm-hero-grade strong,
  .bm-hero-pro-link,
  .bm-midpromo-sub strong,
  .bm-consol-personal strong,
  .bm-ach-progress strong,
  .bm-ach-footer a,
  .bm-ach-footer.bm-ach-complete
),
#main-content [style*="color:#2a9d8f"] {
  color: #8ce8dd !important;
}

#main-content .bm-card-step[data-group="foundation"] .bm-card-step-label {
  color: #8ce8dd;
}

#main-content .bm-card-step[data-group="cashflow"] .bm-card-step-label {
  color: #9cc7ff;
}

#main-content .bm-card-step[data-group="debt"] .bm-card-step-label {
  color: #f2b76f;
}

#main-content .bm-card-step[data-group="wealth"] .bm-card-step-label {
  color: #c9b3f5;
}

#main-content .bm-card-step[data-group="future"] .bm-card-step-label {
  color: #ffad9c;
}

#main-content :where(.bench-tick.up.good, .bench-tick.down.good) {
  color: #86d7ad;
}

#main-content :where(.bench-tick.up.bad, .bench-tick.down.bad) {
  color: #ff9c87;
}

#main-content :where(.bench-tick.up.neutral, .bench-tick.down.neutral) {
  color: #c5d0de;
}

#main-content .bm-card-header .bm-expand {
  color: #c5d0de !important;
}

#main-content [class$="-module"] {
  border-color: rgba(184, 196, 212, 0.28);
  background-color: #12203e !important;
}

#main-content :where(.bm3-dashboard-head, [class$="-view"]) {
  border-color: rgba(184, 196, 212, 0.26);
}

/* The two hand-authored account CTA cards use light-theme inline tokens. */
#main-content :where(
  a[href$="/my-finances"],
  a[href$="/financial-checkup"]
) {
  border-color: rgba(140, 232, 221, 0.34) !important;
  background: #12203e !important;
}

#main-content :where(
  a[href$="/my-finances"],
  a[href$="/financial-checkup"]
):hover {
  border-color: #8ce8dd !important;
}

#main-content :where(
  a[href$="/my-finances"],
  a[href$="/financial-checkup"]
) > div strong {
  color: #f4f7fb !important;
}

#main-content :where(
  a[href$="/my-finances"],
  a[href$="/financial-checkup"]
) > p {
  color: #c5d0de !important;
}

#main-content :where(
  a[href$="/my-finances"],
  a[href$="/financial-checkup"]
) > span {
  color: #8ce8dd !important;
}

/* Dense evidence labels remain compact, but no longer drop below 11.2px. */
#main-content [class$="-meta"] dt,
#main-content :where([class$="-table"] thead th) {
  font-size: 0.7rem;
}

#main-content [class$="-meta"] dd,
#main-content :where([class$="-table"] caption) {
  font-size: 0.76rem;
}

#main-content [class$="-table"] {
  font-size: 0.78rem;
}

#main-content [class$="-scope"],
#main-content [class$="-module-footer"],
#main-content :where([class$="-module-footer"] p),
#main-content :where([class$="-method"] summary),
#main-content :where([class$="-method"] p) {
  font-size: 0.8rem;
}

/* Inputs keep a visible 3:1+ boundary and readable placeholder text. */
#main-content :where(select, input[type="email"], input[type="text"]) {
  border-color: #71809a;
  background: #12203e;
  color: #f4f7fb;
}

#main-content :where(input[type="email"], input[type="text"])::placeholder {
  color: #b8c4d4;
  opacity: 1;
}

/* White button text requires a darker teal than teal used as inline text. */
#main-content :where(
  .bm-personalize button,
  .bm-related a,
  .bm-you-actions a,
  .bm-pctl-calcs a,
  .p-ev-calc,
  .bm-no-data a,
  .bm-stale-inner a,
  .bm-email button,
  .bm-aff-row .aff-cta,
  .bm-premium-cta a,
  .bm-pdf-inner button,
  .bm-midpromo-cta,
  .bm-consol-cta,
  .bm-share-btn,
  .bm-floating-pill
) {
  border-color: #23796f !important;
  background: #23796f !important;
  color: #fff !important;
}

#main-content :where(
  .bm-personalize button,
  .bm-related a,
  .bm-you-actions a,
  .bm-pctl-calcs a,
  .p-ev-calc,
  .bm-no-data a,
  .bm-stale-inner a,
  .bm-email button,
  .bm-aff-row .aff-cta,
  .bm-premium-cta a,
  .bm-pdf-inner button,
  .bm-midpromo-cta,
  .bm-consol-cta,
  .bm-share-btn,
  .bm-floating-pill
):hover {
  border-color: #1f746a !important;
  background: #1f746a !important;
}

/* Shared metadata inserted beneath the page hero. */
.fc-trust-badge {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  float: none !important;
  box-sizing: border-box;
  display: flex !important;
  width: fit-content !important;
  max-width: min(760px, calc(100% - 32px)) !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px 10px;
  margin: 14px auto 0 !important;
  color: #d4dde9 !important;
  text-align: center !important;
  flex-wrap: wrap;
}

.fc-trust-badge :where(span, time) {
  color: #d4dde9 !important;
}

.fc-trust-badge a {
  color: #8ce8dd !important;
}

/* Shared Financial Pulse CTA: a contained card, never a viewport-wide band. */
.fc-newsletter-cta {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  box-sizing: border-box !important;
  width: min(1100px, calc(100% - 40px)) !important;
  max-width: 1100px !important;
  margin: 32px auto !important;
  padding: clamp(24px, 4vw, 40px) !important;
  overflow: hidden;
  border: 1px solid rgba(140, 232, 221, 0.34) !important;
  border-radius: 18px !important;
  background: #12203e !important;
  color: #d4dde9 !important;
  box-shadow: 0 16px 38px rgba(7, 14, 30, 0.24) !important;
}

.fc-newsletter-cta :where(h2, h3, strong, label) {
  color: #f4f7fb !important;
}

.fc-newsletter-cta :where(p, small, span) {
  color: #d4dde9 !important;
}

.fc-newsletter-cta a {
  color: #8ce8dd !important;
}

.fc-newsletter-cta > div {
  box-sizing: border-box;
  max-width: 960px;
  margin-right: auto;
  margin-left: auto;
  flex-wrap: wrap;
}

.fc-newsletter-cta form {
  box-sizing: border-box;
  display: flex;
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
  gap: 10px;
  flex-wrap: wrap;
}

.fc-newsletter-cta :where(input, button) {
  min-height: 44px;
  border-radius: 10px !important;
}

.fc-newsletter-cta input {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 240px;
  border: 1px solid #71809a !important;
  background: #0d1830 !important;
  color: #f4f7fb !important;
}

.fc-newsletter-cta input::placeholder {
  color: #b8c4d4 !important;
  opacity: 1;
}

.fc-newsletter-cta button,
.fc-newsletter-cta button :where(span, strong) {
  border-color: #23796f !important;
  background: #23796f !important;
  color: #fff !important;
}

@media (prefers-color-scheme: light) {
  html,
  body,
  #main-content {
    background: #1b2a4a !important;
    color: #d4dde9;
  }
}

@media (max-width: 600px) {
  #main-content div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .fc-newsletter-cta {
    width: calc(100% - 28px) !important;
    margin: 24px auto !important;
    padding: 22px 18px !important;
  }

  .fc-trust-badge {
    width: calc(100% - 28px);
    max-width: none;
  }

  .fc-newsletter-cta form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .fc-newsletter-cta :where(input, button) {
    width: 100%;
  }
}

@media (forced-colors: active) {
  html,
  body,
  #main-content,
  .fc-newsletter-cta {
    background: Canvas !important;
    color: CanvasText !important;
  }

  .fc-newsletter-cta,
  .fc-trust-badge,
  #main-content :where(select, input, button) {
    border: 1px solid CanvasText !important;
  }
}
