.calculator-form-card {
  width: 100%;
  color: #2d150d;
}

.calculator-form-card .back-button,
.back-button {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  margin: 0 0 14px;
  border: 1px solid #c99b38;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff0bd;
  color: #660000;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.back-button:hover {
  background: #f6d877;
}

.card-header {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.card-header h1,
.card-header h2,
.card-header h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.card-header .calculator-open-note,
.calculator-open-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 10px 18px 0;
  color: #700b06;
  font-weight: 700;
}

.card-header .calculator-open-note {
  margin-left: 0;
  margin-right: 0;
}

.calculator-open-note strong {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #700b06;
  color: #fff8dc;
  font-size: 0.82rem;
  line-height: 1;
}

.clinical-info {
  font-size: 0.8rem;
  line-height: 1.45;
}

.clinical-info h5 {
  font-size: 0.82rem;
  line-height: 1.35;
}

.clinical-info p,
.clinical-info li {
  line-height: 1.45;
}

.clinical-info .meld-disclaimer {
  font-size: 0.84rem;
  line-height: 1.45;
}

.clinical-info .meld-disclaimer strong {
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px;
}

.form-grid.single-column {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 6px;
}

.field-input-control,
.field-input-unit {
  width: 100%;
}

.field-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.field-input-unit input {
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.field-input-unit select {
  width: auto;
  min-width: 96px;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: #fff0bd;
  color: #660000;
  font-weight: 700;
}

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

.field label {
  color: #5a2e14;
  font-size: 0.82rem;
  font-weight: 700;
}

.field label em {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f3d071;
  color: #660000;
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fffdf4;
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}

.field .field-input-unit select {
  border-color: #d7a73d;
  background: #f3d071;
  color: #660000;
  font-weight: 800;
}

.field input.invalid-live {
  border-color: var(--danger, #9f1d12);
}

.field-error {
  margin: 0;
  color: var(--danger, #9f1d12);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.score-field {
  gap: 10px;
  padding: 2px 0;
}

.score-label {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.score-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.score-segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.score-segmented label {
  display: block;
  min-width: 0;
}

.score-segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}

.score-segmented span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf4;
  color: #263247;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.score-segmented em {
  color: var(--ink);
  font-style: normal;
  font-weight: 800;
}

.score-segmented input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff8dc;
  box-shadow: 0 8px 18px rgba(102, 0, 0, 0.18);
}

.score-segmented input:checked + span em {
  color: var(--ink);
}

.actions {
  display: flex;
  gap: 10px;
  padding: 0 18px 16px;
}

.actions button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.calculate {
  background: var(--accent);
  color: #fff8dc;
}

.calculate:hover {
  background: var(--burgundy-dark);
}

.reset {
  border: 1px solid var(--line);
  background: #f3d071;
  color: #660000;
}

.result {
  min-height: 72px;
  margin: 0 18px 18px;
  padding: 14px;
  border-radius: 6px;
  background: #fff0bd;
  color: #660000;
  line-height: 1.45;
}

.result strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1.18rem;
}

.result > span {
  display: block;
}

.result-recommendations {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(102, 0, 0, 0.18);
}

.result-recommendations p {
  margin: 0;
}

.result-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(102, 0, 0, 0.18);
}

.result-section h4 {
  margin: 0 0 6px;
  color: #5a2e14;
  font-size: 0.9rem;
}

.result-section ul {
  margin: 0;
  padding-left: 20px;
}

.result-section li + li {
  margin-top: 4px;
}

.result-section p {
  margin: 0;
}

.result-section p + p {
  margin-top: 4px;
}

.risk-badge {
  display: inline-block;
  vertical-align: baseline;
  border: 1px solid var(--burgundy-dark);
  border-radius: 6px;
  padding: 2px 9px;
  background: var(--accent);
  color: #fff8dc;
  font-weight: 800;
  line-height: 1.25;
}

.safety-alert {
  color: var(--danger, #9f1d12);
  font-weight: 900;
}

.result.error {
  background: #ffe3dc;
  color: var(--danger, #9f1d12);
}

.result.warning {
  border: 1px solid #660000;
  background: #fff1b8;
  color: #660000;
}

.calculator-info {
  display: grid;
  margin-top: 18px;
  border-radius: 8px;
  background: #fff7d7;
  padding: 22px 24px;
  color: #660000;
}

.calculator-info-heading {
  margin-bottom: 18px;
}

.calculator-info-kicker {
  margin: 0 0 6px;
  color: #8b1209;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.calculator-info-heading h3 {
  margin: 0;
  color: #660000;
  font-size: 1.22rem;
  line-height: 1.25;
}

.calculator-info-section {
  padding: 16px 0;
  border-top: 1px solid rgba(102, 0, 0, 0.16);
}

.calculator-info-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.calculator-info-section:last-child {
  padding-bottom: 0;
}

.calculator-info-section h4 {
  margin: 0 0 8px;
  color: #660000;
  font-size: 0.98rem;
  line-height: 1.25;
}

.calculator-info-section p,
.calculator-info-section li {
  color: #660000;
  font-size: 0.96rem;
  line-height: 1.6;
}

.calculator-info-section p {
  margin: 0;
}

.calculator-info-section p + p {
  margin-top: 8px;
}

.calculator-info-section ul {
  margin: 0;
  padding-left: 20px;
}

.calculator-info-section li + li {
  margin-top: 6px;
}

@media (max-width: 920px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .score-segmented {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }
}
