/* Savings calculator wizard */
.calc { background: var(--paper); min-height: calc(100vh - 72px); padding: clamp(28px, 5vw, 64px) 0 clamp(56px, 8vw, 96px); }
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: clamp(28px, 5vw, 64px); align-items: start; }
@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-grid .preview { display: none; }
}

.wizard { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: clamp(24px, 4vw, 48px); }

/* Progress */
.progress { display: flex; align-items: center; gap: 16px; margin-bottom: clamp(24px, 4vw, 36px); }
.progress p { font-size: var(--step--1); color: var(--ink-3); white-space: nowrap; font-weight: 500; }
.progress .bar { flex: 1; height: 6px; background: var(--paper); border-radius: 3px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 20%; background: var(--kept); border-radius: 3px; transition: width .35s ease; }
.back { border: 0; background: none; padding: 6px 0; color: var(--ink-2); font: 500 var(--step--1) var(--font-body); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.back:hover { color: var(--ink); }
.back[hidden] { display: none; }

/* Steps */
.step { border: 0; margin: 0; padding: 0; min-width: 0; }
.step[hidden] { display: none; }
.step legend { padding: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.75rem, 3.4vw, 2.375rem); line-height: 1.12; letter-spacing: -0.02em; max-width: 22ch; }
.step .hint { margin-top: 12px; color: var(--ink-2); font-size: var(--step-0); max-width: 52ch; }
.step-body { margin-top: clamp(24px, 4vw, 32px); display: grid; gap: 20px; }
.step-actions { margin-top: clamp(28px, 4vw, 36px); display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.step-actions .fine { font-size: var(--step--1); color: var(--ink-3); max-width: 46ch; }
@media (prefers-reduced-motion: no-preference) {
  .step.entering { animation: stepIn .3s ease both; }
  @keyframes stepIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
}

/* Fields */
.field { display: grid; gap: 8px; }
.field label, .field .label { font-weight: 600; font-size: 0.975rem; }
.field .sub { font-weight: 400; color: var(--ink-3); }
.input {
  width: 100%; min-height: 56px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--white);
  font: 500 1.125rem var(--font-body); color: var(--ink);
  transition: border-color .15s ease;
}
.input:hover { border-color: #BCC6D3; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47,111,237,.18); }
.input[aria-invalid="true"] { border-color: var(--fee); }
.money { position: relative; }
.money .input { padding-left: 34px; }
.money::before { content: "$"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 500; font-size: 1.125rem; pointer-events: none; }
.error { color: var(--fee); font-size: var(--step--1); font-weight: 500; }
.error:empty { display: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }

.consent { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; font-size: var(--step--1); color: var(--ink-2); line-height: 1.5; padding: 14px; background: var(--paper); border-radius: 12px; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--kept); }
.consent a { color: var(--ink); }

/* Choice tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tile span {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 14px 18px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--white);
  font-weight: 600; font-size: 1.0625rem; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.tile span small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--step--1); }
.tile input:hover + span { border-color: #A9B5C5; }
.tile input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile input:checked + span { border-color: var(--kept); background: var(--kept-soft); }

/* Range + quick picks */
.range { width: 100%; accent-color: var(--kept); height: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--white); font: 500 0.9375rem var(--font-body); color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--kept); background: var(--kept-soft); color: var(--kept-deep); }

/* Live preview receipt beside the wizard */
.preview { position: sticky; top: 100px; }
.preview .receipt { margin-left: 26px; margin-right: 26px; }
.preview .r-row span:last-child { color: var(--ink); }
.preview .r-row .pending { color: var(--line); }
.preview-note { margin-top: 18px; padding: 0 26px; font-size: var(--step--1); color: var(--ink-3); text-align: center; }

/* Working state */
.working { text-align: center; padding: clamp(48px, 8vw, 96px) 0; }
.working[hidden] { display: none; }
.working .spinner { width: 44px; height: 44px; margin: 0 auto 20px; border-radius: 50%; border: 4px solid var(--kept-soft); border-top-color: var(--kept); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.working p { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); }

/* Results */
.results:focus { outline: none; }
.results-head { max-width: 760px; }
.results-head h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
.results-head h1 .amount { color: var(--kept); }
.results-head p { margin-top: 14px; font-size: var(--step-1); color: var(--ink-2); line-height: 1.5; }
.results-progress { max-width: 420px; margin-bottom: 28px; }
.sent { margin-top: 20px; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; font-size: 0.975rem; color: var(--ink-2); }
.sent svg { flex: none; margin-top: 2px; }
.sent.failed { border-color: var(--fee); }

/* The big savings message */
.savings-pair { margin-top: clamp(28px, 4vw, 40px); display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; }
.saving { border-radius: 20px; padding: clamp(22px, 3.5vw, 32px); background: var(--white); border: 1px solid var(--line); }
.saving p { font-weight: 600; color: var(--ink-2); }
.saving strong { display: block; margin-top: 6px; font-family: var(--font-display); font-weight: 700; font-size: clamp(2.5rem, 6vw, 4rem); line-height: 1; letter-spacing: -0.03em; color: var(--kept); }
.saving-big { background: var(--kept); border-color: var(--kept); }
.saving-big p { color: #CDEFE0; }
.saving-big strong { color: var(--white); font-size: clamp(2.75rem, 7vw, 4.75rem); }
@media (max-width: 640px) { .savings-pair { grid-template-columns: 1fr; } }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: clamp(22px, 3.5vw, 36px); }
.panel h2 { font-size: var(--step-2); }
.panel > p { margin-top: 8px; color: var(--ink-2); }
.compare { margin-top: 16px; }

/* Comparison table */
.table-wrap { margin-top: 24px; overflow-x: auto; }
.cost-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 460px; }
.cost-table th, .cost-table td { text-align: left; padding: 16px 14px; border-bottom: 1px solid var(--line); }
.cost-table thead th { font-size: var(--step--1); font-weight: 600; color: var(--ink-3); padding-top: 0; }
.cost-table tbody th { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); letter-spacing: -0.01em; }
.cost-table td { color: var(--ink-2); }
.cost-table td.theirs { color: var(--fee); font-weight: 600; font-size: 1.125rem; }
.cost-table .ours-col { background: var(--kept-soft); text-align: center; }
.cost-table thead .ours-col { color: var(--kept-deep); border-radius: 12px 12px 0 0; padding-top: 12px; }
.cost-table td.ours-col { border-bottom: 0; border-radius: 0 0 12px 12px; vertical-align: middle; }
.cost-table td.ours-col strong { display: block; font-family: var(--font-display); font-size: clamp(1.75rem, 3.5vw, 2.25rem); color: var(--kept-deep); line-height: 1.1; }
.cost-table td.ours-col span { font-size: var(--step--1); color: var(--kept-deep); }
.legend-note { margin-top: 18px; font-size: var(--step--1); color: var(--ink-3); }

/* Step 2 controls */
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2716%27 height=%2716%27 viewBox=%270 0 16 16%27%3E%3Cpath d=%27M4 6l4 4 4-4%27 fill=%27none%27 stroke=%27%230D2340%27 stroke-width=%272%27 stroke-linecap=%27round%27/%3E%3C/svg%3E") no-repeat right 16px center; }
.tiles-3 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 1100px) { .tiles-3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 420px) { .tiles-3 { grid-template-columns: 1fr; } }
.tiles-3 .tile span { min-height: 56px; font-size: 1rem; }

.next { margin-top: 20px; }
.next h2 { font-size: var(--step-2); }
.next .actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 12px; }
.next .linkish { border: 0; background: none; color: var(--ink-2); font: 500 0.975rem var(--font-body); text-decoration: underline; cursor: pointer; padding: 8px 4px; }

.assumptions { margin-top: 32px; font-size: var(--step--1); color: var(--ink-3); max-width: 80ch; }

@media print {
  .site-header, .site-footer, .next .actions, .wizard, .preview, .skip { display: none !important; }
  .calc { background: #fff; padding: 0; }
  .panel, .sent { border-color: #ccc; break-inside: avoid; }
  .receipt { filter: none; -webkit-mask: none; mask: none; border: 1px dashed #ccc; }
  .terminal-head { display: none; }
}
.results.wrap { max-width: 1000px; }

/* On phones, our cost moves from the side column to a row under the table. */
.cost-table .ours-row { display: none; }
@media (max-width: 600px) {
  .cost-table { min-width: 0; }
  .cost-table .ours-col { display: none; }
  .cost-table .ours-row { display: table-footer-group; }
  .cost-table .ours-row th, .cost-table .ours-row td { background: var(--kept-soft); color: var(--kept-deep); border-bottom: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
  .cost-table .ours-row th { border-radius: 12px 0 0 12px; }
  .cost-table .ours-row td { border-radius: 0 12px 12px 0; }
  .cost-table th, .cost-table td { padding: 14px 8px; }
  .cost-table tbody th { font-size: 1.0625rem; }
  .cost-table td.theirs { font-size: 1rem; }
}
