/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #f2efe6;
  --ink: #16201b;
  --ink-2: #3f4c45;
  --muted: #5f6c65;
  --line: #e4e0d5;
  --line-strong: #d3cebf;
  --brand: #0f6e50;
  --brand-hover: #0b5a41;
  --brand-soft: #e1f0e8;
  --on-brand: #ffffff;
  --accent: #e8912d;
  --series-a: #1a8a61;
  --series-b: #eb8a1f;
  --danger: #b42318;
  --wa: #1c9a4e;
  --c-loans: #2d64c8;
  --c-loans-bg: #e6edfb;
  --c-invest: #13805a;
  --c-invest-bg: #e0f1e8;
  --c-plan: #6a4cc9;
  --c-plan-bg: #eeeafb;
  --c-tax: #b85c0c;
  --c-tax-bg: #fcefdd;
  --c-daily: #1d7582;
  --c-daily-bg: #dff0f2;
  --c-business: #b0306a;
  --c-business-bg: #fbe8f0;
  --c-health: #c2372f;
  --c-health-bg: #fde9e7;
  --c-construction: #4f5d6c;
  --c-construction-bg: #e7ecf1;
  --c-convert: #866300;
  --c-convert-bg: #f6eed3;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(22, 32, 27, 0.06);
  --shadow-2: 0 1px 2px rgba(22, 32, 27, 0.05), 0 12px 32px -12px rgba(22, 32, 27, 0.16);
  --font: "Mukta", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  --maxw: 1160px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1411;
    --surface: #151d19;
    --surface-2: #1a2420;
    --ink: #e7eee9;
    --ink-2: #bac7c0;
    --muted: #93a29a;
    --line: #26322c;
    --line-strong: #34423b;
    --brand: #34b884;
    --brand-hover: #4cc896;
    --brand-soft: #16302a;
    --on-brand: #06140d;
    --accent: #f0a24a;
    --series-a: #23996c;
    --series-b: #d67a1c;
    --danger: #f4877c;
    --wa: #25b35d;
    --c-loans: #86aef5;
    --c-loans-bg: #1a2640;
    --c-invest: #5fd3a2;
    --c-invest-bg: #143126;
    --c-plan: #b6a3f7;
    --c-plan-bg: #262042;
    --c-tax: #f3b36b;
    --c-tax-bg: #3a2711;
    --c-daily: #6cd0de;
    --c-daily-bg: #122f33;
    --c-business: #f391bd;
    --c-business-bg: #3a1a29;
    --c-health: #f4948a;
    --c-health-bg: #3b1d1a;
    --c-construction: #aebccb;
    --c-construction-bg: #1f2831;
    --c-convert: #e2c15b;
    --c-convert-bg: #2e2710;
    --shadow-1: none;
    --shadow-2: none;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

.ic {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}

.logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.logo-bg {
  fill: var(--brand);
}

.logo-mark {
  fill: none;
  stroke: var(--on-brand);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-dot {
  fill: var(--accent);
}

.top-nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.top-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.97rem;
}

.top-nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 3px 3px 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.lang-toggle .ic {
  width: 16px;
  height: 16px;
  margin-right: 4px;
}

.lang-toggle a {
  min-width: 40px;
  padding: 3px 10px;
  border-radius: 999px;
  text-align: center;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-2);
  text-decoration: none;
}

.lang-toggle a[aria-current] {
  background: var(--brand);
  color: var(--on-brand);
}

/* ------------------------------------------------------------------ shared pieces */
.tool-icon {
  --c: var(--c-invest);
  --c-bg: var(--c-invest-bg);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--c-bg);
  color: var(--c);
}

.tool-icon .ic {
  width: 22px;
  height: 22px;
}

.tool-icon-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.tool-icon-lg .ic {
  width: 28px;
  height: 28px;
}

.cat-loans {
  --c: var(--c-loans);
  --c-bg: var(--c-loans-bg);
}

.cat-invest {
  --c: var(--c-invest);
  --c-bg: var(--c-invest-bg);
}

.cat-plan {
  --c: var(--c-plan);
  --c-bg: var(--c-plan-bg);
}

.cat-tax {
  --c: var(--c-tax);
  --c-bg: var(--c-tax-bg);
}

.cat-daily {
  --c: var(--c-daily);
  --c-bg: var(--c-daily-bg);
}

.cat-business {
  --c: var(--c-business);
  --c-bg: var(--c-business-bg);
}

.cat-health {
  --c: var(--c-health);
  --c-bg: var(--c-health-bg);
}

.cat-construction {
  --c: var(--c-construction);
  --c-bg: var(--c-construction-bg);
}

.cat-convert {
  --c: var(--c-convert);
  --c-bg: var(--c-convert-bg);
}

.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 3px;
}

.sw-a {
  background: var(--series-a);
}

.sw-b {
  background: var(--series-b);
}

.split-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
}

.split-bar .seg-a,
.split-bar .seg-b {
  flex: 1 1 0;
  min-width: 0;
  transition: flex-grow 0.25s ease;
}

.split-bar .seg-a {
  background: var(--series-a);
}

.split-bar .seg-b {
  background: var(--series-b);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-wa {
  background: var(--wa);
  border-color: var(--wa);
  color: #fff;
}

.btn-wa:hover {
  filter: brightness(1.06);
  color: #fff;
}

/* ------------------------------------------------------------------ home */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr);
  gap: 48px;
  align-items: center;
  padding: 48px 0 28px;
}

.hero-plain {
  grid-template-columns: minmax(0, 1fr);
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  font-size: 0.9rem;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 700;
}

.lead {
  margin: 0 0 22px;
  color: var(--ink-2);
  font-size: 1.12rem;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-1);
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.chips-label {
  color: var(--muted);
  font-size: 0.95rem;
  margin-right: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.chip .ic {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.chip:hover {
  border-color: var(--brand);
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  color: var(--ink);
  text-decoration: none;
  transform: rotate(-1deg);
  transition: transform 0.2s ease;
}

.hero-card:hover {
  transform: rotate(0deg) translateY(-2px);
}

.hc-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.hc-head > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.hc-head span span {
  color: var(--muted);
  font-size: 0.92rem;
}

.hc-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.hc-value {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.hc-sub {
  color: var(--muted);
  margin-bottom: 12px;
}

.hc-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 0.92rem;
}

.hc-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hc-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--brand);
  font-weight: 600;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 12px;
  padding: 0;
  list-style: none;
}

.trust-strip li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.95rem;
}

.trust-strip .ic {
  color: var(--brand);
}

.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 36px 0 14px;
}

.cat-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.cat-head h2 a,
.footer-col h3 a {
  color: inherit;
  text-decoration: none;
}

.cat-head h2 a:hover,
.footer-col h3 a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.cat-cards {
  margin-top: 24px;
}

.count {
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 40px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-title {
  font-weight: 700;
  line-height: 1.35;
}

.card-text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.card-arrow {
  position: absolute;
  top: 18px;
  right: 14px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.card:hover .card-arrow {
  opacity: 1;
  transform: none;
  color: var(--brand);
}

.card-sm {
  align-items: center;
  padding: 10px 36px 10px 10px;
  border-radius: 12px;
}

.card-sm .tool-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.card-sm .tool-icon .ic {
  width: 18px;
  height: 18px;
}

.card-sm .card-title {
  font-weight: 600;
  font-size: 0.97rem;
}

.card-sm .card-arrow {
  top: 50%;
  margin-top: -9px;
}

.card[hidden],
.cat[hidden] {
  display: none;
}

.no-match {
  color: var(--muted);
}

/* ------------------------------------------------------------------ tool page head */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  font-size: 0.92rem;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.crumb-sep {
  width: 14px;
  height: 14px;
  transform: rotate(-90deg);
}

.tool-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 18px 0 10px;
}

.tool-head h1 {
  margin: 0 0 4px;
  font-size: clamp(1.75rem, 3.6vw, 2.4rem);
  font-weight: 700;
}

.tool-head .lead {
  margin: 0;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.92rem;
}

.trust-row li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trust-row .ic {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

/* ------------------------------------------------------------------ calculator */
.calc {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}

.inputs {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 4px 4px 0;
}

.field label {
  font-weight: 600;
  color: var(--ink);
}

.field > label {
  display: block;
  margin-bottom: 8px;
}

.field-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.field-top label {
  padding-top: 8px;
}

.num-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
}

.num {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 132px;
  padding: 7px 12px;
  background: var(--brand-soft);
  border: 1.5px solid transparent;
  border-radius: 12px;
  color: var(--brand);
  font-weight: 700;
  font-size: 1.05rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.num:focus-within {
  background: var(--surface);
  border-color: var(--brand);
}

.num input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  text-align: right;
}

.affix {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.hint {
  min-height: 1.3em;
  margin-top: 2px;
  font-size: 0.84rem;
  color: var(--muted);
}

.select {
  position: relative;
}

.select .ic {
  position: absolute;
  right: 12px;
  top: 50%;
  margin-top: -10px;
  color: var(--muted);
  pointer-events: none;
}

select,
.date {
  width: 100%;
  padding: 11px 40px 11px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  -webkit-appearance: none;
  appearance: none;
}

.date {
  padding-right: 14px;
}

select:focus,
.date:focus {
  outline: none;
  border-color: var(--brand);
}

.range {
  --fill: 50%;
  width: 100%;
  height: 28px;
  margin: 8px 0 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--brand) var(--fill), var(--line) var(--fill));
}

.range::-moz-range-track {
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--brand) var(--fill), var(--line) var(--fill));
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.presets button {
  padding: 6px 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}

.presets button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.results {
  position: sticky;
  top: 84px;
}

.results-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.results-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calc-msg {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}

.outs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.out {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.out.primary,
.out.wide,
.out.span {
  grid-column: 1 / -1;
}

.out.primary {
  order: -1;
  padding: 18px 20px;
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.out-label {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.35;
}

.out.primary .out-label,
.out.primary .out-sub {
  color: inherit;
  opacity: 0.88;
}

.out-val {
  margin-top: 2px;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.out.primary .out-val {
  font-size: clamp(2rem, 4.2vw, 2.6rem);
  line-height: 1.1;
}

.out.txt:not(.primary) .out-val {
  font-size: 1.05rem;
  font-weight: 600;
}

.out.wide:not(.primary) .out-val {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink-2);
}

.out-sub {
  font-size: 0.86rem;
  color: var(--muted);
}

.out-sub:empty {
  display: none;
}

.is-invalid .out-val {
  opacity: 0.5;
}

.split-legend {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.split-legend li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}

.split-legend b {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.split-legend em {
  min-width: 3ch;
  color: var(--muted);
  font-style: normal;
  font-size: 0.88rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sticky-result {
  display: none;
}

/* ------------------------------------------------------------------ chart / table card */
.viz,
.breakdown {
  margin-top: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.viz-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.viz-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
}

.seg button .ic {
  width: 16px;
  height: 16px;
}

.seg button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 0.93rem;
}

.viz-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.viz-panel {
  position: relative;
  margin-top: 14px;
}

.viz-chart {
  width: 100%;
  min-height: 250px;
}

.viz-chart svg {
  display: block;
  overflow: visible;
  outline: none;
}

.viz-chart svg:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 6px;
}

.viz-chart .grid {
  stroke: var(--line);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.viz-chart .tick {
  fill: var(--muted);
  font-size: 11.5px;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}

.viz-chart .s0 {
  fill: var(--series-a);
}

.viz-chart .s1 {
  fill: var(--series-b);
}

.viz-chart .bar {
  transition: opacity 0.12s ease;
}

.viz-chart svg.dim .bar:not(.active) {
  opacity: 0.4;
}

.viz-chart .hit {
  fill: transparent;
}

.viz-tip {
  position: absolute;
  z-index: 2;
  min-width: 170px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2);
  font-size: 0.9rem;
  pointer-events: none;
}

.tip-head {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.tip-row {
  display: grid;
  grid-template-columns: 12px auto 1fr;
  align-items: center;
  gap: 8px;
}

.tip-row b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tip-row span {
  color: var(--muted);
}

.tip-key {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.tip-key.sw-a {
  background: var(--series-a);
}

.tip-key.sw-b {
  background: var(--series-b);
}

.tip-key.tip-total {
  background: transparent;
}

.breakdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.breakdown summary::-webkit-details-marker {
  display: none;
}

.breakdown[open] summary .ic {
  transform: rotate(180deg);
}

/* ------------------------------------------------------------------ tables */
.table-wrap {
  overflow: auto;
}

.viz .table-wrap {
  max-height: 440px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 600;
}

tbody tr:hover td {
  background: var(--surface-2);
}

/* ------------------------------------------------------------------ article */
.health-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 20px 0 0;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.5;
}

.health-note .ic {
  margin-top: 1px;
  color: var(--c-health);
}

.page-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  align-items: start;
  margin-top: 40px;
}

.content {
  max-width: 740px;
  font-size: 1.06rem;
  line-height: 1.75;
}

.content > :first-child {
  margin-top: 0;
}

.content h2 {
  margin: 40px 0 12px;
  font-size: 1.55rem;
}

.content h3 {
  margin: 26px 0 8px;
  font-size: 1.15rem;
}

.content li {
  margin: 4px 0;
}

.content li::marker {
  color: var(--brand);
}

.content .table-wrap {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.content td,
.content th {
  white-space: normal;
}

.content code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--brand-soft);
  font-size: 0.92em;
}

.formula {
  margin: 16px 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  line-height: 1.6;
}

.formula code {
  padding: 0;
  background: none;
  font-size: 0.98rem;
}

.faq {
  margin-top: 40px;
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  font-weight: 600;
  font-size: 1.08rem;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary .ic {
  color: var(--muted);
  transition: transform 0.2s ease;
}

.faq-item[open] summary .ic {
  transform: rotate(180deg);
}

.faq-a {
  padding: 0 0 16px;
  color: var(--ink-2);
}

.faq-a p {
  margin: 0;
}

.side {
  position: sticky;
  top: 88px;
}

.side h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-content {
  margin-top: 48px;
}

.page {
  margin-top: 36px;
}

.page h1 {
  margin: 0 0 16px;
  font-size: 2.2rem;
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  margin-top: 72px;
  padding: 44px 0 32px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(5, minmax(0, 1fr));
  gap: 28px;
}

.footer-brand p {
  margin: 10px 0 0;
  color: var(--muted);
}

.footer-col h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
  color: var(--ink);
}

.footer-col h3 + ul + h3 {
  margin-top: 18px;
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col li {
  margin: 5px 0;
}

.footer-col a {
  color: var(--ink-2);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.disclaimer {
  margin: 32px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .page-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .side {
    position: static;
  }

  .side-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .top-nav {
    display: none;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-top: 28px;
  }

  .hero-card {
    display: none;
  }

  .trust-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calc {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
    gap: 20px;
  }

  .results {
    position: static;
  }

  .sticky-result {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px 10px 16px;
    border-radius: 16px;
    background: var(--brand);
    color: var(--on-brand);
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.35);
  }

  .sticky-result[hidden] {
    display: none;
  }

  .sr-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
  }

  .sr-label {
    font-size: 0.82rem;
    opacity: 0.88;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sr-value {
    font-size: 1.3rem;
  }

  .sr-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
  }

  .sr-link .ic {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .brand span {
    font-size: 1.08rem;
  }

  .tool-head {
    gap: 12px;
  }

  .tool-icon-lg {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .tool-icon-lg .ic {
    width: 24px;
    height: 24px;
  }

  .field-top {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .field-top label {
    padding-top: 0;
  }

  .num-col {
    align-items: stretch;
  }

  .num {
    min-width: 0;
  }

  .num input {
    text-align: left;
  }

  .hint {
    text-align: right;
  }

  .trust-strip li {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .share .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .viz,
  .breakdown {
    padding: 16px 14px;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
