:root {
  color-scheme: light;
  --ink: #18392f;
  --muted: #65746e;
  --cream: #f4efe6;
  --paper: #fffdf9;
  --line: #ddd8cf;
  --green: #0b6b53;
  --green-soft: #dceee7;
  --gold: #c7963f;
  --error: #b43b32;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(255,255,255,.75), transparent 28rem),
    linear-gradient(135deg, #f4efe6 0%, #e9e4da 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(320px, .86fr) minmax(520px, 1.14fr);
  gap: clamp(42px, 7vw, 100px);
  align-items: center;
  padding: 48px 0;
}

.intro { padding: 28px 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--ink);
  color: white;
  box-shadow: 0 10px 30px rgba(24,57,47,.18);
}

.brand-mark svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow, .step { margin: 28px 0 10px; color: var(--gold); font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.step { margin: 0 0 5px; }
h1 { max-width: 650px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.45rem, 5vw, 4.55rem); line-height: 1.01; letter-spacing: -.04em; }
.lede { max-width: 520px; margin: 24px 0 30px; color: var(--muted); font-size: 1.05rem; line-height: 1.75; }

.privacy-note { display: flex; align-items: center; gap: 12px; }
.privacy-note svg { width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--green-soft); fill: none; stroke: var(--green); stroke-width: 1.6; }
.privacy-note div { display: grid; gap: 2px; }
.privacy-note strong { font-size: .9rem; }
.privacy-note span { color: var(--muted); font-size: .78rem; }

.beta-note { display: flex; align-items: center; gap: 12px; max-width: 440px; margin-top: 25px; padding: 16px 18px; border: 1px solid rgba(199,150,63,.3); border-radius: 14px; background: rgba(255,253,249,.58); }
.beta-note p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.beta-badge { flex: 0 0 auto; padding: 6px 9px; border-radius: 7px; background: var(--gold); color: white; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.calculator-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(24,57,47,.08);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(35,45,39,.13);
}

.card-head { display: flex; justify-content: space-between; align-items: center; padding: 30px 34px 24px; }
h2, h3 { margin: 0; letter-spacing: -.025em; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.8rem; }
h3 { font-size: 1.06rem; }
.reset-button { border: 0; background: transparent; color: var(--green); cursor: pointer; font-size: .82rem; font-weight: 700; }
.reset-button:hover { text-decoration: underline; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0 34px 22px; }
.field { display: block; }
.field > span { display: block; margin-bottom: 8px; font-size: .8rem; font-weight: 700; }
.input-wrap { height: 52px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: white; transition: border .2s, box-shadow .2s; }
.input-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,107,83,.1); }
.input-wrap.invalid { border-color: var(--error); }
input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 0 14px; font-weight: 600; }
input::placeholder { color: #a4aaa7; font-weight: 400; }
.prefix { padding-left: 14px; color: var(--muted); }
.currency-input input { padding-left: 6px; }
.unit { flex: 0 0 auto; padding-right: 14px; color: var(--muted); font-size: .72rem; }
.field small { display: block; min-height: 16px; margin-top: 6px; color: var(--muted); font-size: .68rem; }
.field .error { color: var(--error); margin-top: 0; }
.divider { height: 1px; background: var(--line); }

.breakdown { padding: 24px 34px 12px; }
.breakdown-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 15px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
dl { margin: 0; }
dl > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 0; border-bottom: 1px dashed #e5e1da; }
dt { color: #364b44; font-size: .82rem; }
dt small { color: #8a9591; font-size: .66rem; }
dd { margin: 0; color: var(--ink); font-size: .87rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.closure-row { margin-top: 3px; background: #f4f0e7; border: 0; border-radius: 10px; padding: 10px 9px; }

.total { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 8px 20px 0; padding: 22px 18px 22px 20px; border-radius: 18px; background: var(--ink); color: white; }
.total div { display: grid; gap: 3px; }
.total span { font-size: .82rem; font-weight: 700; }
.total small { color: rgba(255,255,255,.62); font-size: .66rem; }
.total output { color: #f4cb7a; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.footnote { margin: 12px 34px 22px; color: #929a97; font-size: .64rem; text-align: center; }

.hidden-settings {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin: -15px 7px 7px auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  opacity: .12;
  transition: opacity .2s ease;
}
.hidden-settings:hover, .hidden-settings:focus-visible { opacity: .7; }
.hidden-settings svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

dialog {
  width: min(500px, calc(100% - 28px));
  padding: 30px;
  border: 1px solid rgba(24,57,47,.1);
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 32px 90px rgba(10,32,25,.3);
}
dialog::backdrop { background: rgba(16,35,29,.58); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; top: 15px; right: 16px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f0ede6; color: var(--ink); cursor: pointer; font-size: 1.25rem; line-height: 1; }
.dialog-copy { margin: 10px 0 22px; color: var(--muted); font-size: .84rem; line-height: 1.55; }
.dialog-field { margin-bottom: 15px; }
.dialog-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.primary-button { width: 100%; min-height: 48px; border: 0; border-radius: 12px; background: var(--green); color: white; cursor: pointer; font-weight: 700; }
.primary-button:hover { background: #085e49; }
.formula-preview { display: grid; gap: 5px; margin: 4px 0 18px; padding: 13px 14px; border-radius: 10px; background: #f1eee7; }
.formula-preview span { color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.formula-preview strong { font-size: .76rem; line-height: 1.45; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 18px; padding: 40px 0 60px; }
  .intro { padding: 0 12px; }
  h1 { max-width: 720px; font-size: clamp(2.5rem, 9vw, 4.3rem); }
  .lede { margin-bottom: 22px; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 22px; }
  .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
  .eyebrow { margin-top: 20px; }
  h1 { font-size: 2.55rem; }
  .lede { font-size: .95rem; }
  .calculator-card { border-radius: 22px; }
  .card-head, .breakdown { padding-left: 20px; padding-right: 20px; }
  .fields { grid-template-columns: 1fr; padding-left: 20px; padding-right: 20px; gap: 10px; }
  dt small { display: block; margin-top: 2px; }
  .total { align-items: flex-start; flex-direction: column; }
  .total output { font-size: 2rem; }
  dialog { padding: 26px 20px 22px; }
  .dialog-fields { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .calculator-card { animation: rise .55s ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } }
}
