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

:root {
  /* ── Brand palette ── */
  --slate-950:    #020617;
  --slate-900:    #0f172a;
  --slate-800:    #1e293b;
  --slate-700:    #334155;
  --slate-600:    #475569;
  --slate-400:    #94a3b8;
  --slate-200:    #e2e8f0;
  --slate-100:    #f1f5f9;
  --slate-50:     #f8fafc;

  --blue-600:     #5580A8;
  --blue-700:     #3f6690;
  --blue-100:     #dbe6f0;
  --blue-50:      #eef3f8;

  --indigo-600:   #5e5a8a;
  --indigo-500:   #7970A2;

  --violet-600:   #7970A2;
  --violet-100:   #eae9f2;

  --emerald-600:  #3a7a60;
  --emerald-500:  #4D8E72;
  --emerald-100:  #d0e8de;
  --emerald-50:   #eaf4ef;

  --amber-600:    #8a6428;
  --amber-500:    #B5883C;
  --amber-100:    #f0e2c8;

  --rose-600:     #9a484d;
  --rose-500:     #B55C62;
  --rose-100:     #f0dada;

  --teal-600:     #4A8FA0;
  --teal-100:     #d0e8f0;

  /* ── Semantic aliases ── */
  --bg:           #f4f6fb;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e4e9f2;
  --border-strong:#c8d3e8;

  --ink:          #0f172a;
  --ink-muted:    #374151;
  --ink-subtle:   #6b7280;
  --ink-faint:    #94a3b8;

  --accent:       var(--blue-600);
  --accent-dark:  var(--blue-700);

  /* ── Typography ── */
  --serif: 'DM Serif Display', Georgia, serif;
  --sans:  'Inter', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'Courier New', monospace;

  /* ── Elevation ── */
  --shadow-xs:   0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm:   0 1px 4px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:   0 4px 16px rgba(15,23,42,0.08), 0 1px 4px rgba(15,23,42,0.04);
  --shadow-lg:   0 8px 32px rgba(15,23,42,0.12), 0 2px 8px rgba(15,23,42,0.06);
  --shadow-blue: 0 4px 20px rgba(85,128,168,0.22);

  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ──────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--slate-900);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 2.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px;
}
.nav-logo {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: #fff;
  letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 2px;
}
.nav-logo span {
  background: linear-gradient(120deg, #60a5fa 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-tagline {
  font-size: 11px; color: rgba(255,255,255,0.26);
  letter-spacing: 0.07em; text-transform: uppercase;
  display: none;
}
@media (min-width: 700px) { .nav-tagline { display: block; } }

.nav-tabs {
  display: flex; gap: 2px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,0.07);
}
.nav-tab {
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.45);
  background: none; border: none; cursor: pointer;
  padding: 6px 16px; border-radius: 7px;
  transition: all 0.15s;
  font-family: var(--sans);
}
.nav-tab:hover  { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); }
.nav-tab.active { color: #fff; background: rgba(255,255,255,0.14); font-weight: 600; }

/* ── HERO ─────────────────────────────────────────── */
.hero {
  background:
    radial-gradient(ellipse at 80% 30%, rgba(79,70,229,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 80%, rgba(37,99,235,0.15) 0%, transparent 50%),
    linear-gradient(160deg, var(--slate-950) 0%, var(--slate-900) 55%, #111827 100%);
  padding: 2rem 2.5rem 1.75rem;
  position: relative; overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.hero-inner {
  max-width: 940px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto;
  gap: 3rem; align-items: center;
  position: relative; z-index: 1;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(96,165,250,0.1);
  border: 1px solid rgba(96,165,250,0.22);
  color: #93c5fd;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 13px; border-radius: 20px;
  margin-bottom: 0.8rem; width: fit-content;
}
.hero-badge-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #60a5fa;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}
.hero-text h1 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  line-height: 1.14; letter-spacing: -0.02em;
  color: #f8fafc; margin-bottom: 0.55rem;
}
.hero-text h1 em { font-style: italic; color: #93c5fd; }
.hero-text p { font-size: 13px; color: rgba(255,255,255,0.45); max-width: 390px; line-height: 1.7; }

.hero-stat-box {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 1.1rem 1.7rem;
  text-align: center; min-width: 138px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.08);
}
.hero-stat-eyebrow {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: rgba(255,255,255,0.3); margin-bottom: 0.35rem;
}
.hero-stat-num {
  font-family: var(--mono);
  font-size: clamp(1.65rem, 3.2vw, 2.2rem);
  font-weight: 600; color: #fff;
  letter-spacing: -0.03em; line-height: 1;
  transition: color 0.35s;
}
.hero-stat-num.positive { color: #6ee7b7; }
.hero-stat-num.negative { color: #fca5a5; }
.hero-stat-foot { font-size: 9.5px; color: rgba(255,255,255,0.28); margin-top: 0.35rem; letter-spacing: 0.04em; }

/* ── PAGE LAYOUT ──────────────────────────────────── */
.page { max-width: 940px; margin: 0 auto; padding: 2rem 2rem 5rem; }
.section { display: none; }
.section.active { display: block; }

/* ── PANEL ────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.875rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.panel:hover { box-shadow: var(--shadow-md); }

.panel-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-subtle);
  margin-bottom: 1.4rem;
  display: flex; align-items: center; gap: 10px;
}
.panel-title::before {
  content: '';
  width: 3px; height: 14px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--blue-600), var(--indigo-500));
  border-radius: 3px;
}
.panel-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── LOCATION PRESET ──────────────────────────────── */
.loc-preset {
  margin-bottom: 1.4rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #f0f4f8 0%, #eef3f8 100%);
  border: 1px solid #c8d8e8;
  border-radius: 12px;
}
.loc-preset-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 0.9rem; flex-wrap: wrap;
}
.loc-pin { font-size: 14px; flex-shrink: 0; }
.loc-preset-title {
  font-size: 12px; font-weight: 700; color: var(--ink-muted);
  letter-spacing: 0.01em; flex: 1;
}
.loc-data-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #5580A8; background: rgba(85,128,168,0.12);
  border: 1px solid rgba(85,128,168,0.25);
  padding: 2px 9px; border-radius: 20px;
}
.loc-selects {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem;
}
.loc-select-wrap { display: flex; flex-direction: column; gap: 4px; }
.loc-label {
  font-size: 11.5px; font-weight: 600; color: var(--ink-subtle);
}
.loc-select {
  height: 38px; width: 100%;
  border: 1.5px solid #c8d8e8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px; font-family: var(--sans);
  padding: 0 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A8796' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.loc-select:focus { outline: none; border-color: #5580A8; box-shadow: 0 0 0 3px rgba(85,128,168,0.12); }
.loc-select:disabled { opacity: 0.45; cursor: not-allowed; }
.loc-applied {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 0.85rem;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid #c8d8e8;
  border-radius: 8px;
}
.loc-tag {
  font-size: 11.5px; font-weight: 600; padding: 2px 10px;
  border-radius: 20px; white-space: nowrap;
}
.loc-tag-app  { color: #3f6690; background: rgba(85,128,168,0.12); }
.loc-tag-rent { color: #3a7a60; background: rgba(77,142,114,0.12); }
.loc-tag strong { font-size: 12.5px; }
.loc-src {
  font-size: 10.5px; color: var(--ink-faint); flex: 1;
  font-style: italic; letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.loc-clear-btn {
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 9px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.loc-clear-btn:hover { color: var(--rose-600); border-color: var(--rose-500); }

@media (max-width: 540px) {
  .loc-selects { grid-template-columns: 1fr; }
  .loc-src { display: none; }
}

/* ── FORM ─────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.15rem; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-muted); letter-spacing: 0.01em; }
.field-hint { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-prefix, .input-suffix {
  position: absolute;
  font-size: 13px; color: var(--ink-faint);
  font-family: var(--mono); pointer-events: none; z-index: 1;
}
.input-prefix { left: 11px; }
.input-suffix { right: 11px; }

.field input[type="number"] {
  width: 100%; height: 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px; font-family: var(--mono); font-weight: 500;
  padding: 0 38px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.field input[type="number"]:focus {
  outline: none;
  border-color: var(--blue-600);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.input-wrap.suffix-only input { padding-left: 12px; }

/* ── SLIDERS ──────────────────────────────────────── */
.slider-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 3rem; }
.slider-field { display: flex; flex-direction: column; gap: 9px; }
.slider-header { display: flex; justify-content: space-between; align-items: center; }
.slider-header label { font-size: 13.5px; font-weight: 600; color: var(--ink-muted); }
.slider-badge {
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  color: var(--blue-600);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  padding: 2px 13px; border-radius: 20px;
  min-width: 80px; text-align: center;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--border);
  border-radius: 4px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  border: 2px solid var(--blue-600);
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 14px rgba(37,99,235,0.45);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--blue-600);
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.slider-range {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--ink-faint); font-family: var(--mono);
}
.field-slider-row { margin: 8px 0 2px; display: flex; flex-direction: column; gap: 6px; }

/* ── BUTTONS ──────────────────────────────────────── */
.calc-row { margin: 1.6rem 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn-calc {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--indigo-600) 100%);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 12px 30px; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-blue);
}
.btn-calc:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(37,99,235,0.38); }
.btn-calc:active { transform: translateY(0); }
.btn-calc:disabled { opacity: 0.55; box-shadow: none; cursor: not-allowed; transform: none; }

.btn-reset {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--ink-subtle);
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  padding: 11px 22px; border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-reset:hover { border-color: var(--border-strong); color: var(--ink); background: var(--surface-2); }

/* ── SPINNER ──────────────────────────────────────── */
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff;
  animation: spin 0.55s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.api-error {
  font-size: 12.5px; color: var(--rose-600);
  padding: 7px 13px;
  background: var(--rose-100);
  border-radius: var(--radius-sm);
  border: 1px solid #fecdd3;
}

/* ── VERDICT STRIP ────────────────────────────────── */
.verdict-strip {
  border-radius: 12px; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
  display: flex; align-items: flex-start; gap: 1.2rem;
  border: 1px solid transparent; position: relative; overflow: hidden;
}
.verdict-strip.buy  { background: linear-gradient(135deg, #eef4f1 0%, #d8ece4 100%); border-color: #9abfb0; }
.verdict-strip.rent { background: linear-gradient(135deg, #f6f0f0 0%, #ede0e0 100%); border-color: #c9a0a4; }
.verdict-icon { font-size: 2.2rem; flex-shrink: 0; margin-top: 1px; }
.verdict-text strong { font-size: 17px; font-weight: 800; display: block; margin-bottom: 4px; color: var(--ink); letter-spacing: -0.01em; }
.verdict-text span { font-size: 13.5px; color: var(--ink-muted); line-height: 1.55; }
.verdict-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.verdict-chip {
  font-size: 11.5px; color: var(--ink-subtle);
  background: rgba(0,0,0,0.05);
  padding: 2px 10px; border-radius: 20px;
  font-family: var(--mono); font-weight: 500;
}
.verdict-chip.pos { color: var(--emerald-600); background: var(--emerald-100); }
.verdict-chip.neg { color: var(--rose-600);    background: var(--rose-100); }

/* ── HOME PRICE TEXT INPUT (auto-comma INR) ───────── */
.field input.hp-input {
  width: 100%; height: 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px; font-family: var(--mono); font-weight: 500;
  padding: 0 38px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field input.hp-input:focus {
  outline: none;
  border-color: var(--blue-600);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ── LOAN SUMMARY STRIP (plain-English at-a-glance) ── */
.loan-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.lss-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 0.9rem 0.85rem;
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s;
}
.lss-card:hover { box-shadow: var(--shadow-sm); }
.lss-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-subtle);
  margin-bottom: 0.45rem;
  display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap;
  line-height: 1.4;
}
.lss-value {
  font-family: var(--mono); font-size: 1.1rem; font-weight: 700;
  color: var(--ink); line-height: 1.15; margin-bottom: 0.3rem;
}
.lss-value.pos  { color: var(--emerald-600); }
.lss-value.warn { color: var(--rose-600); }
.lss-sub { font-size: 10px; color: var(--ink-faint); line-height: 1.4; }
.lss-badge {
  font-size: 7.5px; font-weight: 700; letter-spacing: 0.04em;
  color: #3a7a60; background: rgba(77,142,114,0.12);
  border: 1px solid rgba(77,142,114,0.25);
  padding: 1px 5px; border-radius: 8px; white-space: nowrap;
}
@media (max-width: 720px) {
  .loan-summary-strip { grid-template-columns: repeat(2, 1fr); }
  .lss-card:last-child { grid-column: 1 / -1; }
}

/* ── KPI GRID ─────────────────────────────────────── */
.kpi-section-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-muted);
  margin: 1.75rem 0 0.7rem;
  display: flex; align-items: center; gap: 10px;
}
/* colored left bar — set per variant */
.kpi-section-label::before {
  content: '';
  width: 4px; height: 20px;
  border-radius: 3px; flex-shrink: 0;
  background: var(--border-strong);
}
.kpi-section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Section colour variants */
.lbl-inflow  { color: #3a7a60; }
.lbl-inflow::before  { background: linear-gradient(180deg, #4D8E72, #3a7a60); }
.lbl-outflow { color: #9a484d; }
.lbl-outflow::before { background: linear-gradient(180deg, #B55C62, #9a484d); }
.lbl-profit  { color: #5e5688; }
.lbl-profit::before  { background: linear-gradient(180deg, #7970A2, #5e5688); }
.lbl-dcf     { color: #8a6428; }
.lbl-dcf::before     { background: linear-gradient(180deg, #B5883C, #8a6428); }
.lbl-caption {
  font-size: 9.5px; font-weight: 500;
  color: var(--ink-faint); letter-spacing: 0.02em; text-transform: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px; margin-bottom: 0.5rem;
}
.kpi {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 1.05rem 1.15rem 0.95rem;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s, box-shadow 0.18s;
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Top accent gradients — muted professional palette */
.kpi.a-blue::before    { background: linear-gradient(90deg, #5580A8, #92B4D0); }
.kpi.a-emerald::before { background: linear-gradient(90deg, #4D8E72, #89BDA8); }
.kpi.a-rose::before    { background: linear-gradient(90deg, #B55C62, #D49498); }
.kpi.a-violet::before  { background: linear-gradient(90deg, #7970A2, #ADA8CB); }
.kpi.a-gold::before    { background: linear-gradient(90deg, #B5883C, #D4B47A); }
.kpi.a-teal::before    { background: linear-gradient(90deg, #4A8FA0, #86BECE); }
.kpi.a-amber::before   { background: linear-gradient(90deg, #B5883C, #D4B47A); }

/* Subtle tinted card backgrounds */
.kpi.a-emerald { background: linear-gradient(165deg, #f1f7f4 0%, #ffffff 30%); }
.kpi.a-rose    { background: linear-gradient(165deg, #f8f2f2 0%, #ffffff 30%); }
.kpi.a-blue    { background: linear-gradient(165deg, #f0f4f8 0%, #ffffff 30%); }
.kpi.a-violet  { background: linear-gradient(165deg, #f3f2f7 0%, #ffffff 30%); }
.kpi.a-gold    { background: linear-gradient(165deg, #f8f4ee 0%, #ffffff 30%); }
.kpi.a-teal    { background: linear-gradient(165deg, #f0f5f7 0%, #ffffff 30%); }
.kpi.a-amber   { background: linear-gradient(165deg, #fffbeb 0%, #ffffff 30%); }

.kpi-label {
  font-size: 9.5px; color: var(--ink-subtle); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--mono); font-size: 1.25rem; font-weight: 700;
  color: var(--ink); line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.kpi-value.up   { color: var(--emerald-600); }
.kpi-value.down { color: var(--rose-600); }
.kpi-sub { font-size: 10.5px; color: var(--ink-faint); margin-top: 5px; line-height: 1.4; }

/* ── CHARTS ───────────────────────────────────────── */
.chart-container { position: relative; width: 100%; height: 320px; }
.chart-container.short { height: 240px; }

.chart-legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  font-size: 11.5px; color: var(--ink-muted); font-weight: 500;
  margin-bottom: 14px;
  padding: 9px 16px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  letter-spacing: 0.01em;
}
.chart-legend span { display: flex; align-items: center; gap: 7px; }
.leg { width: 20px; height: 3px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.leg.dashed { height: 0; border-top: 2.5px dashed; width: 18px; }

/* ── AMORTISATION ─────────────────────────────────── */
.amort-wrapper {
  overflow-x: auto;
  max-height: 520px; overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface-2);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-muted);
  padding: 13px 18px; text-align: right;
  position: sticky; top: 0;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
thead th:first-child { text-align: left; }
tbody td {
  padding: 13px 18px;
  text-align: right;
  border-bottom: 1px solid var(--surface-2);
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-muted);
  transition: background 0.12s;
}
tbody td:first-child {
  text-align: left;
  font-family: var(--sans); font-weight: 600;
  color: var(--ink); white-space: nowrap;
}
tbody tr:hover td { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }
.td-pos   { color: var(--emerald-600) !important; font-weight: 600; }
.td-neg   { color: var(--rose-600)    !important; }
.td-faint { color: var(--ink-faint)   !important; }
.td-sip   { color: #7970A2 !important; font-weight: 600; }

/* ── Surplus SIP table ─────────────────────────── */
tr.sip-crossover td { background: #f3f2f8 !important; }
tr.sip-crossover:hover td { background: #eae9f2 !important; }
.sip-cross-badge {
  display: inline-block; margin-left: 6px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: #7970A2;
  background: #eae9f2; border: 1px solid #ADA8CB;
  border-radius: 4px; padding: 1px 5px; vertical-align: middle;
  font-family: var(--sans);
}

tbody tr.totals-row td {
  background: var(--surface-2) !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  border-top: 1.5px solid var(--border-strong);
  font-family: var(--mono); font-size: 12.5px;
}
tbody tr.totals-row td:first-child {
  font-family: var(--sans); font-weight: 700;
  color: var(--ink); letter-spacing: 0.01em;
}

/* Break-even highlight */
tbody tr.be-row td { background: rgba(16,185,129,0.05) !important; }
tbody tr.be-row td:first-child::after {
  content: ' ✓'; color: var(--emerald-600); font-size: 11px; font-weight: 700;
}

/* ── SENSITIVITY ──────────────────────────────────── */
.sens-note {
  font-size: 13px; color: var(--ink-muted);
  margin-bottom: 1.2rem; padding: 11px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--blue-600);
  line-height: 1.65;
  opacity: 0.92;
}
.sens-note em { color: var(--blue-600); font-style: normal; font-weight: 600; }

.sens-chart-wrap {
  overflow-x: auto; display: flex;
  justify-content: center; padding: 4px 0 8px;
}
.sens-chart-wrap canvas { display: block; }

.sens-legend {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 10px;
}
.sens-legend-bar {
  width: 160px; height: 8px; border-radius: 4px;
  background: linear-gradient(to right, hsl(0,60%,46%), hsl(40,65%,50%), hsl(120,55%,42%));
}

/* ── INSIGHTS ─────────────────────────────────────── */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px; margin-bottom: 1.4rem;
}
.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.95rem 1.05rem 0.85rem;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 4px;
  transition: box-shadow 0.18s, transform 0.18s;
}
.insight-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.insight-icon { font-size: 1.2rem; line-height: 1; margin-bottom: 2px; }
.insight-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-subtle);
}
.insight-body {
  font-size: 12.5px; color: var(--ink-muted); line-height: 1.6; flex: 1;
}
.insight-body strong { color: var(--ink); font-weight: 700; }
.insight-tag {
  display: inline-flex; align-items: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 9px; border-radius: 20px; width: fit-content; margin-top: 5px;
}
.insight-tag.good { background: var(--emerald-100); color: var(--emerald-600); }
.insight-tag.warn { background: var(--amber-100);   color: var(--amber-600); }
.insight-tag.bad  { background: var(--rose-100);    color: var(--rose-600); }
.insight-tag.info { background: var(--blue-50);     color: var(--blue-600); }

/* ── BENCHMARK ────────────────────────────────────── */
.chart-container.bm-chart { height: 270px; }

.bm-table-wrap {
  overflow-x: auto; margin-top: 1.2rem;
  border: 1px solid var(--border); border-radius: 10px;
}
.bm-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.bm-table thead th {
  background: var(--surface-2); padding: 11px 16px;
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-subtle);
  border-bottom: 1px solid var(--border); text-align: left;
}
.bm-table thead th:not(:first-child) { text-align: right; }
.bm-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--surface-2);
  vertical-align: middle;
}
.bm-table tbody tr:last-child td { border-bottom: none; }
.bm-table tbody tr:hover td { background: #fafbff; }
.bm-table tbody tr.bm-home td { background: var(--blue-50); }
.bm-table tbody tr.bm-home:hover td { background: var(--blue-100); }

.bm-asset { display: flex; align-items: center; gap: 9px; }
.bm-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.bm-label { font-weight: 600; color: var(--ink); font-size: 13px; }
.bm-note  { font-size: 10px; color: var(--ink-faint); margin-left: 2px; }

.bm-val  { font-family: var(--mono); font-weight: 500; color: var(--ink-muted); text-align: right; }
.bm-cagr { font-family: var(--mono); font-weight: 600; text-align: right; }
.bm-delta { font-family: var(--mono); font-size: 12px; text-align: right; white-space: nowrap; }
.bm-delta.pos { color: var(--emerald-600); }
.bm-delta.neg { color: var(--rose-600); }
.bm-delta.neu { color: var(--ink-faint); }
.bm-rank { text-align: center; }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--ink-faint);
  border: 1px solid var(--border);
}
.rank-badge.rank-1 { background: #fef9c3; color: #713f12; border-color: #fde68a; }
.rank-badge.rank-2 { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.rank-badge.rank-3 { background: #fef3c7; color: #78350f; border-color: #fde68a; }
.rank-badge.home-rank { background: var(--blue-100); color: var(--blue-600); border-color: #93c5fd; }

.bm-insight {
  margin-top: 0.9rem; padding: 10px 15px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--blue-600);
  font-size: 12.5px; color: var(--ink-muted); line-height: 1.6;
}
.bm-insight strong { color: var(--ink); }

/* Verdict chips */
.verdict-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.verdict-chip {
  font-size: 11.5px; color: var(--ink-subtle);
  background: rgba(0,0,0,0.05);
  padding: 2px 10px; border-radius: 20px;
  font-family: var(--mono); font-weight: 500;
}
.verdict-chip.pos { color: var(--emerald-600); background: var(--emerald-100); }
.verdict-chip.neg { color: var(--rose-600);    background: var(--rose-100); }

/* ── COMPARISON ───────────────────────────────────── */
.compare-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem;
}
.btn-copy {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--ink-muted);
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  padding: 7px 16px; border-radius: 7px; cursor: pointer;
  transition: all 0.15s;
}
.btn-copy:hover { border-color: var(--border-strong); color: var(--ink); background: var(--surface-2); }

.compare-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin-bottom: 1.1rem;
}
.prop-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid transparent;
}
.prop-panel.prop-a { border-top-color: var(--blue-600); }
.prop-panel.prop-b { border-top-color: var(--indigo-600); }
.prop-a-title::before { background: var(--blue-600) !important; }
.prop-b-title::before { background: var(--indigo-600) !important; }

.cmp-form { grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-bottom: 1.1rem; }
.cmp-sliders { gap: 0.9rem 1.4rem; }

.winner-banner {
  border-radius: 12px; padding: 1.15rem 1.4rem;
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 1.1rem;
  border: 1px solid transparent;
}
.winner-banner.win-a   { background: linear-gradient(135deg, var(--blue-50), #e0eaff); border-color: var(--blue-100); }
.winner-banner.win-b   { background: linear-gradient(135deg, #f5f3ff, var(--violet-100)); border-color: #c4b5fd; }
.winner-banner.win-tie { background: linear-gradient(135deg, #fefce8, #fef9c3); border-color: #fde68a; }
.winner-icon { font-size: 2rem; flex-shrink: 0; }
.winner-text { font-size: 15px; color: var(--ink); line-height: 1.5; }
.winner-text strong { font-weight: 700; }
.winner-sub { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; display: block; }

.compare-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.compare-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; min-width: 520px;
}
.compare-table thead th {
  background: var(--surface-2); padding: 11px 16px;
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-subtle);
  border-bottom: 1px solid var(--border);
  text-align: left; position: sticky; top: 0; white-space: nowrap;
}
.compare-table thead .col-a { color: var(--blue-600); }
.compare-table thead .col-b { color: var(--indigo-600); }
.compare-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--surface-2);
  vertical-align: middle;
}
.compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table tbody tr:hover td { background: #fafbff; }

.metric-name { display: flex; flex-direction: column; gap: 1px; }
.metric-name .mn-label { font-weight: 600; color: var(--ink); }
.metric-name .mn-note  { font-size: 10px; color: var(--ink-faint); }

.val-a, .val-b { font-family: var(--mono); font-weight: 500; color: var(--ink-muted); white-space: nowrap; }
.val-a.is-winner { color: var(--blue-600);   font-weight: 700; }
.val-b.is-winner { color: var(--indigo-600); font-weight: 700; }

.badge-cell { white-space: nowrap; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 10px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
}
.badge-a { background: var(--blue-100);   color: var(--blue-600);   border: 1px solid #93c5fd; }
.badge-b { background: var(--violet-100); color: var(--violet-600); border: 1px solid #c4b5fd; }
.badge-tie { color: var(--ink-faint); font-size: 13px; }

/* ── INFO ICON + TOOLTIP ──────────────────────────── */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--slate-100); color: var(--ink-faint);
  font-size: 8.5px; font-weight: 700; cursor: help;
  margin-left: 4px; vertical-align: middle; flex-shrink: 0;
  position: relative; font-style: normal;
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}
.info-icon:hover { background: var(--blue-50); color: var(--blue-600); border-color: var(--blue-100); }
.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 7px); left: 0;
  background: var(--slate-900); color: rgba(255,255,255,0.9);
  font-size: 11px; font-weight: 400; line-height: 1.55;
  padding: 8px 12px; border-radius: 7px;
  white-space: normal; width: 230px;
  z-index: 999; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  font-family: var(--sans); letter-spacing: 0;
}
.info-icon:hover::after { opacity: 1; }

/* .home-price-select removed — replaced with free number input */

/* ── TABLE HEADER NOTES ───────────────────────────── */
.th-note {
  display: block;
  font-size: 9px; font-weight: 400; text-transform: none;
  letter-spacing: 0; color: var(--ink-faint);
  margin-top: 2px; white-space: nowrap;
}

/* ── PIE CHARTS ───────────────────────────────────── */
.pie-main-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: start;
}
.pie-section { padding: 0.5rem 0.75rem; }
.pie-sec-header { margin-bottom: 1rem; }
.pie-sec-title {
  font-size: 13px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.01em;
}
.pie-sec-total {
  font-size: 11px; color: var(--ink-faint);
  font-family: var(--mono); margin-top: 3px;
}
.pie-sec-body {
  display: flex; align-items: center; gap: 1.5rem;
}
.pie-wrap {
  width: 160px; flex-shrink: 0; position: relative;
}
.pie-v-divider {
  width: 1px; background: var(--border);
  align-self: stretch; margin: 0 0.5rem; min-height: 180px;
}
.pie-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.pie-leg-item { display: flex; align-items: center; gap: 10px; }
.pie-dot {
  width: 11px; height: 11px; border-radius: 50%;
  flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.pie-leg-info { flex: 1; }
.pie-leg-label {
  font-size: 12px; font-weight: 600; color: var(--ink-muted);
  line-height: 1.3;
}
.pie-leg-stats {
  font-size: 10.5px; color: var(--ink-faint);
  font-family: var(--mono); margin-top: 1px;
}
@media (max-width: 680px) {
  .pie-main-grid { grid-template-columns: 1fr; }
  .pie-v-divider { width: auto; height: 1px; min-height: unset; margin: 1.25rem 0; }
  .pie-sec-body { flex-direction: column; align-items: flex-start; }
  .pie-wrap { width: 140px; }
}

/* ── FOOTER ───────────────────────────────────────── */
footer {
  background: var(--slate-900);
  color: rgba(255,255,255,0.25);
  text-align: center;
  padding: 2rem 2rem 2.5rem;
  font-size: 11.5px; line-height: 1.8; margin-top: 3rem;
}
footer strong { color: rgba(255,255,255,0.5); font-weight: 700; }
.footer-main { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.5); margin-bottom: 0.55rem; }
.footer-desc { max-width: 680px; margin: 0 auto 0.9rem; color: rgba(255,255,255,0.22); line-height: 1.75; }
.footer-tags {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  margin-bottom: 1rem;
}
.footer-tags span {
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.28);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 2px 10px;
}
.footer-legal { font-size: 10.5px; color: rgba(255,255,255,0.15); }

/* ── LIVE EMI BAR ────────────────────────────────── */
.live-emi-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  background: linear-gradient(135deg, #eef3f8 0%, #dbe6f0 100%);
  border: 1px solid #b8cedd;
  border-radius: 12px;
  padding: 13px 18px;
  margin-top: 1.1rem;
}
.live-emi-left { display: flex; flex-direction: column; gap: 2px; }
.live-emi-eyebrow {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #5580A8;
}
.live-emi-value {
  font-family: var(--mono); font-size: 1.55rem; font-weight: 700;
  color: #3f6690; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.live-emi-right { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.live-emi-chip {
  font-size: 11.5px; font-family: var(--mono); font-weight: 500;
  color: #1e40af; background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: 6px; padding: 3px 9px; white-space: nowrap;
}

/* ── KPI ABBR BADGE ──────────────────────────────── */
.kpi-abbr {
  display: inline-block; margin-left: 5px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #92400e;
  background: #fef3c7; border: 1px solid #fcd34d;
  border-radius: 4px; padding: 1px 5px; vertical-align: middle;
  font-family: var(--sans);
}

/* ── RESULTS JUMP NAV ────────────────────────────── */
.results-jump-nav {
  display: none;
  position: sticky; top: 58px; z-index: 99;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  margin: 0 -2rem 1.25rem;
  padding: 7px 2rem;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  flex-wrap: nowrap; gap: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.results-jump-nav::-webkit-scrollbar { display: none; }
.results-jump-nav.visible { display: flex; }
.rj-item {
  font-size: 11.5px; font-weight: 600; color: var(--ink-muted);
  padding: 5px 12px; border-radius: 20px;
  text-decoration: none; white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  border: 1px solid transparent;
}
.rj-item:hover { background: var(--surface-2); color: var(--ink); }
.rj-item.active {
  background: #eef3f8; color: #5580A8;
  border-color: #b8cedd;
}

/* ── SCROLL HINT (mobile tables) ─────────────────── */
.scroll-hint {
  display: none;
  text-align: center; font-size: 11px; color: var(--ink-faint);
  padding: 5px 0 2px; letter-spacing: 0.04em;
  transition: opacity 0.3s;
}
@media (max-width: 820px) {
  .scroll-hint { display: block; }
  .amort-wrapper {
    box-shadow: inset -10px 0 14px -10px rgba(0,0,0,0.1),
                1px solid var(--border);
  }
}

/* ── HEATMAP TOOLTIP ─────────────────────────────── */
.hm-tooltip {
  display: none;
  position: fixed; z-index: 9000;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 11px;
  padding: 13px 17px;
  pointer-events: none;
  box-shadow: 0 10px 36px rgba(0,0,0,0.45);
  min-width: 178px;
}
.hm-tooltip.visible { display: block; }
.hm-tt-emi {
  font-family: var(--mono); font-size: 20px; font-weight: 700;
  color: #6ee7b7; line-height: 1.2; margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.hm-tt-emlabel {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: rgba(255,255,255,0.38);
  margin-bottom: 10px;
}
.hm-tt-divider { height: 1px; background: rgba(255,255,255,0.1); margin-bottom: 8px; }
.hm-tt-row {
  display: flex; justify-content: space-between; gap: 14px;
  font-size: 11.5px; line-height: 1.9;
}
.hm-k { color: rgba(255,255,255,0.45); }
.hm-v { font-family: var(--mono); font-weight: 600; color: #f1f5f9; font-variant-numeric: tabular-nums; }

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 680px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-stat-box { padding: 1.3rem 1.5rem; text-align: left; display: flex; align-items: center; gap: 1rem; }
  .hero-stat-num { font-size: 1.9rem; }
  .slider-panel { grid-template-columns: 1fr; gap: 1.1rem; }
  nav { padding: 0 1.25rem; }
  .page { padding: 1.4rem 1rem 3rem; }
  .hero { padding: 2.5rem 1.25rem 2rem; }
  .panel { padding: 1.3rem 1.1rem; }
}
@media (max-width: 700px) {
  .compare-grid { grid-template-columns: 1fr; }
  .cmp-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 440px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .cmp-form { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ── CHAT WIDGET ─────────────────────────────────── */
#chatWidget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2B3D52;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  position: relative;
  color: #fff;
  flex-shrink: 0;
}
.chat-fab:hover { background: #3a5068; transform: scale(1.07); box-shadow: 0 6px 20px rgba(0,0,0,0.28); }
.chat-fab:active { transform: scale(0.97); }

.fab-icon-chat, .fab-icon-close { display: block; }
.fab-icon-chat.hidden, .fab-icon-close.hidden { display: none; }

.chat-unread {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.chat-unread.visible { display: block; }

.chat-panel {
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 1;
  transform: scale(1);
}
.chat-panel[aria-hidden="true"] {
  opacity: 0;
  transform: scale(0.92) translateY(8px);
  pointer-events: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: #2B3D52;
  color: #fff;
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 0.65rem; }
.chat-avatar { font-size: 1.3rem; line-height: 1; }
.chat-name { font-size: 0.92rem; font-weight: 600; }
.chat-sub { font-size: 0.72rem; color: rgba(255,255,255,0.6); margin-top: 1px; }

.chat-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.chat-close-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

.chat-msg-row { display: flex; }
.chat-msg-row.user { justify-content: flex-end; }
.chat-msg-row.bot  { justify-content: flex-start; }

.chat-bubble {
  max-width: 82%;
  padding: 0.55rem 0.85rem;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.55;
  word-break: break-word;
}
.chat-msg-row.user .chat-bubble {
  background: #2B3D52;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-row.bot .chat-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.chat-typing { padding: 0 1rem 0.4rem; }
.chat-typing.hidden { display: none; }
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.5rem 0.75rem;
  background: #f1f5f9;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.typing-bubble span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: chatBounce 1.2s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

.chat-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: #fff;
}
.chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 0.5rem 0.9rem;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  background: #f8fafc;
  color: #1e293b;
}
.chat-input:focus { border-color: #2B3D52; background: #fff; }
.chat-input::placeholder { color: #94a3b8; }

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2B3D52;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
}
.chat-send-btn:hover { background: #3a5068; }
.chat-send-btn:active { transform: scale(0.93); }

@media (max-width: 480px) {
  #chatWidget { bottom: 1rem; right: 1rem; }
  .chat-panel { width: calc(100vw - 2rem); max-height: 70vh; }
}
