:root {
  --ink: #102a2b;
  --muted: #607071;
  --cream: #f5f3ec;
  --paper: #fffef9;
  --line: #d9ddd6;
  --teal: #0c756c;
  --teal-dark: #07534d;
  --lime: #dce97b;
  --amber: #f3c76a;
  --error: #a13a35;
  --shadow: 0 22px 60px rgba(22, 48, 48, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: inherit; }

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(16, 42, 43, 0.12);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 48% 52%;
  color: white;
  background: var(--teal);
  font-family: Georgia, serif;
  font-size: 21px;
}
.brand-ai { color: var(--teal); }
.environment-badge {
  border: 1px solid #c8a34c;
  border-radius: 999px;
  background: #fff6dc;
  color: #694a0c;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
nav { display: flex; gap: 28px; }
nav a { text-decoration: none; color: var(--muted); font-size: 14px; }
nav a:hover { color: var(--ink); }

main { width: min(1180px, 92vw); margin: 0 auto; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .5fr);
  gap: 56px;
  align-items: end;
  padding: 86px 0 64px;
}
.eyebrow {
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: .15em;
  font-weight: 800;
  font-size: 12px;
  margin: 0 0 14px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(46px, 7vw, 78px);
  line-height: .98;
  letter-spacing: -.045em;
  margin-bottom: 26px;
  font-weight: 500;
}
.hero-copy {
  max-width: 680px;
  font-size: 19px;
  color: var(--muted);
}
.hero-note {
  border-left: 2px solid var(--teal);
  padding: 6px 0 6px 22px;
  color: var(--muted);
  font-size: 14px;
}
.hero-note p { margin: 0; }
.hero-note strong { color: var(--ink); }

.calculator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 18px;
  overflow: hidden;
}
.input-panel { padding: 42px; }
.results-panel {
  min-height: 720px;
  padding: 42px;
  background: var(--ink);
  color: white;
}
.panel-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.panel-heading h2, .methodology h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.025em;
}
.panel-heading h2 { margin-bottom: 3px; font-size: 30px; }
.panel-heading p { color: var(--muted); font-size: 14px; }
.step {
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  padding: 0 12px;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 117, 108, .12);
}
.currency-input, .suffix-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}
.currency-input:focus-within, .suffix-input:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 117, 108, .12);
}
.currency-input > span, .suffix-input > span {
  color: var(--muted);
  padding-left: 12px;
  font-weight: 500;
}
.suffix-input > span { padding: 0 12px 0 0; font-size: 12px; }
.currency-input input, .suffix-input input {
  border: 0;
  box-shadow: none;
}

.safeguards {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 34px 0 16px;
  padding: 30px 0 0;
}
.safeguards legend {
  display: flex;
  gap: 16px;
  width: 100%;
  padding: 0;
  margin-bottom: 20px;
}
.safeguards legend strong { display: block; font-size: 18px; }
.safeguards legend small { display: block; color: var(--muted); font-weight: 400; }
.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  position: relative;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.toggle-row > span:first-child { padding-right: 70px; }
.toggle-row small { display: block; color: var(--muted); font-weight: 400; margin-top: 3px; }
.toggle-row em {
  color: #75500b;
  background: #f8e5ae;
  padding: 3px 6px;
  border-radius: 999px;
  font-style: normal;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.toggle-row input {
  position: absolute;
  opacity: 0;
}
.toggle {
  position: absolute;
  right: 0;
  width: 46px;
  height: 26px;
  background: #cfd6d1;
  border-radius: 999px;
  transition: .2s ease;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: .2s ease;
}
.toggle-row input:checked + .toggle { background: var(--teal); }
.toggle-row input:checked + .toggle::after { transform: translateX(20px); }
.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  font-weight: 500;
  color: var(--muted);
  margin: 22px 0;
}
.check-row input { min-height: auto; width: 17px; height: 17px; accent-color: var(--teal); }
.primary-button {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: var(--teal);
  color: white;
  padding: 15px 18px;
  display: flex;
  justify-content: space-between;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.primary-button:hover { background: var(--teal-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.form-status { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.form-status.error { color: var(--error); }

.empty-state {
  min-height: 620px;
  display: grid;
  place-content: center;
  text-align: center;
  color: #b8c6c5;
}
.empty-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid #4a6060;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
}
.empty-ring span { font-family: Georgia, serif; font-size: 36px; color: var(--lime); }
.empty-state h2 { color: white; font-family: Georgia, serif; font-weight: 500; }
.empty-state p { max-width: 320px; }

.result-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.result-heading h2 { font-family: Georgia, serif; font-size: 34px; font-weight: 500; margin-bottom: 4px; }
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #5b7472;
  border-radius: 999px;
  padding: 5px 9px;
  color: #d8e3e1;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.badge.experimental { color: #ffe3a4; border-color: #8f713a; }
.status-pill {
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(220, 233, 123, .12);
  color: var(--lime);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.status-pill.infeasible { color: #ffc6a7; background: rgba(255, 154, 99, .12); }
.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.metric {
  border: 1px solid #3c5151;
  border-radius: 10px;
  padding: 15px;
}
.metric span { color: #a6b7b5; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.metric strong { display: block; margin-top: 5px; font-size: 23px; font-weight: 650; }
.allocation-list { display: grid; gap: 12px; }
.allocation-row {
  display: grid;
  grid-template-columns: 140px 1fr 44px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.bar {
  height: 8px;
  background: #324747;
  border-radius: 999px;
  overflow: hidden;
}
.bar i { display: block; height: 100%; background: var(--lime); border-radius: inherit; }
.result-note {
  margin-top: 28px;
  padding: 14px;
  border-left: 2px solid var(--amber);
  background: rgba(243, 199, 106, .08);
  color: #d7dedc;
  font-size: 12px;
}
.result-note p { margin: 10px 0 0; }
.failure-heading { color: white; }
.safeguard-failures {
  margin: 6px 0 10px;
  padding-left: 18px;
}
.safeguard-failures li { margin: 3px 0; }

.methodology { padding: 100px 0 80px; }
.methodology > h2 { font-size: clamp(36px, 5vw, 56px); max-width: 680px; }
.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px;
  margin: 48px 0;
}
.method-grid article { border-top: 1px solid var(--ink); padding-top: 18px; }
.method-grid article > span { color: var(--teal); font: 12px ui-monospace, monospace; }
.method-grid h3 { margin: 30px 0 8px; }
.method-grid p { color: var(--muted); font-size: 14px; }
.disclosure {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 10px;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 5vw;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 60px; }
  .calculator-shell { grid-template-columns: 1fr; }
  .results-panel { min-height: 560px; }
  .empty-state { min-height: 460px; }
}
@media (max-width: 620px) {
  nav { display: none; }
  .environment-badge { font-size: 8px; padding: 4px 7px; }
  main { width: min(94vw, 1180px); }
  .hero { padding: 48px 4px 42px; }
  .input-panel, .results-panel { padding: 26px 20px; }
  .form-grid, .method-grid { grid-template-columns: 1fr; }
  .methodology { padding: 72px 4px 56px; }
  .allocation-row { grid-template-columns: 115px 1fr 40px; }
}
