:root {
  color-scheme: light;
  --paper: #f5f2e9;
  --sheet: #fffcf5;
  --ink: #202f28;
  --muted: #4a6055;
  --rule: #c4cfc0;
  --accent: #175a46;
  --accent-dark: #0f4434;
  --wash: #e8efe5;
  --display: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --body: system-ui, sans-serif;
  --ledger: ui-monospace, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  background: var(--paper);
  font: 1rem/1.5 var(--body);
}

a { color: var(--accent-dark); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .15em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.shell { width: min(calc(100% - 3rem), 86rem); margin-inline: auto; }

.masthead {
  padding-block: 1.3rem 1.65rem;
  border-top: 6px solid var(--accent);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.4rem;
  background: linear-gradient(100deg, var(--wash), transparent 75%);
}

.masthead > a {
  display: inline-block;
  margin-left: 1.2rem;
  font-size: .84rem;
  font-weight: 650;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(14rem, .85fr);
  align-items: end;
  gap: 1.25rem;
  padding-inline: 1.2rem;
}

h1 {
  margin: .55rem 0 0;
  font: 500 clamp(2.55rem, 6.3vw, 5.5rem)/.94 var(--display);
  letter-spacing: -.055em;
}

.intro p {
  max-width: 32ch;
  margin: .8rem 0 .15rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.55vw, 1.2rem);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(17rem, 1fr) minmax(0, 1.95fr);
  align-items: start;
  gap: 1.2rem;
}

form, .results {
  min-width: 0;
  padding: clamp(.9rem, 2.2vw, 1.45rem);
  border: 1px solid var(--rule);
  background: var(--sheet);
}

h2 { margin: 0 0 .9rem; font: 650 1.65rem/1.12 var(--display); }

label {
  display: block;
  min-width: 0;
  margin-block: .65rem;
  font-size: .86rem;
  font-weight: 650;
  line-height: 1.35;
}

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .85rem; }

input, select, textarea, button { font: inherit; }

input:not([type=checkbox]), select, textarea {
  width: 100%;
  min-height: 2.6rem;
  margin-top: .32rem;
  padding: .46rem .55rem;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: .2rem;
  background: var(--sheet);
  font-size: 1rem;
  font-weight: 400;
}

textarea { resize: vertical; font: .9rem/1.48 var(--ledger); }

input[type=checkbox] { accent-color: var(--accent); }
.checkbox { display: flex; gap: .4rem; align-items: baseline; }

.hint {
  margin: .35rem 0 .85rem;
  color: var(--muted);
  font-size: .85rem;
}

details { border-top: 1px solid var(--rule); }
details:last-of-type { border-bottom: 1px solid var(--rule); }
details .fields { margin-bottom: .55rem; }
summary { padding-block: .68rem; cursor: pointer; font-size: .92rem; font-weight: 680; }

button {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: .7rem .85rem;
  border: 0;
  border-radius: .2rem;
  color: white;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--accent-dark); }
.error { color: #9c241a; margin: .65rem 0 0; }
.error:empty { margin: 0; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 1.15rem;
  border-top: 2px solid var(--accent);
  background: var(--wash);
}

.metrics > div { min-width: 0; padding: .6rem .75rem .72rem; }
.metrics > div + div { border-left: 1px solid var(--rule); }
.metrics dt { font-size: .8rem; font-weight: 650; color: var(--muted); }
.metrics dd {
  margin: .25rem 0 0;
  font: 650 clamp(1.02rem, 2vw, 1.67rem)/1.16 var(--display);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.table-scroll { max-width: 100%; overflow: auto; }
.schedule { max-height: 22rem; }
table { width: 100%; border-collapse: collapse; font: .82rem/1.45 var(--ledger); }
caption { padding: 0 0 .55rem; color: var(--muted); text-align: left; font: .87rem/1.4 var(--body); }

th, td {
  padding: .55rem .58rem;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  white-space: nowrap;
}

th:first-child { text-align: left; }
thead th { background: var(--wash); }
.schedule thead th { position: sticky; top: 0; }
tbody tr:nth-child(even) { background: var(--paper); }
tbody th { max-width: 17ch; overflow-wrap: anywhere; white-space: normal; }

.breakdown { margin-top: 1.25rem; padding-top: 1.05rem; border-top: 2px solid var(--accent); }
.picker { width: min(100%, 18rem); }

.related {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.3rem;
  padding-block: .75rem 1.5rem;
  font-size: .88rem;
}

.related p { margin-block: .35rem; }

@media (max-width: 56rem) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 39rem) {
  .shell { width: calc(100% - 1.5rem); }
  .intro { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
  .metrics > div { padding-inline: .4rem; }
}
