:root {
  --bg: #ffffff;
  --panel: #fbfaf7;
  --ink: #26231f;
  --muted: #756f68;
  --line: #dfd9cf;
  --accent: #305c8a;
  --accent-soft: #eaf2f8;
  --danger: #9d3b3b;
  --radius: 6px;
  --shadow: 0 12px 30px rgba(38, 35, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-size: 14px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

.site-shell,
.model-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.site-header,
.model-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: 0;
}

.lede {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
}

.model-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.model-card {
  display: grid;
  gap: 6px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
}

.model-card:hover {
  border-color: #b9c9d8;
  background: #f7fbff;
}

.model-card span,
.model-card small {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.controls,
.results,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.controls {
  padding: 14px;
}

.chart-panel {
  padding: 12px;
}

.control-group {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.control-group:first-child {
  padding-top: 0;
}

.control-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.formula {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.control-row label {
  color: var(--ink);
}

.control-row output {
  min-width: 56px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  min-height: 34px;
  color: var(--ink);
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.metric {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.chart {
  width: 100%;
  min-height: 440px;
}

.note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .model-list,
  .workspace {
    grid-template-columns: 1fr;
  }

  .site-shell,
  .model-shell {
    width: min(100vw - 20px, 720px);
    padding: 18px 0;
  }

  .chart {
    min-height: 360px;
  }
}
