/* Follow the session theme, including dialogs rendered outside the layout. */
@media screen {
  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-overlay) {
    color-scheme: dark;
    color: #e2e8f0;
    background: rgb(2 6 23 / 72%) !important;
  }

  body.analyse-theme-dark .modal-v2-overlay > :is(div, form, section):not(.absolute),
  body.analyse-theme-dark .modal-content {
    background: linear-gradient(145deg, #172235, #111c2e) !important;
    color: #e2e8f0;
    border-color: #334155;
    box-shadow: 0 25px 60px -15px #0009, 0 0 0 1px #475569 !important;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) :is([class~='text-[#34495e]'], [class~='text-[#2c3e50]']) {
    color: #f1f5f9 !important;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) [class~='text-[#7f8c8d]'] {
    color: #b8c7da !important;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) [class~='hover:text-[#34495e]']:hover {
    color: #fff !important;
  }

  /* Replace the old white inset/outset shadows on cards and action buttons. */
  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) [class*='shadow-'][class*='#ffffff'] {
    box-shadow: 0 2px 6px #0004, inset 0 0 0 1px #64748b55 !important;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) button[class*='shadow-'][class*='#ffffff']:active {
    box-shadow: inset 0 2px 6px #0006, inset 0 0 0 1px #94a3b855 !important;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
    background-color: #111c2e !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) :is(input, textarea)::placeholder {
    color: #94a3b8;
    opacity: 1;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) :is(input, select, textarea):disabled {
    background-color: #202f46 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) :is(input, select, textarea, button):focus-visible {
    outline: 2px solid #7dd3fc;
    outline-offset: 3px;
  }

  body.analyse-theme-dark :is(.modal-v2-overlay, .modal-content) option {
    color: #e2e8f0 !important;
    background: #172235 !important;
  }

  body.analyse-theme-dark .modal-v2-overlay option:is([style*='#15803d'], [style*='rgb(21, 128, 61)']) { color: #86efac !important; }
  body.analyse-theme-dark .modal-v2-overlay option:is([style*='#b91c1c'], [style*='rgb(185, 28, 28)']) { color: #fda4af !important; }

  body.analyse-theme-dark .modal-v2-overlay :is([class$='-placeholder'], [class$='-indicatorContainer']) {
    color: #b8c7da !important;
  }

  body.analyse-theme-dark .modal-v2-overlay :is([class$='-input'], [class$='-control'] input) {
    background: transparent !important;
  }

  body.analyse-theme-dark .modal-v2-overlay :is(.border-b, .border-t) { border-color: #334155; }
  body.analyse-theme-dark .modal-v2-overlay .rounded-full > .bg-white.rounded-full { background-color: #cbd5e1 !important; }

  body.analyse-theme-dark .modal-v2-overlay [role=option][aria-selected=true] {
    background-color: #164e63 !important;
    color: #f0f9ff !important;
  }

  body.analyse-theme-dark .modal-v2-overlay button[aria-pressed=true] {
    background: #164e63 !important;
    border-color: #38bdf8 !important;
    color: #e0f2fe !important;
  }

  body.analyse-theme-dark .modal-v2-overlay button:is([type=submit], .bg-blue-600, .bg-primary-600) {
    background: linear-gradient(135deg, #0369a1, #075985);
    color: #fff !important;
    box-shadow: 0 4px 14px #0004;
  }

  body.analyse-theme-dark .modal-v2-overlay .unit-segmented-group {
    background: #111c2e;
    border-color: #475569;
  }

  body.analyse-theme-dark .modal-v2-overlay .unit-segmented-group legend { color: #cbd5e1; }
  body.analyse-theme-dark .modal-v2-overlay .unit-pill { background: #202f46; color: #e2e8f0; border-color: #475569; }
  body.analyse-theme-dark .modal-v2-overlay .unit-segmented-options input:checked + .unit-pill {
    background: #075985;
    border-color: #38bdf8;
    color: #fff;
    box-shadow: 0 0 0 1px #38bdf8;
  }
  body.analyse-theme-dark .modal-v2-overlay .unit-segmented-options input:focus-visible + .unit-pill { outline-color: #7dd3fc; }
}
