:root {
  --ink: #14221f;
  --muted: #62706c;
  --paper: #ffffff;
  --canvas: #f3f5f1;
  --line: #dce4df;
  --brand: #183a34;
  --brand-2: #235a4f;
  --lime: #d9f259;
  --lime-soft: #f3fbc8;
  --coral: #ef755c;
  --danger-soft: #fff1ee;
  --shadow: 0 18px 50px rgba(20, 34, 31, .10);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 4%, rgba(217, 242, 89, .18), transparent 24rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-150%);
  background: var(--paper);
  padding: 10px 14px;
  border-radius: 8px;
}
.skip-link:focus { transform: translateY(0); }

.page-shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 245, 241, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(24, 58, 52, .08);
}

.header-inner, .header-actions, .brand, .footer-inner {
  display: flex;
  align-items: center;
}

.header-inner { min-height: 68px; justify-content: space-between; gap: 20px; }
.brand { gap: 10px; text-decoration: none; font-size: 1.25rem; font-weight: 850; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--lime); }
.brand-mark svg { width: 22px; height: 22px; fill: currentColor; }
.header-actions { gap: 8px; }

select, input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

select:focus, input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(35, 90, 79, .12); }
.compact-control select { min-width: 112px; padding: 8px 34px 8px 10px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 13px;
  padding: 11px 16px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 760;
  transition: transform .18s, box-shadow .18s, background .18s;
}
.button:hover { transform: translateY(-1px); }
.small-button { min-height: 38px; padding: 7px 12px; }
.button-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.button-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.button-primary { width: 100%; background: var(--lime); color: var(--brand); box-shadow: 0 9px 24px rgba(217, 242, 89, .22); }
.button-primary:hover { background: #e4fa7b; }

.hero { padding: 72px 0 42px; max-width: 920px; text-align: center; }
.eyebrow, .step-kicker {
  margin: 0 0 10px;
  color: var(--brand-2);
  font-size: .77rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 { margin: 0; font-size: clamp(2.25rem, 6vw, 4.6rem); line-height: .98; letter-spacing: -.06em; text-wrap: balance; }
.hero-copy { max-width: 760px; margin: 22px auto 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); text-wrap: balance; }
.trust-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 26px; margin-top: 24px; color: #42524d; font-size: .9rem; }
.trust-row > span { display: inline-flex; gap: 7px; align-items: center; }
.trust-row > span > span:first-child { color: var(--brand-2); font-weight: 900; }

.calculator-shell { margin-bottom: 30px; }
.calculator-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); gap: 22px; align-items: start; }
.input-panel, .results-panel { background: var(--paper); border: 1px solid rgba(24, 58, 52, .08); border-radius: var(--radius); box-shadow: var(--shadow); }
.input-panel { padding: clamp(18px, 3vw, 32px); }
.results-panel { background: var(--brand); color: #fff; overflow: hidden; }
.results-sticky { padding: clamp(20px, 3vw, 32px); }

.panel-heading, .result-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading h2, .result-topline h2, .explanation-card h2, .cross-service h2, .content-section h2 { margin: 0; font-size: 1.45rem; line-height: 1.15; letter-spacing: -.025em; }
.utility-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 230px; }
.utility-selects label { color: var(--muted); font-size: .72rem; font-weight: 700; }
.utility-selects select { margin-top: 4px; padding: 8px 28px 8px 9px; font-size: .85rem; }

.step-card { min-width: 0; margin: 24px 0 0; padding: 21px; border: 1px solid var(--line); border-radius: 18px; }
.step-card legend { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 0; font-weight: 820; letter-spacing: -.01em; }
.step-number { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 10px; color: var(--brand); background: var(--lime); font-size: .86rem; }
.step-help { margin: 0 0 17px; color: var(--muted); font-size: .88rem; }
.accent-card { border-color: rgba(35, 90, 79, .38); background: linear-gradient(180deg, rgba(243, 251, 200, .35), transparent 45%); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: block; min-width: 0; color: #41504c; font-size: .83rem; font-weight: 690; }
.field-wide { grid-column: 1 / -1; }
.field input { margin-top: 6px; padding: 11px 12px; font-size: 1rem; font-weight: 700; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: .73rem; font-weight: 450; }
.unit-label { color: var(--muted); font-weight: 500; }

.advanced-costs { margin-top: 14px; border-top: 1px dashed var(--line); }
.advanced-costs summary { padding: 14px 0 0; color: var(--brand-2); font-size: .85rem; font-weight: 750; }
.advanced-grid { margin-top: 14px; }
.inline-result { display: flex; justify-content: space-between; gap: 15px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--lime-soft); font-size: .88rem; }
.inline-result strong { color: var(--brand); white-space: nowrap; }
.muted-result { background: #f2f5f3; }

.slider-block { margin-top: 18px; }
.slider-heading { display: flex; justify-content: space-between; gap: 15px; align-items: center; color: #41504c; font-size: .84rem; font-weight: 700; }
.slider-heading output { color: var(--brand); font-size: 1.35rem; font-weight: 900; }
input[type="range"] { width: 100%; margin: 13px 0; accent-color: var(--brand-2); }
.preset-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.preset { min-height: 38px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; font-size: .72rem; font-weight: 700; }
.preset.active { color: var(--brand); border-color: var(--brand-2); background: var(--lime-soft); }

.results-panel .step-kicker { color: var(--lime); }
.result-topline h2 { color: #fff; }
.scenario-badge { flex: 0 0 auto; padding: 6px 9px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: rgba(255,255,255,.8); font-size: .72rem; }
.hero-result { margin-top: 26px; padding: 22px; border-radius: 18px; background: var(--lime); color: var(--brand); }
.hero-result.negative { background: #ffb9aa; }
.hero-result > span, .hero-result small { display: block; }
.hero-result > span { font-size: .86rem; font-weight: 750; }
.hero-result strong { display: block; margin: 5px 0; font-size: clamp(2.2rem, 6vw, 3.5rem); line-height: 1; letter-spacing: -.055em; }
.hero-result small { opacity: .75; }

.calculation-list { margin-top: 18px; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; overflow: hidden; }
.calculation-list > div { display: flex; justify-content: space-between; gap: 14px; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.1); font-size: .86rem; }
.calculation-list > div:last-child { border-bottom: 0; }
.calculation-list span { color: rgba(255,255,255,.68); }
.calculation-list strong { text-align: right; }
.minus-row strong { color: #ffb9aa; }

.ratio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ratio-card { padding: 14px; border-radius: 15px; background: rgba(255,255,255,.08); }
.ratio-card > span, .ratio-card small { display: block; color: rgba(255,255,255,.65); }
.ratio-card > span { font-size: .76rem; }
.ratio-card strong { display: block; margin: 4px 0 2px; color: var(--lime); font-size: 1.55rem; letter-spacing: -.04em; }
.ratio-card small { font-size: .68rem; line-height: 1.35; }

.comparison { margin-top: 20px; }
.comparison-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; font-size: .75rem; color: rgba(255,255,255,.7); }
.comparison-label strong { color: #fff; }
.second-label { margin-top: 10px; }
.bar-track { height: 8px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.1); }
.bar-fill { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .35s ease; }
.before-bar { background: var(--coral); }
.after-bar { background: var(--lime); }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; }
.action-grid .button { min-height: 42px; padding: 9px 10px; font-size: .8rem; }
.full-action { grid-column: 1 / -1; }
.results-panel .button-secondary { color: #fff; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.16); }
.results-panel .button-primary { margin-top: 8px; }
.privacy-note { margin: 11px 0 0; text-align: center; color: rgba(255,255,255,.48); font-size: .68rem; }

.explanation-section { margin-top: 22px; }
.explanation-card { display: grid; grid-template-columns: .75fr 1.25fr; gap: 30px; padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.explanation-card ol { display: grid; gap: 12px; margin: 0; padding-left: 22px; }
.explanation-card li { padding-left: 6px; }
.explanation-card li strong, .explanation-card li span { display: block; }
.explanation-card li span { margin-top: 3px; color: var(--muted); font-size: .87rem; }
.disclaimer { max-width: 930px; margin: 16px auto 0; color: var(--muted); text-align: center; font-size: .77rem; }

.content-guide { margin-top: 56px; }
.guide-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 8px 24px rgba(20, 34, 31, .05); }
.guide-nav strong { color: var(--ink); font-size: .84rem; }
.guide-nav a { color: var(--brand-2); font-size: .82rem; font-weight: 700; text-underline-offset: 3px; }
.content-section { max-width: 1000px; margin: 64px auto 0; scroll-margin-top: 90px; }
.content-section > p:not(.step-kicker):not(.example-note) { color: #42524d; font-size: 1rem; }
.content-section a { color: var(--brand-2); font-weight: 750; text-underline-offset: 3px; }
.intro-section { max-width: 900px; }
.intro-section h2 { font-size: clamp(1.75rem, 4vw, 2.45rem); }
.section-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-count, .example-label { display: inline-flex; flex: 0 0 auto; padding: 7px 11px; border-radius: 999px; color: var(--brand); background: var(--lime-soft); font-size: .72rem; font-weight: 800; }
.example-label { color: #755247; background: var(--danger-soft); }

.how-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0 0; padding: 0; counter-reset: guide-step; list-style: none; }
.how-list li { position: relative; min-height: 116px; padding: 18px 18px 18px 58px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); counter-increment: guide-step; }
.how-list li::before { content: counter(guide-step); position: absolute; top: 17px; left: 17px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--brand); background: var(--lime); font-size: .8rem; font-weight: 900; }
.how-list strong, .how-list span { display: block; }
.how-list strong { line-height: 1.3; }
.how-list span { margin-top: 6px; color: var(--muted); font-size: .83rem; }
.tip-box { margin-top: 14px; padding: 16px 18px; border-left: 4px solid var(--brand-2); border-radius: 10px; color: #344640; background: #eaf2ee; font-size: .88rem; }

.audience-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.audience-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.audience-card h3, .meaning-list h3, .doubt-grid h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.audience-card p, .meaning-list p, .doubt-grid p { margin: 8px 0 0; color: var(--muted); font-size: .84rem; }

.example-section { padding: clamp(22px, 4vw, 38px); border: 1px solid rgba(35, 90, 79, .28); border-radius: var(--radius); background: linear-gradient(145deg, #fff, #f7faee); }
.example-math { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.example-math > div { padding: 14px; border-radius: 13px; background: #fff; border: 1px solid var(--line); }
.example-math span, .example-math strong { display: block; }
.example-math span { color: var(--muted); font-size: .73rem; }
.example-math strong { margin-top: 4px; color: var(--brand); font-size: 1.15rem; }
.example-math .math-total { color: #fff; background: var(--brand); border-color: var(--brand); }
.example-math .math-total span { color: rgba(255,255,255,.7); }
.example-math .math-total strong { color: var(--lime); }
.example-result { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 20px; }
.example-result > div { padding: 15px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.example-result span:not(.operator), .example-result strong { display: block; }
.example-result div span { color: var(--muted); font-size: .73rem; }
.example-result strong { margin-top: 4px; font-size: 1.2rem; color: var(--brand); }
.example-result .operator { color: var(--muted); font-size: 1.35rem; font-weight: 900; }
.example-result .net-example { background: var(--lime-soft); border-color: #d2e875; }
.example-note { margin: 16px 0 0; color: var(--muted); font-size: .78rem; }

.meaning-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--line); }
.meaning-list > div { padding: 20px; background: var(--paper); }
.doubt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.doubt-grid > div { padding: 20px; border-radius: 16px; background: #eaf2ee; }

.faq-list { margin-top: 20px; border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { position: relative; padding: 19px 38px 19px 0; color: var(--ink); font-weight: 780; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; position: absolute; right: 8px; top: 15px; color: var(--brand-2); font-size: 1.45rem; font-weight: 500; }
.faq-list details[open] summary::after { content: '−'; }
.faq-list p { max-width: 850px; margin: -5px 0 18px; color: var(--muted); font-size: .9rem; }

.cross-service { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-top: 52px; padding: clamp(24px, 4vw, 42px); border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, #263733, #40524d); }
.cross-service > div { max-width: 680px; }
.cross-service .step-kicker { color: var(--lime); }
.cross-service p:last-child { margin: 12px 0 0; color: rgba(255,255,255,.7); }
.text-link { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 12px; color: var(--lime); font-weight: 800; text-underline-offset: 4px; }

.site-footer { margin-top: 52px; border-top: 1px solid var(--line); }
.footer-inner { min-height: 80px; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .82rem; }
.footer-inner a { color: var(--brand-2); font-weight: 800; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 50; transform: translate(-50%, 140%); max-width: calc(100% - 32px); padding: 10px 15px; border-radius: 12px; color: #fff; background: var(--ink); box-shadow: var(--shadow); opacity: 0; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 941px) {
  .results-sticky { position: sticky; top: 88px; }
}

@media (max-width: 940px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .results-panel { order: 2; }
  .cross-service { align-items: flex-start; flex-direction: column; }
  .audience-grid { grid-template-columns: 1fr 1fr; }
  .example-math { grid-template-columns: 1fr 1fr; }
  .example-result { grid-template-columns: 1fr; }
  .example-result .operator { text-align: center; line-height: .6; }
}

@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 1180px); }
  .site-header { position: static; }
  .header-inner { min-height: 60px; }
  .brand { font-size: 1.08rem; }
  .brand-mark { width: 30px; height: 30px; }
  .compact-control select { min-width: 98px; }
  .small-button { padding-inline: 10px; }
  .hero { padding: 44px 0 30px; }
  .hero h1 { font-size: clamp(2.05rem, 11vw, 3.25rem); }
  .trust-row { align-items: flex-start; flex-direction: column; width: max-content; max-width: 100%; margin-inline: auto; text-align: left; }
  .input-panel, .results-panel, .explanation-card, .cross-service { border-radius: 18px; }
  .panel-heading { flex-direction: column; }
  .utility-selects { width: 100%; min-width: 0; }
  .step-card { padding: 17px 14px; }
  .field-grid { grid-template-columns: 1fr; gap: 12px; }
  .field-wide { grid-column: auto; }
  .preset-row { grid-template-columns: 1fr; }
  .preset { text-align: left; padding-left: 12px; }
  .result-topline { align-items: center; }
  .ratio-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; }
  .full-action { grid-column: auto; }
  .explanation-card { grid-template-columns: 1fr; gap: 20px; }
  .content-guide { margin-top: 40px; }
  .guide-nav { align-items: flex-start; flex-direction: column; }
  .content-section { margin-top: 48px; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .how-list, .audience-grid, .meaning-list, .doubt-grid, .example-math { grid-template-columns: 1fr; }
  .how-list li { min-height: 0; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; padding: 20px 0; }
}

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

@media print {
  :root { --shadow: none; }
  body { background: #fff; }
  .site-header, .hero, .input-panel, .no-print, .cross-service, .site-footer, .toast { display: none !important; }
  .page-shell { width: 100%; }
  .calculator-grid { display: block; }
  .results-panel { color: #111; background: #fff; border: 1px solid #bbb; box-shadow: none; }
  .results-panel .step-kicker, .result-topline h2, .calculation-list span, .ratio-card > span, .ratio-card small, .comparison-label { color: #333; }
  .scenario-badge { color: #222; border-color: #bbb; }
  .hero-result { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .calculation-list, .ratio-card { border-color: #ccc; color: #111; background: #f7f7f7; }
  .calculation-list > div { border-color: #ddd; }
  .calculation-list strong, .comparison-label strong { color: #111; }
  .ratio-card strong { color: #183a34; }
  .explanation-section { margin-top: 18px; }
  .explanation-card { box-shadow: none; }
}
