/* REDESIGN STYLES START*/
:root {
  --Viewer-BG: #000;
  --Primary-Surface: #1C1C1E;
  --Viewer-Border: #3D3C41;
  --Viewer-Surface: #1C1C1E;
  --Viewer-Hover: #3F3F3F;
  --Brand-Primary: #00C5A0;
  --Viewer-Gray-Light: #949396;
  --Viewer-on-Surface: #2C2C2E;
  --Viewer-Accent: #003228;
  --Brand-Palette-green-700: #008C72;
  --Brand-Palette-green-100: #B0EDE2;
  --Viewer-Pressed: #00241D
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden; /* Prevent body scrolling */
  
  background: var(--Viewer-BG,#000);
  color: var(--Primary-White, #FFF);
  font-family: 'Inter';
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.layout {
  position: relative;
  display: flex;
  height: calc(100vh - 80px); /* full height minus navbar */
  width: 100vw;
  padding: 0 16px 16px 16px;
  align-items: flex-start;
  gap: 1rem;
  flex-shrink: 0;
}

/* SIDEBAR START */
.sidebar {
  width: 158px;
  height: 100%;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem
}

/* Filter box over the thumbnail list (thumbnailFilter.js) */
.thumbnail-filter {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 132px; /* same as .thumbnail-card: 120px image + 2*4px padding + 2*2px border */
  height: 28px;
  margin-bottom: -0.5rem; /* the sidebar's 1rem gap is too much here */
  padding: 0 4px 0 24px;
  background: var(--Viewer-BG, #000);
  border: 1px solid var(--Viewer-Border, #3D3C41);
  border-radius: 4px;
  color: var(--Viewer-Gray-Light, #949396);
}

.thumbnail-filter:focus-within {
  border-color: var(--Brand-Primary, #00C5A0);
}

.thumbnail-filter-icon {
  position: absolute;
  left: 8px;
  pointer-events: none;
}

.thumbnail-filter input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--Viewer-White, #FFF);
  font-size: 12px;
}

.thumbnail-filter input::placeholder {
  color: var(--Viewer-Gray-Light, #949396);
}

.thumbnail-filter-count {
  flex-shrink: 0;
  margin-left: 4px;
  font-size: 10px;
  white-space: nowrap;
}

.thumbnail-filter-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--Viewer-Gray-Light, #949396);
  cursor: pointer;
}

.thumbnail-filter-clear:hover {
  background: var(--Viewer-Hover, #3F3F3F);
  color: #fff;
}

.thumbnail-filter-count[hidden],
.thumbnail-filter-clear[hidden],
.thumbnail-filter-empty[hidden] {
  display: none;
}

.thumbnail-container .thumbnail-card.is-filtered-out {
  display: none !important;
}

/* The sidebar spreads its children (space-between): the list takes the room
   between the filter box and the actions, cards from the top as before */
.sidebar > .thumbnail-container {
  flex: 1 1 auto;
  min-height: 0;
}

.thumbnail-filter-empty {
  padding: 8px 4px;
  color: var(--Viewer-Gray-Light, #949396);
  font-size: 12px;
  text-align: center;
}

.thumbnail-container{
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* scroll only vertically if needed */
    align-items: flex-start;
    gap: 1rem;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-BG);
    scrollbar-width: thin;
    -webkit-mask-image: linear-gradient(to bottom, 
    transparent 0px, 
    black 10px, 
    black calc(100% - 10px), 
    transparent 100%);
  mask-image: linear-gradient(to bottom, 
    transparent 0px, 
    black 10px, 
    black calc(100% - 10px), 
    transparent 100%);
}

/* Study Tabs Styling */
.study-tabs-container {
    display: none; /* Hidden by default, shown when multiple studies exist */
    padding: 12px 16px;
    gap: 8px;
    /* one row that scrolls sideways, so more priors never push the viewer down.
       flex-shrink: the overflow lets the main column squeeze the bar and clip
       the tabs' second line, so keep it at its full height. */
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
    background: var(--Viewer-Surface, #1C1C1E);
    border-bottom: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 16px 16px 0 0;
}

.study-tabs-container.active {
    display: flex;
}

.study-tab {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 2px;
}

.study-tab:hover {
    opacity: 0.8;
}

.study-tab.active {
    border: 2px solid var(--Brand-Primary, #00C5A0);
}

.study-tab-date {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.study-tab-patient {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.9;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

.thumbnail-card{
    position: relative;
    background: var(--Primary-Surface,#1C1C1E);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    padding: 0 4px;
    cursor: pointer;
    max-width: 132px;
    border: 2px solid transparent;
}


.thumbnail-title{
    font-size: 12px;
    padding: 8px 4px 0 4px;
}

.thumbnail-slice-thickness{
    font-size: 10px;
    padding: 0 4px;
    color: #3ac4a2;
}

.thumbnail-data{
    font-size: 12px;
    padding: 8px;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.data-detail{
    display: flex;
    gap: 4px;
}

.thumbnail-image{
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    background: var(--Viewer-BG,#000)
}

.thumbnail-image canvas{
    border-radius: 8px;
}

/* Study folder loading (folderSource.js) */
.folder-loading-status{
    font-size: 12px;
    padding: 8px 4px 0 4px;
    color: var(--Brand-Primary, #00C5A0);
}

.thumbnail-card:hover .thumbnail-overlay {
  opacity: 1;
}

.thumbnail-card:hover {
  border: 2px solid var(--Viewer-Border, #3D3C41);
}

/* Focused/selected thumbnail (matches the series loaded in the selected grid).
   Uses outline so it doesn't fight the study-color border. */
.thumbnail-card.highlight {
  outline: 4px solid var(--Brand-Primary, #a7ff03);
  outline-offset: -4px;
}

.thumbnail-card:hover .thumbnail-title{
  color: var(--Brand-Primary, #00C5A0);
}



.thumbnail-overlay {
  position: absolute;
  inset: 0;
  /* background: rgba(0,0,0,0.6); */
  color: white;
  border-radius: 8px;
  pointer-events: auto;
  opacity: 0;
  
  transition: opacity 0.3s ease;
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 8px;

}

.profileDropdown-content {
  display: none;
  position: absolute;
  min-width: 160px;
  z-index: 1;
  border-radius: 8px;
  background: var(--Viewer-on-Surface, #2C2C2E);
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.80);
  padding: 8px;
  bottom:50px;
}


.profileDropdown-content a{
    display: flex;
    padding: 8px 12px 8px 8px;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--Viewer-White, #FFF);
    font-size:12px;
}

.profileDropdown-content a:hover{
    border-radius: 8px;
    background: var(--Viewer-Accent, #003228)
}

.action-container{
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* SIDEBAR END */

/* BUTTONS START */
/* THUMBNAIL BUTTONS */

.thumbnail-overlay button{
    border-radius: 8px;
    background: var(--Viewer-Accent, #003228);;
    border: none;
    color: var(--Viewer-White, #FFF);
    width: 100%;
    padding: 8px;
    display: flex;
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
}

.thumbnail-overlay button:hover{
     background: var(--Brand-Palette-green-900, #005343);
}

.thumbnail-overlay button:active{
     background: var(--Viewer-Pressed, #00241D);
}

/* ACTION BUTTONS */

.action-btn{
    width: 128px;
    display: flex;
    padding:  8px;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    background: var(--Viewer-Surface, #1C1C1E);
    border: 1px solid transparent;
    color: var(--Viewer-White, #FFF);
    font-size: 12px;
    cursor: pointer;
}

.action-btn div{
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover{
  background-color: var(--Viewer-Hover, #3F3F3F);
}

.action-btn:focus{
    border-radius: 8px;
    border: 1px solid var(--Brand-Palette-green-700, #008C72);
    background: var(--Viewer-Accent, #003228);
}

/* MODAL BUTTONS */
.close-btn, .download-btn {
    border-radius: 8px;
    border: none;
    background: var(--Viewer-on-Surface, #2C2C2E);
    display: flex;
    padding: 8px 12px 8px 8px;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #fff;
}

.close-btn:hover, .download-btn:hover{
   background: var(--Viewer-Hover);
}

.primary-btn {
    border-radius: 8px;
    border: none;
    background: var(--Brand-Palette-green-700, #008C72);
    display: flex;
    padding: 8px 16px;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #fff;
}

.primary-btn:hover {
    background: var(--Viewer-Accent, #003228);
}

#seriesUpdateModal .mdl-footer {
    gap: 12px;
    padding: 16px 24px;
}

#seriesUpdateModal .mdl-footer .close-btn,
#seriesUpdateModal .mdl-footer .primary-btn {
    flex: 1 1 0;
    justify-content: center;
}

.download-btn{
  white-space: nowrap;
}

.exam-history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.summary-toggle-btn,
.summary-collapse-btn {
    border-radius: 8px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: transparent;
    color: var(--Viewer-White, #FFF);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
}

.summary-toggle-btn:hover,
.summary-collapse-btn:hover {
    background: var(--Viewer-Hover, #3F3F3F);
}

.summary-toggle-btn.is-active {
    border-color: var(--Brand-Palette-green-700, #008C72);
    background: var(--Viewer-Accent, #003228);
}

.summary-toggle-chevron {
    font-size: 10px;
    line-height: 1;
}

.link-btn{display: inline;}

.link-btn:hover{
    color: #fff; 
    text-decoration: none;
}

/* TOOLBAR BUTTONS */
.tool{
    display: flex;
    padding: 6px;
    align-items: center;
    gap: 4px;
    border-radius: 8px;
    border:2px solid transparent;
    box-sizing: border-box;
    background: var(--Primary-Surface, #1C1C1E);
    cursor: pointer;
    position: relative;
}

.tool:hover, .highlighted-tool-group .tool:hover {
  background: var(--Viewer-Accent, #003228);
}

.tool:active, .highlighted-tool-group  .tool:active {
  background: var(--Viewer-Pressed, #00241D);
}

.tool:focus {
  outline: none;
}

.tool:focus-visible {
  outline: 2px solid var(--Brand-Palette-green-500, #00C5A0);
  outline-offset: 2px;
}

.highlighted-tool-group  .tool{
  background: var(--Viewer-on-Surface, #2C2C2E);
}

.tool.active .icon{
  color: var(--Brand-Palette-green-100, #B0EDE2);
}

.tool.active, .highlighted-tool-group  .tool.active {
  background: var(--Viewer-Accent, #003228);
  border: 2px solid var(--Brand-Palette-green-700, #008C72);
}

/* Local button drag-drop styles */
#localBtn {
  justify-content: center;
}

#localBtn.drag-over {
  background: var(--Viewer-Accent, #003228);
  border: 2px dashed var(--Brand-Palette-green-500, #00C5A0);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

#localBtn.processing {
  opacity: 0.6;
  pointer-events: none;
}

/* BUTTONS END */

/* Main content */
.main-content {
  flex: 1 0 0;
  align-self: stretch;
  overflow: hidden; /* Prevent vertical scroll */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-radius: 16px;
  border: 1px solid var(--Viewer-Border, #3D3C41);
  background: var(--Viewer-BG, #000);
}

.patient-banner{
    border-radius: 8px 8px 0 0;
    background: var(--Viewer-Surface, #1C1C1E);
    display: flex;
    padding: 12px;
    align-items: center;
    gap: 16px;
    font-size:  12px;
    position: relative;
}

.patient-data-label{
  color: #B7B7B7;
}

.patient-data{
    display: flex;
    gap:4px;
}

.patient-banner-impression-action {
    margin-left: auto;
    position: relative;
    flex: 0 0 auto;
}

.patient-banner-impression-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 8px;
    background: var(--Viewer-on-Surface, #2C2C2E);
    color: var(--Viewer-White, #FFF);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.patient-banner-impression-btn:hover,
.patient-banner-impression-btn[aria-expanded="true"] {
    border-color: var(--Brand-Primary, #00C5A0);
    color: var(--Brand-Primary, #00C5A0);
}

.patient-banner-impression-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, 70vw);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1600;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-on-Surface, #2C2C2E);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
    color: var(--Viewer-White, #FFF);
    line-height: 1.4;
    white-space: normal;
}

.patient-banner-impression-tooltip.is-visible {
    display: block;
}

.patient-banner-impression-tooltip::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 10px;
    width: 10px;
    height: 10px;
    transform: rotate(45deg);
    border-left: 1px solid var(--Viewer-Border, #3D3C41);
    border-top: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-on-Surface, #2C2C2E);
}

.patient-banner-impression-tooltip__title {
    margin-bottom: 8px;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.patient-banner-impression-tooltip__body {
    color: var(--Viewer-White, #FFF);
    font-size: 13px;
}
/* MODALS */

.mdl {
  display: none; 
  position: fixed;
  z-index: 3000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; 
  background-color: rgba(0, 0, 0, 0.5); 
}

.mdl-content {
  display: flex;
  flex-direction: column;
  background: var(--Viewer-Surface, #1C1C1E);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Right-side drawers (annotations list, hotkeys legend) slide in from the
   right edge; .is-closing (set by closeDrawer() in index.js) slides them out
   before they are hidden. */
@keyframes drawer-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes drawer-slide-out {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

#drawListModal .mdl-content,
#segListModal .mdl-content,
#hotkeysLegendModal .mdl-content {
  animation: drawer-slide-in 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

#drawListModal.is-closing .mdl-content,
#segListModal.is-closing .mdl-content,
#hotkeysLegendModal.is-closing .mdl-content {
  animation: drawer-slide-out 180ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  #drawListModal .mdl-content,
  #segListModal .mdl-content,
  #hotkeysLegendModal .mdl-content,
  #drawListModal.is-closing .mdl-content,
  #segListModal.is-closing .mdl-content,
  #hotkeysLegendModal.is-closing .mdl-content {
    animation: none;
  }
}

/* Draw list: right side panel, no backdrop, viewport stays visible/usable */
#drawListModal{
    left: auto;
    right: 0;
    width: min(520px, 100vw);
    background-color: transparent;
    overflow: hidden;
}

#drawListModal .mdl-content{
    height: 100%;
    margin: 0;
    width: 100%;
    border-radius: 0;
    border: none;
    border-left: 1px solid var(--Viewer-Border, #3D3C41);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.35);
}

#drawListModal .mdl-body{
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

/* ---------- Draw list cards ---------- */
#drawListModal .mdl-body{
    padding: 0 12px 0 12px;
    display: flex;
    flex-direction: column;
    color: #fff;
    font-size: 13px;
}

#drawListModal .dl-toolbar{
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0 12px 0;
    background: var(--Viewer-Surface, #1C1C1E);
}

#drawListModal .dl-search{
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
}

#drawListModal .dl-options{
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: 0 0 auto;
}

#drawListModal .dl-palette{
    display: inline-flex;
    gap: 2px;
    margin-left: 2px;
}

#drawListModal .dl-palette-dot{
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

#drawListModal .dl-toggle{
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 400;
    font-size: 12px;
    color: #B7B7B7;
    white-space: nowrap;
    cursor: pointer;
}

#drawListModal .dl-toggle input{
    margin: 0;
    padding: 0;
}

#drawListModal .dl-list{
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 0 auto;
}

#drawListModal .dl-group-body{
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#drawListModal .dl-group-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 6px 4px;
    font-size: 11px;
    letter-spacing: 0.55px;
    text-transform: uppercase;
    color: #B7B7B7;
    cursor: pointer;
}

#drawListModal .dl-group.is-current .dl-group-head{
    color: #fff;
}

#drawListModal .dl-group-count{
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 9px;
    text-align: center;
    background: var(--Viewer-on-Surface, #2C2C2E);
}

#drawListModal .dl-card{
    position: relative;
    padding: 10px 12px 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-on-Surface, #2C2C2E);
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}

/* colour accent on the left edge */
#drawListModal .dl-card::before{
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--dl-color, #fff);
}

#drawListModal .dl-card:hover{
    border-color: #5A5960;
}

#drawListModal .dl-card.is-current{
    border-color: var(--Brand-Palette-green-700, #008C72);
    background: #26302D;
}

/* description shown briefly on the image when a measurement is selected */
.draw-description-flash{
    display: none;
    position: absolute;
    z-index: 20;
    max-width: 280px;
    padding: 6px 10px;
    border-radius: 8px;
    border-left: 3px solid var(--draw-colour, #fff);
    background: rgba(28, 28, 30, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 13px;
    line-height: 1.35;
    white-space: pre-line;
    word-break: break-word;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.draw-description-flash.visible{
    opacity: 1;
}

@media print {
    .draw-description-flash{
        display: none !important;
    }
}

#drawListModal .dl-card.is-selected{
    border-color: #ffffff;
    box-shadow: 0 0 0 1px #ffffff, 0 0 12px rgba(255, 255, 255, 0.25);
}

#drawListModal .dl-card.is-hidden > :not(.dl-card-head),
#drawListModal .dl-card.is-hidden .dl-type{
    opacity: 0.45;
}

#drawListModal .dl-card.is-editing{
    cursor: default;
    border-color: #5A5960;
}

#drawListModal .dl-card-head{
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
}

#drawListModal .dl-swatch{
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--dl-color, #fff);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

#drawListModal input.dl-swatch-input{
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

#drawListModal input.dl-swatch-input::-webkit-color-swatch-wrapper{
    padding: 0;
}

#drawListModal input.dl-swatch-input::-webkit-color-swatch{
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

#drawListModal input.dl-swatch-input::-moz-color-swatch{
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

#drawListModal .dl-type{
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#drawListModal .dl-type-icon{
    display: inline-flex;
    color: #B7B7B7;
}

#drawListModal .dl-slice{
    flex: 0 0 auto;
    padding: 1px 8px;
    border-radius: 9px;
    font-size: 11px;
    color: #B7B7B7;
    background: var(--Viewer-Surface, #1C1C1E);
}

#drawListModal .dl-actions{
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

#drawListModal .dl-icon-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 26px;
    height: 26px;
    padding: 0 5px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #949396;
    font-size: 11px;
    cursor: pointer;
}

#drawListModal .dl-icon-btn svg,
#drawListModal .dl-type-icon svg{
    display: block;
    flex: 0 0 auto;
}

#drawListModal .dl-icon-btn:hover{
    background: var(--Viewer-Surface, #1C1C1E);
    color: #fff;
}

#drawListModal .dl-icon-btn.armed,
#drawListModal .dl-delete-all.armed{
    background: #5C1F1F;
    color: #FFB4AB;
}

#drawListModal .dl-note{
    margin-top: 6px;
    color: #fff;
    font-weight: 500;
    word-break: break-word;
}

#drawListModal .dl-primary{
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 6px;
}

#drawListModal .dl-primary-name{
    font-size: 11px;
    color: #B7B7B7;
    text-transform: uppercase;
    letter-spacing: 0.55px;
}

#drawListModal .dl-primary-value{
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

#drawListModal .dl-stats{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 4px 12px;
    margin-top: 6px;
}

#drawListModal .dl-stat{
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

#drawListModal .dl-stat-name{
    font-size: 11px;
    color: #B7B7B7;
}

#drawListModal .dl-stat-value{
    color: #fff;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#drawListModal .dl-desc{
    margin-top: 8px;
    color: #B7B7B7;
    white-space: pre-line;
    word-break: break-word;
}

#drawListModal .dl-empty-value{
    margin-top: 6px;
    color: #949396;
    font-style: italic;
}

#drawListModal .dl-edit{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

#drawListModal .dl-field{
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-weight: 400;
}

#drawListModal .dl-field-name{
    font-size: 11px;
    color: #B7B7B7;
    text-transform: uppercase;
    letter-spacing: 0.55px;
}

#drawListModal .dl-field input[type="text"],
#drawListModal .dl-field textarea{
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 8px;
    background: var(--Viewer-Surface, #1C1C1E);
    color: #fff;
    font: inherit;
    resize: vertical;
}

#drawListModal .dl-hint{
    font-size: 11px;
    color: #949396;
}

#drawListModal .dl-empty,
#drawListModal .dl-no-match{
    padding: 24px 8px;
    text-align: center;
    color: #949396;
}

#drawListModal .dl-footer{
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-Surface, #1C1C1E);
}

#drawListModal .dl-total{
    font-size: 12px;
    color: #B7B7B7;
}

#drawListModal .dl-delete-all{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}

#drawListModal .dl-delete-all:hover{
    background: var(--Viewer-on-Surface, #2C2C2E);
}

/* ---------- Segmentations drawer (segOverlay.js), same look as the draw list ---------- */
#segListModal{
    left: auto;
    right: 0;
    width: min(420px, 100vw);
    background-color: transparent;
    overflow: hidden;
}

#segListModal .mdl-content{
    height: 100%;
    margin: 0;
    width: 100%;
    border-radius: 0;
    border: none;
    border-left: 1px solid var(--Viewer-Border, #3D3C41);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.35);
}

#segListModal .mdl-body{
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #fff;
    font-size: 13px;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

#segListModal .dl-list{
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#segListModal .dl-group-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 4px 6px 4px;
    font-size: 11px;
    letter-spacing: 0.55px;
    text-transform: uppercase;
    color: #B7B7B7;
}

#segListModal .dl-group-count{
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 9px;
    text-align: center;
    background: var(--Viewer-on-Surface, #2C2C2E);
}

#segListModal .dl-group-body{
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#segListModal .dl-card{
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-on-Surface, #2C2C2E);
    cursor: grab;
    transition: border-color 0.12s ease;
}

#segListModal .dl-card:hover{
    border-color: #5A5960;
}

#segListModal .dl-card-head{
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
}

#segListModal .dl-type{
    min-width: 0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#segListModal .dl-slice{
    flex: 0 0 auto;
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 9px;
    font-size: 11px;
    color: #B7B7B7;
    background: var(--Viewer-Surface, #1C1C1E);
}

#segListModal .dl-swatch{
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--dl-color, #fff);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

#segListModal .dl-hint{
    font-size: 11px;
    color: #949396;
}

#segListModal .dl-empty{
    padding: 24px 8px;
    text-align: center;
    color: #949396;
}

#segListModal .dl-icon-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #949396;
    cursor: pointer;
}

#segListModal .dl-icon-btn:hover{
    background: var(--Viewer-Surface, #1C1C1E);
    color: #fff;
}

#segListModal .seg-segments{
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 6px 0 8px 0;
}

#segListModal .seg-segment{
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 -6px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}

#segListModal .seg-segment:hover{
    color: #fff;
}

/* compact version of the shared .switch / .toggle-slider */
#segListModal .seg-all-toggle{
    flex: 0 0 auto;
    width: 30px;
    height: 18px;
    margin: 0;
}

#segListModal .seg-all-toggle .toggle-slider:before{
    width: 12px;
    height: 12px;
    left: 3px;
    bottom: 3px;
}

#segListModal .seg-all-toggle input:checked + .toggle-slider:before{
    transform: translateX(12px);
}

#segListModal .seg-segment-label{
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#segListModal .seg-segment-label:hover{
    text-decoration: underline;
}

#segListModal .seg-opacity{
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    cursor: default;
}

#segListModal .seg-opacity-slider{
    width: 80px;
    padding: 0;
    background: transparent;
    accent-color: var(--Brand-Palette-green-500, #00C5A0);
    cursor: pointer;
}

/* visibility (not display) keeps the label column width stable when the selection moves */
#segListModal .seg-segment:not(.is-selected) .seg-opacity{
    visibility: hidden;
}

#segListModal .seg-segment.is-selected{
    background: rgba(0, 197, 160, 0.15);
    box-shadow: inset 2px 0 0 var(--Brand-Palette-green-500, #00C5A0);
}

/* picked by clicking the segment in a viewport */
#segListModal .seg-segment.is-flash{
    animation: seg-row-flash 1.2s ease-out;
}

@keyframes seg-row-flash{
    0%, 30% { background: rgba(0, 197, 160, 0.45); }
    100% { background: rgba(0, 197, 160, 0.15); }
}

#segListModal .seg-segment.is-selected .seg-segment-label{
    color: var(--Brand-Palette-green-500, #00C5A0);
    font-weight: 600;
}

#segListModal .seg-smoothing{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

#segListModal .seg-smoothing-label{
    flex: 0 0 auto;
    font-size: 12px;
    color: #E5E2E6;
}

#segListModal .seg-smoothing-slider{
    flex: 1 1 auto;
    width: auto;
    min-width: 60px;
}

#segListModal .seg-opacity-value{
    width: 32px;
    text-align: right;
    font-size: 11px;
    color: #949396;
}

#segListModal .seg-segment.is-hidden{
    opacity: 0.4;
}

#segListModal .seg-segment.is-hidden .dl-swatch{
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--dl-color, #fff);
}

#segListModal .seg-shown-on{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#segListModal .seg-chip{
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 2px 1px 8px;
    border-radius: 9px;
    font-size: 11px;
    border: 1px solid var(--Brand-Palette-green-700, #008C72);
    background: #26302D;
}

#segListModal .seg-note:not(:empty){
    margin-top: 6px;
    color: #FFB4AB;
}

#examsHistoryModal .mdl-content,
#patientJourneyModal .mdl-content {
    width: min(1240px, calc(100vw - 48px));
    height: min(720px, calc(100vh - 48px));
    margin: 24px auto;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
}

#patientJourneyModal .mdl-content {
    width: min(1240px, calc(100vw - 48px));
    height: min(720px, calc(100vh - 48px));
    margin: 24px auto;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
}

#examsHistoryModal .mdl-header.exam-history-modal-header,
#patientJourneyModal .mdl-header.patient-journey-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.exam-history-modal-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exam-history-modal-title-row,
.patient-journey-modal-title-row {
    align-items: flex-start;
    gap: 12px;
}

.exam-history-modal-title-copy,
.patient-journey-modal-title-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exam-history-modal-title,
.patient-journey-modal-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--Viewer-White, #FFF);
}

.patient-journey-modal-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exam-history-modal-title-row,
.patient-journey-modal-title-row {
    align-items: flex-start;
    gap: 12px;
}

.exam-history-modal-title-copy,
.patient-journey-modal-title-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exam-history-modal-title,
.patient-journey-modal-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--Viewer-White, #FFF);
}

.patient-journey-close-btn,
.exam-history-close-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    background: transparent;
}

.patient-journey-close-btn:hover,
.exam-history-close-btn:hover {
    background: var(--Viewer-Hover, #3F3F3F);
}

.patient-journey-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.patient-journey-step {
    height: 100%;
    min-height: 0;
}

.patient-journey-setup-step,
.patient-journey-loading-step {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.patient-journey-setup-card,
.patient-journey-loading-card {
    width: min(560px, 100%);
    border-radius: 16px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.patient-journey-setup-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--Brand-Primary, #00C5A0);
    background: var(--Viewer-Accent, #003228);
    border: 1px solid var(--Brand-Palette-green-700, #008C72);
}

.patient-journey-setup-card h2,
.patient-journey-loading-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.patient-journey-setup-card p,
.patient-journey-loading-copy,
.patient-journey-status {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 13px;
    line-height: 1.5;
}

.patient-journey-modality-label {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--Brand-Primary, #00C5A0);
}

.patient-journey-modality-grid,
.patient-journey-filter-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.patient-journey-modality-grid {
    gap: 14px;
    width: 100%;
}

.patient-journey-modality-card,
.patient-journey-filter-option {
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    color: var(--Viewer-White, #FFF);
    cursor: pointer;
}

.patient-journey-modality-card {
    min-height: 136px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.patient-journey-modality-card:hover,
.patient-journey-modality-card.is-selected,
.patient-journey-filter-option:hover,
.patient-journey-filter-option.is-selected {
    border-color: rgba(0, 197, 160, 0.55);
    background: rgba(0, 197, 160, 0.08);
}

.patient-journey-modality-icon {
    color: var(--Brand-Primary, #00C5A0);
}

.patient-journey-modality-code {
    font-size: 22px;
    font-weight: 700;
}

.patient-journey-modality-name {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.patient-journey-generate-btn,
.patient-journey-filter-btn {
    width: auto;
    min-width: 150px;
    padding: 0 16px;
    gap: 8px;
}

.patient-journey-generate-btn {
    min-height: 44px;
    padding: 0 20px;
    justify-content: center;
    border: 1px solid rgba(0, 197, 160, 0.65);
    background: var(--Brand-Primary, #00C5A0);
    color: #001F19;
    font-size: 14px;
    font-weight: 700;
}

.patient-journey-generate-btn:hover:not(:disabled) {
    background: var(--Brand-Palette-green-100, #B0EDE2);
}

.patient-journey-filter-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.patient-journey-generate-btn:disabled,
.patient-journey-filter-apply-btn:disabled,
.exam-history-load-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.patient-journey-detail-topbar {
    position: relative;
}

.patient-journey-filter-menu {
    display: none;
    position: absolute;
    top: 42px;
    right: 0;
    z-index: 2;
    width: 220px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-Surface, #242329);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.patient-journey-filter-menu.is-open {
    display: block;
}

.patient-journey-filter-title {
    margin-bottom: 10px;
    color: var(--Viewer-White, #FFF);
    font-size: 12px;
    font-weight: 600;
}

.patient-journey-filter-options {
    gap: 8px;
}

.patient-journey-filter-option {
    min-height: 34px;
    border-radius: 8px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    color: var(--Viewer-White, #FFF);
    cursor: pointer;
}

.patient-journey-filter-option:hover,
.patient-journey-filter-option.is-selected {
    border-color: rgba(0, 197, 160, 0.55);
    background: rgba(0, 197, 160, 0.08);
}

.patient-journey-modality-icon {
    color: var(--Brand-Primary, #00C5A0);
}

.patient-journey-modality-code {
    font-size: 22px;
    font-weight: 700;
}

.patient-journey-modality-name {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.patient-journey-generate-btn,
.patient-journey-filter-btn {
    width: auto;
    min-width: 150px;
    padding: 0 16px;
    gap: 8px;
}

.patient-journey-generate-btn {
    min-height: 44px;
    padding: 0 20px;
    justify-content: center;
    border: 1px solid rgba(0, 197, 160, 0.65);
    background: var(--Brand-Primary, #00C5A0);
    color: #001F19;
    font-size: 14px;
    font-weight: 700;
}

.patient-journey-generate-btn:hover:not(:disabled) {
    background: var(--Brand-Palette-green-100, #B0EDE2);
}

.patient-journey-filter-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.patient-journey-generate-btn:disabled,
.patient-journey-filter-apply-btn:disabled,
.exam-history-load-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.patient-journey-detail-topbar {
    position: relative;
}

.patient-journey-filter-menu {
    display: none;
    position: absolute;
    top: 42px;
    right: 0;
    z-index: 2;
    width: 220px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-Surface, #242329);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.patient-journey-filter-menu.is-open {
    display: block;
}

.patient-journey-filter-title {
    margin-bottom: 10px;
    color: var(--Viewer-White, #FFF);
    font-size: 12px;
    font-weight: 600;
}

.patient-journey-filter-options {
    gap: 8px;
}

.patient-journey-filter-option {
    min-height: 34px;
    border-radius: 8px;
}

.patient-journey-filter-status {
    min-height: 18px;
    margin: 10px 0;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 11px;
}

.patient-journey-filter-status.is-error {
    color: #ff9d9d;
}

.patient-journey-filter-apply-btn {
    width: 100%;
    min-width: 0;
}

.patient-journey-loader {
    width: 44px;
    height: 44px;
    border-width: 4px;
}

.patient-journey-results-step {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
}

.patient-journey-timeline-pane {
    width: 420px;
    min-width: 420px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
}

.patient-journey-timeline-headings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
}

.patient-journey-timeline-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.patient-journey-timeline-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

.patient-journey-timeline-item {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--Viewer-White, #FFF);
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
    cursor: pointer;
    width: 100%;
}

.patient-journey-timeline-item:hover,
.patient-journey-timeline-item.is-active {
    background: rgba(0, 197, 160, 0.08);
}

.patient-journey-timeline-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    background: var(--patient-journey-study-color, var(--Brand-Primary, #00C5A0));
    box-shadow: 0 0 0 3px rgba(0, 197, 160, 0.12);
}

.patient-journey-timeline-column.has-finding .patient-journey-timeline-dot {
    background: var(--Brand-Primary, #00C5A0);
    box-shadow: 0 0 0 3px rgba(0, 197, 160, 0.16);
}

.patient-journey-timeline-column.no-finding .patient-journey-timeline-dot {
    background: #E05A5A;
    box-shadow: 0 0 0 3px rgba(224, 90, 90, 0.16);
}

.patient-journey-timeline-date {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 11px;
    line-height: 1.15;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.patient-journey-timeline-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.patient-journey-timeline-preview {
    color: #D7D7D7;
    font-size: 12px;
    line-height: 1.45;
}

.patient-journey-detail-pane,
.exam-history-detail-pane {
    flex: 1 1 auto;
    min-width: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.patient-journey-detail-pane {
    gap: 18px;
}

.patient-journey-detail-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.patient-journey-detail-heading {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.patient-journey-report-heading {
    margin-top: 4px;
    font-size: 18px;
}

.patient-journey-overview-card,
.patient-journey-detail-card,
.exam-history-detail-card,
.exam-history-summary-section {
    border-radius: 12px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    padding: 18px 20px;
}

.patient-journey-overview-text,
.patient-journey-detail-card,
.patient-journey-empty,
.exam-history-summary-section__content,
.exam-history-summary-empty,
.exam-history-empty {
    font-size: 13px;
    line-height: 1.5;
    color: var(--Viewer-White, #FFF);
}

.patient-journey-empty {
    color: var(--Viewer-Gray-Light, #949396);
}

.patient-journey-overview-text p {
    margin: 0 0 10px;
}

.patient-journey-overview-text p:last-child {
    margin-bottom: 0;
}

.patient-journey-overview-heading {
    margin: 14px 0 6px;
    color: var(--Viewer-White, #FFF);
    font-weight: 700;
}

.patient-journey-overview-heading:first-child {
    margin-top: 0;
}

.patient-journey-detail-meta {
    margin-bottom: 12px;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.patient-journey-detail-section + .patient-journey-detail-section {
    margin-top: 14px;
}

.patient-journey-detail-section-title {
    margin-bottom: 6px;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.patient-journey-close-btn,
.exam-history-close-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    background: transparent;
}

.patient-journey-close-btn:hover,
.exam-history-close-btn:hover {
    background: var(--Viewer-Hover, #3F3F3F);
}

.patient-journey-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.patient-journey-step {
    height: 100%;
    min-height: 0;
}

.patient-journey-setup-step,
.patient-journey-loading-step {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.patient-journey-setup-card,
.patient-journey-loading-card {
    width: min(560px, 100%);
    border-radius: 16px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.patient-journey-setup-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--Brand-Primary, #00C5A0);
    background: var(--Viewer-Accent, #003228);
    border: 1px solid var(--Brand-Palette-green-700, #008C72);
}

.patient-journey-setup-card h2,
.patient-journey-loading-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.patient-journey-setup-card p,
.patient-journey-loading-copy,
.patient-journey-status {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 13px;
    line-height: 1.5;
}

.patient-journey-modality-label {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--Brand-Primary, #00C5A0);
}

.patient-journey-modality-grid,
.patient-journey-filter-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.patient-journey-modality-grid {
    gap: 14px;
    width: 100%;
}

.patient-journey-modality-card,
.patient-journey-filter-option {
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    color: var(--Viewer-White, #FFF);
    cursor: pointer;
}

.patient-journey-modality-card {
    min-height: 136px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.patient-journey-modality-card:hover,
.patient-journey-modality-card.is-selected,
.patient-journey-filter-option:hover,
.patient-journey-filter-option.is-selected {
    border-color: rgba(0, 197, 160, 0.55);
    background: rgba(0, 197, 160, 0.08);
}

.patient-journey-modality-icon {
    color: var(--Brand-Primary, #00C5A0);
}

.patient-journey-modality-code {
    font-size: 22px;
    font-weight: 700;
}

.patient-journey-modality-name {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.patient-journey-generate-btn,
.patient-journey-filter-btn {
    width: auto;
    min-width: 150px;
    padding: 0 16px;
    gap: 8px;
}

.patient-journey-generate-btn {
    min-height: 44px;
    padding: 0 20px;
    justify-content: center;
    border: 1px solid rgba(0, 197, 160, 0.65);
    background: var(--Brand-Primary, #00C5A0);
    color: #001F19;
    font-size: 14px;
    font-weight: 700;
}

.patient-journey-generate-btn:hover:not(:disabled) {
    background: var(--Brand-Palette-green-100, #B0EDE2);
}

.patient-journey-filter-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.patient-journey-generate-btn:disabled,
.patient-journey-filter-apply-btn:disabled,
.exam-history-load-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.patient-journey-detail-topbar {
    position: relative;
}

.patient-journey-filter-menu {
    display: none;
    position: absolute;
    top: 42px;
    right: 0;
    z-index: 2;
    width: 220px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-Surface, #242329);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.patient-journey-filter-menu.is-open {
    display: block;
}

.patient-journey-filter-title {
    margin-bottom: 10px;
    color: var(--Viewer-White, #FFF);
    font-size: 12px;
    font-weight: 600;
}

.patient-journey-filter-options {
    gap: 8px;
}

.patient-journey-filter-option {
    min-height: 34px;
    border-radius: 8px;
}

.patient-journey-filter-status {
    min-height: 18px;
    margin: 10px 0;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 11px;
}

.patient-journey-filter-status.is-error {
    color: #ff9d9d;
}

.patient-journey-filter-apply-btn {
    width: 100%;
    min-width: 0;
}

.patient-journey-loader {
    width: 44px;
    height: 44px;
    border-width: 4px;
}

.patient-journey-results-step {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
}

.patient-journey-timeline-pane {
    width: 420px;
    min-width: 420px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
}

.patient-journey-timeline-headings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
}

.patient-journey-timeline-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.patient-journey-timeline-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

.patient-journey-timeline-item {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--Viewer-White, #FFF);
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
    cursor: pointer;
    width: 100%;
}

.patient-journey-timeline-item:hover,
.patient-journey-timeline-item.is-active {
    background: rgba(0, 197, 160, 0.08);
}

.patient-journey-timeline-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    background: var(--patient-journey-study-color, var(--Brand-Primary, #00C5A0));
    box-shadow: 0 0 0 3px rgba(0, 197, 160, 0.12);
}

.patient-journey-timeline-column.has-finding .patient-journey-timeline-dot {
    background: var(--Brand-Primary, #00C5A0);
    box-shadow: 0 0 0 3px rgba(0, 197, 160, 0.16);
}

.patient-journey-timeline-column.no-finding .patient-journey-timeline-dot {
    background: #E05A5A;
    box-shadow: 0 0 0 3px rgba(224, 90, 90, 0.16);
}

.patient-journey-timeline-date {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 11px;
    line-height: 1.15;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.patient-journey-timeline-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.patient-journey-timeline-preview {
    color: #D7D7D7;
    font-size: 12px;
    line-height: 1.45;
}

.patient-journey-detail-pane,
.exam-history-detail-pane {
    flex: 1 1 auto;
    min-width: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.patient-journey-detail-pane {
    gap: 18px;
}

.patient-journey-detail-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.patient-journey-detail-heading {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.patient-journey-report-heading {
    margin-top: 4px;
    font-size: 18px;
}

.patient-journey-overview-card,
.patient-journey-detail-card,
.exam-history-detail-card,
.exam-history-summary-section {
    border-radius: 12px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    padding: 18px 20px;
}

.patient-journey-overview-text,
.patient-journey-detail-card,
.patient-journey-empty,
.exam-history-summary-section__content,
.exam-history-summary-empty,
.exam-history-empty {
    font-size: 13px;
    line-height: 1.5;
    color: var(--Viewer-White, #FFF);
}

.patient-journey-empty {
    color: var(--Viewer-Gray-Light, #949396);
}

.patient-journey-detail-meta {
    margin-bottom: 12px;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.patient-journey-detail-section + .patient-journey-detail-section {
    margin-top: 14px;
}

.patient-journey-detail-section-title {
    margin-bottom: 6px;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.exam-history-modal-subtitle {
    display: none;
}

.exam-history-modal-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.exam-history-timeline-column {
    width: 420px;
    min-width: 420px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px 20px 24px 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.exam-history-column-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--Brand-Primary, #00C5A0);
}

.exam-history-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 18px;
    padding-left: 26px;
    padding-right: 4px;
    overflow-x: hidden;
    overflow-y: auto;
}

.exam-history-timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: rgba(255, 255, 255, 0.14);
}

.exam-history-timeline-item {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    gap: 8px;
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    background: rgba(255, 255, 255, 0.02);
    text-align: left;
    color: var(--Viewer-White, #FFF);
    cursor: pointer;
    overflow: hidden;
}

.exam-history-timeline-item::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: var(--Primary-Surface, #1C1C1E);
}

.exam-history-timeline-item::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--exam-history-study-color, transparent);
    opacity: 1;
}

.exam-history-timeline-item:hover,
.exam-history-timeline-item.is-active {
    border-color: rgba(0, 197, 160, 0.55);
    background: rgba(0, 197, 160, 0.08);
}

.exam-history-timeline-item.is-active::before {
    border-color: var(--Brand-Primary, #00C5A0);
    background: var(--Brand-Primary, #00C5A0);
}

.exam-history-timeline-item__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--Viewer-Gray-Light, #949396);
}

.exam-history-timeline-item__title {
    display: none;
}

.exam-history-timeline-item__preview {
    font-size: 13px;
    line-height: 1.5;
    color: #D7D7D7;
    display: block;
    overflow: visible;
    word-break: break-word;
}

.exam-history-timeline-item__preview--clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exam-history-timeline-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(0, 197, 160, 0.14);
    color: var(--Brand-Primary, #00C5A0);
    font-weight: 700;
}

.exam-history-detail-pane {
    gap: 20px;
}

.exam-history-detail-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.exam-history-detail-heading-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.exam-history-detail-heading {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}

.exam-history-detail-context {
    display: none;
}

.exam-history-detail-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.exam-history-load-btn {
    background: var(--Viewer-Accent, #003228);
    border: 1px solid var(--Brand-Palette-green-700, #008C72);
    width: auto;
    min-width: 74px;
    padding: 0 14px;
    gap: 6px;
}

.exam-history-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.exam-history-load-btn span {
    font-size: 13px;
    line-height: 1;
}

.exam-history-original-report-btn {
    box-sizing: border-box;
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
}

.exam-history-original-report-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.exam-history-download-btn svg {
    display: block;
    margin: 0 auto;
}

.exam-history-download-btn.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Report download links without an href (non-local installation) still look clickable */
.download-btn[role="button"]:not(.is-disabled) {
    cursor: pointer;
}

.exam-history-detail-metadata {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.exam-history-detail-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.exam-history-detail-card__label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--Viewer-Gray-Light, #949396);
}

.exam-history-detail-card__value {
    font-size: 30px;
    font-weight: 700;
    color: var(--Brand-Primary, #00C5A0);
    line-height: 1.1;
}

.exam-history-detail-card--description .exam-history-detail-card__value {
    font-size: 18px;
    line-height: 1.4;
    color: var(--Viewer-White, #FFF);
    text-transform: none;
}

.exam-history-summary-panel {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.exam-history-summary-panel.is-hidden {
    display: none;
}

.exam-history-summary-panel.is-visible {
    display: block;
}

.exam-history-summary-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.exam-history-summary-title {
    font-size: 16px;
    font-weight: 600;
}

.exam-history-summary-status {
    font-size: 12px;
    color: var(--Viewer-Gray-Light, #949396);
    margin-bottom: 4px;
}

.exam-history-summary-status.is-error {
    color: #ff9d9d;
}

.exam-history-summary-panel__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.exam-history-summary-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exam-history-summary-section.exam-history-summary-card--impression {
    border-left: 5px solid var(--exam-history-study-color, var(--Brand-Primary, #00C5A0));
}

.exam-history-summary-section__title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--Brand-Primary, #00C5A0);
}

.exam-history-summary-section__content,
.exam-history-summary-empty,
.exam-history-empty {
    white-space: pre-wrap;
}

/* Shared compact clinical-review shell. The Summary and Journey blocks retain their existing layout rules. */
#clinicalReviewModal .clinical-review-modal-content {
    width: min(1240px, calc(100vw - 48px));
    height: min(720px, calc(100vh - 48px));
    margin: 24px auto;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
}

#clinicalReviewModal .clinical-review-modal-header {
    min-height: 72px;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
}

.clinical-review-modal-heading {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 28px;
}

.clinical-review-modal-title {
    color: var(--Viewer-White, #FFF);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.clinical-review-mode-control {
    display: flex;
    align-self: stretch;
    gap: 0;
}

.clinical-review-mode-btn {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #C9D2D0;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 0 16px;
}

.clinical-review-mode-btn:hover {
    color: var(--Viewer-White, #FFF);
}

.clinical-review-mode-btn.is-active {
    border-bottom-color: var(--Brand-Primary, #00C5A0);
    color: var(--Brand-Primary, #00C5A0);
}

.clinical-review-mode-btn:disabled,
.clinical-review-mode-btn:disabled:hover {
    border-bottom-color: transparent;
    color: var(--Viewer-Gray-Light, #949396);
    cursor: not-allowed;
    opacity: 0.45;
}

.clinical-review-mode-btn.is-active:disabled {
    border-bottom-color: var(--Brand-Primary, #00C5A0);
}

.clinical-review-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.clinical-review-sources-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--Viewer-Gray-Light, #949396);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.clinical-review-sources-btn:hover,
.clinical-review-sources-btn.is-active {
    background: var(--Viewer-Hover, #3F3F3F);
    color: var(--Brand-Primary, #00C5A0);
}

.clinical-review-sources-btn:disabled,
.clinical-review-sources-btn:disabled:hover {
    background: transparent;
    color: var(--Viewer-Gray-Light, #949396);
    cursor: not-allowed;
    opacity: 0.45;
}

.clinical-review-close-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    background: transparent;
}

.clinical-review-close-btn:hover {
    background: var(--Viewer-Hover, #3F3F3F);
}

.clinical-review-view {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#clinicalReviewSummaryView {
    display: flex;
    flex-direction: column;
}

#clinicalReviewJourneyView {
    display: flex;
}

#clinicalReviewJourneyView .patient-journey-body {
    width: 100%;
}

#clinicalReviewModal.is-reviewing-sources .clinical-review-modal-content {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
}

#clinicalReviewModal.is-reviewing-sources .clinical-review-modal-header {
    min-height: 72px;
}

.clinical-review-expanded-view {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    grid-template-columns: minmax(240px, 19%) minmax(380px, 1fr) minmax(420px, 34%);
    background: #111112;
}

.clinical-review-expanded-timeline,
.clinical-review-expanded-main,
.clinical-review-expanded-source {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.clinical-review-expanded-timeline,
.clinical-review-expanded-main {
    border-right: 1px solid var(--Viewer-Border, #3D3C41);
}

.clinical-review-expanded-pane-title {
    min-height: 60px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--Viewer-Border, #3D3C41);
    color: var(--Viewer-White, #FFF);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.clinical-review-expanded-main-header {
    min-height: 60px;
    border-bottom: 1px solid var(--Viewer-Border, #3D3C41);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-right: 16px;
    position: relative;
    z-index: 3;
}

.clinical-review-expanded-main-header .clinical-review-expanded-pane-title {
    border-bottom: 0;
}

.clinical-review-expanded-journey-filter-btn {
    flex: 0 0 auto;
}

.clinical-review-expanded-timeline-body,
.clinical-review-expanded-main-body,
.clinical-review-expanded-source-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.clinical-review-expanded-timeline-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.clinical-review-expanded-timeline-body.is-summary,
.clinical-review-expanded-timeline-body.is-journey {
    gap: 14px;
    padding: 24px 20px 24px 24px;
}

.clinical-review-expanded-timeline-body.is-summary .exam-history-timeline {
    width: 100%;
}

.clinical-review-expanded-timeline-body.is-journey .patient-journey-timeline-headings,
.clinical-review-expanded-timeline-body.is-journey .patient-journey-timeline-columns {
    width: 100%;
}

.clinical-review-expanded-main-body {
    padding: 24px 30px;
    color: #D7D7D7;
    font-size: 16px;
    line-height: 1.6;
}

.clinical-review-expanded-main-body.is-journey {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.clinical-review-expanded-main-body.is-journey .clinical-review-journey-top {
    flex: 0 0 auto;
}

.clinical-review-expanded-main-body.is-journey .clinical-review-journey-findings {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.clinical-review-expanded-main-body.is-journey .clinical-review-journey-findings-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.clinical-review-expanded-context {
    margin-bottom: 20px;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.clinical-review-expanded-summary-section {
    margin-bottom: 28px;
}

.clinical-review-expanded-section-title {
    margin-bottom: 10px;
    color: #C9D2D0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.clinical-review-expanded-section-content {
    white-space: pre-wrap;
}

.clinical-review-expanded-section-content.has-claims {
    white-space: normal;
}

.clinical-review-provenance-claim {
    cursor: pointer;
    border-radius: 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.clinical-review-provenance-claim:hover {
    background: rgba(0, 197, 160, 0.12);
}

.clinical-review-provenance-claim.is-active {
    background: rgba(0, 197, 160, 0.22);
    box-shadow: 0 0 0 1px rgba(0, 197, 160, 0.55);
}

.clinical-review-journey-claim {
    cursor: pointer;
    border-radius: 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.clinical-review-journey-claim:hover {
    background: rgba(0, 197, 160, 0.12);
}

.clinical-review-journey-claim.is-active {
    background: rgba(0, 197, 160, 0.22);
    box-shadow: 0 0 0 1px rgba(0, 197, 160, 0.55);
}

.clinical-review-journey-evidence-nav {
    margin-top: 14px;
}

.clinical-review-journey-findings-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clinical-review-journey-findings-item {
    border: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 8px;
    padding: 14px 16px;
}

.clinical-review-journey-findings-item-meta {
    margin-bottom: 8px;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.clinical-review-expanded-empty-inline {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 13px;
    font-style: italic;
}

.clinical-review-expanded-report-text {
    padding: 20px 22px;
    color: #D7D7D7;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: break-word;
}

.clinical-review-expanded-report-text p {
    margin: 0 0 14px;
}

.clinical-review-report-heading {
    color: var(--Viewer-White, #FFF);
    font-weight: 700;
}

mark.clinical-review-source-quote {
    background: rgba(0, 197, 160, 0.28);
    color: inherit;
    border-radius: 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

mark.clinical-review-source-quote.is-focused {
    background: rgba(0, 197, 160, 0.55);
    box-shadow: 0 0 0 1px var(--Brand-Primary, #00C5A0);
}

.clinical-review-evidence-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
    white-space: nowrap;
}

.clinical-review-evidence-nav-btn {
    width: 22px;
    height: 22px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 4px;
    background: transparent;
    color: #D7D7D7;
    cursor: pointer;
    line-height: 1;
    font-size: 14px;
}

.clinical-review-evidence-nav-btn:hover {
    border-color: var(--Brand-Primary, #00C5A0);
    color: var(--Brand-Primary, #00C5A0);
}

.clinical-review-expanded-source-header {
    min-height: 60px;
    border-bottom: 1px solid var(--Viewer-Border, #3D3C41);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-right: 16px;
}

.clinical-review-expanded-source-header .clinical-review-expanded-pane-title {
    border-bottom: 0;
    min-width: 0;
}

.clinical-review-expanded-download-btn {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.clinical-review-expanded-download-btn.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.clinical-review-expanded-empty {
    margin: 20px;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    #clinicalReviewModal .clinical-review-modal-header {
        gap: 12px;
    }

    .clinical-review-modal-heading {
        gap: 12px;
    }

    .clinical-review-modal-title {
        display: none;
    }

    .clinical-review-expanded-view {
        grid-template-columns: 220px minmax(320px, 1fr);
    }

    .clinical-review-expanded-source {
        display: none;
    }
}

.exam-history-empty {
    border-radius: 12px;
    border: 1px dashed var(--Viewer-Border, #3D3C41);
    padding: 18px 20px;
    color: var(--Viewer-Gray-Light, #949396);
}

.exam-history-simple-table-container {
    flex: 1 1 auto;
    min-height: 0;
    padding: 24px;
    overflow: auto;
}

.exam-history-simple-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--Viewer-White, #FFF);
}

.exam-history-simple-table th,
.exam-history-simple-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    vertical-align: middle;
}

.exam-history-simple-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--Viewer-Surface, #1C1C1E);
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.exam-history-simple-table tbody tr {
    background: rgba(255, 255, 255, 0.02);
}

.exam-history-simple-table tbody tr:hover,
.exam-history-simple-table tbody tr.is-current {
    background: rgba(0, 197, 160, 0.08);
}

.exam-history-simple-description {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.exam-history-simple-date,
.exam-history-simple-disabled {
    margin-top: 4px;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.exam-history-simple-download-btn,
.exam-history-simple-change-btn {
    min-height: 34px;
    width: auto;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.exam-history-simple-change-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.exam-history-simple-empty {
    color: var(--Viewer-Gray-Light, #949396);
    text-align: center !important;
}

.examsList {
    border-collapse: collapse;
}

.examsList th,
.examsList td {
    padding: 12px 16px;
    vertical-align: top;
}

.examsList tbody tr + tr {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}


.mdl-title{
  display: flex;
  align-items: center;
  gap: 4px
}

.mdl-header-details{
    display: flex;
    align-items: center;
    gap: 12px;
}

.mdl-header{
  display: flex;
  justify-content: space-between;
  padding: 16px;
}

.mdl-footer{
  display: flex;
  justify-content: space-between;
  padding: 16px;
  align-items: center;
}

.seperator{
    color: #2C2C2E;
}

#tagsModal input, #drawListModal input{
    padding: 8px;
    border-radius: 8px;
    background: var(--Viewer-on-Surface, #2C2C2E);
    border: none;
    color: #fff;
}

#drawListModal input[type="color"]{
    padding: 0px;
}

#tagsModal .highlighted{
    background: var(--Brand-Palette-green-800, #006C58);
}

/* Alternating font colours for the DICOM tags rows, to separate them.
   Targets data rows only (the header lives in <thead>). */
#tagsModal .tagsTable tbody tr:nth-child(odd) td{
    color: #FFFFFF;
}
#tagsModal .tagsTable tbody tr:nth-child(even) td{
    color: #8FBFB0;
}

/* --- Sequence (SQ) grouping --- placed after the zebra rules so it wins.
   Each sequence reads as one block: a green header bar for the sequence,
   italic "Item N" dividers, and a green left spine + faint tint down the
   nested tags. */
#tagsModal .tagsTable tbody tr.sq-row td{
    background: rgba(0, 108, 88, 0.22);
    color: #EAF6F1;
    font-weight: 600;
}
#tagsModal .tagsTable tbody tr.sq-row td:first-child{
    border-left: 3px solid var(--Brand-Palette-green-800, #006C58);
}

#tagsModal .tagsTable tbody tr.sq-item-row td{
    background: rgba(255, 255, 255, 0.04);
    color: #93A39D;
    font-style: italic;
}
#tagsModal .tagsTable tbody tr.sq-item-row td:first-child{
    border-left: 3px solid rgba(0, 108, 88, 0.5);
}

#tagsModal .tagsTable tbody tr.sq-child-row td{
    background: rgba(0, 108, 88, 0.06);
}
#tagsModal .tagsTable tbody tr.sq-child-row td:first-child{
    border-left: 3px solid rgba(0, 108, 88, 0.30);
}

/* Only the body scrolls, so the header (Close) and the search stay visible */
#tagsModal{
    overflow: hidden;
}

#tagsModal .mdl-content{
    height: 100%
}

#tagsModal .mdl-body{
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    background-color: var(--Viewer-Surface, #1C1C1E);;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

/* the search form gets an inline margin-left from getHtmlSearchForm();
   use padding instead so the sticky background covers the full width */
#tagsModal .mdl-body .filter{
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0 !important;
    padding: 8px 16px;
    background-color: var(--Viewer-Surface, #1C1C1E);
    /* search + slice navigation (index.html syncTagsSliceNav) on one row */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

#tagsModal .tags-slice-nav{
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 320px;
    max-width: 520px;
}

#tagsModal .tags-slice-step{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: var(--Viewer-on-Surface, #2C2C2E);
    color: var(--Viewer-Gray-Light, #949396);
    cursor: pointer;
}

#tagsModal .tags-slice-step:hover:not(:disabled){
    background: var(--Viewer-Accent, #003228);
    color: var(--Brand-Palette-green-100, #B0EDE2);
}

#tagsModal .tags-slice-step:disabled{
    opacity: 0.4;
    cursor: default;
}

#tagsModal .tags-slice-input{
    width: 64px;
    text-align: center;
    -moz-appearance: textfield;
}

#tagsModal .tags-slice-input::-webkit-outer-spin-button,
#tagsModal .tags-slice-input::-webkit-inner-spin-button{
    -webkit-appearance: none;
    margin: 0;
}

#tagsModal .tags-slice-total{
    min-width: 40px;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
    white-space: nowrap;
}

/* overrides the generic #tagsModal input box styling */
#tagsModal .tags-slice-slider{
    flex: 1 1 auto;
    min-width: 100px;
    padding: 0;
    background: transparent;
    accent-color: var(--Brand-Palette-green-500, #00C5A0);
    cursor: pointer;
}

/* a value that changed since the previous slice flashes briefly */
#tagsModal .tagsTable tbody tr.tag-changed td{
    animation: tag-changed-flash 1.2s ease-out;
}

@keyframes tag-changed-flash{
    from { background-color: rgba(0, 197, 160, 0.35); }
}

#helpModal .mdl-body{
    padding: 16px;
}

#helpModal p{
    margin: 0 0 10px;
}

/* About: centered card with a dark gray body; the black CE/eIFU symbols
   are inverted to white (the company logo is left as is) */
#aboutModal{
    align-items: center;
    justify-content: center;
}

#aboutModal .mdl-content{
    width: min(520px, calc(100vw - 32px));
    border-radius: 8px;
    overflow: hidden;
}

#aboutModal .about-body{
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 32px 24px;
    background: var(--Viewer-on-Surface, #2C2C2E);
    color: #fff;
    font-size: 13px;
}

.about-company-logo{
    /* the png has wide transparent padding; cover crops it to the artwork */
    width: 220px;
    height: 130px;
    object-fit: cover;
    align-self: center;
}

.about-product{
    font-size: 18px;
    font-weight: 600;
}

.about-version{
    margin-bottom: 8px;
    color: #D1D1D6;
}

.about-row{
    display: flex;
    align-items: center;
    gap: 12px;
}

.about-symbol{
    flex: 0 0 auto;
    width: 32px;
    height: 24px;
    object-fit: contain;
}

/* black-on-transparent / black-on-white symbols -> white */
.about-invert{
    filter: invert(1);
}

/* the eIFU png has an opaque white background, which inverts to black;
   screen blending drops that black box into the dark gray body */
.about-eifu{
    mix-blend-mode: screen;
}

.about-row a{
    color: var(--Brand-Palette-green-100, #B0EDE2);
    word-break: break-all;
}

/* User manual: large card with an embedded PDF viewer, above the About modal */
#manualModal{
    align-items: center;
    justify-content: center;
    z-index: 3001;
    overflow: hidden;
}

#manualModal .mdl-content{
    width: min(1100px, calc(100vw - 32px));
    height: calc(100vh - 32px);
    border-radius: 8px;
    overflow: hidden;
}

#manualModal .download-btn{
    text-decoration: none;
}

#manualModal .manual-body{
    flex: 1 1 auto;
    min-height: 0;
    background: #525659;
}

#manualModal .manual-body iframe{
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.about-sw-info{
    font-size: 11px;
    color: #AEAEB2;
}

.about-sw-info #sw-version{
    font-weight: 600;
    color: var(--Brand-Palette-green-100, #B0EDE2);
}

/* right edge of the toolbar (where the SW version badge used to be) */
.about-tool-group{
    margin-left: auto;
    flex-shrink: 0;
}

.about-tool-group .tool-group-buttons{
    justify-content: center;
}

.about-copyright{
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #48484A;
    color: #AEAEB2;
    font-size: 12px;
}

#hotkeysLegendModal {
    background-color: rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

#hotkeysLegendModal .mdl-content{
    border-left: 1px solid rgba(61, 60, 65, 0.85);
    margin: 0 0 0 auto;
    width: min(360px, calc(100vw - 32px));
    height: 100vh;
    max-height: 100vh;
    background: rgba(12, 18, 17, 0.74);
    box-shadow: -12px 0 38px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
}

#hotkeysLegendModal .mdl-header{
    padding: 14px 16px 8px 16px;
}

#hotkeysLegendModal .mdl-body{
    padding: 0 16px 16px 16px;
    overflow-y: auto;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

.hotkeys-legend-intro{
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 0 14px 0;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.hotkeys-legend-content{
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.hotkeys-legend-section{
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.hotkeys-legend-section-title{
    position: relative;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 14px;
    padding-left: 12px;
    text-transform: uppercase;
}

.hotkeys-legend-section-title::before{
    content: "";
    position: absolute;
    left: 0;
    top: 1px;
    width: 4px;
    height: 13px;
    background: var(--Brand-Primary, #00C5A0);
}

.hotkeys-legend-list{
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hotkeys-legend-row{
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.hotkeys-legend-keys{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    order: 2;
    flex: 0 0 auto;
    max-width: 150px;
}

.hotkeys-legend-details{
    order: 1;
    min-width: 0;
}

.hotkey-chip{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid rgba(120, 130, 130, 0.28);
    background: rgba(72, 80, 80, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.hotkeys-legend-label{
    color: #D7DEDC;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hotkeys-legend-description{
    display: none;
}

@media (max-width: 760px) {
    #hotkeysLegendModal {
        background-color: rgba(0, 0, 0, 0.2);
    }

    #hotkeysLegendModal .mdl-content{
        width: min(340px, calc(100vw - 24px));
    }

    .hotkeys-legend-content{
        gap: 18px;
    }

    .hotkeys-legend-row{
        gap: 10px;
    }

    .hotkeys-legend-keys{
        max-width: 130px;
    }
}

/* Hanging Protocol popover selector */
.hanging-protocol-dropdown {
    min-width: 260px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

.hanging-protocol-dropdown.show {
    animation: hanging-protocol-pop-in 0.15s ease-out;
}

@keyframes hanging-protocol-pop-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.hanging-protocol-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hanging-protocol-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.hanging-protocol-row:hover {
    background: var(--Viewer-Hover, #3F3F3F);
}

.hanging-protocol-row.active {
    border-left-color: var(--Brand-Primary, #00C5A0);
    background: var(--Viewer-on-Surface, #2C2C2E);
}

.hanging-protocol-row-label {
    color: #D7DEDC;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hanging-protocol-row-meta {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 11px;
    white-space: nowrap;
}

/* "Compare exams…" is an action, not a protocol: set apart below a divider. */
.hanging-protocol-row.hanging-protocol-pair-row-open {
    margin-top: 4px;
    border-top: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 0 0 6px 6px;
    padding-top: 12px;
}

.hanging-protocol-pair-row-open .hanging-protocol-row-label {
    color: var(--Brand-Primary, #00C5A0);
}

.hanging-protocol-row.hanging-protocol-pair-row-open:hover {
    background: var(--Viewer-Accent, #003228);
}

/* Hanging Protocol quick switcher (alt-tab style overlay) */
.hanging-protocol-switcher {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.hanging-protocol-switcher-grid {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 16px;
    max-width: 80vw;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

.hanging-protocol-switcher-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 140px;
    padding: 14px 10px;
    border-radius: 8px;
    border: 2px solid transparent;
    background: var(--Viewer-Surface, #1C1C1E);
    cursor: pointer;
}

.hanging-protocol-switcher-tile.selected {
    border-color: var(--Brand-Primary, #00C5A0);
    background: var(--Viewer-on-Surface, #2C2C2E);
}

.hanging-protocol-switcher-glyph {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    min-height: 48px;
}

.hanging-protocol-switcher-monitor {
    display: grid;
    gap: 2px;
    width: 56px;
    height: 40px;
    padding: 3px;
    border: 1px solid var(--Viewer-Gray-Light, #949396);
    border-radius: 3px;
    background: var(--Viewer-Accent, #003228);
}

.hanging-protocol-switcher-cell {
    background: var(--Viewer-Hover, #3F3F3F);
    border-radius: 1px;
}

.hanging-protocol-switcher-cell.prior {
    background: repeating-linear-gradient(45deg,
        var(--Viewer-Hover, #3F3F3F), var(--Viewer-Hover, #3F3F3F) 3px,
        var(--Viewer-Gray-Light, #949396) 3px, var(--Viewer-Gray-Light, #949396) 5px);
}

.hanging-protocol-switcher-tile-label {
    color: #D7DEDC;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.hanging-protocol-pair-card {
    width: min(640px, 92vw);
    max-height: 82vh;
    border-radius: 16px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    color: #fff;
}

.hanging-protocol-pair-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    padding: 4px 24px 8px;
}

.hanging-protocol-pair-intro {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.hanging-protocol-pair-notice {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--Brand-Palette-green-700, #008C72);
    background: var(--Viewer-Accent, #003228);
    color: var(--Brand-Palette-green-100, #B0EDE2);
    font-size: 12px;
}

.hanging-protocol-pair-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-Surface);
    scrollbar-width: thin;
}

.hanging-protocol-pair-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    border-left: 4px solid var(--Viewer-Border, #3D3C41);
    background: var(--Viewer-on-Surface, #2C2C2E);
}

.hanging-protocol-pair-row.in-pair {
    border-top-color: var(--Brand-Palette-green-700, #008C72);
    border-right-color: var(--Brand-Palette-green-700, #008C72);
    border-bottom-color: var(--Brand-Palette-green-700, #008C72);
}

.hanging-protocol-pair-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.hanging-protocol-pair-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.hanging-protocol-pair-description {
    min-width: 0;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hanging-protocol-pair-active {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--Brand-Primary, #00C5A0);
    color: var(--Brand-Primary, #00C5A0);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.hanging-protocol-pair-date {
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
}

.hanging-protocol-pair-roles {
    display: flex;
    flex: 0 0 auto;
    padding: 3px;
    border-radius: 8px;
    background: var(--Viewer-Surface, #1C1C1E);
}

.hanging-protocol-pair-role {
    min-width: 72px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 12px;
    cursor: pointer;
}

.hanging-protocol-pair-role:hover {
    background: var(--Viewer-Hover, #3F3F3F);
    color: #fff;
}

.hanging-protocol-pair-role[data-role="current"].selected {
    background: var(--Brand-Palette-green-700, #008C72);
    color: #fff;
}

.hanging-protocol-pair-role[data-role="prior"].selected {
    border-color: var(--Brand-Palette-green-700, #008C72);
    background: var(--Viewer-Accent, #003228);
    color: var(--Brand-Palette-green-100, #B0EDE2);
}

.hanging-protocol-pair-footer {
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
}

.hanging-protocol-pair-footer .close-btn {
    padding: 8px 16px;
}

/* App-wide notification/toast system (top-right). Single shared mechanism for
   every "message + severity" notification across both the legacy layer and the
   src/ module bundles — see public/public/js/appNotifications.js
   (window.showAppNotification) and src/helpers/toast.js (its bridge). Bootstrap's
   .alert classes have no effect in this app — its CSS link is commented out in
   index.html — so this is self-contained rather than reusing that dead pattern. */
.app-notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.app-notification {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    padding: 12px 40px 12px 16px;
    border-radius: 8px;
    background: var(--Viewer-Surface, #1C1C1E);
    border: 1px solid var(--Viewer-Border, #3D3C41);
    border-left: 4px solid var(--Brand-Primary, #00C5A0);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    color: #FFF;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    pointer-events: auto;
    animation: app-notification-in 0.2s ease-out;
}

.app-notification-out {
    animation: app-notification-out 0.2s ease-in forwards;
}

@keyframes app-notification-in {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes app-notification-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(30px); }
}

.app-notification-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
}

.app-notification-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--Brand-Primary, #00C5A0);
    border-radius: 50%;
    animation: app-notification-spin 0.8s linear infinite;
}

@keyframes app-notification-spin {
    to { transform: rotate(360deg); }
}

.app-notification-message {
    flex: 1;
    /* keep line breaks of multi-line messages (e.g. the old alert() texts) */
    white-space: pre-line;
}

.app-notification-action {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--Brand-Primary, #00C5A0);
    background: none;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    cursor: pointer;
}

.app-notification-action:hover {
    background: var(--Brand-Primary, #00C5A0);
    color: #000;
}

.app-notification-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

.app-notification-close:hover {
    opacity: 1;
    color: #FFF;
}

#helpModal h1,
#helpModal h2, 
#helpModal h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}

#table-search::placeholder{
    color: #fff;
}


/* TABLES */

#examsHistoryModal table,  #drawListModal table{
  margin: 16px 0 24px 0;
  width: 100%;
  border-collapse: collapse;
  color: #fff;
  font-size: 14px;
  font-style: normal;
  font-weight: 400;
}
 table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--Viewer-Border);
  padding: 16px;
  text-align: left;
}

#examsHistoryModal th {
  color: #B7B7B7;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.55px;
}

#gridTable td{
    background: #1c1c1e;
    border-radius: 4px;
    border: 0.5px solid transparent;
}

#gridTable{
    border-collapse:separate;
}



/* HEADER START */
.navbar {
  height: 80px;
  color: white;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem;
}

.logo{
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Hidden until config.json says whose logo it is (applyClientLogo, index.html) */
.navbar .logo{
    visibility: hidden;
}

.navbar .logo.logo-ready{
    visibility: visible;
}

.client-logo{
    display: block;
    height: 32px;
    width: auto;
}

.toolbar{
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Only the part after .toolbar-fixed scrolls (and shows a scrollbar) */
.toolbar-scroll{
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-color: var(--Viewer-Border) var(--Viewer-BG);
    scrollbar-width: thin;
}

.tool-group-buttons{
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.tool-group{
  display: flex;
  flex-direction: column;
  align-items: center; /* buttons centered over a wider label */
}

.tool-group-text{
  --Brand-Primary: #00C5A0;
  color: var(--Viewer-Gray-Light, #949396);
  font-size: 12px;
  text-align: center;
  /* One line: a narrow screen scrolls the toolbar instead of wrapping the label,
     which made the group taller and lifted its buttons out of line */
  white-space: nowrap;
}

.icon{
    display: flex;
    width: 1.3rem;
    height: 1.3rem;
    padding: 2px;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1/1;
    color: var(--Viewer-White, #FFF);;
}


/* The one shared tooltip (index.html): slightly see-through so what is under
   it stays visible, and above every modal/overlay (MPR modal is 3000,
   highest overlay is 100000). */
#tooltiptext {
  display: none;
  opacity: 0.85;
  z-index: 100001;
  position: fixed;
  font-family: Inter;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--Viewer-Hover, #3F3F3F);
  box-shadow: 0 4px 16px 0 #000;
  color: var(--Viewer-White, #FFF);
  white-space: pre-line;
  max-width: 320px;
  line-height: 1.4;
  pointer-events: none;
}

#tooltiptext::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent var(--Viewer-Hover, #3F3F3F) transparent;
}

/* Tooltip flipped above its element: arrow on the bottom, pointing down. */
#tooltiptext.is-above::after {
  bottom: auto;
  top: 100%;
  border-color: var(--Viewer-Hover, #3F3F3F) transparent transparent transparent;
}

/* Thumbnail tooltip sits to the right of the card: arrow on the left, pointing left. */
#tooltiptext.is-thumbnail::after {
  bottom: auto;
  left: auto;
  right: 100%;
  top: var(--tooltip-arrow-top, 50%);
  margin-left: 0;
  margin-top: -5px;
  border-color: transparent var(--Viewer-Hover, #3F3F3F) transparent transparent;
}

/* .tool:hover .tooltiptext {
  visibility: visible;
} */

.highlighted-tool-group {
  display: flex;
  gap: 1rem;
  background: var(--Viewer-Surface, #1C1C1E);
  border-radius: 12px;
  padding: 8px;
}

.tool:disabled{
    opacity: 0.25;
    cursor: not-allowed;
}

.dropdown-content {
  display: none;
  position: absolute;
  min-width: 160px;
  z-index: 1;
  border-radius: 8px;
  background: var(--Viewer-on-Surface, #2C2C2E);
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.80);
  padding: 8px;
  top:50px;
}

/* Collapsed toolbar menus (Rotate/flip, Sync, Series): a list of labelled .tool rows */
.tool-menu {
  z-index: 1000;
  min-width: 0;
  padding: 4px;
}

.tool-menu.show {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tool-menu .tool {
  width: 100%;
  background: transparent;
  color: var(--Viewer-White, #FFF);
  font-size: 13px;
  white-space: nowrap;
  text-align: left;
  padding: 4px 10px 4px 4px;
  /* .dropdown-content button sets border:none; keep the border so the active state doesn't shift */
  border: 2px solid transparent;
}

.tool-menu .tool:hover:not(:disabled),
.tool-menu .tool.active {
  background: var(--Viewer-Accent, #003228);
}

.tool-menu .tool.active {
  border-color: var(--Brand-Palette-green-700, #008C72);
}

.tool-menu-section {
  padding: 6px 8px 2px;
  color: var(--Viewer-Gray-Light, #949396);
  font-size: 11px;
}

.tool-menu-section:not(:first-child) {
  margin-top: 4px;
  border-top: 1px solid var(--Viewer-Border, #3D3C41);
}

.tool-menu-check {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  color: var(--Brand-Palette-green-100, #B0EDE2);
}

.tool-menu-hint {
  margin-left: auto;
  padding-left: 16px;
  color: var(--Viewer-Gray-Light, #949396);
  font-size: 11px;
}

.tool-menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 22px;
  margin: 0;
  font-size: 13px;
  font-weight: normal;
  color: var(--Viewer-White, #FFF);
  cursor: pointer;
}

.tool-menu-row input[type="color"] {
  margin-left: auto;
  width: 32px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--Viewer-Border, #3D3C41);
  border-radius: 4px;
  background: none;
  cursor: pointer;
}

.tool-menu-row input[type="text"] {
  margin-left: auto;
  width: 52px;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: right;
  cursor: text;
}

.tool-menu-row input[type="checkbox"] {
  margin: 0 0 0 auto;
  accent-color: var(--Brand-Palette-green-500, #00C5A0);
  cursor: pointer;
}

/* Cine: Play / Stop side by side, settings rows below */
.cine-menu {
  min-width: 220px;
}

.cine-controls {
  display: flex;
  gap: 4px;
}

.cine-menu .tool-menu-row {
  padding-left: 8px;
}

/* Any toolbar dropdown placed by positionToolbarPopup (toolbarMenus.js) */
.toolbar-popup {
  z-index: 1000;
}

/* First group + tool options area: never scroll. The options area is bracketed
   by rounded edges (its own left one, this right one); the scrolling part
   starts after the right edge. */
.toolbar-fixed {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 0 12px 0 0;
  border-right: 1px solid var(--Viewer-Border, #3D3C41);
  border-radius: 0 12px 12px 0;
  align-self: stretch;
}

/* ---- Viewer modes (viewerMode.js) ----
   body[data-viewer-mode="<mode>"] shows that mode's panel (in the viewer
   area) and toolbar, plus the Back / thumbnails group in the highlighted box,
   in place of the simple viewer's grid and toolbar groups. Those are only
   hidden, so the simple viewer comes back exactly as it was. */
.viewer-mode-panel,
.viewer-mode-toolbar,
.viewer-mode-group {
  display: none;
}

body[data-viewer-mode] .viewer-mode-group,
.viewer-mode-group.thumbnails-tool-group {
  display: flex;
}

/* The label is wider than the single button of the simple viewer: center it */
.thumbnails-tool-group {
  align-items: center;
}

/* "Thumbnails open in <mode>" only means something in a mode */
body:not([data-viewer-mode]) #viewerModeThumbnailsTargetBtn {
  display: none;
}

body[data-viewer-mode="mpr"] .viewer-mode-panel[data-mode="mpr"],
body[data-viewer-mode="petct"] .viewer-mode-panel[data-mode="petct"],
body[data-viewer-mode="hemo"] .viewer-mode-panel[data-mode="hemo"],
body[data-viewer-mode="ff"] .viewer-mode-panel[data-mode="ff"],
body[data-viewer-mode="osteo"] .viewer-mode-panel[data-mode="osteo"],
body[data-viewer-mode="myelin"] .viewer-mode-panel[data-mode="myelin"] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

body[data-viewer-mode="mpr"] .viewer-mode-toolbar[data-mode="mpr"],
body[data-viewer-mode="petct"] .viewer-mode-toolbar[data-mode="petct"],
body[data-viewer-mode="hemo"] .viewer-mode-toolbar[data-mode="quantidos"],
body[data-viewer-mode="ff"] .viewer-mode-toolbar[data-mode="quantidos"],
body[data-viewer-mode="osteo"] .viewer-mode-toolbar[data-mode="quantidos"],
body[data-viewer-mode="myelin"] .viewer-mode-toolbar[data-mode="quantidos"] {
  display: flex;
}

/* .tool's display: flex would otherwise win over [hidden] */
.viewer-mode-toolbar .tool[hidden] {
  display: none;
}

body[data-viewer-mode] .highlighted-tool-group > .tool-group:not(.viewer-mode-group),
body[data-viewer-mode] #toolOptionsGroup,
body[data-viewer-mode] .toolbar-scroll:not(.viewer-mode-toolbar),
body[data-viewer-mode] .about-tool-group,
body[data-viewer-mode] #fullScreenDisplay,
body[data-viewer-mode] #viewerDisplay,
body[data-viewer-mode] #imageDisplay {
  display: none !important;
}

/* The fixed part's divider separates it from the tool options area, which a
   mode doesn't show: without it the line would just stand alone. */
body[data-viewer-mode] .toolbar-fixed {
  border-right: none;
  padding-right: 0;
}

/* Mode title, first group of a mode's toolbar ("MPR" + its icon) */
.viewer-mode-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--Viewer-Accent, #003228);
  color: var(--Brand-Palette-green-100, #B0EDE2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* The viewer area's border marks that a mode is shown in it */
body[data-viewer-mode] .main-content {
  border-color: var(--Brand-Palette-green-700, #008C72);
}

/* "Hide thumbnails" (simple viewer and modes) */
.layout.thumbnails-collapsed .sidebar {
  display: none;
}

/* "Current value ▾" pickers in a mode toolbar: same look as the W/L picker
   in the tool options area */
.viewer-mode-toolbar .tool-picker {
  height: 32px;
  gap: 6px;
  max-width: 124px;
  padding: 0 8px;
  color: var(--Viewer-White, #FFF);
  font-size: 12px;
  flex-shrink: 0;
}

.viewer-mode-toolbar .tool-picker svg {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  color: var(--Viewer-Gray-Light, #949396);
}

/* A mode's tool groups, laid out like the groups of .toolbar-scroll */
.viewer-mode-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ... while the mode's series is still loading (the title stays) */
.viewer-mode-tools.is-disabled > .tool-group:not(.viewer-mode-title) {
  opacity: 0.4;
}

.viewer-mode-toolbar .tool:disabled {
  cursor: default;
}

/* Fixed width so the buttons after it never shift when the active tool changes */
.tool-options-group {
  width: 260px;
  flex-shrink: 0;
  align-self: stretch;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--Viewer-Border, #3D3C41);
  border-radius: 12px 0 0 12px;
}

#toolOptionsBar {
  justify-content: center;
  align-items: center;
  gap: 3px;
  width: 100%;
  height: 37px;
  overflow: hidden;
}

/* Every control in the options area is the same compact 32px square (or 32px
   tall) box with a 16px icon, so the 6 Draw shapes + colour fit the area. */
#toolOptionsBar > .tool,
#toolOptionsBar > .tool-options-colour {
  height: 32px;
  min-width: 32px;
  padding: 6px;
  justify-content: center;
  flex-shrink: 0;
}

#toolOptionsBar svg {
  width: 16px;
  height: 16px;
}

#toolOptionsBar .icon {
  width: 16px;
  height: 16px;
  padding: 0;
}

.tool-options-note {
  padding: 0 4px;
  color: var(--Viewer-Gray-Light, #949396);
  font-size: 12px;
  line-height: 32px;
  white-space: nowrap;
}

/* Caption tabs when more than one active thing has options (e.g. Scroll + Localizer) */
.tool-options-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.tool-options-tab {
  padding: 0;
  border: none;
  background: none;
  color: var(--Viewer-Gray-Light, #949396);
  font-size: 12px;
  cursor: pointer;
}

.tool-options-tab:hover {
  color: var(--Brand-Palette-green-100, #B0EDE2);
}

.tool-options-tab.active {
  color: var(--Viewer-White, #FFF);
  text-decoration: underline;
  text-decoration-color: var(--Brand-Palette-green-500, #00C5A0);
  text-underline-offset: 3px;
}

.tool-options-tab:focus {
  outline: none;
}

.tool-options-tab:focus-visible {
  outline: 2px solid var(--Brand-Palette-green-500, #00C5A0);
  outline-offset: 2px;
}

.tool-options-text {
  padding: 0 2px;
  color: var(--Viewer-White, #FFF);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

/* "Current value ▾" button, e.g. the W/L preset */
#toolOptionsBar > .tool-picker {
  gap: 6px;
  max-width: 124px;
  padding: 0 8px;
  color: var(--Viewer-White, #FFF);
  font-size: 12px;
}

#toolOptionsBar .tool-picker svg {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  color: var(--Viewer-Gray-Light, #949396);
}

.tool-picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}

.tool-options-colour {
  width: 32px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--Primary-Surface, #1C1C1E);
  cursor: pointer;
}

.tool-options-colour:hover {
  background: var(--Viewer-Accent, #003228);
}

.tool-options-colour::-webkit-color-swatch-wrapper {
  padding: 0;
}

.tool-options-colour::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.tool-options-colour::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

/* Rows in the collapsed menus use the same 16px icon size */
.tool-menu .icon {
  width: 16px;
  height: 16px;
  padding: 0;
}

.tool-menu .icon svg {
  width: 16px;
  height: 16px;
}

/* DWV tool option panels only open from their caret, never by themselves */
.toolList .toolsDropdown-content:not(.show) {
  display: none !important;
}

.toolList .toolsDropdown-content.show {
  display: block !important;
}

/* Small corner marker on buttons that open a menu */
.tool.has-menu::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  border-left: 4px solid transparent;
  border-bottom: 4px solid var(--Viewer-Gray-Light, #949396);
}

/* Split button: main action + narrow caret that opens the menu */
.tool-split {
  display: flex;
}

.tool-split > .tool:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.tool-split > .tool-split-caret {
  padding: 6px 3px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  color: var(--Viewer-Gray-Light, #949396);
}

.tool-split > .tool-split-caret:hover,
.tool-split > .tool-split-caret[aria-expanded="true"] {
  color: var(--Brand-Palette-green-100, #B0EDE2);
}

.toolsDropdown-content{
    position: absolute;
    z-index: 1;
    border-radius: 8px;
    background: var(--Viewer-on-Surface, #2C2C2E);
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.80);
    padding: 8px;
    top: 50px;
}

/* Wider width for tools with multiple controls */
.wl.toolsDropdown-content,
.draw.toolsDropdown-content,
.filter.toolsDropdown-content {
    min-width: 300px;
}

/* Filter controls row - horizontal layout for filter dropdown + actions */
.filterControlsRow {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filterWrapper {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 150px;
}

.filterActionsContainer {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

/* Horizontal container for window level dropdowns */
.windowlevel-dropdowns-container,
.draw-dropdowns-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Filter buttons container for Sobel/Sharpen */
.filter-buttons-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sobelLi,
.sharpenLi {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Threshold filter controls container */
.thresholdControls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.threshold-inputs-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.threshold-inputs-wrapper .inputMin,
.threshold-inputs-wrapper .inputMax {
    width: 60px;
    flex-shrink: 0;
}

.threshold-inputs-wrapper .threshold-reset {
    flex-shrink: 0;
}

.thresholdSliderContainer {
    margin-top: 8px;
    width: 100%;
}

.wlWrapper,
.cmWrapper,
.shapeWrapper,
.colourWrapper {
    flex: 1;
    min-width: 0; /* Allow flexbox to shrink properly */
}

.toolsDropdown-content select, .dropdown-content select{
    background: var(--Website-BG-1, #060606);
    border: 1px solid var(--Brand-Palette-green-900, #005343);
    border-radius: 8px;
    padding: 0.6rem;
    color: #fff;
    cursor: pointer;
    width: 100%;
}

.toolsDropdown-content input, .dropdown-content input{
    background: var(--Website-BG-1, #060606);
    border: 1px solid var(--Brand-Palette-green-900, #005343);
    border-radius: 8px;
    padding: 0.6rem;
    color: #fff;
    cursor: pointer;
}

.toolsDropdown-content input:focus,  .dropdown-content input:focus {
    border: 1px solid var(--Brand-Primary, #00C5A0);
    background: var(--Viewer-Accent, #003228);
    color: #fff;
    outline: none;
}

.toolsDropdown-content input[type="color"]{
    cursor: pointer;
    padding: 0rem;
}

.toolsDropdown-content input::placeholder, .dropdown-content input::placeholder{
    color: #fff;
    padding:10px;
}

.toolsDropdown-content button, .dropdown-content button{
    border-radius: 8px;
    border: none;
    background: var(--Viewer-Surface, #1C1C1E);
    cursor: pointer;
    color: #fff;
    padding: 0.6rem;
}

.toolsDropdown-content button:hover, .dropdown-content button:hover{
    background: var(--Viewer-Hover);
}


.toolsDropdown-content  .slider.slider-horizontal .slider-track, 
.toolsDropdown-content  .slider.slider-horizontal .slider-selection{
    background: var(--Viewer-Surface, #1C1C1E);;
}

.toolsDropdown-content .slider-handle.round{
    background: var(--Viewer-Border, #3D3C41);;
}

input[type="checkbox"] {
  accent-color: var(--Brand-Palette-green-700, #008C72);
}

/* HEADER END */

/* SCROLLER OVERIDE START*/
#viewerDisplay .slider.slider-vertical .slider-track,
#fullScreenDisplay .slider.slider-vertical .slider-track,
#viewerDisplay .slider.slider-vertical .slider-selection,
#fullScreenDisplay .slider.slider-vertical .slider-selection{
    background: #000;
}
#viewerDisplay .slider.slider-vertical .slider-handle,
#fullScreenDisplay .slider.slider-vertical .slider-handle{
    background: var(--Viewer-Border);
}

/* SCROLLER OVERIDE END*/

/* KEY TOGGLE */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--Viewer-Hover, #3F3F3F);
  -webkit-transition: .4s;
  transition: .4s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .toggle-slider {
  background-color: var(--Brand-Palette-green-700, #008C72);
}

input:focus + .toggle-slider {
  box-shadow: 0 0 1px var(--Brand-Palette-green-700, #008C72);
}
input:checked + .toggle-slider:before {
  -webkit-transform: translateX(18px);
  -ms-transform: translateX(18px);
  transform: translateX(18px);
}
.toggle-slider.round {
  border-radius: 34px;
}

.toggle-slider.round:before {
  border-radius: 50%;
}

.key-toggle-container{
    border-radius: 8px;
    background: var(--Viewer-Surface, #1C1C1E);
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 4px;
    font-size: 12px;
}
/* INFO LAYER */
.list-inline>li {
    display: inline-block;
    padding-right: 5px;
    padding-left: 5px;
}

/* REDESIGN STYLES END*/

#imageDisplay{
    overflow-y: overlay;
}
.hovered{
    border-radius: 4px !important;
    border: 0.5px solid var(--Brand-Palette-green-700, #008C72)!important;
    background: var(--Viewer-Accent, #003228)!important;
}
/* Layers */
.infoXBar{
    color:white;
    position:absolute !important;
    bottom:8px;
    padding-right: 200px;
    right: 0px;
    left: 0px;
    mix-blend-mode: difference;
}
.infoYBar{
    color:white;
    position:absolute !important;
    left:50px;
    margin-top:20px;
    margin-left:0;
    mix-blend-mode: difference;
}
.imgTable .infoXBar{
    color:white;
    position:absolute !important;
    bottom:8px;
    padding-right: 200px;
    right: 0px;
    left: 0px;
    top:0px;
    margin-top:170px;
    mix-blend-mode: difference;
}
.imgTable .infoYBar{
    color:white;
    position:absolute !important;
    left:50px;
    margin-top:100px;
    margin-left:0;
    mix-blend-mode: difference;
}
.imgTable .layerDialog{
    border: 1px ridge silver;
}
.rotateYbar{
    -moz-transform:rotate(90deg);
    -o-transform:rotate(90deg);
    -webkit-transform:rotate(90deg);
    transform:rotate(90deg);
}
.right{ padding-left: 0px !important; }
.left{ padding-right: 0px !important; }

.leftLabel{position:absolute!important;width:150px;height:40px;padding:0;margin:auto;left:0;top:100px;bottom:120px;pointer-events:none;}
.leftText{color:yellow;position:absolute!important;left:0;margin-top:0px;margin-left:20px;font-size:medium;}
.bottomLabel{color:yellow;position:absolute !important;bottom:28px;right:0;left:0;font-size:medium;pointer-events:none;}
.rightLabel{position:absolute!important;width:150px;height:40px;padding:0;margin:auto;right:20!important;top:100px;bottom:120px;pointer-events:none;}
.rightText{color:yellow;position:absolute!important;right:0;margin-top:0px;margin-right:10px;font-size:medium;}
.topLabel{position:absolute !important;width:150px;height:40px;padding:0;margin:auto;top:10px;right:0;left:0;color:yellow;font-size:medium;pointer-events:none;}
.Ybar{
    position:absolute !important;
    width:150px;
    height:40px;
    padding:0;
    margin:auto;
    left:0;
    top:100px;
    bottom:120px;
    margin-right:100px;
    margin-left:-35px;
    mix-blend-mode: difference;
}
.Xbar{
    position:absolute !important;
    width:150px;
    height:40px;
    padding:0;
    margin:auto;
    bottom:10px;
    right:0;
    left:0;
    mix-blend-mode: difference;
}
.greenlight{
    border: 2px solid var(--Brand-Primary, #00C5A0) !important;
}

.layerDialog{
    width:auto!important;
    height: auto;
    background-color: black;
    padding: 0;
    margin: auto;
    position: absolute !important;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    display: inline-block;
    vertical-align: middle;
    float: none;
 }
.layerContainer { width: inherit; padding: 0; margin: 0; top: 0; left: 0; bottom: 0; right: 0; }
.konvajs-content canvas{ margin:auto !important; bottom:0 !important; right:0 !important; }
.imageLayer {
    width:auto;
    height: auto;
    padding: 0;
    margin: auto;
    position: absolute !important;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    transform: rotate(0deg);
    -ms-transform: rotate(0deg); /* IE 9 */
    -webkit-transform: rotate(0deg);
    filter: "FlipH";
    -ms-filter: "FlipH";
}
.drawDiv { width:auto; height: auto;padding: 0; margin: auto; position: absolute !important; top: 0; left: 0; bottom: 0; right: 0; pointer-events: none; }
.dropBox { border: 5px dashed #ccc; }
.dropBox.hover { border: 5px dashed #cc0; }

/* Info */
.infotl { position: absolute!important; top: 0; left: 0; text-align: left; color: #fff; pointer-events: none;}

.patient-name-overlay {
    display: block;
    padding: 2px 6px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 3px;
    margin-bottom: 8px;
    margin-top: 20px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

.study-color-indicator {
    display: inline-block;
    width: 26px;
    height: 10px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.infotr { position: absolute !important; top: 0; right: 20px !important; text-align: right; color: #fff; pointer-events: none;}
.infobl { position: absolute !important; bottom: 0; left: 0; text-align: left; color: #fff; pointer-events: none;}
.infobr {  margin: 0px; position: absolute !important; bottom: 0; right: 20px !important; text-align: right; pointer-events: none;}
.infotl,
.infotr,
.infobl,
.infobr {
    /* Fallback style: adaptive class is applied at runtime. */
    mix-blend-mode: normal;
    font-family: monospace;
    color: #fff;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.95),
         1px -1px 0 rgba(0, 0, 0, 0.95),
        -1px  1px 0 rgba(0, 0, 0, 0.95),
         1px  1px 0 rgba(0, 0, 0, 0.95);
}

/* Adaptive contrast classes toggled by infoController sampling logic. */
.overlay-contrast-light {
    color: #fff !important;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.95),
         1px -1px 0 rgba(0, 0, 0, 0.95),
        -1px  1px 0 rgba(0, 0, 0, 0.95),
         1px  1px 0 rgba(0, 0, 0, 0.95);
}

.overlay-contrast-dark {
    color: #111 !important;
    text-shadow:
        -1px -1px 0 rgba(255, 255, 255, 0.95),
         1px -1px 0 rgba(255, 255, 255, 0.95),
        -1px  1px 0 rgba(255, 255, 255, 0.95),
         1px  1px 0 rgba(255, 255, 255, 0.95);
}

/* Orientation sub-labels are created with inline color; force inherit for contrast classes. */
.top-sub,
.left-sub,
.right-sub,
.bot-sub,
.orientation li {
    color: inherit !important;
}
.key-image{margin-bottom:20px;}
.slright {position: absolute !important; top: 0; bottom:0; right: 0; text-align: right;}
.slider-handle{
    /*background-color:#3399ff!important;*/
    height:20px!important;
    width:10px!important;
    /*background-image: -webkit-linear-gradient(top,#3399ff 0,#3399ff 100%);*/
    /*margin-top:0px!important;*/
}
.slider.slider-vertical{
    margin: auto;
    position: absolute !important;
    right: 0;
}
.tooltip-arrow{
    border-right-width: 0px !important;
}
.tooltip-inner{
    padding-left: 0px;
    padding-right: 0px;
    border-radius: 8px;
}
#mySlider{
    margin: auto;
    position: absolute !important;
    right: 0;
    width:20px;
}
.plot { position: absolute !important; width: 100px; height: 50px; bottom: 0; left: 0; text-align: left; }
.linked { position: absolute !important; right: 20px; bottom: 25%; pointer-events: none; }
.infoLayer ul { margin: 0px; padding: 0px; list-style-type: none; font-size: 14px; }
.infoLayer canvas { margin: 0; padding: 2px; }
/* Tag list */

/* .highlighted { background: #f87217; } */

.colour-map-info{ width:98px !important; height: 10px !important; }
#pageHeader h1 { display: inline-block; margin: 0; color: #fff; }
#pageHeader a { color: #ddf; }
#pageHeader .toolbar {  float: right; padding-top:150px; z-index: 1500; }
.toolList ul { padding: 0; }
.toolList li { list-style-type: none; }
/* #pageMain { height: 92%; width: 99%; bottom: 5px; left: 5px; background-color: #000; } */

.dropBox { margin: 20px; }
.ui-icon { zoom: 125%; }

li button, li input { margin: 0; }
.history_list { width: 100%; }

button.accordion {
    background-color: #eee;
    color: #444;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 15px;
    transition: 0.4s;
}

button.accordion.active, button.accordion:hover {
    background-color: #ddd;
}

button.accordion:after {
    content: '\002B';
    color: #777;
    font-weight: bold;
    float: right;
    margin-left: 5px;
}

button.accordion.active:after {
    content: "\2212";
}

div.panel {
    padding: 0 18px;
    z-index:1500;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

#myProgress {
    position: relative;
    width: 100%;
    height: 30px;
    background-color: white;
}
#progressbar {
    position: absolute;
    width: 1%;
    height: 100%;
    background-color: #333;
    color:#fff;
}
.tags{
    width:100%;
}
.dwv-version > .container-fluid{
    padding-right: 0px !important;
}
#Patient{
    padding-top: 5px;
    padding-left:0px;
    padding-right:0px;
}
#patientBanner {
    border: 3px solid silver;
    background-color: #333;
    color: silver;
    right:0px;
    top:90px;
    margin:0px;
}
#fullNameLatin{
    text-transform:capitalize;
}
.protocolName{
    font-size: 9pt ;
}
.well{
    background-color: #333;
}
.modal-backdrop{
    z-index:0;
}
.modal-dialog{
    width: 40% !important;
}
.toolBtn{
    margin-left: 5px;
}
.hidden{
    display: none;
}
.dropdown-menu{
    z-index:1200 !important;
}

.seriesInfo {
    background-color:#fff;
    position:absolute;
    color: #333;
    line-height: 30px;
    font-size:15px;
    outline: medium none;
    text-align: center;
    margin:auto;
    right:0px;
    left:0px;
}
.examsList{
    width:100%;
}
.examsList tr{
    cursor:pointer;
}
.selectExam{
    background-color:dimgray;
}
.toggle{
    min-height:29px !important;
    height:29px !important;
}
.toggle label{
    padding-top: 4px;
}
#Profile{
    padding-left:7px;
    padding-right:7px;
}
.examsStyle{
    background-color:#333;
    color:#fff;
    border: 1px solid gray;
}

#patientInfo{
    padding-left: 0px;
}
.evoImage{
    padding-top: 0px !important;
}
nav{
    padding-top: 0px !important;
}
#rLeft{
    -moz-transform: scaleX(-1);
    -o-transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
    filter: FlipH;
    -ms-filter: "FlipH";
}
#flipV{
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
}


#myTable tr{
    height: 220px;
}
#myTable td div{
    height:200px;
    position: relative;
}

.slider-horizontal .slider-handle{
    border-radius: unset;
    margin-left: -5px !important;
    height: 10px !important;
}

.borderless td, .borderless th{
    border: none !important;
}

.dropdown{
    padding: 0px;
}

.div-inline{
    display:inline-block;
}

.dropdown-item > button {
    margin-right:2px;
}

.keyImage{
    border-color: green !important;
}

#inputRows{ color:#333; }
#inputColumns{ color:#333; }
.close{ color:#fff !important; }
.oflow{overflow-y:scroll}
@media print{
    @page {
        size: landscape;
        margin: 10mm;  /* 10mm margin on all sides */
    }
    
    html, body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        background-color: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Hide everything by default */
    body * {
        visibility: hidden !important;
    }
    
    /* Hide UI elements that shouldn't print */
    .navbar, 
    .sidebar,
    #sidebar,
    #thumbnailsDisplay,
    .btn, 
    button,
    .toolbar,
    .infoLayer,
    .controls,
    hr,
    .drawDiv,
    .patient-banner,
    #fullScreenDisplay,
    #imageDisplay,
    #myTable,
    #imagesDiv > aside,
    .main-content > *:not(#viewerDisplay),
    #studyTabsContainer,
    #dwv > *:not(#imagesDiv) {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Show only viewerDisplay and its container */
    #imagesDiv,
    .main-content {
        visibility: visible !important;
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        page-break-inside: avoid !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
    }
    
    /* Keep scale bars visible with their original size */
    .Xbar,
    .Ybar,
    .infoXBar,
    .infoYBar {
        display: block !important;
        visibility: visible !important;
    }
    
    /* Make viewer display full page */
    #viewerDisplay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        /* Size automatically filled by fixed positioning - not affected by zoom */
        visibility: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        background-color: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        overflow: hidden !important;
    }
    
    #viewerDisplay * {
        visibility: visible !important;
    }
    
    /* Make toPrint visible */
    .toPrint,
    .toPrint * {
        visibility: visible !important;
    }
    
    /* Prevent page breaks */
    #viewerDisplay,
    .toPrint {
        page-break-before: avoid !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
    }
    
    /* If there's a table or grid layout, make it fill the space */
    #viewerDisplay table,
    #viewerDisplay > .table {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        table-layout: fixed !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        background-color: white !important;
        page-break-inside: avoid !important;
        box-sizing: border-box !important;
    }
    
    #viewerDisplay table td,
    #viewerDisplay table th,
    #viewerDisplay .grid {
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        background-color: white !important;
        page-break-inside: avoid !important;
        overflow: hidden !important;
        position: relative !important;
        min-width: 0 !important;
        min-height: 0 !important;
        width: auto !important;
        height: auto !important;
    }
    
    /* Prevent page breaks on table rows */
    #viewerDisplay table tr {
        page-break-inside: avoid !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
    }
    
    /* Ensure all grid containers have white background */
    #viewerDisplay .layerDialog,
    #viewerDisplay [id^="grid"] {
        background-color: white !important;
        max-width: 100% !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }
    
    /* Specific constraint for layerDialog in grid cells */
    #viewerDisplay td .layerDialog {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
    }
    
    /* Position patient data at top with minimal height */
    .toPrint{
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 2mm 2mm !important;
        background: white !important;
        color: black !important;
        z-index: 1000 !important;
        font-size: 10pt !important;
        max-height: 12mm !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 16px !important;
    }
    
    .toPrint > div {
        display: flex !important;
        gap: 4px !important;
        white-space: nowrap !important;
    }
    
    .toPrint .patient-data-label {
        color: #666666 !important;
    }
    
    /* Hide hr elements inside patient data */
    .toPrint hr {
        display: none !important;
    }

    .toPrint #currentExamImpressionAction {
        display: none !important;
    }

    /* Adjust viewerDisplay when patient data is present */
    .toPrint ~ #viewerDisplay {
        top: 12mm !important;
        bottom: 0 !important;
        /* Height automatically calculated from top and bottom - not affected by zoom */
    }
    
    /* Ensure canvases and images fit with proper aspect ratio */
    /* Exclude scale bars (Xbar, Ybar) from resizing */
    #viewerDisplay canvas:not(.Xbar):not(.Ybar):not(.Xbar):not(.Ybar),
    #viewerDisplay img {
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
        display: block !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
    }
    
    /* Specific handling for grid cell canvases to ensure they fit */
    #viewerDisplay td canvas:not(.Xbar):not(.Ybar),
    #viewerDisplay .grid canvas:not(.Xbar):not(.Ybar) {
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
        flex-shrink: 0 !important;
    }
    
    /* Scale bars at 50% size for printing */
    #viewerDisplay canvas.Xbar {
        transform: scale(0.5) !important;
        transform-origin: center !important;
    }
    
    #viewerDisplay canvas.Ybar {
        transform: rotate(90deg) scale(0.5) !important;
        transform-origin: center !important;
    }
    
    /* Container divs should not add extra space */
    #viewerDisplay .imageLayer,
    #viewerDisplay .konvajs-content,
    #viewerDisplay .layerDialog {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        background-color: white !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Ensure layerContainer has white background */
    #viewerDisplay .layerContainer {
        background-color: white !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Hide all modals during print */
    .mdl,
    #tagsModal,
    #helpModal,
    #drawListModal,
    #segListModal,
    #mpr-modal,
    #petct-modal,
    #examsHistoryModal {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* ==================== NEW: Print Container Styles ==================== */
    /* Show only the print container with captured screenshot */
    #printContainer,
    #printContainer * {
        display: block !important;
        visibility: visible !important;
    }
    
    #printContainer {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background-color: white !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        page-break-inside: avoid !important;
        z-index: 10000 !important;
    }
    
    /* Patient banner in print container */
    #printContainer .toPrint {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 2mm !important;
        background: white !important;
        color: black !important;
        font-size: 10pt !important;
        max-height: 12mm !important;
        overflow: hidden !important;
        z-index: 10001 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 16px !important;
    }
    
    #printContainer .toPrint > div {
        display: flex !important;
        gap: 4px !important;
        white-space: nowrap !important;
    }

    #printContainer .toPrint #currentExamImpressionAction {
        display: none !important;
    }

    #printContainer .toPrint .patient-data-label {
        color: #B7B7B7 !important;
    }
    
    #printContainer .toPrint hr {
        display: none !important;
    }
    
    /* The captured screenshot image */
    #printContainer > img {
        max-width: 100% !important;
        max-height: calc(100% - 12mm) !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
        display: block !important;
        margin-top: 12mm !important;
    }

}
.loader {
  border: 10px solid #f3f3f3;
  border-radius: 50%;
  border-top: 10px solid var(--Brand-Primary, #00C5A0);;
  width: 60px;
  height: 60px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 2s linear infinite;
}
@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ContrastBolusAgent{
    font-weight: bold;
}

.show {
    display: block;
}

/* ── Volume-cache DB loading spinner ── */
@keyframes vp-cache-spin {
    to { transform: rotate(360deg); }
}

.vp-cache-spinner {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.35);
}

.vp-cache-spinner::after {
    content: '';
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(0, 197, 160, 0.25);
    border-top-color: #00C5A0;
    animation: vp-cache-spin 0.75s linear infinite;
}

/* Volume cached indicator (application.js showVolumeCachedDot) */
.vp-volume-cached-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    /* !important: maximize/restore (index.html #resizeFullbtn/#resizeSmallbtn)
       moves all cell children and sets an inline height on each of them,
       which stretched the dot into a bar. */
    width: 8px !important;
    height: 8px !important;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 4px rgba(34, 197, 94, 0.8);
    z-index: 1001;
    pointer-events: none;
}

/* Same dot, blinking while the series is fetched (network) or read back
   from the volume buffer cache (application.js showVolumeCachedDot(true)) */
.vp-volume-cached-dot--loading {
    animation: vp-volume-dot-blink 0.9s ease-in-out infinite;
}

@keyframes vp-volume-dot-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.15; }
}

.vp-cache-spinner--mpr {
    flex-direction: column;
    gap: 14px;
}

.vp-cache-spinner--mpr::after {
    width: 66px;
    height: 66px;
    border-width: 5px;
}

.vp-cache-spinner__label {
    order: 1;
    color: #00C5A0;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* ──────────────────────────────────────────────
   Viewport long-press drag-to-move / swap
   ────────────────────────────────────────────── */
.grid-hold-ring {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    width: 48px;
    height: 48px;
    transform: translate(-50%, -50%);
}
.grid-hold-ring circle.track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 3;
}
.grid-hold-ring circle.progress {
    fill: none;
    stroke: var(--Brand-Primary, #00C5A0);
    stroke-width: 3;
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    stroke-linecap: round;
    transform-origin: 24px 24px;
    transform: rotate(-90deg);
    animation: vp-hold-fill var(--hold-duration, 1000ms) linear forwards;
}
@keyframes vp-hold-fill {
    from { stroke-dashoffset: 120; }
    to   { stroke-dashoffset: 0;   }
}


.grid-drag-source {
    outline: 2px solid var(--Brand-Primary, #00C5A0) !important;
    outline-offset: -2px;
    opacity: 0.75 !important;
}

.grid-drag-target-hover {
    outline: 2px dashed var(--Brand-Primary, #00C5A0) !important;
    outline-offset: -2px;
    background-color: rgba(0, 197, 160, 0.08) !important;
}

.grid-drag-target-swap-hover {
    outline: 2px dashed #FF9800 !important;
    outline-offset: -2px;
    background-color: rgba(255, 152, 0, 0.08) !important;
}

.grid-drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    width: 160px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    opacity: 0.82;
    border: 1.5px solid var(--Brand-Primary, #00C5A0);
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    user-select: none;
    background: #1c1c1e;
}
.grid-drag-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.grid-drag-preview .drag-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    font-family: 'Inter', sans-serif;
    text-align: center;
    letter-spacing: 0.02em;
}
.grid-drag-preview .drag-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #fff;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
}
.grid-drag-preview .drag-icon {
    font-size: 18px;
    opacity: 0.9;
}

/* ---- Document (PDF) series cards ---------------------------------------- *
 * A loose PDF imported beside the images, or a DICOM-encapsulated document.
 * Neither has pixel data, so the thumbnail area shows a glyph instead of a
 * decoded image. Dashed border distinguishes it from a real image series.
 * ------------------------------------------------------------------------- */
.thumbnail-card.document-card .thumbnail-image.document-thumbnail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    color: #d8dee9;
    background: var(--Viewer-BG, #000);
    border: 1px dashed rgba(255, 255, 255, 0.28);
    cursor: pointer;
}

.thumbnail-card.document-card .document-thumbnail svg {
    opacity: 0.85;
}

.thumbnail-card.document-card .document-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
}

.thumbnail-card.document-card:hover .thumbnail-image.document-thumbnail {
    border-color: rgba(255, 255, 255, 0.55);
}

.thumbnail-card.document-card:hover .document-thumbnail svg {
    opacity: 1;
}

/* ---- In-app PDF reader (browser / PWA) ---------------------------------- *
 * The Electron build hands the document to the workstation's reader. The web
 * and PWA builds have nowhere to hand it to - an installed PWA has no tab to
 * open into - so the document is rendered by the browser's own PDF viewer
 * inside this modal, over the viewer, without leaving the application.
 * ------------------------------------------------------------------------- */
.pdf-doc-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 2vw;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.72);
}

.pdf-doc-modal-panel {
    display: flex;
    flex-direction: column;
    width: min(1100px, 96vw);
    height: 96vh;
    background: #15181c;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
}

.pdf-doc-modal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #1d2126;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-family: 'Inter', sans-serif;
}

.pdf-doc-modal-title {
    flex: 1 1 auto;
    min-width: 0;
    color: #e5e9f0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-doc-modal-btn {
    flex: 0 0 auto;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    background: transparent;
    color: #e5e9f0;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
}

.pdf-doc-modal-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
}

.pdf-doc-modal-frame {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    background: #2b2b2b;
}

/* ---- Structured Report (SR) series cards -------------------------------- *
 * A DICOM Structured Report carries a tree of coded observations instead of
 * pixel data, so the thumbnail area shows a report glyph like a document card
 * does. Same dashed border as .document-card, different badge, so the two
 * non-image kinds read as a family without being mistaken for each other.
 * ------------------------------------------------------------------------- */
.thumbnail-card.report-card .thumbnail-image.report-thumbnail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    color: #d8dee9;
    background: var(--Viewer-BG, #000);
    border: 1px dashed rgba(255, 255, 255, 0.28);
    cursor: pointer;
}

.thumbnail-card.report-card .report-thumbnail svg {
    opacity: 0.85;
}

.thumbnail-card.report-card .report-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(0, 197, 160, 0.18);
    color: var(--Brand-Primary, #00C5A0);
}

.thumbnail-card.report-card:hover .thumbnail-image.report-thumbnail {
    border-color: rgba(255, 255, 255, 0.55);
}

.thumbnail-card.report-card:hover .report-thumbnail svg {
    opacity: 1;
}

/* ---- In-app Structured Report reader ------------------------------------ *
 * Unlike an encapsulated PDF there is no external application to hand an SR
 * to: the report only exists as a content tree, so this modal is the reader on
 * every build, Electron included. Styled to match .pdf-doc-modal so the two
 * readers are visibly the same feature.
 * ------------------------------------------------------------------------- */
.sr-doc-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 2vw;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.72);
}

.sr-doc-modal-panel {
    display: flex;
    flex-direction: column;
    width: min(980px, 96vw);
    height: 92vh;
    background: #15181c;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
}

.sr-doc-modal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #1d2126;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-family: 'Inter', sans-serif;
    flex: 0 0 auto;
}

.sr-doc-modal-title {
    flex: 1 1 auto;
    min-width: 0;
    color: #e5e9f0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-doc-modal-btn {
    flex: 0 0 auto;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    background: transparent;
    color: #e5e9f0;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
}

.sr-doc-modal-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
}

.sr-doc-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 26px 32px;
    background: #15181c;
    outline: none;
}

/* ---- Rendered report content ------------------------------------------- */

.sr-report {
    font-family: 'Inter', sans-serif;
    color: #dfe4ec;
    font-size: 13px;
    line-height: 1.55;
    max-width: 82ch;
}

.sr-report-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sr-report-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    flex: 1 1 auto;
}

.sr-flags {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

.sr-flag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.sr-flag-ok {
    background: rgba(0, 197, 160, 0.18);
    color: var(--Brand-Primary, #00C5A0);
}

.sr-flag-warn {
    background: rgba(255, 176, 32, 0.16);
    color: #ffc457;
}

/* Document-level attributes: patient, study, dates, verifying observers. */
.sr-meta {
    display: grid;
    grid-template-columns: minmax(120px, max-content) 1fr;
    gap: 2px 16px;
    margin: 14px 0 20px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.035);
    border-radius: 5px;
    font-size: 12px;
}

.sr-meta-row {
    display: contents;
}

.sr-meta-name {
    color: #8b95a5;
}

.sr-meta-value {
    color: #e5e9f0;
    word-break: break-word;
}

/* A CONTAINER becomes a section. Nesting is shown with a left rule rather
   than indentation, so a deeply nested measurement group does not run off the
   right-hand edge of the panel. */
.sr-section {
    margin: 0 0 16px;
}

.sr-section > .sr-section,
.sr-section > .sr-row-children {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.sr-section-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--Brand-Primary, #00C5A0);
    letter-spacing: 0.01em;
}

.sr-depth-0 > .sr-section-title {
    font-size: 15px;
    color: #fff;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

/* A leaf: 'concept name' on the left, its value on the right. */
.sr-row {
    display: flex;
    gap: 12px;
    padding: 2px 0;
    align-items: baseline;
}

.sr-row-name {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 40%;
    color: #8b95a5;
}

.sr-row-value {
    flex: 1 1 auto;
    color: #e5e9f0;
    word-break: break-word;
}

/* Measurements are the one value worth making scannable down the column. */
.sr-row.sr-type-num .sr-row-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #fff;
}

.sr-row.sr-type-uidref .sr-row-value,
.sr-row.sr-type-image .sr-row-value,
.sr-row.sr-type-scoord .sr-row-value,
.sr-row.sr-type-scoord3d .sr-row-value {
    color: #8b95a5;
    font-size: 12px;
    word-break: break-all;
}

.sr-row-children {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Narrative text: the substance of most reports, so it gets a block of its
   own with the source's line breaks preserved rather than a table cell. */
.sr-block {
    margin: 10px 0 16px;
}

.sr-block-title {
    color: #8b95a5;
    font-size: 12px;
    margin-bottom: 4px;
}

.sr-block-text {
    white-space: pre-wrap;
    color: #e9edf4;
    background: rgba(255, 255, 255, 0.035);
    border-left: 2px solid rgba(0, 197, 160, 0.5);
    border-radius: 0 4px 4px 0;
    padding: 10px 12px;
}

.sr-empty {
    color: #6f7887;
    font-style: italic;
    font-size: 12px;
}

/* ──────────────────────────────────────────────
   Series splitter (multi-echo / b-value batches)
   ────────────────────────────────────────────── */
.series-split-btn {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(28, 28, 30, 0.85);
    border: 1px solid var(--Viewer-Border, #3D3C41);
    color: var(--Brand-Primary, #00C5A0);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
}

.series-split-btn:hover {
    background: rgba(0, 197, 160, 0.18);
    border-color: var(--Brand-Primary, #00C5A0);
}

.series-split-badge {
    display: inline-block;
    margin: 2px 0;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(28, 28, 30, 0.7);
    color: var(--Brand-Primary, #00C5A0);
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
}

/* Parts of a series on its thumbnail (MG views, US stills/clips, XA runs) */
.series-parts {
    width: 100%;
    padding: 0 4px 8px;
    box-sizing: border-box;
}

.series-parts-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--Viewer-Border, #3D3C41);
    border-radius: 6px;
    background: transparent;
    color: var(--Brand-Primary, #00C5A0);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.series-parts-toggle:hover {
    background: var(--Viewer-Accent, #003228);
}

.series-parts-caret {
    margin-left: auto;
    transition: transform 0.15s;
}

.series-parts-toggle[aria-expanded="true"] .series-parts-caret {
    transform: rotate(180deg);
}

/* Capped at the thumbnail image's height (an expanded card stays at most
   about double its size); longer lists scroll inside the card. */
.series-parts-list {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px;
    margin-top: 6px;
    max-height: 120px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--Viewer-Border, #3D3C41) transparent;
}

.series-parts-list::-webkit-scrollbar {
    width: 4px;
}

.series-parts-list::-webkit-scrollbar-thumb {
    border-radius: 2px;
    background: var(--Viewer-Border, #3D3C41);
}

.series-parts-list[hidden] {
    display: none;
}

.series-parts-checking {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--Viewer-Gray-Light, #949396);
    font-size: 11px;
}

.series-parts-spinner {
    flex: none;
    width: 10px;
    height: 10px;
    border: 2px solid var(--Viewer-Border, #3D3C41);
    border-top-color: var(--Brand-Primary, #00C5A0);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.series-part-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 100%;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--Viewer-on-Surface, #2C2C2E);
    color: #fff;
    font-size: 11px;
    cursor: grab;
}

.series-part-chip:hover {
    border-color: var(--Brand-Palette-green-700, #008C72);
    background: var(--Viewer-Accent, #003228);
}

.series-part-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.series-part-count {
    margin-left: auto;
    color: var(--Viewer-Gray-Light, #949396);
}

.series-split-content {
    margin: 12% auto;
    width: 420px;
    max-width: calc(100vw - 48px);
    border-radius: 20px;
    background: #2B2B2D;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.series-split-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.series-split-subtitle {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #B8B8B8;
    line-height: 1.5;
}

.series-split-mode {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #3D3D40;
}

.series-split-mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.series-split-mode-option input[type="radio"] {
    margin: 0;
    accent-color: var(--Brand-Primary, #00C5A0);
    cursor: pointer;
}

.series-split-list.series-split-disabled,
.series-split-selectall.series-split-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.series-split-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.series-split-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    background: #3D3D40;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
    /* Shift-click is range selection; don't let it highlight the label text. */
    user-select: none;
}

.series-split-row:hover {
    background: #4A4A4D;
}
.series-split-row input[type="checkbox"] {
    margin: 0;
    accent-color: var(--Brand-Primary, #00C5A0);
    cursor: pointer;
}

.series-split-selectall {
    background: transparent;
    margin-bottom: 8px;
    padding: 4px 12px;
    color: #B8B8B8;
    font-size: 13px;
}

.series-split-selectall:hover {
    background: transparent;
    color: #fff;
}

.series-split-name {
    flex: 1;
}

.series-split-count {
    color: #B8B8B8;
    font-size: 12px;
    font-weight: 400;
}

.series-split-note {
    min-height: 18px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #B8B8B8;
}

.series-peek-count {
    font-variant-numeric: tabular-nums;
}

.series-peek-track {
    height: 6px;
    margin-bottom: 20px;
    border-radius: 3px;
    background: #3D3D40;
    overflow: hidden;
}

.series-peek-fill {
    width: 0;
    height: 100%;
    border-radius: 3px;
    background: var(--Brand-Primary, #00C5A0);
    transition: width 0.15s ease-out;
}

.series-split-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.series-split-cancel {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: #3D3D40;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.series-split-cancel:hover {
    background: #4A4A4D;
}

.series-split-confirm {
    padding: 10px 22px;
    border-radius: 10px;
    border: none;
    background: var(--Brand-Primary, #00C5A0);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.series-split-confirm:hover {
    background: #00B091;
}

.series-split-confirm:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---- Printing a Structured Report --------------------------------------- *
 * The image print (#printImage in index.html) hides the whole page and shows
 * only #viewerDisplay / #printContainer, landscape, on a single page. A report
 * is text, so it needs the opposite of that last part: portrait, free to break
 * across pages, with the viewer surfaces out of the way.
 *
 * Every rule here is scoped to the sr-printing class that structuredReport.js
 * puts on <html> and <body> for the duration of the print, so the image print
 * behaves exactly as it did before.
 * ------------------------------------------------------------------------- */
@media print {
    /* The image print clamps the document to one screen. A report has to be
       allowed to run on. */
    html.sr-printing,
    body.sr-printing {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
    }

    /* These are forced visible and fixed for the image print; left alone they
       would print the viewer on top of the report. */
    body.sr-printing #imagesDiv,
    body.sr-printing .main-content,
    body.sr-printing #viewerDisplay,
    body.sr-printing #printContainer,
    body.sr-printing .sr-doc-modal {
        display: none !important;
        visibility: hidden !important;
    }

    body.sr-printing #srPrintContainer,
    body.sr-printing #srPrintContainer * {
        visibility: visible !important;
    }

    /* bootstrap.css appends every link target to its text when printing.
       No URL belongs on a printed report. */
    body.sr-printing #srPrintContainer a[href]:after,
    body.sr-printing #srPrintContainer abbr[title]:after {
        content: "" !important;
    }

    body.sr-printing #srPrintContainer {
        position: static !important;
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        /* Vertical space comes from the repeating gutter rows below, not
           from here: container padding applies once, not once per sheet. */
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }

    /* The table that carries the report. Its empty head and foot rows are
       repeated by the browser on every printed sheet, which is what keeps a
       margin at the top and bottom of pages two onwards. */
    body.sr-printing .sr-print-sheet {
        width: 100% !important;
        border-collapse: collapse !important;
        border: 0 !important;
        background: #fff !important;
    }

    body.sr-printing .sr-print-sheet > tbody > tr > td.sr-print-cell {
        padding: 0 !important;
        border: 0 !important;
        vertical-align: top !important;
    }

    body.sr-printing .sr-print-gutter {
        height: 12mm !important;
        padding: 0 !important;
        border: 0 !important;
    }

    /* ---- the report itself, inverted out of the dark reader palette ---- */

    body.sr-printing .sr-print-body .sr-report {
        max-width: none !important;
        color: #000 !important;
        font-size: 10pt !important;
        line-height: 1.45 !important;
    }

    body.sr-printing .sr-print-body .sr-report-head {
        border-bottom: 1px solid #000 !important;
    }

    body.sr-printing .sr-print-body .sr-report-title {
        font-size: 15pt !important;
        color: #000 !important;
    }

    body.sr-printing .sr-print-body .sr-flag {
        background: transparent !important;
        border: 1px solid #666 !important;
        color: #000 !important;
    }

    body.sr-printing .sr-print-body .sr-meta {
        background: transparent !important;
        border: 1px solid #bbb !important;
        padding: 3mm !important;
    }

    body.sr-printing .sr-print-body .sr-meta-name,
    body.sr-printing .sr-print-body .sr-row-name,
    body.sr-printing .sr-print-body .sr-block-title {
        color: #444 !important;
    }

    body.sr-printing .sr-print-body .sr-meta-value,
    body.sr-printing .sr-print-body .sr-row-value {
        color: #000 !important;
    }

    body.sr-printing .sr-print-body .sr-section-title {
        color: #000 !important;
        border-bottom-color: #000 !important;
    }

    body.sr-printing .sr-print-body .sr-section > .sr-section,
    body.sr-printing .sr-print-body .sr-section > .sr-row-children,
    body.sr-printing .sr-print-body .sr-row-children {
        border-left: 1px solid #999 !important;
    }

    body.sr-printing .sr-print-body .sr-block-text {
        background: transparent !important;
        border-left: 2px solid #666 !important;
        color: #000 !important;
    }

    body.sr-printing .sr-print-body .sr-empty {
        color: #666 !important;
    }

    /* ---- pagination ----
       A report may run to several pages, but a heading must not be stranded at
       the foot of one and a measurement must not be split down the middle. */
    body.sr-printing .sr-print-body .sr-section {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    body.sr-printing .sr-print-body .sr-section-title,
    body.sr-printing .sr-print-body .sr-block-title {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    body.sr-printing .sr-print-body .sr-row,
    body.sr-printing .sr-print-body .sr-meta,
    body.sr-printing .sr-print-body .sr-block {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}
