/* BMI layout fix — SVG gauge + 3 stacked category tables */

.results--bmi {
  padding: clamp(.85rem, 2vw, 1.15rem) !important;
}

/* ===== Semicircle SVG gauge ===== */
.bmi-gauge-block {
  width: min(100%, 340px);
  margin: 0 auto .1rem;
}

.bmi-gauge-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.bmi-result-main {
  text-align: center;
  margin: .05rem 0 .55rem;
}

.bmi-result-main .stage-pill { margin: .2rem 0 .25rem; }

.bmi-result-main .result-interpretation {
  max-width: 36rem;
  margin: .15rem auto 0;
  font-size: .86rem;
  line-height: 1.4;
}

.bmi-result-line {
  margin: 0;
  font-size: clamp(1.05rem, 2.6vw, 1.22rem);
  font-weight: 700;
  color: #fff;
}

.bmi-result-line .bmi-cat-ok { color: #4ade80; }
.bmi-result-line .bmi-cat-warn { color: #facc15; }
.bmi-result-line .bmi-cat-high,
.bmi-result-line .bmi-cat-crit { color: #fb7185; }
.bmi-result-line .bmi-cat-mild { color: #fbbf24; }

.bmi-result-list {
  list-style: none;
  margin: 0 0 .55rem;
  padding: 0;
  display: grid;
  gap: .4rem;
  grid-template-columns: 1fr 1fr;
}

@media (min-width: 700px) {
  .bmi-result-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.bmi-result-list li {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .5rem .6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .1);
}

.bmi-result-list li span {
  color: #9fb4c6;
  font-size: .64rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 650;
}

.bmi-result-list li b {
  color: #fff;
  font-weight: 650;
  font-size: .84rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.fwd-metrics--bmi {
  margin: .45rem 0 0 !important;
  gap: .35rem !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.fwd-metrics--bmi .fwd-metric { padding: .4rem .45rem; }
.fwd-metrics--bmi .fwd-metric span { font-size: .6rem; }
.fwd-metrics--bmi .fwd-metric b {
  font-size: .78rem;
  line-height: 1.2;
  word-break: break-word;
}

.bmi-cat-chart { margin: .5rem 0 0; }

.bmi-cat-track {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
}

.bmi-cat-seg {
  display: grid;
  place-content: center;
  text-align: center;
  font-size: .6rem;
  font-weight: 700;
  line-height: 1.15;
  padding: .22rem .15rem;
  color: #0b1220;
}

.bmi-cat-seg.under { background: #38bdf8; }
.bmi-cat-seg.normal { background: #22c55e; }
.bmi-cat-seg.over { background: #eab308; }
.bmi-cat-seg.obese { background: #ef4444; color: #fff; }

.bmi-cat-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35);
  border-radius: 2px;
  transition: left .45s cubic-bezier(.22, 1, .36, 1);
  z-index: 2;
}

.formula-viz--bmi {
  margin-top: .55rem !important;
  padding: .65rem .8rem !important;
}
.formula-viz--bmi .fv-equation {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  font-size: clamp(.72rem, 2.8vw, .9rem);
  line-height: 1.45;
}

/* Kill old cramped 3-col grid */
.bmi-tables-grid { display: contents !important; }

.prose--bmi > * + * { margin-top: .75rem !important; }
.prose--bmi h2 { margin-top: 1.65rem !important; }
.prose--bmi h2 + p { margin-top: .35rem !important; }

.bmi-cat-section {
  margin: 1.15rem 0 0;
  padding: 0;
}

.bmi-cat-section > h2 { margin-top: 0 !important; }

.table-wrap--bmi {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  margin: .5rem 0 0 !important;
  max-width: 100%;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

html[data-theme="dark"] .table-wrap--bmi {
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}

.data-table--bmi {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  font-size: .92rem;
  border-collapse: collapse;
}

.data-table--bmi caption {
  caption-side: top;
  text-align: left;
  padding: .85rem 1rem .5rem;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #2563eb;
  background: var(--paper);
}

html[data-theme="dark"] .data-table--bmi caption {
  color: #60a5fa;
}

.data-table--bmi thead th {
  background: #0f172a;
  color: #fff;
  font-weight: 700;
  font-size: .82rem;
  padding: .55rem 1rem !important;
  text-align: left;
}

.data-table--bmi tbody tr:nth-child(even) {
  background: rgba(148, 163, 184, .1);
}

html[data-theme="dark"] .data-table--bmi tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, .035);
}

.data-table--bmi th,
.data-table--bmi td {
  padding: .52rem 1rem !important;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.data-table--bmi tbody tr:last-child td { border-bottom: none; }

.data-table--bmi th:first-child,
.data-table--bmi td:first-child { width: 58%; }

.data-table--bmi th:last-child,
.data-table--bmi td:last-child { width: 42%; }

.data-table--bmi .num {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.bmi-row-under td:first-child { box-shadow: inset 4px 0 0 #38bdf8; }
.bmi-row-ok td:first-child { box-shadow: inset 4px 0 0 #22c55e; }
.bmi-row-warn td:first-child { box-shadow: inset 4px 0 0 #eab308; }
.bmi-row-high td:first-child { box-shadow: inset 4px 0 0 #f97316; }
.bmi-row-crit td:first-child { box-shadow: inset 4px 0 0 #ef4444; }

@media (max-width: 560px) {
  .bmi-gauge-block { width: min(100%, 300px); }
  .bmi-cat-seg { font-size: .52rem; }
  .fwd-metrics--bmi {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .data-table--bmi { font-size: .86rem; }
  .data-table--bmi th,
  .data-table--bmi td { padding: .45rem .75rem !important; }
}
