/* R5.8.5 - HOTFIX UI 01 - contrast, native dialog + Select2, interview read-only studio.
 * Applied last in the base layout: do not require changes to stored interview data. */
/* 1. Buttons on DARK hero backgrounds must be light text and legible. */
.app-wrapper :is(.r53-hero,.r54-library-hero,.r585-doc-hero,.r52-hero,.r56-hero,.r58-hero,.r583-hero,.r55-hero,.r58d-hero,.r58b-hero,.r61-hero) .btn-outline-light,
.app-wrapper :is(.r53-hero,.r54-library-hero,.r585-doc-hero,.r52-hero,.r56-hero,.r58-hero,.r583-hero,.r55-hero,.r58d-hero,.r58b-hero,.r61-hero) a.btn-outline-light {
  color:#ffffff!important;border-color:#e7eef7!important;background:transparent!important;
  text-decoration:none!important;font-weight:700!important;text-shadow:none!important;
}
.app-wrapper :is(.r53-hero,.r54-library-hero,.r585-doc-hero,.r52-hero,.r56-hero,.r58-hero,.r583-hero,.r55-hero,.r58d-hero,.r58b-hero,.r61-hero) :is(.btn-outline-light:hover,.btn-outline-light:focus-visible),
.app-wrapper :is(.r53-hero,.r54-library-hero,.r585-doc-hero,.r52-hero,.r56-hero,.r58-hero,.r583-hero,.r55-hero,.r58d-hero,.r58b-hero,.r61-hero) a.btn-outline-light:hover {
  color:#172d42!important;background:#ffffff!important;border-color:#ffffff!important;
}
.app-wrapper :is(.r53-hero,.r54-library-hero,.r585-doc-hero) .btn-light {
  background:#ffffff!important;color:#172d42!important;border-color:#ffffff!important;font-weight:700!important;
}
.app-wrapper :is(.r53-hero,.r54-library-hero,.r585-doc-hero) .btn-light:hover {
  background:#eaf0f7!important;color:#172d42!important;
}
/* 2. Native <dialog> uses the top layer. Dropdown is attached directly to the dialog
      after showModal() so it cannot sit beneath the overlay or the scroll panel. */
.r585-dialog[open]{overflow:visible!important;isolation:isolate}
.r585-dialog .r585-dialog-content{overscroll-behavior:contain}
.r585-dialog .select2-container{max-width:100%!important}
.r585-dialog .select2-container--open{z-index:25!important}
.r585-dialog>.select2-container,.r585-dialog>.select2-container--open,
.r585-dialog>.select2-container--default {z-index:100!important}
.r585-dialog .select2-dropdown {
  z-index:100!important;max-height:min(45vh,350px);overflow:auto;
  background:var(--bs-body-bg,#ffffff)!important;color:var(--bs-body-color,#243449)!important;
  border:1px solid #9aaec5!important;box-shadow:0 12px 25px rgba(17,34,54,.24)!important;
}
.r585-dialog .select2-results__options{max-height:220px!important}
.r585-dialog .select2-results__option{color:var(--bs-body-color,#243449);line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.r585-dialog .select2-results__option--highlighted {color:#ffffff!important;background:#ad1f2c!important}
.r585-dialog .select2-search__field{background:var(--bs-body-bg,#ffffff)!important;color:var(--bs-body-color,#243449)!important}
.r585-dialog .select2-selection__rendered{color:var(--bs-body-color,#243449)!important}
.r585-dialog :is(.form-select,.form-control) {color:var(--bs-body-color,#243449)!important;opacity:1!important}
/* Dropdown arrow and focus state remain perceivable in light & dark themes. */
.r585-dialog select:focus-visible,.r585-dialog .select2-selection:focus-visible{outline:2px solid #b4232c!important;outline-offset:2px}
/* 3. Studio: audio column stays visible, questions begin immediately next to it.
   Compact horizontal navigation replaces the tall Parts sidebar only in studio. */
.r54-mode .r54-shell{grid-template-columns:minmax(280px,340px) minmax(0,1fr)!important;gap:16px!important;align-items:start!important}
.r54-mode .r53-layout{display:flex!important;flex-direction:column!important;gap:12px!important;min-width:0!important;width:100%!important}
.r54-mode .r53-main{margin:0!important;width:100%!important;min-width:0!important;display:block!important}
.r54-mode .r54-panel{top:14px;max-height:calc(100vh - 28px)}
.r585-studio-parts{padding:12px 14px;border:1px solid var(--r53-border,#cbd5e1);background:var(--r53-paper,#fff);border-radius:12px;min-width:0;max-width:100%}
.r585-studio-parts>strong{display:block;font-size:.87rem;margin:0 0 8px;color:var(--r53-text,#243449)}
.r585-studio-parts-links{display:flex;gap:6px;max-width:100%;overflow-x:auto;padding-bottom:4px;scrollbar-width:thin}
.r585-studio-parts a{white-space:nowrap;display:inline-flex;align-items:center;flex:none;padding:8px 11px;border:1px solid var(--r53-border,#b9c6d5);border-radius:8px;background:var(--r53-base,#f5f7fa);color:var(--r53-text,#243449);font-weight:650;text-decoration:none;font-size:.83rem}
.r585-studio-parts a:hover,.r585-studio-parts a:focus-visible{border-color:#b4232c;color:#a21c29}
.r585-studio-parts a.active{background:#b4232c;color:#fff;border-color:#b4232c}
.r585-readonly-banner{border-left:4px solid #245780;background:#ecf5fc;color:#183c59;border-radius:8px;padding:13px 15px;margin:0 0 16px;line-height:1.5}
.r585-readonly-banner strong{color:#183c59}
.r54-mode .r53-question{max-width:100%;overflow-wrap:anywhere}
@media(max-width:1100px){.r54-mode .r54-shell{grid-template-columns:minmax(245px,290px) minmax(0,1fr)!important}}
@media(max-width:970px){.r54-mode .r54-shell{display:block!important}.r54-mode .r54-panel{position:relative;max-height:none;margin-bottom:15px}.r585-studio-parts{padding:10px}.r54-mode .r53-main{padding:16px}}
@media(max-width:550px){.r585-studio-parts-links a{font-size:.8rem;padding:9px}.r585-readonly-banner{font-size:.9rem}.r54-mode .r53-main{padding:12px}}
html[data-bs-theme="dark"] .r585-readonly-banner{background:#203a51;color:#edf5ff;border-color:#72b9ea}
html[data-bs-theme="dark"] .r585-readonly-banner strong{color:#fff}
.r585-dialog .r585-field>label{font-weight:650;font-size:.86rem;line-height:1.35;color:var(--bs-body-color,#243449);cursor:default}
