:root {
  --bg: #f3f0e8;
  --paper: #fffcf7;
  --ink: #1c1915;
  --muted: #5e584f;
  --line: #e3dcd0;
  --accent: #1f4d3a;
  --accent-soft: #e5f0ea;
  --warn: #8c3a2f;
  --warn-soft: #f8ebe6;
  --chip: #efeae1;
  --ours: #1f4d3a;
  --other: #8d8478;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--line);
}
.kicker {
  margin: 0 0 6px;
  letter-spacing: 0.04em;
  font-size: 12px;
  color: var(--muted);
}
h1 { margin: 0; font-size: 28px; font-weight: 650; letter-spacing: -0.03em; }
.lede { margin: 0; max-width: 420px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 0;
  align-items: start;
}

#editor { padding: 18px 22px 48px; min-width: 0; }
#results {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow: auto;
  padding: 18px 22px 32px;
  border-left: 1px solid var(--line);
  background: #ebe6dc;
}

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tabs button, .rowbtns button, .preset button {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}
.tabs button.on,
.preset button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.preset button.on .en { color: rgba(255, 255, 255, 0.82); }
.rowbtns, .preset { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }

.note {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 12px;
}
.warnbox {
  background: var(--warn-soft);
  color: var(--warn);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0;
}

h2 { font-size: 18px; margin: 18px 0 8px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }

.panel { display: none; }
.panel.on { display: block; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.en {
  margin-left: 0.35em;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.86em;
}
.grid3 {
  display: grid;
  grid-template-columns: 176px repeat(3, 1fr);
  gap: 6px 8px;
  align-items: center;
  margin-bottom: 8px;
}
.grid3 .h { font-size: 12px; color: var(--muted); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input[type="number"], select {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus { outline: 2px solid #c9ddd3; border-color: var(--accent); }
.checks { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--ink); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
th, td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
.plans { display: flex; flex-direction: column; gap: 8px; }
.plan {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.plan.main { border-color: var(--accent); background: var(--accent-soft); }
.plan.innov { border-color: #5a4d8c; background: #f0edf8; }
.plan.innov.highlight { border-width: 2px; box-shadow: 0 0 0 1px rgba(90, 77, 140, 0.15); }
.plan h3 { margin: 0 0 6px; color: var(--ink); font-size: 15px; font-weight: 650; }
.plan .aim { margin: 0 0 10px; font-size: 14px; line-height: 1.6; }
.plan .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 8px; }
.plan .nums div { font-size: 12px; color: var(--muted); line-height: 1.4; }
.plan .nums strong { display: block; color: var(--ink); font-size: 15px; margin-top: 2px; font-weight: 650; }
.plan p { margin: 0 0 4px; font-size: 13px; line-height: 1.6; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

.kpi { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.kpi b {
  display: block;
  margin-top: 2px;
  font-size: 32px;
  letter-spacing: -0.04em;
  font-weight: 650;
  color: var(--accent);
}
.kpi b.neg { color: var(--warn); }
.subkpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 10px 0 14px;
}
.subkpis div { font-size: 12px; color: var(--muted); }
.subkpis strong { display: block; color: var(--ink); font-size: 16px; margin-top: 2px; }

.barline { display: grid; grid-template-columns: 92px 1fr 72px; gap: 8px; align-items: center; margin: 5px 0; font-size: 13px; }
.track { height: 8px; background: #ddd6cb; border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--other); }
.track span.ours { background: var(--ours); }
.barline em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.card.best { border-color: var(--accent); background: var(--accent-soft); }
.card .name { font-size: 13px; margin: 0 0 4px; }
.card .num { font-size: 20px; margin: 0; letter-spacing: -0.03em; }
.card .meta { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.sheet {
  width: 100%;
  font-size: 13px;
}
.sheet td:last-child { font-variant-numeric: tabular-nums; }

.prose p { font-size: 14px; line-height: 1.6; margin: 0 0 10px; }
.prose h2 { margin-top: 20px; }

.teampick { margin-bottom: 10px; }

@media (max-width: 980px) {
  .top { flex-direction: column; align-items: flex-start; padding: 20px 16px 12px; }
  .layout { grid-template-columns: 1fr; }
  #results { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  #editor { padding: 14px 14px 28px; }
  .grid2, .cards, .subkpis { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 132px repeat(3, 1fr); }
}
