/* ═══════════════════════════════════════════════════════════════════
   MORTGAGE COST CALCULATOR — STYLESHEET v3.0
   Stack: Bootstrap 5.3 + Custom CSS
   Author: Revamped 2026
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #1a56db;
  --primary-dark:   #1342a8;
  --primary-light:  #eff4ff;
  --accent:         #0ea5e9;
  --success:        #16a34a;
  --success-light:  #f0fdf4;
  --danger:         #dc2626;

  /* Neutrals */
  --surface:        #f8fafc;
  --border:         #e2e8f0;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --white:          #ffffff;

  /* Elevation */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  /* Shape */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;

  /* Motion */
  --t:          0.18s ease;
}

/* ── 2. Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html  { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  margin: 0;
}

img  { border: 0; max-width: 100%; height: auto; }
p    { margin: 0 0 .75rem; }
hr   { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

h1   { color: var(--primary-dark); font-size: 1.65rem; font-weight: 800; margin: .75rem 0 .5rem; }
h2   { font-size: 1.35rem; font-weight: 700; color: var(--primary-dark); }
h3   { font-size: 1.15rem; font-weight: 700; }

a                  { color: var(--primary); text-decoration: none; }
a:hover            { color: var(--primary-dark); text-decoration: underline; }

/* ── 3. Form Controls ─────────────────────────────────────────────── */
input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

input[type="submit"] {
  border: 0;
  color: var(--white);
  background-color: var(--success);
  padding: 11px 48px 11px 16px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  /* Arrow decoration */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="180" height="40"><circle cx="112" cy="20" r="11" fill="rgba(255,255,255,.2)"/><path d="M110 12 120 20 110 28Z" fill="white"/></svg>');
  background-repeat: no-repeat;
  transition: background-color var(--t), transform var(--t);
}
input[type="submit"]:hover {
  background-color: #14532d;
  transform: translateY(-1px);
}

input[type="reset"],
input[type="button"] {
  border: 0;
  color: var(--white);
  background: #94a3b8;
  padding: 11px 12px;
  font-size: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t);
}
input[type="reset"]:hover,
input[type="button"]:hover { background: #475569; }

/* Remove redundant class="form-control" conflicts on inputs that also have custom sizing */
.form-control:focus { box-shadow: 0 0 0 3px rgba(26,86,219,.15); border-color: var(--primary); }

/* ── 4. Dollar / Percent Icon Overlays ──────────────────────────── */
.indollar {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="15" height="20"><text x="2" y="15" style="font:normal 15px arial;fill:%2364748b">$</text></svg>');
  background-position: left center;
  background-repeat: no-repeat;
  padding-left: 14px !important;
}

.inpct {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="20"><text x="1" y="15" style="font:normal 15px arial;fill:%2364748b">%</text></svg>');
  background-position: right center;
  background-repeat: no-repeat;
  padding-right: 20px !important;
}

/* ── 5. Width Utility Classes (keep original API) ────────────────── */
.innormal    { width: 90px;  }
.in4char     { width: 58px;  }
.in3char     { width: 46px;  }
.in2char     { width: 35px;  }
.inlong      { width: 120px; }
.inlonger    { width: 170px; max-width: 100%; }
.inlongest   { width: 230px; }
.inlongesthalf { width: 112px; }
.infull      { width: 226px; }
.inhalf      { width: 110px; }
.infulltxarea { width: 600px; padding: 8px; }
.inshortfull { width: 170px; }
.inshorthalf { width: 82px;  }

/* Inline unit suffix helpers */
.inuiyear    { padding-right: 15px; }
.inuiyearspan { margin-left: -45px; color: var(--text-muted); }
.inuipound   { padding-right: 62px; }
.inuipoundspan { margin-left: -58px; color: var(--text-muted); }

/* ── 6. Checkbox / Radio ─────────────────────────────────────────── */
.cbcontainer {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  position: relative;
  padding-left: 26px;
  margin: 5px 0;
  cursor: pointer;
  user-select: none;
}
.cbcontainer input { position: absolute; opacity: 0; width: 0; height: 0; }

.cbmark, .rbmark {
  position: absolute;
  left: 0; top: 2px;
  width: 18px; height: 18px;
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: 4px;
  transition: background var(--t);
  flex-shrink: 0;
}
.rbmark { border-radius: 50%; }

.cbcontainer:hover .cbmark,
.cbcontainer:hover .rbmark { background: var(--primary-light); }

.cbcontainer input:checked ~ .cbmark,
.cbcontainer input:checked ~ .rbmark { background: var(--primary); }

.cbmark::after, .rbmark::after { content: ''; position: absolute; display: none; }
.cbcontainer input:checked ~ .cbmark::after,
.cbcontainer input:checked ~ .rbmark::after { display: block; }

.cbcontainer .cbmark::after { left: 4px; top: 1px; width: 5px; height: 10px; border: solid var(--white); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.cbcontainer .rbmark::after { top: 4px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--white); }

/* ── 7. Tooltip ──────────────────────────────────────────────────── */
#cnettt {
  position: fixed;
  z-index: 99999;
  max-width: 320px;
  padding: 8px 12px;
  background: #1e293b;
  color: var(--white);
  border: 1px solid #0f172a;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  display: none;
}

.ttimg {
  opacity: .4;
  vertical-align: top;
  cursor: help;
  transition: opacity var(--t);
}
.ttimg:hover { opacity: 1; }

.inputErrMsg {
  position: absolute;
  padding: 4px 8px;
  color: #7f1d1d;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
}

/* ── 8. Site Header ──────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.site-header .navbar { padding: .625rem 0; }

.site-header .navbar-brand img {
  height: 80px;
  width: auto;
  object-fit: contain;
}

/* Nav links */
.site-header .nav-link {
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: .4rem .875rem;
  transition: color var(--t), background var(--t);
}
.site-header .nav-link:hover,
.site-header .nav-link:focus {
  color: var(--primary);
  background: var(--primary-light);
}
.site-header .nav-link.active {
  color: var(--white);
  background: var(--primary);
}
.site-header .nav-link.active:hover { background: var(--primary-dark); }

/* Mobile toggler */
.site-header .navbar-toggler {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .3rem .55rem;
}
.site-header .navbar-toggler:focus { box-shadow: none; outline: 2px solid var(--primary); }

/* Desktop: show full calculators nav in two lines */
@media (min-width: 992px) {
  .site-header .nav-calcs-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    row-gap: 0.2rem;
    max-width: 980px;
  }
  .site-header .nav-calcs-wrap .nav-link {
    font-size: 0.82rem;
    padding: 0.32rem 0.6rem;
    white-space: nowrap;
  }
}

/* ── 9. Page Layout ──────────────────────────────────────────────── */
.page-body { padding: 1.5rem 0 3rem; }

/* Breadcrumbs */
.breadcrumb-nav { font-size: 13px; color: var(--text-muted); margin-bottom: .75rem; }
.breadcrumb-nav a { color: var(--primary); }
.breadcrumb-nav a:hover { text-decoration: underline; }

/* Panel card */
.panel {
  background: var(--white);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* VA calculator form */
.va-calc-form .form-label { margin-bottom: 0.25rem; }
.va-calc-form .va-options-card { border-color: var(--border) !important; }
.va-calc-form .va-more-options .form-label { font-weight: 500; }
.page-va .panel { max-width: 100%; }

/* Result boxes */
.result-box {
  background: var(--success-light);
  border: 1.5px solid #86efac;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.h2result {
  background: var(--success);
  color: var(--white);
  border: 1px solid var(--success);
  padding: 8px 12px;
  margin-top: 3px;
  font-size: 1.35rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* Legacy alias */
.result_box { background: var(--success-light); border: 1.5px solid #86efac; padding: 6px 12px; border-radius: var(--radius-sm); text-align: center; }

/* ── 10. Tables ──────────────────────────────────────────────────── */
table.cinfoT {
  border-collapse: collapse;
  width: 100%;
}
table.cinfoT th,
table.cinfoT td.cinfoHd,
table.cinfoT td.cinfoHdL {
  background: var(--primary);
  color: var(--white);
  font-weight: 700;
  padding: 8px 6px;
  border: 1px solid var(--primary-dark);
  font-size: 10px;
}
table.cinfoT td {
  border: 1px solid var(--border);
  padding: 5px 6px;
  color: var(--text);
  font-size: 12px;
}
table.cinfoT tr:nth-child(odd)  td { background: #f8fafc; color:#000000;}
table.cinfoT tr:nth-child(even) td { background: var(--white); }

/* ── 11. Mortgage Results Container ─────────────────────────────── */
#mortgage-results-container,
#amortization-results-container,
#mortgage-amortization-results-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  /* margin-top: 1rem; */
}

.mortgage-results-sidebyside,
.mortgage-results-amortization {
  min-width: 0;
  box-sizing: border-box;
}

.mortgage-results-sidebyside  { flex: 1 1 340px; }
.mortgage-results-amortization { flex: 2 1 300px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.mortgage-results-amortization .cinfoT { 
   /* min-width: 420px; */
   /* white-space: nowrap;  */
  }

/* Amortization pie: keep circle round and prevent legend crop */
.amort-pie-wrapper { max-width: 380px; margin-left: auto; margin-right: auto; }
.amort-pie-svg {
  display: block;
  max-width: 100%;
  height: auto;
}
.amort-pie-svg path {
  cursor: pointer;
  transition: filter 0.15s ease;
}
.amort-pie-svg path:hover {
  filter: brightness(1.15);
}

/* Pie charts (mortgage 4-slice, FHA 6-slice): hover effect */
.pie-chart-hover path {
  cursor: pointer;
  transition: filter 0.15s ease;
}
.pie-chart-hover path:hover {
  filter: brightness(1.12);
}

/* HELOC result card — match site colors */
.heloc-result-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  height: 100%;
}
.heloc-result-card--compact {
  padding: 0.5rem 0.75rem;
}
.heloc-result-card .heloc-result-title {
  color: var(--primary-dark);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--primary-light);
}
.heloc-result-card--compact .heloc-result-title {
  margin: 0 0 0.35rem;
  padding: 0 0 0.2rem;
}
.heloc-result-card .table td { color: var(--text); }
.heloc-result-card .table .fw-semibold { color: var(--primary-dark); }
.heloc-result-card--compact .table td,
.heloc-result-card--compact .table th {
  padding: 0.2rem 0.4rem;
  border-top-width: 0;
}
.heloc-pie-wrap {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.heloc-result-card--compact .heloc-pie-wrap {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}
.heloc-pie-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  flex-shrink: 0;
  border: 3px solid var(--white);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.heloc-result-card--compact .heloc-pie-circle {
  margin-bottom: 0.35rem;
}
.heloc-result-card--compact .heloc-pie-legend {
  margin-bottom: 0;
}
.heloc-pie-circle:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.heloc-pie-legend { font-size: 0.8125rem; color: var(--text-muted); }
.heloc-pie-legend .pie-dot-principal { background: var(--primary); }
.heloc-pie-legend .pie-dot-interest { background: var(--accent); }
.heloc-schedule-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  height: 100%;
}
.heloc-schedule-card--compact {
  padding: 0.5rem 0.75rem;
}
.heloc-schedule-card .heloc-schedule-title {
  color: var(--primary-dark);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.heloc-schedule-card--compact .heloc-schedule-title {
  margin: 0 0 0.35rem;
}
.heloc-schedule-card--compact #amoselect {
  margin-bottom: 0.35rem !important;
}
.heloc-schedule-card--compact #yearlyamo,
.heloc-schedule-card--compact #monthlyamo {
  margin: 0 -0.25rem 0 0;
}
.heloc-schedule-card--compact .cinfoT th,
.heloc-schedule-card--compact .cinfoT td {
  padding: 4px 5px;
  font-size: 11px;
}
.heloc-schedule-card--compact .cinfoT th {
  padding: 3px 5px;
}

/* Amortization line chart (Balance, Interest, Payment over years) */
.heloc-amort-chart {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  min-height: 200px;
  overflow: visible;
}
.heloc-amort-chart svg {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
}
.heloc-amort-chart .chart-line-balance { stroke: #1a56db; }
.heloc-amort-chart .chart-line-interest { stroke: #059669; }
.heloc-amort-chart .chart-line-payment { stroke: #b91c1c; }
.heloc-amort-chart .chart-legend { font-size: 11px; fill: var(--text-muted); }

/* Home equity / HELOC page: tighter spacing */
.page-heloc #contentout { padding-top: 0.35rem; padding-bottom: 0.35rem; }
.page-heloc .panel { padding: 0.65rem 0.85rem; }
.page-heloc .heloc-result-card--compact { padding: 0.35rem 0.5rem; }
.page-heloc .heloc-result-card--compact .heloc-pie-wrap { margin-top: 0.35rem; padding-top: 0.35rem; }
.page-heloc .heloc-schedule-card--compact { padding: 0.35rem 0.5rem; }
.page-heloc .heloc-schedule-card--compact .heloc-schedule-title { margin-bottom: 0.25rem; }
.page-heloc .heloc-schedule-card--compact #amoselect { margin-bottom: 0.2rem !important; }
.page-heloc .heloc-amort-chart { margin-top: 0.5rem; padding-top: 0.35rem; }

/* ── 12. Instruction Banner ──────────────────────────────────────── */
#insmdc {
  padding: 10px;
  background-color: #044284;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
  line-height: 0;
}
/* #insmdc img { width: 100%; height: auto; max-height: 40px; object-fit: cover; } */
#insmdc h2 { color: #fff; font-size: 24px; font-weight: 600; margin: 0;}

/* ── 13. Misc Helpers ────────────────────────────────────────────── */
.smalltext   { font-size: 13px; }
.bigtext     { font-size: 18px; }
.verybigtext { font-size: 23px; }
.scaleimg    { max-width: 100%; height: auto; }
.morelinespace { line-height: 1.6; }

/* Fraction display */
.frac    { display: inline-block; text-align: center; vertical-align: middle; }
.fracnum { display: block; }
.fracden { display: block; border-top: 1px solid var(--text); padding: 0 3px; }

.reference    { font-size: 13px; padding-left: 1.8em; }
.reference li { font-size: 13px; word-wrap: break-word; }

#printit { float: right; text-align: right; width: 80px; }

/* ── 14. Form Table Layout ───────────────────────────────────────── */
/* Used inside the calculator forms (replaces align="" attributes) */
.calc-form-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}
.calc-form-table td { vertical-align: middle; }
.calc-form-table td:first-child { text-align: right; padding-right: 10px; white-space: nowrap; }
.calc-form-table td:last-child  { white-space: nowrap; }

/* Optional section background */
.optional-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem;
  margin-top: .5rem;
}

/* Collapsible More Options */
.calc-section-toggle {
  font-weight: 600;
  font-size: .875rem;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.calc-section-toggle:hover { color: var(--primary-dark); text-decoration: underline; }

/* ── 15. Calculator Cards (Homepage) ─────────────────────────────── */
.calculator-card {
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  background: var(--white) !important;
  transition: transform var(--t), box-shadow var(--t);
}
.calculator-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md) !important; }
.calculator-card .card-body { display: flex; align-items: center; gap: 14px; padding: 14px 16px !important; }
.calculator-card .calc-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.calculator-card .card-title { font-size: .875rem !important; font-weight: 600 !important; line-height: 1.35; margin: 0; }

.card-financial .calc-icon { background: rgba(26,86,219,.1); color: var(--primary); }
.card-fitness   .calc-icon { background: rgba(220,38,38,.1);  color: var(--danger); }
.card-math      .calc-icon { background: rgba(5,150,105,.1);  color: #059669; }
.card-other     .calc-icon { background: rgba(107,114,128,.1); color: #6b7280; }

/* ── 16. Hero Section (Mortgage Homepage) ───────────────────────── */
.page-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #0c4a6e 100%);
  padding: 3rem 0 3.5rem;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -80px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(14,165,233,.2) 0%, transparent 70%);
  pointer-events: none;
}
.page-hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -60px;
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(26,86,219,.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-headline {
  color: var(--white);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .375rem;
  line-height: 1.2;
}
.hero-sub { color: #94a3b8; font-size: 1rem; margin-bottom: 1.75rem; }

/* ── 17. Scientific Calculator (Hero Widget) ─────────────────────── */
.sci-calc-modern {
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.2);
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.sci-calc-label {
  font-size: .75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.sci-calc-label i { font-size: 1.1rem; color: #38bdf8; }

#sciOutPut {
  font-size: 2rem;
  font-weight: 700;
  padding: .875rem 1.125rem;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--white);
  min-height: 56px;
  letter-spacing: .03em;
  text-align: right;
  font-family: 'SF Mono', 'Fira Code', monospace;
  word-break: break-all;
}

#sciInPut {
  font-size: .85rem;
  color: #64748b;
  min-height: 22px;
  margin-bottom: 6px;
  text-align: right;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Sci-calc buttons (inside hero) */
.scifunc, .scinm, .sciop, .scieq {
  width: 52px; height: 42px;
  border-radius: 10px;
  font-size: 14px;
  margin: 2.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .08s, opacity .1s, background .1s;
  font-weight: 500;
}
.scifunc:hover, .scinm:hover, .sciop:hover, .scieq:hover { transform: scale(.95); opacity: .85; }
.scifunc { background: rgba(100,116,139,.3); color: #cbd5e1; border-color: rgba(255,255,255,.05); }
.scinm   { background: rgba(255,255,255,.12); color: var(--white); border-color: rgba(255,255,255,.1); font-size: 15px; }
.sciop   { background: rgba(14,165,233,.25); color: #7dd3fc; border-color: rgba(14,165,233,.2); }
.scieq   { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: var(--white); border-color: var(--primary-dark); font-weight: 700; font-size: 16px; }
.sceeq:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, #0f2d6b 100%); }

.scird { border-radius: 8px; padding: 4px 8px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); color: #94a3b8; font-size: 13px; }
.scird label { margin: 0 2px; cursor: pointer; }

#scihistory, #scihistory div {
  width: 100%; border-radius: 6px;
  font-size: 12px; color: #475569;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── 18. Site Footer ─────────────────────────────────────────────── */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  margin-top: 3rem;
}

.footer-main {
  padding: 3.75rem 0 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.footer-col { text-align: left; }

.footer-heading {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--white);
  margin-bottom: 1.125rem;
  padding-bottom: .625rem;
  position: relative;
}
.footer-heading::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 30px; height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.footer-text { font-size: 13.5px; line-height: 1.75; color: #94a3b8; }

.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .625rem; }
.footer-links li a {
  color: #94a3b8;
  font-size: 13.5px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--t), padding-left var(--t);
}
.footer-links li a:hover { color: #38bdf8; padding-left: 4px; }
.footer-links li a i { color: var(--primary); font-size: 12px; transition: color var(--t); }
.footer-links li a:hover i { color: #38bdf8; }

.social-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: .5rem; }
.social-link {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: #94a3b8;
  font-size: 16px;
  border: 1px solid rgba(255,255,255,.1);
  text-decoration: none;
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
}
.social-link:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}

.footer-bottom { padding: 1.125rem 0; background: #080f1c; }
.footer-bottom p { font-size: 13px; color: #64748b; margin: 0; }
.footer-bottom a { color: #94a3b8; }
.footer-bottom a:hover { color: #38bdf8; }
.footer-tagline { font-size: 13px; color: #94a3b8; }

/* ── 19. Contact Page ────────────────────────────────────────────── */
.contact-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1a3a6b 100%);
  padding: 4.375rem 0 3.75rem;
  text-align: center;
  color: var(--white);
}
.contact-hero h1 { color: var(--white); font-size: 2.2rem; font-weight: 800; }
.contact-hero p  { color: #94a3b8; font-size: 1.05rem; margin: 0; }

.contact-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem;
  height: 100%;
}
.contact-icon-box {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}
.contact-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .375rem; }
.contact-card p  { font-size: 14px; color: var(--text-muted); margin: 0; }

.contact-form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.75rem;
}
.contact-form-card .form-label   { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.contact-form-card .form-control,
.contact-form-card .form-select  { border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; padding: 10px 14px; transition: border-color var(--t), box-shadow var(--t); }
.contact-form-card textarea.form-control { min-height: 140px; resize: vertical; }

.btn-submit {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 36px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t), transform var(--t);
}
.btn-submit:hover { background: var(--primary-dark); transform: translateY(-1px); }

.faq-item { padding: 1.25rem 0; }
.faq-item:first-child { padding-top: 0; }
.faq-item:last-child  { border-bottom: none; }
.faq-item h5 { font-size: .98rem; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.faq-item p  { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.75; }

/* ── 20. Amortization / Mortgage-Amortization Page ───────────────── */
.page-amortization .panel,
.page-amortization .table-responsive { max-width: 100%; overflow-x: auto; }

/* ── 21. Blue CTA Button (inline mortgage widget) ───────────────── */
#bluebtn,
.bluebtn {
  display: inline-block;
  background: var(--success);
  color: var(--white);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
}
#bluebtn:hover, .bluebtn:hover { background: #14532d; color: var(--white); }

/* ── 22. Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  h1  { font-size: 1.4rem; }
  .hero-headline { font-size: 1.4rem; }
  .contact-form-card { padding: 1.5rem; }
  .infulltxarea { width: 100%; }
}

@media (max-width: 576px) {
  .mortgage-results-sidebyside,
  .mortgage-results-amortization { flex: 1 1 100%; }
  .panel { padding: .875rem; }
}

@media (max-width: 480px) {
  .scifunc, .scinm, .sciop, .scieq { width: 44px; height: 38px; font-size: 12px; margin: 2px; }
}

/* ── 23. Print ───────────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, #printit, .no-print, .ads-slot { display: none !important; }
  body { background: var(--white); }
  .panel { border: 1px solid #ccc; box-shadow: none; }
}

/* ── 24. Google AdSense Ad Slots ─────────────────────────────────────
   Placeholder styles shown until real AdSense code is activated.
   Remove .ads-placeholder block once AdSense is live.
   TEMPORARY: hide all ad slots — remove the rule below to show ads again.
   ─────────────────────────────────────────────────────────────────── */
.ads-slot {
  display: none !important; /* TEMPORARY: hide ad banners — remove this line to show ads again */
  width: 100%;
  margin: 0 auto;
  text-align: center;
  clear: both;
  overflow: hidden;
}

/* Leaderboard: full-width strip */
.ads-slot--leaderboard {
  max-width: 100%;
  padding: 8px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Rectangle: 300×250 block, centered or left-floated in sidebar */
.ads-slot--rectangle {
  max-width: 336px;   /* 336px is AdSense's best-performer variant */
  margin: 0 auto 1rem;
}

/* In-article: fluid width */
.ads-slot--in-article {
  max-width: 100%;
  margin: 1.5rem auto;
}

/* Horizontal banner: narrower strip between sections */
.ads-slot--horizontal {
  max-width: 970px;
  padding: 6px 0;
  margin: 1.5rem auto;
}

/* ── Placeholder visuals (remove when AdSense is live) ── */
.ads-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 11px;
  font-family: inherit;
  letter-spacing: .03em;
  text-transform: uppercase;
  user-select: none;
  pointer-events: none;
}

.ads-slot--leaderboard   .ads-placeholder { min-height: 90px;  max-height: 90px;  }
.ads-slot--rectangle     .ads-placeholder { min-height: 250px; max-height: 250px; width: 300px; margin: 0 auto; }
.ads-slot--in-article    .ads-placeholder { min-height: 120px; }
.ads-slot--horizontal    .ads-placeholder { min-height: 60px;  max-height: 60px;  }

.ads-placeholder__label {
  font-weight: 700;
  font-size: 12px;
  color: #64748b;
}
.ads-placeholder__note {
  font-size: 10px;
  color: #94a3b8;
}

/* Hide placeholders on very small screens where ads wouldn't serve anyway */
@media (max-width: 360px) {
  .ads-slot--leaderboard,
  .ads-slot--horizontal { display: none; }
}

/* ── Balloon Mortgage Calculator — compact, side-by-side ───────────── */
.page-balloon #contentout { padding-top: 0.5rem; padding-bottom: 1rem; }
.page-balloon .breadcrumb-nav { margin-bottom: 0.35rem; }
.page-balloon .balloon-page-title { font-size: 1.4rem; margin: 0.25rem 0 0.2rem; }
.page-balloon .balloon-page-desc { font-size: 0.875rem; margin-bottom: 0.75rem; }

.page-balloon .balloon-calc-row { margin-bottom: 0; }
.page-balloon .balloon-calc-row .panel { padding: 0.875rem 1rem; margin-bottom: 0; }

.page-balloon .balloon-panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.page-balloon .balloon-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.page-balloon .balloon-label .bi { font-size: 0.7rem; }
.page-balloon .balloon-field {
  margin-bottom: 0.5rem;
}
.page-balloon .balloon-field:last-of-type { margin-bottom: 0; }
.page-balloon .balloon-slider {
  max-width: 100%;
  height: 6px;
  accent-color: var(--primary);
  margin-top: 0.25rem;
}
.page-balloon .balloon-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.page-balloon .balloon-input-sm { width: 3.5rem; }
.page-balloon .balloon-prepay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.page-balloon .balloon-prepay-row .form-label { margin-bottom: 0; }

/* Right column: results */
.page-balloon .balloon-summary-hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  text-align: center;
}
.page-balloon .balloon-hero-text {
  font-size: 1rem;
  color: var(--text);
  margin: 0;
}
.page-balloon .balloon-hero-text strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.page-balloon .balloon-results-panel {
  padding: 0.6rem 1rem;
  margin-bottom: 0.5rem;
}
.page-balloon .balloon-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
}
.page-balloon .balloon-result-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.page-balloon .balloon-result-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.page-balloon .balloon-result-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.page-balloon .balloon-total-bar {
  background: var(--primary);
  color: var(--white);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}
.page-balloon .balloon-total-inner { padding: 0.5rem 0.75rem; }
.page-balloon .balloon-total-bar span span { font-weight: 700; }

/* Principal & interest chart — Bankrate-style, compact */
.page-balloon .balloon-chart-panel {
  padding: 0.4rem 0.75rem 0.35rem;
  margin-bottom: 0;
  border: 1px solid var(--border);
}
.page-balloon .balloon-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin-bottom: 0.2rem;
  padding-bottom: 0.2rem;
}
.page-balloon .balloon-chart-title {
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.page-balloon .balloon-chart-legend {
  display: flex;
  gap: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.page-balloon .balloon-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.page-balloon .balloon-chart-body {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 140px;
}
.page-balloon .balloon-chart-y-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  writing-mode: vertical-rl;
  transform: rotate(-180deg);
  white-space: nowrap;
  padding: 0.35rem 0;
  line-height: 1.35;
}
.page-balloon .balloon-chart-container {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 140px;
  max-width: 100%;
}
.page-balloon #balloon-chart {
  max-width: 100%;
  width: 100%;
  height: 100%;
  display: block;
  vertical-align: top;
}
.page-balloon .balloon-chart-caption {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0;
  padding: 0;
  text-align: center;
}
.page-balloon .balloon-legend-sq {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
}
.page-balloon .balloon-legend-interest { background: #1a56db; }
.page-balloon .balloon-legend-principal { background: #16a34a; }

/* Principal Balances by Year — vertical bar chart (below first chart) */
.page-balloon .balloon-balances-panel {
  padding: 0.5rem 0.75rem 0.4rem;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
}
.page-balloon .balloon-balances-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
  color: var(--text);
  text-align: center;
}
.page-balloon .balloon-balances-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
  text-align: center;
}
.page-balloon .balloon-balances-chart-body {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 220px;
}
.page-balloon .balloon-balances-chart-body .balloon-chart-y-label {
  width: 2.75rem;
}
.page-balloon .balloon-balances-chart-container {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 260px;
  max-width: 100%;
}
.page-balloon #balloon-balances-chart {
  max-width: 100%;
  width: 100%;
  height: 100%;
  display: block;
}
.page-balloon .balloon-balances-x-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0.25rem 0 0;
}

.page-balloon .balloon-content-hr { margin: 1rem 0 0.75rem; border-color: var(--border); }
.page-balloon .balloon-h2 { font-size: 1.1rem; margin: 0 0 0.35rem; }
.page-balloon .balloon-p { margin-bottom: 0.5rem; font-size: 0.9rem; }
.page-balloon .balloon-related { margin-bottom: 1rem; }

/* ── Mortgage Tax Deduction — Result Cards (compact) ────────────────── */
.page-mortgage-tax-deduction .td-results-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.page-mortgage-tax-deduction .td-results-placeholder {
  padding: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Top row: Hero + Summary side by side on md+ */
.page-mortgage-tax-deduction .td-results-row-1 {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .page-mortgage-tax-deduction .td-results-row-1 {
    grid-template-columns: 1fr 1.2fr;
    align-items: stretch;
  }
}

/* Base card — compact padding */
.page-mortgage-tax-deduction .td-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.page-mortgage-tax-deduction .td-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

/* Hero card — compact */
.page-mortgage-tax-deduction .td-card-hero {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem 0.65rem 0.85rem;
  border-left: 3px solid var(--success);
  background: linear-gradient(135deg, var(--white) 0%, var(--success-light) 100%);
}
.page-mortgage-tax-deduction .td-card-hero-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 6px;
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.page-mortgage-tax-deduction .td-card-hero-body {
  flex: 1;
  min-width: 0;
}
.page-mortgage-tax-deduction .td-card-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.page-mortgage-tax-deduction .td-card-hero-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--success);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Metric cards grid — tight */
.page-mortgage-tax-deduction .td-cards-grid {
  display: grid;
  gap: 0.4rem;
}
.page-mortgage-tax-deduction .td-cards-grid-4 {
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 576px) {
  .page-mortgage-tax-deduction .td-cards-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}
.page-mortgage-tax-deduction .td-card-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.6rem;
}
.page-mortgage-tax-deduction .td-card-metric .td-card-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* Totals card — compact */
.page-mortgage-tax-deduction .td-card-totals {
  padding: 0.6rem 1rem;
}
.page-mortgage-tax-deduction .td-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.25rem 0;
}
.page-mortgage-tax-deduction .td-totals-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}
.page-mortgage-tax-deduction .td-totals-row-sub .td-card-value {
  font-weight: 600;
  font-size: 0.85rem;
}
.page-mortgage-tax-deduction .td-card-value-lg {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-dark);
}

/* Second row: Totals + Chart side by side on md+ */
.page-mortgage-tax-deduction .td-results-row-2 {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .page-mortgage-tax-deduction .td-results-row-2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* Chart card — smaller */
.page-mortgage-tax-deduction .td-card-chart {
  padding: 0.65rem 1rem;
}
.page-mortgage-tax-deduction .td-chart-wrap {
  max-width: 280px;
  height: 160px;
  margin: 0 auto;
}
.page-mortgage-tax-deduction #td-stacked-chart {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 280px;
  max-height: 160px;
}
.page-mortgage-tax-deduction .td-chart-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.page-mortgage-tax-deduction .td-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.page-mortgage-tax-deduction .td-chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.page-mortgage-tax-deduction .td-chart-dot-principal { background: #0d6efd; }
.page-mortgage-tax-deduction .td-chart-dot-interest { background: #198754; }

/* Chart tooltip (hover) */
.td-chart-tooltip {
  display: none;
  position: fixed;
  z-index: 1050;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white);
  background: var(--text);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: nowrap;
}
.page-mortgage-tax-deduction .td-card-chart {
  cursor: default;
}

/* Detail section — compact */
.page-mortgage-tax-deduction .td-detail-section {
  margin-top: 0.15rem;
}
.page-mortgage-tax-deduction .td-detail-toggle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.page-mortgage-tax-deduction .td-detail-toggle:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}
.page-mortgage-tax-deduction .td-detail-toggle[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}
.page-mortgage-tax-deduction .td-detail-toggle .bi-chevron-down {
  display: inline-block;
  transition: transform 0.2s ease;
}
.page-mortgage-tax-deduction .td-card-detail {
  margin-top: 0.4rem;
  padding: 0.6rem 0.9rem;
}
.page-mortgage-tax-deduction .td-detail-table .td-detail-label {
  font-size: 0.8rem;
  color: var(--text);
  padding: 0.3rem 0.5rem 0.3rem 0;
}
.page-mortgage-tax-deduction .td-detail-table .td-detail-value {
  font-size: 0.8rem;
  padding: 0.3rem 0 0.3rem 0.5rem;
}
.page-mortgage-tax-deduction .td-detail-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--border);
}

/* ── House Affordability — reference-style results (green header, breakdown table) ── */
.ha-ref-results__head {
  background: linear-gradient(90deg, #15803d 0%, #16a34a 100%);
  border-bottom: 1px solid #14532d;
}
.ha-ref-results__save:hover {
  opacity: 0.88;
}
.ha-ref-results__amount {
  color: #15803d;
  font-weight: 800;
  font-size: 1.12em;
}
.ha-ref-results__lead {
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text);
}
.ha-ref-results__table th {
  font-weight: 500;
  width: 55%;
}
.ha-ref-results__table td {
  vertical-align: middle;
}
.ha-ref-results__totalrow th,
.ha-ref-results__totalrow td {
  background-color: #f0fdf4 !important;
}
.ha-mrate-box {
  box-shadow: var(--shadow-sm);
}

/* Mortgage Payoff calculator */
.page-mortgage-payoff .mp-page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.page-mortgage-payoff .mp-page-subtitle {
  font-size: 0.93rem;
}
.page-mortgage-payoff .mp-section-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 1.15rem;
}
.page-mortgage-payoff .mp-form-panel,
.page-mortgage-payoff .mp-results-panel {
  border: 1px solid #dbe5f4;
  padding: 0.9rem;
}
.page-mortgage-payoff .mp-results-panel {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}
.page-mortgage-payoff .mp-result-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f2b57;
}
.page-mortgage-payoff .mp-summary {
  background: #eef6ff;
  border: 1px solid #d4e7ff;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  line-height: 1.35;
  font-size: 0.9rem;
}
.page-mortgage-payoff .mp-results-table thead th {
  background: #f3f7ff;
  color: #1f3b69;
  font-weight: 700;
  font-size: 0.84rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.page-mortgage-payoff .mp-results-table td {
  font-size: 0.85rem;
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}
.page-mortgage-payoff .mp-results-table tbody tr:last-child td {
  background: #f8fbff;
  font-weight: 700;
}
.page-mortgage-payoff .mp-amort-btn {
  font-weight: 600;
  font-size: 0.82rem;
}
.page-mortgage-payoff .form-check {
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.38rem 0.55rem 0.38rem 2rem;
  margin-bottom: 0.32rem;
  background: #fff;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.page-mortgage-payoff .form-check:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}
.page-mortgage-payoff .form-check-input {
  margin-top: 0.2rem;
  margin-left: -1.25rem;
  margin-right: 0.5rem;
  width: 1rem;
  height: 1rem;
  border: 1.8px solid #64748b;
}
.page-mortgage-payoff .form-check-input:checked {
  background-color: #2563eb;
  border-color: #2563eb;
}
.page-mortgage-payoff .form-check-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #334155;
  margin-left: 0.32rem;
}
.page-mortgage-payoff .form-check:has(.form-check-input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.page-mortgage-payoff .form-check:has(.form-check-input:focus-visible) {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}
.page-mortgage-payoff canvas[id^="payoff-chart-"] {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.page-mortgage-payoff #amort-wrap-1,
.page-mortgage-payoff #amort-wrap-2 {
  max-height: 360px;
  overflow: auto;
}
.page-mortgage-payoff #amort-wrap-1 table,
.page-mortgage-payoff #amort-wrap-2 table {
  margin-bottom: 0.2rem;
}
.page-mortgage-payoff #amort-wrap-1 td,
.page-mortgage-payoff #amort-wrap-1 th,
.page-mortgage-payoff #amort-wrap-2 td,
.page-mortgage-payoff #amort-wrap-2 th {
  font-size: 0.79rem;
  padding-top: 0.26rem;
  padding-bottom: 0.26rem;
}

@media (max-width: 991.98px) {
  .page-mortgage-payoff .mp-page-title {
    font-size: 1.5rem;
  }
  .page-mortgage-payoff .mp-form-panel,
  .page-mortgage-payoff .mp-results-panel {
    padding: 0.82rem;
  }
}

/* Down Payment calculator — dense layout, less vertical gap between sections */
.page-down-payment .page-down-payment-wrap {
  padding-top: 0.5rem;
  padding-bottom: 0.75rem;
}
.page-down-payment .page-down-payment-wrap .cinfoT td,
.page-down-payment .page-down-payment-wrap .cinfoT th {
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
}
.page-down-payment .page-down-payment-wrap .table-responsive {
  margin-bottom: 0;
}
.page-down-payment .page-down-payment-wrap .cinfoT {
  margin-bottom: 0;
}
.page-down-payment h2.dp-sec-title {
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid #e8edf3;
  letter-spacing: 0.02em;
}
.page-down-payment #insmdc + h2.dp-sec-title {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
/* Down payment — comparison table (compact type) */
.page-down-payment .dp-compare-table {
  --dp-compare-blue: #0d2344;
  font-size: 0.6875rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.page-down-payment #dp1-compare-wrap > p.h6,
.page-down-payment #dp2-compare-wrap > p.h6 {
  font-size: 0.72rem;
  line-height: 1.25;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.page-down-payment .dp-compare-thead th {
  background: var(--dp-compare-blue);
  color: #fff;
  font-weight: 600;
  font-size: 0.6875rem;
  line-height: 1.15;
  padding: 0.2rem 0.28rem;
  border-color: rgba(255, 255, 255, 0.2);
}
.page-down-payment .dp-compare-table tbody th {
  font-weight: 600;
  font-size: 0.6875rem;
  line-height: 1.2;
  padding: 0.18rem 0.28rem;
  background: #fff;
}
.page-down-payment .dp-compare-table tbody td {
  font-size: 0.6875rem;
  line-height: 1.2;
  padding: 0.18rem 0.28rem;
  font-variant-numeric: tabular-nums;
}
.page-down-payment .dp-compare-tr:nth-child(even) th,
.page-down-payment .dp-compare-tr:nth-child(even) td {
  background: #f1f4f9;
}
.page-down-payment [id$="compare-host"] {
  min-width: 0;
}

/* Rates column: card + iframe stack (same UX as house-affordability) */
.page-down-payment .dp-mrate-col {
  min-width: 0;
}
.page-down-payment .dp-article h2:first-child {
  margin-top: 0.35rem !important;
}

/* ─── Debt-to-Income (DTI) calculator — compact form + results ───── */
.page-debt-ratio #dti-results {
  scroll-margin-top: 5.25rem;
}
.page-debt-ratio .dti-form-panel {
  margin-bottom: 0;
}
.page-debt-ratio .dti-form-sec {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}
.page-debt-ratio .dti-field-hint {
  display: block;
  font-size: 0.65rem;
  line-height: 1.2;
  color: #94a3b8;
  margin-top: 0.1rem;
}
.page-debt-ratio .dti-compact-form .input-group-sm > .form-control,
.page-debt-ratio .dti-compact-form .input-group-sm > .form-select {
  min-height: calc(1.5em + 0.35rem + 2px);
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}
.page-debt-ratio .dti-results-card {
  border-radius: 0.5rem;
  background: #fff;
}
.page-debt-ratio .dti-results-card__head {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 48%, #14b8a6 100%);
  color: #fff;
  padding: 0.35rem 0.65rem;
}
.page-debt-ratio .dti-results-card__title {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff !important;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.page-debt-ratio .dti-results-placeholder {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
/* KPI strip — back-end + front-end */
.page-debt-ratio .dti-results-detail {
  padding: 0;
}
.page-debt-ratio .dti-kpi-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  background: linear-gradient(125deg, #0d9488 0%, #0f766e 55%, #115e59 100%);
  color: #fff;
}
.page-debt-ratio .dti-kpi-strip__main {
  flex: 1 1 58%;
  min-width: 10rem;
  padding: 0.55rem 0.75rem 0.55rem;
}
.page-debt-ratio .dti-kpi-strip__tag {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.4rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  margin-bottom: 0.35rem;
}
.page-debt-ratio .dti-kpi-strip__tag--dark {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(13, 148, 136, 0.35);
  color: #0f766e;
}
.page-debt-ratio .dti-kpi-strip__title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  line-height: 1.25;
}
.page-debt-ratio .dti-kpi-strip__title-strong {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.page-debt-ratio .dti-kpi-strip__formula {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.page-debt-ratio .dti-kpi-strip__value-row {
  margin-top: 0.35rem;
}
.page-debt-ratio .dti-kpi-strip__value {
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.page-debt-ratio .dti-kpi-strip__value--glow {
  display: inline-block;
  padding: 0.15rem 0.5rem 0.2rem;
  margin-left: -0.35rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.15);
}
.page-debt-ratio .dti-kpi-strip__side {
  flex: 1 1 38%;
  min-width: 7rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  text-align: right;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-left: 3px solid rgba(13, 148, 136, 0.65);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.page-debt-ratio .dti-kpi-strip__side-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #334155;
}
.page-debt-ratio .dti-kpi-strip__side-value {
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-top: 0.15rem;
  color: #0d9488;
  text-shadow: none;
}
.page-debt-ratio .dti-kpi-strip__side-hint {
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 0.15rem;
  color: #1e293b;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  background: #e2e8f0;
}
.page-debt-ratio .dti-kpi-strip--good {
  box-shadow: inset 0 -3px 0 rgba(52, 211, 153, 0.95);
}
.page-debt-ratio .dti-kpi-strip--warn {
  box-shadow: inset 0 -3px 0 rgba(250, 204, 21, 0.95);
}
.page-debt-ratio .dti-kpi-strip--risk {
  box-shadow: inset 0 -3px 0 rgba(248, 113, 113, 0.95);
}
.page-debt-ratio .dti-gauge-block {
  padding-top: 0.45rem;
  padding-bottom: 0.35rem;
}
.page-debt-ratio .dti-scale-highlight {
  margin-top: 0.45rem;
  padding: 0.4rem 0.45rem 0.45rem;
  border-radius: 0.45rem;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.page-debt-ratio .dti-scale-highlight__eyebrow {
  display: block;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #475569;
  margin-bottom: 0.35rem;
}
.page-debt-ratio .dti-scale-highlight__pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
.page-debt-ratio .dti-scale-pill {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.35rem 0.4rem;
  border-radius: 0.4rem;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.page-debt-ratio .dti-scale-pill--safe {
  background: #d1fae5;
  border-color: #34d399;
  color: #065f46;
}
.page-debt-ratio .dti-scale-pill--mid {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #92400e;
}
.page-debt-ratio .dti-scale-pill--stress {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}
@media (max-width: 400px) {
  .page-debt-ratio .dti-scale-pill {
    font-size: 0.6rem;
    padding: 0.28rem 0.25rem;
  }
}
.page-debt-ratio .dti-gauge__caret-wrap {
  height: 0.5rem;
  margin-bottom: 0.12rem;
  padding-top: 0.1rem;
}
.page-debt-ratio .dti-gauge__caret {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid #0f172a;
  transform: translateX(-50%);
  top: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}
.page-debt-ratio .dti-gauge__track {
  height: 0.55rem;
  width: 100%;
  background: linear-gradient(
    90deg,
    #10b981 0%,
    #10b981 28%,
    #84cc16 42%,
    #eab308 50%,
    #f97316 62%,
    #ef4444 78%,
    #b91c1c 100%
  );
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.page-debt-ratio .dti-chart-cap {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.2rem;
}
.page-debt-ratio .dti-risk-msg {
  color: #334155;
  line-height: 1.3;
  padding: 0.28rem 0.45rem;
  border-radius: 0.3rem;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.page-debt-ratio .dti-risk-msg.is-positive {
  background: #ecfdf5;
  border-color: rgba(16, 185, 129, 0.25);
  color: #065f46;
}
.page-debt-ratio .dti-risk-msg.is-warn {
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.35);
  color: #92400e;
}
.page-debt-ratio .dti-risk-msg.is-danger {
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.3);
  color: #991b1b;
}
.page-debt-ratio .dti-donut-wrap {
  width: 100%;
  max-width: 180px;
}
.page-debt-ratio .dti-donut-wrap canvas {
  max-width: 100%;
  height: auto !important;
}
.page-debt-ratio .dti-legend li {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}
.page-debt-ratio .dti-legend li:last-child {
  border-bottom: 0;
}
.page-debt-ratio .dti-legend__swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 0.12rem;
  flex-shrink: 0;
  margin-top: 0.18rem;
}
.page-debt-ratio .dti-legend__label {
  flex: 1;
  min-width: 0;
  color: #475569;
  font-size: 0.78rem;
  line-height: 1.25;
}
.page-debt-ratio .dti-legend__pct {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  font-size: 0.8rem;
}
/* Summary table — highlight DTI rows (override global cinfoT th = primary blue + white text) */
.page-debt-ratio .dti-sum-table {
  border-color: rgba(15, 23, 42, 0.1) !important;
}
.page-debt-ratio .dti-sum-table th,
.page-debt-ratio .dti-sum-table td {
  padding: 0.25rem 0.4rem !important;
  font-size: 0.78rem;
  vertical-align: middle;
  border-color: rgba(15, 23, 42, 0.1) !important;
}
/* Light label column — never use primary header fill here (was hiding dark text) */
.page-debt-ratio .dti-sum-table th {
  font-weight: 700;
  width: 42%;
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
}
.page-debt-ratio .dti-sum-table td {
  background: #ffffff !important;
  color: #0f172a !important;
}
.page-debt-ratio .dti-sum-table tr:nth-child(odd) td,
.page-debt-ratio .dti-sum-table tr:nth-child(even) td {
  background: #ffffff !important;
  color: #0f172a !important;
}
.page-debt-ratio .dti-sum-tr--back th {
  background: rgba(13, 148, 136, 0.18) !important;
  color: #0f3d38 !important;
  font-weight: 800;
}
.page-debt-ratio .dti-sum-tr--back td {
  background: rgba(13, 148, 136, 0.06) !important;
}
.page-debt-ratio .dti-sum-tr--front th {
  background: rgba(37, 99, 235, 0.14) !important;
  color: #1e3a8a !important;
  font-weight: 800;
}
.page-debt-ratio .dti-sum-tr--front td {
  background: rgba(37, 99, 235, 0.05) !important;
}
.page-debt-ratio .dti-sum-tr--back {
  background: transparent;
}
.page-debt-ratio .dti-sum-tr--front {
  background: transparent;
}
.page-debt-ratio .dti-sum-pct {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: #0f766e;
}
.page-debt-ratio .dti-sum-pct--secondary {
  color: #1d4ed8;
  font-size: 0.9rem;
}
.page-debt-ratio .dti-sum-money {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}
.page-debt-ratio .dti-sum-sub {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 500;
}
.page-debt-ratio .dti-results-footnote {
  padding: 0.35rem 0.65rem 0.45rem;
  line-height: 1.35;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}
.page-debt-ratio .dti-results-footnote strong {
  color: #0f766e;
  font-weight: 800;
}
