:root {
  color: #111827;
  background: #edf1f5;
  font: 18px/1.5 system-ui, sans-serif;
  --accent: #174f7c;
  --border: #9ba9b8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.card {
  width: min(100% - 32px, 770px);
  margin: 28px auto;
  background: white;
  border: 1px solid #d8e0e9;
  border-radius: 16px;
  padding: clamp(16px, 4vw, 32px);
}
h1, h2 { font-size: 28px; line-height: 1.2; margin: 0 0 16px; }
h1:focus { outline: none; }
p { margin: 0 0 16px; }
.progress {
  position: sticky;
  top: 0;
  z-index: 1;
  background: white;
  padding: 12px 0;
  border-bottom: 1px solid #d8e0e9;
  margin-bottom: 22px;
}
.progress p { font-weight: 750; margin: 0 0 10px; }
.progress ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.progress li { border-top: 4px solid #c5d0da; color: #475467; padding-top: 5px; font-size: 0.9rem; }
.progress li[aria-current] { border-color: var(--accent); color: var(--accent); font-weight: 750; }
fieldset { border: 0; margin: 0 0 18px; padding: 0; }
legend { margin-bottom: 8px; font-weight: 650; padding: 0; }
.choices { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.choices label { position: relative; margin: 0; }
.choices input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choices span {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
}
.choices input:checked + span { color: white; background: var(--accent); border-color: var(--accent); }
.choices input:focus-visible + span { outline: 3px solid #ad5c00; outline-offset: 2px; }
label { display: block; margin-bottom: 12px; }
input:not([type=checkbox], [type=radio], [type=range]) {
  display: block;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 20px;
  background: white;
  color: inherit;
}
#first {
  appearance: textfield;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  padding-inline: 44px;
}
.amount-input { position: relative; display: block; }
.amount-currency {
  position: absolute;
  inset-inline-end: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  pointer-events: none;
}
#first::-webkit-inner-spin-button,
#first::-webkit-outer-spin-button { appearance: none; margin: 0; }
input[type=range] { width: 100%; height: 44px; margin: 0 0 10px; accent-color: var(--accent); }
input[type=checkbox] { width: 24px; height: 24px; margin: 0; flex: 0 0 24px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
button, .primary {
  color: var(--accent);
  font: inherit;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 44px;
  padding: 8px 14px;
  cursor: pointer;
}
.primary {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  background: #15803D;
  color: white;
  border-color: #15803D;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  align-content: center;
}
button:disabled { opacity: 0.65; cursor: wait; }
.quiet { border: 0; text-decoration: underline; padding-inline: 6px; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #ad5c00; outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
td, th { padding: 8px; border-bottom: 1px solid #d8e0e9; text-align: left; }
th { background: #f1f5f9; }
#error { color: #a01e12; margin-top: 14px; }
dialog { max-width: min(520px, 100% - 32px); padding: 24px; border: 1px solid var(--border); border-radius: 12px; }
dialog::backdrop { background: #111827a8; }
.admin { width: min(100% - 32px, 1400px); }
.admin nav { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.admin nav [aria-current] { font-weight: 750; }
.admin td { overflow-wrap: anywhere; }
.admin button { margin-bottom: 4px; }
.table-scroll { overflow-x: auto; }
@media (max-width: 600px) {
  .card { margin: 0 auto; width: 100%; border-radius: 0; border: 0; min-height: 100vh; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .progress li { font-size: 0.74rem; overflow-wrap: anywhere; line-height: 1.2; }
}

.primary:hover:not(:disabled) { background: #166534; border-color: #166534; }
.primary:disabled { cursor: not-allowed; }
.choices small { font-size: 0.85rem; white-space: nowrap; }
.savings {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: #FACC15;
  color: #111827;
  font-weight: 700;
}
#contract-pdf {
  display: block;
  width: 100%;
  min-height: 680px;
  height: 75vh;
  border: 1px solid var(--border);
  border-radius: 8px;
}
#download, #open-pdf { display: inline-flex; align-items: center; margin-top: 8px; }
.terms { align-items: flex-start; font-size: 18px; cursor: pointer; margin-top: 14px; }
.terms input { margin-top: 2px; }
@media (max-width: 600px) {
  .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

#phone-hint, #email-hint { display: block; margin-top: 4px; font-size: 0.85rem; }
.upgrade-banner { padding: 12px; border-radius: 8px; background: #effaf2; color: #14532d; }
.upgrade-error { color: #991b1b; }
.upgrade-link { margin-top: 12px; overflow-wrap: anywhere; }
.contract-loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  min-height: 260px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #d8e0e9;
  border-top-color: #15803D;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}
