/* ─── GLOBAL STYLES ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #1a6b4a;
  --brand-light: #e8f5ef;
  --brand-mid: #2d9264;
  --text: #1a1a1a;
  --text-muted: #5a5a5a;
  --text-light: #8a8a8a;
  --border: #e0e0e0;
  --bg: #fafaf8;
  --card-bg: #ffffff;
  --result-bg: #f0f9f4;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --warn-bg: #fff8e6;
  --warn-border: #f5d58a;
  --warn-text: #7a5500;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

/* ─── HEADER ─── */
header {
  background: var(--brand);
  color: white;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.logo {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: white;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
header nav { margin-left: auto; display: flex; gap: 2px; font-size: 13.5px; flex-wrap: nowrap; }
header nav a {
  color: white;
  text-decoration: none;
  opacity: 0.8;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
header nav a:hover { opacity: 1; background: rgba(255,255,255,0.12); }
header nav a[aria-current="page"] { opacity: 1; background: rgba(255,255,255,0.18); font-weight: 500; }

/* ─── HAMBURGER ─── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.hamburger span { display: block; width: 22px; height: 2px; background: white; border-radius: 2px; transition: all 0.2s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-nav { display: none; flex-direction: column; background: #155a3e; border-bottom: 2px solid rgba(255,255,255,0.1); }
.mobile-nav a {
  color: white;
  text-decoration: none;
  padding: 14px 20px;
  font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { background: rgba(255,255,255,0.06); }
.mobile-nav.open { display: flex; }

/* ─── HERO ─── */
.hero {
  background: linear-gradient(135deg, #0f4a33 0%, #1a6b4a 60%, #2d9264 100%);
  color: white;
  text-align: center;
  padding: 52px 24px 48px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero h1 { font-family: 'DM Serif Display', serif; font-size: clamp(24px, 5vw, 42px); font-weight: 400; line-height: 1.2; margin-bottom: 12px; position: relative; }
.hero p { font-size: 17px; opacity: 0.85; max-width: 520px; margin: 0 auto 20px; position: relative; }
.badge { display: inline-block; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); border-radius: 20px; padding: 4px 14px; font-size: 13px; line-height: 1.7; position: relative; }

/* ─── MAIN ─── */
main { max-width: 980px; margin: 0 auto; padding: 36px 20px 80px; }

/* ─── CARDS ─── */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); }
.card-title { font-size: 14px; font-weight: 600; color: var(--brand); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.card-title::before { content: ''; display: inline-block; width: 3px; height: 16px; background: var(--brand); border-radius: 2px; flex-shrink: 0; }

/* ─── CALC GRID ─── */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }

/* ─── FIELDS ─── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.field input[type="number"] {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: 'DM Sans', sans-serif; background: white; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s; outline: none; -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 { border-color: var(--brand-mid); box-shadow: 0 0 0 3px rgba(45,146,100,0.1); }
.hint { font-size: 12px; color: var(--text-light); margin-top: 4px; line-height: 1.5; }

/* ─── SLIDERS ─── */
.slider-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--brand); cursor: pointer; height: 4px; }
.slider-val { font-size: 13px; font-weight: 600; color: var(--brand); min-width: 60px; text-align: right; white-space: nowrap; }

/* ─── RADIO GROUP ─── */
.radio-group { display: flex; gap: 10px; margin-top: 6px; }
.radio-group label {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px;
  border: 1.5px solid var(--border); border-radius: 8px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; color: var(--text-muted); flex-direction: column; text-align: center; gap: 2px;
}
.radio-group input[type="radio"] { display: none; }
.radio-group input[type="radio"]:checked + label { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

/* ─── LOAN TABS ─── */
.loan-type-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.loan-tab { flex: 1; padding: 8px 4px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 500; text-align: center; cursor: pointer; color: var(--text-muted); background: white; transition: all 0.15s; white-space: nowrap; }
.loan-tab.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

/* ─── LIVE HINT ─── */
.live-hint { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-light); margin-top: 12px; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-mid); animation: pulse 1.5s infinite; flex-shrink: 0; }

/* ─── RESULTS ─── */
.result-card { background: var(--result-bg); border: 1.5px solid #b2dfcc; border-radius: 12px; padding: 26px; }
.result-highlight { background: var(--brand); color: white; border-radius: 10px; padding: 18px 22px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.result-highlight .rh-left { display: flex; flex-direction: column; gap: 2px; }
.result-highlight .label { font-size: 13px; opacity: 0.85; font-weight: 500; }
.result-highlight .sub-label { font-size: 11px; opacity: 0.65; }
.result-highlight .value { font-size: 28px; font-weight: 600; font-family: 'DM Serif Display', serif; flex-shrink: 0; white-space: nowrap; }
.result-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #cce8d8; font-size: 14px; gap: 8px; }
.result-row:last-of-type { border-bottom: none; }
.result-row .r-label { color: var(--text-muted); flex: 1; }
.result-row .r-value { font-weight: 600; flex-shrink: 0; white-space: nowrap; }
.result-row.winner .r-label { color: var(--brand); font-weight: 500; }
.result-row.winner .r-value { color: var(--brand); }

/* ─── DONUT ─── */
.donut-wrap { display: flex; align-items: center; gap: 20px; margin-top: 20px; }
.donut-wrap canvas { width: 90px !important; height: 90px !important; flex-shrink: 0; }
.legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

/* ─── BAR CHART ─── */
.bar-chart { margin-top: 20px; }
.bar-chart-label { font-size: 12px; color: var(--text-light); margin-bottom: 8px; font-weight: 500; }
.bar-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-label { font-size: 12px; color: var(--text-muted); width: 62px; flex-shrink: 0; }
.bar-track { flex: 1; background: #d8ede5; border-radius: 4px; height: 10px; min-width: 0; }
.bar-fill { height: 10px; border-radius: 4px; transition: width 0.4s; }
.bar-amount { font-size: 12px; font-weight: 600; min-width: 72px; text-align: right; white-space: nowrap; }

/* ─── HRA SPECIFIC ─── */
.taxable-box { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 8px; padding: 14px 16px; margin-top: 16px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; gap: 8px; flex-wrap: wrap; }
.taxable-box .t-label { color: var(--warn-text); }
.taxable-box .t-value { font-weight: 600; color: var(--warn-text); font-size: 16px; flex-shrink: 0; }
.formula-note { margin-top: 14px; padding: 12px 14px; background: #f4f4f0; border-radius: 8px; font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.hra-empty { text-align: center; padding: 40px 24px; color: var(--text-light); }
.hra-empty .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ─── AMORT / TABLES ─── */
.amort-section, .growth-section { margin-top: 36px; }
.amort-section h2, .growth-section h2 { font-family: 'DM Serif Display', serif; font-size: 22px; font-weight: 400; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 400px; }
thead th { background: var(--brand); color: white; padding: 10px 14px; text-align: right; font-weight: 500; font-size: 12.5px; white-space: nowrap; }
thead th:first-child { text-align: left; }
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: right; color: var(--text-muted); }
tbody td:first-child { text-align: left; font-weight: 500; color: var(--text); }
tbody tr:nth-child(even) td { background: #f8f8f6; }
tbody tr:hover td { background: var(--brand-light); }
.gain-positive { color: var(--brand); font-weight: 600; }

/* ─── CONTENT & FAQ ─── */
.content-section { margin-top: 52px; }
.content-section h2 { font-family: 'DM Serif Display', serif; font-size: 26px; font-weight: 400; margin-bottom: 14px; }
.content-section h3 { font-size: 17px; font-weight: 600; margin: 26px 0 10px; }
.content-section p { font-size: 15px; color: var(--text-muted); line-height: 1.78; margin-bottom: 14px; }
.formula-box { background: #1a1a1a; color: #a8e6c5; border-radius: 10px; padding: 18px 22px; font-family: monospace; font-size: 13.5px; line-height: 1.85; margin: 16px 0 24px; overflow-x: auto; white-space: pre-wrap; }
.faq-section { margin-top: 48px; }
.faq-section h2 { font-family: 'DM Serif Display', serif; font-size: 26px; font-weight: 400; margin-bottom: 20px; }
.faq-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.faq-q { padding: 16px 20px; font-size: 15px; font-weight: 500; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: white; user-select: none; gap: 12px; }
.faq-q:hover { background: var(--brand-light); }
.faq-q .arrow { font-size: 18px; color: var(--brand); transition: transform 0.2s; flex-shrink: 0; }
.faq-item.open .faq-q .arrow { transform: rotate(180deg); }
.faq-a { display: none; padding: 14px 20px 16px; font-size: 14px; color: var(--text-muted); line-height: 1.75; background: white; border-top: 1px solid var(--border); }
.faq-item.open .faq-a { display: block; }

/* ─── HOME ─── */
.section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--brand); margin-bottom: 12px; }
.section-title { font-family: 'DM Serif Display', serif; font-size: 32px; font-weight: 400; margin-bottom: 8px; line-height: 1.2; }
.section-sub { font-size: 16px; color: var(--text-muted); margin-bottom: 36px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.tool-card { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); cursor: pointer; color: var(--text); display: flex; flex-direction: column; gap: 10px; transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s; text-decoration: none; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(26,107,74,0.12); border-color: var(--brand-mid); }
.tool-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-light); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.tool-card h2 { font-size: 17px; font-weight: 600; color: var(--text); }
.tool-card p { font-size: 13.5px; color: var(--text-muted); line-height: 1.65; flex: 1; }
.tool-tag { display: inline-block; background: var(--brand-light); color: var(--brand); font-size: 11.5px; font-weight: 500; padding: 3px 10px; border-radius: 20px; width: fit-content; }
.tool-cta { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--brand); margin-top: 4px; }
.tool-cta::after { content: '→'; transition: transform 0.15s; }
.tool-card:hover .tool-cta::after { transform: translateX(4px); }
.why-section { margin-top: 64px; }
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-top: 28px; }
.why-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 22px; text-align: center; }
.why-card .icon { font-size: 28px; margin-bottom: 10px; }
.why-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.why-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ─── TABLE HEADER / DOWNLOAD ─── */
.table-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.table-header h2 { margin-bottom: 0; }
.dl-btn { display: inline-flex; align-items: center; gap: 7px; background: #1d6f42; color: white; border: none; border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: background 0.15s, transform 0.1s; white-space: nowrap; }
.dl-btn:hover { background: #155a34; }
.dl-btn:active { transform: scale(0.97); }
.dl-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ─── SALARY SPECIFIC ─── */
.salary-breakup { margin-top: 14px; background: var(--brand-light); border: 1.5px solid #b2dfcc; border-radius: 8px; padding: 14px 16px; }
.salary-breakup-title { font-size: 12px; font-weight: 600; color: var(--brand); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.salary-breakup-row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px solid #cce8d8; }
.salary-breakup-row:last-child { border-bottom: none; }

/* ─── TAX SPECIFIC ─── */
.tax-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.tax-box { color: white; border-radius: 10px; padding: 16px; text-align: center; }
.tax-box .tb-label { font-size: 12px; opacity: 0.8; margin-bottom: 4px; }
.tax-box .tb-amount { font-size: 22px; font-weight: 600; font-family: 'DM Serif Display', serif; }
.tax-box .tb-monthly { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.tax-verdict { background: var(--brand-light); border: 1.5px solid #b2dfcc; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; font-size: 14px; font-weight: 500; color: var(--brand); text-align: center; }

/* ─── GRATUITY SPECIFIC ─── */
.gr-note { margin-top: 16px; border-radius: 8px; padding: 12px 14px; font-size: 13px; }

/* ─── FOOTER ─── */
footer { background: #1a1a1a; color: #888; text-align: center; padding: 28px 20px; font-size: 13px; margin-top: 60px; }
footer a { color: #aaa; text-decoration: none; margin: 0 8px; }
footer a:hover { color: white; }

/* ─── RESPONSIVE ─── */
@media (max-width: 820px) {
  header nav { display: none; }
  .hamburger { display: flex; }
  .hero { padding: 36px 16px 32px; }
  .hero p { font-size: 15px; }
  .calc-grid { grid-template-columns: 1fr; gap: 16px; }
  .card { padding: 18px 16px; }
  .result-card { padding: 20px 16px; }
  .result-highlight .value { font-size: 24px; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .tools-grid { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr 1fr; }
  .loan-type-tabs { gap: 5px; }
  .loan-tab { font-size: 12px; padding: 7px 3px; }
  .bar-amount { min-width: 52px; font-size: 11px; }
  .slider-val { min-width: 50px; font-size: 12px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; gap: 12px; }
  .taxable-box { flex-direction: column; align-items: flex-start; gap: 4px; }
  .result-row { flex-wrap: wrap; }
  .content-section h2, .faq-section h2 { font-size: 22px; }
  .content-section h3 { font-size: 15px; }
  .section-title { font-size: 24px; }
  .tax-compare-grid { grid-template-columns: 1fr 1fr; }
  .radio-group label { font-size: 12.5px; padding: 9px 5px; }
}
@media (max-width: 420px) {
  .hero h1 { font-size: 21px; }
  .card { padding: 16px 14px; }
  .result-highlight .value { font-size: 20px; }
  .formula-box { font-size: 12px; padding: 14px; }
  .why-grid { grid-template-columns: 1fr; }
  .bar-amount { display: none; }
  .faq-q { font-size: 14px; padding: 13px 15px; }
  .tax-compare-grid { grid-template-columns: 1fr; }
}
