/* ── Reset & Tokens ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:        #0B5563;
  --teal-dark:   #083E4A;
  --teal-light:  #E0F2F4;
  --page:        #F2F6F7;
  --card:        #FFFFFF;
  --border:      #D9E4E6;
  --text:        #1E3240;
  --muted:       #5C7280;
  --amber:       #D97706;

  --font-head:   'Plus Jakarta Sans', sans-serif;
  --font-body:   'Inter', sans-serif;
  --font-mono:   'IBM Plex Mono', monospace;

  --radius:      10px;
  --shadow:      0 1px 3px rgba(11,85,99,.07), 0 1px 2px rgba(11,85,99,.04);
}

html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--page); color: var(--text); line-height: 1.6; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ── Header ─────────────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
  padding: 22px 0;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(8,62,74,.25);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon {
  width: 42px; height: 42px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-title {
  font-family: var(--font-head);
  font-weight: 700; font-size: 16.5px; color: #fff; line-height: 1.2;
}
.brand-sub { font-size: 12px; color: rgba(255,255,255,.65); }
.header-badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.85); padding: 4px 10px; border-radius: 20px;
  white-space: nowrap;
}

/* ── Metric Strip ───────────────────────────────────────────── */
.metric-strip {
  background: var(--teal); border-top: 1px solid rgba(255,255,255,.08);
  padding: 20px 0 28px;
}
.metric-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
}
.metric {
  display: flex; flex-direction: column; gap: 4px;
  padding: 0 20px; border-right: 1px solid rgba(255,255,255,.12);
}
.metric:first-child { padding-left: 0; }
.metric:last-child  { border-right: none; }
.metric-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: rgba(255,255,255,.55);
}
.metric-value {
  font-family: var(--font-head); font-weight: 700;
  font-size: 26px; color: #fff; line-height: 1;
}
.metric-unit { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.5); }
.mono-sm { font-family: var(--font-mono); }

/* ── Layout ─────────────────────────────────────────────────── */
.main { padding: 28px 0 64px; }
.page-grid {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; align-items: start;
}
.col-left, .col-right { display: flex; flex-direction: column; gap: 18px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head { padding: 22px 24px 0; }
.card-head h2 {
  font-family: var(--font-head); font-weight: 700; font-size: 16px;
  color: var(--teal); margin-bottom: 4px;
}
.card-head p { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── Form ───────────────────────────────────────────────────── */
.form { padding: 18px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.fieldset { border: none; }
.legend {
  font-family: var(--font-head); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin-bottom: 12px; display: block;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-4 { grid-template-columns: repeat(4, 1fr); }
.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 12.5px; font-weight: 600; color: var(--text);
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { flex: 1; }
.input-unit {
  position: absolute; right: 10px;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  pointer-events: none;
}
.field input {
  width: 100%; font-family: var(--font-mono); font-size: 14px;
  padding: 9px 38px 9px 10px; border: 1.5px solid var(--border);
  border-radius: 7px; outline: none; background: #fff; color: var(--text);
  transition: border-color .15s;
}
.field-row-4 .field input { padding: 9px 10px; }
.field input:focus { border-color: var(--teal); }
.has-error input { border-color: #DC2626 !important; }
.field-error { font-size: 11.5px; color: #DC2626; }

.btn-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--teal); color: #fff;
  font-family: var(--font-head); font-weight: 700; font-size: 14.5px;
  border: none; border-radius: 8px; padding: 13px 20px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-submit:hover { background: var(--teal-dark); }
.btn-submit:active { transform: scale(.98); }

/* ── WHO Table ──────────────────────────────────────────────── */
#who-card { padding: 22px 24px 20px; }
#who-card h2 {
  font-family: var(--font-head); font-weight: 700; font-size: 16px;
  color: var(--teal); margin-bottom: 4px;
}
#who-card > p { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.who-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.who-table th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); text-align: left;
  padding: 0 10px 8px; border-bottom: 1.5px solid var(--border);
}
.who-table td { padding: 10px 10px; border-bottom: 1px solid #EEF2F4; }
.who-table tr:last-child td { border-bottom: none; }
.label-chip {
  display: inline-block; font-family: var(--font-head); font-weight: 600;
  font-size: 11.5px; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.label-chip-sm { font-size: 10.5px; padding: 2px 7px; }
.who-meaning { font-size: 12px; color: var(--muted); }
.who-source {
  font-size: 11px; color: #8FA6B0; margin-top: 14px;
  border-top: 1px solid var(--border); padding-top: 12px;
  font-style: italic;
}

/* ── Result Card ────────────────────────────────────────────── */
.result-card {
  border-top: 3px solid var(--rc);
  padding: 22px 24px;
}
.result-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
.result-eyebrow {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); display: block; margin-bottom: 4px;
}
.result-label {
  font-family: var(--font-head); font-weight: 800; font-size: 32px;
  color: var(--rc); line-height: 1;
}
.result-avg { text-align: right; }
.result-avg-label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 3px; }
.result-avg-val { font-size: 22px; font-weight: 600; color: var(--text); }

.result-desc {
  font-size: 13.5px; line-height: 1.65; color: var(--text);
  background: var(--rbg); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 22px; border-left: 3px solid var(--rc);
}

/* WHO Ruler */
.ruler-wrap { margin-bottom: 22px; }
.ruler-label-top {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin-bottom: 8px;
}
.ruler {
  position: relative; display: flex; height: 36px;
  border-radius: 6px; overflow: hidden;
}
.ruler-seg {
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 4px; border-top: 2px solid; position: relative;
}
.ruler-seg-label { font-size: 10px; font-weight: 600; line-height: 1; }
.ruler-marker {
  position: absolute; top: -4px;
  width: 4px; height: 44px; border-radius: 2px;
  transform: translateX(-2px);
  box-shadow: 0 0 0 3px rgba(255,255,255,.95), 0 2px 6px rgba(0,0,0,.3);
  transition: left .6s cubic-bezier(.34,1.56,.64,1);
}
.ruler-scale {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted); margin-top: 5px;
}

/* Result Detail */
.result-detail {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  border-top: 1px solid var(--border); padding-top: 18px;
}
.detail-group { display: flex; flex-direction: column; gap: 6px; }
.detail-head {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 2px;
}
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; gap: 6px;
}
.detail-row > span:first-child { color: var(--muted); }

/* ── Empty + Info card ──────────────────────────────────────── */
.empty-card { padding: 40px 24px; text-align: center; }
.empty-icon {
  width: 64px; height: 64px; background: var(--teal-light);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--teal); margin: 0 auto 16px;
}
.empty-card h3 {
  font-family: var(--font-head); font-weight: 700; font-size: 16px;
  color: var(--text); margin-bottom: 8px;
}
.empty-card p { font-size: 13.5px; color: var(--muted); max-width: 340px; margin: 0 auto; }

.info-card { padding: 20px 24px; }
.info-card h3 {
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  color: var(--teal); margin-bottom: 14px;
}
.info-rows { display: flex; flex-direction: column; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid #F0F4F5;
}
.info-row > span:first-child { color: var(--muted); }
.feature-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ftag {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--teal-light); color: var(--teal);
  padding: 3px 8px; border-radius: 5px; font-weight: 500;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--teal-dark); color: rgba(255,255,255,.5);
  padding: 20px 0; text-align: center;
}
.footer p { font-size: 11.5px; line-height: 1.8; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .page-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .metric { padding: 0; border-right: none; }
  .field-row-4 { grid-template-columns: repeat(2, 1fr); }
  .result-detail { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .brand-sub { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .result-top { flex-direction: column; }
  .result-detail { grid-template-columns: 1fr; }
}
