/* Shared SmartEHR visual language for hospital review surfaces. */
html[data-host-page],
html[data-template="ucc"] {
  --ehr-blue: #1855be;
  --ehr-coral: #ff877a;
  --ehr-code: #ac443a;
  --ehr-gradient: linear-gradient(180deg, #4b96e6 0%, #9ce1ee 100%);
  --ehr-font: "Roboto", "IBM Plex Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

html[data-template="ucc"],
html[data-template="ucc"] body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  font-family: var(--ehr-font);
}

html[data-template="ucc"] .app-shell {
  height: 100dvh;
  min-height: 0;
  background: var(--ehr-gradient);
}

html[data-template="ucc"] .soap-results {
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
}

html[data-template="ucc"] .review-template {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 16px;
  padding: 20px 20px 0;
  overflow: hidden;
  background: transparent;
  font-family: var(--ehr-font);
}

html[data-template="ucc"] .review-template:not(.is-theme-linked) {
  --review-accent: var(--ehr-blue);
  --review-card-bg: #fff;
  --review-head-bg: #f0f1f3;
  --review-table-bg: #f5f5f5;
  --review-note-bg: #fff;
  --review-line: #d9dce1;
  --review-line-soft: #edf0f3;
  --review-ink: #252b34;
  --review-text: #333;
  --review-muted: #687382;
  --review-button: #fff;
  --review-button-text: #fff;
  --review-shadow: rgb(24 85 190 / 12%);
}

html[data-template="ucc"] .review-template-head {
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

html[data-template="ucc"] .review-template-head h2 {
  margin: 0 0 5px;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .01em;
}

html[data-template="ucc"] .review-template-head p {
  margin: 0;
  color: #fff;
  font-size: 14px;
  line-height: 1.55;
}

html[data-template="ucc"] .review-close-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 9px;
  background: #fff;
  color: #234571;
}

html[data-template="ucc"] .review-close-button:hover,
html[data-template="ucc"] .review-close-button:focus-visible {
  color: #173f7a;
  background: #e8effb;
  box-shadow: none;
}

html[data-template="ucc"] .review-workspace {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 60%);
  border-radius: 15px;
  background: var(--review-card-bg);
  color: var(--review-text);
  overflow: hidden;
}

html[data-template="ucc"] .review-template .template-soap-tabs {
  flex: 0 0 auto;
  height: auto;
  min-height: 38px;
  gap: 8px;
  padding: 0;
  border-bottom: 1px solid var(--review-line);
  background: transparent;
  overflow-x: auto;
}

html[data-template="ucc"] .review-template-tab {
  flex: 1 0 auto;
  justify-content: center;
  min-height: 38px;
  height: auto;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px 9px 0 0;
  background: #edeef0;
  color: #505967;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: none;
}

html[data-template="ucc"] .review-template-tab span {
  width: auto;
  height: auto;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

html[data-template="ucc"] .review-template-tab[aria-selected="true"],
html[data-template="ucc"] .review-template-tab[aria-selected="true"]:hover {
  border: 0;
  background: var(--ehr-coral);
  color: #51221d;
  box-shadow: none;
}

html[data-template="ucc"] .review-template-tab[aria-selected="true"] span,
html[data-template="ucc"] .review-template-tab:hover span {
  background: transparent;
  color: inherit;
}

html[data-template="ucc"] .review-template-tab:hover {
  background: #e0e7f3;
  color: var(--review-accent);
  box-shadow: none;
}

html[data-template="ucc"] .review-template-tab:focus-visible {
  outline: 2px solid var(--review-accent);
  outline-offset: -3px;
}

html[data-template="ucc"] .review-all-summary {
  flex: 0 0 auto;
  gap: 10px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--review-muted);
  font-size: 13px;
}

html[data-template="ucc"] .review-all-summary strong {
  color: var(--review-ink);
  font-size: 14px;
  font-weight: 600;
}

html[data-template="ucc"] .review-all-summary > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 5px;
  background: #f1f3f7;
  color: #526176;
}

html[data-template="ucc"] .review-all-summary > span::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

html[data-template="ucc"] .review-all-summary.is-done > span {
  background: #e9f5ed;
  color: #236c45;
}

html[data-template="ucc"] .review-all-summary.is-running > span {
  background: #edf3ff;
  color: var(--review-accent);
}

html[data-template="ucc"] .review-all-summary.is-error > span {
  background: #fff0ed;
  color: #a9382f;
}

html[data-template="ucc"] .review-context-notice {
  flex: 0 0 auto;
  margin: 0;
  padding: 9px 12px;
  border-left: 3px solid var(--ehr-coral);
  border-radius: 5px;
  background: #fff4f1;
  color: #844a40;
  font-size: 13px;
  line-height: 1.5;
}

html[data-template="ucc"] .review-source-block {
  flex: 0 0 auto;
  gap: 8px;
}

html[data-template="ucc"] .review-source-block strong {
  font-size: 14px;
  font-weight: 600;
}

html[data-template="ucc"] .review-source-note {
  min-height: 72px;
  max-height: 136px;
  padding: 12px;
  border: 1px solid var(--review-line);
  border-radius: 8px;
  color: var(--review-text);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  resize: none;
}

html[data-template="ucc"] .review-template-grid {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 28%);
  gap: 16px;
  overflow: auto;
}

html[data-template="ucc"] .review-card {
  min-width: 0;
  border: 1px solid var(--review-line-soft);
  border-radius: 8px;
  box-shadow: none;
}

html[data-template="ucc"] .review-suggestions {
  min-height: 150px;
  overflow: auto;
  scrollbar-width: thin;
}

html[data-template="ucc"] .review-all-flat-list {
  flex: 1 1 auto;
  min-height: 0;
}

html[data-template="ucc"] .review-table-head,
html[data-template="ucc"] .review-table-row {
  grid-template-columns: 88px minmax(92px, .3fr) minmax(0, 1fr) 56px 32px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  line-height: 1.45;
}

html[data-template="ucc"] .review-table-head {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 42px;
  border-bottom: 1px solid var(--review-line);
  background: var(--review-card-bg);
  font-size: 13px;
}

html[data-template="ucc"] .review-table-head strong {
  font-weight: 600;
}

html[data-template="ucc"] .review-table-row {
  min-height: 46px;
  border: 0;
  background: var(--review-card-bg);
  color: var(--review-text);
  font-size: 14px;
  cursor: pointer;
  transition: background 140ms ease;
}

html[data-template="ucc"] .review-table-row:nth-child(odd) {
  background: var(--review-table-bg);
}

html[data-template="ucc"] .review-table-row:hover,
html[data-template="ucc"] .review-table-row:focus-within {
  background: #eef3fd;
}

html[data-template="ucc"] .review-system-badge {
  justify-self: start;
  padding: 3px 5px;
  border-radius: 4px;
  background: var(--ehr-coral);
  color: #51221d;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

html[data-template="ucc"] .review-code-value {
  color: var(--ehr-code);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

html[data-template="ucc"] .review-confidence-heading,
html[data-template="ucc"] .review-selection-heading {
  text-align: center;
}

html[data-template="ucc"] .review-table-row input[type="checkbox"] {
  grid-column: 5;
  grid-row: 1;
  justify-self: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--review-accent);
}

html[data-template="ucc"] .review-table-row input[type="checkbox"]::after {
  left: 9px;
  top: 5px;
  width: 6px;
  height: 12px;
  border-width: 0 3px 3px 0;
}

html[data-template="ucc"] .review-table-row input[type="checkbox"]:not(:checked) {
  border: 1px solid #9da9bb;
  background: var(--review-card-bg);
}

html[data-template="ucc"] .review-confidence {
  grid-column: 4;
  grid-row: 1;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  color: var(--review-accent);
}

html[data-template="ucc"] .review-confidence-dots {
  display: inline-flex;
  gap: 5px;
}

html[data-template="ucc"] .review-confidence-dot {
  width: 8px;
  height: 8px;
  border: 1px solid #9da9bb;
  border-radius: 50%;
  background: transparent;
}

html[data-template="ucc"] .review-confidence-dot.is-filled {
  border-color: currentColor;
  background: currentColor;
}

html[data-template="ucc"] .review-confidence.is-unavailable {
  color: var(--review-muted);
}

html[data-template="ucc"] .review-manual-row {
  cursor: default;
}

html[data-template="ucc"] .review-manual-row .review-code-field {
  grid-column: 2;
  grid-row: 1;
}

html[data-template="ucc"] .review-manual-row .review-name-field {
  grid-column: 3;
  grid-row: 1;
}

html[data-template="ucc"] .review-manual-row .review-manual-input {
  height: 36px;
  padding: 6px 8px;
  border-width: 1px;
  border-radius: 5px;
  font-size: 14px;
}

html[data-template="ucc"] .review-manual-actions {
  grid-column: 2 / -1;
  justify-content: flex-end;
  gap: 6px;
}

html[data-template="ucc"] .review-manual-delete-button,
html[data-template="ucc"] .review-manual-unlock-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--review-line);
  border-radius: 4px;
  color: var(--review-accent);
  font-size: 18px;
}

html[data-template="ucc"] .review-add-row {
  padding: 10px 12px;
}

html[data-template="ucc"] .review-add-code-button {
  min-height: 36px;
  border-width: 1px;
  border-radius: 5px;
  font-size: 22px;
}

html[data-template="ucc"] .review-side {
  gap: 12px;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}

html[data-template="ucc"] .review-card h3 {
  padding: 12px;
  background: var(--review-head-bg);
  font-size: 14px;
  font-weight: 600;
}

html[data-template="ucc"] .review-selected-list,
html[data-template="ucc"] .review-soap-match,
html[data-template="ucc"] .review-card p {
  padding: 12px;
  font-size: 14px;
  line-height: 1.6;
}

html[data-template="ucc"] .review-side .review-soap-match p {
  padding: 0;
}

html[data-template="ucc"] .review-empty {
  padding: 14px;
}

html[data-template="ucc"] .review-empty-visual {
  border: 1px dashed var(--review-line);
  border-radius: 8px;
  background: var(--review-table-bg);
}

html[data-template="ucc"] .review-template-footer {
  flex: 0 0 auto;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--review-line-soft);
}

html[data-template="ucc"] .review-template-footer > span {
  flex: 1 1 140px;
  margin-right: auto;
  color: var(--review-muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
}

html[data-template="ucc"] .review-template-footer .button {
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid var(--review-line);
  border-radius: 8px;
  background: var(--review-card-bg);
  color: var(--review-muted);
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

html[data-template="ucc"] .review-template-footer .primary-button {
  border-color: var(--review-accent);
  background: var(--review-accent);
  color: #fff;
}

html[data-template="ucc"] .review-template-footer .button:not(:disabled):hover {
  filter: brightness(.95);
}

html[data-template="ucc"] .review-template-footer .button:focus-visible {
  outline: 3px solid #99b7f0;
  outline-offset: 2px;
}

html[data-template="ucc"] .app-footer {
  min-height: 34px;
  padding: 4px 20px;
  border: 0;
  background: transparent;
  color: #234c79;
}

html[data-template="ucc"] .app-version,
html[data-template="ucc"] .settings-trigger {
  color: #234c79;
  font-family: var(--ehr-font);
}

@media (max-width: 900px) {
  html[data-template="ucc"] .review-template-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(220px, 1fr) minmax(140px, auto);
    align-content: start;
  }

  html[data-template="ucc"] .review-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(140px, 1fr);
  }
}

@media (max-width: 580px) {
  html[data-template="ucc"] .review-template {
    gap: 12px;
    padding: 14px 10px 0;
  }

  html[data-template="ucc"] .review-template-head h2 {
    font-size: 21px;
  }

  html[data-template="ucc"] .review-template-head p {
    font-size: 13px;
  }

  html[data-template="ucc"] .review-workspace {
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  html[data-template="ucc"] .review-template-tab {
    gap: 5px;
    padding: 8px 10px;
    font-size: 12px;
  }

  html[data-template="ucc"] .review-source-column {
    display: none;
  }

  html[data-template="ucc"] .review-table-head,
  html[data-template="ucc"] .review-table-row {
    grid-template-columns: 92px minmax(0, 1fr) 44px 28px;
    gap: 8px;
    padding: 10px;
  }

  html[data-template="ucc"] .review-confidence {
    grid-column: 3;
  }

  html[data-template="ucc"] .review-table-row input[type="checkbox"] {
    grid-column: 4;
  }

  html[data-template="ucc"] .review-manual-row .review-code-field {
    grid-column: 1;
  }

  html[data-template="ucc"] .review-manual-row .review-name-field {
    grid-column: 2;
  }

  html[data-template="ucc"] .review-manual-actions {
    grid-column: 1 / -1;
  }

  html[data-template="ucc"] .review-template-footer > span {
    flex-basis: 100%;
  }

  html[data-template="ucc"] .app-footer {
    padding-inline: 12px;
  }
}

@media (max-height: 560px) {
  html[data-template="ucc"] .review-template {
    gap: 10px;
    padding-top: 10px;
  }

  html[data-template="ucc"] .review-workspace {
    overflow-y: auto;
  }

  html[data-template="ucc"] .review-all-flat-list,
  html[data-template="ucc"] .review-template-grid {
    flex-shrink: 0;
    min-height: 160px;
  }
}

/* HIS-backed SNOMED CT review workspace. */
html[data-template="ucc"] .rw-workbench { --rw-border: #d9dce1; }
html[data-template="ucc"] .rw-workbench button,
html[data-template="ucc"] .rw-workbench select,
html[data-template="ucc"] .rw-workbench input,
html[data-template="ucc"] .rw-workbench textarea { font: inherit; }
html[data-template="ucc"] .rw-workbench button {
  min-height: 32px; padding: 6px 10px; border: 1px solid #cdd6e4; border-radius: 7px;
  color: var(--ehr-blue); background: #fff; font-size: 13px; cursor: pointer;
}
html[data-template="ucc"] .rw-workbench button:hover:not(:disabled) { background: #edf3ff; }
html[data-template="ucc"] .rw-workbench :is(button,a,input,select,textarea,[tabindex]):focus-visible { outline: 2px solid var(--ehr-blue); outline-offset: 2px; }
html[data-template="ucc"] .rw-workbench .review-template-head > button { background: #fff; color: #234571; border-color: #fff; }
html[data-template="ucc"] .rw-workbench .review-template-head > button:is(:hover,:focus-visible):not(:disabled) { background: #e8effb; color: #173f7a; border-color: #c1d3ec; }
html[data-template="ucc"] .rw-workbench .primary-button { background: var(--ehr-blue); border-color: var(--ehr-blue); color: #fff; }
html[data-template="ucc"] .rw-workbench .primary-button:is(:hover,:focus-visible):not(:disabled) { background: #123f8e; border-color: #123f8e; color: #fff; }
html[data-template="ucc"] .rw-workbench button:disabled { background: #e8edf5; border-color: #cdd6e4; color: #53657e; opacity: 1; cursor: not-allowed; }
html[data-template="ucc"] .rw-counts { display: flex; gap: 10px; font-size: 12px; white-space: nowrap; }
html[data-template="ucc"] .rw-counts span { padding: 5px 8px; background: #edf5f0; border-radius: 6px; color: #286043; }
html[data-template="ucc"] .rw-counts span + span { background: #fff0ed; color: #943e34; }
html[data-template="ucc"] .rw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 0 0 auto; font-size: 12px; }
html[data-template="ucc"] .rw-tools label { display: flex; align-items: center; gap: 5px; }
html[data-template="ucc"] .rw-workbench :is(select,input[type="search"],textarea) { min-width: 0; padding: 7px 8px; border: 1px solid var(--rw-border); border-radius: 6px; background: #fff; color: #252b34; }
html[data-template="ucc"] .rw-tools input { flex: 1 1 140px; width: 140px; }
html[data-template="ucc"] .rw-results { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
html[data-template="ucc"] .rw-vocabulary { display: flex; flex-wrap: wrap; gap: 2px; flex: 0 0 auto; border-bottom: 1px solid var(--rw-border); }
html[data-template="ucc"] .rw-vocabulary [role="tab"] {
  position: relative; margin-bottom: -1px; padding: 8px 10px; border: 1px solid var(--rw-border);
  border-top: 3px solid transparent; border-bottom-color: var(--rw-border); border-radius: 8px 8px 0 0;
  background: #fff; color: var(--ehr-blue); font-weight: 600;
}
html[data-template="ucc"] .rw-vocabulary [role="tab"]:focus-visible,
html[data-template="ucc"] .rw-result-pane:focus-visible { outline-offset: -3px; }
html[data-template="ucc"] .rw-layout { display: grid; grid-template-columns: minmax(180px,var(--rw-source-width)) 8px minmax(0,1fr); flex: 1; min-height: 160px; min-width: 0; overflow: hidden; }
html[data-template="ucc"] .rw-source-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--rw-border); border-radius: 9px; overflow: hidden; }
html[data-template="ucc"] .rw-source-head { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; background: #f5f7fa; font-size: 12px; }
html[data-template="ucc"] .rw-source-head label { display: flex; align-items: center; gap: 5px; }
html[data-template="ucc"] .rw-source-head select { max-width: 125px; }
html[data-template="ucc"] .rw-highlight-nav { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 6px 10px; font-size: 12px; border-bottom: 1px solid var(--rw-border); }
html[data-template="ucc"] .rw-highlight-nav button { min-height: 26px; padding: 2px 8px; }
html[data-template="ucc"] .rw-source-text { flex: 1; min-height: 0; padding: 14px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; font-size: 14px; }
html[data-template="ucc"] .rw-source-text mark { background: #fff0ac; border-radius: 2px; color: #252b34; }
html[data-template="ucc"] .rw-source-text mark.is-focused { background: #ffc5b7; box-shadow: 0 0 0 2px #ff877a; }
html[data-template="ucc"] .rw-splitter { cursor: col-resize; touch-action: none; background: linear-gradient(90deg,transparent 3px,#ccd7e7 3px,#ccd7e7 5px,transparent 5px); }
html[data-template="ucc"] .rw-result-pane { flex: 1; min-height: 0; min-width: 0; overflow: auto; border: 1px solid var(--rw-border); border-top: 0; border-radius: 0 0 9px 9px; }
html[data-template="ucc"] .rw-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: auto; font-size: 13px; }
html[data-template="ucc"] .rw-table th,html[data-template="ucc"] .rw-table td { padding: 8px; text-align: left; border: 0; line-height: 1.45; overflow-wrap: anywhere; }
html[data-template="ucc"] .rw-table thead th { position: sticky; top: 0; background: #fff; z-index: 2; font-size: 12px; white-space: nowrap; border-bottom: 1px solid var(--rw-border); }
html[data-template="ucc"] .rw-table thead button { border: 0; background: transparent; padding: 0; white-space: nowrap; }
html[data-template="ucc"] .rw-table tr:nth-child(odd) { background: #f5f5f5; }
html[data-template="ucc"] .rw-table tr:hover { background: #eef3fd; }
html[data-template="ucc"] .rw-table .rw-category th { background: #e9edf3; padding: 5px 10px; font-size: 12px; color: #4a5666; }
html[data-template="ucc"] .rw-category span { float: right; font-weight: 400; }
html[data-template="ucc"] .rw-table td:nth-child(1) { width: 35px; }
html[data-template="ucc"] .rw-table td:nth-child(3) { min-width: 82px; }
html[data-template="ucc"] .rw-table td:nth-child(4) { min-width: 100px; }
html[data-template="ucc"] .rw-table td:nth-child(6) { width: 46px; text-align: center; }
html[data-template="ucc"] .rw-table td:nth-child(7) { width: 38px; }
html[data-template="ucc"] .rw-table a,html[data-template="ucc"] .rw-workbench .rw-span-button { color: #ac443a; text-decoration: none; }
html[data-template="ucc"] .rw-workbench .rw-span-button { padding: 0; border: 0; background: transparent; text-align: left; min-height: 28px; }
html[data-template="ucc"] .rw-table .is-rejected td:nth-child(4) { text-decoration: line-through; color: #7b818a; }
html[data-template="ucc"] .rw-workbench input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--ehr-blue); cursor: pointer; }
html[data-template="ucc"] .rw-auto-select { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
html[data-template="ucc"] .rw-auto-select input { margin: 0; flex: none; }
html[data-template="ucc"] .rw-confidence > span { display: inline-flex; gap: 4px; }
html[data-template="ucc"] .rw-confidence i { width: 8px; height: 8px; border: 1px solid #9da9bb; border-radius: 50%; }
html[data-template="ucc"] .rw-confidence .filled { background: var(--ehr-blue); border-color: var(--ehr-blue); }
html[data-template="ucc"] .rw-review-notes { display: grid; gap: 5px; flex: 0 0 auto; font-size: 12px; }
html[data-template="ucc"] .rw-review-notes textarea { width: 100%; min-height: 54px; max-height: 120px; resize: vertical; font-size: 13px; }
html[data-template="ucc"] .rw-workbench .review-template-footer { flex-wrap: wrap; }
html[data-template="ucc"] .rw-notice { font-size: 12px; overflow-wrap: anywhere; }
html[data-template="ucc"] .rw-muted { color: #687382; font-size: 12px; }
html[data-template="ucc"] .rw-empty { display: grid; place-content: center; min-height: 160px; padding: 24px; color: #687382; text-align: center; }
html[data-template="ucc"] .rw-workbench[data-source-mode="hidden"] .rw-layout,
html[data-template="ucc"] .rw-workbench.is-simple:not([data-source-mode="visible"]) .rw-layout { grid-template-columns: minmax(0,1fr); }
html[data-template="ucc"] .rw-workbench[data-source-mode="hidden"] .rw-source-pane,
html[data-template="ucc"] .rw-workbench[data-source-mode="hidden"] .rw-splitter,
html[data-template="ucc"] .rw-workbench.is-simple:not([data-source-mode="visible"]) .rw-source-pane,
html[data-template="ucc"] .rw-workbench.is-simple:not([data-source-mode="visible"]) .rw-splitter { display: none; }
html[data-template="ucc"] .rw-workbench.is-simple .rw-table :is(th,td):nth-child(2) { display: none; }
@media (max-width: 1000px) {
  html[data-template="ucc"] .rw-workbench:not([data-source-mode="visible"]) .rw-layout { grid-template-columns: minmax(0,1fr); }
  html[data-template="ucc"] .rw-workbench:not([data-source-mode="visible"]) :is(.rw-source-pane,.rw-splitter) { display: none; }
  html[data-template="ucc"] .rw-workbench[data-source-mode="visible"] .rw-layout { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(130px,.7fr) minmax(150px,1fr); gap: 10px; overflow: auto; }
  html[data-template="ucc"] .rw-splitter { display: none; }
  html[data-template="ucc"] .rw-table :is(th,td):nth-child(2) { display: none; }
}
@media (max-width: 580px) {
  html[data-template="ucc"] .rw-workbench .review-workspace { gap: 10px; }
  html[data-template="ucc"] .rw-counts { margin-left: auto; gap: 5px; }
  html[data-template="ucc"] .rw-table { font-size: 12px; }
  html[data-template="ucc"] .rw-table :is(th,td) { padding: 7px 5px; }
  html[data-template="ucc"] .rw-table td:nth-child(4) { min-width: 86px; }
  html[data-template="ucc"] .rw-table td:nth-child(5) { min-width: 75px; }
  html[data-template="ucc"] .rw-table td:nth-child(3) { min-width: 70px; }
  html[data-template="ucc"] .rw-table td:nth-child(3) a { white-space: nowrap; }
  html[data-template="ucc"] .rw-table [data-rw-entry] td:last-child,
  html[data-template="ucc"] .rw-table thead th:last-child { position: sticky; right: 0; background: #fff; box-shadow: -2px 0 4px #d9dce155; }
  html[data-template="ucc"] .rw-table [data-rw-entry] td:last-child { z-index: 1; }
  html[data-template="ucc"] .rw-review-notes textarea { min-height: 45px; }
  html[data-template="ucc"] .rw-workbench .review-template-head { gap: 8px; }
  html[data-template="ucc"] .rw-workbench .review-template-head h2 { font-size: 19px; }
  html[data-template="ucc"] .rw-workbench .review-template-head p { font-size: 12px; }
}

html[data-template="ucc"] .rw-analysis-error { margin: 0; max-height: 100px; overflow: auto; padding: 10px 12px; border: 1px solid #ecc2bc; border-radius: 8px; background: #fff0ed; color: #943e34; font-size: 13px; overflow-wrap: anywhere; }

/* Match the medical coder's vocabulary hues; dark labels stay legible on bright fills. */
html[data-template="ucc"] .rw-vocabulary [data-tab="SNOMEDCT"] { --rw-tab-accent: #ff877a; }
html[data-template="ucc"] .rw-vocabulary [data-tab^="LOINC"] { --rw-tab-accent: #0098f0; }
html[data-template="ucc"] .rw-vocabulary [data-tab^="RXNORM"] { --rw-tab-accent: #07b5d3; }
html[data-template="ucc"] .rw-vocabulary [data-tab="ICD10"] { --rw-tab-accent: #f09000; }
html[data-template="ucc"] .rw-vocabulary [data-tab="NHI"] { --rw-tab-accent: #f6bf41; }
html[data-template="ucc"] .rw-workbench .rw-vocabulary [role="tab"] {
  border-top-color: var(--rw-tab-accent);
  background: color-mix(in srgb,var(--rw-tab-accent) 12%,#fff);
  color: #172b4d;
}
html[data-template="ucc"] .rw-workbench .rw-vocabulary [role="tab"]:is(:hover,:focus-visible):not(:disabled) {
  background: color-mix(in srgb,var(--rw-tab-accent) 28%,#fff);
  color: #172b4d;
}
html[data-template="ucc"] .rw-workbench .rw-vocabulary [role="tab"][aria-selected="true"] {
  border-color: var(--rw-tab-accent);
  background: var(--rw-tab-accent);
  color: #172b4d;
  box-shadow: inset 0 -3px 0 #172b4d;
}
html[data-template="ucc"] .rw-workbench .rw-vocabulary [role="tab"][aria-selected="true"]:is(:hover,:focus-visible):not(:disabled) {
  background: color-mix(in srgb,var(--rw-tab-accent) 85%,#fff);
  color: #172b4d;
}
html[data-template="ucc"] .rw-vocabulary small { font-weight: 400; margin-left: 3px; }
html[data-template="ucc"] .rw-tab-notice { padding: 10px 12px; margin: 0; background: #f2f5fb; color: #506079; font-size: 12px; line-height: 1.6; }

/* Shared help for sorting and automatic acceptance, outside scrolling tables. */
html[data-template="ucc"] .rw-tooltip {
  position: fixed; z-index: 1200; width: min(360px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow: auto; padding: 12px 14px;
  border: 1px solid #cedbec; border-radius: 9px; background: #203c64; color: #fff;
  box-shadow: 0 6px 22px rgb(21 43 74 / 22%); font: 13px/1.7 var(--ehr-font);
  white-space: pre-line; overflow-wrap: anywhere; text-align: left;
}
html[data-template="ucc"] .rw-tooltip[hidden] { display: none; }

/* A stable animation phase survives streaming rerenders of the review table. */
@property --rw-progress-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
html[data-template="ucc"] .rw-results { position: relative; border-radius: 10px; }
html[data-template="ucc"] .rw-analysis-progress { flex: 0 0 auto; padding: 10px 12px; background: #f0f6ff; border: 1px solid #c8d9ef; border-radius: 9px 9px 0 0; }
html[data-template="ucc"] .rw-analysis-progress.is-complete {
  animation: rw-completion-fade var(--rw-completion-duration,600ms) ease var(--rw-completion-delay,2s) forwards;
}
@keyframes rw-completion-fade { from { opacity: 1; } to { opacity: 0; } }
html[data-template="ucc"] .rw-progress-caption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 8px; color: #24529b; }
html[data-template="ucc"] .rw-analysis-state { font-size: 15px; font-variant-numeric: tabular-nums; }
html[data-template="ucc"] .rw-progress-caption small { font-size: 12px; color: #536982; }
html[data-template="ucc"] .rw-progress-track { height: 6px; overflow: hidden; border-radius: 20px; background: #dce6f4; }
html[data-template="ucc"] .rw-progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#3267cb,#35b9d5); }
html[data-template="ucc"] .rw-workbench[data-analysis-state="processing"] .rw-analysis-state {
  animation: rw-analysis-pulse 1.6s ease-in-out infinite;
  animation-delay: var(--rw-pulse-delay,0ms);
}
html[data-template="ucc"] .rw-workbench[data-analysis-state="processing"] .rw-results::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 10px; padding: 3px;
  background: conic-gradient(from var(--rw-progress-angle),#9ebfeb55 0deg,#9ebfeb55 225deg,#3878ed 280deg,#7eeaf4 310deg,#9ebfeb55 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter: drop-shadow(0 0 3px #459edba0);
  animation: rw-progress-orbit 2.6s linear infinite;
  animation-delay: var(--rw-orbit-delay,0ms);
}
html[data-template="ucc"] .rw-workbench[data-analysis-state="error"] .rw-analysis-progress { background: #fff0ed; border-color: #ecc2bc; }
html[data-template="ucc"] .rw-workbench[data-analysis-state="error"] .rw-analysis-state { color: #943e34; }
@keyframes rw-analysis-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes rw-progress-orbit { to { --rw-progress-angle: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  html[data-template="ucc"] .rw-analysis-progress.is-complete { animation: none; }
  html[data-template="ucc"] .rw-workbench[data-analysis-state="processing"] .rw-analysis-state,
  html[data-template="ucc"] .rw-workbench[data-analysis-state="processing"] .rw-results::after { animation: none; }
  html[data-template="ucc"] .rw-workbench[data-analysis-state="processing"] .rw-results::after { background: #4d8cda; }
}
