:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #4a4a4a;
  --line: #d9d2c4;
  --accent: #0b5f3a;
  --accent-soft: #e6f3ec;
  --warn: #7a3b00;
  --warn-bg: #fff4e5;
  --radius: 14px;
  --max: 1100px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 20px;
  line-height: 1.55;
}
a { color: var(--accent); }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.1rem; }
.site-header {
  background: #0f2f22;
  color: #fff;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .01em;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .9rem;
  font-size: .95rem;
}
.nav a { color: #d9f0e4; text-decoration: none; }
.nav a:hover { color: #fff; text-decoration: underline; }
.hero {
  padding: 1.6rem 0 1rem;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  line-height: 1.2;
  margin: 0 0 .6rem;
}
.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 52rem;
  margin: 0 0 1.1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin: 1rem 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.card h2, .prose h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  margin: 0 0 .7rem;
  line-height: 1.25;
}
.prose h3 {
  font-size: 1.2rem;
  margin: 1.4rem 0 .45rem;
}
.prose p, .prose li { color: var(--ink); }
.prose ul { padding-left: 1.2rem; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem;
}
@media (max-width: 760px) {
  .tool-grid { grid-template-columns: 1fr; }
  body { font-size: 18px; }
}
label {
  display: block;
  font-weight: 700;
  margin-bottom: .35rem;
  font-size: 1rem;
}
select, button {
  font: inherit;
  width: 100%;
  padding: .7rem .8rem;
  border-radius: 10px;
  border: 1px solid #b9b1a1;
  background: #fff;
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
.result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
  margin-top: 1rem;
}
@media (max-width: 640px) {
  .result { grid-template-columns: 1fr; }
}
.result-box {
  background: var(--accent-soft);
  border: 1px solid #b7dcc8;
  border-radius: 12px;
  padding: 1rem;
}
.result-box .k {
  font-size: .95rem;
  color: var(--muted);
  font-weight: 600;
}
.result-box .v {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-top: .2rem;
}
.assumptions-line {
  margin-top: .85rem;
  font-size: .98rem;
  color: var(--muted);
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--line);
}
table.span-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 1rem;
  background: #fff;
}
table.span-table th, table.span-table td {
  border: 1px solid var(--line);
  padding: .55rem .6rem;
  text-align: left;
  vertical-align: top;
}
table.span-table th {
  background: #edf7f1;
  font-weight: 700;
}
table.span-table tr:nth-child(even) td { background: #fafafa; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 .8rem;
}
.filters button {
  width: auto;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: .45rem .75rem;
  font-size: .95rem;
}
.filters button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.breadcrumb {
  font-size: .95rem;
  color: var(--muted);
  margin: 1rem 0 .4rem;
}
.breadcrumb a { color: var(--muted); }
.related {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .85rem;
  margin: .4rem 0 0;
}
.related a {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .8rem;
  text-decoration: none;
  font-size: .95rem;
}
.related a:hover { border-color: var(--accent); }
.disclaimer, .site-footer {
  background: #231f1a;
  color: #efe8dc;
  margin-top: 2rem;
}
.disclaimer .wrap, .site-footer .wrap {
  padding-top: 1.2rem;
  padding-bottom: 1.2rem;
}
.disclaimer h2 { color: #fff; font-size: 1.2rem; margin: 0 0 .5rem; }
.disclaimer p, .site-footer p, .site-footer li {
  color: #d9d0c2;
  font-size: .98rem;
}
.site-footer a { color: #9fe0bf; }
.site-footer ul {
  columns: 2;
  gap: 1.5rem;
  padding-left: 1.1rem;
}
@media (max-width: 640px) {
  .site-footer ul { columns: 1; }
}
.note {
  background: var(--warn-bg);
  border: 1px solid #f0d2a4;
  color: var(--warn);
  border-radius: 10px;
  padding: .75rem .9rem;
  margin: .8rem 0;
  font-size: .98rem;
}
.faq details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: .7rem .9rem;
  margin: .55rem 0;
}
.faq summary {
  font-weight: 700;
  cursor: pointer;
}
.toc-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .45rem .75rem;
  margin: .6rem 0 0;
}
.toc-links a {
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
  font-size: .98rem;
}
.toc-links a:hover { border-color: var(--accent); }
