/* Shared calculator/planner corrections. Loaded after page-specific styles. */
main .home-debt-results .hd-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
main .hd-panels {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
main .hd-panels > .hd-panel--wide:only-child {
  grid-column: 1 / -1;
}
main .home-debt-results .hd-stat strong {
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
}
/* Let grid and flex children shrink; wide schedules scroll inside their card. */
main :is(.cat-main, .page-main, .home-debt-inputs, .gp-field, .gp-table-wrap) {
  min-width: 0;
}
main .gp-table-wrap { max-width: 100%; }
main .gp-back { margin-bottom: 20px; }
/* Nested action wrappers should occupy one row, without an extra top gap. */
html body main .tool-actions > .gp-actions.gp-actions {
  display: flex !important;
  flex-wrap: wrap;
  width: 100%;
  gap: 10px;
  margin: 0 !important;
}
html body main :is(.tool-actions, .gp-actions, .hd-actions) .hd-action:focus-visible {
  outline: 3px solid var(--accent, #078c49);
  outline-offset: 3px;
}
html body main :is(.tool-actions, .gp-actions) .hd-status:not(:empty) {
  display: block;
  flex-basis: 100%;
  font-size: 13px;
  line-height: 1.5;
}
html.dark main :is(.gp-stack-row, .gp-stack-row b, .gp-legend,
  .gp-ring-label span, .gp-bar-row, .gp-bar-row b, .gp-meter-legend,
  .gp-meter-status) { color: #cbd5e1; }
html.dark main .gp-meter-target { background: #e2e8f0; }
@media (max-width: 480px) {
  main .home-debt-results .hd-stats { gap: 8px; }
  main .hd-stat { padding: 12px; }
  main .hd-panels > .hd-panel--wide { grid-column: auto; }
}
/* Older ID-specific grid rules otherwise collapse nested icon buttons. */
html body main #calculator .gp-actions > :is(#plannerShare, #plannerReset, #plannerCsv, #plannerPdf, .hd-action) {
  width: 46px !important;
  min-width: 46px !important;
  height: 46px !important;
  padding: 0 !important;
  flex: 0 0 46px !important;
  border: 1px solid var(--line, #cbd5e1) !important;
  border-radius: 12px !important;
  background: var(--surface, #fff) !important;
  color: var(--accent, #078c49) !important;
}
main #calculator.home-debt > .tool-actions { padding: 14px 20px; }
main .hd-panels:has(> :nth-child(2):last-child) > .hd-panel--wide {
  grid-column: auto;
}

/* Keep every category visible when the desktop header cannot fit one row. */
@media (min-width: 1024px) and (max-width: 1599px) {
  html body .site-header .bar.bar { display: flex; flex-wrap: wrap; gap: 10px 16px; }
  html body .site-header .nav {
    order: 3;
    flex: 1 0 100%;
    margin: 0;
    overflow: visible;
    flex-wrap: wrap;
    -webkit-mask-image: none;
    mask-image: none;
    padding: 0;
  }
  html body .site-header .search { margin-left: auto; }
}
/* Footer actions should follow the results without an extra blank band. */
html body #calculator.mc-calculator.planner-look .mc-footer {
  margin-top: 0 !important;
}
/* Debt rows need room for a full-size remove control on every device. */
main .hd-head, main .hd-row {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .9fr) 44px;
}
main :is(.hd-remove, .hd-add, .hd-try) {
  min-height: 44px;
}
main .hd-remove { min-width: 44px; }
main .hd-remove:focus-visible {
  outline: 2px solid var(--accent, #078c49);
  outline-offset: 2px;
}
main .ask-form .ask-btn { min-height: 44px; }
@media (max-width: 759px) {
  main .hd-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  main .hd-row .hd-name { grid-column: 1 / -1; }
  main [role="tablist"] { display: flex; flex-wrap: wrap; gap: 8px; }
  main [role="tablist"] [role="tab"], main button[data-tab] { min-height: 44px; }
  html body #calculator.mc-calculator .mc-footer :is(#resetBtn, [data-copy-results]) {
    min-height: 44px !important;
  }
}

/* Total interest answer: plain text, no background box. */
#calculator.mc-calculator .mc-result.mc-plain, #calculator.planner-look.mc-calculator .mc-result.mc-plain { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; }
html.dark #calculator.mc-calculator .mc-result.mc-plain, html.dark #calculator.planner-look.mc-calculator .mc-result.mc-plain { background: transparent !important; border: 0 !important; }

/* Formulas: plain, like the rest of the guide. No coloured box, and the plain-text version uses the body font. */
.formula-box, .page-clean .formula-box, html.dark .formula-box, html.dark .page-clean .formula-box { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 4px 0 !important; color: inherit !important; box-shadow: none !important; text-align: left !important; }
.formula-box .formula-words { margin-top: 12px; }
.formula-box .formula-words-label { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: inherit; margin: 0 0 4px; }
.formula-box .formula-words p, .formula-box .formula-words p.font-mono { font-family: inherit !important; font-size: 1rem !important; line-height: 1.6; margin: 0; }

/* Formula lines: simple body text, no box, no monospace. */
.formula-words, .formula-words p { font-family: inherit !important; background: transparent !important; border: 0 !important; padding: 0 !important; color: inherit !important; font-size: 1rem; line-height: 1.6; margin: 0 0 4px; }

/* Calculator guide sections: the same panel style as the answer pages. Each section is a card with a heading and plain text.
   Colours rotate blue, pink, yellow and lilac; green is kept for buttons and results only. */
#guide .g-card { border-radius: 16px; border: 2px solid #93c5fd; background: #eff6ff; padding: 16px 18px; margin: 0 0 14px; }
#guide .g-card:nth-of-type(3n+2) { border-color: #f9a8d4; background: #fdf2f8; }
#guide .g-card:nth-of-type(3n+3) { border-color: #fde047; background: #fefce8; }
#guide .g-card > h2 { margin: 0 0 8px !important; font-size: 1.15rem !important; font-weight: 800 !important; color: #1e3a8a !important; }
#guide .g-card > p, #guide .g-card > ul, #guide .g-card > ol { margin: 0 0 8px; font-size: 16px; line-height: 1.6; color: #1f2937; }
#guide .g-card > p:last-child, #guide .g-card > ul:last-child { margin-bottom: 0; }
html.dark #guide .g-card { background: #1c2430 !important; border-color: #334155 !important; }
html.dark #guide .g-card > h2 { color: #93c5fd !important; }
html.dark #guide .g-card > p, html.dark #guide .g-card > ul { color: #e5e7eb; }
/* The shared stylesheet strips paper and padding from sections; the guide cards keep theirs. */
#guide .g-card { background: #eff6ff !important; border: 2px solid #93c5fd !important; padding: 16px 18px !important; border-radius: 16px !important; }
#guide .g-card:nth-of-type(3n+2) { background: #fdf2f8 !important; border-color: #f9a8d4 !important; }
#guide .g-card:nth-of-type(3n+3) { background: #fefce8 !important; border-color: #fde047 !important; }
html.dark #guide .g-card { background: #1c2430 !important; border-color: #334155 !important; }

/* What if you change a number?: each scenario is a card, like the guide cards. Blue, pink and yellow rotate; no green. */
#whatIf { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
#whatIf > h2 { margin: 0 0 10px !important; font-size: 1.15rem !important; font-weight: 800 !important; color: #1e3a8a !important; letter-spacing: 0 !important; text-transform: none !important; }
#whatIf .whatif-list { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
#whatIf .whatif-row { border-radius: 16px !important; border: 2px solid #93c5fd !important; background: #eff6ff !important; padding: 14px 16px !important; box-shadow: none !important; }
#whatIf .whatif-list > li:nth-child(3n+2) .whatif-row, #whatIf .whatif-row:nth-of-type(3n+2) { border-color: #f9a8d4 !important; background: #fdf2f8 !important; }
#whatIf .whatif-list > li:nth-child(3n+3) .whatif-row, #whatIf .whatif-row:nth-of-type(3n+3) { border-color: #fde047 !important; background: #fefce8 !important; }
#whatIf .whatif-title { font-size: 1.05rem !important; font-weight: 800 !important; color: #1e3a8a !important; margin: 0 0 4px; }
#whatIf .whatif-detail, #whatIf .whatif-empty { font-size: 15px !important; line-height: 1.55 !important; color: #374151 !important; margin: 0; }
html.dark #whatIf .whatif-row { background: #1c2430 !important; border-color: #334155 !important; }
html.dark #whatIf .whatif-title { color: #93c5fd !important; }
html.dark #whatIf .whatif-detail, html.dark #whatIf .whatif-empty { color: #e5e7eb !important; }

/* Related calculators: no greens. Plain grey and black, with a neutral icon. */
html body #related.cal-related, html body main.sidebar-page #related.cal-related, #related.cal-related { background: #ffffff !important; border: 1px solid #e5e7eb !important; box-shadow: none !important; }
html body #related.cal-related > h2, #related.cal-related h2 { color: #111827 !important; }
html body #related.cal-related a, #related.cal-related a { color: #111827 !important; background: #f8fafc !important; border: 1px solid #e5e7eb !important; box-shadow: none !important; }
html body #related.cal-related a:hover, #related.cal-related a:hover { background: #f1f5f9 !important; text-decoration: underline !important; }
html body #related.cal-related a::before, #related.cal-related a::before { color: #475569 !important; background: #e2e8f0 !important; }
html.dark #related.cal-related, html.dark body #related.cal-related { background: #141418 !important; border-color: #2a2a33 !important; }
html.dark #related.cal-related h2 { color: #e5e7eb !important; }
html.dark #related.cal-related a, html.dark body #related.cal-related a { color: #f1f5f9 !important; background: #1c1c22 !important; border-color: #2a2a33 !important; }
html.dark #related.cal-related a::before { color: #cbd5e1 !important; background: #2a2a33 !important; }
html body main #related.cal-related > h2, html body #related.cal-related > h2.cal-h2 { color: #111827 !important; }
html body main #related.cal-related a::before { color: #475569 !important; background: #e2e8f0 !important; }

/* Calculators, plainer and more useful on desktop and phone (after the Omni-style review):
   the side column stays in view while the reader scrolls, and the guide and what-if cards are plain, not coloured. */
@media (min-width: 900px) { html body .page-grid > .cal-sidebar { position: sticky; top: 92px; align-self: start; } }
#guide .g-card { background: transparent !important; border: 0 !important; border-top: 1px solid #e5e7eb !important; border-radius: 0 !important; padding: 18px 0 !important; }
#guide .g-card:nth-of-type(n) { background: transparent !important; border-color: #e5e7eb !important; }
#guide .g-card > h2 { color: #111827 !important; font-size: 1.2rem !important; }
html.dark #guide .g-card { background: transparent !important; border-color: #2a2a33 !important; }
html.dark #guide .g-card > h2 { color: #f1f5f9 !important; }
#whatIf .whatif-row, #whatIf .whatif-list > li .whatif-row, #whatIf .whatif-row:nth-of-type(n) { background: #ffffff !important; border: 1px solid #e5e7eb !important; }
#whatIf .whatif-title { color: #111827 !important; }
html.dark #whatIf .whatif-row { background: #141418 !important; border-color: #2a2a33 !important; }
html.dark #whatIf .whatif-title { color: #f1f5f9 !important; }

/* The calculator form, shown as a card so people can see where to enter numbers. */
[id$="Form"].calc-card { display: block !important; background: #ffffff !important; border: 1px solid #e5e7eb !important; border-radius: 16px !important; padding: 18px !important; margin: 0 0 18px !important; box-shadow: none !important; }
html.dark [id$="Form"].calc-card { background: #141418 !important; border-color: #2a2a33 !important; }

/* Dark mode fixes for the related block and the calculator form (high specificity, so the light rules cannot win). */
html.dark body main #related.cal-related { background: #141418 !important; border: 1px solid #2a2a33 !important; }
html.dark body main #related.cal-related > h2 { color: #e5e7eb !important; }
html.dark body main #related.cal-related a { background: #1c1c22 !important; color: #f1f5f9 !important; border: 1px solid #2a2a33 !important; }
html.dark body main #related.cal-related a::before { background: #2a2a33 !important; color: #cbd5e1 !important; }
html.dark [id$="Form"].calc-card { background: #141418 !important; border-color: #2a2a33 !important; }
html.dark [id$="Form"].calc-card * { color: #e5e7eb; }
html.dark [id$="Form"].calc-card input, html.dark [id$="Form"].calc-card select { background: #0f1116 !important; color: #f8fafc !important; border-color: #2a2a33 !important; }
html.dark [id$="Form"].calc-card input::placeholder { color: #6b7280 !important; }
html.dark [id$="Form"].calc-card button { background: #1c1c22 !important; color: #f1f5f9 !important; border-color: #2a2a33 !important; }

/* Pay raise page: compact and neutral. White cards with one thin border, one heading size, no coloured highlights. */
body.pr-page main { max-width: 1120px; }
body.pr-page main section, body.pr-page main article, body.pr-page [id$="Form"].calc-card, body.pr-page #related.cal-related {
  background: #ffffff !important; border: 1px solid #e5e7eb !important; border-radius: 12px !important; box-shadow: none !important; padding: 16px 18px !important; margin: 0 0 12px !important; }
body.pr-page main section > h2, body.pr-page article h2, body.pr-page #related > h2 { font-size: 15px !important; font-weight: 700 !important; color: #111827 !important; letter-spacing: 0 !important; text-transform: none !important; margin: 0 0 8px !important; line-height: 1.35 !important; }
body.pr-page main h1 { margin-bottom: 4px; }
body.pr-page article p, body.pr-page article li, body.pr-page main p { font-size: 15px !important; line-height: 1.6 !important; color: #374151 !important; }
body.pr-page .ins-var, body.pr-page .ins-sentence .ins-var, body.pr-page .ins-chip { background: #f3f4f6 !important; color: #111827 !important; border: 1px solid #e5e7eb !important; box-shadow: none !important; }
body.pr-page .ins-hero, body.pr-page .ins-hero-value, body.pr-page .ins-hero-label { color: #111827 !important; background: transparent !important; border: 0 !important; }
body.pr-page .ins-hero-value { font-size: 2.2rem !important; font-weight: 700 !important; }
body.pr-page #guide .g-card { background: #ffffff !important; border: 1px solid #e5e7eb !important; border-radius: 12px !important; padding: 16px 18px !important; margin: 0 0 12px !important; }
body.pr-page #guide .g-card > h2 { color: #111827 !important; font-size: 15px !important; }
body.pr-page #whatIf .whatif-row { background: #ffffff !important; border: 1px solid #e5e7eb !important; border-radius: 12px !important; padding: 12px 14px !important; }
body.pr-page #whatIf .whatif-title { color: #111827 !important; font-size: 15px !important; }
body.pr-page #whatIf > h2, body.pr-page #payRaiseInsight h2 { color: #111827 !important; }
body.pr-page .formula-box, body.pr-page .formula-words { background: transparent !important; border: 0 !important; padding: 0 !important; }
body.pr-page #related a { background: #f9fafb !important; color: #111827 !important; border: 1px solid #e5e7eb !important; box-shadow: none !important; font-size: 14px !important; min-height: 0 !important; padding: 8px 12px !important; }
body.pr-page #related a::before { background: #f3f4f6 !important; color: #374151 !important; }
body.pr-page #related > h2 { color: #111827 !important; }
html.dark body.pr-page main section, html.dark body.pr-page [id$="Form"].calc-card, html.dark body.pr-page #related.cal-related, html.dark body.pr-page #guide .g-card { background: #141418 !important; border-color: #2a2a33 !important; }
html.dark body.pr-page main section > h2, html.dark body.pr-page article h2, html.dark body.pr-page #related > h2, html.dark body.pr-page .ins-hero-value, html.dark body.pr-page .ins-hero-label { color: #f1f5f9 !important; }
html.dark body.pr-page article p, html.dark body.pr-page main p { color: #cbd5e1 !important; }
html.dark body.pr-page #related a { background: #1c1c22 !important; color: #f1f5f9 !important; border-color: #2a2a33 !important; }
/* One card, not a card inside a card: the inner calculator box is plain inside the form card. */
body.pr-page [id$="Form"].calc-card #calculator, body.pr-page [id$="Form"].calc-card .mc-calculator { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
body.pr-page [id$="Form"].calc-card > div { border: 0 !important; background: transparent !important; box-shadow: none !important; }
html.dark body.pr-page [id$="Form"].calc-card #calculator { background: transparent !important; }

/* FINAL LAYOUT (every calculator page, body.pr-page):
   one content column that lines up on desktop and phone; every card has the same border, radius, padding and type;
   every result is a card with the same look (Total interest included); no coloured highlights anywhere. */
body.pr-page main { max-width: 1120px !important; }
body.pr-page main > *, body.pr-page .page-main > *, body.pr-page #payRaiseInsight, body.pr-page #whatIf, body.pr-page #guide, body.pr-page [id$="Form"].calc-card { width: 100%; max-width: 100%; box-sizing: border-box; }
body.pr-page .mc-result, body.pr-page .mc-result.mc-plain, body.pr-page #calculator .mc-result { background: #ffffff !important; border: 1px solid #e5e7eb !important; border-radius: 12px !important; padding: 14px 16px !important; box-shadow: none !important; margin: 0 0 10px !important; }
body.pr-page .mc-result-label { font-size: 12px !important; font-weight: 600 !important; letter-spacing: .04em !important; text-transform: uppercase !important; color: #4b5563 !important; }
body.pr-page .mc-result-value { font-size: 1.6rem !important; font-weight: 700 !important; color: #111827 !important; }
body.pr-page .mc-result-sub { font-size: 13px !important; color: #6b7280 !important; }
body.pr-page #guide .g-card, body.pr-page #whatIf .whatif-row { width: 100% !important; background: #ffffff !important; border: 1px solid #e5e7eb !important; border-radius: 12px !important; padding: 14px 16px !important; margin: 0 0 10px !important; }
html.dark body.pr-page .mc-result, html.dark body.pr-page #guide .g-card, html.dark body.pr-page #whatIf .whatif-row { background: #141418 !important; border-color: #2a2a33 !important; }
html.dark body.pr-page .mc-result-value { color: #f1f5f9 !important; }
html.dark body.pr-page .mc-result-label { color: #9ca3af !important; }

/* Reference layout (pay raise, applied in our page): inputs on the left, results on the right, and one dominant first result.
   Kept neutral: the dominant result is near-black, not coloured. */
body.pr-page [id$="Form"].calc-card #calculator { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 720px) { body.pr-page [id$="Form"].calc-card #calculator { grid-template-columns: 1fr; } }
body.pr-page .mc-result.is-primary { background: #111827 !important; border-color: #111827 !important; }
body.pr-page .mc-result.is-primary .mc-result-label, body.pr-page .mc-result.is-primary .mc-result-sub { color: #d1d5db !important; }
body.pr-page .mc-result.is-primary .mc-result-value { color: #ffffff !important; font-size: clamp(2rem, 4vw, 2.6rem) !important; }
html.dark body.pr-page .mc-result.is-primary { background: #f1f5f9 !important; border-color: #f1f5f9 !important; }
html.dark body.pr-page .mc-result.is-primary .mc-result-value { color: #111827 !important; }
html.dark body.pr-page .mc-result.is-primary .mc-result-label, html.dark body.pr-page .mc-result.is-primary .mc-result-sub { color: #374151 !important; }
html body.pr-page #calculator.mc-calculator .mc-results .mc-result.is-primary { background: #111827 !important; border: 1px solid #111827 !important; }
html body.pr-page #calculator.mc-calculator .mc-results .mc-result.is-primary .mc-result-value { color: #ffffff !important; font-size: clamp(2rem, 4vw, 2.6rem) !important; }
html body.pr-page #calculator.mc-calculator .mc-results .mc-result.is-primary .mc-result-label, html body.pr-page #calculator.mc-calculator .mc-results .mc-result.is-primary .mc-result-sub { color: #d1d5db !important; }
html.dark html body.pr-page #calculator.mc-calculator .mc-results .mc-result.is-primary { background: #f1f5f9 !important; border-color: #f1f5f9 !important; }
html.dark html body.pr-page #calculator.mc-calculator .mc-results .mc-result.is-primary .mc-result-value { color: #111827 !important; }
