:root {
  --bg: #070b0f;
  --panel: #10161d;
  --panel-2: #161d25;
  --line: #2b3642;
  --muted: #8e9aa8;
  --text: #f4f7fa;
  --gold: #ef233c;
  --cyan: #1fd8dd;
  --blue: #2897ff;
  --danger: #ff6f73;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: #070b0f; }
button, input, select { font: inherit; }
button { color: inherit; }
.topbar { height: 72px; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(11,14,18,.9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: #fff; font-weight: 900; background: linear-gradient(135deg, #fa344d, #df102a); box-shadow: 0 8px 26px rgba(239,35,60,.22); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-actions { display: flex; gap: 10px; }
.button { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; cursor: pointer; transition: .18s ease; font-weight: 700; font-size: 13px; }
.button:hover { transform: translateY(-1px); border-color: #435061; }
.button.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.button.secondary { background: var(--panel-2); }
.file-button input { display: none; }
.workspace { height: calc(100vh - 72px); display: grid; grid-template-columns: clamp(240px, 22vw, 290px) minmax(480px, 1fr) clamp(320px, 28vw, 390px); overflow: hidden; }
.panel { background: rgba(18,23,29,.92); }
.catalog-panel { border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; max-height: calc(100vh - 72px); position: sticky; top: 72px; }
.editor-panel { border-left: 1px solid var(--line); padding: 20px; overflow-y: auto; max-height: calc(100vh - 72px); position: sticky; top: 72px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 16px; }
.count, .status { padding: 3px 8px; border-radius: 99px; font-size: 11px; color: var(--gold); background: rgba(245,185,40,.1); }
.search { height: 40px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 0 11px; border-radius: 9px; color: var(--muted); background: #0c1015; }
.search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.filter-row { display: flex; gap: 7px; margin: 12px 0 14px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 5px 10px; font-size: 11px; cursor: pointer; }
.chip.active { background: #2b333d; border-color: #455160; }
.parameter-library { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 3px; }
.parameter-card { width: 100%; padding: 11px; margin-bottom: 8px; text-align: left; border: 1px solid transparent; border-radius: 10px; background: #171d24; cursor: pointer; }
.parameter-card { position: relative; }
.saved-delete { position: absolute; right: 9px; top: 7px; padding: 2px 5px; color: var(--danger); font-size: 16px; }
.parameter-card:hover, .parameter-card.active { border-color: #526173; background: #1c242d; }
.parameter-card.selected { border-color: var(--cyan); box-shadow: inset 3px 0 0 var(--cyan), 0 0 0 1px rgba(31,216,221,.16); }
.parameter-card.active.selected { background: #202b34; }
.parameter-card[draggable="true"] { cursor: grab; }
.parameter-card.dragging { opacity: .45; cursor: grabbing; }
.parameter-card.drag-over { position: relative; }
.parameter-card.drag-over::before { content: ""; position: absolute; left: 5px; right: 5px; height: 3px; border-radius: 3px; background: var(--cyan); box-shadow: 0 0 8px rgba(31,216,221,.65); }
.parameter-card.drag-before::before { top: -6px; }
.parameter-card.drag-after::before { bottom: -6px; }
.parameter-card .name { font-size: 13px; font-weight: 750; }
.parameter-card .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-top: 5px; text-transform: uppercase; letter-spacing: .07em; }
.type-dot { color: var(--cyan); }
.add-button { margin-top: 12px; width: 100%; background: transparent; border-style: dashed; color: #dfe7ee; }
.device-stage { min-width: 0; display: grid; place-items: center; padding: 18px 26px; overflow: hidden; background: radial-gradient(ellipse at center, #121921 0, #070b0f 68%); }
.root-device { width: min(100%, 1100px); margin: auto; filter: drop-shadow(0 34px 55px rgba(0,0,0,.62)); }
/* The exact supplied 1375x1144 transparent PNG is displayed unchanged. */
.root-photo-frame { position: relative; width: 100%; aspect-ratio: 1375 / 1144; overflow: hidden; background: transparent; }
.root-photo { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; user-select: none; pointer-events: none; }

/* ============================================================
   ROOT PHYSICAL HOME BUTTON HIT TARGET
   Transparent overlay over the oval/square hardware button.
   ============================================================ */

#root-physical-home-button {
  position: absolute;

  left: 64.9%;
  top: 91.0%;

  width: 7.2%;
  height: 6.4%;

  z-index: 100;

  margin: 0;
  padding: 0;

  border: 0;
  border-radius: 50%;

  background: transparent;

  box-shadow: none;

  opacity: 0;

  cursor: pointer;
}

#root-physical-home-button:hover,
#root-physical-home-button:focus,
#root-physical-home-button:active {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  opacity: 0;
}

/* This separate HTML layer covers only the physical Root touchscreen. */
.root-screen-window { position: absolute; z-index: 2; left: 45.45%; top: 14.42%; width: 41.67%; height: 72.90%; display: grid; grid-template-rows: 11% 13% minmax(0, 1fr) 10%; overflow: hidden; color: #f5f5f5; border: 1px solid #171717; border-radius: 1px; background: linear-gradient(#222, #171717 13%, #202020 100%); box-shadow: inset 0 0 25px #000; font-family: "Segoe UI", Arial, sans-serif; }

.root-statusbar { min-height: 0; display: flex; align-items: center; gap: 1.5%; padding: 0 2%; color: #d7d7d7; border-bottom: 1px solid #202020; background: #050505; font-size: clamp(5px, .65vw, 9px); }
.root-statusbar span { opacity: .82; }
.root-statusbar .status-spacer { flex: 1; }
.root-statusbar b { padding: 1px 5%; border-radius: 12px; color: #dcf7ff; background: linear-gradient(#18bbed, #056e9c); font-size: .8em; }
.root-statusbar time { margin-left: 1%; }
.screen-header { min-height: 0; display: grid; grid-template-columns: 13% minmax(0, 1fr) 7%; align-items: center; padding: 0 2%; font-weight: 300; font-size: clamp(10px, 1.55vw, 21px); letter-spacing: -.02em; text-align: center; white-space: nowrap; background: linear-gradient(#222, #171717); }
.back-button { width: clamp(20px, 3vw, 36px); aspect-ratio: 1; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 2px solid #e9e9e9; background: #060606; font-weight: 900; font-size: clamp(13px, 2vw, 24px); line-height: 1; cursor: pointer; }
.signal { font-size: 7px; color: #64db8a; }
.patient-strip { min-height: 0; margin: 1.5% 2.5% 2%; padding: 2% 4%; display: grid; grid-template-columns: 1fr 1fr; align-items: center; border-radius: 7px; background: linear-gradient(#202020, #151515); border: 1px solid #2b2b2b; }
.patient-strip div { display: grid; }
.patient-strip small { color: #c1c1c1; font-size: clamp(7px, .9vw, 12px); }
.patient-strip span { font-size: clamp(8px, 1.15vw, 15px); }
.root-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #696969 #171717; padding: 0 2% 4%; }
.root-content::-webkit-scrollbar { width: 8px; }
.root-content::-webkit-scrollbar-track { background: #171717; }
.root-content::-webkit-scrollbar-thumb { border-radius: 6px; background: #666; border: 2px solid #171717; }
.root-section-title { position: sticky; top: 0; z-index: 3; color: #aaa; font-style: italic; font-weight: 700; border-bottom: 1px solid #555; padding: 1% 2%; background: #202020; font-size: clamp(7px, .9vw, 12px); }
.manual-row { min-height: clamp(31px, 3.6vw, 48px); display: grid; grid-template-columns: minmax(90px, .8fr) minmax(120px, 1.25fr); align-items: center; gap: 3%; padding: 1.5% 3%; }
.manual-label { text-align: right; font-size: clamp(8px, 1.15vw, 15px); font-weight: 300; }
.root-select, .root-value { min-height: clamp(24px, 2.8vw, 36px); width: 100%; border: 1px solid #4d4939; border-radius: 5px; color: #fff; background: linear-gradient(#3a3a3a, #0d0d0d 55%, #292929); box-shadow: inset 0 0 0 1px #111; padding: 2px 5%; text-align: center; font-size: clamp(8px, 1.1vw, 14px); }
.root-dropdown, .numeric-picker { position: relative; }
.root-dropdown-trigger, .root-value-button { cursor: pointer; }
.root-menu, .numeric-menu { display: none; position: absolute; z-index: 12; right: 0; top: calc(100% - 1px); width: 100%; max-height: min(245px, 42vh); overflow-y: auto; padding: 2px; border: 1px solid #625d4b; border-radius: 0 0 5px 5px; background: #171717; box-shadow: 0 12px 30px #000; }
.root-menu.open, .numeric-menu.open { display: grid; }
.root-menu button, .numeric-menu button { min-height: clamp(25px, 3vw, 39px); border: 1px solid #39352c; color: #fff; background: linear-gradient(#3a3a3a, #101010 58%, #292929); font-size: clamp(8px, 1.1vw, 14px); cursor: pointer; }
.root-menu button:hover, .numeric-menu button:hover { color: #18120a; background: linear-gradient(#ffc739, #e99c00); }
.slider-wrap { display: grid; grid-template-columns: 1fr 22%; align-items: center; gap: 4%; }
.root-slider { appearance: none; width: 100%; height: clamp(7px, .8vw, 11px); border-radius: 9px; background: #050505; border: 1px solid #555; }
.root-slider::-webkit-slider-thumb { appearance: none; width: clamp(17px, 2.2vw, 29px); height: clamp(17px, 2.2vw, 29px); border-radius: 50%; background: radial-gradient(circle at 35% 30%, white, #bbb 45%, #333); box-shadow: 0 2px 5px #000; }
.root-slider::-moz-range-thumb { width: clamp(17px, 2.2vw, 29px); height: clamp(17px, 2.2vw, 29px); border: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, white, #bbb 45%, #333); }
.root-value { display: grid; place-items: center; }
.numeric-menu { bottom: auto; top: 50%; transform: translateY(-50%); min-width: 54px; }
.screen-footer { min-height: 0; display: grid; place-items: center; background: linear-gradient(transparent, #050505 35%); }
.screen-footer button { min-width: 36%; padding: 1.5% 6%; border: 1px solid #454545; border-radius: 5px; background: linear-gradient(#444, #111); color: #eee; font-size: clamp(8px, 1.15vw, 15px); cursor: pointer; }
.review-pews { padding: 0 0 10px; border-bottom: 1px solid #5a5a5a; }
.review-row { display: grid; grid-template-columns: 1fr 1.35fr; gap: 18px; align-items: center; padding: 6px 14px; }
.review-row .review-label { text-align: right; color: #d2d2d2; font-size: clamp(15px, 2vw, 22px); }
.review-box { padding: 11px; border: 1px solid #333; border-radius: 10px; text-align: center; background: #181818; font-size: clamp(15px, 2vw, 21px); }
.rainbow-label { padding: 7px 10px 0; letter-spacing: .5em; font-family: monospace; background: linear-gradient(90deg,#7f50ff,#178fff,#24d9db,#8bd650,#ffd038,#ff8f3c,#e95b88); color: transparent; background-clip: text; }
.vital-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 4px 8px 18px; }
.vital { min-height: 108px; display: grid; place-items: center; align-content: center; }
.vital .reading { font-size: clamp(28px, 5vw, 54px); font-weight: 300; }
.vital .vital-name { font-size: clamp(13px, 1.8vw, 20px); color: var(--cyan); }
.vital.gold .vital-name, .vital.gold .reading { color: #ffb31a; }
.category-strip { min-height: 95px; border-top: 1px solid #555; padding: 4px 10px; color: #999; font-style: italic; font-weight: 700; }
.editor-panel label { display: grid; gap: 6px; color: #c7d0da; font-size: 11px; font-weight: 700; }
.editor-panel label > span { float: right; color: var(--muted); font-weight: 500; }
.editor-panel input:not([type=radio]):not([type=checkbox]) { width: 100%; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: #0d1116; padding: 9px 10px; outline: none; }
.editor-panel input:focus { border-color: #64758a; }
.field-grid { display: grid; gap: 10px; margin-bottom: 12px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.field-grid.four { grid-template-columns: repeat(2, 1fr); }
fieldset { margin: 15px 0; padding: 0; border: 0; }
legend, .section-heading { width: 100%; margin-bottom: 8px; color: #edf2f7; font-size: 12px; font-weight: 800; }
.control-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.control-choice label { display: block; }
.control-choice input { position: absolute; opacity: 0; }
.control-choice span { display: block; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 9px; cursor: pointer; }
.control-choice input:checked + span { color: #17130a; border-color: var(--gold); background: var(--gold); }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading button { border: 0; color: var(--gold); background: transparent; font-size: 11px; cursor: pointer; }
.option-row { display: grid; grid-template-columns: 1fr 72px 25px; gap: 7px; margin-bottom: 7px; }
.option-row button { border: 0; color: var(--danger); background: transparent; cursor: pointer; }
.check { display: flex !important; grid-template-columns: 18px 1fr; align-items: center; margin: 8px 0; }
.hint { color: var(--muted); font-size: 10px; line-height: 1.45; }
.form-errors { color: var(--danger); white-space: pre-line; font-size: 11px; line-height: 1.5; margin: 10px 0; }
.save-button { width: 100%; }
.policy-status { margin: -8px 0 16px; padding: 8px 10px; border-left: 2px solid var(--cyan); background: rgba(31,216,221,.06); color: #aab6c2; font-size: 10px; }
.editor-intro { margin: -7px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.parameter-actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 8px; }
.library-save-button { width: 100%; margin-top: 8px; }
.library-dialog { width: min(520px, calc(100vw - 30px)); max-height: 75vh; color: var(--text); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.library-dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dialog-header button { border: 0; color: var(--text); background: transparent; font-size: 22px; cursor: pointer; }
.policy-library-list { display: grid; gap: 8px; margin-top: 14px; max-height: 52vh; overflow-y: auto; }
.saved-policy-row { display: grid; grid-template-columns: 1fr 42px; gap: 8px; }
.saved-policy-row button { padding: 10px; text-align: left; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer; }
.saved-policy-row .danger-link { text-align: center; color: var(--danger); }
/* Saved Policies dialog only */
#policy-library-dialog { width: min(900px, 95vw); max-width: 95vw; box-sizing: border-box; }
#policy-library-list { overflow-x: hidden; min-width: 0; }
#policy-library-list .saved-policy-row { grid-template-columns: 42px minmax(0, 1fr); min-width: 0; align-items: stretch; }
#policy-library-list .saved-policy-row [data-load-policy] { min-width: 0; white-space: normal; overflow-wrap: anywhere; word-break: normal; line-height: 1.4; }
#policy-library-list .saved-policy-row .danger-link { width: 42px; min-width: 42px; }

.button.danger { color: #ffd8d9; border-color: #6b3438; background: #32191c; }
.button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.schema-note { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.schema-note strong { color: #dfe6ed; }
.hidden { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 9px; background: #edf2f7; color: #111820; font-weight: 700; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 240px minmax(500px, 1fr); }
  .editor-panel { grid-column: 1 / -1; position: static; max-height: none; border: 1px solid var(--line); margin: 0 24px 30px; }
  .catalog-panel { max-height: calc(100vh - 72px); }
}
@media (max-width: 780px) {
  .topbar { padding: 0 14px; }
  .brand span { display: none; }
  .button { padding: 9px 10px; }
  .workspace { display: block; }
  .catalog-panel, .editor-panel { position: static; max-height: none; border: 0; margin: 0; }
  .device-stage { padding: 20px 8px 30px; }
  .stage-toolbar { padding: 0 8px; }
  .top-actions { gap: 6px; }
  .top-actions .button { font-size: 11px; }
  .root-statusbar { gap: 2px; }
  .vital-grid { grid-template-columns: repeat(2, 1fr); }
}


/* Rainbow section polish */
.rainbow-strip {
  border-top: 1px solid #555;
  padding: 4px 10px 0;
}

.rainbow-grid {
  padding-top: 8px;
}

.vital {
  color: #e8e8e8;
}

.vital .reading,
.vital .vital-name {
  color: inherit;
}

.vital-unit {
  font-size: 0.58em;
  margin-left: 0.22em;
  vertical-align: baseline;
}

.vital.blue,
.vital.blue .reading,
.vital.blue .vital-name {
  color: #2fb2ff;
}

.vital.yellow,
.vital.yellow .reading,
.vital.yellow .vital-name {
  color: #f3ef19;
}

.vital.orange,
.vital.orange .reading,
.vital.orange .vital-name {
  color: #ff8a00;
}

.vital.lavender,
.vital.lavender .reading,
.vital.lavender .vital-name {
  color: #d7cde9;
}

/* Rainbow channel header - same bar treatment as other sections */
.rainbow-section-title {
  color: #aaa;
  letter-spacing: normal;
}

/* Individual letters guarantee the full rainbow */
.rainbow-word {
  font-family: monospace;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .38em;
}

.rainbow-r { color: #ff3030; }
.rainbow-o { color: #ff8a00; }
.rainbow-y { color: #ffd928; }
.rainbow-g { color: #55c95a; }
.rainbow-b { color: #2db7e5; }
.rainbow-i { color: #5277e8; }
.rainbow-v { color: #a866cc; }

/* Disable the earlier standalone Rainbow header treatment */
.rainbow-strip {
  border: 0;
  padding: 0;
}

.rainbow-label {
  background: none;
  color: inherit;
  padding: 0;
  letter-spacing: normal;
}

/* Authoritative current-policy view */
.active-filter-row {
  display: flex;
  margin: 0 0 12px;
}

.active-policy-chip {
  width: 100%;
  justify-content: center;
  min-height: 34px;
}


/* Explicit active-parameter precedence indicator */
.selection-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 10px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Keep the Active-policy action rows visually separated. */
#add-to-active {
  margin-bottom: 8px;
}


/* ============================================================
   Policy Studio branding
   ============================================================ */

.brand {
  gap: 16px;
}

.brand-mark {
  width: 60px;
  min-width: 60px;
  height: 46px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.42),
    0 0 6px rgba(255,255,255,.22),
    0 7px 16px rgba(0,0,0,.34);
  overflow: hidden;
}

.brand-logo-image {
  display: block;
  width: 50px;
  height: 38px;
  object-fit: contain;
  filter:
    drop-shadow(0 0 1px rgba(0,0,0,.16))
    drop-shadow(0 1px 1px rgba(0,0,0,.10));
}


/* ============================================================
   Policy Studio workspace switcher
   ============================================================ */

.studio-mode-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #090d12;
}

.studio-mode-button {
  min-width: 132px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .055em;
  cursor: pointer;
  transition: .16s ease;
}

.studio-mode-button:hover {
  color: #fff;
  background: #171d24;
}

.studio-mode-button.active {
  color: #fff;
  border-color: #4b5766;
  background: #252d36;
  box-shadow: inset 0 -2px 0 var(--gold);
}


/* ============================================================
   EWS Builder
   Namespaced separately from the existing Parameter Builder.
   ============================================================ */

.ews-workspace {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns:
    clamp(250px, 20vw, 310px)
    minmax(480px, 1fr)
    clamp(320px, 26vw, 410px);
  overflow: hidden;
  background: #090d12;
}

.ews-structure,
.ews-editor,
.ews-inspector {
  min-width: 0;
  min-height: 0;
  background: rgba(18,23,29,.92);
}

.ews-structure {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.ews-editor {
  overflow-y: auto;
  background:
    radial-gradient(
      ellipse at center top,
      rgba(29,40,51,.42) 0,
      rgba(9,13,18,0) 52%
    ),
    #090d12;
}

.ews-inspector {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.ews-pane-header {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,20,26,.94);
}

.ews-pane-header strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
}

.ews-pane-eyebrow {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ews-phase-badge,
.ews-editor-state {
  padding: 4px 8px;
  border: 1px solid #495666;
  border-radius: 999px;
  color: #bbc6d2;
  background: #1b222a;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
}

.ews-structure-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px;
}

.ews-structure-item {
  width: 100%;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  padding: 11px 10px;
  color: #dfe6ed;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.ews-structure-item:hover {
  border-color: #394552;
  background: #151b22;
}

.ews-structure-item.active {
  border-color: #526173;
  background: #1c242d;
  box-shadow:
    inset 3px 0 0 var(--cyan),
    0 0 0 1px rgba(31,216,221,.08);
}

.ews-structure-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--cyan);
  font-size: 13px;
}

.ews-structure-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ews-structure-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ews-structure-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ews-structure-status {
  color: #73808e;
  font-size: 11px;
}

.ews-structure-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.ews-structure-section-title {
  margin: 0 5px 9px;
  color: #98a5b3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.ews-profile-tree {
  display: grid;
  gap: 6px;
}

.ews-empty-tree {
  padding: 13px;
  color: #74808d;
  border: 1px dashed #35404c;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.45;
}

.ews-structure-footer {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #0d1217;
}

.ews-shell-disabled-action {
  width: 100%;
}

.ews-shell-note {
  margin-top: 8px;
  color: #707c89;
  font-size: 9px;
  line-height: 1.45;
}

.ews-editor-content {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.ews-welcome-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
  border: 1px solid #35414e;
  border-radius: 13px;
  background: rgba(18,24,31,.86);
}

.ews-welcome-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border: 1px solid #485767;
  border-radius: 16px;
  color: #fff;
  background:
    linear-gradient(
      145deg,
      rgba(239,35,60,.95),
      rgba(136,15,33,.92)
    );
  box-shadow: 0 12px 28px rgba(0,0,0,.32);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .08em;
}

.ews-welcome-card h2 {
  margin: 0 0 7px;
  font-size: 20px;
}

.ews-welcome-card p {
  margin: 0;
  color: #a9b5c1;
  font-size: 11px;
  line-height: 1.55;
}

.ews-welcome-card code {
  color: #dce9f5;
}

.ews-shell-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.ews-shell-card {
  min-height: 125px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid #303b47;
  border-radius: 11px;
  background: rgba(16,22,29,.78);
}

.ews-card-number {
  color: #617080;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.ews-shell-card strong {
  font-size: 12px;
}

.ews-shell-card p {
  margin: 7px 0 0;
  color: #909daa;
  font-size: 10px;
  line-height: 1.5;
}

.ews-phase-message {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--cyan);
  background: rgba(31,216,221,.055);
  color: #aab8c5;
  font-size: 10px;
  line-height: 1.5;
}

.ews-phase-message strong {
  flex: 0 0 auto;
  color: #e5eef6;
}

.ews-inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 8px;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  background: #0d1217;
}

.ews-inspector-tab {
  min-width: 0;
  padding: 7px 4px;
  overflow: hidden;
  color: #8794a2;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 9px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ews-inspector-tab:hover {
  color: #dce5ed;
  background: #171d24;
}

.ews-inspector-tab.active {
  color: #fff;
  border-color: #424e5b;
  background: #252d36;
}

.ews-inspector-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.ews-inspector-view {
  min-height: 100%;
}

.ews-inspector-placeholder {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  color: #8895a2;
  text-align: center;
  border: 1px dashed #36414d;
  border-radius: 11px;
  background: rgba(11,16,21,.6);
}

.ews-inspector-placeholder strong {
  color: #dce5ed;
  font-size: 12px;
}

.ews-inspector-placeholder p {
  max-width: 290px;
  margin: 0;
  font-size: 10px;
  line-height: 1.55;
}

.ews-placeholder-icon {
  color: var(--cyan);
  font-size: 25px;
  font-weight: 800;
}


/* ============================================================
   EWS Builder responsive behavior
   ============================================================ */

@media (max-width: 1180px) {
  .studio-mode-button {
    min-width: 112px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 9px;
  }

  .ews-workspace {
    grid-template-columns:
      230px
      minmax(460px, 1fr);
    overflow-y: auto;
  }

  .ews-inspector {
    grid-column: 1 / -1;
    min-height: 420px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 900px) {
  .studio-mode-switcher {
    margin-left: auto;
    margin-right: 8px;
  }

  .studio-mode-button {
    min-width: 0;
    font-size: 8px;
  }

  .ews-workspace {
    height: auto;
    min-height: calc(100vh - 72px);
    display: block;
    overflow: visible;
  }

  .ews-structure,
  .ews-editor,
  .ews-inspector {
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .ews-editor-content {
    padding: 20px 14px;
  }
}

@media (max-width: 700px) {
  .studio-mode-switcher {
    gap: 2px;
    padding: 3px;
  }

  .studio-mode-button {
    padding: 6px;
    font-size: 7px;
    letter-spacing: .02em;
  }

  .ews-shell-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   EWS Builder Phase 2 read-only discovery
   ============================================================ */

.ews-readonly-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.ews-readonly-summary-card {
  display: grid;
  gap: 6px;
  min-height: 82px;
  align-content: center;
  padding: 14px;
  border: 1px solid #303b47;
  border-radius: 10px;
  background: rgba(16,22,29,.78);
}

.ews-readonly-summary-card span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.ews-readonly-summary-card strong {
  color: #edf3f8;
  font-size: 14px;
}

.ews-readonly-section {
  margin-top: 18px;
}

.ews-readonly-section-title {
  margin-bottom: 8px;
  color: #dfe7ee;
  font-size: 11px;
  font-weight: 800;
}

.ews-readonly-list {
  display: grid;
  gap: 6px;
}

.ews-readonly-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid #303b47;
  border-radius: 8px;
  background: #11171d;
  color: #ccd6df;
  font-size: 10px;
}

.ews-readonly-row code {
  color: #9fc8e8;
  font-size: 9px;
}

.ews-readonly-row-button {
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.ews-readonly-row-button:hover {
  border-color: #4d5c6c;
  background: #182029;
}

.ews-readonly-empty {
  padding: 12px;
  color: #788593;
  border: 1px dashed #35404c;
  border-radius: 8px;
  font-size: 10px;
}

.ews-profile-tree-group {
  margin-bottom: 9px;
}

.ews-profile-node {
  width: 100%;
  display: grid;
  grid-template-columns: 20px minmax(0,1fr);
  gap: 7px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #dbe4ec;
  text-align: left;
  cursor: pointer;
}

.ews-profile-node:hover,
.ews-profile-node.active {
  border-color: #465462;
  background: #171f27;
}

.ews-profile-node-icon {
  color: var(--cyan);
}

.ews-profile-node-copy {
  display: grid;
  gap: 2px;
}

.ews-profile-node-copy strong {
  font-size: 11px;
}

.ews-profile-node-copy small {
  color: var(--muted);
  font-size: 8px;
}

.ews-profile-contributors {
  display: grid;
  gap: 3px;
  margin-top: 3px;
  margin-left: 14px;
}

.ews-profile-contributor {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0,1fr);
  gap: 5px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #9eabb8;
  background: transparent;
  text-align: left;
  font-size: 9px;
  cursor: pointer;
}

.ews-profile-contributor:hover,
.ews-profile-contributor.active {
  color: #eef4f9;
  border-color: #394653;
  background: #141b22;
}

.ews-profile-branch {
  color: #556575;
}

.ews-profile-tree-empty {
  padding: 5px 7px;
  color: #66727e;
  font-size: 8px;
}

.ews-profile-summary-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.ews-profile-summary-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  color: #e1e8ef;
  border: 1px solid #303b47;
  border-radius: 9px;
  background: #11171d;
  text-align: left;
  cursor: pointer;
}

.ews-profile-summary-card:hover {
  border-color: #4b5968;
  background: #182029;
}

.ews-profile-summary-card div {
  display: grid;
  gap: 4px;
}

.ews-profile-summary-card strong {
  font-size: 12px;
}

.ews-profile-summary-card small {
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 700px) {
  .ews-readonly-summary-grid {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================
   Authentication
   ========================================================== */

.auth-pending .topbar,
.auth-pending .workspace {
  visibility: hidden;
}

.auth-gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at 50% 35%,
      #151d26 0,
      #090d12 42%,
      #05070a 100%
    );
}

.auth-gate.hidden {
  display: none;
}

.auth-card {
  width: min(440px, calc(100vw - 32px));
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(18, 23, 29, .97);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, .55);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.auth-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 18px;
}

.auth-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-form h1 {
  margin: 0;
  font-size: 24px;
}

.auth-copy {
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #c7d0da;
  font-size: 12px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--text);
  background: #0d1116;
}

.auth-form input:focus {
  border-color: #64758a;
}

.auth-submit {
  width: 100%;
  margin-top: 3px;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid #6b3438;
  border-radius: 8px;
  color: #ffd8d9;
  background: #32191c;
  font-size: 12px;
  line-height: 1.45;
}

.auth-account-line {
  padding: 9px 11px;
  border-left: 2px solid var(--cyan);
  background: rgba(31, 216, 221, .06);
  color: #c4ced8;
  font-size: 12px;
}

.auth-password-note {
  margin: -7px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.auth-user-control {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
}

.auth-user-summary {
  min-width: 90px;
  text-align: right;
}

.auth-user-summary strong,
.auth-user-summary span {
  display: block;
}

.auth-user-summary strong {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  white-space: nowrap;
}

.auth-user-summary span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

@media (max-width: 1180px) {
  .auth-user-summary {
    display: none;
  }
}


/* ==========================================================
   Stage 3 Administration
   ========================================================== */

.admin-dialog {
  width: min(1180px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  padding: 0;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #11171d;
}

.admin-dialog::backdrop {
  background: rgba(0, 0, 0, .78);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.admin-header strong,
.admin-header span {
  display: block;
}

.admin-header strong {
  font-size: 17px;
}

.admin-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.admin-header > button {
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.admin-tab {
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  font-size: 11px;
}

.admin-tab.active {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
}

.admin-panel {
  height: calc(100% - 112px);
  padding: 20px;
  overflow: auto;
}

.admin-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
}

.admin-section-heading strong,
.admin-section-heading span {
  display: block;
}

.admin-section-heading strong {
  font-size: 15px;
}

.admin-section-heading span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.admin-create-user {
  display: grid;
  grid-template-columns:
    1fr
    1.25fr
    180px
    auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #171e25;
}

.admin-create-user label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.admin-create-user input,
.admin-create-user select,
.admin-user-row select,
.journal-filters input,
.journal-filters select {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0c1116;
}

.admin-create-actions {
  display: flex;
  gap: 7px;
}

#admin-users-list {
  display: grid;
  gap: 8px;
}

.admin-user-row {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.4fr)
    170px
    100px
    minmax(120px, 1fr)
    auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #151b22;
}

.admin-user-identity strong,
.admin-user-identity span {
  display: block;
}

.admin-user-identity span,
.admin-password-state {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.admin-enabled {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #c8d2dc;
  font-size: 11px;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
}

.admin-user-actions .button {
  padding: 8px 9px;
  white-space: nowrap;
  font-size: 10px;
}

.journal-filters {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.4fr)
    minmax(120px, .8fr)
    120px
    140px
    140px
    auto
    auto;
  gap: 8px;
  margin-bottom: 12px;
}

.journal-summary {
  margin: 7px 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.journal-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.journal-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px;
  text-align: left;
  color: #cfd7df;
  background: #1a222a;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.journal-table td {
  padding: 9px;
  vertical-align: top;
  border-bottom: 1px solid #242e38;
}

.journal-time {
  min-width: 145px;
  white-space: nowrap;
}

.journal-action {
  font-weight: 700;
  white-space: nowrap;
}

.journal-result {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 800;
}

.journal-success {
  color: #a8edc1;
  background: rgba(56, 170, 95, .15);
}

.journal-failure {
  color: #ffd1d3;
  background: rgba(220, 65, 71, .16);
}

.journal-denied {
  color: #ffd997;
  background: rgba(221, 151, 38, .16);
}

.journal-details summary {
  cursor: pointer;
  color: var(--cyan);
}

.journal-details pre {
  max-width: 420px;
  overflow: auto;
  padding: 8px;
  border-radius: 6px;
  color: #d8e0e8;
  background: #090d11;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 10px;
}

.journal-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

#journal-page {
  min-width: 120px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.readonly-disabled {
  opacity: .35 !important;
  pointer-events: none !important;
}

body.readonly-mode #parameter-form {
  opacity: .68;
}

@media (max-width: 1000px) {
  .admin-user-row {
    grid-template-columns:
      1fr
      160px;
  }

  .admin-user-actions {
    grid-column: 1 / -1;
  }

  .admin-create-user {
    grid-template-columns:
      1fr
      1fr;
  }

  .journal-filters {
    grid-template-columns:
      1fr
      1fr;
  }
}


/* POLICY STUDIO BUTTON TOOLTIPS */

.policy-studio-button-tooltip {
  position: fixed;
  z-index: 100000;
  max-width: 320px;
  padding: 9px 11px;
  border: 1px solid #596471;
  border-radius: 7px;
  background: #11161c;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.38);
  color: #f2f5f7;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  pointer-events: none;
  transform:
    translate(-50%, -100%);
  white-space: normal;
}

.policy-studio-button-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 1px solid #596471;
  border-bottom: 1px solid #596471;
  background: #11161c;
  transform:
    translate(-50%, -4px)
    rotate(45deg);
}

.policy-studio-button-tooltip[hidden] {
  display: none;
}


/* Active Parameters label emphasis */
.active-policy-chip {
  font-size: 1.5em;
}


/* Review screen aligned with EMR Push layout */

.review-manual-list {
  display: grid;
}

.review-value-box {
  min-height: clamp(24px, 2.8vw, 36px);
  display: grid;
  place-items: center;
  width: 100%;
  padding: 2px 5%;
  border: 1px solid #3c3c3c;
  border-radius: 5px;
  color: #f3f3f3;
  background: linear-gradient(#292929, #151515 55%, #222);
  box-shadow: inset 0 0 0 1px #111;
  text-align: center;
  font-size: clamp(8px, 1.1vw, 14px);
}


/* ============================================================
   Root Review snapshot
   ============================================================ */

.review-manual-list {
  display: grid;
}

.review-value-box {
  min-height: clamp(24px, 2.8vw, 36px);
  width: 100%;
  display: grid;
  place-items: center;
  padding: 2px 5%;
  border: 1px solid #3e3e3e;
  border-radius: 5px;
  color: #f2f2f2;
  background:
    linear-gradient(
      #292929,
      #151515 55%,
      #222
    );
  box-shadow:
    inset 0 0 0 1px #111;
  text-align: center;
  font-size:
    clamp(8px, 1.1vw, 14px);
}


/* Consistent Root vital label alignment */

.vital-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 2.8em;
  line-height: 1.05;
}

.vital-label {
  display: block;
}

.vital-unit {
  display: block;
  min-height: 1.1em;
}


/* ============================================================
   ROOT PATIENT WORKFLOW
   ============================================================ */

.root-workflow-overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f3f3f3;
  background: linear-gradient(#171717, #060606);
  font-family: "Segoe UI", Arial, sans-serif;
}

.root-live-topbar {
  min-height: 8%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1% 3%;
  background: #050505;
  border-bottom: 1px solid #333;
  font-size: clamp(6px, .75vw, 10px);
}

.root-live-profile-badge {
  justify-self: start;
  padding: 1px 8px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(#16bde7, #0874aa);
  white-space: nowrap;
}

.root-live-demo {
  justify-self: center;
  color: #f2ec57;
  font-weight: 700;
}

.root-live-clock {
  justify-self: end;
  color: #ccc;
}


/* ============================================================
   ROOT LIVE SCREEN — QML / REAL ROOT STRUCTURE
   Native logical canvas: 800 x 1280
   ============================================================ */

#root-live-screen {
  position: absolute !important;

  inset: 0 !important;

  width: 800px !important;
  height: 1280px !important;

  display: block !important;

  overflow: hidden !important;

  background: #000 !important;

  color: #fff !important;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif !important;
}


/* ------------------------------------------------------------
   Rainbow channel
   ------------------------------------------------------------ */

.root-live-rainbow-channel {
  position: absolute;

  left: 8px;
  right: 8px;
  top: 72px;

  height: 690px;

  border:
    3px solid #2d2d2d;

  border-radius:
    4px;

  background:
    #000;
}


.root-live-rainbow-header {
  position: relative;

  height: 32px;

  display: grid;

  grid-template-columns:
    1fr
    1fr
    1fr;

  align-items: center;

  padding:
    0 10px;

  background:
    linear-gradient(
      #353535,
      #1c1c1c
    );

  border-bottom:
    1px solid #4a4a4a;
}


.root-live-rainbow-logo {
  justify-self: start;

  font-size: 17px;

  letter-spacing: .38em;

  text-transform: lowercase;
}


.root-live-demo {
  justify-self: center;

  color: #fff45a;

  font-size: 17px;

  font-weight: 700;
}


.root-live-apod {
  justify-self: end;

  color: #999;

  font-size: 16px;
}


.root-live-waveform-area {
  position: relative;

  height: 585px;

  border-bottom:
    1px solid #303030;

  background: #000;
}


.root-live-waveform-track {
  position: absolute;

  left: 4px;
  right: 4px;
  top: 4px;

  height: 100px;

  border-bottom:
    1px solid #20425d;

  background:
    linear-gradient(
      #082442,
      #02101c
    );
}


.root-live-waveform-line {
  position: absolute;

  left: 18px;
  right: 18px;
  top: 46px;

  height: 2px;

  background:
    rgba(255,255,255,.92);

  box-shadow:
    0 -12px 0 -1px rgba(255,255,255,.42),
    0 12px 0 -1px rgba(255,255,255,.42);
}


/* SpO2 + PR are right-aligned in the actual Root channel. */

.root-live-spo2-block,
.root-live-pr-block {
  position: absolute;

  right: 18px;

  width: 255px;

  text-align: right;
}


.root-live-spo2-block {
  top: 145px;
}


.root-live-pr-block {
  top: 375px;
}


.root-live-primary-value {
  box-sizing: border-box;

  padding-right: 44px;

  font-size: 88px;

  font-weight: 300;

  line-height: .9;

  letter-spacing:
    -3px;
}


.root-live-primary-label {
  margin-top: -4px;

  font-size: 20px;

  line-height: 1.05;
}


.root-live-primary-label small {
  font-size: 17px;
}


.root-live-limit {
  position: absolute;

  right: 0;
  top: -10px;

  width: 34px;

  text-align: right;

  color: #f2f2f2;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif;

  font-size: 14px;
  font-weight: 400;

  line-height: 1.18;

  letter-spacing: 0;

  transform: none;
}


.root-live-pi-row {
  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: 70px;

  display: flex;

  justify-content: center;
  align-items: baseline;

  gap: 20px;

  border-top:
    1px solid #303030;
}


.root-live-pi-row strong {
  font-size: 55px;

  font-weight: 300;
}


.root-live-pi-row span {
  font-size: 18px;
}


/* ------------------------------------------------------------
   Lower channel groups
   ------------------------------------------------------------ */

.root-live-channel {
  position: absolute;

  left: 8px;
  right: 8px;

  border:
    3px solid #2e2e2e;

  border-radius:
    4px;

  background:
    #000;
}


.root-live-temperature-channel {
  top: 770px;

  height: 136px;
}


.root-live-nibp-channel {
  top: 912px;

  height: 136px;
}


.root-live-adult-channel {
  top: 1054px;

  height: 132px;
}


.root-live-channel-heading {
  height: 30px;

  display: flex;

  align-items: center;

  justify-content:
    space-between;

  padding:
    0 10px;

  background:
    linear-gradient(
      #363636,
      #1e1e1e
    );

  color:
    #aaa;

  font-size:
    19px;

  font-style:
    italic;

  font-weight:
    700;
}


.root-live-channel-heading small {
  color:
    #eee;

  font-size:
    14px;

  font-style:
    normal;

  font-weight:
    400;
}


.root-live-channel-body {
  position: relative;

  height:
    calc(100% - 30px);

  overflow: hidden;

  background:
    #000;
}


.root-live-channel-scale {
  position: absolute;

  left: 5px;
  top: 5px;
  bottom: 5px;

  width: 42px;

  display: flex;

  flex-direction:
    column;

  justify-content:
    space-between;

  color:
    #777;

  font-size:
    16px;
}


.root-live-temp-value {
  position: absolute;

  right: 18px;
  bottom: 10px;

  color:
    #bb7d00;

  text-align:
    right;
}


.root-live-temp-value strong {
  font-size:
    42px;

  font-weight:
    300;
}


.root-live-temp-value small {
  margin-left:
    6px;

  font-size:
    18px;
}


.root-live-nibp-main {
  position: absolute;

  right: 20px;
  bottom: 10px;

  text-align:
    right;

  color:
    #0b8a0b;
}


.root-live-nibp-main strong {
  display:
    block;

  font-size:
    39px;

  font-weight:
    300;
}


.root-live-nibp-main small {
  display:
    block;

  margin-top:
    2px;

  font-size:
    15px;
}


.root-live-adult-placeholder {
  position:
    absolute;

  right:
    95px;

  top:
    20px;

  color:
    #ddd;

  font-size:
    45px;
}


/* ------------------------------------------------------------
   Patient text and lower toolbar
   ------------------------------------------------------------ */


/* ------------------------------------------------------------
   Real Root lower trend scale + action bar
   ------------------------------------------------------------ */


/* ------------------------------------------------------------
   Real Root lower trend scale + action bar
   ------------------------------------------------------------ */

.root-live-patient-summary {
  display: none !important;
}


.root-live-patient-summary strong {
  display: block;

  color: #b7b7b7;

  font-size: 18px;

  font-weight: 400;

  letter-spacing: .5px;
}


.root-live-patient-summary small {
  display: none;
}


/* Trend/time ruler immediately above the bottom action bar. */

.root-live-timescale {
  position: absolute;

  left: 8px;
  right: 8px;

  bottom: 84px;

  height: 42px;

  display: grid;

  grid-template-columns:
    118px
    minmax(0, 1fr)
    235px;

  align-items: stretch;

  border-top:
    1px solid #444;

  border-bottom:
    1px solid #292929;

  background:
    linear-gradient(
      #262626,
      #111
    );

  color: #9c9c9c;

  z-index: 20;
}


.root-live-timescale-date {
  display: flex;

  align-items: flex-end;

  padding:
    0 7px 4px;

  border-right:
    1px solid #3a3a3a;

  font-size: 15px;
}


.root-live-timescale-ticks {
  position: relative;

  display: grid;

  grid-template-columns:
    repeat(4, 1fr);

  align-items: start;

  height: 100%;

  padding-top: 3px;

  font-size: 15px;

  text-align: center;
}


.root-live-timescale-ticks::before {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: 7px;

  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 48px,
      #666 49px,
      transparent 50px
    );
}


.root-live-timescale-now {
  color: #aaa;
}


.root-live-timescale-controls {
  display: grid;

  grid-template-columns:
    1fr
    1.25fr
    1fr;

  border-left:
    1px solid #3a3a3a;
}


.root-live-timescale-controls button,
.root-live-timescale-controls span {
  display: grid;

  place-items: center;

  min-width: 0;

  padding: 0;

  border: 0;

  border-left:
    1px solid #333;

  color: #aaa;

  background:
    linear-gradient(
      #2c2c2c,
      #111
    );

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif;

  font-size: 18px;
}


.root-live-timescale-controls button {
  color: #fff;

  cursor: default;
}


/* Bottom action row */

.root-live-toolbar {
  position: absolute;

  left: 8px;
  right: 8px;
  bottom: 0;

  height: 84px;

  display: flex;

  align-items: center;

  gap: 10px;

  padding:
    0 7px;

  border-top:
    1px solid #333;

  background:
    #050505;

  z-index: 20;
}


.root-live-tool {
  width: 76px !important;
  height: 76px !important;

  min-width: 76px !important;
  min-height: 76px !important;

  max-width: 76px !important;
  max-height: 76px !important;

  display: grid !important;

  place-items: center !important;

  padding: 0 !important;

  border: 0 !important;

  background:
    transparent !important;

  box-shadow:
    none !important;

  overflow:
    visible !important;
}


.root-live-tool:hover {
  border: 0 !important;

  background:
    transparent !important;

  box-shadow:
    none !important;
}


.root-tool-icon {
  display: block !important;

  width: 68px !important;
  height: 68px !important;

  max-width: none !important;
  max-height: none !important;

  object-fit: contain !important;

  border: 0 !important;
  background: transparent !important;

  transform: scale(1.18);
  transform-origin: center center;

  pointer-events: none;
}


/*
 * Real Root leaves the central lower region open for patient /
 * status context rather than packing the action icons together.
 */
#root-open-emr-push {
  margin-left: 2px;
}


.root-live-toolbar-status {
  position: absolute;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%);

  width: 360px;

  padding: 0;

  text-align: center;

  color: #a7a7a7;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif;

  font-size: 18px;
  font-weight: 400;

  letter-spacing: .5px;

  white-space: nowrap;

  pointer-events: none;
}



/* Patient admission */

.root-admit-overlay {
  padding: 0;
  overflow-y: auto;
  background: linear-gradient(#252525, #111);
}

.root-admit-header {
  min-height: 10%;
  display: grid;
  grid-template-columns: 14% 1fr 14%;
  align-items: center;
  padding: 1% 3%;
  text-align: center;
  font-size: clamp(13px, 2.6vw, 34px);
  font-weight: 300;
}

.root-admit-header button {
  width: clamp(26px, 3.8vw, 48px);
  aspect-ratio: 1;
  border: 2px solid #ddd;
  border-radius: 50%;
  color: #fff;
  background: #050505;
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
}

.root-admit-message {
  margin: 1% 4% 3%;
  padding: 2%;
  border: 2px solid #0877ad;
  border-radius: 4px;
  background: linear-gradient(#1ca8e6, #087cb5);
  text-align: center;
  font-size: clamp(7px, 1vw, 13px);
}

.root-admit-card {
  margin: 0 3%;
  padding: 3%;
  border: 1px solid #111;
  border-radius: 4px;
  background: linear-gradient(#2a2a2a, #181818);
}

.root-admit-title {
  margin-bottom: 3%;
  font-size: clamp(13px, 2vw, 27px);
  font-weight: 300;
}

.root-admit-fields {
  display: grid;
  gap: clamp(3px, .55vw, 7px);
}

.root-admit-fields label {
  min-width: 0;
  display: grid;
  grid-template-columns: 38% minmax(0, 1fr);
  align-items: center;
  gap: 3%;
}

.root-admit-fields label > span {
  color: #ddd;
  text-align: right;
  font-size: clamp(7px, 1vw, 13px);
}

.root-admit-fields input,
.root-admit-fields select {
  min-width: 0;
  height: clamp(24px, 3.1vw, 40px);
  padding: 1% 3%;
  border: 1px solid #303030;
  border-radius: 5px;
  color: #fff;
  background: linear-gradient(#202020, #171717);
  font-size: clamp(7px, .9vw, 12px);
}

.root-admit-fields input:focus,
.root-admit-fields select:focus {
  border-color: #0ea8eb;
  outline: 1px solid #0ea8eb;
}

.root-admit-fields select:disabled {
  opacity: .68;
}

.root-admit-age-result {
  margin: 3% 0 0 41%;
  color: #8ed8fa;
  font-size: clamp(6px, .8vw, 11px);
  line-height: 1.3;
}

.root-admit-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8%;
  padding: 3% 22% 4%;
}

.root-admit-actions button {
  min-height: clamp(28px, 3.6vw, 46px);
  border: 1px solid #444;
  border-radius: 4px;
  color: #eee;
  background: linear-gradient(#414141, #151515);
  font-size: clamp(8px, 1vw, 14px);
  cursor: pointer;
}



/* Root live monitor cleanup */

.root-live-topbar {
  display: none !important;
}

.root-live-patient-summary {
  margin-top: auto;
  padding: 2% 0 1%;
  border-top: 0;
  text-align: center;
  color: #fff;
}

.root-live-patient-summary > span {
  display: none;
}

.root-live-patient-summary strong {
  font-size: clamp(9px, 1.15vw, 15px);
  font-weight: 600;
}

.root-live-patient-summary small {
  display: none;
}



/* ============================================================
   Root live profile + patient placement correction
   ============================================================ */

/*
 * Covers the blue ADULT selector already present in the
 * Root background image.
 */
.root-live-profile-overlay {
  position: absolute;
  z-index: 60;

  top: 1.6%;
  left: 48%;

  transform: translateX(-50%);

  min-width: 42px;
  max-width: 150px;

  padding: 1px 7px;

  border-radius: 999px;

  overflow: hidden;

  color: #fff;

  background:
    linear-gradient(
      #19bdea,
      #087baa
    );

  box-shadow:
    inset 0 0 0 1px
      rgba(255,255,255,.22);

  font-size:
    clamp(
      5px,
      .55vw,
      8px
    );

  font-weight: 600;

  line-height: 1.25;

  text-align: center;

  text-overflow: ellipsis;
  white-space: nowrap;
}


/*
 * Patient label belongs at the bottom center of the live
 * monitoring area, immediately above the Root toolbar.
 */
.root-live-patient-summary {
  position: absolute;

  z-index: 40;

  left: 15%;
  right: 15%;

  bottom: 10.2%;

  margin: 0;
  padding: 0;

  border: 0;

  text-align: center;

  pointer-events: none;
}

.root-live-patient-summary > span,
.root-live-patient-summary > small {
  display: none !important;
}

.root-live-patient-summary strong {
  display: block;

  margin: 0;

  color: #fff;

  font-size:
    clamp(
      8px,
      .95vw,
      13px
    );

  font-weight: 600;

  line-height: 1;

  text-align: center;
}


/* ============================================================
   Root live final alignment correction
   ============================================================ */

/* Move generated EWS profile over the built-in ADULT badge */
.root-live-profile-overlay {
  top: -5.7% !important;
  left: 48% !important;
}

/* Move admitted patient label down near the bottom toolbar */
.root-live-patient-summary {
  bottom: 4.8% !important;
}


/* Bring EWS profile badge back into the visible Root status bar */
.root-live-profile-overlay {
  top: 0.4% !important;
  left: 48% !important;
}


/* ============================================================
   EWS profile badge exact Root status-bar alignment
   ============================================================ */

/*
 * Allow only the generated profile badge to extend upward into
 * the real Root status bar area.
 */
#root-live-screen {
  overflow: visible !important;
}

.root-live-profile-overlay {
  top: 0 !important;
  left: 48% !important;

  transform:
    translate(-50%, -33px) !important;

  min-width: 62px !important;
  max-width: 145px !important;

  padding:
    2px 9px !important;

  font-size:
    clamp(
      7px,
      .72vw,
      10px
    ) !important;

  line-height: 1.15 !important;

  font-weight: 600 !important;
}


/* ============================================================
   EWS profile badge anchored to actual Root screen
   ============================================================ */

#root-live-screen {
  overflow: hidden !important;
}

.root-screen-window {
  position: absolute;
}

/*
 * Positioned against the real Root display area.
 * This overlays the blue ADULT profile selector in the
 * underlying Root image.
 */
.root-screen-window > .root-live-profile-overlay {
  position: absolute !important;
  z-index: 100 !important;

  top: 1.3% !important;
  left: 50% !important;

  transform: translateX(-50%) !important;

  min-width: 62px !important;
  max-width: 150px !important;

  padding: 2px 8px !important;

  border-radius: 999px !important;

  color: #fff !important;
  background: linear-gradient(
    #19bdea,
    #087baa
  ) !important;

  font-size: clamp(
    7px,
    .72vw,
    10px
  ) !important;

  font-weight: 600 !important;
  line-height: 1.1 !important;

  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}


/* Final EWS profile badge vertical alignment */

.root-screen-window {
  overflow: visible !important;
}

.root-screen-window > .root-live-profile-overlay {
  top: 1.3% !important;
  left: 50% !important;

  transform:
    translate(-50%, -38px) !important;

  min-width: 68px !important;

  padding:
    2px 10px !important;

  font-size:
    clamp(
      8px,
      .8vw,
      11px
    ) !important;
}


/* Tiny upward nudge for generated EWS profile badge */
.root-screen-window > .root-live-profile-overlay {
  transform: translate(-50%, -42px) !important;
}


/* Real Root toolbar icons */

.root-live-tool {
  padding: 0 !important;
  overflow: hidden;
}

.root-tool-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}


/* Root toolbar icons should look like the real monitor:
   small standalone icons with no surrounding button box */

.root-live-toolbar {
  gap: 10px !important;
  padding-left: 10px !important;
  align-items: center !important;
}

.root-live-tool {
  min-width: 0 !important;
  min-height: 0 !important;

  width: 30px !important;
  height: 30px !important;

  padding: 0 !important;

  border: 0 !important;
  border-radius: 0 !important;

  background: transparent !important;
  box-shadow: none !important;

  overflow: visible !important;
}

.root-live-tool:hover {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.root-tool-icon {
  display: block !important;

  width: 28px !important;
  height: 28px !important;

  object-fit: contain !important;

  border: 0 !important;
  background: transparent !important;
}


/* ============================================================
   Real Root back-button image
   ============================================================ */

.root-image-button,
#root-admit-back {
  position: absolute !important;

  top: 10px !important;
  left: 10px !important;

  width: 260px !important;
  height: 40px !important;

  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;

  padding: 0 !important;

  border: 0 !important;

  background: transparent !important;

  box-shadow: none !important;

  overflow: visible !important;

  z-index: 20 !important;
}

.root-image-button:hover,
#root-admit-back:hover {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.root-back-icon {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}


/* ============================================================
   Root native EWS profile selector
   ============================================================ */

#root-admit-profile-mode {
  color: #ffffff !important;
  background: #181818 !important;
}

/*
 * Chrome/Windows renders the opened native option menu with
 * a light background. Use dark text there so every profile
 * remains visible.
 */
#root-admit-profile-mode option {
  color: #111111 !important;
  background: #ffffff !important;
}

#root-admit-profile-mode option:checked {
  color: #ffffff !important;
  background: #087db5 !important;
}


/* Native Root admission EWS selector readability */

#root-admit-profile-mode {
  color: #ffffff !important;
  background-color: #181818 !important;
  -webkit-text-fill-color: #ffffff !important;
}

#root-admit-profile-mode option {
  color: #111111 !important;
  background-color: #ffffff !important;
  -webkit-text-fill-color: #111111 !important;
}


/* ============================================================
   ROOT ADMIT SCREEN — QML-BASED LAYOUT
   Based on the actual Root ADT / patient QML structure.
   ============================================================ */


/* Remove the web-card appearance. */
#root-admit-screen {
  background: #000 !important;
  color: #fff !important;
}


/* Main content area */
#root-admit-screen .root-admit-panel,
#root-admit-screen .root-admit-form {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  width: calc(100% - 36px) !important;
  max-width: none !important;

  margin: 0 18px !important;
  padding: 0 !important;
}


/* Root menu heading */
#root-admit-screen .root-admit-title,
#root-admit-screen h2,
#root-admit-screen h3 {
  text-align: center !important;

  margin-top: 58px !important;
  margin-bottom: 24px !important;

  font-size: 17px !important;
  font-weight: 700 !important;

  text-transform: lowercase !important;
  letter-spacing: 0 !important;

  color: #fff !important;
}


/* Each patient field follows the Root 58px row model. */
#root-admit-screen label {
  display: grid !important;

  grid-template-columns:
    140px
    minmax(0, 1fr) !important;

  align-items: center !important;

  min-height: 58px !important;
  height: 58px !important;

  margin: 0 !important;

  column-gap: 18px !important;

  padding:
    0 20px !important;
}


/* Left field labels */
#root-admit-screen label > span {
  display: flex !important;
  align-items: center !important;

  width: 140px !important;

  padding: 0 12px 0 0 !important;

  color: #d2d5d8 !important;

  font-size: 16px !important;
  font-weight: 400 !important;

  text-transform: lowercase !important;
}


/* Root-like recessed entry fields */
#root-admit-screen input,
#root-admit-screen select {
  box-sizing: border-box !important;

  width: 100% !important;
  height: 44px !important;

  margin: 0 !important;
  padding: 0 14px !important;

  border: 1px solid #4b4f53 !important;
  border-radius: 3px !important;

  background:
    linear-gradient(
      to bottom,
      #050505 0%,
      #131313 100%
    ) !important;

  box-shadow:
    inset 0 1px 4px rgba(0,0,0,.9),
    0 1px 0 rgba(255,255,255,.05) !important;

  color: #fff !important;

  font-size: 16px !important;
  font-weight: 400 !important;
}


/* Native dropdown list readability */
#root-admit-screen select option {
  color: #111 !important;
  background: #fff !important;
}


/* Focus state approximates Root highlighted controls. */
#root-admit-screen input:focus,
#root-admit-screen select:focus {
  outline: none !important;

  border-color: #00a9df !important;

  box-shadow:
    inset 0 1px 4px rgba(0,0,0,.9),
    0 0 0 1px rgba(0,169,223,.7) !important;
}


/* DOB / EWS resolution text */
#root-admit-age-result {
  margin:
    -4px 30px 12px
    calc(30px + 140px) !important;

  padding-left: 14px !important;

  color: #9da3a8 !important;

  font-size: 12px !important;
  line-height: 1.3 !important;
}


/* Bottom action area like the Root menu footer. */
#root-admit-screen .root-admit-actions {
  position: absolute !important;

  left: 0 !important;
  right: 0 !important;
  bottom: 20px !important;

  height: 52px !important;

  display: flex !important;

  justify-content: center !important;
  align-items: center !important;

  gap: 40px !important;

  margin: 0 !important;
  padding: 0 !important;

  border: 0 !important;

  background: transparent !important;
}


/* Actual Root ADT QML uses 52px action buttons. */
#root-admit-clear,
#root-admit-confirm {
  width: 200px !important;
  min-width: 200px !important;
  max-width: 200px !important;

  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;

  padding: 0 !important;

  border:
    1px solid #555 !important;

  border-radius:
    4px !important;

  background:
    linear-gradient(
      to bottom,
      #343434 0%,
      #1c1c1c 55%,
      #111 100%
    ) !important;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.14) !important;

  color: #fff !important;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif !important;

  font-size: 16px !important;
  font-weight: 500 !important;

  line-height: 52px !important;

  cursor: pointer !important;
}


/* Active Admit button */
#root-admit-confirm {
  border-color: #168db5 !important;

  background:
    linear-gradient(
      to bottom,
      #1594c2 0%,
      #086b91 55%,
      #064d68 100%
    ) !important;
}


/* Real image back button */
#root-admit-back {
  position: absolute !important;

  top: 0 !important;
  left: 0 !important;

  width: 48px !important;
  height: 48px !important;

  padding: 0 !important;

  border: 0 !important;
  background: transparent !important;

  z-index: 20 !important;
}


#root-admit-back .root-back-icon {
  width: 48px !important;
  height: 48px !important;

  object-fit: contain !important;
}


/* Prevent old web-form styling from adding boxes around rows. */
#root-admit-screen .root-admit-fields,
#root-admit-screen .root-patient-fields {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}



/* ============================================================
   ROOT FIXED DESIGN CANVAS
   ============================================================ */

/*
 * The monitor graphic and every overlay use one immutable
 * 1375 x 1144 coordinate system.
 *
 * Scaling happens only on .root-device.
 */
.root-device {
  position: relative !important;

  width: 1402px !important;
  height: 1122px !important;

  min-width: 1402px !important;
  min-height: 1122px !important;

  max-width: none !important;
  max-height: none !important;

  margin: 0 !important;

  transform-origin: top left !important;
}


/*
 * This wrapper represents the Root's transformed dimensions
 * in normal document layout.
 */
.root-scale-box {
  position: relative;

  flex: 0 0 auto;

  margin: auto;
}


/*
 * Keep the original monitor artwork locked to the native
 * design canvas.
 */
.root-photo-frame {
  position: relative !important;

  width: 1402px !important;
  height: 1122px !important;

  aspect-ratio: auto !important;

  overflow: visible;
}


.root-photo {
  position: absolute !important;

  inset: 0 !important;

  width: 1402px !important;
  height: 1122px !important;

  max-width: none !important;
  max-height: none !important;

  object-fit: contain !important;
}


/*
 * Normal condition:
 * center the Root in the available simulator area.
 */
.device-stage {
  align-items: center;
  justify-items: center;

  overflow: hidden;
}


/*
 * Once the Root reaches its 60% minimum size, do not
 * compress it further. Scroll instead.
 */
.device-stage.root-stage-scroll {
  overflow: auto;

  align-items: start;
  justify-items: start;
}


.device-stage.root-stage-scroll
.root-scale-box {
  margin: auto;
}




/* ============================================================
   ROOT BLACKOUT BACKGROUND
   ============================================================ */

/*
 * Make the simulator stage and Root display area black so the
 * underlying image background does not show through.
 */
.device-stage {
  background: #000 !important;
}

.root-scale-box,
.root-device,
.root-photo-frame,
.root-screen-window {
  background: #000 !important;
}

/*
 * Keep all main simulated Root screens black by default.
 */
#root-live-screen,
#root-admit-screen,
#manual-screen,
#review-screen {
  background: #000 !important;
}







/* ============================================================
   ROOT CANONICAL 800 x 1280 DISPLAY
   ============================================================ */

/*
 * Source artwork:
 *
 *     1402 x 1122
 *
 * Actual Root screenshot:
 *
 *     800 x 1280
 *
 * The rectangle below has the SAME aspect ratio as the real
 * Root display.
 *
 *     472 / 755 ~= 800 / 1280
 *
 * From this point forward these four values are the only
 * physical screen alignment values.
 */
.root-screen-viewport {
  position: absolute !important;

  left: 659px !important;
  top: 192px !important;

  width: 448px !important;
  height: 717px !important;

  overflow: hidden !important;

  background: #000 !important;

  border: 0 !important;
  border-radius: 0 !important;

  box-shadow: none !important;

  z-index: 10 !important;
}


/*
 * Native Root application canvas.
 *
 * This is now the authoritative coordinate system for all
 * Root/QML work.
 */
.root-native-screen {
  position: absolute !important;

  left: 0 !important;
  top: 0 !important;

  width: 800px !important;
  height: 1280px !important;

  transform-origin: top left !important;

  /*
   * 755 / 1280 = 0.58984375
   *
   * At this scale:
   *
   * 800  * .58984375 = 471.875
   * 1280 * .58984375 = 755
   *
   * Therefore it fits our 472 x 755 viewport with essentially
   * pixel-perfect native aspect ratio.
   */
  transform:
    scale(0.56) !important;

  background: #000 !important;
}


/*
 * Existing simulated Root interface now fills the complete
 * native 800 x 1280 screen.
 */
.root-native-screen > .root-screen-window {
  position: absolute !important;

  inset: 0 !important;

  width: 800px !important;
  height: 1280px !important;

  min-width: 800px !important;
  min-height: 1280px !important;

  max-width: none !important;
  max-height: none !important;

  margin: 0 !important;

  overflow: hidden !important;

  background: #000 !important;

  border: 0 !important;
  border-radius: 0 !important;

  box-shadow: none !important;
}


/*
 * Main simulated monitoring screen occupies the complete
 * native display.
 */
#root-live-screen {
  position: absolute !important;

  inset: 0 !important;

  width: 800px !important;
  height: 1280px !important;

  overflow: hidden !important;

  background: #000 !important;
}


/*
 * ADULT is part of the native Root screen.
 * It must never sit outside the display.
 */
.root-screen-window > .root-live-profile-overlay,
#root-live-screen .root-live-profile-overlay {
  position: absolute !important;

  top: 8px !important;
  left: 50% !important;

  transform:
    translateX(-50%) !important;

  margin: 0 !important;

  z-index: 100 !important;
}


/*
 * Never allow simulated Root screens to become transparent
 * and reveal baked-in artwork below them.
 */
.root-screen-viewport,
.root-native-screen,
.root-screen-window,
#root-live-screen,
#root-admit-screen,
#manual-screen,
#review-screen {
  background-color: #000 !important;
}


/*
 * The underlying product photograph remains untouched.
 * It lives in the same fixed Root coordinate space.
 */
.root-photo {
  transform: none !important;
  transform-origin: center center !important;
}



/* === ROOT SCREEN FIT CALIBRATION START === */

/*
 * New Root background image fit.
 *
 * We keep the whole Root artwork as-is and fit only the
 * interactive LCD area on the right.
 *
 * Background image dimensions currently in use are based on the
 * updated Root PNG the user supplied.
 */

.root-photo {
  object-fit: contain !important;
  object-position: center center !important;
}

/*
 * Physical LCD opening in the new Root PNG.
 *
 * Tune only these four numbers if we need a final nudge:
 *   left
 *   top
 *   width
 *   height
 */
.root-screen-window {
  position: absolute !important;
  left: 633px !important;
  top: 80px !important;
  width: 596px !important;
  height: 906px !important;

  overflow: hidden !important;
  background: #000 !important;
  z-index: 30 !important;
}

/*
 * Every Root workflow screen renders in one fixed native design
 * coordinate system, then gets scaled into the LCD viewport.
 *
 * Native Root screenshot resolution:
 *   800 x 1280
 *
 * Viewport:
 *   486 x 778
 *
 * Scale:
 *   486 / 800 = 0.6075
 *   778 / 1280 = 0.6078125
 *
 * We use 0.6075 so width is exact and height is effectively exact.
 */
#root-live-screen,
#root-admit-screen,
#root-emr-screen {
  position: absolute !important;

  left: 0 !important;
  top: 0 !important;

  width: 800px !important;
  height: 1280px !important;

  min-width: 800px !important;
  min-height: 1280px !important;

  max-width: none !important;
  max-height: none !important;

  transform-origin: top left !important;

  transform:
    scale(.745, .7078125) !important;

  overflow: hidden !important;

  background: #000 !important;
}

/*
 * Preserve hidden workflow screens.
 */
#root-live-screen.hidden,
#root-admit-screen.hidden,
#root-emr-screen.hidden,
#manual-screen.hidden,
#review-screen.hidden {
  display: none !important;
}

/* === ROOT SCREEN FIT CALIBRATION END === */

/* ------------------------------------------------------------
   EMR PUSH NATIVE LAYOUT
   ------------------------------------------------------------ */

#root-emr-screen {
  display: grid !important;

  grid-template-rows:
    100px
    100px
    minmax(0, 1fr)
    100px !important;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif;
}

#root-emr-screen.hidden {
  display: none !important;
}


#manual-screen,
#review-screen {
  position: relative !important;

  left: auto !important;
  top: auto !important;

  width: auto !important;
  height: auto !important;

  min-width: 0 !important;
  min-height: 0 !important;

  max-width: none !important;
  max-height: none !important;

  transform: none !important;

  overflow-y: auto !important;

  background: #000 !important;
}


/* Root navigation/title area */

#root-emr-screen .screen-header {
  position: relative !important;

  height: 100px !important;
  min-height: 100px !important;
  max-height: 100px !important;

  display: grid !important;

  grid-template-columns:
    260px
    minmax(0, 1fr)
    260px !important;

  align-items: center !important;

  padding:
    0 10px !important;

  background:
    #000 !important;

  color:
    #fff !important;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif !important;

  font-size:
    27px !important;

  font-weight:
    400 !important;

  text-align:
    center !important;
}


/* Patient / clinician section */

#root-emr-screen .patient-strip {
  height: 80px !important;

  margin:
    20px 12px 0 !important;

  padding:
    0 22px !important;

  display: grid !important;

  grid-template-columns:
    1fr 1fr !important;

  align-items: center !important;

  border:
    1px solid #2b2b2b !important;

  border-radius:
    6px !important;

  background:
    linear-gradient(
      #222,
      #151515
    ) !important;
}


#root-emr-screen .patient-strip small {
  font-size: 16px !important;
}


#root-emr-screen .patient-strip span {
  font-size: 22px !important;
}


/* Manual rows */

#root-emr-screen .root-section-title {
  height: 42px !important;

  display: flex !important;
  align-items: center !important;

  padding:
    0 14px !important;

  font-size:
    18px !important;
}


#root-emr-screen .manual-row,
#root-emr-screen .review-row {
  min-height:
    58px !important;

  display:
    grid !important;

  grid-template-columns:
    250px
    minmax(0, 1fr) !important;

  align-items:
    center !important;

  gap:
    18px !important;

  padding:
    0 20px !important;
}


#root-emr-screen .manual-label,
#root-emr-screen .review-label {
  font-size:
    18px !important;

  text-align:
    right !important;
}


#root-emr-screen .root-select,
#root-emr-screen .root-value,
#root-emr-screen .review-box {
  min-height:
    46px !important;

  font-size:
    18px !important;
}


/* Real EMR Push QML reserves 100px at bottom */

#root-emr-screen .screen-footer {
  height: 100px !important;
  min-height: 100px !important;
  max-height: 100px !important;

  display: grid !important;

  place-items: center !important;

  margin: 0 !important;
  padding: 0 !important;

  background:
    #050505 !important;
}


#root-emr-screen .screen-footer button {
  width: 200px !important;
  min-width: 200px !important;
  max-width: 200px !important;

  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;

  padding: 0 !important;

  border:
    1px solid #555 !important;

  border-radius:
    4px !important;

  color:
    #fff !important;

  background:
    linear-gradient(
      to bottom,
      #343434 0%,
      #1c1c1c 55%,
      #111 100%
    ) !important;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.14) !important;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif !important;

  font-size:
    16px !important;

  font-weight:
    500 !important;

  line-height:
    58px !important;

  cursor:
    pointer !important;
}


/* ============================================================
   ROOT REVIEW EWS SUMMARY
   ============================================================ */

#root-emr-screen .root-review-ews {
  margin:
    0 12px !important;

  color:
    #fff !important;

  background:
    #242424 !important;

  border-bottom:
    1px solid #555 !important;
}


#root-emr-screen .root-review-ews-title {
  height:
    42px !important;

  display:
    flex !important;

  align-items:
    center !important;

  padding:
    0 14px !important;

  background:
    #3a3a3a !important;

  border-top:
    1px solid #565656 !important;

  border-bottom:
    1px solid #565656 !important;

  color:
    #ddd !important;

  font-size:
    22px !important;

  font-weight:
    400 !important;
}


#root-emr-screen .root-review-ews-score-area {
  display:
    grid !important;

  grid-template-columns:
    minmax(0, 1fr)
    120px !important;

  gap:
    16px !important;

  padding:
    16px 12px 18px !important;

  background:
    #3a3a3a !important;
}


#root-emr-screen .root-ews-contributors {
  display:
    flex !important;

  flex-wrap:
    wrap !important;

  align-items:
    flex-start !important;

  align-content:
    flex-start !important;

  column-gap:
    14px !important;

  row-gap:
    10px !important;

  width:
    100% !important;
}


#root-emr-screen .root-ews-contributor {
  width:
    88px !important;

  text-align:
    center !important;
}


#root-emr-screen .root-ews-score-shape {
  width:
    60px !important;

  height:
    60px !important;

  margin:
    0 auto 6px !important;

  display:
    grid !important;

  place-items:
    center !important;

  box-sizing:
    border-box !important;

  border:
    2px solid #d2d2d2 !important;

  background:
    linear-gradient(
      145deg,
      #474747,
      #292929
    ) !important;

  color:
    #fff !important;

  font-size:
    34px !important;

  font-weight:
    400 !important;

  line-height:
    1 !important;

  clip-path:
    polygon(
      16% 0,
      100% 0,
      100% 84%,
      84% 100%,
      0 100%,
      0 16%
    ) !important;
}


#root-emr-screen .root-ews-contributor-label {
  color:
    #fff !important;

  font-size:
    14px !important;

  line-height:
    1.15 !important;
}


#root-emr-screen .root-ews-summary-boxes {
  display:
    flex !important;

  flex-direction:
    column !important;

  align-items:
    center !important;

  justify-content:
    center !important;

  gap:
    12px !important;
}


#root-emr-screen .root-ews-total {
  text-align:
    center !important;
}


#root-emr-screen .root-ews-total-value {
  color:
    #fff !important;

  font-size:
    40px !important;

  line-height:
    1 !important;
}


#root-emr-screen .root-ews-total-label {
  margin-top:
    4px !important;

  color:
    #fff !important;

  font-size:
    14px !important;
}


#root-emr-screen .root-ews-risk {
  width:
    88px !important;

  height:
    88px !important;

  display:
    grid !important;

  place-items:
    center !important;

  align-content:
    center !important;

  box-sizing:
    border-box !important;

  border:
    4px solid #c3c8d0 !important;

  background:
    #444 !important;

  clip-path:
    polygon(
      20% 0,
      100% 0,
      100% 80%,
      80% 100%,
      0 100%,
      0 20%
    ) !important;
}


#root-emr-screen .root-ews-risk-value {
  color:
    #fff !important;

  font-size:
    48px !important;

  line-height:
    .9 !important;
}


#root-emr-screen .root-ews-risk-label {
  margin-top:
    5px !important;

  color:
    #fff !important;

  font-size:
    12px !important;
}


#root-emr-screen .root-ews-actions {
  padding:
    18px 24px 20px !important;

  background:
    #242424 !important;

  border-top:
    1px solid #555 !important;
}


#root-emr-screen .root-ews-action {
  display:
    grid !important;

  grid-template-columns:
    18px
    minmax(0, 1fr) !important;

  gap:
    5px !important;

  margin:
    0 0 12px !important;

  color:
    #fff !important;

  font-size:
    18px !important;

  line-height:
    1.25 !important;
}


#root-emr-screen .root-ews-action:last-child {
  margin-bottom:
    0 !important;
}


/* Review gets Back + Submit. */
#root-emr-screen .screen-footer.review-actions {
  display:
    flex !important;

  justify-content:
    center !important;

  align-items:
    center !important;

  gap:
    40px !important;
}


#root-review-submit {
  width:
    200px !important;

  min-width:
    200px !important;

  max-width:
    200px !important;

  height:
    58px !important;

  min-height:
    58px !important;

  max-height:
    58px !important;

  padding:
    0 !important;

  border:
    1px solid #666 !important;

  border-radius:
    4px !important;

  background:
    linear-gradient(
      to bottom,
      #454545 0%,
      #292929 55%,
      #151515 100%
    ) !important;

  box-shadow:
    inset 0 1px 0
    rgba(255,255,255,.16) !important;

  color:
    #fff !important;

  font-family:
    "MasiSansProDEV",
    "Segoe UI",
    Arial,
    sans-serif !important;

  font-size:
    16px !important;

  font-weight:
    500 !important;

  line-height:
    58px !important;

  cursor:
    pointer !important;
}


/* Publish XSL workspace — isolated from existing Policy and EWS styles. */
.publish-workspace {display:grid;grid-template-columns:minmax(270px,320px) minmax(0,1fr);height:calc(100vh - 72px);overflow:hidden;background:#10161d;color:#e9eef4;}
.publish-sidebar {padding:20px;border-right:1px solid #37424d;overflow-y:auto;}
.publish-sidebar h2,.publish-main h2 {margin:0 0 8px;font-size:1.35rem;}
.publish-parameter-list {display:flex;flex-direction:column;gap:7px;margin-top:15px;}
.publish-param {display:flex;flex-direction:column;text-align:left;gap:4px;padding:12px;border:1px solid #364453;border-radius:8px;background:#1c2731;color:#e6edf5;cursor:pointer;}
.publish-param:hover,.publish-param.selected {border-color:#6fb9da;background:#233647;}
.publish-param span,.publish-param small {font-size:0.8rem;color:#aabccc;overflow-wrap:anywhere;}
.publish-main {min-width:0;overflow-y:auto;padding:20px 26px 40px;}
.publish-page-header,.publish-heading-row,.publish-preview-actions {display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;}
.publish-page-actions {display:flex;gap:8px;flex-wrap:wrap;}
.publish-status {padding:10px 12px;margin:16px 0;border:1px solid #37424d;border-radius:6px;color:#b3cbde;}
.publish-status.publish-error {color:#ffc0c0;border-color:#be6767;}
.publish-parameter-editor,.publish-preview-panel {padding:16px;margin-bottom:16px;border:1px solid #37424d;border-radius:10px;background:#18222b;}
.publish-parameter-editor h3,.publish-preview-panel h3 {margin:0 0 7px;}
.publish-date-label {display:flex;align-items:center;gap:8px;color:#bccbd8;}
.publish-date-label input {background:#101820;color:white;border:1px solid #617286;border-radius:5px;padding:9px;}
.publish-value-head,.publish-value-row {display:grid;grid-template-columns:minmax(80px,.5fr) minmax(140px,1fr) minmax(190px,1.4fr) 76px;gap:10px;align-items:center;}
.publish-value-head {margin-top:16px;border-bottom:1px solid #354653;color:#a8c5d7;font-weight:bold;padding:7px 4px;font-size:.9rem;}
.publish-value-row {padding:7px 4px;border-bottom:1px solid #2c3844;}
.publish-value-row input {width:100%;min-width:0;box-sizing:border-box;background:#0f1922;border:1px solid #63758a;color:white;border-radius:5px;padding:10px;font:inherit;}
.publish-value-row button {padding:9px 7px;font-size:.78rem;}
.publish-policy-label {overflow-wrap:anywhere;}
.publish-raw-value {color:#a8becf;font-family:monospace;}
.publish-reset-actions {display:flex;justify-content:flex-end;margin-top:14px;}
.publish-full-checkbox {display:flex;align-items:center;gap:6px;font-size:.85rem;color:#cbd7e2;}
.publish-xsl-preview {white-space:pre;overflow:auto;max-height:50vh;min-height:180px;padding:14px;background:#070d13;border-radius:7px;color:#d5eadf;font:12px/1.55 monospace;}
.publish-empty {padding:24px;color:#a7bccb;}
@media (max-width:850px) {.publish-workspace{grid-template-columns:1fr;height:auto;min-height:calc(100vh - 72px);overflow:visible}.publish-sidebar{max-height:300px;border-right:0;border-bottom:1px solid #37424d}.publish-main{overflow:visible;padding:16px}.publish-value-head,.publish-value-row{grid-template-columns:65px minmax(100px,1fr) minmax(100px,1fr) 64px;gap:4px}}

.auth-pending .publish-workspace {visibility:hidden;}

/* DKorte: POCDescriptor.xml export from the Publish XSL workspace. */
.poc-panel {margin-top:24px;}
.poc-table-header,.poc-row {display:grid;grid-template-columns:35px minmax(200px,1fr) 140px 168px;gap:10px;align-items:center;min-width:650px;}
.poc-table-header {color:#a8c5d7;font-weight:700;border-bottom:1px solid #465564;padding:8px 4px;}
.poc-parameter-table {max-height:450px;overflow:auto;margin:6px 0 20px;}
.poc-row {padding:7px 4px;border-bottom:1px solid #2c3844;}
.poc-name {display:flex;flex-direction:column;overflow-wrap:anywhere;gap:3px;}
.poc-name small {font-size:.77rem;color:#abc1d3;}
.poc-row input {min-width:0;width:100%;box-sizing:border-box;background:#0f1922;border:1px solid #63758a;color:white;border-radius:5px;padding:8px;font:inherit;}
.poc-slot {color:#a8becf;font-family:monospace;}
@media(max-width:800px) {.poc-panel {overflow-x:auto;} .poc-parameter-table {max-height:360px;}}

/* Separate POCDescriptor workspace. Shared grid controls and previews remain consistent. */
.poc-workspace { display:block; height:calc(100vh - 72px); overflow-y:auto; }
.poc-workspace .poc-main { max-width:1500px; margin:auto; overflow:visible; }
.poc-workspace .poc-panel { margin-top:20px; }
