.emt-cmed-lab {
  --cmed-ink: #e6f2f3;
  --cmed-muted: #afc4ce;
  --cmed-line: rgba(142, 195, 210, 0.25);
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: clamp(14px, 2.5vw, 24px);
  border: 1px solid rgba(103, 197, 207, 0.32);
  border-radius: 14px;
  background: radial-gradient(circle at 92% 0%, rgba(111, 195, 194, 0.16), transparent 31%), #101d29;
  color: var(--cmed-ink);
}
.emt-cmed-lab * { box-sizing: border-box; }
.emt-cmed-lab :is(h3, h4, h5, p, ul, ol, pre) { margin: 0; }
.emt-cmed-lab p { line-height: 1.5; }
.emt-cmed-lab :is(button, select, input):focus-visible { outline: 2px solid #a5edee; outline-offset: 3px; }
.emt-cmed-lab button { min-height: 42px; font: inherit; cursor: pointer; }
.emt-cmed-lab button:disabled { opacity: 0.48; cursor: not-allowed; }
.emt-cmed-head { display: grid; gap: 8px; max-width: 87ch; }
.emt-cmed-eyebrow,
.emt-cmed-panel-kicker { color: #80cfd0; font-size: 0.66rem; font-weight: 850; letter-spacing: 0.12em; }
.emt-cmed-head h3 { font-size: clamp(1.2rem, 2.3vw, 1.52rem); line-height: 1.2; }
.emt-cmed-head p,
.emt-cmed-timeline > p,
.emt-cmed-sources { color: var(--cmed-muted); font-size: 0.84rem; }

.emt-cmed-case-picker,
.emt-cmed-med-tabs { display: grid; gap: 9px; }
.emt-cmed-case-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.emt-cmed-med-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.emt-cmed-case-button,
.emt-cmed-med-button {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--cmed-line);
  border-radius: 9px;
  background: rgba(20, 45, 57, 0.9);
  color: #d2e6e9;
  font-size: 0.82rem !important;
  font-weight: 760 !important;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
}
.emt-cmed-case-button[aria-pressed="true"],
.emt-cmed-med-button[aria-pressed="true"] {
  border-color: #7fd8ce;
  box-shadow: inset 0 0 0 1px rgba(127, 216, 206, 0.25);
  background: rgba(59, 143, 150, 0.25);
  color: #f4fbf9;
}

.emt-cmed-stage { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 12px; align-items: start; }
.emt-cmed-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: clamp(12px, 2vw, 18px);
  border: 1px solid var(--cmed-line);
  border-radius: 11px;
  background: #0c1c2a;
}
.emt-cmed-patient { border-top: 3px solid #79d5b3; }
.emt-cmed-patient[data-state="changed"] { border-top-color: #eda08b; }
.emt-cmed-protocol { border-top: 3px solid #87b9e4; }
.emt-cmed-panel h4,
.emt-cmed-timeline h4 { font-size: 0.99rem; }
.emt-cmed-panel h5,
.emt-cmed-timeline h5 { font-size: 0.83rem; }

.emt-cmed-patient-top {
  display: grid;
  grid-template-columns: minmax(116px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 182px;
  padding: 12px;
  border: 1px solid rgba(125, 184, 202, 0.18);
  border-radius: 9px;
  background: radial-gradient(circle at 12% 35%, rgba(95, 177, 156, 0.12), transparent 45%), #0a1723;
}
.emt-cmed-patient[data-state="changed"] .emt-cmed-patient-top { background: radial-gradient(circle at 12% 35%, rgba(222, 135, 113, 0.13), transparent 45%), #0a1723; }
.emt-cmed-person { position: relative; height: 138px; min-width: 100px; }
.emt-cmed-person-head,
.emt-cmed-person-body,
.emt-cmed-person-pulse { position: absolute; }
.emt-cmed-person-head { top: 5px; left: 50%; width: 37px; height: 37px; transform: translateX(-50%); border: 2px solid #9bdbc1; border-radius: 50%; background: rgba(113, 207, 166, 0.24); }
.emt-cmed-person-body { top: 47px; bottom: 5px; left: 18%; right: 18%; border: 2px solid #8ccfb8; border-radius: 33px 33px 13px 13px; background: linear-gradient(160deg, rgba(125, 221, 174, 0.24), rgba(72, 154, 169, 0.04)); }
.emt-cmed-person-body::after { content: "♥"; position: absolute; top: 17px; left: 47%; color: #efbd83; font-size: 1.1rem; }
.emt-cmed-person-pulse { top: 68px; right: 0; width: 45px; height: 26px; border-top: 2px solid #83e0bb; border-right: 2px solid #83e0bb; transform: skewY(-17deg); }
.emt-cmed-person-pulse::after { content: ""; position: absolute; right: 0; top: -11px; width: 13px; height: 13px; border-right: 2px solid #83e0bb; border-bottom: 2px solid #83e0bb; transform: rotate(45deg); }
.emt-cmed-patient[data-state="changed"] .emt-cmed-person-head,
.emt-cmed-patient[data-state="changed"] .emt-cmed-person-body { border-color: #e9a392; background-color: rgba(219, 114, 101, 0.18); }
.emt-cmed-patient-summary { display: grid; gap: 8px; min-width: 0; }
.emt-cmed-patient-summary strong { font-size: 0.86rem; }
.emt-cmed-patient-summary ul { display: grid; gap: 5px; padding-left: 0; list-style: none; color: #d5e5e8; font-size: 0.77rem; }
.emt-cmed-patient-summary li { overflow-wrap: anywhere; }
.emt-cmed-patient-summary li .emt-cmed-source { color: #85cdd1; font-weight: 800; }
.emt-cmed-moment-label { display: grid; grid-template-columns: 1fr auto; gap: 7px; color: #cfe1e5; font-size: 0.78rem; font-weight: 750; }
.emt-cmed-moment-label output { color: #86d9d6; font-variant-numeric: tabular-nums; }
.emt-cmed-moment-label input { grid-column: 1 / -1; width: 100%; min-height: 27px; accent-color: #70cebc; }
.emt-cmed-ticks { display: flex; justify-content: space-between; color: #8ea9b5; font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.emt-cmed-evidence-head { display: grid; gap: 4px; }
.emt-cmed-evidence-head p { color: #a7c0c9; font-size: 0.75rem; }
.emt-cmed-evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.emt-cmed-evidence-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: start;
  gap: 3px 7px;
  min-width: 0;
  min-height: 85px !important;
  padding: 10px;
  border: 1px solid rgba(135, 192, 207, 0.26);
  border-left: 3px solid #8eacb6;
  border-radius: 7px;
  background: rgba(21, 42, 53, 0.76);
  color: #dce9eb;
  text-align: left;
}
.emt-cmed-evidence-card[data-status="clear"] { border-left-color: #7ad8a9; background: rgba(42, 121, 92, 0.13); }
.emt-cmed-evidence-card[data-status="concern"] { border-left-color: #ef9d88; background: rgba(177, 81, 65, 0.17); }
.emt-cmed-evidence-name { font-size: 0.75rem; font-weight: 760; }
.emt-cmed-evidence-state { color: #92bdc5; font-size: 0.58rem; font-weight: 850; letter-spacing: 0.06em; text-align: right; }
.emt-cmed-evidence-card[data-status="clear"] .emt-cmed-evidence-state { color: #83daad; }
.emt-cmed-evidence-card[data-status="concern"] .emt-cmed-evidence-state { color: #f0a991; }
.emt-cmed-evidence-card small { grid-column: 1 / -1; color: #b7ccd0; font-size: 0.68rem; line-height: 1.4; overflow-wrap: anywhere; }

.emt-cmed-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(136, 183, 222, 0.34);
  border-radius: 9px;
  background: linear-gradient(120deg, rgba(60, 100, 143, 0.26), rgba(56, 89, 117, 0.07));
}
.emt-cmed-card[data-medication="nitro"] { border-color: rgba(208, 161, 118, 0.42); background: linear-gradient(120deg, rgba(137, 96, 47, 0.25), rgba(76, 78, 92, 0.06)); }
.emt-cmed-card-icon { display: grid; place-items: center; width: 46px; height: 58px; border: 2px solid #a7c9e6; border-radius: 8px; color: #c1e7f2; font-size: 1.5rem; font-weight: 800; }
.emt-cmed-card[data-medication="nitro"] .emt-cmed-card-icon { border-color: #e2b381; color: #f0cca2; }
.emt-cmed-card-copy { display: grid; gap: 5px; min-width: 0; }
.emt-cmed-card-copy strong { font-size: 0.9rem; }
.emt-cmed-card-copy p { color: #c2d8df; font-size: 0.73rem; }
.emt-cmed-card-copy p:last-child { color: #a7bdc8; }
.emt-cmed-controls { display: grid; gap: 8px; }
.emt-cmed-field { display: grid; gap: 5px; color: #c7dde1; font-size: 0.75rem; font-weight: 740; }
.emt-cmed-field select { width: 100%; min-width: 0; min-height: 38px; padding: 7px 9px; border: 1px solid rgba(135, 185, 205, 0.35); border-radius: 6px; background: #102b3a; color: #e3f1f3; font: inherit; font-size: 0.75rem; }
.emt-cmed-dose-note { padding: 10px 12px; border-left: 3px solid #eab986; border-radius: 5px; background: rgba(177, 121, 65, 0.11); color: #ead4b9; font-size: 0.72rem; }

.emt-cmed-decision { display: grid; gap: 10px; }
.emt-cmed-decision-banner { display: grid; gap: 4px; padding: 13px 15px; border: 1px solid rgba(240, 192, 120, 0.38); border-left: 4px solid #e8be7e; border-radius: 8px; background: rgba(176, 129, 67, 0.11); }
.emt-cmed-decision-banner[data-status="hold"] { border-color: rgba(236, 144, 121, 0.42); border-left-color: #ed9d86; background: rgba(167, 72, 63, 0.15); }
.emt-cmed-decision-banner[data-status="review"] { border-color: rgba(127, 217, 172, 0.36); border-left-color: #85dcae; background: rgba(65, 152, 103, 0.12); }
.emt-cmed-decision-banner strong { font-size: 0.89rem; }
.emt-cmed-decision-banner p { color: #d8e4e5; font-size: 0.76rem; }
.emt-cmed-gate-rail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.emt-cmed-gate { display: grid; gap: 2px; min-width: 0; padding: 10px; border: 1px solid rgba(140, 188, 203, 0.25); border-top: 3px solid #819aa5; border-radius: 7px; background: #112633; }
.emt-cmed-gate[data-status="clear"] { border-top-color: #80d8a8; }
.emt-cmed-gate[data-status="concern"] { border-top-color: #efa28d; }
.emt-cmed-gate span { color: #8caeb8; font-size: 0.64rem; font-weight: 800; }
.emt-cmed-gate strong { font-size: 0.73rem; overflow-wrap: anywhere; }
.emt-cmed-issue-list { display: grid; gap: 6px; max-height: 205px; overflow-y: auto; padding: 10px 12px 10px 27px; border: 1px solid rgba(137, 184, 200, 0.2); border-radius: 7px; background: rgba(5, 20, 29, 0.43); color: #c4d7dc; font-size: 0.73rem; line-height: 1.45; }
.emt-cmed-issue-list li { overflow-wrap: anywhere; }

.emt-cmed-timeline { display: grid; gap: 10px; padding-top: 3px; }
.emt-cmed-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.emt-cmed-actions button { flex: 1 1 160px; min-width: 0; padding: 8px 12px; }
.emt-cmed-events { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 9px; padding: 0; list-style: none; }
.emt-cmed-event,
.emt-cmed-empty { min-width: 0; min-height: 75px; padding: 11px; border: 1px solid rgba(126, 187, 202, 0.23); border-left: 3px solid #80caca; border-radius: 7px; background: rgba(12, 36, 48, 0.87); }
.emt-cmed-event[data-type="no-medication"] { border-left-color: #efaa8c; }
.emt-cmed-event[data-type="draft"] { border-left-color: #e8be7e; }
.emt-cmed-event-time { color: #9dc6ca; font-size: 0.68rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.emt-cmed-event p,
.emt-cmed-empty { color: #cbdfe1; font-size: 0.73rem; line-height: 1.45; overflow-wrap: anywhere; }
.emt-cmed-handoff { white-space: pre-wrap; overflow-wrap: anywhere; padding: 13px; border: 1px solid rgba(138, 188, 205, 0.25); border-radius: 7px; background: #081925; color: #d3e2e7; font: 0.72rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.emt-cmed-scope { color: #ebcba8; font-size: 0.74rem; }
.emt-cmed-sources a { color: #97d4ee; }
.emt-cmed-live { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 960px) {
  .emt-cmed-stage { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .emt-cmed-case-picker { grid-template-columns: 1fr; }
  .emt-cmed-gate-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emt-cmed-patient-top { grid-template-columns: 105px minmax(0, 1fr); }
}
@media (max-width: 390px) {
  .emt-cmed-med-tabs { grid-template-columns: 1fr; }
  .emt-cmed-patient-top { grid-template-columns: 1fr; }
  .emt-cmed-person { height: 95px; }
  .emt-cmed-person-head { width: 28px; height: 28px; }
  .emt-cmed-person-body { top: 34px; }
  .emt-cmed-person-pulse { top: 50px; }
  .emt-cmed-evidence-grid { grid-template-columns: 1fr; }
  .emt-cmed-card { grid-template-columns: 40px minmax(0, 1fr); }
  .emt-cmed-card-icon { width: 38px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .emt-cmed-lab *, .emt-cmed-lab *::before, .emt-cmed-lab *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
