.homa-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7df;
  box-shadow: var(--shadow);
}

.homa-card .back-button {
  margin: 0;
  border-top: 0;
  border-left: 0;
  border-radius: 0 0 6px 0;
}

.homa-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px 22px;
  background: #660000;
  color: #fff8dc;
}

.homa-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f4c542;
  color: #660000;
  font-weight: 800;
}

.homa-hero h1,
.homa-hero h3 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.homa-hero p {
  margin: 0;
  color: #ffe7a3;
  font-size: 0.92rem;
}

.homa-body {
  padding: 20px;
}

.homa-info-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #d0a54b;
  border-radius: 6px;
  background: #fff0bd;
}

.homa-info-row span {
  display: block;
  margin-bottom: 8px;
  color: #660000;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.homa-info-row p {
  margin: 0;
  color: #660000;
  line-height: 1.45;
}

.homa-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
}

.homa-input-grid .field {
  padding: 0;
}

.homa-input-grid .field.full {
  grid-column: auto;
}

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

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

.segmented label {
  min-width: 0;
}

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

.segmented span,
.homa-input-grid .score-segmented span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid #d0a54b;
  border-radius: 6px;
  background: #fff6d8;
  color: #5a2e14;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  box-shadow: none;
}

.segmented input:checked + span,
.homa-input-grid .score-segmented input:checked + span {
  border-color: #660000;
  background: #660000;
  color: #fff8dc;
}

.homa-actions {
  padding: 18px 18px 16px;
}

.homa-actions .calculate {
  flex: 1;
}

.homa-form .result {
  margin: 0 18px 18px;
}

.homa-details {
  display: grid;
  gap: 0;
  padding-top: 20px;
  border-top: 1px solid #d6ad53;
}

.homa-details section {
  padding: 14px;
  border: 1px solid #d0a54b;
  border-radius: 6px;
  background: #fff7df;
}

.homa-details section + section {
  margin-top: 10px;
}

.homa-details h5 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.homa-details p,
.homa-details ul {
  margin: 0;
  color: #660000;
  line-height: 1.55;
}

.homa-details ul {
  padding-left: 18px;
}

.homa-details li + li {
  margin-top: 6px;
}

.homa-details .clinical-limit {
  border-color: #d6ad53;
  background: #fff0bd;
}

.bmi-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff9e8;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.bmi-card .back-button {
  margin: 0;
  border-top: 0;
  border-left: 0;
  border-radius: 0 0 6px 0;
}

.bmi-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 16px;
  align-items: start;
  padding: 22px;
  border-bottom: 1px solid #e0c175;
}

.bmi-header h1,
.bmi-header h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.bmi-header p {
  margin: 0;
  color: #6c4a29;
}

.bmi-instructions {
  margin: 18px 22px 0;
  padding: 16px;
  border: 1px solid #d0a54b;
  border-radius: 8px;
  background: #fff0bd;
}

.bmi-instructions h4 {
  margin: 0 0 10px;
  color: #660000;
}

.bmi-info-row,
.bsa-info-row,
.calculator-info-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.bmi-instructions p {
  margin: 0;
  color: #660000;
  line-height: 1.55;
}

.bsa-equation {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 0;
  color: #660000;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  overflow-x: auto;
}

.spise-equation,
.fai-equation {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 0;
  color: #660000;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1;
  overflow-x: auto;
}

.spise-equation sup,
.fai-equation sup {
  font-size: 0.58em;
}

.spise-fraction,
.fai-fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  min-width: max-content;
  margin-left: 10px;
  text-align: center;
}

.spise-fraction span:first-child,
.fai-fraction span:first-child {
  padding: 0 10px 5px;
  border-bottom: 1px solid currentColor;
}

.spise-fraction span:last-child,
.fai-fraction span:last-child {
  padding-top: 5px;
}

.calculator-info-row {
  margin: 18px 18px 0;
  padding: 14px;
  border: 1px solid #d0a54b;
  border-radius: 6px;
  background: #fff0bd;
}

.calculator-info-row span {
  display: block;
  margin-bottom: 8px;
  color: #660000;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.calculator-info-row p {
  margin: 0;
  color: #660000;
  line-height: 1.45;
}

.calculator-info-row p + p {
  margin-top: 6px;
}

.lt4-details,
.spise-details,
.steroid-details,
.calcium-details {
  display: grid;
  gap: 0;
  margin: 18px 18px 18px;
  padding-top: 4px;
  border-top: 1px solid #d6ad53;
}

.lt4-details section,
.spise-details section,
.steroid-details section,
.calcium-details section {
  padding: 14px 0;
  border-top: 1px solid #d6ad53;
}

.lt4-details section:first-child,
.spise-details section:first-child,
.steroid-details section:first-child,
.calcium-details section:first-child {
  border-top: 0;
}

.lt4-details h5,
.spise-details h5,
.steroid-details h5,
.calcium-details h5 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.lt4-details ul,
.spise-details ul,
.steroid-details ul,
.calcium-details ul,
.spise-details p,
.steroid-details p {
  margin: 0;
  color: #660000;
  line-height: 1.55;
}

.lt4-details ul,
.spise-details ul,
.steroid-details ul,
.calcium-details ul {
  padding-left: 18px;
}

.lt4-details li + li,
.spise-details li + li,
.steroid-details li + li,
.calcium-details li + li {
  margin-top: 6px;
}

.bsa-left {
  white-space: nowrap;
}

.bsa-equation sup {
  font-size: 0.58em;
}

.radical {
  margin: 0 3px 0 8px;
  font-size: 1.9em;
  line-height: 0.8;
  font-weight: 400;
}

.fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  min-width: max-content;
  padding-left: 4px;
  border-top: 1px solid currentColor;
  font-style: normal;
  text-align: center;
}

.fraction span:first-child {
  padding: 0 5px 4px;
  border-bottom: 1px solid currentColor;
}

.fraction span:last-child {
  padding-top: 4px;
}

.bmi-form {
  padding-top: 16px;
}

.bmi-field-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(260px, 1.1fr);
  gap: 18px;
  align-items: center;
  margin: 0 22px;
  padding: 16px 0;
  border-bottom: 1px solid #e6cf91;
}

.bmi-field-row label {
  display: block;
  color: #660000;
  font-weight: 700;
}

.bmi-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  border: 1px solid #d0a54b;
  border-radius: 8px;
  background: #fffdf4;
  overflow: hidden;
}

.bmi-input-unit input,
.bmi-input-unit select {
  min-height: 44px;
  border: 0;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
}

.bmi-input-unit input:focus,
.bmi-input-unit select:focus {
  outline: 3px solid var(--accent-soft);
  outline-offset: -3px;
}

.bmi-input-unit span,
.bmi-input-unit select {
  display: grid;
  place-items: center;
  border-left: 1px solid #6f1f10;
  background: #6f1f10;
  color: #ffffff;
  font-weight: 900;
  font-size: 0.75rem;
}

.bmi-input-unit select {
  padding-right: 30px;
  appearance: none;
  background-color: #6f1f10;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%23ffffff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.bmi-actions {
  padding: 18px 22px 16px;
}

.bmi-actions .calculate {
  flex: 1;
}

.bmi-result,
.bmi-form .result {
  margin: 0 22px 22px;
}

.bmi-classification,
.reference-classification,
.steroid-conversion-table {
  margin-top: 12px;
}

.bmi-classification h5,
.reference-classification h5,
.steroid-conversion-table h5 {
  margin: 0 0 6px;
  font-size: 0.92rem;
}

.bmi-classification table {
  width: auto;
  min-width: 245px;
  border-collapse: separate;
  border-spacing: 0;
  color: #660000;
  font-size: 0.95rem;
}

.bmi-classification th,
.bmi-classification td {
  padding: 2px 8px;
  text-align: left;
  vertical-align: top;
}

.bmi-classification th {
  font-weight: 800;
}

.bmi-classification .meld-active-row td {
  border-top: 2px solid #8a0000;
  border-bottom: 2px solid #8a0000;
  font-weight: 800;
}

.bmi-classification .meld-active-row td:first-child {
  border-left: 2px solid #8a0000;
}

.bmi-classification .meld-active-row td:last-child {
  border-right: 2px solid #8a0000;
}

.reference-classification ul,
.bmi-classification ul {
  margin: 0;
  padding-left: 18px;
}

.reference-classification li + li,
.bmi-classification li + li {
  margin-top: 3px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.steroid-conversion-table h5 {
  margin-bottom: 10px;
}

.steroid-conversion-table table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.steroid-conversion-table th,
.steroid-conversion-table td {
  padding: 8px 7px;
  border-bottom: 1px solid #d6ad53;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.steroid-conversion-table th:nth-child(2),
.steroid-conversion-table td:nth-child(2),
.steroid-conversion-table th:nth-child(3),
.steroid-conversion-table td:nth-child(3) {
  white-space: nowrap;
}

.steroid-conversion-table th {
  color: #660000;
  font-weight: 800;
}

.steroid-conversion-table p {
  margin: 12px 0 0;
}

@media (max-width: 760px) {
  .homa-info-row,
  .homa-input-grid,
  .bmi-info-row,
  .bsa-info-row,
  .calculator-info-row,
  .bmi-field-row {
    grid-template-columns: 1fr;
  }

  .bmi-field-row {
    gap: 8px;
    margin: 0 16px;
  }

  .bmi-instructions,
  .bmi-result {
    margin-left: 16px;
    margin-right: 16px;
  }

  .bmi-instructions {
    padding: 12px;
  }
}
