.calculator-shell {
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--ink);
}

.form-section {
  padding: 27px 28px;
  border-bottom: 1px solid #dce1e8;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 20px;
}

.section-heading > span {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.section-heading h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.form-grid {
  display: grid;
  gap: 18px 19px;
}

.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.full-row {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
}

.field > label,
.segment-field legend {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  margin-bottom: 8px;
  color: #303641;
  font-size: 15px;
  font-weight: 780;
}

.field input,
.field select {
  width: 100%;
  height: 47px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--warm);
}

.input-with-unit {
  position: relative;
}

.input-with-unit input {
  padding-right: 54px;
}

.input-with-unit > span {
  position: absolute;
  top: 50%;
  right: 13px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.help-button {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #dbe7ff;
  color: #0754d7;
  font-size: 13px;
  font-weight: 900;
}

.field-note,
.field-error {
  min-height: 18px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.field-error {
  color: #bd2a1c;
}

.checkbox-field {
  display: flex;
  align-items: flex-end;
  padding-bottom: 9px;
}

.checkbox-field label {
  min-height: 47px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid var(--line);
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.segment-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segment-field legend {
  padding: 0;
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.segments label {
  min-width: 0;
}

.segments input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segments span {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  color: #454c57;
  font-size: 14px;
  text-align: center;
}

.segments input:checked + span {
  border-color: var(--ink);
  background: var(--primary);
  color: white;
  font-weight: 850;
  box-shadow: 3px 3px 0 var(--ink);
}

.live-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--ink);
  border-top: 1px solid var(--ink);
}

.summary-metric {
  min-width: 0;
  padding: 20px;
  background: #f8f9fb;
}

.summary-metric.primary {
  background: var(--accent);
}

.summary-metric span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.summary-metric strong {
  display: block;
  margin-top: 7px;
  font-size: 28px;
  white-space: nowrap;
}

#view-report-button {
  grid-column: 1 / -1;
  min-height: 54px;
  border: 0;
  background: var(--primary);
  color: white;
  font-size: 17px;
  font-weight: 900;
}

#view-report-button:disabled {
  cursor: not-allowed;
  background: #aeb5c0;
}

@media (max-width: 760px) {
  .form-section {
    padding: 23px 19px;
  }

  .cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .form-section {
    padding: 21px 13px;
  }

  .cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 11px;
  }

  .field > label,
  .segment-field legend {
    font-size: 14px;
  }

  .compact-grid .field input,
  .compact-grid .field select {
    font-size: 14px;
  }

  .segments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-metric.primary {
    grid-column: 1 / -1;
    order: -1;
  }
}
