/* ═══════════════════════════════════════════════════════════
   CALBHARAT — Design System
   Theme: obsidian monolith in candlelight. Near-black canvas,
   warm cream type, one champagne accent, hairline borders,
   no shadows. Light mode (data-theme="light") inverts the same
   system onto warm paper with a deepened champagne accent.
═══════════════════════════════════════════════════════════ */

@import url('https://api.fontshare.com/v2/css?f[]=switzer@400,500,600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600&family=Noto+Sans+Tamil:wght@400;500;600&family=Noto+Sans+Telugu:wght@400;500;600&family=Noto+Sans+Kannada:wght@400;500;600&family=Noto+Sans+Malayalam:wght@400;500;600&family=Noto+Sans+Gujarati:wght@400;500;600&family=Noto+Sans+Bengali:wght@400;500;600&family=Noto+Sans+Gurmukhi:wght@400;500;600&family=Noto+Sans+Oriya:wght@400;500;600&display=swap');

/* ─── TOKENS (dark, default) ────────────────────────────── */
:root {
  --bg:          #000000;
  --bg2:         #000000;
  --surface:     #000000;
  --surface2:    rgba(255,247,221,0.05);
  --surface3:    rgba(255,247,221,0.09);
  --border:      rgba(255,247,221,0.20);
  --border2:     rgba(255,247,221,0.32);
  --ash:         #66635f;

  /* The accent. Legacy names (orange, gold, emerald, blue, purple, pink) all resolve to the
     same restrained palette so older markup keeps working without introducing new colours. */
  --accent:      #c8ad86;
  --orange:      #c8ad86;
  --orange-dim:  rgba(200,173,134,0.12);
  --orange-glow: rgba(200,173,134,0.20);
  --gold:        #c8ad86;
  --gold-dim:    rgba(200,173,134,0.12);
  --emerald:     #fff7dd;
  --emerald-dim: rgba(255,247,221,0.06);
  --blue:        #fff7dd;
  --blue-dim:    rgba(255,247,221,0.06);
  --purple:      #c8ad86;
  --pink:        #c8ad86;
  --red:         #e08a76;

  --text:        #fff7dd;
  --text2:       rgba(255,247,221,0.80);
  --muted:       rgba(255,247,221,0.60);
  --on-accent:   #000000;
  --arrow-fill:  %23fff7dd;

  --font-head:   'Switzer', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
                 'Noto Sans Devanagari', 'Noto Sans Tamil', 'Noto Sans Telugu', 'Noto Sans Kannada',
                 'Noto Sans Malayalam', 'Noto Sans Gujarati', 'Noto Sans Bengali',
                 'Noto Sans Gurmukhi', 'Noto Sans Oriya', sans-serif;
  --font-body:   var(--font-head);
  --font-mono:   var(--font-head);   /* one family; figures use tabular-nums instead */

  --track-display: -0.042em;         /* tight tracking only on Latin display sizes */
  --track-title:   -0.03em;

  --radius-sm:   4px;
  --radius:      4px;
  --radius-lg:   4px;
  --radius-xl:   4px;
  --radius-full: 100px;

  --shadow-sm:   none;
  --shadow:      none;
  --shadow-lg:   none;
  --glow-orange: none;
  --glow-gold:   none;

  color-scheme: dark;
}

/* ─── TOKENS (light) ────────────────────────────────────── */
:root[data-theme="light"] {
  --bg:          #f8f3e6;
  --bg2:         #f8f3e6;
  --surface:     #f8f3e6;
  --surface2:    rgba(23,20,13,0.045);
  --surface3:    rgba(23,20,13,0.08);
  --border:      rgba(23,20,13,0.18);
  --border2:     rgba(23,20,13,0.30);
  --ash:         #8b867c;

  --accent:      #7d6234;
  --orange:      #7d6234;
  --orange-dim:  rgba(125,98,52,0.10);
  --orange-glow: rgba(125,98,52,0.18);
  --gold:        #7d6234;
  --gold-dim:    rgba(125,98,52,0.10);
  --emerald:     #17140d;
  --emerald-dim: rgba(23,20,13,0.05);
  --blue:        #17140d;
  --blue-dim:    rgba(23,20,13,0.05);
  --purple:      #7d6234;
  --pink:        #7d6234;
  --red:         #a8402a;

  --text:        #17140d;
  --text2:       rgba(23,20,13,0.82);
  --muted:       rgba(23,20,13,0.64);
  --on-accent:   #f8f3e6;
  --arrow-fill:  %2317140d;

  color-scheme: light;
}

/* Non-Latin scripts: negative tracking breaks conjuncts, so switch it off. */
html:not([lang="en"]) { --track-display: 0; --track-title: 0; }

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--on-accent); }

/* ─── NAV ───────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  flex-wrap: wrap;
}
.nav-logo {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-logo span { color: var(--accent); }
.nav-logo sup {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  vertical-align: super;
  margin-left: 2px;
  filter: grayscale(1);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-link {
  padding: 5px 11px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--accent); }
.nav-link.active { color: var(--accent); border-bottom: 1px solid var(--accent); border-radius: 0; }
.nav-right { display: flex; align-items: center; gap: 10px; }

/* Language selector */
.lang-select {
  appearance: none;
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 28px 5px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23fff7dd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}
.lang-select option { background: var(--bg); color: var(--text); }
.lang-select:hover, .lang-select:focus { border-color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover, .theme-toggle:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ─── PAGE WRAPPER ──────────────────────────────────────── */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
  position: relative;
  z-index: 1;
}

/* ─── HERO (HOMEPAGE) ───────────────────────────────────── */
.hero {
  padding: 72px 0 48px;
  position: relative;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 20px;
  letter-spacing: 0.18px;
}
.hero-title {
  font-family: var(--font-head);
  font-size: clamp(30px, 4.2vw, 44px);
  font-weight: 400;
  line-height: 1.13;
  letter-spacing: var(--track-display);
  margin-bottom: 16px;
  max-width: 640px;
}
.hero-title .accent-orange,
.hero-title .accent-gold { color: inherit; }
.hero-sub {
  font-size: 19px;
  letter-spacing: -0.5px;
  color: var(--text2);
  max-width: 540px;
  margin-bottom: 32px;
  line-height: 1.5;
}
html:not([lang="en"]) .hero-sub { letter-spacing: 0; }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin-bottom: 48px;
}
.stat-item { display: flex; flex-direction: column; gap: 2px; }
.stat-val {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.5px;
  color: var(--accent);
}
.stat-lbl { font-size: 15px; color: var(--muted); font-weight: 400; }

/* ─── HERO CALCULATOR (HOMEPAGE) ───────────────────────── */
.hero-layout {
  display: grid;
  grid-template-columns: 1fr minmax(460px, 520px);
  gap: 40px;
  align-items: start;
}
@media (max-width: 1000px) {
  .hero-layout { grid-template-columns: 1fr; }
}
.hero-calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 76px;
  width: 100%;
}
.hero-calc-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.hctab {
  padding: 11px 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s;
  font-family: var(--font-body);
  text-align: center;
}
.hctab:hover { color: var(--text); }
.hctab.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
.hero-calc-body { padding: 20px; }

/* ─── CARDS ─────────────────────────────────────────────── */
.card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--border2); }

.card-glass {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ─── FORM ELEMENTS ─────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18px;
}
.field-input {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 17px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.field-input:focus { border-color: var(--accent); }
.field-input::placeholder { color: var(--muted); font-family: var(--font-body); font-size: 16px; }

.input-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 17px;
  pointer-events: none;
}
.input-wrap .field-input { padding-left: 26px; }

.field-select {
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 34px 11px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23fff7dd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}
.field-select:focus { border-color: var(--accent); }
.field-select option { background: var(--bg); color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 540px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
.full-col { grid-column: 1 / -1; }

/* Range slider */
.range-wrap { display: flex; flex-direction: column; gap: 6px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-val {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent);
  min-width: 80px;
  text-align: right;
  font-weight: 500;
}
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 1px;
  background: var(--border2);
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* ─── BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: transparent; color: var(--accent); }
.btn-gold { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-gold:hover { background: transparent; color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 16px; border-radius: var(--radius-sm); }

/* ─── RESULT BOX ────────────────────────────────────────── */
.result-box {
  display: none;
  margin-top: 20px;
}
.result-box.show { display: block; }

.result-hero {
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}
.result-label { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.18px; font-weight: 500; margin-bottom: 8px; }
.result-value {
  font-family: var(--font-head);
  font-size: 40px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: var(--track-display);
  line-height: 1.1;
}
.result-value.gold,
.result-value.emerald { color: var(--accent); }
.result-sub { font-size: 16px; color: var(--text2); margin-top: 8px; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.result-item {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  transition: border-color 0.15s;
}
.result-item:hover { border-color: var(--border2); }
.result-item-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.18px; }
.result-item-val { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--text); }

/* Donut chart */
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap; margin-top: 16px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--text2); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ─── TABS ──────────────────────────────────────────────── */
.tab-group { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-body);
  white-space: nowrap;
}
.tab-btn:hover { border-color: var(--accent); color: var(--accent); }
.tab-btn.active,
.tab-btn.active-gold,
.tab-btn.active-emerald { background: transparent; border-color: var(--accent); color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── PAGE HEADER ───────────────────────────────────────── */
.page-header {
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  position: relative;
}
.page-eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  margin-bottom: 14px;
}
.page-title {
  font-family: var(--font-head);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: var(--track-display);
  margin-bottom: 10px;
  line-height: 1.13;
}
.page-desc { font-size: 15px; color: var(--text2); max-width: 560px; }

/* ─── ABOUT / FORMULA SECTION ───────────────────────────── */
.about-section {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 32px;
}
.about-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  font-size: 17px;
  font-weight: 500;
  color: var(--text2);
  transition: color 0.15s;
}
.about-toggle:hover { color: var(--accent); }
.about-toggle-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  transition: transform 0.2s, border-color 0.15s;
  flex-shrink: 0;
}
.about-toggle.open .about-toggle-icon { transform: rotate(180deg); border-color: var(--accent); }
.about-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}
.about-body.open { display: block; }

.about-what { font-size: 17px; color: var(--text2); line-height: 1.6; margin-bottom: 20px; padding-top: 16px; }
.formula-box {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.formula-title { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.18px; color: var(--accent); margin-bottom: 10px; }
.formula-equation {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 12px;
  line-height: 1.5;
}
.formula-vars { display: flex; flex-direction: column; gap: 4px; }
.formula-var { font-size: 16px; color: var(--text2); line-height: 1.5; }
.formula-var strong { color: var(--text); font-family: var(--font-mono); font-weight: 500; }

.example-box {
  background: transparent;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 16px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 16px;
}
.example-box strong { color: var(--accent); font-weight: 500; }

.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--text2);
  transition: color 0.15s;
  user-select: none;
}
.faq-q:hover { color: var(--accent); }
.faq-a {
  display: none;
  padding: 12px 16px 14px;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
  border-top: 1px solid var(--border);
}
.faq-a.open { display: block; }

/* ─── INFO / VERDICT BOX ────────────────────────────────── */
.info-box {
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 16px;
  line-height: 1.6;
  margin-top: 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  color: var(--text2);
}
.info-box.orange,
.info-box.gold,
.info-box.emerald,
.info-box.blue { background: transparent; border: 1px solid var(--border); border-left: 2px solid var(--accent); color: var(--text2); }

/* ─── TOOL GRID (homepage) ──────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: var(--track-title);
}
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18px;
  background: transparent;
  color: var(--accent);
}
.tag-orange, .tag-gold, .tag-emerald, .tag-blue { background: transparent; color: var(--accent); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.tool-card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
  position: relative;
}
.tool-card:hover { border-color: var(--accent); }
.tool-card-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.tool-card-name {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.tool-card-desc { font-size: 15px; color: var(--muted); line-height: 1.4; }
.tool-card-arrow {
  font-size: 17px;
  color: var(--muted);
  transition: color 0.15s;
  align-self: flex-end;
  margin-top: auto;
}
.tool-card:hover .tool-card-arrow { color: var(--accent); }

/* ─── DATA TABLE ────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  font-family: var(--font-mono);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.data-table .highlight td { color: var(--accent); font-weight: 500; }
.data-table .active-slab td { color: var(--accent); font-weight: 500; background: var(--accent-dim, var(--gold-dim)); }

/* ─── AD SLOTS ──────────────────────────────────────────── */
/* Hidden until AdSense (or another ad network) is actually approved and live —
   showing a dashed "Ad · Google AdSense" placeholder box to real visitors before
   that reads as an unfinished site. Re-enable (display: flex) once ads are wired up. */
.ad-slot {
  display: none;
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  font-family: var(--font-mono);
}
.ad-slot-top { width: 100%; height: 90px; margin-bottom: 20px; }
.ad-slot-mid { width: 100%; height: 250px; margin: 20px 0; }
.ad-slot-sidebar { width: 100%; height: 250px; }

/* ─── MAIN CALC LAYOUT ──────────────────────────────────── */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; }
}
.calc-sidebar { display: flex; flex-direction: column; gap: 16px; }


/* ─── RATE BADGE ────────────────────────────────────────── */
.rate-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.rate-badge-live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ─── ADMIN ─────────────────────────────────────────────── */
.admin-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.admin-field:last-child { border-bottom: none; }
.admin-field-info { display: flex; flex-direction: column; gap: 4px; }
.admin-field-label { font-size: 16px; font-weight: 500; color: var(--text); }
.admin-field-note { font-size: 14px; color: var(--muted); }
.admin-input {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  outline: none;
  width: 120px;
  text-align: right;
  transition: border-color 0.15s;
}
.admin-input:focus { border-color: var(--accent); }
.save-btn-sm {
  padding: 6px 14px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  font-family: var(--font-body);
}
.save-btn-sm:hover { background: transparent; color: var(--accent); }

/* ─── TOAST ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  display: none;
  z-index: 999;
}
.toast.show { display: block; }

/* ─── FOOTER ────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  margin-top: 80px;
  position: relative;
  z-index: 1;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-copy { font-size: 15px; color: var(--muted); }
.footer-links { display: flex; gap: 16px; }
.footer-link { font-size: 15px; color: var(--text2); text-decoration: none; transition: color 0.15s; }
.footer-link:hover { color: var(--accent); }
.footer-disclaimer {
  max-width: 1200px;
  margin: 10px auto 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  padding: 0 0 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* ─── UTILITY ───────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-orange { color: var(--accent); }
.text-gold   { color: var(--accent); }
.text-emerald{ color: var(--text); }
.text-muted  { color: var(--muted);  }
.font-mono   { font-family: var(--font-mono); }
.font-head   { font-family: var(--font-head); }
.fw-700      { font-weight: 500; }
.fw-600      { font-weight: 500; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12{ gap: 12px; }

/* ─── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .page-wrap { padding: 0 16px 40px; }
  .hero { padding: 40px 0 24px; }
  .card { padding: 20px; }
  .result-value { font-size: 30px; }
  .hero-calc { position: static; }
}
@media (max-width: 480px) {
  .hero-stats { gap: 20px; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── FINANCIAL TERM TOOLTIPS ───────────────────────────── */
.ft-tooltip {
  position: relative;
  border-bottom: 1px dashed var(--muted);
  cursor: help;
  color: inherit;
}
.ft-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 300px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 15px;
  color: var(--text2);
  line-height: 1.5;
  white-space: normal;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.ft-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border2);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.15s;
}
.ft-tooltip:hover::after,
.ft-tooltip:hover::before,
.ft-tooltip:focus::after,
.ft-tooltip:focus::before { opacity: 1; }

/* Standalone info-icon variant: tappable on mobile (no hover there),
   reuses the same bubble styling as the acronym tooltips above. */
.info-tip-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: transparent; border: 1px solid var(--muted);
  color: var(--muted); font-size: 13px; font-weight: 500;
  font-family: var(--font-body); line-height: 1; cursor: help;
  padding: 0; flex-shrink: 0;
}
.info-tip-btn:hover, .info-tip-btn:focus { border-color: var(--accent); color: var(--accent); }

/* Respect reduced motion everywhere. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Select arrows are data-URIs, which can't read CSS variables, so light mode swaps the fill. */
:root[data-theme="light"] .lang-select,
:root[data-theme="light"] .field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2317140d'/%3E%3C/svg%3E");
}

/* ─── 404 PAGE ──────────────────────────────────────────── */
.nf-wrap { min-height: calc(100vh - 61px - 90px); display: flex; align-items: center; justify-content: center; text-align: center; padding: 80px 24px; }
.nf-inner { max-width: 640px; }
.nf-code {
  font-size: clamp(96px, 20vw, 200px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: var(--track-display);
  color: var(--accent);
  margin-bottom: 24px;
}
.nf-title { font-size: clamp(24px, 3.4vw, 36px); font-weight: 400; letter-spacing: var(--track-display); line-height: 1.13; margin-bottom: 12px; }
.nf-sub { color: var(--text2); font-size: 18px; margin-bottom: 32px; }
.nf-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 48px; }
.nf-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Overrides for rules injected by js/nav.js (it loads after this file): monochrome icons,
   no shadows, square corners, per the design system. */
html .mega-dropdown { box-shadow: none; border-radius: var(--radius); }
html .mega-icon, html .cat-tool-icon { background: transparent; }
html .nav-group-btn, html .back-btn { border-radius: var(--radius); }
html .mega-item.current, html .cat-tool-link.active-tool { background: transparent; }
html .cat-tool-link { background: transparent; border-color: var(--border); }
html .category-tools { background: transparent; border-radius: var(--radius); }

/* ─── LIVE-DATA FAILURE NOTICE ──────────────────────────── */
.api-notice {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 15px;
}
.api-notice-retry, .api-notice-close {
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--accent); font-family: var(--font-body); font-size: 15px; font-weight: 500;
  padding: 2px 10px; cursor: pointer;
}
.api-notice-close { color: var(--muted); padding: 0 8px; }
.api-notice-retry:hover, .api-notice-close:hover { border-color: var(--accent); }

/* ─── EMI RESULT: figure on one side, chart on the other ─── */
.result-hero-split {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 32px;
  flex-wrap: wrap;
  padding: 24px;
}
.result-hero-main { flex: 1 1 220px; min-width: 0; }
.result-hero-main .result-label { font-size: 12px; }
.result-hero-main .result-value { font-size: clamp(26px, 3.2vw, 38px); }
.result-hero-chart { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.result-hero-chart canvas { display: block; max-width: 100%; }
.result-hero-chart .donut-legend { flex-direction: row; gap: 20px; }
.result-hero-chart .legend-item { font-size: 13px; }
.result-hero-chart .legend-dot { width: 10px; height: 10px; }
@media (max-width: 560px) {
  .result-hero-split { flex-direction: column; padding: 24px 16px; gap: 16px; }
  .result-hero-main { flex: 0 0 auto; width: 100%; text-align: center; }
}

/* Keep the nav on one row at laptop widths despite the larger type. */
.nav-inner { flex-wrap: nowrap; }
html .nav-group-btn, .nav-link { font-size: 14px; padding: 6px 8px; }
html .nav-menu { gap: 0; flex-wrap: nowrap; }
.nav-right { flex-shrink: 0; }

/* Category menu as a compact scrollable chip row above the calculator.
   Opt-in per page with <body class="tools-chips">. */
body.tools-chips .category-tools { border: 0; padding: 0; margin-bottom: 16px; background: transparent; }
body.tools-chips .category-tools-title { display: none; }
body.tools-chips .category-tools-grid {
  display: flex; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding-bottom: 2px;
}
body.tools-chips .category-tools-grid::-webkit-scrollbar { display: none; }
body.tools-chips .cat-tool-link {
  flex: 0 0 auto; white-space: nowrap; gap: 6px;
  padding: 6px 12px; font-size: 13px;
  border-radius: var(--radius-full, 999px);
}
body.tools-chips .cat-tool-icon { width: auto; font-size: 16px; }
@media (min-width: 900px) {
  body.tools-chips .category-tools-grid { flex-wrap: wrap; overflow: visible; }
}

/* Eyebrow badges removed: the page title is enough. */
.page-eyebrow { display: none; }

/* Home + sibling calculators row, replaces breadcrumbs. */
.crumb-row {
  display: flex; flex-wrap: nowrap; gap: 6px; align-items: center;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 10px 0 0;
}
.crumb-row::-webkit-scrollbar { display: none; }
.crumb-row .cat-tool-link {
  flex: 0 0 auto; white-space: nowrap;
  padding: 4px 11px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); border-radius: var(--radius-full, 999px);
  background: transparent; color: var(--text2);
}
.crumb-row .cat-tool-link:hover { color: var(--text); border-color: var(--border2); }
.crumb-row .cat-tool-link.active-tool { color: var(--accent); border-color: var(--accent); }


/* Opt-in smaller text for a page (about 2px less on 16px body text). */
body.page-compact { zoom: 0.88; }

.crumb-row { margin-bottom: 30px; padding-top: 16px; gap: 8px; }
