:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --surface-strong: #e9f0ec;
  --ink: #102018;
  --muted: #526158;
  --line: #d6ded9;
  --control-line: #718078;
  --brand: #0b5a37;
  --brand-strong: #063d27;
  --brand-soft: #e5f2ea;
  --action-bg: #063d27;
  --action-ink: #ffffff;
  --footer-bg: #063d27;
  --footer-ink: #ffffff;
  --footer-muted: #cfe4d8;
  --gold: #f2b84b;
  --gold-strong: #b87800;
  --good: #08783d;
  --warn: #9a5b00;
  --bad: #b42318;
  --shadow: 0 18px 50px rgba(16, 32, 24, .10);
  --radius: 12px;
  --max: 1180px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1511;
  --surface: #121f19;
  --surface-soft: #172720;
  --surface-strong: #20342a;
  --ink: #f4f8f5;
  --muted: #b7c5bd;
  --line: #32473c;
  --control-line: #74887c;
  --brand: #78ad91;
  --brand-strong: #8fb9a3;
  --brand-soft: #193128;
  --action-bg: #23543f;
  --action-ink: #ffffff;
  --footer-bg: #10261d;
  --footer-ink: #f4f8f5;
  --footer-muted: #b7c5bd;
  --gold: #f4c45f;
  --gold-strong: #ffd77f;
  --good: #69d394;
  --warn: #f6c669;
  --bad: #ff8a80;
  --shadow: 0 24px 60px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  transition: background-color .18s ease, color .18s ease;
}
body.menu-open { overflow: hidden; }
a { color: inherit; text-underline-offset: .18em; }
img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 500;
  top: 10px;
  left: 10px;
  transform: translateY(-150%);
  padding: 10px 14px;
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: 8px;
}
.skip-link:focus { transform: none; }
.container { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.header-inner { min-height: 72px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 850; letter-spacing: -.02em; white-space: nowrap; }
.brand img { width: 44px; height: 44px; border-radius: 9px; box-shadow: 0 6px 18px rgba(6, 61, 39, .18); }
.desktop-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-link, .nav-button, .header-cta, .theme-toggle, .menu-button, .drawer-close {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  padding: 9px 13px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-weight: 720;
  cursor: pointer;
}
.nav-link:hover, .nav-button:hover, .theme-toggle:hover { background: var(--surface-soft); }
.nav-link.active, .desktop-disclosure.active > .nav-button { color: var(--brand-strong); }
.header-cta { margin-left: 8px; background: var(--action-bg); color: var(--action-ink); padding-inline: 18px; }
.theme-toggle { border: 1px solid var(--control-line); margin-left: 8px; min-width: 82px; }
.theme-icon { width: 17px; height: 17px; }
.desktop-disclosure { position: relative; }
.chevron { width: 16px; height: 16px; transition: transform .16s ease; }
.desktop-disclosure.open .chevron, [aria-expanded="true"] > .chevron { transform: rotate(180deg); }
.desktop-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(760px, calc(100vw - 40px));
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.desktop-disclosure:not(.open) .desktop-panel { display: none; }
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.menu-column h3 { margin: 0 0 9px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.menu-column a { display: block; padding: 7px 0; color: var(--ink); text-decoration: none; line-height: 1.35; }
.menu-column a:hover { color: var(--brand-strong); text-decoration: underline; }
.menu-footer-link { display: inline-flex; margin-top: 18px; color: var(--brand-strong); font-weight: 800; }
.mobile-controls, .mobile-drawer { display: none; }

.main { padding-block: 32px 72px; }
.breadcrumbs { margin-bottom: 18px; color: var(--muted); font-size: .9rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--muted); }
.breadcrumbs a { color: var(--brand-strong); font-weight: 700; }
h1, h2, h3 { margin-top: 0; line-height: 1.12; letter-spacing: -.035em; }
h1 { font-size: clamp(2.35rem, 5vw, 4.7rem); }
h2 { font-size: clamp(1.65rem, 2.5vw, 2.4rem); }
h3 { font-size: 1.1rem; }
p { margin-block: 0 1em; }
.muted { color: var(--muted); }

.home-hero { display: grid; grid-template-columns: minmax(0, .96fr) minmax(420px, 1.04fr); gap: clamp(44px, 7vw, 90px); align-items: center; min-height: 570px; padding-block: 54px 70px; }
.home-hero h1 { max-width: 720px; margin-bottom: 24px; }
.hero-copy { max-width: 640px; color: var(--muted); font-size: clamp(1.05rem, 1.5vw, 1.25rem); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn, button.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--action-bg);
  border-radius: 9px;
  padding: 11px 18px;
  background: var(--action-bg);
  color: var(--action-ink);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}
.btn.secondary { border-color: var(--brand-strong); background: transparent; color: var(--brand-strong); }
.btn.quiet { min-height: 40px; border: 0; background: transparent; color: var(--muted); padding-inline: 4px; text-decoration: underline; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.result-preview, .result-panel, .form-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.result-preview { overflow: hidden; box-shadow: var(--shadow); }
.preview-top, .privacy-note { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 700; }
.preview-main { padding: 42px 36px 34px; text-align: center; }
.preview-main strong { display: block; margin-block: 8px 20px; color: var(--brand-strong); font-size: clamp(3.4rem, 7vw, 5.8rem); line-height: 1; letter-spacing: -.06em; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); padding-top: 24px; }
.preview-grid div + div { border-left: 1px solid var(--line); }
.preview-grid span, .preview-grid b { display: block; }
.privacy-note { border: 0; border-top: 1px solid var(--line); font-size: .9rem; }
.privacy-note svg { color: var(--good); width: 20px; }

.decision-band { border-block: 1px solid var(--line); padding-block: 54px; }
.decision-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.decision-link { min-height: 150px; padding: 28px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; text-decoration: none; }
.decision-link + .decision-link { border-left: 1px solid var(--line); }
.decision-link:hover { background: var(--surface-soft); }
.decision-link strong { font-size: 1.12rem; }
.decision-link span { color: var(--muted); }

.section { padding-block: 58px; }
.section-heading { max-width: 760px; margin-bottom: 28px; }
.tool-list { border-top: 1px solid var(--line); }
.tool-row { min-height: 116px; display: grid; grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.4fr) auto; gap: 28px; align-items: center; border-bottom: 1px solid var(--line); }
.tool-row h3 { margin: 0; }
.tool-row h3 a { text-decoration: none; }
.tool-row p { margin: 0; color: var(--muted); }
.text-link { color: var(--brand-strong); font-weight: 800; white-space: nowrap; }
.tool-filter { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 24px 0 32px; }
.search-field { width: min(100%, 560px); }
.search-field input { width: 100%; min-height: 50px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); }

.page-intro { max-width: 900px; margin-bottom: 34px; }
.page-intro h1 { font-size: clamp(2.4rem, 4vw, 4rem); margin-bottom: 14px; }
.page-intro p { max-width: 760px; color: var(--muted); font-size: 1.08rem; }
.calculator-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(350px, .8fr); gap: 22px; align-items: start; }
.form-panel { padding: 26px; }
.field-group { margin: 0; padding: 0; border: 0; }
.field-group + .field-group { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.field-group legend { width: 100%; margin-bottom: 16px; color: var(--brand-strong); font-size: 1.18rem; font-weight: 850; letter-spacing: -.02em; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field label { display: block; margin-bottom: 7px; color: var(--ink); font-size: .92rem; font-weight: 780; }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.field textarea { resize: vertical; line-height: 1.55; }
.field-note { margin: 6px 0 0; color: var(--muted); font-size: .79rem; line-height: 1.4; }
.form-footer { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.status { margin: 0; color: var(--muted); font-size: .88rem; }
.result-panel { position: sticky; top: 94px; padding: 26px; box-shadow: var(--shadow); }
.result-panel h2 { font-size: 1.15rem; margin-bottom: 14px; }
.primary-result { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.primary-result .label { font-weight: 800; }
.primary-result .value { display: block; margin-top: 8px; color: var(--brand-strong); font-size: clamp(2.8rem, 5vw, 4.4rem); line-height: 1; letter-spacing: -.055em; font-weight: 900; }
.result-list { display: grid; gap: 0; margin-block: 14px; }
.result { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding-block: 11px; border-bottom: 1px solid var(--line); }
.result .label { color: var(--muted); font-size: .9rem; }
.result .value { font-weight: 850; text-align: right; }
.verdict { margin-top: 18px; padding: 12px 14px; border-left: 4px solid; background: var(--surface-soft); font-weight: 850; }
.verdict.good { color: var(--good); border-color: var(--good); }
.verdict.warn { color: var(--warn); border-color: var(--warn); }
.verdict.bad { color: var(--bad); border-color: var(--bad); }
.error-list { color: var(--bad); margin: 12px 0; padding-left: 22px; }
.result-explain { color: var(--muted); font-size: .9rem; }
.result-actions { display: grid; gap: 9px; margin-top: 20px; }
.result-actions .btn { width: 100%; }
.more-actions { position: relative; }
.more-actions-menu { display: grid; position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); }
.more-actions-menu button { min-height: 44px; border: 0; border-radius: 7px; background: transparent; text-align: left; padding: 9px 12px; cursor: pointer; }
.more-actions-menu button:hover { background: var(--surface-soft); }
.saved-scenarios { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.saved-scenarios h3 { margin-bottom: 12px; }
.saved-row { display: flex; gap: 8px; margin-top: 8px; }
.saved-scenario, .icon-button { min-height: 40px; border: 1px solid var(--control-line); border-radius: 7px; background: var(--surface-soft); color: var(--ink); cursor: pointer; }
.saved-scenario { flex: 1; padding: 8px 10px; text-align: left; }
.icon-button { padding-inline: 10px; }
.icon-button.danger { color: var(--bad); }
.mobile-result-bar { display: none; }

.method-strip { margin-top: 22px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.method-strip h2 { font-size: 1.25rem; }
.formula { margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--brand-strong); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .6fr); gap: 56px; }
.article { max-width: 820px; }
.article section { padding-block: 26px; border-bottom: 1px solid var(--line); }
.article h2 { font-size: 1.65rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 0 0 28px; padding: 15px 0; border-block: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.side-rail { position: sticky; top: 96px; align-self: start; padding: 22px; background: var(--surface-soft); border-radius: var(--radius); }
.side-rail a { display: block; padding-block: 7px; color: var(--brand-strong); font-weight: 700; }
.notice { margin-block: 34px; padding: 20px 22px; background: var(--surface-soft); border-left: 5px solid var(--gold); border-radius: 0 9px 9px 0; }
.notice strong { display: block; margin-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--line); padding-block: 14px; }
.faq summary { cursor: pointer; font-weight: 800; }
.footer { padding-block: 40px; background: var(--footer-bg); color: var(--footer-ink); }
.footer-grid { display: grid; grid-template-columns: 1.3fr repeat(3, .7fr); gap: 40px; }
.footer .brand { color: var(--footer-ink); }
.footer h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--footer-muted); }
.footer a { display: block; width: fit-content; padding-block: 4px; color: var(--footer-ink); }
.footer small { display: block; margin-top: 18px; color: var(--footer-muted); }

@media (max-width: 980px) {
  .desktop-nav { display: none; }
  .mobile-controls { margin-left: auto; display: flex; gap: 8px; }
  .theme-toggle { margin-left: 0; min-width: 44px; padding-inline: 10px; }
  .theme-toggle [data-theme-label] { display: none; }
  .menu-button { border: 1px solid var(--gold); color: var(--ink); }
  .mobile-drawer { display: block; position: fixed; z-index: 200; inset: 0; overflow-y: auto; background: var(--surface); }
  .drawer-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
  .drawer-close { border: 1px solid var(--gold); }
  .drawer-body { width: min(100% - 32px, 680px); margin: 22px auto; }
  .drawer-section, .drawer-link { border-bottom: 1px solid var(--line); }
  .drawer-disclosure, .drawer-link { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border: 0; background: transparent; color: var(--ink); text-decoration: none; font-weight: 850; text-align: left; cursor: pointer; }
  .drawer-submenu { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .drawer-submenu a { min-height: 52px; display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
  .drawer-submenu a:last-child { border-bottom: 0; }
  .home-hero { grid-template-columns: 1fr; min-height: auto; }
  .result-preview { max-width: 720px; }
  .decision-list { grid-template-columns: 1fr; }
  .decision-link + .decision-link { border-left: 0; border-top: 1px solid var(--line); }
  .calculator-layout { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .content-grid { grid-template-columns: 1fr; }
  .side-rail { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .container { width: min(100% - 24px, var(--max)); }
  .header-inner { min-height: 62px; }
  .brand { gap: 8px; font-size: .88rem; }
  .brand img { width: 38px; height: 38px; border-radius: 8px; }
  .menu-button { min-height: 42px; padding-inline: 11px; }
  .main { padding-top: 22px; }
  .home-hero { padding-block: 30px 44px; gap: 36px; }
  h1 { font-size: clamp(2.25rem, 12vw, 3.4rem); }
  .hero-copy { font-size: 1rem; }
  .actions .btn { width: 100%; }
  .preview-main { padding: 30px 18px; }
  .preview-main strong { font-size: 3.5rem; }
  .decision-band, .section { padding-block: 40px; }
  .tool-row { grid-template-columns: 1fr; gap: 10px; padding-block: 22px; }
  .tool-filter { align-items: stretch; flex-direction: column; }
  .page-intro h1 { font-size: 2.45rem; }
  .form-panel, .result-panel { padding: 20px; }
  .fields { grid-template-columns: 1fr; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .result-panel { scroll-margin-top: 78px; }
  .mobile-result-bar { position: sticky; z-index: 80; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--action-bg); color: var(--action-ink); box-shadow: 0 -12px 34px rgba(0,0,0,.18); }
  .mobile-result-bar.has-error { background: #7f1d1d; }
  .mobile-result-bar span, .mobile-result-bar strong { display: block; }
  .mobile-result-bar span { color: #dcebe2; font-size: .72rem; }
  .mobile-result-bar strong { font-size: 1.25rem; }
  .mobile-result-bar .btn { min-height: 42px; width: auto; background: var(--gold); border-color: var(--gold); color: #161107; padding-inline: 14px; }
  .article section { padding-block: 22px; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .footer, .breadcrumbs, .page-intro, .form-panel, .result-actions, .saved-scenarios, .mobile-result-bar, .method-strip, .article, .side-rail { display: none !important; }
  body { background: #fff; color: #111; }
  .main { padding: 0; }
  .calculator-layout { display: block; }
  .result-panel { position: static; box-shadow: none; border: 0; }
}

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