/* ==========================================================================
   MedCalc — Design System
   Signature: the "readout" panel — result cards styled like a bedside
   monitor readout (monospace figures, colored severity edge) rather than
   generic dashboard cards.
   ========================================================================== */

/* Self-hosted fonts — no third-party requests to Google Fonts on page load. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-700.woff2") format("woff2");
}

:root {
  /* Color */
  --ink: #16211E;
  --ink-muted: #5C6B68;
  --paper: #F6F7F4;
  --card: #FFFFFF;
  --line: #E2E6E3;

  --teal: #0F6E64;
  --teal-deep: #0A4B44;
  --teal-tint: #DCEEEB;

  --coral: #E0562F;
  --coral-tint: #FBE6DF;

  --green: #2E8B57;
  --green-tint: #E3F3EA;
  --amber: #C8860D;
  --amber-tint: #FBF0DA;
  --red: #C13B2E;
  --red-tint: #F9E2DF;

  /* Type */
  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;

  /* Layout */
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1080px;
  --shadow: 0 1px 2px rgba(22,33,30,0.04), 0 6px 20px rgba(22,33,30,0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0 0 0.4em 0;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em 0; line-height: 1.55; }

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Focus visibility, kept even on custom controls */
a:focus-visible,
button:focus-visible,
input:focus-visible,
.toggle-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------------- Nav ---------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 247, 244, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--teal-tint);
  color: var(--teal-deep);
  text-decoration: none;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-links {
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 8px 20px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 14px; }
  .nav-toggle { display: block; }
}

/* ---------------- Hero ---------------- */
.hero {
  padding: 64px 0 16px;
}
.hero .eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
  color: var(--teal-deep);
  background: var(--teal-tint);
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  max-width: 16ch;
  font-weight: 600;
}
.hero p.lead {
  font-size: 1.1rem;
  color: var(--ink-muted);
  max-width: 55ch;
}
.hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero-stats .stat .num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--teal-deep);
}
.hero-stats .stat .label {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* ---------------- Category grid ---------------- */
.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 12px 0 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title-row h2 { font-size: 1.5rem; }
.section-title-row .see-all { font-size: 0.9rem; font-weight: 600; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.cat-card .emoji { font-size: 1.4rem; line-height: 1; }
.cat-card h3 { font-size: 1.05rem; margin: 0; color: var(--ink); }
.cat-card .count { flex-basis: 100%; margin-top: 6px; font-size: 0.85rem; color: var(--ink-muted); font-family: var(--font-mono); }

/* ---------------- Calculator cards ---------------- */
.calc-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  scroll-margin-top: 84px;
}
.calc-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  cursor: pointer;
}
.calc-card-head .emoji {
  font-size: 1.6rem;
  width: 42px; height: 42px;
  background: var(--teal-tint);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.calc-card-head h3 { font-size: 1.15rem; margin: 0; }
.calc-card-head .sub { font-size: 0.9rem; color: var(--ink-muted); margin: 2px 0 0; }
.calc-card-head .chevron {
  margin-left: auto;
  color: var(--ink-muted);
  transition: transform 0.15s ease;
  font-size: 1.1rem;
}
.calc-card.open .chevron { transform: rotate(180deg); }
.calc-body { display: none; }
.calc-card.open .calc-body { display: block; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.field .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.field input[type="number"], .field input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.98rem;
  background: var(--paper);
  color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--teal); background: var(--card); }
/* Hide native number spin buttons — they collide with the unit label, which already
   conveys the expected value, so the browser's +/- arrows add nothing. */
.field input[type="number"] { -moz-appearance: textfield; padding-right: 52px; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field .unit {
  position: absolute;
  right: 12px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  pointer-events: none;
}
.field input.has-unit-toggle { padding-right: 84px; }
.field .unit-toggle {
  position: absolute;
  right: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--teal-deep);
  background: var(--teal-tint);
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: var(--font-body);
  white-space: nowrap;
}
.field .unit-toggle:hover { background: var(--teal); color: white; }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 0.95rem;
}
.check-row input { width: 18px; height: 18px; accent-color: var(--teal); }

.seg {
  display: flex;
  background: var(--teal-tint);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 2px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.seg button {
  flex: 1;
  min-width: 44px;
  border: none;
  background: transparent;
  padding: 9px 8px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--teal-deep);
  cursor: pointer;
}
.seg button.active {
  background: var(--teal);
  color: white;
  font-weight: 600;
}

.field-label-standalone {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin: 4px 0 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--teal);
  color: white;
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.96rem;
  cursor: pointer;
  width: 100%;
}
.btn:hover { background: var(--teal-deep); }

.calc-btn-wrap { position: relative; }
.arrow-cue {
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  font-size: 1.6rem;
  line-height: 1;
  pointer-events: none;
  animation: arrow-cue-bounce 1.1s ease-in-out infinite;
}
.arrow-cue.hidden { display: none; }
@keyframes arrow-cue-bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 10px); }
}

.schedule-actions {
  display: none;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  color: var(--teal-deep);
  border: 1px solid var(--line);
  padding: 9px 16px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--teal-tint); }

/* ---------------- Print-to-PDF (downloadSchedulePdf) ---------------- */
.print-only { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-only, .print-only * { visibility: visible; }
  .print-only { display: block; position: absolute; top: 0; left: 0; width: 100%; }
}

/* ---------------- Readout (signature result panel) ---------------- */
.readout {
  margin-top: 18px;
  border-radius: var(--radius);
  padding: 20px 20px 20px 22px;
  border-left: 5px solid var(--ink-muted);
  background: var(--paper);
  display: none;
}
.readout.show { display: block; animation: readoutIn 0.25s ease; }
@keyframes readoutIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.readout .headline {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
}
.readout-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}
.readout-row .rlabel { color: var(--ink-muted); }
.readout-row .rvalue { font-family: var(--font-mono); font-weight: 600; }
.readout .interp {
  margin-top: 10px;
  font-size: 0.87rem;
  color: var(--ink-muted);
}
.readout.sev-normal { border-color: var(--green); background: var(--green-tint); }
.readout.sev-normal .headline { color: var(--green); }
.readout.sev-low { border-color: var(--teal); background: var(--teal-tint); }
.readout.sev-low .headline { color: var(--teal-deep); }
.readout.sev-moderate { border-color: var(--amber); background: var(--amber-tint); }
.readout.sev-moderate .headline { color: var(--amber); }
.readout.sev-high { border-color: var(--coral); background: var(--coral-tint); }
.readout.sev-high .headline { color: var(--coral); }
.readout.sev-critical { border-color: var(--red); background: var(--red-tint); }
.readout.sev-critical .headline { color: var(--red); }

.error-text { color: var(--red); font-size: 0.88rem; margin-top: 8px; }

/* ---------------- Ad slot placeholders (future Google AdSense) ---------------- */
.ad-slot {
  margin: 28px 0;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding: 32px 0 40px;
  color: var(--ink-muted);
  font-size: 0.85rem;
}
.site-footer .links { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0; }
.disclaimer-banner {
  background: var(--teal-tint);
  color: var(--teal-deep);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.85rem;
  margin: 30px 0;
}

.page-header { padding: 44px 0 8px; }
.page-header .eyebrow {
  font-family: var(--font-mono);
  color: var(--teal-deep);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.page-header h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-top: 6px; }
.page-header p { color: var(--ink-muted); max-width: 60ch; }

/* ---------------- Info block (how it works / normal values / references) ---------------- */
.info-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  margin-bottom: 20px;
}
.info-block h2 {
  font-size: 1.2rem;
  margin-top: 0;
}
.info-block h2:not(:first-child) {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.info-block h3 {
  font-size: 0.98rem;
  color: var(--teal-deep);
  margin-top: 18px;
}
.info-block p, .info-block li { color: var(--ink-muted); font-size: 0.95rem; }
.info-block strong { color: var(--ink); }

.formula-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 10px 0 16px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-line;
  line-height: 1.6;
}
.formula-box + .formula-box { margin-top: -8px; }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0 16px;
}
.ref-table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0;
}
.ref-table th, .ref-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.ref-table th {
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}
.ref-table td:first-child { font-family: var(--font-mono); white-space: nowrap; color: var(--ink); font-weight: 600; }
.ref-table tr:last-child td { border-bottom: none; }

.info-block ul, .info-block ol { padding-left: 1.2em; margin: 8px 0 16px; }
.info-block ul li, .info-block ol li { margin-bottom: 6px; line-height: 1.5; }

.ref-list { font-size: 0.85rem; }
.ref-list li { color: var(--ink-muted); }

/* ---------------- Top disclaimer banner ---------------- */
.top-disclaimer {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 44px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-align: center;
  position: relative;
}
.top-disclaimer strong { color: var(--red); }
.top-disclaimer .close-disclaimer {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 6px;
}
.top-disclaimer .close-disclaimer:hover { color: var(--ink); }
@media (max-width: 700px) {
  .top-disclaimer { padding: 10px 40px 10px 14px; font-size: 0.78rem; text-align: left; }
}

/* ---------------- Homepage search ---------------- */
.site-search {
  position: relative;
  max-width: 480px;
  margin: 28px 0 8px;
}
.site-search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  font-size: 1rem;
  pointer-events: none;
}
.site-search input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.site-search input:focus {
  outline: none;
  border-color: var(--teal);
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 360px;
  overflow-y: auto;
  z-index: 40;
}
.search-results.open { display: block; }
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--ink);
}
.search-result:hover { background: var(--teal-tint); text-decoration: none; }
.search-result + .search-result { border-top: 1px solid var(--line); }
.sr-emoji { font-size: 1.2rem; flex-shrink: 0; }
.sr-text { display: flex; flex-direction: column; }
.sr-name { font-weight: 600; font-size: 0.95rem; }
.sr-desc { font-size: 0.8rem; color: var(--ink-muted); font-family: var(--font-mono); }
.search-empty { padding: 14px 16px; font-size: 0.9rem; color: var(--ink-muted); }

/* ---------------- About page ---------------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin: 8px 0 20px;
}
.about-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.about-card .about-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--teal-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.about-card h2 { font-size: 1.15rem; margin-bottom: 12px; }
.about-card p { color: var(--ink-muted); font-size: 0.95rem; }
.about-stat-row { display: flex; gap: 24px; margin-top: 12px; flex-wrap: wrap; }
.about-stat-row .stat .num {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--teal-deep);
}
.about-stat-row .stat .label { font-size: 0.8rem; color: var(--ink-muted); }
.ref-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ref-chip {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--ink);
}
.about-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.about-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--teal-tint);
  color: var(--teal-deep);
  font-size: 0.85rem;
  font-weight: 600;
}
.about-links a:hover { background: var(--teal); color: #fff; text-decoration: none; }

/* ---------------- FAQ (details/summary) ---------------- */
.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  margin-bottom: 10px;
  background: var(--paper);
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 0;
  color: var(--ink);
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+ "; color: var(--teal); font-weight: 700; }
.faq-item[open] summary::before { content: "− "; }
.faq-item p { padding-bottom: 14px; margin: 0; color: var(--ink-muted); }

/* ---------------- Ref table row highlight (OB wheel milestone/biometry) ---------------- */
.ref-table tr.current-week td { background: var(--teal-tint); font-weight: 600; }

/* ---------------- Date field (styled text + icon, backed by a real native date input) ----------------
   The native input is click-through (pointer-events: none) — a JS click handler on the
   wrapper calls .showPicker() explicitly instead, because clicking the middle of a native
   date input in most browsers only positions a text segment, not opens the calendar; only
   its own built-in icon (which we've hidden) reliably opens the popup. Keyboard/tab access
   to the native input is unaffected by pointer-events. */
.date-field { position: relative; }
.date-field .date-text { padding-right: 42px; cursor: pointer; }
.date-field input[type="date"] {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.date-field .date-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--ink-muted);
  font-size: 1rem;
  z-index: 1;
}

/* ---------------- Select fields (e.g. cycle length) ---------------- */
.field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.98rem;
  background: var(--paper);
  color: var(--ink);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%), linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field select:focus { outline: none; border-color: var(--teal); background-color: var(--card); }

/* ---------------- Related calculators ---------------- */
.related-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.related-tools a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--teal-tint);
  color: var(--teal-deep);
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.related-tools a:hover { background: var(--teal); color: #fff; text-decoration: none; }

/* ---------------- "Popular" badge on cat-cards ---------------- */
.cat-card { position: relative; }
.badge-popular {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--coral);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------------- BMI gauge ---------------- */
.bmi-gauge-result { margin-top: 18px; display: none; }
.bmi-gauge-result.show { display: block; animation: readoutIn 0.25s ease; }
.bmi-gauge-headline {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.bmi-gauge-headline .cat { font-family: var(--font-body); font-weight: 600; }
.bmi-gauge-headline.sev-low, .bmi-gauge-headline.sev-low .cat { color: var(--teal-deep); }
.bmi-gauge-headline.sev-normal, .bmi-gauge-headline.sev-normal .cat { color: var(--green); }
.bmi-gauge-headline.sev-moderate, .bmi-gauge-headline.sev-moderate .cat { color: var(--amber); }
.bmi-gauge-headline.sev-high, .bmi-gauge-headline.sev-high .cat { color: var(--coral); }
.bmi-gauge-headline.sev-critical, .bmi-gauge-headline.sev-critical .cat { color: var(--red); }

.bmi-gauge-svg { display: block; width: 100%; max-width: 420px; margin: 0 auto; }
.gauge-band { fill: none; stroke-width: 26; }
.gauge-band.b-underweight { stroke: var(--teal); }
.gauge-band.b-normal { stroke: var(--green); }
.gauge-band.b-overweight { stroke: var(--amber); }
.gauge-band.b-obese1 { stroke: var(--coral); }
.gauge-band.b-obese2 { stroke: var(--red); }
.gauge-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  fill: var(--ink-muted);
  text-anchor: middle;
}
.gauge-needle-line { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.gauge-needle-pivot { fill: var(--ink); }
.gauge-center-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  fill: var(--ink);
  text-anchor: middle;
}

.bmi-gauge-stats {
  max-width: 420px;
  margin: 4px auto 0;
  font-size: 0.9rem;
}
.bmi-gauge-stats .stat-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.bmi-gauge-stats .stat-line .slabel { color: var(--ink-muted); }
.bmi-gauge-stats .stat-line .svalue { font-family: var(--font-mono); font-weight: 600; color: var(--ink); text-align: right; }
