:root {
  --ink: #18343b;
  --muted: #5c7075;
  --brand: #075d71;
  --brand-dark: #044654;
  --accent: #efb44c;
  --surface: #ffffff;
  --soft: #eef6f5;
  --line: #d8e5e4;
  --shadow: 0 16px 45px rgb(15 68 79 / 12%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #f9fcfb;
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: .85rem max(1rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgb(216 229 228 / 80%);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand span:last-child { display: grid; }
.brand small { margin-top: .12rem; color: var(--muted); font-size: .72rem; }
.brand-mark {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border-radius: .8rem;
  color: white;
  background: var(--brand);
  font-size: 1.45rem;
  font-weight: 800;
}

nav { display: flex; gap: .3rem; }
nav a { padding: .6rem .8rem; border-radius: .6rem; text-decoration: none; font-weight: 650; }
nav a:hover { background: var(--soft); }
.menu-button { display: none; }

.hero {
  display: grid;
  grid-template-columns: 1.6fr .8fr;
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  max-width: 1180px;
  min-height: 560px;
  margin: auto;
  padding: 5rem 1rem;
}

.eyebrow {
  margin: 0 0 .65rem;
  color: var(--brand);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 { max-width: 780px; margin: 0; font-size: clamp(2.55rem, 6vw, 5.3rem); line-height: .98; letter-spacing: -.055em; }
h2 { margin: 0; font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.035em; }
.hero-copy { max-width: 650px; margin: 1.5rem 0 0; color: var(--muted); font-size: 1.15rem; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: .72rem 1rem;
  border: 1px solid transparent;
  border-radius: .75rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 750;
}
.button.primary { color: white; background: var(--brand); }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { border-color: var(--line); color: var(--brand); background: white; }
.button.secondary:hover { background: var(--soft); }

.hero-card {
  position: relative;
  padding: 1.8rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-card::after {
  position: absolute;
  right: -3rem;
  bottom: -4rem;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: rgb(239 180 76 / 18%);
  content: "";
}
.hero-card p { position: relative; z-index: 1; margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.status-dot { display: inline-block; width: .6rem; height: .6rem; margin-right: .4rem; border-radius: 50%; background: var(--accent); }

.section { max-width: 1180px; margin: auto; padding: 5rem 1rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.search input {
  width: min(330px, 100%);
  padding: .78rem .9rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: var(--ink);
  background: white;
}
.search input:focus, input:focus, select:focus { outline: 3px solid rgb(7 93 113 / 18%); border-color: var(--brand); }

.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tool-group { margin-top: 2.5rem; }
.tool-group:first-child { margin-top: 0; }
.tool-group h3 { margin: 0 0 1rem; color: var(--brand-dark); font-size: 1.25rem; }
.converter-group { margin-top: 4.5rem; padding-top: 2rem; border-top: 2px solid var(--line); }
.catalog-section-header { margin-bottom: 1.4rem; }
.catalog-section-header .eyebrow { margin-bottom: .35rem; }
.catalog-section-header h2 { margin: 0; color: var(--brand-dark); font-size: clamp(1.75rem, 4vw, 2.4rem); }
.catalog-section-header p:last-child { max-width: 650px; margin: .55rem 0 0; color: var(--muted); line-height: 1.5; }
.tool-card {
  position: relative;
  display: grid;
  min-height: 205px;
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  text-align: left;
  background: white;
  box-shadow: 0 8px 26px rgb(15 68 79 / 5%);
}
button.tool-card { cursor: pointer; }
button.tool-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); }
.tool-card strong { align-self: end; margin-bottom: .4rem; font-size: 1.16rem; }
.tool-card > span:last-child { color: var(--muted); line-height: 1.4; }
.tool-card.muted { background: #f5f8f7; box-shadow: none; }
.tool-icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: .8rem;
  color: var(--brand);
  background: var(--soft);
  font-weight: 850;
}
.tag { position: absolute; top: 1.3rem; right: 1.3rem; padding: .3rem .5rem; border-radius: 999px; font-size: .66rem; font-weight: 850; text-transform: uppercase; }
.tag.available { color: #0a6653; background: #e2f6ef; }
.tag.planned { color: #6f6555; background: #eeeae1; }

.calculator-shell { max-width: 900px; margin: auto; padding: 2rem 1rem 6rem; }
.back-link { margin-bottom: 1rem; border: 0; color: var(--brand); background: transparent; cursor: pointer; font-weight: 750; }
.calculator-card { padding: clamp(1.2rem, 4vw, 2.3rem); border: 1px solid var(--line); border-radius: 1.2rem; background: white; box-shadow: var(--shadow); }
.notice { padding: .85rem 1rem; border-left: 4px solid var(--accent); color: #645536; background: #fff8e9; line-height: 1.45; }
form { display: grid; gap: 1rem; margin-top: 1.5rem; }
form label { display: grid; gap: .4rem; font-weight: 700; }
form input, form select { width: 100%; padding: .78rem .85rem; border: 1px solid var(--line); border-radius: .65rem; color: var(--ink); background: white; }
form .button { justify-self: start; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-section { margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .9rem; }
.form-section legend { padding: 0 .45rem; color: var(--brand); font-weight: 850; }
.clinical-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
form label small { color: var(--muted); font-size: .75rem; font-weight: 500; line-height: 1.35; }
.check-label { display: flex; flex-direction: row; align-items: center; align-self: end; min-height: 2.9rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .65rem; }
.check-label input { width: auto; margin: 0 .6rem 0 0; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.live-calculation { display: grid; align-content: center; gap: .25rem; min-height: 100%; padding: .8rem; border: 1px solid var(--line); border-radius: .65rem; color: var(--brand-dark); background: var(--soft); }
.live-calculation span { font-weight: 700; }
.live-calculation strong { font-size: 1.25rem; }
.live-calculation small { color: var(--muted); }
.data-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; margin-top: .8rem; }
.data-summary span { padding: .65rem; border: 1px solid rgb(7 93 113 / 12%); border-radius: .6rem; background: white; }
.crisis-results { display: grid; gap: 1rem; margin-top: 1.3rem; }
.classification-card { padding: 1.2rem; border: 1px solid var(--brand); border-radius: .9rem; color: var(--brand-dark); background: var(--soft); }
.classification-card strong { display: block; margin-bottom: .35rem; font-size: 1.25rem; }
.result-section { padding: 1rem; border: 1px solid var(--line); border-radius: .9rem; background: white; }
.result-section h3 { margin: 0 0 .8rem; color: var(--brand-dark); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.metric { padding: .7rem; border-radius: .65rem; background: var(--soft); }
.metric b, .criterion b { display: block; margin-bottom: .18rem; }
.metric small, .criterion small { color: var(--muted); }
.criteria-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.criterion { padding: .7rem .8rem; border-left: 4px solid var(--line); border-radius: .45rem; background: #f8faf9; }
.criterion.met { border-left-color: #239873; }
.criterion.not-met { border-left-color: #c98b31; }
.criterion.unknown { border-left-color: #84969a; }
.clinical-warning { padding: .85rem 1rem; border-left: 4px solid #b36b2c; color: #68461f; background: #fff5e8; line-height: 1.45; }
.treatment-alert { display: grid; gap: .25rem; margin-bottom: 1rem; padding: .85rem 1rem; border-left: 5px solid; border-radius: .6rem; }
.treatment-alert.ready { border-color: #239873; color: #075c48; background: #e5f5ef; }
.treatment-alert.blocked { border-color: #be553f; color: #812e20; background: #f9e6e2; }
.treatment-grid { margin-top: .8rem; }
.protocol-plan { padding: .8rem; border-radius: .65rem; background: var(--soft); line-height: 1.45; }
.reference-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: .8rem; }
.reference-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.reference-table th, .reference-table td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.reference-table th { color: var(--brand-dark); background: var(--soft); font-size: .8rem; }
.reference-table tr:last-child td { border-bottom: 0; }
.reference-table tr.normal td:first-child { border-left: 5px solid #239873; }
.reference-table tr.abnormal td:first-child { border-left: 5px solid #be553f; }
.reference-table tr.unknown td:first-child { border-left: 5px solid #84969a; }
.reference-value { font-weight: 850; white-space: nowrap; }
.reference-status { display: inline-block; margin-top: .25rem; padding: .18rem .42rem; border-radius: 999px; font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.reference-status.normal { color: #075c48; background: #dff4ed; }
.reference-status.abnormal { color: #8b3324; background: #f9e3de; }
.reference-status.unknown { color: #52676b; background: #e8eeee; }
.result { margin-top: 1.3rem; padding: 1rem; border-radius: .8rem; color: var(--brand-dark); background: var(--soft); line-height: 1.5; }
.result strong { display: block; font-size: 1.35rem; }
.result span, .result small { display: block; margin-top: .25rem; }
.result small { color: var(--muted); }
.measurements { display: grid; gap: .7rem; }
.measurement-row { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: .7rem; align-items: end; margin: 0; padding: .8rem; border: 1px solid var(--line); border-radius: .8rem; }
.measurement-number { align-self: center; color: var(--brand); font-weight: 850; }
.method-hint { margin: 0; color: var(--muted); font-size: .9rem; }
.remove-measurement { min-width: 2.8rem; min-height: 2.8rem; border: 1px solid var(--line); border-radius: .65rem; color: #a12f2f; background: white; cursor: pointer; font-weight: 800; }
.remove-measurement:disabled { cursor: not-allowed; opacity: .35; }
.remove-measurement { min-width: 2.8rem; min-height: 2.8rem; border: 1px solid var(--line); border-radius: .65rem; color: #a12f2f; background: white; cursor: pointer; font-weight: 800; }
.form-actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.soft-section { max-width: none; padding-right: max(1rem, calc((100vw - 1180px) / 2)); padding-left: max(1rem, calc((100vw - 1180px) / 2)); background: var(--soft); }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.info-grid article { padding: 1.3rem; border-radius: 1rem; background: white; }
.info-grid p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }

footer { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; padding: 1.5rem max(1rem, calc((100vw - 1180px) / 2)); color: var(--muted); background: #e3efed; font-size: .85rem; }
.footer-disclaimer { max-width: 900px; line-height: 1.45; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 800px) {
  .site-header { flex-wrap: wrap; }
  .menu-button { display: block; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .6rem; color: var(--brand); background: white; font-weight: 750; }
  nav { display: none; flex-basis: 100%; flex-direction: column; }
  nav.open { display: flex; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 3.5rem; }
  .tool-grid, .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .brand small { display: none; }
  .hero { padding-bottom: 3rem; }
  h1 { font-size: 2.7rem; }
  .section { padding-top: 3.5rem; padding-bottom: 3.5rem; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .search input { width: 100%; }
  .tool-grid, .info-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
  .measurement-row { grid-template-columns: 1fr; }
  .form-columns { grid-template-columns: 1fr; }
  .clinical-grid, .data-summary, .result-grid { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .remove-measurement { width: 100%; }
}

@media (min-width: 561px) and (max-width: 900px) {
  .clinical-grid, .data-summary, .result-grid { grid-template-columns: 1fr 1fr; }
}
