.bmi-shell {
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
  background:
    radial-gradient(60rem 30rem at 10% -10%, rgba(66, 99, 235, 0.14), transparent 60%),
    radial-gradient(50rem 28rem at 100% 0%, rgba(47, 158, 68, 0.12), transparent 60%),
    linear-gradient(180deg, #f6f8fc 0%, #eef2f9 100%);
}

.bmi-page {
  max-width: 820px;
  margin: 0 auto;
}

.bmi-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #5b6b82;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1.25rem;
}

.bmi-back:hover {
  color: #172b4a;
}

.bmi-back svg {
  width: 1.1rem;
  height: 1.1rem;
}

.bmi-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.bmi-hero-icon {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #2f9e44 0%, #12b886 100%);
  box-shadow: 0 0.6rem 1.25rem rgba(47, 158, 68, 0.3);
}

.bmi-hero-icon svg {
  width: 1.8rem;
  height: 1.8rem;
}

.bmi-hero h1 {
  margin: 0 0 0.15rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #172b4a;
}

.bmi-hero p {
  margin: 0;
  color: #5b6b82;
  font-size: 0.95rem;
}

.bmi-card {
  background: #fff;
  border: 1px solid rgba(23, 43, 74, 0.08);
  border-radius: 1.1rem;
  box-shadow: 0 0.25rem 1rem rgba(23, 43, 74, 0.06);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.bmi-card h2 {
  margin: 0 0 1.1rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #172b4a;
}

.bmi-error {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #fdecea;
  color: #a50e0e;
  font-size: 0.92rem;
}

.bmi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 1.25rem;
}

.bmi-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.bmi-field.is-wide {
  grid-column: 1 / -1;
}

.bmi-label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5b6b82;
}

.bmi-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: #8593a8;
}

.bmi-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  color: #172b4a;
  background: #f6f8fc;
  border: 1.5px solid #dbe2ee;
  border-radius: 0.7rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.bmi-input:focus {
  outline: none;
  background: #fff;
  border-color: #4263eb;
  box-shadow: 0 0 0 4px rgba(66, 99, 235, 0.15);
}

.bmi-unit {
  position: relative;
}

.bmi-unit .bmi-input {
  padding-right: 3rem;
}

.bmi-unit span {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  font-weight: 600;
  color: #8593a8;
  pointer-events: none;
}

.bmi-seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.35rem;
  padding: 0.3rem;
  background: #eef2f9;
  border-radius: 0.8rem;
}

.bmi-seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.bmi-seg label {
  margin: 0;
  padding: 0.55rem 0.75rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #5b6b82;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.bmi-seg label:hover {
  color: #172b4a;
}

.bmi-seg input:checked + label {
  background: #fff;
  color: #4263eb;
  box-shadow: 0 0.15rem 0.5rem rgba(23, 43, 74, 0.12);
}

.bmi-seg input.is-female:checked + label {
  color: #d6336c;
}

.bmi-seg input:focus-visible + label {
  outline: 2px solid #4263eb;
  outline-offset: 2px;
}

.bmi-submit {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.8rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #4263eb 0%, #3b5bdb 100%);
  border: 0;
  border-radius: 0.8rem;
  box-shadow: 0 0.6rem 1.25rem rgba(66, 99, 235, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bmi-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.9rem 1.6rem rgba(66, 99, 235, 0.38);
}

.bmi-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.5rem;
}

.bmi-stat {
  padding: 1rem 1.1rem;
  background: #f6f8fc;
  border-radius: 0.9rem;
}

.bmi-stats dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5b6b82;
}

.bmi-stats dd {
  margin: 0.3rem 0 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #172b4a;
}

.bmi-stat.is-category {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bmi-stat.is-category dd {
  margin: 0;
}

.bmi-badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 999px;
}

.bmi-cat-SEVERE_THINNESS { background: #fdecea; color: #c5221f; }
.bmi-cat-THINNESS { background: #fff3e0; color: #e37400; }
.bmi-cat-NORMAL { background: #e6f4ea; color: #137333; }
.bmi-cat-OVERWEIGHT { background: #fff4d6; color: #b06000; }
.bmi-cat-OBESITY { background: #fdecea; color: #a50e0e; }

.bmi-chart-wrap {
  border-top: 1px solid #eef2f9;
  padding-top: 1.25rem;
}

.bmi-chart-title {
  font-weight: 700;
  color: #172b4a;
  margin: 0 0 0.75rem;
}

@media (max-width: 560px) {
  .bmi-grid {
    grid-template-columns: 1fr;
  }
  .bmi-card {
    padding: 1.25rem;
  }
  .bmi-hero h1 {
    font-size: 1.3rem;
  }
}

.bmi-chart-root {
  width: 100%;
}

.bmi-who-frame {
  border: 5px solid #4285f4;
  background: #fff;
  padding: 4px;
  border-radius: 2px;
  max-width: 900px;
}

.bmi-who-frame.bmi-sex-m {
  border-color: #4285f4;
}

.bmi-who-frame.bmi-sex-f {
  border-color: #ec008c;
}

.bmi-who-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: "Segoe UI", Arial, sans-serif;
}

.bmi-who-border {
  fill: #fff;
  stroke: #ec008c;
  stroke-width: 0;
}

.bmi-who-title {
  font-size: 13px;
  font-weight: 700;
  fill: #333;
}

.bmi-who-plot-bg {
  fill: #d6ecf7;
}

.bmi-grid-major {
  stroke: #fff;
  stroke-width: 1;
}

.bmi-grid-minor {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 0.5;
}

.bmi-grid-major-v {
  stroke: #fff;
  stroke-width: 1;
}

.bmi-grid-minor-v {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 0.5;
}

.bmi-zone {
  stroke: none;
  fill-opacity: 0.38;
}

.bmi-zone-severe { fill: #f4c7c3; }
.bmi-zone-thin { fill: #fce8b2; }
.bmi-zone-normal { fill: #ceead6; }
.bmi-zone-over { fill: #fdd663; }
.bmi-zone-obese { fill: #f28b82; }

.bmi-zone-label {
  font-size: 11px;
  fill: rgba(80, 80, 80, 0.55);
  font-style: italic;
}

.bmi-sd-line {
  fill: none;
  stroke-width: 2;
}

.bmi-sd-pos2 { stroke: #e53935; }
.bmi-sd-pos1 { stroke: #f57c00; }
.bmi-sd-median { stroke: #43a047; }
.bmi-sd-neg2 { stroke: #e53935; }
.bmi-sd-neg3 { stroke: #212121; }

.bmi-sd-z-label {
  font-size: 10px;
  fill: #333;
  font-weight: 600;
}

.bmi-who-axis-y text,
.bmi-who-axis-x text {
  font-size: 10px;
  fill: #333;
}

.bmi-axis-subtick {
  font-size: 8px;
  fill: #555;
}

.bmi-axis-caption {
  font-size: 11px;
  fill: #333;
}

.bmi-marker {
  fill: #4285f4;
  stroke: #172b4a;
  stroke-width: 2;
  animation: bmi-blink 1s ease-in-out infinite;
}

.bmi-who-frame.bmi-sex-f .bmi-marker {
  fill: #ec008c;
  stroke: #9e0056;
}

.bmi-who-frame.bmi-sex-m .bmi-marker {
  fill: #4285f4;
  stroke: #172b4a;
}

@keyframes bmi-blink {
  0%, 100% {
    opacity: 1;
    r: 7;
  }
  50% {
    opacity: 0.35;
    r: 10;
  }
}

.bmi-chart-legend-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: #444;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.sw-marker {
  background: #4285f4;
  border-radius: 50%;
}

.bmi-chart-wrap.bmi-sex-f .sw-marker {
  background: #ec008c;
}

.bmi-chart-wrap.bmi-sex-m .sw-marker {
  background: #4285f4;
}

.bmi-login-link {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}
