:root {
  --ink: #142c30;
  --muted: #4c6265;
  --line: #d8e2e1;
  --surface: #ffffff;
  --page: #f3f7f6;
  --teal: #087066;
  --teal-dark: #06554d;
  --teal-wash: #e4f3ee;
  --amber-ink: #693709;
  --amber-line: #e4caa4;
  --amber-wash: #fff3e2;
  --red: #962f35;
  --red-line: #ecd1d2;
  --red-wash: #fdf0f0;
  --radius: 15px;
  font-family: Inter, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 280px; margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal-dark); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #258b7d;
  outline-offset: 3px;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.18; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 5; top: 9px; left: 9px; padding: 12px; background: white; border-radius: 8px; }
.container { width: min(100% - 72px, 1160px); margin-inline: auto; }

.site-header { background: #102a2b; color: #f6fffc; }
.header-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.header-inner { min-height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 17px; font-weight: 720; letter-spacing: -.025em; }
.brand-icon { width: 33px; height: 33px; border-radius: 10px; background: #b8e8d7; color: #0c554a; position: relative; }
.brand-icon::before, .brand-icon::after { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); border-radius: 2px; background: currentColor; content: ''; }
.brand-icon::before { width: 14px; height: 4px; }
.brand-icon::after { width: 4px; height: 14px; }
.header-nav { display: flex; align-items: center; gap: 23px; }
.header-nav a { color: #d3e9e3; font-size: 14px; font-weight: 630; text-decoration: none; padding-block: 13px; white-space: nowrap; }
.header-nav a:hover { text-decoration: underline; color: white; }
.header-nav .nav-calculator { color: white; }
.external-arrow { position: relative; display: inline-block; width: 9px; height: 9px; color: currentColor; }
.external-arrow::before { content: ''; position: absolute; top: 0; right: 0; width: 6px; height: 6px; border-top: 1.5px solid; border-right: 1.5px solid; }
.external-arrow::after { content: ''; position: absolute; left: 0; top: 4px; width: 10px; height: 1.5px; background: currentColor; transform: rotate(-45deg); }

.page { padding-top: 43px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
h1 { font-size: clamp(2.125rem, 4.1vw, 3.375rem); font-weight: 765; letter-spacing: -.054em; }
.intro-copy { margin-top: 10px; color: var(--muted); font-size: clamp(.97rem, 1.75vw, 1.12rem); line-height: 1.47; }
.byline { margin-top: 8px; color: var(--teal-dark); font-size: 13px; font-weight: 650; line-height: 1.4; }
.outline-link { flex-shrink: 0; display: inline-flex; align-items: center; gap: 9px; min-height: 43px; padding: 9px 13px; border: 1px solid #a9c6c1; border-radius: 9px; background: var(--surface); font-size: 13px; font-weight: 720; text-decoration: none; }
.outline-link:hover { background: var(--teal-wash); }

.notice { display: flex; gap: 12px; align-items: start; padding: 13px 16px; border: 1px solid var(--amber-line); background: var(--amber-wash); color: var(--amber-ink); border-radius: 11px; margin-bottom: 24px; }
.notice-icon { display: inline-grid; place-items: center; width: 21px; height: 21px; border: 1.5px solid currentColor; border-radius: 50%; flex: 0 0 21px; font-size: 13px; font-weight: 800; margin-top: 1px; }
.notice h2 { font-size: 15px; }
.notice p { margin-top: 4px; font-size: 13px; line-height: 1.45; }
.notice p + p { margin-top: 7px; }
.no-script { padding: 15px; border: 1px solid var(--red-line); background: var(--red-wash); margin-bottom: 16px; }

.workspace { display: grid; grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); align-items: start; gap: 23px; scroll-margin-top: 18px; }
.patient-column { display: grid; gap: 14px; position: sticky; top: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 9px #18373607; }
.patient-panel { padding: 20px; }
.patient-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin-bottom: 18px; }
.patient-heading h2 { font-size: 20px; letter-spacing: -.033em; }
.patient-heading p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.text-button { color: var(--teal-dark); background: none; border: 0; padding: 0 0 4px 4px; font-size: 12px; font-weight: 730; white-space: nowrap; min-height: 28px; }
.text-button:hover { text-decoration: underline; }
.field { margin-bottom: 15px; }
.field label, .habitus-field label { display: block; font-size: 13px; font-weight: 720; margin-bottom: 6px; }
.joined { display: flex; align-items: stretch; border: 1px solid #a9bdbb; border-radius: 9px; background: white; min-height: 47px; }
.joined:focus-within, .search-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 2px #0870663b; }
.joined input, .joined select { border: 0; background: transparent; color: var(--ink); border-radius: 8px; }
.joined input { min-width: 0; width: 100%; padding: 10px 11px; }
.joined select { min-width: 91px; margin: 5px 4px 5px 0; padding: 4px 8px; background: #eff5f3; font-size: 14px; font-weight: 650; }
input::placeholder { color: #617578; opacity: 1; }
.input-suffix { padding: 0 13px; display: grid; place-content: center; color: var(--muted); font-size: 14px; font-weight: 730; }
.field .sub-label { margin-top: 13px; }
.standalone { width: 100%; min-height: 43px; padding: 7px 9px; border: 1px solid #a9bdbb; border-radius: 8px; background: white; color: var(--ink); font-size: 14px; }
.field-help, .field-error { font-size: 12px; line-height: 1.43; margin-top: 6px; }
.field-help { color: var(--muted); }
.field-error { color: var(--red); font-weight: 660; }
.estimate-panel { margin-top: 10px; padding: 0 9px 9px; border: 1px solid #d4e2dd; border-radius: 8px; background: #f3f8f6; }
.field .estimate-label { display: flex; align-items: center; gap: 8px; min-height: 42px; margin: 0; cursor: pointer; }
.estimate-label input { flex: 0 0 auto; width: 17px; height: 17px; margin: 0; accent-color: var(--teal-dark); }
.estimate-label:has(input:disabled) { color: var(--muted); cursor: default; }
.estimate-panel .field-help { margin-top: 0; }
#estimated-weight { display: block; margin: 0 0 7px; color: var(--amber-ink); font-size: 13px; font-weight: 750; }
.joined.invalid { border-color: var(--red); }
.form-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.primary-button, .clear-button { min-height: 44px; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 730; }
.primary-button { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--teal); color: white; text-align: left; }
.primary-button:hover { background: var(--teal-dark); }
.primary-button span { font-size: 19px; line-height: 1; }
.clear-button { background: #eef4f2; color: var(--ink); }
.clear-button:hover { background: #dcebe7; }
.regional-panel { background: #e9f2ef; border: 1px solid #d4e2dd; border-radius: 12px; padding: 13px 17px; }
.regional-panel h2 { font-size: 13px; margin-bottom: 3px; }
.regional-panel a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 35px; text-decoration: none; font-size: 13px; font-weight: 650; }
.regional-panel a + a { border-top: 1px solid #d5e3de; }
.regional-panel a:hover { text-decoration: underline; }

.dose-column { min-width: 0; }
.mode-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 5px; background: #e3ece9; border: 1px solid #d4e2dd; border-radius: 12px; scroll-margin-top: 12px; }
.mode { min-height: 45px; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 8px 6px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-size: 15px; font-weight: 740; }
.mode:hover { background: #f5faf8; }
.mode[aria-pressed='true'] { background: white; color: var(--teal-dark); border-color: #d7e4e0; box-shadow: 0 1px 3px #112b2c14; }
.mode#emergency[aria-pressed='true'] { color: var(--red); border-color: var(--red-line); background: var(--red-wash); }
.mode-icon { display: inline-grid; place-items: center; flex: 0 0 15px; width: 15px; height: 15px; border: 1.5px solid currentColor; border-radius: 4px; line-height: 1; }
.theatre-icon { position: relative; }
.theatre-icon::before, .theatre-icon::after { content: ''; position: absolute; width: 7px; height: 1.5px; background: currentColor; border-radius: 1px; }
.theatre-icon::after { transform: rotate(90deg); }
.emergency-icon { font-size: 10px; font-weight: 850; border-radius: 50%; }
.search-box { margin-top: 11px; display: flex; align-items: center; gap: 10px; border: 1px solid #bdcecb; border-radius: 9px; background: white; padding-inline: 13px; }
.search-box input { min-width: 0; width: 100%; min-height: 44px; background: transparent; border: 0; padding: 7px 0; color: var(--ink); }
.search-box input:focus { outline: none; }
.search-icon { flex: 0 0 13px; width: 13px; height: 13px; border: 1.5px solid #557171; border-radius: 50%; position: relative; margin-right: 2px; }
.search-icon::after { content: ''; width: 5px; height: 1.5px; background: #557171; position: absolute; bottom: -2px; right: -4px; transform: rotate(45deg); border-radius: 2px; }
.category-buttons { display: flex; flex-wrap: wrap; gap: 7px; padding-block: 11px; }
.category-buttons[hidden] + #results { margin-top: 11px; }
.category-button { min-height: 38px; padding: 6px 12px; border: 1px solid #ccdcda; background: white; color: var(--muted); border-radius: 20px; font-size: 13px; font-weight: 690; }
.category-button:hover { color: var(--teal-dark); border-color: #83b4a9; }
.category-button[aria-pressed='true'] { color: white; background: var(--teal-dark); border-color: var(--teal-dark); }
.results-banner { display: flex; align-items: center; gap: 10px; border: 1px solid #d6e3df; background: #eaf1ef; border-radius: 9px; padding: 9px 12px; }
.results-banner strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.results-banner p { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.results-banner.calculated { background: var(--teal-wash); border-color: #b5d9ce; }
.results-banner.estimated { background: var(--amber-wash); border-color: var(--amber-line); }
.results-banner.estimated .banner-indicator { background: var(--amber-ink); }
.banner-indicator { width: 9px; height: 9px; border-radius: 50%; background: #687e7c; flex: 0 0 9px; }
.calculated .banner-indicator { background: var(--teal); }
.example-marker { margin-left: auto; border-radius: 15px; background: white; color: var(--teal-dark); padding: 5px 8px; font-size: 11px; font-weight: 730; white-space: nowrap; }
.weight-notice { color: var(--amber-ink); background: var(--amber-wash); border: 1px solid var(--amber-line); border-radius: 8px; font-size: 13px; line-height: 1.45; padding: 9px 12px; margin-top: 8px; }
.drug-section { margin-top: 19px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 8px 1px; }
.section-heading h3 { font-size: 20px; letter-spacing: -.027em; }
.section-link { font-size: 12px; font-weight: 700; flex-shrink: 0; min-height: 33px; display: inline-flex; align-items: center; gap: 4px; }
.drug-list { display: grid; gap: 8px; }
.drug-card { border: 1px solid var(--line); border-radius: 11px; background: white; min-width: 0; overflow: clip; }
.drug-card.critical { border-left: 3px solid #b33d43; }
.drug-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 23%); gap: 12px; padding: 11px 13px 3px; }
.drug-row.has-volume { grid-template-columns: minmax(0, 1fr) minmax(0, 23%) minmax(0, 28%); }
.drug-name { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.drug-name h4 { font-size: 17px; letter-spacing: -.025em; }
.drug-label { padding: 3px 6px; border-radius: 4px; color: #161b20; }
.colour-induction { background: #ffe800; }
.colour-opioid { background: #71c5e8; }
.colour-relaxant { background: #ff7477; }
.colour-depolarising { background: #ff7477; border-top: 4px solid #171b1d; }
.colour-antiemetic { background: #efbe7d; }
.colour-anticholinergic { background: #a4d65e; }
.colour-vasopressor { background: #d0b5e5; }
.colour-benzodiazepine { background: #ffc28a; }
.colour-reversal { background: repeating-linear-gradient(135deg, #ffe3e3 0 5px, #ffffff 5px 10px); outline: 1px solid #e4a2a5; outline-offset: -1px; }
.route, .drug-tag { align-self: center; padding: 2px 5px; border-radius: 5px; font-size: 11px; font-weight: 760; white-space: nowrap; line-height: 1.35; }
.route { color: #335653; background: #e9f2ef; }
.critical .route { color: var(--red); background: var(--red-wash); }
.drug-tag { color: var(--amber-ink); background: var(--amber-wash); }
.indication { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 4px; }
.drug-result, .drug-volume { display: flex; flex-direction: column; align-items: start; gap: 4px; min-width: 0; font-variant-numeric: tabular-nums; }
.drug-volume { padding-left: 10px; border-left: 1px solid #dce7e4; }
.result-label { color: var(--muted); font-size: 11px; font-weight: 750; line-height: 1.3; }
.dose-value { font-size: clamp(1.06rem, 2.15vw, 1.43rem); font-weight: 780; line-height: 1.14; letter-spacing: -.022em; color: var(--teal-dark); }
.critical .dose-value { color: var(--red); }
.reference-rule { color: #496362; font-size: 13px; font-weight: 700; }
.cap-label, .review-label { font-size: 11px; color: var(--amber-ink); font-weight: 740; background: var(--amber-wash); border-radius: 5px; padding: 3px 6px; }
.limit-label { font-size: 11px; color: var(--muted); font-weight: 700; }
.volume-result { display: flex; flex-direction: column; gap: 3px; }
.volume-result:empty { display: none; }
.volume-value { font-size: clamp(1.04rem, 1.85vw, 1.25rem); line-height: 1.13; letter-spacing: -.025em; }
.volume-strength, .volume-caution { color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.volume-caution { color: var(--amber-ink); }
.preparation-select { width: 100%; min-height: 37px; border: 1px solid #adc3be; border-radius: 6px; padding: 4px 6px; background: #f4f8f6; color: var(--ink); font-size: 13px; }
.drug-schedule { margin: 6px 13px 0; display: grid; gap: 3px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.drug-schedule .extra-note { margin: 0; font-weight: 700; }
.drug-caution { color: var(--amber-ink); }
.drug-details { margin-inline: 13px; }
.drug-details summary { display: list-item; width: fit-content; max-width: 100%; padding: 7px 2px 8px; font-size: 12px; color: var(--teal-dark); font-weight: 700; cursor: pointer; }
.drug-details summary::marker { font-size: .86em; }
.drug-details summary:hover { text-decoration: underline; }
.detail-body { border-top: 1px solid var(--line); padding-block: 9px 11px; color: var(--muted); font-size: 13px; line-height: 1.46; }
.rule-line { margin-bottom: 4px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.extra-note { margin-top: 7px; color: var(--ink); }
.prep-note { margin-top: 7px; padding: 7px 8px; border-radius: 7px; background: #eef5f3; color: var(--ink); }
.review-message, .habitus-field { margin: 7px 13px; }
.review-message { border-radius: 7px; background: var(--amber-wash); padding: 7px 9px; color: var(--amber-ink); font-size: 13px; line-height: 1.4; }
.habitus-field { max-width: 320px; }
.source-links, .reference-links { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.source-links { margin-top: 8px; }
.source-links a, .reference-links a { font-size: 12px; font-weight: 700; }
.no-results { border: 1px solid var(--line); border-radius: 11px; background: white; padding: 18px; margin-top: 16px; }
.no-results h3 { font-size: 17px; margin-bottom: 5px; }
.no-results p { font-size: 14px; color: var(--muted); line-height: 1.45; }

.references { border-top: 1px solid #cadbd8; margin-top: 32px; padding: 23px 0 29px; scroll-margin-top: 18px; }
.references h2 { font-size: 24px; letter-spacing: -.032em; margin-bottom: 15px; }
.reference-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.reference-grid > div { border: 1px solid var(--line); border-radius: 11px; background: white; padding: 13px; }
.reference-grid h3 { font-size: 15px; margin-bottom: 7px; }
.reference-grid p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.reference-grid p + p, .reference-links { margin-top: 7px; }
.site-footer { border-top: 1px solid #d7e4e1; color: var(--muted); background: #eaf1ef; }
.footer-inner { min-height: 55px; font-size: 12px; }

@media (max-width: 920px) {
  .container { width: min(100% - 44px, 1160px); }
  .workspace { grid-template-columns: minmax(245px, 290px) minmax(0, 1fr); gap: 15px; }
  .patient-panel { padding: 15px; }
}

@media (max-width: 1020px) {
  .drug-row.has-volume { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 10px; row-gap: 8px; }
  .has-volume .drug-info { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .container { width: calc(100% - 30px); }
  .header-inner { min-height: 54px; }
  .header-nav { gap: 12px; }
  .header-nav a { font-size: 13px; }
  .nav-calculator { display: none; }
  .brand { font-size: 16px; }
  .brand-icon { width: 30px; height: 30px; }
  .page { padding-top: 24px; }
  .intro { display: block; margin-bottom: 16px; }
  .intro-copy { margin-top: 8px; }
  .outline-link { margin-top: 11px; }
  .notice { margin-bottom: 15px; padding: 10px; gap: 9px; }
  .notice p { font-size: 12px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .patient-column { display: contents; }
  .patient-panel { grid-row: 1; }
  .dose-column { grid-row: 2; }
  .regional-panel { grid-row: 3; }
  .patient-heading { margin-bottom: 12px; }
  .text-button { min-height: 44px; }
  .standalone, .joined select { font-size: 16px; }
  .preparation-select { font-size: 16px; min-height: 44px; }
  .category-button { min-height: 44px; }
  .drug-details summary { min-height: 44px; padding-top: 12px; }
  .references { margin-top: 22px; }
  .reference-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-inner { align-items: flex-start; justify-content: center; flex-direction: column; gap: 4px; padding-block: 12px; }
}

@media (max-width: 420px) {
  .mode { padding-inline: 4px; font-size: 13px; }
  .mode-icon { display: none; }
  .category-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-button { padding-inline: 6px; }
  .drug-row:not(.has-volume) { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .has-volume .drug-volume:has(.preparation-select) { grid-column: 1 / -1; border-left: 0; padding: 6px 0 0; border-top: 1px solid #dce7e4; }
  .drug-details { margin-inline: 0; }
  .drug-details { padding-inline: 13px; }
  .dose-value { font-size: 1.32rem; }
  .header-inner { gap: 6px; }
  .section-heading h3 { font-size: 18px; }
}

@media (max-width: 355px) {
  .dose-value { font-size: 1.14rem; }
}

@media print {
  body { background: white; }
  .container { width: 100%; }
  .site-header { background: white; color: var(--ink); }
  .header-nav, .outline-link, .workspace { display: none; }
  .notice, .references { break-inside: avoid; }
}
