/* ============================================================
   PropertySmart – Stylesheet
   ============================================================ */

/* ── Custom Properties ──────────────────────────────────────────────────── */
:root {
  --primary:        #0d2d4e;
  --primary-light:  #164e7a;
  --accent-green:   #00a651;
  --accent-amber:   #f59e0b;
  --accent-red:     #dc2626;
  --bg-page:        #f0f4f8;
  --bg-card:        #ffffff;
  --text-dark:      #1a202c;
  --text-mid:       #4a5568;
  --text-light:     #718096;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e0;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --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);
  --radius:         12px;
  --radius-sm:      8px;
  --font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* KPI card accent colours */
  --kpi-upfront:    #3b82f6;
  --kpi-mortgage:   #8b5cf6;
  --kpi-monthly:    #10b981;
  --kpi-annual:     #f59e0b;
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  padding-top: 32px;
  padding-bottom: 60px;
}

/* ── Home hero ───────────────────────────────────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 56px 0 52px;
}

.home-hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: center;
}

.home-hero-headline {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  color: #fff;
}

.home-hero-sub {
  font-size: 1rem;
  color: rgba(255,255,255,.8);
  line-height: 1.7;
  max-width: 540px;
  margin-bottom: 24px;
}

.home-hero-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-hero-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: rgba(255,255,255,.9);
}

.home-hero-benefits svg {
  width: 18px;
  height: 18px;
  color: #4ade80;
  flex-shrink: 0;
}

.home-hero-cta {
  display: inline-block;
  background: #4ade80;
  color: #0d2d4e;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 28px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}

.home-hero-cta:hover {
  background: #22c55e;
  transform: translateY(-1px);
}

.home-hero-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  padding: 28px 32px;
  min-width: 220px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.hero-stat:last-child { border-bottom: none; }

.hero-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #4ade80;
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,.65);
  line-height: 1.4;
}

@media (max-width: 820px) {
  .home-hero-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .home-hero-stats {
    flex-direction: row;
    min-width: unset;
    padding: 20px;
  }
  .hero-stat {
    flex: 1;
    padding: 0 16px;
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,.1);
    text-align: center;
  }
  .hero-stat:last-child { border-right: none; }
  .home-hero-headline { font-size: 1.9rem; }
}

@media (max-width: 560px) {
  .home-hero { padding: 36px 0 32px; }
  .home-hero-headline { font-size: 1.6rem; }
  .home-hero-stats { flex-direction: column; padding: 16px 20px; }
  .hero-stat {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.1);
    padding: 14px 0;
    text-align: left;
  }
  .hero-stat:last-child { border-bottom: none; }
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--primary);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}

.logo strong {
  color: #4ade80;
}

.logo-icon {
  width: 32px;
  height: 32px;
  color: #4ade80;
  flex-shrink: 0;
}

.header-tagline {
  color: rgba(255,255,255,.65);
  font-size: 0.875rem;
  font-weight: 400;
}

/* ── Site navigation ─────────────────────────────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.site-nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.site-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.12);
}

.site-nav a.active {
  color: #4ade80;
  background: rgba(74,222,128,.1);
}

/* ── Static page layout ──────────────────────────────────────────────────── */
.page-hero {
  background: var(--primary);
  color: #fff;
  padding: 48px 0 40px;
  margin-bottom: 40px;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.page-hero p {
  color: rgba(255,255,255,.7);
  font-size: 1.05rem;
  max-width: 600px;
}

.static-content {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 60px;
}

/* ── FAQ accordion ───────────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-item summary {
  padding: 18px 22px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dark);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item[open] summary {
  color: var(--primary);
  border-bottom: 1px solid var(--border);
}

.faq-body {
  padding: 18px 22px;
  font-size: 0.92rem;
  color: var(--text-mid);
  line-height: 1.7;
}

.faq-body p + p { margin-top: 10px; }

.faq-list {
  padding-left: 20px;
  margin-top: 8px;
  line-height: 1.8;
}

/* ── About page ──────────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
}

.about-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.about-card p {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.7;
}

.about-card .card-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.prose {
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.8;
}

.prose h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 28px 0 10px;
}

.prose p + p { margin-top: 10px; }

.prose ul {
  padding-left: 20px;
  margin-top: 8px;
}

.prose li {
  margin-bottom: 6px;
}

/* ── Contact form ────────────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.contact-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
}

.contact-info-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.contact-info-card p {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.contact-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.contact-form-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 22px;
}

.contact-cta-card {
  text-align: center;
  padding: 48px 32px;
  margin-top: 20px;
}

.contact-cta-card h2 {
  margin-bottom: 12px;
}

.contact-cta-icon {
  margin-bottom: 16px;
  color: var(--primary);
}

.contact-cta-desc {
  color: var(--text-mid);
  font-size: 0.95rem;
  margin-bottom: 24px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-dark);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(22,78,122,.12);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-submit:hover { background: var(--primary-light); }

.form-success {
  display: none;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  color: #166534;
  font-size: 0.9rem;
  margin-top: 16px;
}

@media (max-width: 700px) {
  .header-inner {
    gap: 10px;
    padding-bottom: 4px;
  }
  .header-tagline { display: none; }
  .site-nav {
    width: 100%;
    margin-left: 0;
    justify-content: center;
    border-top: 1px solid rgba(255,255,255,.12);
    padding-top: 10px;
  }
  .site-nav a { padding: 6px 11px; font-size: 0.82rem; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-hero h1 { font-size: 1.5rem; }
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 28px 32px;
  margin-bottom: 24px;
}

.card-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.heading-icon {
  font-size: 1.2rem;
}

/* ── Input Card ─────────────────────────────────────────────────────────── */
.input-card {
  background: #f8fafc;
  color: var(--text-dark);
  border: 1px solid var(--border);
}

.input-card .card-heading {
  color: var(--primary);
  font-size: 1.2rem;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 48px;
}

.input-group--price {
  grid-column: 1 / -1;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-mid);
}

/* -- Deposit number input row -- */
.deposit-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deposit-number-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s;
}

.deposit-number-wrap:focus-within {
  border-color: var(--primary);
}

.deposit-number-input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-dark);
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 8px 10px;
  width: 100px;
  text-align: right;
  -moz-appearance: textfield;
}

.deposit-number-input::-webkit-outer-spin-button,
.deposit-number-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.deposit-currency-prefix {
  padding: 8px 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-mid);
  background: #f1f5f9;
  border-right: 1px solid var(--border);
}

.deposit-pct-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* -- Price Input -- */
.price-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 320px;
  transition: border-color .2s;
}

.price-wrap:focus-within {
  border-color: var(--primary);
  background: #fff;
}

.currency-prefix {
  padding: 10px 12px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-mid);
  background: #f1f5f9;
  border-right: 1px solid var(--border);
}

.price-input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-dark);
  font-family: var(--font);
  font-size: 1.3rem;
  font-weight: 700;
  padding: 10px 14px;
  width: 220px;
  -moz-appearance: textfield;
}

.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* -- Range Slider -- */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-strong);
  outline: none;
  cursor: pointer;
  transition: background .2s;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  cursor: pointer;
  transition: transform .15s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-light);
}

/* ── Location typeahead ─────────────────────────────────────────────────── */
.location-typeahead {
  position: relative;
}

.location-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: #fff;
  color: var(--text-dark);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
}

.location-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,45,78,0.10);
}

.location-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
}

.location-suggestions.hidden { display: none; }

.location-hint {
  font-size: 0.78rem;
  margin-top: 5px;
  min-height: 1.1em;
  color: var(--text-light);
  transition: color 0.2s;
}
.location-hint--ok   { display: none; }
.location-hint--warn { color: var(--accent-amber); }
.location-default-notice {
  font-size: 0.78rem;
  margin-top: 5px;
  color: var(--text-light);
  font-style: italic;
}

/* ── Share bar ──────────────────────────────────────────────────────────── */
.share-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all .2s;
}

.share-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.share-btn:hover svg { stroke: #fff; }

/* ── Share modal ────────────────────────────────────────────────────────── */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.share-overlay.hidden { display: none; }

.share-modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.share-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.share-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.share-modal-close {
  background: none;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-mid);
  transition: background .2s;
  flex-shrink: 0;
}

.share-modal-close:hover { background: var(--bg-page); }

.share-modal-desc {
  font-size: 0.84rem;
  color: var(--text-mid);
  margin: 0 0 18px;
  line-height: 1.5;
}

.share-channels {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-ch {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-dark);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background .15s, border-color .15s;
  box-sizing: border-box;
}

.share-ch:hover {
  background: var(--bg-page);
  border-color: var(--border-strong);
}

.share-ch-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.share-ch--copy     .share-ch-icon { background: var(--primary); }
.share-ch--whatsapp .share-ch-icon { background: #25D366; }
.share-ch--x        .share-ch-icon { background: #000; }
.share-ch--facebook .share-ch-icon { background: #1877F2; }
.share-ch--email    .share-ch-icon { background: var(--primary-light); }

.share-ch-label { flex: 1; }

.share-ch-feedback {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-green);
}

.location-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 9px 14px;
  cursor: pointer;
}

.location-suggestion-item:hover,
.location-suggestion-item:focus {
  background: var(--bg-page);
  outline: none;
}

.sugg-term {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
}

.sugg-region {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
}

/* -- Select -- */
.select-input {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: #fff;
  color: var(--text-dark);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color .2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a5568' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.select-input:focus { border-color: var(--primary); }
.select-input option { color: #000; background: #fff; }

/* -- Radio Pills -- */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-pill {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.radio-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill span {
  padding: 8px 16px;
  border-radius: 100px;
  border: 2px solid var(--border-strong);
  background: #fff;
  color: var(--text-mid);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all .2s;
}

.radio-pill input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

.radio-pill:hover span {
  border-color: var(--primary-light);
  color: var(--primary);
}

/* ── Summary / KPI Cards ────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform .2s, box-shadow .2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card--upfront  { border-top: 4px solid var(--kpi-upfront); }
.kpi-card--mortgage { border-top: 4px solid var(--kpi-mortgage); }
.kpi-card--monthly  { border-top: 4px solid var(--kpi-monthly); }
.kpi-card--annual   { border-top: 4px solid var(--kpi-annual); }

.kpi-icon { font-size: 1.6rem; margin-top: 2px; line-height: 1; }

.kpi-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-light);
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ── Detail Grid ────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.detail-card--full {
  grid-column: 1 / -1;
}

/* ── Cost Tables ────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

.costs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.costs-table thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  padding: 10px 12px;
  white-space: nowrap;
}

.costs-table thead th.col-amt {
  text-align: right;
  white-space: nowrap;
}

.costs-table thead th.col-note { min-width: 160px; }

.costs-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.costs-table tbody tr:hover { background: #f8fafc; }
.costs-table tbody tr:last-child { border-bottom: none; }

.costs-table td {
  padding: 13px 12px;
  vertical-align: top;
}

.costs-table .amt {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-dark);
}

.costs-table .note {
  font-size: 0.8rem;
  color: var(--text-light);
  padding-left: 16px;
}

.item-name {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
}

.item-note {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Table footer rows */
.costs-table tfoot tr { border-top: 2px solid var(--border-strong); }
.costs-table tfoot tr + tr { border-top: 1px solid var(--border); }

.subtotal-row td {
  padding: 11px 12px;
  font-weight: 600;
  color: var(--text-mid);
  font-size: 0.875rem;
  background: #f8fafc;
}

.total-row td {
  padding: 14px 12px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-dark);
  background: #eef9f2;
}

.highlight {
  color: var(--accent-green) !important;
  font-size: 1.15rem !important;
}

/* ── Leasehold toggle & fields ─────────────────────────────────────────── */
.leasehold-toggle-label {
  margin-bottom: 2px;
}

.leasehold-fields {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leasehold-fields.hidden { display: none; }

.leasehold-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.leasehold-field-label {
  font-size: 0.84rem;
  color: var(--text-mid);
  width: 110px;
  flex-shrink: 0;
}

.leasehold-amount-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  background: #fff;
  flex: 1;
  max-width: 180px;
}

.leasehold-currency {
  color: var(--text-light);
  font-size: 0.9rem;
}

.leasehold-amt-input {
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.9rem;
  width: 80px;
  background: transparent;
  color: var(--text-dark);
}

.leasehold-period {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
}

.leasehold-hint {
  font-size: 0.76rem;
  color: var(--text-light);
  margin: 2px 0 0;
  line-height: 1.4;
}

.row--leasehold td .item-name::before {
  content: '🏢 ';
  font-style: normal;
}

/* ── Custom Rate Override Input ─────────────────────────────────────────── */
.rate-override-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rate-toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.rate-toggle-cb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  position: relative;
}

.rate-toggle-cb:checked {
  background: #4ade80;
  border-color: #4ade80;
}

.rate-toggle-cb:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.rate-toggle-cb:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.rate-toggle-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-mid);
}

.rate-input-row {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 160px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: #fff;
  overflow: hidden;
  transition: border-color .2s, opacity .2s;
}

/* Dim the row when disabled */
.rate-input-row:has(.rate-number-input:disabled) {
  opacity: 0.4;
}

.rate-number-input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-dark);
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 8px 12px;
  width: 110px;
  -moz-appearance: textfield;
}

.rate-number-input:disabled { cursor: not-allowed; }
.rate-number-input::-webkit-outer-spin-button,
.rate-number-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.rate-input-row:focus-within {
  border-color: var(--primary);
}

.rate-pct-suffix {
  padding: 8px 12px 8px 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-mid);
}

/* ── Rate Badge Tooltip ──────────────────────────────────────────────────── */
.rate-tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.rate-tip-wrap:hover .rate-tooltip,
.rate-tip-wrap:focus-within .rate-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.rate-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: #ffffff;
  color: #374151;
  border: 1px solid #d1d5db;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  pointer-events: none;
  z-index: 200;
  white-space: normal;
  text-align: left;
}

/* Caret */
.rate-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 18px;
  border: 6px solid transparent;
  border-top-color: #d1d5db;
}

/* Custom rate variation of the badge */
.rate-badge--custom {
  background: var(--accent-amber);
  color: #1a202c !important;
}

/* ── Tax Breakdown Toggle ───────────────────────────────────────────────── */
.tax-breakdown-toggle {
  margin: 4px 0 12px;
}

.toggle-btn {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all .2s;
}

.toggle-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Info Box ────────────────────────────────────────────────────────────── */
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.85rem;
  color: #1e40af;
  line-height: 1.6;
}

.info-box.hidden { display: none; }

.info-box__title {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #1d4ed8;
}

.mt-sm { margin-top: 16px; }

/* Tax breakdown table inside the info box */
.tax-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 4px;
}

.tax-breakdown-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(30,64,175,.15);
  vertical-align: middle;
}

.tax-breakdown-table tr:last-child td { border-bottom: none; }

.tbd-rate { color: #3b82f6; font-weight: 600; text-align: center; }
.tbd-tax  { font-weight: 700; text-align: right; color: #1d4ed8; }

.ads-note {
  margin-top: 10px;
  font-weight: 600;
  padding-top: 8px;
  border-top: 1px solid rgba(30,64,175,.2);
}

/* ── Mortgage Panel ─────────────────────────────────────────────────────── */
.mortgage-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.mrow:last-child { border-bottom: none; }

.mrow span:first-child { color: var(--text-mid); flex: 1; }
.mrow span:last-child  { font-weight: 600; color: var(--text-dark); text-align: right; }

.mrow--minus span:last-child { color: var(--accent-red); }

.mrow--loan span:last-child {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--primary);
}

.mrow--payment {
  background: #f0fdf4;
  margin: 4px -32px;
  padding: 14px 32px;
  border: none;
  border-top: 2px solid var(--accent-green);
  border-bottom: 2px solid var(--accent-green);
}

.mrow--payment span:first-child { font-weight: 700; color: var(--text-dark); }

.big-figure {
  font-size: 1.8rem !important;
  font-weight: 800 !important;
  color: var(--accent-green) !important;
  letter-spacing: -0.5px;
}

.mrow--sub span:first-child { font-size: 0.82rem; color: var(--text-light); }
.mrow--sub span:last-child  { font-size: 0.88rem; color: var(--text-mid); }

.mrow--total {
  background: #fafaf9;
  border-radius: var(--radius-sm);
}

.mrow--total span:first-child { font-weight: 700; }
.mrow--total span:last-child  { font-size: 1.05rem; font-weight: 800; }

.interest-figure { color: var(--accent-amber) !important; }

.mdivider {
  height: 1px;
  background: var(--border-strong);
  margin: 4px 0;
}

.rate-badge {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
}

.item-name-input {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  padding: 5px 8px;
  width: calc(100% - 36px);
  outline: none;
  transition: border-color .15s;
}

.item-name-input:focus {
  border-color: #3b82f6;
  background: #eff6ff;
}

.td-name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.delete-item-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.85rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.delete-item-btn:hover {
  color: var(--accent-red);
  background: #fef2f2;
}

.row--user-item td:first-child {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* ── Add Custom Cost button ───────────────────────────────────────────────── */
.rc-add-wrap {
  margin: 10px 0 4px;
}

.rc-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.rc-add-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* ── Editable Running Cost Inputs ──────────────────────────────────────── */

.item-name-input {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  padding: 5px 8px;
  width: calc(100% - 36px);
  outline: none;
  transition: border-color .15s;
}

.item-name-input:focus {
  border-color: #3b82f6;
  background: #eff6ff;
}

.td-name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.delete-item-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.85rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.delete-item-btn:hover {
  color: var(--accent-red);
  background: #fef2f2;
}

.row--user-item td:first-child {
  padding-top: 10px;
  padding-bottom: 10px;
}

.amt-edit-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #f8fafc;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}

.amt-edit-wrap:focus-within {
  border-color: #3b82f6;
  background: #eff6ff;
}

.amt-currency {
  padding: 5px 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  background: #f1f5f9;
  border-right: 1px solid var(--border);
  line-height: 1;
  user-select: none;
}

.amt-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  padding: 5px 6px;
  width: 70px;
  text-align: right;
  -moz-appearance: textfield;
}

.amt-input::-webkit-outer-spin-button,
.amt-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.reset-btn {
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  padding: 5px 8px;
  font-size: 0.78rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.reset-btn:hover {
  color: var(--accent-red);
  background: #fef2f2;
}

.custom-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 4px;
  text-transform: uppercase;
}

.row--custom {
  background: #fffbeb;
}

/* ── Disclaimer Text ────────────────────────────────────────────────────── */
.disclaimer {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.5;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,.7);
  padding: 36px 0;
  margin-top: 20px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.footer-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.footer-logo strong { color: #4ade80; }

.footer-tagline {
  font-size: 0.875rem;
  color: rgba(255,255,255,.6);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  margin: 6px 0;
}

.footer-nav a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.footer-nav a:hover { color: #4ade80; }

.footer-divider {
  width: 100%;
  max-width: 480px;
  border: none;
  border-top: 1px solid rgba(255,255,255,.12);
  margin: 6px 0;
}

.footer-disclaimer {
  font-size: 0.78rem;
  max-width: 700px;
  color: rgba(255,255,255,.45);
  line-height: 1.6;
}

.footer-copyright {
  font-size: 0.75rem;
  color: rgba(255,255,255,.35);
  margin-top: 2px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-card--full {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .card { padding: 20px 16px; }

  .input-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .input-group--price { grid-column: 1; }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .kpi-value { font-size: 1.25rem; }
  .kpi-icon  { font-size: 1.2rem; }

  .header-tagline { display: none; }

  .radio-group { flex-direction: column; }

  .costs-table .note { display: none; }
  .col-note { display: none; }

  .mrow--payment {
    margin: 4px -16px;
    padding: 12px 16px;
  }
}

@media (max-width: 400px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .site-header { position: static; }
  .input-card  { background: #f0f0f0 !important; color: #000 !important; }
  .input-card .input-label,
  .input-card .select-input,
  .input-card .radio-pill span { color: #000 !important; }
  .range-slider { display: none; }
  .slider-labels { display: none; }
  .toggle-btn { display: none; }
  #taxBreakdownBox { display: block !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .site-footer { background: #f0f0f0 !important; color: #333 !important; }
}
