/* ===========================
   Mortgage Calculator Site
   Shared Stylesheet — Mobile First
   =========================== */

:root {
  --blue: #6366f1;
  --blue-dark: #4f46e5;
  --blue-light: #eef2ff;
  --green: #059669;
  --green-light: #d1fae5;
  --orange: #fb923c;
  --gray-50: #faf9ff;
  --gray-100: #f3f2fe;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #1e1b4b;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
}

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

/* ===========================
   LAYOUT
   =========================== */

.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===========================
   HEADER / NAV
   =========================== */

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; }

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--gray-700);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.nav-links a:hover { background: var(--blue-light); color: var(--blue); text-decoration: none; }
.nav-links a.active { color: var(--blue); font-weight: 600; }

.nav-cta {
  background: var(--blue);
  color: var(--white) !important;
  padding: 8px 16px !important;
  border-radius: var(--radius-sm);
  font-weight: 600;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--blue-dark); color: var(--white) !important; }

/* ===========================
   AGENT BANNER
   =========================== */

.agent-banner {
  background: var(--blue-light);
  border-bottom: 1px solid #c7d2fc;
  padding: 10px 0;
}

.agent-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.agent-banner img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--blue);
  flex-shrink: 0;
}

.agent-banner-info { flex: 1; min-width: 0; }
.agent-banner-info strong { display: block; font-size: 0.9rem; }
.agent-banner-info span { font-size: 0.8rem; color: var(--gray-600); }

.agent-banner-contact {
  background: var(--blue);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.agent-banner-contact:hover { background: var(--blue-dark); color: var(--white); text-decoration: none; }

/* ===========================
   PAGE HERO
   =========================== */

.page-hero {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 60%, #4f46e5 100%);
  color: var(--white);
  padding: 40px 0 32px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 8px;
}

.page-hero p {
  font-size: 1rem;
  opacity: 0.9;
  max-width: 560px;
  margin: 0 auto;
}

/* ===========================
   CALCULATOR CARD
   =========================== */

.calc-section { padding: 32px 0; }

.calc-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 768px) {
  .calc-grid { grid-template-columns: 1fr 1fr; }
}

.calc-inputs {
  padding: 28px;
  border-bottom: 1px solid var(--gray-200);
}

@media (min-width: 768px) {
  .calc-inputs {
    border-bottom: none;
    border-right: 1px solid var(--gray-200);
  }
}

.calc-inputs h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 20px;
}

.calc-results {
  padding: 28px;
  background: var(--gray-50);
}

.calc-results h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 20px;
}

/* ===========================
   FORM ELEMENTS
   =========================== */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.input-prefix-wrap {
  position: relative;
}
.input-prefix-wrap .prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-600);
  font-size: 1rem;
  pointer-events: none;
}
.input-prefix-wrap input {
  padding-left: 28px !important;
}

.input-suffix-wrap {
  position: relative;
}
.input-suffix-wrap .suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-600);
  font-size: 1rem;
  pointer-events: none;
}
.input-suffix-wrap input {
  padding-right: 36px !important;
}

/* Toggle group (% vs $) */
.toggle-group {
  display: flex;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.toggle-group button {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--white);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: all 0.15s;
}
.toggle-group button.active {
  background: var(--blue);
  color: var(--white);
}

/* Range slider */
.slider-wrap { display: flex; align-items: center; gap: 12px; }
.slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--blue);
  height: 6px;
  cursor: pointer;
}
.slider-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue);
  min-width: 60px;
  text-align: right;
}

/* Term select pills */
.term-pills { display: flex; gap: 8px; }
.term-pills button {
  flex: 1;
  padding: 9px 4px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: all 0.15s;
}
.term-pills button.active {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
}

/* ===========================
   RESULTS DISPLAY
   =========================== */

.result-big {
  text-align: center;
  padding: 20px;
  background: var(--blue);
  border-radius: var(--radius-sm);
  color: var(--white);
  margin-bottom: 20px;
}
.result-big .label { font-size: 0.85rem; opacity: 0.85; margin-bottom: 4px; }
.result-big .amount { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.02em; }
.result-big .sub { font-size: 0.8rem; opacity: 0.8; margin-top: 4px; }

.result-breakdown { list-style: none; margin-bottom: 20px; }
.result-breakdown li {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
}
.result-breakdown li:last-child { border-bottom: none; }
.result-breakdown .label-dot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.result-breakdown .value { font-weight: 700; }

.result-stat {
  background: var(--green-light);
  color: var(--green);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Donut/pie chart placeholder */
.chart-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
canvas.pie-chart {
  max-width: 160px;
  max-height: 160px;
}

/* ===========================
   AFFILIATE CTA
   =========================== */

.affiliate-cta {
  background: linear-gradient(135deg, #fff7ed, #fff0e0);
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 28px 0;
  text-align: center;
}
.affiliate-cta .cta-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.affiliate-cta h3 { font-size: 1.1rem; margin-bottom: 6px; }
.affiliate-cta p { font-size: 0.9rem; color: var(--gray-600); margin-bottom: 14px; }

.btn-primary {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}
.btn-primary:hover { opacity: 0.9; color: var(--white); text-decoration: none; }

.btn-secondary {
  display: inline-block;
  background: var(--blue);
  color: var(--white);
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}
.btn-secondary:hover { opacity: 0.9; color: var(--white); text-decoration: none; }

.btn-outline {
  display: inline-block;
  background: transparent;
  color: var(--blue);
  padding: 11px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid var(--blue);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-outline:hover { background: var(--blue); color: var(--white); text-decoration: none; }

/* Agent contextual CTA (after results) */
.agent-cta-result {
  background: var(--blue-light);
  border: 1.5px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}
.agent-cta-result img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.agent-cta-result .text { flex: 1; font-size: 0.9rem; color: var(--gray-700); }
.agent-cta-result .text strong { display: block; }
.agent-cta-result a {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===========================
   ADSENSE PLACEHOLDER
   =========================== */

.adsense-slot {
  background: var(--gray-100);
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: 24px;
  margin: 28px 0;
  color: var(--gray-400);
  font-size: 0.8rem;
}
.adsense-slot::before { content: "[ AdSense Ad Unit — Activate after AdSense approval ]"; }

/* ===========================
   NEWSLETTER OPT-IN
   =========================== */

.newsletter-section {
  background: var(--blue);
  color: var(--white);
  padding: 40px 0;
  text-align: center;
}
.newsletter-section h2 { font-size: 1.5rem; margin-bottom: 6px; }
.newsletter-section p { opacity: 0.9; margin-bottom: 20px; }

.newsletter-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}
.newsletter-form input {
  flex: 1;
  min-width: 220px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}
.newsletter-form input:focus { outline: 2px solid var(--orange); }
.newsletter-form button {
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}
.newsletter-form button:hover { opacity: 0.9; }
.newsletter-disclaimer {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 10px;
}

/* ===========================
   EXPLAINER / CONTENT SECTION
   =========================== */

.explainer-section { padding: 40px 0; }
.explainer-section h2 { font-size: 1.4rem; margin-bottom: 16px; }
.explainer-section h3 { font-size: 1.1rem; margin: 24px 0 10px; color: var(--blue); }
.explainer-section p { color: var(--gray-700); margin-bottom: 14px; line-height: 1.7; }

/* ===========================
   CALC NAVIGATION (other calcs)
   =========================== */

.other-calcs {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 32px 0;
}
.other-calcs h3 { font-size: 1rem; color: var(--gray-600); margin-bottom: 16px; text-align: center; }

.calc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.calc-nav-card {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.15s;
  text-decoration: none;
}
.calc-nav-card:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
  text-decoration: none;
}
.calc-nav-card .icon { font-size: 1.6rem; margin-bottom: 6px; }

/* ===========================
   AMORTIZATION TABLE
   =========================== */

.amort-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  max-height: 380px;
  overflow-y: auto;
}

table.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.amort-table th {
  background: var(--gray-100);
  position: sticky;
  top: 0;
  padding: 10px 12px;
  text-align: right;
  font-weight: 700;
  color: var(--gray-700);
  border-bottom: 1.5px solid var(--gray-200);
}
.amort-table th:first-child { text-align: left; }
.amort-table td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.amort-table td:first-child { text-align: left; font-weight: 600; }
.amort-table tr:last-child td { border-bottom: none; }
.amort-table tr:hover td { background: var(--blue-light); }

/* ===========================
   HOMEPAGE HERO
   =========================== */

.home-hero {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
  color: var(--white);
  padding: 64px 0 80px;
  text-align: center;
}
.home-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  margin-bottom: 16px;
  line-height: 1.15;
}
.home-hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 520px;
  margin: 0 auto 28px;
}
.hero-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Calculator card grid on homepage */
.calc-grid-home {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 48px 0;
}
.calc-home-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1.5px solid var(--gray-200);
  text-decoration: none;
  color: var(--gray-900);
  display: block;
}
.calc-home-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--blue);
  text-decoration: none;
  color: var(--gray-900);
}
.calc-home-card .icon { font-size: 2.2rem; margin-bottom: 12px; }
.calc-home-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.calc-home-card p { font-size: 0.875rem; color: var(--gray-600); line-height: 1.5; }

/* Agent teaser section on homepage */
.agent-teaser {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  padding: 48px 0;
}
.agent-teaser-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
}
@media (min-width: 768px) {
  .agent-teaser-grid { grid-template-columns: 1fr 1fr; }
}
.agent-teaser h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; }
.agent-teaser p { color: var(--gray-600); margin-bottom: 20px; }
.agent-teaser ul { list-style: none; margin-bottom: 24px; }
.agent-teaser ul li {
  padding: 6px 0;
  padding-left: 24px;
  position: relative;
  color: var(--gray-700);
  font-size: 0.95rem;
}
.agent-teaser ul li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }

.agent-preview-card {
  background: var(--blue-light);
  border: 1.5px solid #c7d2fc;
  border-radius: var(--radius);
  padding: 20px;
}
.agent-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.agent-preview-header img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--blue);
}
.agent-preview-mock {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
}
.mock-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.85rem;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}
.mock-row:last-child { border-bottom: none; }
.mock-total { font-weight: 800; color: var(--blue); font-size: 1.1rem; }

/* ===========================
   AGENT PAGES
   =========================== */

.agent-landing-hero {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
  color: var(--white);
  padding: 60px 0;
  text-align: center;
}
.agent-landing-hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; margin-bottom: 14px; }
.agent-landing-hero p { font-size: 1.05rem; opacity: 0.9; max-width: 540px; margin: 0 auto 28px; }

.how-it-works { padding: 52px 0; text-align: center; }
.how-it-works h2 { font-size: 1.5rem; margin-bottom: 36px; }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  max-width: 760px;
  margin: 0 auto;
}
.step-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.step-num {
  width: 40px;
  height: 40px;
  background: var(--blue);
  color: var(--white);
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.step-card h3 { font-size: 1rem; margin-bottom: 8px; }
.step-card p { font-size: 0.875rem; color: var(--gray-600); }

.signup-section {
  background: var(--gray-50);
  padding: 52px 0;
}
.signup-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  max-width: 560px;
  margin: 0 auto;
}
.signup-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.signup-card p { color: var(--gray-600); margin-bottom: 24px; }

.file-upload-label {
  display: block;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.file-upload-label:hover { border-color: var(--blue); color: var(--blue); }
.file-upload-label input[type="file"] { display: none; }
.photo-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--blue);
  margin: 8px auto 0;
  display: none;
}

/* ===========================
   FOOTER
   =========================== */

.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 40px 0 24px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 28px;
  margin-bottom: 28px;
}
.footer-col h4 { color: var(--white); font-size: 0.9rem; margin-bottom: 12px; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul a { color: var(--gray-400); font-size: 0.875rem; }
.footer-col ul a:hover { color: var(--white); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid #374151;
  padding-top: 20px;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.6;
}

/* ===========================
   LEGAL PAGES
   =========================== */

.legal-content {
  max-width: 740px;
  margin: 0 auto;
  padding: 48px 16px;
}
.legal-content h1 { font-size: 1.8rem; margin-bottom: 8px; }
.legal-content .last-updated { color: var(--gray-400); font-size: 0.875rem; margin-bottom: 32px; }
.legal-content h2 { font-size: 1.2rem; margin: 28px 0 10px; }
.legal-content p, .legal-content li { color: var(--gray-700); margin-bottom: 12px; line-height: 1.7; }
.legal-content ul { padding-left: 20px; margin-bottom: 16px; }

/* ===========================
   COMPACT FORM ROWS
   (label + narrow input on one line, like top mortgage sites)
   =========================== */

.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 34px;
  flex-wrap: wrap;
}
.form-row-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  min-width: 148px;
  flex-shrink: 0;
  line-height: 1.3;
}
.form-row input[type="number"],
.form-row select {
  width: 114px;
  padding: 6px 8px;
  font-size: 0.9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  color: var(--gray-900);
  background: var(--white);
  appearance: none;
  flex-shrink: 0;
}
.form-row input[type="number"]:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-row-unit {
  font-size: 0.82rem;
  color: var(--gray-600);
  white-space: nowrap;
}
.form-row-radio { display: flex; gap: 10px; }
.form-row-radio label {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.82rem; color: var(--gray-700); cursor: pointer;
}
.form-row-radio input[type="radio"] { accent-color: var(--blue); }

/* Term pill group (compact) */
.term-pills-sm { display: flex; gap: 4px; }
.term-pills-sm button {
  padding: 5px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: all 0.15s;
}
.term-pills-sm button.active {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
}

/* Pie + legend side-by-side (shared) */
.pie-with-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0;
}
.pie-with-legend canvas { flex-shrink: 0; }
.legend-list {
  flex: 1;
  list-style: none;
  margin: 0; padding: 0;
}
.legend-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.8rem;
}
.legend-list li:last-child { border-bottom: none; }
.legend-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}
.legend-label { display: flex; align-items: center; color: var(--gray-700); }
.legend-val { font-weight: 700; color: var(--gray-900); }

@media (max-width: 480px) {
  .form-row-label { min-width: 120px; }
  .form-row input[type="number"], .form-row select { width: 100px; }
  .pie-with-legend { flex-direction: column; align-items: flex-start; }
}

/* ===========================
   UTILITIES
   =========================== */

.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Responsive tweaks */
@media (max-width: 480px) {
  .nav {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 0;
    gap: 2px;
  }
  .nav-links {
    display: flex;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 4px 16px 2px 0;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { font-size: 0.78rem; padding: 3px 6px; }
  .result-big .amount { font-size: 1.9rem; }
  .newsletter-form {
    flex-direction: column;
    align-items: stretch;
    padding: 0 8px;
  }
  .newsletter-form input {
    min-width: unset;
    width: 100%;
  }
}
