:root {
  --primary: #064e3b;
  --primary-light: #0a6b50;
  --accent: #10b981;
  --accent-soft: #d1fae5;
  --bg: #f0fdf4;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #d1fae5;
  --white: #ffffff;
  --radius: 14px;
  --shadow-lg: 0 12px 40px rgba(6, 78, 59, 0.12);
  --sel: #0a6b50;
  --base: #94a3b8;
  --grid: #e7f5ee;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--border); background: var(--surface); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.top-note { color: var(--muted); font-size: 14px; }
h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.2; margin: 28px 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.lead { color: var(--muted); max-width: 760px; margin: 0 0 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 0 0 20px; }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.controls .more { grid-column: 1 / -1; }
.ctrl-label { display: block; font-weight: 600; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font: inherit; font-size: 15px; cursor: pointer;
}
.seg button[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg button:hover { border-color: var(--accent); }
.seg button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
input[type="range"] { width: 100%; accent-color: var(--sel); }
output { font-weight: 700; color: var(--primary-light); }
.more summary { cursor: pointer; font-weight: 600; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; margin-top: 14px; }
.reset { margin-top: 14px; border: 1px solid var(--border); background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; }
.summary-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.summary-head select { font: inherit; font-size: 20px; font-weight: 700; border: 1px solid var(--border); border-radius: 8px; padding: 2px 6px; background: var(--surface); color: var(--text); }
.legend { color: var(--muted); font-size: 14px; margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; }
.sw-sel { background: var(--sel); }
.sw-base { background: repeating-linear-gradient(90deg, var(--base) 0 5px, transparent 5px 8px); margin-left: 10px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card .k { color: var(--muted); font-size: 14px; }
.card .v { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.card .d { color: var(--muted); font-size: 13px; margin-top: 4px; }
.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px 8px; position: relative; }
.chart h3 { font-size: 15px; margin: 0 0 2px; }
.chart .sub { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 13px; padding: 6px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); display: none; }
.axis text { fill: var(--muted); font-size: 11px; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.line-sel { fill: none; stroke: var(--sel); stroke-width: 2.5; }
.line-base { fill: none; stroke: var(--base); stroke-width: 2; stroke-dasharray: 5 4; }
.cursor { stroke: var(--muted); stroke-width: 1; }
.dot-sel { fill: var(--sel); stroke: var(--surface); stroke-width: 2; }
.dot-base { fill: var(--base); stroke: var(--surface); stroke-width: 2; }
.table-wrap { overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; white-space: normal; min-width: 220px; }
.tbl thead th { color: var(--muted); font-weight: 600; }
.tbl tr.grp td { font-weight: 700; padding-top: 14px; }
.method ul { padding-left: 20px; margin: 0 0 8px; }
.method li { margin-bottom: 6px; }
.foot { border-top: 1px solid var(--border); padding: 18px 0 28px; color: var(--muted); font-size: 14px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 16px; }
.foot a { color: var(--muted); }
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .controls, .more-grid { grid-template-columns: 1fr; }
  .top-note { display: none; }
  .card .v { font-size: 24px; }
}

.top { background: var(--primary); border-bottom: 0; }
.top .brand, .top .top-note { color: #fff; }
.download { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; padding: 10px 16px; border-radius: 10px; }
.download:hover { background: #059669; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 20px; }
.intro-actions .hint { margin: 0; }
.summary-head h2 output { color: var(--primary); font-size: inherit; }
.year { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 10px 0 0; font-variant-numeric: tabular-nums; }
.year input[type="range"] { flex: 1; }
