:root {
  --bg: #f5f4ef;
  --card: #ffffff;
  --ink: #1b1f1c;
  --muted: #6b716c;
  --line: #e3e1d9;
  --contrib: #2d4b6d;
  --growth: #3e9a68;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "Geist", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding: 20px;
}
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.site-footer nav {
  display: flex;
  gap: 16px;
}
.site-footer a {
  color: inherit;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.feature-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover,
.feature-card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(27, 31, 28, 0.1);
}
.feature-card h3 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.feature-card a {
  margin-top: auto;
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--contrib) 10%, white);
  color: var(--contrib);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.feature-card a:hover,
.feature-card a:focus-visible {
  background: var(--contrib);
  color: #fff;
}
@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
header h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}
header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 760px) {
  .grid {
    grid-template-columns: 320px 1fr;
  }
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.field:first-child {
  padding-top: 0;
}
.field:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.field-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.num {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: #fbfbf9;
}
.num:focus-within {
  border-color: var(--contrib);
  outline: 2px solid color-mix(in srgb, var(--contrib) 20%, transparent);
}
.num input {
  width: 92px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  padding: 6px 4px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.num input:focus {
  outline: none;
}
.num span {
  font-size: 13px;
  color: var(--muted);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--contrib);
}
select {
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fbfbf9;
  color: var(--ink);
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 560px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.stat .k {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .v {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat.total {
  grid-column: 1 / -1;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
@media (min-width: 560px) {
  .stat.total {
    grid-column: auto;
  }
}
.stat.total .k {
  color: #b9c0ba;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}
.right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.chart-head h2 {
  font-size: 15px;
  margin: 0;
}
.seg {
  display: inline-flex;
  background: #efeee8;
  border-radius: 8px;
  padding: 3px;
}
.seg button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}
.seg button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.chart-box {
  position: relative;
  height: 300px;
}
.bar {
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  background: var(--line);
  margin-top: 10px;
}
.bar div {
  height: 100%;
  transition: width 0.3s;
}
.bar-legend {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.table-wrap {
  max-height: 280px;
  overflow: auto;
  margin-top: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 8px 6px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}
th:first-child,
td:first-child {
  text-align: left;
}
th {
  position: sticky;
  top: 0;
  background: var(--card);
  color: var(--muted);
  font-weight: 500;
}

html {
  -webkit-text-size-adjust: 100%;
}
.grid > *,
.right > * {
  min-width: 0;
}
.stat .v {
  overflow-wrap: anywhere;
}
.seg button {
  min-height: 32px;
}
.sm-only {
  display: none;
}
@media (max-width: 559px) {
  .sm-only {
    display: inline;
  }
}

@media (max-width: 559px) {
  body {
    padding: 12px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .wrap {
    gap: 12px;
  }
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  header h1 {
    font-size: 21px;
  }
  header p {
    font-size: 13px;
  }
  .grid,
  .right {
    gap: 12px;
  }
  .card {
    padding: 14px;
    border-radius: 12px;
  }
  .stats {
    gap: 8px;
  }
  .stat {
    padding: 12px;
    border-radius: 12px;
  }
  .stat .v {
    font-size: clamp(16px, 5vw, 20px);
  }
  .stat.total .v {
    font-size: 26px;
  }
  .num input {
    width: 84px;
    font-size: 16px;
  }
  select {
    font-size: 16px;
  }
  input[type="range"] {
    height: 28px;
  }
  .chart-head h2 {
    font-size: 14px;
  }
  .chart-box {
    height: 240px;
  }
  .bar-legend {
    font-size: 11px;
  }
  .table-wrap {
    max-height: 360px;
  }
  table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }
  tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
  }
  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    text-align: right;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    text-align: left;
  }
  td:first-child {
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
    margin-bottom: 2px;
  }
  td:first-child::before {
    content: none;
  }
}
@media (max-width: 340px) {
  .stats {
    grid-template-columns: 1fr;
  }
}
