/* ═══════════════════════════════════════════════════════════════
   THRIFTRUPEE CALCULATORS — Shared Stylesheet v1.0.0
   "Warm Forest" design system
   Full-width layout · Mobile-first · India-specific
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Brand — Forest Green */
  --tr-g-50:   #EDF7E8;
  --tr-g-100:  #C5E8BE;
  --tr-g-300:  #6EBA7A;
  --tr-g-500:  #2D7A3A;
  --tr-g-700:  #1D5C28;
  --tr-g-900:  #1A3320;

  /* Accent — Warm Gold */
  --tr-gold-50:  #FDF8EC;
  --tr-gold-300: #F5D87A;
  --tr-gold-600: #C4920A;

  /* Neutral — Warm Leaf */
  --tr-n-50:   #F4F8F2;
  --tr-n-100:  #E4EEE0;
  --tr-n-300:  #C8D5C0;
  --tr-n-500:  #6B7A65;
  --tr-n-700:  #3A4838;
  --tr-n-900:  #1A1E18;

  /* Semantic */
  --tr-success:        #2D7A3A;
  --tr-success-bg:     #EDF7E8;
  --tr-success-border: #A8D5A0;
  --tr-danger:         #C0392B;
  --tr-danger-bg:      #FDE8E8;
  --tr-danger-border:  #F0A0A0;
  --tr-warning:        #C4920A;
  --tr-warning-bg:     #FDF8EC;
  --tr-info:           #2557A7;
  --tr-info-bg:        #E8F0FB;

  /* Chart colours — semantic, fixed across all 134 calculators */
  --tr-chart-1: #2D7A3A;  /* principal / invested        */
  --tr-chart-2: #6EBA7A;  /* returns / gains             */
  --tr-chart-3: #C0392B;  /* interest / cost / loss      */
  --tr-chart-4: #F5D87A;  /* inflation-adjusted          */
  --tr-chart-5: #2557A7;  /* scenario B / comparison     */

  /* Typography */
  --tr-font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --tr-font-body:    'Inter', system-ui, sans-serif;

  /* Spacing — 4px base */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px;  --sp-5: 20px;  --sp-6: 24px;
  --sp-8: 32px;  --sp-10: 40px; --sp-12: 48px;

  /* Border radius */
  --r-sm:   8px;
  --r-md:   10px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-pill: 20px;

  /* Shadows */
  --shadow-card:  0 1px 3px rgba(26,51,32,.06), 0 1px 2px rgba(26,51,32,.04);
  --shadow-float: 0 4px 16px rgba(26,51,32,.12);

  /* Transitions */
  --ease:    150ms ease;
  --ease-md: 220ms ease;
}

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

body.tr-calc-page {
  background: var(--tr-n-50);
  font-family: var(--tr-font-body);
  color: var(--tr-n-700);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 3. LAYOUT — CONTAINER SYSTEM ────────────────────────────── */

/* Wide: calculator cards, charts, tables — 1400px max */
.tr-container {
  width: 100%;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
}

/* Narrow: SEO text, FAQ, breadcrumb, H1 — 860px max */
.tr-container-sm {
  width: 100%;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
}

/* Page wrapper spacing */
.tr-page-wrap {
  padding-top: var(--sp-6);
  padding-bottom: var(--sp-12);
}

/* Section spacing */
.tr-section {
  margin-bottom: var(--sp-8);
}
.tr-section-lg {
  margin-bottom: var(--sp-12);
}

/* ── 4. BREADCRUMB ────────────────────────────────────────────── */
.tr-breadcrumb {
  font-size: 12px;
  color: var(--tr-n-500);
  margin-bottom: var(--sp-2);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.tr-breadcrumb a {
  color: var(--tr-n-500);
  text-decoration: none;
  transition: color var(--ease);
}
.tr-breadcrumb a:hover { color: var(--tr-g-500); }
.tr-breadcrumb-sep { color: var(--tr-n-300); }
.tr-breadcrumb-current { color: var(--tr-n-700); font-weight: 500; }

/* ── 5. PAGE TITLE ────────────────────────────────────────────── */
.tr-page-title {
  font-family: var(--tr-font-display);
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  color: var(--tr-n-900);
  line-height: 1.2;
  margin: 0 0 var(--sp-2);
}
.tr-page-tagline {
  font-size: 14px;
  color: var(--tr-n-500);
  margin: 0 0 var(--sp-5);
}

/* ── 6. CALCULATOR CARD ───────────────────────────────────────── */
.tr-calc-card {
  background: #fff;
  border: 1px solid var(--tr-n-300);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

/* Dark header strip */
.tr-calc-header {
  background: var(--tr-g-900);
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.tr-calc-header-title {
  font-family: var(--tr-font-display);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.tr-calc-header-sub {
  font-size: 12px;
  color: var(--tr-g-300);
  margin-top: 2px;
}

/* Loan-type tab pills inside header */
.tr-calc-tabs {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}
.tr-calc-tab {
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1.5px solid rgba(110,186,122,.5);
  background: transparent;
  color: var(--tr-g-300);
  cursor: pointer;
  transition: all var(--ease);
}
.tr-calc-tab:hover,
.tr-calc-tab.active {
  background: var(--tr-g-500);
  border-color: var(--tr-g-500);
  color: #fff;
}

/* Two-column body: inputs left, results right */
.tr-calc-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.tr-input-panel {
  padding: var(--sp-6);
  border-right: 1px solid var(--tr-n-100);
}

.tr-result-panel {
  padding: var(--sp-6);
  background: #F9FCF8;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── 7. INPUT CONTROLS ────────────────────────────────────────── */
.tr-input-group {
  margin-bottom: var(--sp-5);
}
.tr-input-group:last-child {
  margin-bottom: 0;
}

.tr-input-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--tr-n-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-2);
}
.tr-input-value {
  font-family: var(--tr-font-body);
  font-size: 15px;
  font-weight: 800;
  color: var(--tr-g-500);
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* Helper text below label */
.tr-input-helper {
  font-size: 11px;
  color: var(--tr-g-500);
  margin-bottom: var(--sp-2);
  opacity: .85;
}

/* Preset chips */
.tr-preset-chips {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  margin-bottom: var(--sp-2);
}
.tr-chip {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--tr-success-border);
  color: var(--tr-g-500);
  background: #fff;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  user-select: none;
}
.tr-chip:hover { border-color: var(--tr-g-500); }
.tr-chip.active {
  background: var(--tr-g-500);
  border-color: var(--tr-g-500);
  color: #fff;
}

/* Range slider */
.tr-slider-wrap {
  position: relative;
  padding: var(--sp-2) 0;
  margin-bottom: var(--sp-1);
}
.tr-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--tr-n-300);
  outline: none;
  cursor: pointer;
  background-image: linear-gradient(var(--tr-g-500), var(--tr-g-500));
  background-repeat: no-repeat;
  transition: background-size var(--ease);
}
.tr-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tr-g-500);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(45,122,58,.35);
  cursor: pointer;
  transition: transform var(--ease);
}
.tr-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.tr-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--tr-g-500);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(45,122,58,.35);
  cursor: pointer;
}
.tr-slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--tr-n-500);
  margin-top: var(--sp-1);
}

/* Text input field */
.tr-input-row {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--tr-n-300);
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
  transition: border-color var(--ease);
  margin-top: var(--sp-2);
}
.tr-input-row:focus-within { border-color: var(--tr-g-500); }

.tr-input-prefix {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tr-n-500);
  background: var(--tr-n-50);
  border-right: 1px solid var(--tr-n-300);
  display: flex;
  align-items: center;
  user-select: none;
}
.tr-input-suffix {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tr-n-500);
  background: var(--tr-n-50);
  border-left: 1px solid var(--tr-n-300);
  display: flex;
  align-items: center;
  user-select: none;
}
.tr-input-field {
  flex: 1;
  padding: 10px 12px;
  font-family: var(--tr-font-body);
  font-size: 15px;
  font-weight: 700;
  color: var(--tr-n-900);
  border: none;
  outline: none;
  background: transparent;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.tr-input-field::placeholder { color: var(--tr-n-300); font-weight: 400; }

/* ── 8. RESULT KPI CARDS ──────────────────────────────────────── */
.tr-kpi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.tr-kpi-row.three { grid-template-columns: 1fr 1fr 1fr; }

.tr-kpi {
  border: 1.5px solid var(--tr-n-300);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: #fff;
  transition: box-shadow var(--ease);
}
.tr-kpi:hover { box-shadow: var(--shadow-card); }

.tr-kpi.hero {
  grid-column: 1 / -1;
  background: var(--tr-g-900);
  border-color: var(--tr-g-900);
}

.tr-kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tr-n-500);
  margin-bottom: var(--sp-1);
}
.tr-kpi.hero .tr-kpi-label { color: var(--tr-g-300); }

.tr-kpi-value {
  font-family: var(--tr-font-body);
  font-size: 22px;
  font-weight: 800;
  color: var(--tr-n-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.tr-kpi.hero .tr-kpi-value { font-size: 28px; color: #fff; }
.tr-kpi-value.danger  { color: var(--tr-danger); }
.tr-kpi-value.success { color: var(--tr-success); }

.tr-kpi-sub {
  font-size: 11px;
  color: var(--tr-n-500);
  margin-top: var(--sp-1);
}
.tr-kpi.hero .tr-kpi-sub { color: var(--tr-g-300); }

/* ── 9. CHARTS ────────────────────────────────────────────────── */
.tr-chart-wrap {
  background: #fff;
  border: 1px solid var(--tr-n-300);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--shadow-card);
}
.tr-chart-title {
  font-family: var(--tr-font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--tr-n-900);
  margin-bottom: var(--sp-1);
}
.tr-chart-sub {
  font-size: 12px;
  color: var(--tr-n-500);
  margin-bottom: var(--sp-4);
}
.tr-chart-legend {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  font-size: 12px;
  color: var(--tr-n-700);
}
.tr-legend-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 4px;
  flex-shrink: 0;
  vertical-align: middle;
}
.tr-chart-canvas-wrap { position: relative; }

/* Donut chart sizing */
.tr-donut-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  flex-wrap: wrap;
}
.tr-donut-canvas { max-width: 160px; max-height: 160px; }

/* ── 10. AMORTIZATION TABLE ───────────────────────────────────── */
.tr-table-wrap {
  background: #fff;
  border: 1px solid var(--tr-n-300);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.tr-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--tr-n-100);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.tr-table-title {
  font-family: var(--tr-font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--tr-n-900);
}
.tr-table-toggle {
  display: flex;
  gap: var(--sp-1);
}
.tr-toggle-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--tr-n-300);
  background: #fff;
  color: var(--tr-n-500);
  cursor: pointer;
  transition: all var(--ease);
}
.tr-toggle-btn.active {
  background: var(--tr-g-900);
  border-color: var(--tr-g-900);
  color: #fff;
}
.tr-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tr-table thead tr { background: var(--tr-g-900); }
.tr-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--tr-g-300);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.tr-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--tr-n-100);
  color: var(--tr-n-700);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tr-table tbody tr:nth-child(even) td { background: #F9FCF8; }
.tr-table tbody tr:hover td           { background: var(--tr-g-50); }
.tr-table tbody tr:last-child td      { border-bottom: none; }
.tr-table .success { color: var(--tr-success); font-weight: 700; }
.tr-table .danger  { color: var(--tr-danger);  font-weight: 700; }

.tr-table-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--tr-n-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.tr-table-show-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--tr-g-500);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--ease);
}
.tr-table-show-more:hover { color: var(--tr-g-700); }
.tr-csv-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--tr-n-500);
  cursor: pointer;
  background: none;
  border: 1.5px solid var(--tr-n-300);
  border-radius: var(--r-sm);
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--ease);
}
.tr-csv-btn:hover {
  border-color: var(--tr-g-500);
  color: var(--tr-g-500);
}

/* ── 11. INSIGHT BOX (signature component) ────────────────────── */
.tr-insight-band {
  background: var(--tr-success-bg);
  border-top: 1px solid var(--tr-success-border);
  border-bottom: 1px solid var(--tr-success-border);
  padding: var(--sp-6) 0;
}
.tr-insight-box {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
}
.tr-insight-icon {
  width: 36px;
  height: 36px;
  background: var(--tr-g-500);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}
.tr-insight-body {}
.tr-insight-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--tr-g-700);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: var(--sp-1);
}
.tr-insight-text {
  font-size: 14px;
  color: #1a4a22;
  line-height: 1.7;
}

/* ── 12. SEO CONTENT AREA ─────────────────────────────────────── */
.tr-seo-content {
  padding: var(--sp-8) 0;
}
.tr-seo-content h2 {
  font-family: var(--tr-font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--tr-n-900);
  margin: var(--sp-8) 0 var(--sp-3);
}
.tr-seo-content h2:first-child { margin-top: 0; }
.tr-seo-content p {
  font-size: 14px;
  color: var(--tr-n-700);
  line-height: 1.8;
  margin-bottom: var(--sp-4);
}
.tr-seo-content ul, .tr-seo-content ol {
  margin: var(--sp-3) 0 var(--sp-4) var(--sp-5);
}
.tr-seo-content li {
  font-size: 14px;
  color: var(--tr-n-700);
  line-height: 1.75;
  margin-bottom: var(--sp-2);
}
/* Formula highlight block */
.tr-formula-block {
  background: var(--tr-g-900);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-4) 0;
  font-family: var(--tr-font-body);
  font-size: 14px;
  color: var(--tr-g-300);
  line-height: 1.6;
  overflow-x: auto;
}
.tr-formula-block strong { color: #fff; }

/* ── 13. FAQ ACCORDION ────────────────────────────────────────── */
.tr-faq-section { padding: var(--sp-8) 0; }
.tr-faq-title {
  font-family: var(--tr-font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--tr-n-900);
  margin-bottom: var(--sp-5);
}
.tr-faq-item {
  border: 1px solid var(--tr-n-300);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
  overflow: hidden;
  transition: border-color var(--ease);
}
.tr-faq-item.open { border-color: var(--tr-g-500); }
.tr-faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  background: #fff;
  user-select: none;
  gap: var(--sp-3);
}
.tr-faq-question:hover { background: var(--tr-n-50); }
.tr-faq-q-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--tr-n-900);
  flex: 1;
}
.tr-faq-chevron {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--tr-n-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--tr-n-500);
  flex-shrink: 0;
  transition: transform var(--ease), background var(--ease);
}
.tr-faq-item.open .tr-faq-chevron {
  transform: rotate(180deg);
  background: var(--tr-g-500);
  color: #fff;
}
.tr-faq-answer {
  display: none;
  padding: 0 var(--sp-5) var(--sp-4);
  font-size: 14px;
  color: var(--tr-n-700);
  line-height: 1.75;
  background: #fff;
}
.tr-faq-item.open .tr-faq-answer { display: block; }

/* ── 14. RELATED CALCULATORS ──────────────────────────────────── */
.tr-related-section { padding: var(--sp-8) 0; }
.tr-related-title {
  font-family: var(--tr-font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--tr-n-900);
  margin-bottom: var(--sp-4);
}
.tr-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-3);
}
.tr-related-card {
  border: 1.5px solid var(--tr-n-300);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: #fff;
  text-decoration: none;
  transition: all var(--ease);
  display: block;
}
.tr-related-card:hover {
  border-color: var(--tr-g-500);
  background: var(--tr-g-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.tr-related-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--tr-n-900);
  margin-bottom: 3px;
}
.tr-related-card-desc {
  font-size: 11px;
  color: var(--tr-n-500);
}

/* ── 15. BUTTONS ──────────────────────────────────────────────── */
.tr-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  font-family: var(--tr-font-body);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: none;
  transition: all var(--ease);
  text-decoration: none;
  user-select: none;
}
.tr-btn-primary {
  background: var(--tr-g-500);
  color: #fff;
}
.tr-btn-primary:hover { background: var(--tr-g-700); }

.tr-btn-secondary {
  background: var(--tr-g-50);
  color: var(--tr-g-500);
  border: 1.5px solid var(--tr-success-border);
}
.tr-btn-secondary:hover { background: var(--tr-g-100); }

.tr-btn-ghost {
  background: transparent;
  color: var(--tr-n-700);
  border: 1.5px solid var(--tr-n-300);
}
.tr-btn-ghost:hover { border-color: var(--tr-g-500); color: var(--tr-g-500); }

/* ── 16. MOBILE BOTTOM TAB BAR ────────────────────────────────── */
.tr-mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--tr-g-900);
  border-top: 1px solid var(--tr-g-500);
  z-index: 999;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.tr-mobile-tabbar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--sp-1);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tr-g-300);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--tr-font-body);
  transition: color var(--ease);
}
.tr-mobile-tabbar-btn.active { color: #fff; }
.tr-mobile-tabbar-icon { font-size: 16px; }

/* ── 17. UTILITY ──────────────────────────────────────────────── */
.tr-num {
  font-family: var(--tr-font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.tr-disclaimer {
  font-size: 12px;
  color: var(--tr-n-500);
  line-height: 1.6;
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--tr-n-100);
}

/* ── 18. BREAKPOINTS ──────────────────────────────────────────── */

/* Tablet: stack calculator panels */
@media (max-width: 1023px) {
  .tr-calc-body {
    grid-template-columns: 1fr;
  }
  .tr-input-panel {
    border-right: none;
    border-bottom: 1px solid var(--tr-n-100);
  }
  .tr-kpi-row.three { grid-template-columns: 1fr 1fr; }
}

/* Mobile */
@media (max-width: 767px) {
  .tr-container,
  .tr-container-sm {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }

  .tr-calc-header { padding: var(--sp-3) var(--sp-4); }
  .tr-input-panel { padding: var(--sp-4); }
  .tr-result-panel { padding: var(--sp-4); }

  .tr-kpi.hero .tr-kpi-value { font-size: 24px; }

  .tr-chart-wrap,
  .tr-table-wrap { border-radius: var(--r-md); }

  .tr-related-grid { grid-template-columns: 1fr 1fr; }

  /* Show mobile bottom tab bar */
  .tr-mobile-tabbar { display: flex; }

  /* Pad bottom so last content isn't behind tab bar */
  .tr-page-wrap { padding-bottom: 68px; }
}

/* Small phones */
@media (max-width: 480px) {
  .tr-container,
  .tr-container-sm {
    padding-left: var(--sp-3);
    padding-right: var(--sp-3);
  }

  /* Chips scroll horizontally instead of wrapping */
  .tr-preset-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .tr-preset-chips::-webkit-scrollbar { display: none; }

  .tr-related-grid { grid-template-columns: 1fr; }
  .tr-kpi-row.three { grid-template-columns: 1fr; }
}

/* ── Chart canvas height fix ─────────────────────────────────────
 * Chart.js with maintainAspectRatio:false requires the parent to
 * have an explicit pixel height before initialization.
 * These rules ensure the container is never 0px tall.
 * ─────────────────────────────────────────────────────────────── */
.tr-chart-canvas-wrap {
  position: relative;
  min-height: 260px;
  width: 100%;
}
.tr-chart-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
/* Donut is square and uses maintainAspectRatio:true — override above */
.tr-donut-canvas {
  min-height: unset;
  width: 160px !important;
  max-width: 160px;
}
.tr-donut-canvas canvas {
  width: 160px !important;
  height: 160px !important;
}

/* ══════════════════════════════════════════════════════════════════
   TAX CALCULATOR COMPONENTS  (appended v1.1.0)
   ══════════════════════════════════════════════════════════════════ */

/* ── Regime toggle (Income Tax, TDS, Surcharge) ─────────────────── */
.tr-toggle-group {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.tr-toggle-btn {
  padding: 8px 18px;
  border: 1.5px solid var(--tr-n-300);
  border-radius: var(--r-pill);
  background: #fff;
  font-family: var(--tr-font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--tr-n-700);
  cursor: pointer;
  transition: all var(--ease);
}
.tr-toggle-btn.active,
.tr-toggle-btn:hover {
  background: var(--tr-g-500);
  border-color: var(--tr-g-500);
  color: #fff;
}

/* ── Deduction panel header ──────────────────────────────────────── */
.tr-deduction-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tr-n-500);
  padding: var(--sp-3) 0 var(--sp-2);
  border-top: 1px solid var(--tr-n-100);
  margin-top: var(--sp-4);
}

/* ── Regime comparison rows ─────────────────────────────────────── */
.tr-regime-compare {
  background: var(--tr-n-50);
  border: 1px solid var(--tr-n-100);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
}
.tr-regime-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--tr-n-100);
}
.tr-regime-row:last-child { border-bottom: none; }
.tr-regime-row.highlight {
  font-weight: 700;
  color: var(--tr-g-500);
  font-size: 15px;
}

/* ── Regime recommendation banner ───────────────────────────────── */
.tr-regime-rec {
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  margin: var(--sp-3) 0;
}
.tr-regime-rec.positive {
  background: var(--tr-success-bg);
  color: var(--tr-success);
  border: 1px solid var(--tr-success-border);
}
.tr-regime-rec.neutral {
  background: var(--tr-warning-bg);
  color: var(--tr-warning);
  border: 1px solid #e8d08a;
}

/* ── Condition table (HRA 3-condition, quarterly installments) ───── */
.tr-condition-table {
  background: var(--tr-n-50);
  border: 1px solid var(--tr-n-100);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
}
.tr-condition-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tr-n-500);
  margin-bottom: var(--sp-3);
}
.tr-condition-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--tr-n-100);
}
.tr-condition-row:last-child { border-bottom: none; }
.tr-cond-winner {
  color: var(--tr-g-500);
  font-weight: 700;
}
.tr-cond-winner::after {
  content: ' ✓';
  font-size: 11px;
}

/* ── Progress bar (80C utilisation) ─────────────────────────────── */
.tr-progress-track {
  height: 20px;
  background: var(--tr-n-100);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.tr-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--tr-g-500), var(--tr-g-300));
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  transition: width 400ms ease;
  min-width: 32px;
}

/* ── 80C status badge ────────────────────────────────────────────── */
.tr-80c-status {
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  margin: var(--sp-3) 0;
}
.tr-80c-status.done {
  background: var(--tr-success-bg);
  color: var(--tr-success);
  border: 1px solid var(--tr-success-border);
}
.tr-80c-status.warn {
  background: var(--tr-warning-bg);
  color: var(--tr-warning);
  border: 1px solid #e8d08a;
}
