/*
 * Legacy editorial interface layer.
 * Font declarations moved to v2-foundation.css in V2 Phase 2.
 */

body.editorial-ui {
  color-scheme: light;
  --paper: #f2ebdd;
  --paper-raised: #fbf7ee;
  --paper-deep: #e5dac8;
  --paper-blue: #e3ebe8;
  --paper-rust: #f0ddd1;
  --ink: #0a2e4d;
  --ink-soft: #4f5652;
  --ink-faint: #666963;
  --line: #b8ad9b;
  --line-strong: #746b5e;
  --control-line: #8b8172;
  --navy: #0a2e4d;
  --navy-2: #104c67;
  --rust: #a9431f;
  --rust-display: #c65b32;
  --teal: #0b626b;
  --plum: #6a4356;
  --ochre: #7a4d12;
  --focus: #006c75;
  --surface: var(--paper-raised);
  --surface-soft: #eee6d8;
  --shadow-soft: 0 2px 0 rgba(10, 46, 77, .08), 0 12px 28px rgba(55, 43, 28, .06);
  --shadow-lift: 0 2px 0 rgba(10, 46, 77, .10), 0 18px 40px rgba(55, 43, 28, .09);
  --radius-sm: 2px;
  --radius-md: 5px;
  --radius-lg: 9px;
  --radius-xl: 12px;
  --font-ui: "Studio Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-display: "Studio Condensed", Impact, Haettenschweiler, "Arial Narrow Bold", "Aptos Narrow", "Helvetica Neue Condensed", sans-serif;
  --font-editorial: "Studio Serif", Georgia, Cambria, "Times New Roman", serif;
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 15% -5%, rgba(198, 91, 50, .045), transparent 42rem),
    linear-gradient(var(--paper), var(--paper));
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  isolation: isolate;
}

body.editorial-ui::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background:
    repeating-linear-gradient(7deg, rgba(10, 46, 77, .018) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(93deg, rgba(169, 67, 31, .014) 0 1px, transparent 1px 11px),
    radial-gradient(circle, rgba(10, 46, 77, .025) 0 .7px, transparent .8px);
  background-size: 137px 83px, 109px 97px, 4px 4px;
  content: "";
  opacity: .55;
  pointer-events: none;
}

body.editorial-ui .app-shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - clamp(32px, 6vw, 96px)));
  margin: 0 auto;
  padding: 0 0 38px;
}

body.editorial-ui :where(button, input, select, textarea, summary) {
  font-family: var(--font-ui);
}

body.editorial-ui :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  min-height: 44px;
  font-size: 1rem;
}

body.editorial-ui :where(button, [role="button"], summary, .nav-action, .module-learn-shortcut, .module-research-link) {
  min-height: 44px;
}

body.editorial-ui :where(input, output, .hero-result-value, .result-metric strong, .plan-summary-value, .home-primary-metrics strong) {
  font-variant-numeric: lining-nums tabular-nums;
}

body.editorial-ui :where(button, input, select, summary, a):focus-visible {
  outline: 3px solid var(--focus) !important;
  outline-offset: 3px;
}

body.editorial-ui .mini-switch input:focus-visible + i {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

body.editorial-ui .skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: var(--paper-raised);
  border-radius: 3px;
  background: var(--navy);
  font-weight: 750;
  transform: translateY(-150%);
}

body.editorial-ui .skip-link:focus {
  transform: translateY(0);
}

/* Persistent navigation */
body.editorial-ui .site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: 66px;
  margin: 0 0 34px;
  padding: 10px 0 8px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(242, 235, 221, .97);
}

body.editorial-ui .site-name {
  margin: 0;
  color: var(--ink-soft);
  font-size: .75rem;
  font-weight: 760;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

body.editorial-ui .primary-nav {
  display: flex;
  min-width: 0;
  align-items: stretch;
  justify-content: flex-end;
  gap: clamp(8px, 2.2vw, 32px);
}

body.editorial-ui .nav-action {
  position: relative;
  display: inline-flex;
  min-width: 0;
  padding: 9px 3px 7px;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: .82rem;
  font-weight: 760;
  letter-spacing: .035em;
  text-decoration: none;
  white-space: nowrap;
}

body.editorial-ui .nav-action::after {
  position: absolute;
  right: 0;
  bottom: -9px;
  left: 0;
  height: 3px;
  background: transparent;
  content: "";
}

body.editorial-ui .nav-action:hover::after,
body.editorial-ui .nav-action:focus-visible::after,
body.editorial-ui .nav-action[aria-current="page"]::after,
body.editorial-ui .nav-action[data-view="modules"]::after {
  background: var(--rust);
}

body.editorial-ui:has(#plan-view:not([hidden])) .nav-action[data-view="modules"]::after,
body.editorial-ui:has(#risk-view:not([hidden])) .nav-action[data-view="modules"]::after {
  background: transparent;
}

body.editorial-ui:has(#plan-view:not([hidden])) .nav-action[data-view="plan"]::after,
body.editorial-ui:has(#risk-view:not([hidden])) .nav-action[data-view="risk"]::after {
  background: var(--rust);
}

/* Landing page */
body.editorial-ui .landing-view {
  width: min(1120px, 100%);
  margin: 0 auto;
}

body.editorial-ui .decision-hero {
  padding: clamp(18px, 4vh, 48px) 0 clamp(24px, 4vh, 44px);
  text-align: center;
}

body.editorial-ui .editorial-meta {
  margin: 0 0 14px;
  color: var(--teal);
  font-size: .75rem;
  font-weight: 780;
  letter-spacing: .12em;
  text-transform: uppercase;
}

body.editorial-ui .decision-hero h1,
body.editorial-ui .module-intro h1,
body.editorial-ui .combined-heading :is(h1, h2),
body.editorial-ui #risk-lab-root h1 {
  font-family: var(--font-display);
  font-stretch: condensed;
  font-weight: 800;
  text-transform: uppercase;
}

body.editorial-ui .decision-hero h1 {
  max-width: 900px;
  margin: 0 auto;
  color: var(--navy);
  font-size: clamp(3.6rem, 8.3vw, 7.4rem);
  letter-spacing: -.025em;
  line-height: .88;
  text-wrap: balance;
}

body.editorial-ui .decision-lead {
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-family: var(--font-editorial);
  font-size: clamp(1rem, 1.7vw, 1.28rem);
}

body.editorial-ui .landing-decision-layout {
  display: grid;
  gap: 22px;
}

body.editorial-ui .calculator-directory {
  display: grid;
  gap: 12px;
}

body.editorial-ui .quick-calculator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

body.editorial-ui .quick-calculator-grid :is(.quick-action-grid, .directory-grid) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.editorial-ui .quick-calculator-grid .module-card {
  position: relative;
  display: block;
  min-height: 164px;
  aspect-ratio: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 247, 238, .82);
  box-shadow: var(--shadow-soft);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

body.editorial-ui .quick-calculator-grid .module-card::after {
  display: none;
}

body.editorial-ui .quick-calculator-grid .module-card:hover {
  border-color: var(--accent-dark);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

body.editorial-ui .quick-calculator-grid .module-card-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--accent-dark);
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

body.editorial-ui .quick-calculator-grid .module-card-icon svg {
  width: 29px;
  height: 29px;
}

body.editorial-ui .quick-calculator-grid .module-card-plan-toggle {
  display: none;
}

body.editorial-ui .quick-calculator-grid .module-open {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 162px;
  padding: 22px 23px;
  grid-template-columns: 58px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 17px;
  color: inherit;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

body.editorial-ui .quick-calculator-grid .module-open::after {
  display: none;
}

body.editorial-ui .quick-calculator-grid .module-card-body {
  display: block;
  min-width: 0;
}

body.editorial-ui .quick-calculator-grid .module-card-arrow {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--rust);
}

body.editorial-ui .quick-calculator-grid .module-card-arrow svg {
  width: 22px;
  height: 22px;
}

body.editorial-ui .quick-calculator-grid .module-card-title {
  margin: 0 0 8px;
  color: var(--navy);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-stretch: condensed;
  font-weight: 800;
  letter-spacing: .005em;
  line-height: 1;
  text-transform: uppercase;
}

body.editorial-ui .quick-calculator-grid .module-card-question {
  max-width: 37ch;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.4;
}

body.editorial-ui .quick-calculator-grid .calculator-directory {
  display: grid;
  width: 100%;
  gap: 13px;
  justify-self: center;
  color: var(--rust);
  text-align: center;
}

body.editorial-ui .quick-calculator-grid .calculator-directory summary {
  display: inline-flex;
  width: fit-content;
  margin: 0 auto;
  padding: 8px 12px;
  align-items: center;
  gap: 9px;
  color: var(--rust);
  list-style: none;
  font-size: .92rem;
  font-weight: 760;
}

body.editorial-ui .quick-calculator-grid .calculator-directory summary::-webkit-details-marker { display: none; }
body.editorial-ui .quick-calculator-grid .calculator-directory summary::after { content: "↓"; }
body.editorial-ui .quick-calculator-grid .calculator-directory[open] summary::after { content: "↑"; }

body.editorial-ui .quick-calculator-grid .directory-card {
  min-height: 184px;
}

body.editorial-ui .quick-calculator-grid .directory-card .module-open {
  min-height: 182px;
  padding-bottom: 55px;
}

body.editorial-ui .quick-calculator-grid .directory-card .module-research-link {
  position: absolute;
  z-index: 3;
  right: auto;
  bottom: 13px;
  left: 98px;
  display: inline-flex;
  min-height: 34px;
  padding: 5px 8px;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: .78rem;
}

body.editorial-ui :is(.connected-plan-promo, .quick-calculator-grid .connected-plan-card) {
  display: grid;
  width: min(100%, 810px);
  min-height: 150px;
  margin: 2px auto 0;
  padding: 22px 26px;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 247, 238, .86);
  box-shadow: var(--shadow-soft);
}

body.editorial-ui .connected-plan-icon,
body.editorial-ui .quick-calculator-grid .connected-plan-card > .module-card-icon {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 50%;
}

body.editorial-ui .connected-plan-icon svg,
body.editorial-ui .quick-calculator-grid .connected-plan-card > .module-card-icon svg { width: 36px; height: 36px; }
body.editorial-ui .connected-plan-promo h2,
body.editorial-ui .quick-calculator-grid .connected-plan-card strong {
  margin: 0;
  color: var(--navy);
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.5vw, 2.15rem);
  font-stretch: condensed;
  line-height: 1;
  text-transform: uppercase;
}
body.editorial-ui .connected-plan-promo p,
body.editorial-ui .quick-calculator-grid .connected-plan-card p { margin: 6px 0 13px; color: var(--ink-soft); font-size: .95rem; }
body.editorial-ui .connected-plan-promo small { display: block; margin-top: 8px; color: var(--ink-soft); font-size: .78rem; }

body.editorial-ui .quick-calculator-grid .connected-plan-card .primary-button {
  white-space: nowrap;
}

body.editorial-ui .editorial-landscape {
  position: relative;
  min-height: clamp(255px, 29vw, 390px);
  margin: 24px calc(-1 * clamp(16px, 2.5vw, 34px)) 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
}

body.editorial-ui .editorial-word {
  position: absolute;
  z-index: 0;
  top: clamp(-8px, 1vw, 12px);
  left: 50%;
  width: 100%;
  color: transparent;
  background:
    radial-gradient(circle, rgba(242, 235, 221, .32) 0 .7px, transparent .9px),
    linear-gradient(var(--rust-display), var(--rust-display));
  background-size: 4px 4px, auto;
  background-clip: text;
  -webkit-background-clip: text;
  font-family: var(--font-display);
  font-size: clamp(8rem, 21vw, 18rem);
  font-stretch: condensed;
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: .8;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
}

body.editorial-ui .editorial-landscape > svg {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 88%;
}

body.editorial-ui .landscape-layer-back { fill: #a9b7b2; opacity: .88; }
body.editorial-ui .landscape-layer-mid { fill: #557b83; opacity: .92; }
body.editorial-ui .landscape-layer-front { fill: var(--navy); }
body.editorial-ui .landscape-path { fill: none; stroke: var(--paper); stroke-width: 8; stroke-linecap: round; opacity: .9; }
body.editorial-ui .scale-figure { fill: var(--navy); stroke: var(--navy); stroke-width: 4; stroke-linecap: round; }

body.editorial-ui .landscape-caption {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 14px;
  margin: 0;
  color: var(--paper-raised);
  font-family: var(--font-editorial);
  font-size: .76rem;
  font-style: italic;
}

/* Make calculators, the plan, and risk fit independent pages even before the
   application router is refactored. */
body.editorial-ui:has(#module-view:not([hidden])) #modules-view,
body.editorial-ui:has(#plan-view:not([hidden])) #modules-view,
body.editorial-ui:has(#risk-view:not([hidden])) #modules-view {
  display: none;
}

body.editorial-ui .result-stage {
  margin: 0;
  padding: 0;
  border: 0;
}

body.editorial-ui .result-stage:not(:has(> section:not([hidden]))) {
  display: none;
}

body.editorial-ui :is(#module-view, #plan-view, #risk-view) {
  scroll-margin-top: 88px;
}

/* Shared calculator surface */
body.editorial-ui .module-intro {
  display: grid;
  margin: 0 0 22px;
  padding: 0 0 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  border-bottom: 1px solid var(--line-strong);
}

body.editorial-ui .module-identity {
  align-items: flex-start;
}

body.editorial-ui .module-large-icon {
  width: 58px;
  height: 58px;
  color: var(--accent-dark);
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

body.editorial-ui .module-intro h1 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: clamp(2.8rem, 5.7vw, 5.8rem);
  letter-spacing: -.02em;
  line-height: .9;
}

body.editorial-ui .module-intro p {
  max-width: 760px;
  margin: 0;
  color: var(--ink-soft);
  font-size: .95rem;
}

body.editorial-ui .module-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

body.editorial-ui .example-data-banner {
  display: grid;
  margin: -8px 0 18px;
  padding: 13px 15px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  color: var(--navy);
  border: 1px solid color-mix(in srgb, var(--accent, var(--teal)) 42%, var(--line));
  border-left: 4px solid var(--accent, var(--teal));
  border-radius: 4px;
  background: var(--accent-soft, var(--paper-teal));
}

body.editorial-ui .example-data-banner > span,
body.editorial-ui .example-data-banner svg {
  width: 25px;
  height: 25px;
}

body.editorial-ui .example-data-banner strong {
  font-family: var(--font-editorial);
  font-size: .95rem;
}

body.editorial-ui .example-data-banner p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: .79rem;
  line-height: 1.45;
}

body.editorial-ui .example-data-banner.is-review-note {
  border-color: color-mix(in srgb, var(--ochre) 42%, var(--line));
  background: color-mix(in srgb, var(--paper-ochre) 72%, var(--paper-raised));
}

body.editorial-ui .module-learn-shortcut,
body.editorial-ui .module-state {
  min-height: 44px;
  padding: 9px 12px;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(251, 247, 238, .88);
  font-size: .875rem;
  font-weight: 720;
  text-decoration: none;
}

body.editorial-ui .module-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

body.editorial-ui .module-shell[data-theme="events"] .module-workspace,
body.editorial-ui .module-shell[data-theme="home"] .module-workspace,
body.editorial-ui .module-shell[data-theme="budget"] .module-workspace {
  grid-template-columns: minmax(350px, 430px) minmax(0, 1fr);
}

body.editorial-ui :is(.input-panel, .module-result-panel, .plan-results) {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(251, 247, 238, .9);
  box-shadow: var(--shadow-soft);
}

body.editorial-ui .input-panel {
  overflow: hidden;
}

body.editorial-ui .module-result-panel,
body.editorial-ui .module-shell[data-theme="budget"] .module-result-panel,
body.editorial-ui .module-shell[data-theme="events"] .module-result-panel,
body.editorial-ui .module-shell[data-theme="home"] .module-result-panel {
  min-height: 650px;
  padding: clamp(22px, 2.4vw, 34px);
  color: var(--ink);
  border: 1px solid var(--line);
  background:
    linear-gradient(150deg, rgba(251, 247, 238, .96), rgba(242, 235, 221, .92));
  box-shadow: var(--shadow-soft);
}

body.editorial-ui .module-result-panel::after {
  display: none;
}

body.editorial-ui .panel-heading,
body.editorial-ui .form-section {
  padding: 21px 22px;
  border-color: rgba(116, 107, 94, .28);
}

body.editorial-ui .panel-heading h2,
body.editorial-ui .form-section-title,
body.editorial-ui .result-heading h2,
body.editorial-ui .home-result-top h2 {
  color: var(--navy);
}

body.editorial-ui .panel-heading h2 {
  font-size: 1.3rem;
}

body.editorial-ui :is(.panel-heading p, .field, .choice-label, .form-check, .form-note, .funding-control-note) {
  color: var(--ink-soft);
  font-size: .875rem;
}

body.editorial-ui .overline {
  color: var(--accent-dark, var(--teal));
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
}

body.editorial-ui .field-grid {
  gap: 13px;
}

body.editorial-ui .field input,
body.editorial-ui .field select,
body.editorial-ui .phase-row input,
body.editorial-ui .event-library-top input {
  min-height: 44px;
  color: var(--navy);
  border: 1px solid var(--control-line);
  border-radius: 4px;
  background: #fffdf7;
  font-size: 1rem;
  font-weight: 620;
}

body.editorial-ui .field input:focus,
body.editorial-ui .field select:focus {
  border-color: var(--focus);
  outline-color: var(--focus);
}

body.editorial-ui .field input[aria-invalid="true"] {
  border-color: var(--rust);
  outline-color: var(--rust);
  background: #fff7f1;
}

body.editorial-ui :is(
  .budget-detail-card-top input,
  .month-pattern input,
  .history-grid input,
  .allocation-input,
  .allocation-actions select
) {
  border-color: var(--control-line);
}

body.editorial-ui .field-feedback {
  display: block;
  margin-top: 5px;
  color: var(--rust);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.3;
}

body.editorial-ui .form-section-title small {
  color: var(--ink-soft);
  font-size: .66rem;
  font-weight: 650;
}

body.editorial-ui .comparison-baseline,
body.editorial-ui .event-baseline {
  background: color-mix(in srgb, var(--accent-soft, var(--paper-teal)) 52%, transparent);
  box-shadow: inset 4px 0 0 var(--accent, var(--teal));
}

body.editorial-ui .event-library-more {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
}

body.editorial-ui .event-library-more > summary {
  padding: 13px 0 3px;
  color: var(--navy);
  font-size: .78rem;
  font-weight: 780;
  cursor: pointer;
}

body.editorial-ui .event-library-more[open] > summary {
  margin-bottom: 10px;
}

body.editorial-ui .segmented {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--control-line);
  border-radius: 5px;
  background: var(--paper-deep);
}

body.editorial-ui .segment {
  min-height: 40px;
  color: var(--ink-soft);
  border-radius: 2px;
  font-size: .875rem;
}

body.editorial-ui .segment.active {
  color: var(--paper-raised);
  background: var(--navy);
  box-shadow: none;
}

body.editorial-ui .choice-button {
  min-height: 72px;
  color: var(--ink-soft);
  border: 1px solid var(--control-line);
  border-radius: 5px;
  background: #fffdf7;
}

body.editorial-ui .choice-button strong { color: var(--navy); font-size: .95rem; }
body.editorial-ui .choice-button span { font-size: .8rem; }
body.editorial-ui .choice-button.active {
  color: var(--accent-dark);
  border-color: var(--accent-dark);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-dark);
}

body.editorial-ui .assumptions {
  border-color: rgba(116, 107, 94, .3);
}

body.editorial-ui .assumptions summary {
  padding: 15px 22px;
  color: var(--navy);
  font-size: .9rem;
}

body.editorial-ui :is(.primary-button, .secondary-button, .inline-button, .back-button) {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 4px;
  font-size: .9rem;
  font-weight: 760;
  box-shadow: none;
}

body.editorial-ui .primary-button {
  color: var(--paper-raised);
  border: 1px solid var(--navy);
  background: var(--navy);
}

body.editorial-ui :is(.secondary-button, .inline-button, .back-button) {
  color: var(--navy);
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
}

/* Compatible module palettes: paper and navy stay constant; one ink changes. */
body.editorial-ui :is(.module-card[data-module="budget"], .module-shell[data-theme="budget"]) {
  --accent: #0b626b !important;
  --accent-dark: #0b5961 !important;
  --accent-soft: #dfeae4 !important;
  --accent-fade: #c6dcd5 !important;
}
body.editorial-ui :is(.module-card[data-module="home"], .module-shell[data-theme="home"]) {
  --accent: #a9431f !important;
  --accent-dark: #963a1b !important;
  --accent-soft: #f0ddd1 !important;
  --accent-fade: #e6c4b1 !important;
}
body.editorial-ui :is(.module-card[data-module="investing"], .module-shell[data-theme="investing"]) {
  --accent: #315e75 !important;
  --accent-dark: #23465a !important;
  --accent-soft: #e3eaed !important;
  --accent-fade: #c8d7dd !important;
}
body.editorial-ui :is(.module-card[data-module="safety"], .module-shell[data-theme="safety"]) {
  --accent: #165c70 !important;
  --accent-dark: #104a5b !important;
  --accent-soft: #dfe9e8 !important;
  --accent-fade: #c4d8d7 !important;
}
body.editorial-ui :is(.module-card[data-module="debt"], .module-shell[data-theme="debt"]) {
  --accent: #9d3d2b !important;
  --accent-dark: #843124 !important;
  --accent-soft: #f0ddd7 !important;
  --accent-fade: #e6c3ba !important;
}
body.editorial-ui :is(.module-card[data-module="goal"], .module-shell[data-theme="goal"]) {
  --accent: #7a4d12 !important;
  --accent-dark: #6b420f !important;
  --accent-soft: #eee3ca !important;
  --accent-fade: #dfcfaa !important;
}
body.editorial-ui :is(.module-card[data-module="events"], .module-shell[data-theme="events"]) {
  --accent: #6a4356 !important;
  --accent-dark: #593648 !important;
  --accent-soft: #eadde3 !important;
  --accent-fade: #d9c4ce !important;
}

/* Results and charts */
body.editorial-ui :is(
  .result-heading h2,
  .hero-result-value,
  .result-metric strong,
  .chart-title strong,
  .comparison-row > strong,
  .plan-result-top h2,
  .plan-summary-value,
  .plan-empty h2,
  .plan-key-metric strong,
  .plan-insight strong,
  .event-chart-heading strong,
  .event-contribution-list span strong,
  .event-plan-breakdown strong
) {
  color: var(--navy);
}

body.editorial-ui :is(
  .result-heading p,
  .hero-result-label,
  .hero-result-sub,
  .result-metric span,
  .result-metric small,
  .chart-legend,
  .meter-labels,
  .comparison-row > span,
  .comparison-row > strong small,
  .plan-result-top p,
  .plan-summary-label,
  .chart-interaction-hint,
  .plan-key-metric span,
  .timeline-event,
  .plan-insight span,
  .plan-insight small,
  .event-chart-heading span,
  .event-assumptions summary,
  .event-assumptions p
) {
  color: var(--ink-soft);
}

body.editorial-ui .hero-result-value {
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 680;
}

body.editorial-ui .result-metrics {
  border-color: rgba(116, 107, 94, .32);
}

body.editorial-ui .result-metric {
  border-color: rgba(116, 107, 94, .28);
}

body.editorial-ui .result-metric span,
body.editorial-ui .result-metric small,
body.editorial-ui .chart-legend,
body.editorial-ui .chart-interaction-hint {
  font-size: .8rem;
}

body.editorial-ui .probability-ring {
  background: conic-gradient(var(--accent) calc(var(--value, 0) * 1%), var(--paper-deep) 0);
}

body.editorial-ui .probability-ring-inner {
  color: var(--navy);
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1px var(--line);
}

body.editorial-ui .probability-ring strong { color: var(--navy); }
body.editorial-ui .probability-ring span { color: var(--ink-soft); }

body.editorial-ui .chart-legend i { background: var(--navy-2); }
body.editorial-ui .meter-fill { background: linear-gradient(90deg, var(--teal), var(--navy-2)); }
body.editorial-ui .comparison-fill { background: var(--navy-2); }
body.editorial-ui .plan-results {
  --accent: var(--navy-2);
  --accent-dark: var(--navy);
  --accent-soft: var(--paper-blue);
}

body.editorial-ui .budget-hero-result strong,
body.editorial-ui .budget-metrics strong,
body.editorial-ui .tradeoff-result strong,
body.editorial-ui .allocation-unassigned strong,
body.editorial-ui .budget-detail-callout strong {
  color: var(--teal);
}

body.editorial-ui .budget-chart-legend .income { color: var(--teal); }
body.editorial-ui .budget-chart-legend .spending { color: var(--rust); }
body.editorial-ui .budget-chart-legend .capacity { color: var(--navy-2); }

body.editorial-ui .home-chart-legend .equity i { background: var(--navy-2); }
body.editorial-ui .home-series.equity { fill: none; stroke: var(--navy-2); }
body.editorial-ui .home-end-dot.equity { fill: var(--navy-2); }
body.editorial-ui .home-chart-legend .net-equity i { background: var(--rust); }
body.editorial-ui .home-series.net-equity { fill: none; stroke: var(--rust); }
body.editorial-ui .home-end-dot.net-equity { fill: var(--rust); }
body.editorial-ui .home-chart-legend .cash i { background: var(--plum); }
body.editorial-ui .home-series.cash { fill: none; stroke: var(--plum); }
body.editorial-ui .home-end-dot.cash { fill: var(--plum); }

body.editorial-ui .module-learn-shortcut:hover {
  border-color: var(--teal);
  background: var(--paper-raised);
}

body.editorial-ui .privacy-controls button[aria-pressed="true"] {
  color: var(--teal);
  border-color: var(--teal);
  background: var(--paper-blue);
}

body.editorial-ui .insight-card,
body.editorial-ui .plan-guidance {
  color: var(--navy);
  border: 1px solid #9eb5ae;
  border-radius: 6px;
  background: var(--paper-blue);
  box-shadow: none;
}

body.editorial-ui .insight-card span,
body.editorial-ui .plan-guidance span { color: var(--teal); }
body.editorial-ui .insight-card p,
body.editorial-ui .plan-guidance p { color: var(--ink-soft); font-size: .875rem; }

body.editorial-ui .module-learning {
  gap: 14px;
  margin-top: 18px;
}

body.editorial-ui .learning-card {
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(251, 247, 238, .78);
}

body.editorial-ui .learning-card h3 { color: var(--navy); font-size: 1rem; }
body.editorial-ui .learning-card p,
body.editorial-ui .learning-card summary,
body.editorial-ui .learning-card a { font-size: .875rem; }
body.editorial-ui .learning-card a { color: var(--teal); }

/* Connected plan and money map */
body.editorial-ui .combined-heading {
  align-items: end;
  margin: 0 0 18px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line-strong);
}

body.editorial-ui .combined-heading :is(h1, h2) {
  margin: 3px 0 0;
  color: var(--navy);
  font-size: clamp(2.6rem, 5.4vw, 5.4rem);
  letter-spacing: -.02em;
  line-height: .9;
}

body.editorial-ui .plan-status {
  color: var(--ink-soft);
  font-size: .875rem;
}

body.editorial-ui .money-map:empty {
  display: none;
}

body.editorial-ui .money-map:not(:empty) {
  position: relative;
  display: grid;
  margin: 0 0 18px;
  padding: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(251, 247, 238, .76);
}

body.editorial-ui .money-map-intro,
body.editorial-ui .plan-quick-facts,
body.editorial-ui .plan-suggestion {
  grid-column: 1 / -1;
}

body.editorial-ui .money-map-intro {
  display: grid;
  padding: 2px 2px 7px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 22px;
}

body.editorial-ui .money-map-intro h3 {
  margin: 4px 0 5px;
  color: var(--navy);
  font-family: var(--font-editorial);
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  line-height: 1.08;
}

body.editorial-ui .money-map-intro p,
body.editorial-ui .plan-quick-facts > p,
body.editorial-ui .plan-suggestion p {
  margin: 0;
  color: var(--ink-soft);
  font-size: .84rem;
  line-height: 1.45;
}

body.editorial-ui .dollar-mode {
  display: grid;
  min-width: min(100%, 380px);
  margin: 0;
  padding: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--control-line);
  border-radius: 6px;
  background: rgba(255, 253, 247, .68);
}

body.editorial-ui .dollar-mode legend {
  padding: 0 4px;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 760;
}

body.editorial-ui .dollar-mode button {
  min-height: 38px;
  padding: 7px 9px;
  color: var(--navy);
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  font-size: .78rem;
  font-weight: 750;
}

body.editorial-ui .dollar-mode button[aria-pressed="true"] {
  color: var(--paper-raised);
  border-color: var(--navy);
  background: var(--navy);
}

body.editorial-ui .dollar-mode small {
  grid-column: 1 / -1;
  padding: 3px 4px 0;
  color: var(--ink-soft);
  font-size: .69rem;
  line-height: 1.35;
}

body.editorial-ui .input-panel > .dollar-mode {
  width: 100%;
  margin: 18px 0;
}

body.editorial-ui .plan-quick-facts {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 253, 247, .58);
}

body.editorial-ui .plan-quick-facts summary {
  padding: 13px 15px;
  color: var(--navy);
  font-size: .86rem;
  font-weight: 780;
  cursor: pointer;
}

body.editorial-ui .plan-quick-facts > p {
  padding: 0 15px 4px;
}

body.editorial-ui .plan-fact-grid {
  display: grid;
  padding: 12px 15px 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body.editorial-ui .plan-fact-grid .field {
  min-width: 0;
  font-size: .76rem;
}

body.editorial-ui .plan-suggestion {
  display: grid;
  padding: 14px 16px;
  grid-template-columns: minmax(135px, .48fr) minmax(0, 1.5fr) auto;
  align-items: center;
  gap: 14px;
  color: var(--navy);
  border-left: 4px solid var(--rust);
  background: var(--paper-rust);
}

body.editorial-ui .plan-suggestion > span {
  color: var(--rust);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .69rem;
  font-weight: 780;
  letter-spacing: .06em;
  text-transform: uppercase;
}

body.editorial-ui .plan-suggestion strong {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-editorial);
  font-size: 1.04rem;
}

body.editorial-ui .plan-suggestion button,
body.editorial-ui .money-map-edit {
  min-height: 34px;
  padding: 6px 9px;
  color: var(--navy);
  border: 1px solid currentColor;
  border-radius: 3px;
  background: transparent;
  font-size: .74rem;
  font-weight: 780;
}

body.editorial-ui .money-map :is(.map-group, .money-map-group) {
  position: relative;
  min-width: 0;
  padding: 14px;
  border-top: 3px solid var(--map-accent, var(--teal));
  background: rgba(255, 253, 247, .72);
}

body.editorial-ui .money-map :is(.map-group, .money-map-group) > h3 {
  margin: 0 0 11px;
  color: var(--map-accent, var(--teal));
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

body.editorial-ui .money-map :is(.map-node, .money-map-node) {
  display: grid;
  width: 100%;
  min-height: 62px;
  margin-top: 8px;
  padding: 10px 11px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-raised);
  text-align: left;
}

body.editorial-ui .money-map .money-map-node.is-connected {
  border-color: var(--map-node-accent, var(--teal));
  box-shadow: inset 3px 0 0 var(--map-node-accent, var(--teal));
}

body.editorial-ui .money-map-node-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--map-node-accent, var(--teal));
}

body.editorial-ui .money-map-node-icon svg {
  width: 23px;
  height: 23px;
}

body.editorial-ui .money-map-node-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

body.editorial-ui .money-map-node-copy strong {
  font-size: .82rem;
  line-height: 1.2;
}

body.editorial-ui .money-map-node-copy small {
  color: var(--ink-soft);
  font-size: .75rem;
}

body.editorial-ui .money-map-switch {
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--ink-soft);
  font-size: .72rem;
  cursor: pointer;
}

body.editorial-ui .money-map-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--map-node-accent, var(--teal));
}

body.editorial-ui .money-map-edit {
  min-height: 30px;
  padding: 4px 7px;
  grid-column: 2 / -1;
  justify-self: start;
  border-color: var(--line-strong);
}

body.editorial-ui .result-actions {
  display: flex;
  margin-top: 18px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body.editorial-ui .active-assumptions {
  display: flex;
  margin: 0 0 15px;
  padding: 9px 11px;
  gap: 7px;
  flex-wrap: wrap;
  border-block: 1px solid var(--line);
}

body.editorial-ui .active-assumptions span {
  padding: 4px 7px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(251, 247, 238, .72);
  font-size: .7rem;
}

body.editorial-ui .active-assumptions strong {
  color: var(--navy);
}

body.editorial-ui .assumption-boundary {
  margin: 0 0 4px;
  padding: 10px 12px;
  grid-column: 1 / -1;
  color: var(--ink-soft);
  border-left: 3px solid var(--rust);
  background: var(--paper-rust);
  font-size: .76rem;
  line-height: 1.45;
}

body.editorial-ui .historical-context-card {
  display: grid;
  margin-top: 14px;
  padding: 16px 18px;
  grid-template-columns: minmax(150px, .55fr) minmax(0, 1.25fr) auto;
  align-items: center;
  gap: 13px;
  color: var(--navy);
  border: 1px solid color-mix(in srgb, var(--rust) 42%, var(--line));
  border-radius: 6px;
  background: var(--paper-rust);
}

body.editorial-ui .historical-context-card > span {
  color: var(--rust);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .68rem;
  font-weight: 780;
  letter-spacing: .06em;
  text-transform: uppercase;
}

body.editorial-ui .historical-context-card strong {
  font-family: var(--font-editorial);
  font-size: 1.02rem;
}

body.editorial-ui .historical-context-card p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: .75rem;
}

body.editorial-ui .historical-context-card a {
  color: var(--rust);
  font-size: .74rem;
  font-weight: 760;
}

body.editorial-ui .plan-results {
  min-height: 0;
  padding: clamp(20px, 2.3vw, 30px);
}

body.editorial-ui .plan-loading {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--navy);
  text-align: left;
}

body.editorial-ui .plan-loading > span {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--rust);
  border-radius: 50%;
  animation: editorial-spin .8s linear infinite;
}

body.editorial-ui .plan-loading p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: .78rem;
}

@keyframes editorial-spin { to { transform: rotate(360deg); } }

body.editorial-ui .plan-kpi-panel,
body.editorial-ui .plan-chart-panel,
body.editorial-ui .plan-insight,
body.editorial-ui .event-plan-breakdown > div {
  color: var(--ink);
  border-color: var(--line);
  border-radius: 6px;
  background: rgba(255, 253, 247, .72);
  box-shadow: none;
}

body.editorial-ui .timeline-event {
  border-color: var(--line);
  border-radius: 3px;
  background: var(--paper-raised);
}

body.editorial-ui .plan-comparison-details > summary {
  color: var(--navy);
  background: var(--paper-deep);
}

/* Risk lab: supports the shared class vocabulary while risk-lab.js owns state. */
body.editorial-ui #risk-view {
  width: min(1240px, 100%);
  margin: 0 auto;
}

body.editorial-ui #risk-lab-root .fm-risk-lab {
  --paper: #fbf7ee;
  --ink: #0a2e4d;
  --rust: #a9431f;
  --teal: #0b626b;
  --line: #b8ad9b;
  max-width: none;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(251, 247, 238, .9);
  box-shadow: var(--shadow-soft);
}

body.editorial-ui #risk-lab-root .fm-risk-lab::before {
  display: none;
}

body.editorial-ui #risk-lab-root .fm-risk-head {
  padding: clamp(22px, 3vw, 36px);
  border-color: var(--line);
}

body.editorial-ui #risk-lab-root .fm-risk-meta,
body.editorial-ui #risk-lab-root .fm-risk-kicker {
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .75rem;
}

body.editorial-ui #risk-lab-root .fm-risk-head :is(h1, h2) {
  margin: clamp(24px, 4vw, 46px) 0 14px;
  color: var(--rust);
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 7.4vw, 6.8rem);
  font-stretch: condensed;
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: .88;
  text-transform: uppercase;
}

body.editorial-ui #risk-lab-root .fm-risk-deck {
  max-width: 760px;
  color: var(--ink-soft);
  font-family: var(--font-editorial);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
}

body.editorial-ui #risk-lab-root .fm-risk-main {
  min-height: 420px;
  padding: clamp(22px, 3vw, 36px);
}

body.editorial-ui #risk-lab-root .fm-risk-main h3 {
  color: var(--navy);
  font-family: var(--font-editorial);
  font-size: clamp(1.8rem, 3.2vw, 2.7rem);
}

body.editorial-ui #risk-lab-root .fm-risk-intro {
  color: var(--ink-soft);
  font-size: 1rem;
}

body.editorial-ui #risk-lab-root :is(.fm-risk-field label, .fm-risk-field legend, .fm-risk-options legend) {
  color: var(--navy);
  font-size: .95rem;
}

body.editorial-ui #risk-lab-root :is(.fm-risk-field small, .fm-risk-hint, .fm-risk-progress-text) {
  color: var(--ink-soft);
  font-size: .8125rem;
}

body.editorial-ui #risk-lab-root :is(.fm-risk-field input, .fm-risk-field select) {
  min-height: 48px;
  color: var(--navy);
  border-color: var(--control-line);
  border-radius: 4px;
  background: #fffdf7;
  font-size: 1rem;
}

body.editorial-ui #risk-lab-root .fm-risk-inline-options label,
body.editorial-ui #risk-lab-root .fm-risk-option {
  min-height: 52px;
  color: var(--navy);
  border-color: var(--control-line);
  border-radius: 5px;
  background: rgba(255, 253, 247, .78);
  font-size: .95rem;
}

body.editorial-ui #risk-lab-root .fm-risk-option:hover {
  border-color: var(--teal);
}

body.editorial-ui #risk-lab-root .fm-risk-option:has(input:checked) {
  border-color: var(--teal);
  background: var(--paper-blue);
  box-shadow: inset 4px 0 0 var(--teal);
}

body.editorial-ui #risk-lab-root .fm-risk-note {
  color: var(--navy);
  border-color: var(--rust);
  background: var(--paper-rust);
  font-size: .875rem;
}

body.editorial-ui #risk-lab-root .fm-risk-actions {
  padding: 18px clamp(22px, 3vw, 36px) 26px;
  border-color: var(--line);
}

body.editorial-ui #risk-lab-root .fm-risk-button {
  min-height: 44px;
  padding: 10px 17px;
  color: var(--navy);
  border-color: var(--navy);
  border-radius: 4px;
  background: transparent;
  font-size: .9rem;
}

body.editorial-ui #risk-lab-root .fm-risk-button--primary {
  color: var(--paper-raised);
  background: var(--navy);
}

body.editorial-ui #risk-lab-root .fm-risk-result {
  border-color: var(--line);
}

body.editorial-ui #risk-lab-root .fm-risk-result h4 {
  color: var(--teal);
  font-size: .75rem;
}

body.editorial-ui #risk-lab-root .fm-risk-result-value {
  color: var(--navy);
  font-size: clamp(1.4rem, 3vw, 2rem);
}

body.editorial-ui #risk-lab-root :is(.fm-risk-result p, .fm-risk-factors, .fm-risk-disclaimer, .fm-risk-evidence) {
  color: var(--ink-soft);
  font-size: .875rem;
}

body.editorial-ui #risk-lab-root .fm-risk-disclaimer {
  border-color: var(--line);
  border-radius: 6px;
  background: var(--paper-blue);
}

body.editorial-ui #risk-lab-root :is(.risk-shell, .risk-lab, .scenario-shell) {
  color: var(--ink);
}

body.editorial-ui #risk-lab-root :is(.risk-header, .scenario-header) {
  margin-bottom: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line-strong);
}

body.editorial-ui #risk-lab-root h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(3rem, 7vw, 6.5rem);
  letter-spacing: -.02em;
  line-height: .88;
}

body.editorial-ui #risk-lab-root :is(.risk-profile-grid, .risk-dimensions, .scenario-layout) {
  display: grid;
  grid-template-columns: minmax(230px, .72fr) minmax(0, 1.6fr);
  gap: 18px;
}

body.editorial-ui #risk-lab-root :is(.risk-dimension, .scenario-card, .risk-context, .risk-result, .behavior-watch) {
  padding: 18px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(251, 247, 238, .9);
  box-shadow: var(--shadow-soft);
}

body.editorial-ui #risk-lab-root :is(.risk-option, .scenario-option, .answer-choice) {
  display: flex;
  width: 100%;
  min-height: 58px;
  padding: 11px 14px;
  align-items: center;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-raised);
  font-size: .95rem;
  text-align: left;
}

body.editorial-ui #risk-lab-root :is(.risk-option, .scenario-option, .answer-choice)[aria-pressed="true"],
body.editorial-ui #risk-lab-root :is(.risk-option, .scenario-option, .answer-choice):has(input:checked) {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--teal);
}

body.editorial-ui #risk-lab-root :is(.scenario-progress, progress) {
  accent-color: var(--rust);
}

/* Home and event canvases remain light and legible. */
body.editorial-ui .home-life-board,
body.editorial-ui .event-chart-host,
body.editorial-ui .event-preset,
body.editorial-ui .event-item,
body.editorial-ui .budget-detail-card {
  border-color: var(--line);
  border-radius: 6px;
  background: rgba(255, 253, 247, .78);
}

body.editorial-ui :is(.event-preset p, .event-item-main small, .event-source p, .home-boundary-note, .home-timeline-heading p) {
  color: var(--ink-soft);
  font-size: .8rem;
}

body.editorial-ui :is(.event-preset strong, .event-item-main strong, .home-timeline-heading h3) {
  color: var(--navy);
  font-size: .9rem;
}

/* Preserve the compact editorial hierarchy without making supporting facts
   dependent on 8–10px text. */
body.editorial-ui :is(
  .budget-metrics span,
  .budget-metrics small,
  .budget-section-title small,
  .cashflow-legend span,
  .budget-chart-legend,
  .budget-tradeoff label,
  .budget-tradeoff label small,
  .tradeoff-result small,
  .capacity-warning span,
  .allocation-request > span:first-child,
  .allocation-request small,
  .allocation-input b,
  .allocation-input em,
  .allocation-unassigned span,
  .allocation-actions label,
  .allocation-actions button,
  .allocation-actions select,
  .pattern-heading,
  .pattern-heading strong,
  .pattern-row,
  .pattern-row strong,
  .pattern-row em,
  .budget-detail-callout p,
  .budget-detail-heading p,
  .budget-detail-card-top label,
  .budget-detail-card-top button,
  .budget-detail-advanced summary,
  .budget-detail-advanced > p,
  .history-box p,
  .history-grid label,
  .history-grid input,
  .event-preset > span,
  .event-list-empty p,
  .event-editor-empty p,
  .event-editor-heading button,
  .event-step > div > strong,
  .event-sentence,
  .event-source summary,
  .event-source a,
  .reference-use-button,
  .sticky-add-event,
  .event-result-status,
  .event-chart-heading span,
  .event-contribution-list span small,
  .event-assumptions summary,
  .event-assumptions p,
  .event-loading,
  .event-error,
  .event-plan-breakdown span,
  .event-plan-breakdown small,
  .home-primary-metrics span,
  .home-upfront-callout small,
  .home-result-tabs button,
  .home-chart-legend,
  .home-event-lane > span,
  .home-event-lane em,
  .home-horizon-strip span,
  .home-compare-outcome span,
  .home-compare-outcome small,
  .home-output-title,
  .home-linked-output strong,
  .home-linked-output small,
  .home-budget-signal strong,
  .home-budget-signal span
) {
  font-size: .75rem;
}

body.editorial-ui .event-contribution-list span strong {
  font-size: .8125rem;
}

body.editorial-ui .compact-ring span {
  max-width: 56px;
  font-size: .7rem;
}

body.editorial-ui .home-comparison-board .home-series.cash {
  stroke-dasharray: 9 6;
}

body.editorial-ui .event-preset button,
body.editorial-ui .event-item-actions button,
body.editorial-ui .home-event-lane button,
body.editorial-ui .home-linked-output button {
  min-height: 36px;
  font-size: .78rem;
}

/* Footer */
body.editorial-ui .site-footer {
  display: flex;
  margin-top: 24px;
  padding: 16px 2px 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  font-size: .8rem;
}

body.editorial-ui .site-footer > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.editorial-ui .site-footer svg {
  width: 18px;
  height: 18px;
  color: var(--teal);
}

body.editorial-ui .site-footer .privacy-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.editorial-ui .site-footer button {
  min-height: 36px;
  padding: 7px 10px;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(251, 247, 238, .75);
  font-size: .78rem;
  text-decoration: none;
}

@media (max-width: 1100px) {
  body.editorial-ui .module-workspace,
  body.editorial-ui .module-shell[data-theme="events"] .module-workspace,
  body.editorial-ui .module-shell[data-theme="home"] .module-workspace,
  body.editorial-ui .module-shell[data-theme="budget"] .module-workspace {
    grid-template-columns: 1fr;
  }

  body.editorial-ui .input-panel {
    display: block;
  }

  body.editorial-ui .money-map:not(:empty) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.editorial-ui .plan-fact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body.editorial-ui .app-shell {
    width: min(100% - 24px, 680px);
  }

  body.editorial-ui .site-header {
    position: relative;
    min-height: 0;
    margin-bottom: 18px;
    padding: 10px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  body.editorial-ui .site-name {
    font-size: .68rem;
  }

  body.editorial-ui .primary-nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }

  body.editorial-ui .nav-action {
    min-height: 42px;
    padding-inline: 4px;
    font-size: .72rem;
  }

  body.editorial-ui .nav-action::after {
    bottom: -10px;
  }

  body.editorial-ui .decision-hero {
    padding-top: 20px;
  }

  body.editorial-ui .decision-hero h1 {
    font-size: clamp(3.15rem, 15vw, 5.2rem);
  }

  body.editorial-ui .quick-calculator-grid :is(.quick-action-grid, .directory-grid) {
    grid-template-columns: 1fr;
  }

  body.editorial-ui .quick-calculator-grid .module-card {
    min-height: 142px;
  }

  body.editorial-ui .quick-calculator-grid .module-open {
    min-height: 140px;
    padding: 19px;
  }

  body.editorial-ui :is(.connected-plan-promo, .quick-calculator-grid .connected-plan-card) {
    grid-template-columns: 54px minmax(0, 1fr);
    padding: 19px;
    gap: 15px;
  }

  body.editorial-ui .connected-plan-icon {
    width: 52px;
    height: 52px;
  }

  body.editorial-ui .editorial-landscape {
    min-height: 260px;
    margin-inline: 0;
  }

  body.editorial-ui .editorial-word {
    top: 18px;
    font-size: clamp(6.4rem, 27vw, 11rem);
  }

  body.editorial-ui .landscape-caption {
    right: 12px;
    bottom: 9px;
    max-width: 220px;
    font-size: .66rem;
    text-align: right;
  }

  body.editorial-ui .module-intro {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 15px;
  }

  body.editorial-ui .module-header-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  body.editorial-ui .module-learn-shortcut,
  body.editorial-ui .module-state {
    justify-content: space-between;
  }

  body.editorial-ui .field-grid,
  body.editorial-ui .choice-stack,
  body.editorial-ui .module-learning,
  body.editorial-ui .result-metrics,
  body.editorial-ui .plan-dashboard,
  body.editorial-ui #risk-lab-root :is(.risk-profile-grid, .risk-dimensions, .scenario-layout) {
    grid-template-columns: 1fr;
  }

  body.editorial-ui .field-grid .wide {
    grid-column: auto;
  }

  body.editorial-ui .combined-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  body.editorial-ui .plan-status {
    max-width: none;
    text-align: left;
  }

  body.editorial-ui .money-map:not(:empty) {
    grid-template-columns: 1fr;
  }

  body.editorial-ui .money-map-intro,
  body.editorial-ui .plan-suggestion,
  body.editorial-ui .historical-context-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  body.editorial-ui .money-map-intro .dollar-mode {
    width: 100%;
  }

  body.editorial-ui .plan-fact-grid {
    grid-template-columns: 1fr;
  }

  body.editorial-ui .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  body.editorial-ui .site-footer .privacy-controls {
    align-items: stretch;
    flex-direction: column;
  }

  body.editorial-ui .site-footer button {
    min-height: 44px;
  }
}

@media (max-width: 430px) {
  body.editorial-ui .primary-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.editorial-ui .nav-action::after {
    bottom: 0;
  }

  body.editorial-ui .quick-calculator-grid .module-card {
    min-height: 160px;
  }

  body.editorial-ui .quick-calculator-grid .module-open {
    min-height: 158px;
    grid-template-columns: 48px minmax(0, 1fr) 20px;
    column-gap: 13px;
  }

  body.editorial-ui .quick-calculator-grid .module-card-icon {
    width: 46px;
    height: 46px;
  }

  body.editorial-ui .quick-calculator-grid .module-card-title {
    font-size: 1.45rem;
  }

  body.editorial-ui :is(.connected-plan-promo, .quick-calculator-grid .connected-plan-card) {
    grid-template-columns: 1fr;
  }

  body.editorial-ui .editorial-word {
    font-size: 6rem;
  }

  body.editorial-ui #risk-lab-root .fm-risk-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  body.editorial-ui #risk-lab-root .fm-risk-button {
    width: 100%;
  }
}

body.editorial-ui .mobile-result-jump {
  display: none;
}

body.editorial-ui .direct-chart-hint {
  margin: 10px 0 6px;
}

body.editorial-ui .chart-data-details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

body.editorial-ui .event-baseline-warning {
  margin: 10px 0 12px;
  padding: 9px 11px;
  color: var(--ink);
  border-left: 3px solid var(--rust-display);
  background: var(--paper-rust);
  font-size: .78rem;
  line-height: 1.45;
}

body.editorial-ui .chart-data-details summary {
  width: fit-content;
  padding: 9px 0;
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 760;
  cursor: pointer;
}

body.editorial-ui .chart-data-scroll {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--control-line);
  background: var(--paper-raised);
}

body.editorial-ui .chart-data-scroll table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  color: var(--ink);
  font-size: .76rem;
}

body.editorial-ui .chart-data-scroll caption {
  padding: 10px;
  text-align: left;
  font-weight: 760;
}

body.editorial-ui .chart-data-scroll :is(th, td) {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  text-align: right;
}

body.editorial-ui .chart-data-scroll :is(th:first-child, td:first-child) {
  text-align: left;
}

@media (max-width: 1100px) {
  body.editorial-ui .mobile-result-jump {
    position: fixed;
    z-index: 8;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(520px, calc(100% - 20px));
    margin: 0 auto;
    padding: 12px 14px;
    color: var(--paper-raised);
    border: 1px solid var(--navy);
    background: var(--navy);
    box-shadow: 0 9px 24px rgba(10, 46, 77, .22);
    text-decoration: none;
  }

  body.editorial-ui .mobile-result-jump.is-used {
    display: none;
  }

  body.editorial-ui #module-view:not([hidden]) {
    padding-bottom: 76px;
  }

  body.editorial-ui .mobile-result-jump span {
    font-size: .72rem;
  }

  body.editorial-ui .mobile-result-jump strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
  }

  body.editorial-ui .mobile-result-jump svg {
    width: 14px;
    height: 14px;
  }

  body.editorial-ui :is(.budget-chart, .chart-host:not(.compact-chart)) {
    overflow: visible;
  }
}

@media (max-width: 700px) {

  body.editorial-ui :is(.chart-host, .home-chart-host, .event-chart-host, .budget-chart) {
    overscroll-behavior-inline: contain;
    scrollbar-color: var(--rust-display) var(--paper-deep);
  }

  body.editorial-ui .pattern-heading {
    display: none;
  }

  body.editorial-ui .pattern-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.editorial-ui .pattern-row > span {
    grid-column: 1 / -1;
    font-weight: 780;
  }

  body.editorial-ui .pattern-row > :last-child {
    display: block;
  }

  body.editorial-ui .pattern-row > strong::before,
  body.editorial-ui .pattern-row > em::before {
    display: block;
    margin-bottom: 3px;
    color: var(--ink-faint);
    font-size: .66rem;
    font-style: normal;
    font-weight: 650;
  }

  body.editorial-ui .pattern-row > strong:nth-of-type(1)::before { content: "Entered"; }
  body.editorial-ui .pattern-row > strong:nth-of-type(2)::before { content: "Alternative"; }
  body.editorial-ui .pattern-row > em::before { content: "Difference"; }
}

@media (prefers-reduced-motion: reduce) {
  body.editorial-ui,
  body.editorial-ui *,
  body.editorial-ui *::before,
  body.editorial-ui *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (prefers-contrast: more) {
  body.editorial-ui::before {
    display: none;
  }

  body.editorial-ui :is(.module-card, .connected-plan-promo, .connected-plan-card, .input-panel, .module-result-panel, .plan-results, .learning-card) {
    border-color: var(--line-strong);
    background: var(--paper-raised);
    box-shadow: none;
  }
}

@media print {
  body.editorial-ui::before,
  body.editorial-ui .site-header,
  body.editorial-ui .editorial-landscape,
  body.editorial-ui .site-footer .privacy-controls {
    display: none !important;
  }

  body.editorial-ui .app-shell {
    width: 100%;
  }
}
