/*
 * JUSTIS A1 Compact theme bridge.
 *
 * The Angular Brand Kit is the visual reference only. These semantic tokens
 * keep the existing Laminas/Bootstrap markup themeable without importing the
 * Angular component library.
 */
:root {
    --justis-control-height: 40px;
    --justis-control-radius: 7px;
    --justis-input-font-size: 16px;
    --justis-button-font-size: 14px;
    --justis-button-font-weight: 700;
}

:root,
html[data-theme="light"] {
    --justis-page-bg: #ffffff;
    --justis-surface-subtle: #f5f5f7;
    --justis-surface-emphasis: #eef6f6;
    --justis-surface-raised: #ffffff;
    --justis-surface-raised-hover: #f0f7fc;
    --justis-chrome-bg: #003781;
    --justis-text-primary: #003781;
    --justis-text-secondary: #3f72b1;
    --justis-text-disabled: #9ea4b4;
    --justis-action: #003781;
    --justis-action-hover: #00266d;
    --justis-on-action: #ffffff;
    --justis-border: #d2d5dc;
    --justis-border-strong: #6590bd;
    --justis-control-bg: #ffffff;
    --justis-control-border: #6590bd;
    --justis-button-disabled-bg: #c1c5cf;
    --justis-button-disabled-text: #5f636f;
    --justis-focus: #0e98cc;
    --justis-overlay: rgba(9, 18, 35, 0.48);
    --justis-shadow: 0 2px 8px rgba(18, 43, 84, 0.16), 0 8px 24px rgba(18, 43, 84, 0.12);
    --justis-info-bg: #dbeaf5;
    --justis-info-text: #1a5393;
    --justis-filled-bg: #0f1f3a;
    --justis-filled-text: #dbeaf5;
    --justis-filled-border: #0377a8;
    --justis-success-bg: #d9f2e2;
    --justis-success-text: #006028;
    --justis-warning-bg: #fbe6a7;
    --justis-warning-text: #6a4e00;
    --justis-danger-bg: #fae2e3;
    --justis-danger-text: #aa001b;
    --justis-pastel-yellow-bg: #fff4cc;
    --justis-pastel-yellow-text: #664d00;
    --justis-pastel-orange-bg: #ffe8d6;
    --justis-pastel-orange-text: #853700;
    --justis-pastel-red-bg: #fde2e4;
    --justis-pastel-red-text: #94152b;
    --justis-pastel-purple-bg: #eee5ff;
    --justis-pastel-purple-text: #593080;
    --justis-pastel-teal-bg: #d9f3ef;
    --justis-pastel-teal-text: #00635a;
    --justis-pastel-aqua-bg: #dcf4fb;
    --justis-pastel-aqua-text: #005e78;
    --justis-pastel-blue-bg: #dbeaf5;
    --justis-pastel-blue-text: #003781;
    --justis-pastel-green-bg: #dff2e4;
    --justis-pastel-green-text: #146534;
    --justis-pastel-gray-bg: #eceff2;
    --justis-pastel-gray-text: #34383c;
    --bs-body-bg: var(--justis-page-bg);
    --bs-body-color: var(--justis-text-primary);
    --bs-primary: var(--justis-action);
    --bs-primary-rgb: 0, 55, 129;
    color-scheme: light;
}

/* Screen themes must not override the existing print stylesheet. Keep the
   light root tokens above available to print layouts and other stylesheets. */
@media screen {
html[data-theme="dark"] {
    --justis-page-bg: #091223;
    --justis-surface-subtle: #0c182e;
    --justis-surface-emphasis: #0f1f3a;
    --justis-surface-raised: #091223;
    --justis-surface-raised-hover: #14345e;
    --justis-chrome-bg: #0f294a;
    --justis-cap-chrome-bg: #4b101b;
    --justis-cap-chrome-border: #772637;
    --justis-editorial-green-bg: #132a22;
    --justis-editorial-blue-bg: #10213a;
    --justis-text-primary: #dbeaf5;
    --justis-text-secondary: #8dafd1;
    --justis-text-disabled: #68727b;
    --justis-action: #dbeaf5;
    --justis-action-hover: #c3d7e9;
    --justis-on-action: #001955;
    --justis-border: #335389;
    --justis-border-strong: #5371a4;
    --justis-control-bg: #091223;
    --justis-control-border: #dbeaf5;
    --justis-button-disabled-bg: #4a555f;
    --justis-button-disabled-text: #c1c8d0;
    --justis-focus: #0e98cc;
    --justis-overlay: rgba(0, 0, 0, 0.72);
    --justis-shadow: 0 2px 8px rgba(0, 0, 0, 0.16), 0 8px 24px rgba(0, 0, 0, 0.12);
    --justis-info-bg: #00266d;
    --justis-info-text: #8dafd1;
    --justis-filled-bg: #0f1f3a;
    --justis-filled-text: #dbeaf5;
    --justis-filled-border: #1e90c1;
    --justis-success-bg: #023409;
    --justis-success-text: #9ae5b4;
    --justis-warning-bg: #382a04;
    --justis-warning-text: #fad066;
    --justis-danger-bg: #5c0906;
    --justis-danger-text: #ff808a;
    --justis-pastel-yellow-bg: #3a300d;
    --justis-pastel-yellow-text: #ffe08a;
    --justis-pastel-orange-bg: #40230f;
    --justis-pastel-orange-text: #ffbe8a;
    --justis-pastel-red-bg: #421725;
    --justis-pastel-red-text: #ffadb9;
    --justis-pastel-purple-bg: #2c2042;
    --justis-pastel-purple-text: #d8bdff;
    --justis-pastel-teal-bg: #103935;
    --justis-pastel-teal-text: #90ded4;
    --justis-pastel-aqua-bg: #103445;
    --justis-pastel-aqua-text: #9cddf0;
    --justis-pastel-blue-bg: #102f58;
    --justis-pastel-blue-text: #a9cceb;
    --justis-pastel-green-bg: #173820;
    --justis-pastel-green-text: #9de0ad;
    --justis-pastel-gray-bg: #252d3a;
    --justis-pastel-gray-text: #d8dee7;
    --bs-body-bg: var(--justis-page-bg);
    --bs-body-color: var(--justis-text-primary);
    --bs-primary: var(--justis-action);
    --bs-primary-rgb: 219, 234, 245;
    color-scheme: dark;
}

html[data-theme] body {
    background-color: var(--justis-page-bg);
    color: var(--justis-text-primary);
}

html[data-theme] :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--justis-focus) !important;
    outline-offset: 2px;
}

/* Pointer activation should not retain legacy focus rings on preferences. */
html[data-theme] body [data-preference-pointer-focus],
html[data-theme] :is(.site-language-switcher, .site-language-switcher-footer) > .nav-link:focus:not(:focus-visible),
html[data-theme] .a1-theme-switcher__trigger:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
}

.a1-theme-switcher {
    align-items: center;
    background: var(--justis-surface-raised);
    border: 1px solid var(--justis-border);
    border-radius: 999px;
    box-shadow: var(--justis-shadow);
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 1080;
}

.a1-theme-switcher-slot {
    align-items: center;
    margin-left: 16px;
}

.a1-theme-switcher-slot .a1-theme-switcher {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    position: static;
}

.a1-theme-switcher-slot .a1-theme-switcher.is-open {
    background: var(--justis-surface-raised);
    border: 1px solid var(--justis-border);
    box-shadow: var(--justis-shadow);
    padding: 3px;
}

.a1-footer-preferences {
    align-items: flex-end;
    display: flex;
    gap: 8px;
    min-height: 44px;
}

.a1-theme-switcher-slot--footer {
    align-self: flex-end;
    display: block;
    flex: 0 0 44px;
    height: 44px;
    margin: 0;
    position: relative;
    width: 44px;
    z-index: 20;
}

.a1-theme-switcher-slot--footer .a1-theme-switcher {
    align-items: flex-end;
    bottom: 0;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: auto;
}

.a1-theme-switcher-slot--header {
    display: block;
    flex: 0 0 44px;
    height: 44px;
    margin-left: 8px;
    position: relative;
    width: 44px;
    z-index: 1081;
}

.a1-theme-switcher-slot--header .a1-theme-switcher {
    align-items: flex-end;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 0;
}

.a1-login-mobile-preferences {
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.a1-login-mobile-preferences .site-language-switcher {
    padding: 0;
}

.a1-login-mobile-preferences .site-language-switcher > .nav-link {
    align-items: center;
    display: flex;
    gap: 6px;
    padding: 8px;
}

.a1-login-language-switcher {
    flex: 0 0 72px;
    height: 44px;
    padding: 0 !important;
    position: relative;
    width: 72px;
}

.a1-login-language-switcher > .nav-link {
    align-items: center;
    background: var(--justis-action) !important;
    border-radius: 999px;
    color: var(--justis-on-action) !important;
    display: flex;
    gap: 6px;
    height: 36px;
    justify-content: center;
    margin: 4px 0;
    padding: 8px !important;
    width: 72px;
}

.a1-login-language-switcher > .dropdown-menu {
    left: auto !important;
    margin: 0;
    min-width: 72px;
    position: absolute !important;
    right: 0 !important;
    top: 44px !important;
    transform: none !important;
}

.a1-login-language-switcher > .dropdown-menu .dropdown-item {
    min-height: 36px;
    padding: 8px 12px;
}

@media (min-width: 768px) {
    .a1-theme-switcher-slot--portal-mobile-only {
        display: none !important;
    }
}

.a1-theme-switcher__button {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--justis-text-secondary);
    cursor: pointer;
    align-items: center;
    display: none;
    height: 36px;
    justify-content: center;
    min-height: 36px;
    min-width: 36px;
    padding: 8px;
    transition: background-color 120ms ease, color 120ms ease;
}

.a1-theme-switcher.is-open .a1-theme-switcher__button,
.a1-theme-switcher__button.is-active,
.a1-theme-switcher__button[aria-pressed="true"] {
    display: inline-flex;
}

.a1-theme-switcher__button svg {
    fill: none;
    height: 20px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 20px;
}

.a1-theme-switcher__button:hover {
    background: var(--justis-surface-raised-hover);
    color: var(--justis-text-primary);
}

.a1-theme-switcher__button.is-active,
.a1-theme-switcher__button[aria-pressed="true"] {
    background: var(--justis-action);
    color: var(--justis-on-action);
    font-weight: 600;
}

.a1-theme-switcher__menu .a1-theme-switcher__button[aria-pressed="true"],
html[data-theme] body :is(.site-language-switcher, .site-language-switcher-footer) .dropdown-menu a.dropdown-item:has(.lang-check) {
    background: transparent !important;
    color: var(--justis-action) !important;
    font-weight: 700;
}

html[data-theme] :is(.site-language-switcher, .site-language-switcher-footer) .dropdown-menu .dropdown-item:has(.lang-check) :is(.lang-check, span) {
    color: inherit !important;
}

html[data-theme] :is(.site-language-switcher, .site-language-switcher-footer) .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 8px;
}

html[data-theme] :is(.site-language-switcher, .site-language-switcher-footer) .dropdown-item:not(:has(.lang-check))::before {
    content: "";
    flex: 0 0 20px;
}

html[data-theme] :is(.site-language-switcher, .site-language-switcher-footer) .dropdown-item .lang-check {
    position: static !important;
    flex: 0 0 20px;
    width: 20px;
    transform: none;
    margin: 0;
}

html[data-theme] .top-header .site-language-switcher {
    position: relative;
}

html[data-theme] .top-header .site-language-switcher > .nav-link,
html[data-theme] .top-header .site-language-switcher > .nav-link :is(i, span) {
    color: var(--justis-action) !important;
}

html[data-theme] .top-header .site-language-switcher > .dropdown-menu {
    background: var(--justis-surface-raised) !important;
    border: 1px solid var(--justis-border) !important;
    border-radius: 8px;
    box-shadow: var(--justis-shadow);
    left: auto !important;
    right: 0 !important;
    top: calc(100% + 8px) !important;
    transform: none !important;
    margin: 0;
    min-width: 144px;
    width: max-content;
    padding: 4px !important;
}

html[data-theme] .top-header .site-language-switcher > .dropdown-menu > li {
    margin: 0;
    padding: 0;
    width: 100%;
}

html[data-theme] .top-header .site-language-switcher > .dropdown-menu .dropdown-item {
    border-radius: 4px;
    min-height: 44px;
    padding: 8px 12px !important;
    width: 100%;
}

/* Language and appearance controls share compact triggers and anchored menus. */
.a1-theme-switcher,
.a1-theme-switcher-slot .a1-theme-switcher.is-open {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.a1-theme-switcher-slot--header,
.a1-theme-switcher-slot--footer {
    flex-basis: 44px;
    width: 44px;
}

.a1-theme-switcher__trigger,
.a1-login-language-switcher > .nav-link {
    align-items: center;
    background: transparent !important;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--justis-action) !important;
    cursor: pointer;
    display: inline-flex;
    gap: 6px;
    height: 44px;
    justify-content: center;
    margin: 0;
    padding: 8px;
    width: 72px;
}

.a1-theme-switcher__trigger {
    padding: 8px 4px;
    width: 44px;
}

.a1-theme-switcher__trigger:hover,
.a1-theme-switcher__trigger[aria-expanded="true"],
.a1-login-language-switcher > .nav-link:hover,
.a1-login-language-switcher > .nav-link[aria-expanded="true"] {
    background: var(--justis-surface-raised-hover) !important;
}

html[data-theme] .a1-footer-preferences {
    align-items: center;
    gap: 8px;
}

html[data-theme] .a1-footer-preferences > .nav-item {
    align-self: center;
    height: 44px;
    margin: 0 !important;
    padding: 0 !important;
}

html[data-theme] .a1-footer-preferences > .site-language-switcher-footer {
    flex: 0 0 72px;
    width: 72px;
}

html[data-theme] .a1-footer-preferences .site-language-switcher-footer > .nav-link {
    align-items: center;
    background: transparent !important;
    border-radius: 8px;
    color: var(--justis-action) !important;
    display: inline-flex;
    font-size: 16px;
    gap: 6px;
    height: 44px;
    justify-content: center;
    padding: 8px;
    width: 72px;
}

html[data-theme] .a1-footer-preferences .site-language-switcher-footer > .nav-link:hover,
html[data-theme] .a1-footer-preferences .site-language-switcher-footer > .nav-link[aria-expanded="true"] {
    background: var(--justis-surface-raised-hover) !important;
}

html[data-theme] .a1-footer-preferences .site-language-switcher-footer > .dropdown-menu {
    border: 1px solid var(--justis-border);
    border-radius: 8px;
    bottom: 52px !important;
    box-shadow: var(--justis-shadow);
    left: 0 !important;
    margin: 0;
    min-width: 144px;
    padding: 4px;
    top: auto !important;
    transform: none !important;
}

html[data-theme] .a1-footer-preferences .dropdown-menu > li {
    margin: 0;
    padding: 0;
}

html[data-theme] .a1-footer-preferences .dropdown-menu .dropdown-item {
    border-radius: 4px;
    min-height: 44px;
    padding: 8px 12px;
}

.a1-theme-switcher__trigger svg {
    fill: none;
    height: 20px;
    width: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.a1-theme-switcher__caret {
    border-top: 5px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

.a1-theme-switcher__menu,
.a1-login-language-switcher > .dropdown-menu {
    background: var(--justis-surface-raised);
    border: 1px solid var(--justis-border);
    border-radius: 8px;
    box-shadow: var(--justis-shadow);
    margin: 0;
    min-width: 144px;
    padding: 4px;
    position: absolute;
    right: 0;
    top: 52px !important;
}

.a1-theme-switcher__menu { display: none; }
.a1-theme-switcher.is-open .a1-theme-switcher__menu { display: block; }

.a1-theme-switcher-slot--footer .a1-theme-switcher__menu {
    bottom: 52px;
    top: auto !important;
}

.a1-theme-switcher__menu .a1-theme-switcher__button,
.a1-login-language-switcher > .dropdown-menu .dropdown-item {
    border-radius: 4px;
    display: flex;
    gap: 10px;
    height: auto;
    justify-content: flex-start;
    min-height: 44px;
    padding: 8px 12px;
    width: 100%;
}

html[data-theme] :where(.card, .panel, .well, .box, .list-group-item, .accordion-item, .offcanvas, .toast, .modal-content, .dropdown-menu, .popover) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] :where(.card-header, .card-footer, .panel-heading, .box-header, .modal-header, .modal-footer, .accordion-button:not(.collapsed)) {
    background-color: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] :where(.dropdown-item, .list-group-item-action, .popover-header, .popover-body, .modal-title, .card-title, .card-text) {
    color: var(--justis-text-primary) !important;
}

html[data-theme] .popover {
    --bs-popover-bg: var(--justis-surface-raised);
    --bs-popover-border-color: var(--justis-border);
    --bs-popover-header-bg: var(--justis-surface-emphasis);
    --bs-popover-header-color: var(--justis-text-primary);
    --bs-popover-body-color: var(--justis-text-primary);
}

html[data-theme] .popover .popover-header {
    background-color: var(--justis-surface-emphasis) !important;
    border-bottom-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] .popover .popover-body {
    background-color: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] :where(.dropdown-item:hover, .dropdown-item:focus, .dropdown-item.active, .list-group-item-action:hover, .list-group-item-action:focus) {
    background-color: var(--justis-surface-raised-hover) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea, .form-control, .form-select, .input-group-text, .selectize-input, .selectize-dropdown) {
    background-color: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

/* Override legacy label greys without outranking contextual or validation colours. */
html[data-theme="dark"] :where(label, .form-label, .control-label, .col-form-label, .form-check-label, .form-checkbox-label, .form-radio-label) {
    color: var(--justis-text-primary);
}

html[data-theme] :where(.is-invalid, .was-validated .form-control:invalid, .was-validated .form-select:invalid, .was-validated .form-check-input:invalid, .has-error .form-control, .has-error .form-select) {
    border-color: var(--justis-danger-text) !important;
}

html[data-theme] .has-error .help-block {
    color: var(--justis-danger-text) !important;
}

html[data-theme="dark"] .has-error :where(label, .form-label, .control-label, .col-form-label) {
    color: var(--justis-danger-text);
}

html[data-theme] :where(.btn-primary, .btn-blue) {
    background-image: none !important;
    background-color: var(--justis-action) !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme] :where(.btn-primary, .btn-blue):hover,
html[data-theme] :where(.btn-primary, .btn-blue):focus {
    background-color: var(--justis-action-hover) !important;
    border-color: var(--justis-action-hover) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme] :where(.btn-secondary, .btn-outline-primary, .btn-white, .btn-default:not(.btn-primary):not(.btn-blue)) {
    background-image: none !important;
    background-color: transparent !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-action) !important;
}

html[data-theme] :where(table, .table, .dataTable) {
    --bs-table-bg: transparent;
    --bs-table-color: var(--justis-text-primary);
    --bs-table-striped-bg: var(--justis-surface-emphasis);
    --bs-table-striped-color: var(--justis-text-primary);
    --bs-table-hover-bg: var(--justis-surface-raised-hover);
    --bs-table-hover-color: var(--justis-text-primary);
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] .btn:is(.btn-secondary, .btn-outline-primary, .btn-white, .btn-default:not(.btn-primary):not(.btn-blue)):is(:hover, :focus):not(:disabled):not(.disabled) {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-action) !important;
}

/* A1 tables keep body cells transparent; overdue rows use a focused status marker. */
html[data-theme] :where(.portal-dashboard, .portal) tr.assistant-todo-row-past > td {
    background: transparent !important;
}

html[data-theme] :where(.portal-dashboard, .portal) tr.assistant-todo-row-past > td:first-child {
    border-left-color: var(--justis-danger-text) !important;
}

html[data-theme] :where(.portal-dashboard, .portal) .assistant-todo-deadline-past {
    color: var(--justis-danger-text) !important;
}

/* Present the legacy presence control like the compact A1 default switcher. */
html[data-theme] .profile-status,
html[data-theme] .profile-status .profile-presence-control {
    align-items: center;
    display: inline-flex;
}

html[data-theme] .profile-status {
    flex-wrap: wrap;
    gap: 8px;
}

html[data-theme] .profile-status .profile-presence-control {
    gap: 8px;
}

html[data-theme] .profile-status .toggle.replacetoggle {
    background: var(--justis-action) !important;
    border: 0 !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    height: 24px !important;
    min-height: 24px !important;
    min-width: 48px !important;
    padding: 0 !important;
    width: 48px !important;
}

html[data-theme] .profile-status .toggle.replacetoggle.off {
    background: var(--justis-border-strong) !important;
}

html[data-theme] .profile-status .replacetoggle .toggle-group {
    transition-duration: 160ms;
}

html[data-theme] .profile-status .replacetoggle :where(.toggle-on, .toggle-off) {
    background: transparent !important;
    border: 0 !important;
    color: transparent !important;
    font-size: 0 !important;
    padding: 0 !important;
}

html[data-theme] .profile-status .replacetoggle .toggle-handle {
    background: var(--justis-surface-raised) !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 2px rgba(9, 18, 35, 0.32) !important;
    display: block !important;
    height: 16px !important;
    left: 50%;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute;
    top: 4px;
    transform: translateX(-20px);
    width: 16px !important;
}

html[data-theme] .profile-status .replacetoggle.off .toggle-handle {
    transform: translateX(4px);
}

html[data-theme] .profile-status .replacetoggle:focus-within {
    outline: 3px solid var(--justis-focus) !important;
    outline-offset: 2px;
}

html[data-theme] .profile-status .profile-presence-label {
    color: var(--justis-text-primary);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

html[data-theme] .profile-status .profile-presence-label--absent {
    color: var(--justis-danger-text);
}

html[data-theme="dark"] .profile-status .toggle.replacetoggle {
    background: #0e98cc !important;
}

html[data-theme="dark"] .profile-status .toggle.replacetoggle.off {
    background: rgba(255, 255, 255, 0.22) !important;
}

html[data-theme="dark"] .profile-status .replacetoggle .toggle-handle {
    background: #ffffff !important;
}

/* A1 review of the lawyer out-of-office assignment dialog. */
html[data-theme] .out-of-office-modal .modal-dialog {
    margin-inline: auto;
    max-width: 720px;
    width: calc(100% - 32px);
}

html[data-theme] .out-of-office-modal .modal-content {
    background: var(--justis-surface-raised) !important;
    border: 1px solid var(--justis-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--justis-shadow) !important;
    color: var(--justis-text-primary) !important;
    overflow: visible;
}

html[data-theme] .out-of-office-modal :where(.modal-header, .modal-body, .modal-footer) {
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] .out-of-office-modal .modal-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--justis-border) !important;
    padding: 24px;
}

html[data-theme] .out-of-office-modal .modal-title {
    color: var(--justis-text-primary) !important;
    font-size: 24px;
    line-height: 1.3;
    margin: 0;
}

html[data-theme] .out-of-office-modal .modal-body {
    padding: 24px;
}

html[data-theme] .out-of-office-modal .modal-footer {
    border-top: 1px solid var(--justis-border) !important;
    padding: 16px 24px 24px;
}

html[data-theme] .out-of-office-modal :where(.form-label, .form-radio-label, .text-bold, .modal-text, .modal-text span) {
    color: var(--justis-text-primary) !important;
}

html[data-theme] .out-of-office-modal #replacement_end_date {
    background: var(--justis-surface-subtle) !important;
    border: 1px solid var(--justis-border-strong) !important;
    border-radius: 4px;
    color: var(--justis-text-primary) !important;
    min-height: 48px;
    padding: 10px 12px;
    width: 100%;
}

html[data-theme] .out-of-office-modal .form-radio-input {
    background-color: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
}

html[data-theme] .out-of-office-modal .form-radio-input:checked {
    background-color: var(--justis-action) !important;
    border-color: var(--justis-action) !important;
}

html[data-theme] .out-of-office-modal .submit-temp-lawyer:disabled {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-disabled) !important;
    opacity: 1;
}

html[data-theme] :where(.nav-tabs, .nav-tabs .nav-link) {
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme] :where(.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

/* Push prompts share one A1 surface across customer, lawyer and team-lead portals. */
html[data-theme] :is(#subscribeNotification, .justis-push-toast) {
    box-sizing: border-box;
    width: min(420px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px);
    padding: 20px !important;
    border: 1px solid var(--justis-border) !important;
    border-radius: var(--justis-control-radius);
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
    box-shadow: var(--justis-shadow);
    overflow-wrap: anywhere;
}
html[data-theme] #subscribeNotification {
    top: auto;
    left: auto;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}
html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) .modal-dialog {
    width: auto;
    max-width: 560px;
    margin: 24px auto;
    min-height: calc(100% - 48px);
}
html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) .modal-content {
    border: 1px solid var(--justis-border);
    border-radius: var(--justis-control-radius);
    box-shadow: var(--justis-shadow);
    overflow-wrap: anywhere;
}
html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) :is(.modal-header, .modal-body, .modal-footer) {
    padding: 20px !important;
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
}
html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) .modal-header {
    align-items: flex-start;
    gap: 12px;
    border-bottom: 0;
    padding-bottom: 0 !important;
}
html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) .modal-footer {
    border-top: 0;
    padding-top: 0 !important;
}
html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) :is(.modal-wrapper, .modal-text, .imageupload-instructions) {
    margin: 0;
    padding: 0;
    color: var(--justis-text-primary) !important;
}
html[data-theme] :is(#subscribeNotification h4, .justis-push-toast .notify-title, #switchNotificationDevice .modal-title, #ReceivePushModal .modal-title) {
    margin: 0;
    color: var(--justis-text-primary) !important;
    font-size: 20px !important;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
}
html[data-theme] :is(#subscribeNotification p, .justis-push-toast .notify-body, #switchNotificationDevice .modal-body, #ReceivePushModal .modal-body) {
    color: var(--justis-text-primary) !important;
    font-size: 16px;
    line-height: 1.5;
}
html[data-theme] #subscribeNotification p {
    margin: 8px 0 0;
}
html[data-theme] #subscribeNotification > .mb-18 {
    margin-bottom: 16px !important;
}
html[data-theme] :is(#subscribeNotification, #switchNotificationDevice .modal-footer) .row {
    width: 100%;
    margin: 0;
}
html[data-theme] :is(#subscribeNotification, #switchNotificationDevice .modal-footer) .row > div {
    padding: 0;
}
html[data-theme] :is(#subscribeNotification, #switchNotificationDevice, #ReceivePushModal) .btn {
    min-height: 44px;
    margin: 0;
    white-space: normal;
}
html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) .btn-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 10px;
    margin: -10px -10px -10px 0;
}
html[data-theme] .justis-push-toast .notify-title {
    padding: 0 40px 12px 0;
}
html[data-theme] .justis-push-toast .notify-title img {
    width: 24px;
    height: 24px;
}
html[data-theme] .justis-push-toast .close {
    position: absolute;
    top: 8px !important;
    right: 8px !important;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    filter: none;
    color: var(--justis-text-primary) !important;
    opacity: 1;
    z-index: 2;
}
html[data-theme] .justis-push-toast :is(a, button):focus-visible {
    outline: 3px solid var(--justis-focus);
    outline-offset: 2px;
}
@media (max-width: 575.98px) {
    html[data-theme] :is(#switchNotificationDevice, #ReceivePushModal) .modal-dialog {
        margin: 12px;
        min-height: calc(100% - 24px);
        max-width: none;
    }
    html[data-theme] :is(#subscribeNotification, #switchNotificationDevice, #ReceivePushModal) .btn {
        flex: 0 0 auto;
        width: 100%;
    }
    html[data-theme] :is(#subscribeNotification, #switchNotificationDevice) .row > div,
    html[data-theme] #ReceivePushModal .modal-footer {
        flex-direction: column-reverse;
        flex-wrap: nowrap !important;
        align-items: stretch;
        gap: 8px !important;
    }
}
@media (prefers-reduced-motion: reduce) {
    html[data-theme] .justis-push-toast {
        animation: none !important;
    }
}

html[data-theme] :where(.alert-info, .alert-primary) {
    background-color: var(--justis-info-bg) !important;
    border-color: var(--justis-info-text) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme] .alert-success {
    background-color: var(--justis-success-bg) !important;
    border-color: var(--justis-success-text) !important;
    color: var(--justis-success-text) !important;
}

html[data-theme] .alert-warning {
    background-color: var(--justis-warning-bg) !important;
    border-color: var(--justis-warning-text) !important;
    color: var(--justis-warning-text) !important;
}

html[data-theme] :where(.alert-danger, .alert-error, .invalid-feedback) {
    background-color: var(--justis-danger-bg) !important;
    border-color: var(--justis-danger-text) !important;
    color: var(--justis-danger-text) !important;
}

/* Message attachments and inline alert actions must follow the active palette. */
html[data-theme] .attached-files > a:not(.btn) {
    color: var(--justis-action) !important;
}

html[data-theme] .attached-files > a:not(.btn):is(:hover, :focus-visible) {
    color: var(--justis-action-hover) !important;
}

html[data-theme] .alert.alert-danger a:not(.btn) {
    color: var(--justis-danger-text) !important;
    font-weight: 700;
}

html[data-theme] .attached-files > a:not(.btn),
html[data-theme] .alert.alert-danger a:not(.btn) {
    text-decoration: underline !important;
    text-underline-offset: 0.16em;
}

html[data-theme] .attached-files > a:not(.btn):is(:hover, :focus-visible),
html[data-theme] .alert.alert-danger a:not(.btn):is(:hover, :focus-visible) {
    text-decoration-thickness: 2px !important;
}

html[data-theme] :where(.tiptap-editor-wrapper, .tiptap-editor-wrapper .editor-toolbar, .tiptap-editor-wrapper .editor-content, .tiptap-editor-wrapper .ProseMirror, .tiptap-editor-wrapper .color-palette, .tiptap-editor-wrapper .heading-dropdown) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .main-app,
    .main-content,
    .content-wrapper,
    .page-content,
    .container-content,
    .portal-wrapper,
    .dashboard-content,
    .legalcase-content
) {
    background-color: var(--justis-page-bg) !important;
    color: var(--justis-text-primary);
}

html[data-theme="dark"] :where(
    .navbar,
    .top-header,
    .bottom-header,
    .header-wrapper,
    .footer,
    .footer-top,
    .footer-bottom
) {
    background-color: var(--justis-chrome-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

/* Reserve CAP red for CAP chrome; partner brands use the neutral A1 dark chrome. */
html[data-theme="dark"] :where(
    nav.navbar[data-a1-brand="cap"] .top-header,
    nav.webcon-navbar[data-a1-brand="cap"]
) {
    background-color: var(--justis-cap-chrome-bg) !important;
    border-color: var(--justis-cap-chrome-border) !important;
}

html[data-theme="dark"] .container-pictograms-list {
    background: var(--justis-surface-subtle) !important;
    border-block: 1px solid var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .container-pictograms-list :where(h2, a, a span) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .container-pictograms-list :where(a:hover, a:focus, .active a),
html[data-theme="dark"] .container-pictograms-list :where(a:hover, a:focus, .active a) span {
    color: var(--justis-action-hover) !important;
}

html[data-theme="dark"] :where(
    .main-content-left .block-content,
    .angebot-content,
    .offer-faq-section,
    .faq-detail
) a:not(.btn) {
    color: var(--justis-action) !important;
    text-decoration: underline !important;
    text-decoration-thickness: 0.08em !important;
    text-underline-offset: 0.16em !important;
}

html[data-theme="dark"] :where(
    .navbar a,
    .navbar .nav-link,
    .top-header a,
    .bottom-header a,
    .footer a,
    .footer p,
    .footer li,
    .footer .block-title
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .navbar a:hover,
    .navbar a:focus,
    .navbar .nav-link.show,
    .navbar .nav-link[aria-expanded="true"],
    .footer a:hover,
    .footer a:focus
) {
    background-color: var(--justis-surface-emphasis) !important;
    color: var(--justis-action-hover) !important;
}

html[data-theme="dark"] .bottom-header .bottomheader-navleft > li > a.nav-link,
html[data-theme="dark"] .bottom-header .bottomheader-navleft > li > a.nav-link:hover,
html[data-theme="dark"] .bottom-header .bottomheader-navleft > li > a.nav-link:focus,
html[data-theme="dark"] .bottom-header .bottomheader-navleft > li > a.nav-link.show,
html[data-theme="dark"] .bottom-header .bottomheader-navleft > li > a.nav-link[aria-expanded="true"] {
    background-color: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link,
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link :where(.search-btn, i) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link,
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link:hover,
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link:focus,
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link.show,
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link[aria-expanded="true"],
html[data-theme="dark"] .mobile-menu .suche-lnk,
html[data-theme="dark"] .mobile-menu .suche-lnk:hover,
html[data-theme="dark"] .mobile-menu .suche-lnk:focus,
html[data-theme="dark"] .mobile-menu .suche-lnk.show,
html[data-theme="dark"] .mobile-menu .suche-lnk[aria-expanded="true"] {
    background-color: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link:hover,
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link:focus,
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link[aria-expanded="true"],
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link:hover :where(.search-btn, i),
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link:focus :where(.search-btn, i),
html[data-theme="dark"] .bottom-header .nav li.suche.header-search > a.nav-link[aria-expanded="true"] :where(.search-btn, i) {
    color: var(--justis-action-hover) !important;
}

html[data-theme="dark"] .header-search-panel {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .header-search-panel__field > .icon-Search {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .header-search-panel__input {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .header-search-panel__input::placeholder {
    color: var(--justis-text-secondary) !important;
    opacity: 1;
}

html[data-theme="dark"] .header-search-panel__input:focus {
    border-color: var(--justis-focus) !important;
}

html[data-theme="dark"] .native-search {
    --search-allianz-blue: var(--justis-text-primary) !important;
    --search-interactive-blue: var(--justis-action) !important;
    --search-light-blue: var(--justis-surface-emphasis) !important;
    --search-border: var(--justis-border) !important;
    --search-text: var(--justis-text-primary) !important;
    --search-muted: var(--justis-text-secondary) !important;
    background: var(--justis-page-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .native-search__hero {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] :where(
    .native-search__title,
    .native-search__intro,
    .native-search__status,
    .native-search__result p
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .native-search__form,
html[data-theme="dark"] .native-search__result {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    box-shadow: var(--justis-shadow) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .native-search__result {
    border-left-color: var(--justis-focus) !important;
}

html[data-theme="dark"] .native-search__result:hover {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-border-strong) !important;
}

html[data-theme="dark"] :where(.native-search__input, .native-search__select) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .native-search__input::placeholder,
html[data-theme="dark"] .native-search__filters label,
html[data-theme="dark"] .native-search__type {
    color: var(--justis-text-secondary) !important;
    opacity: 1;
}

html[data-theme="dark"] .native-search__select option {
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .native-search__result h2 a,
html[data-theme="dark"] .native-search__more {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] .native-search__result h2 a:hover,
html[data-theme="dark"] .native-search__result h2 a:focus {
    color: var(--justis-action-hover) !important;
}

html[data-theme="dark"] .native-search mark {
    background: var(--justis-pastel-yellow-bg) !important;
    color: var(--justis-pastel-yellow-text) !important;
}

html[data-theme="dark"] :where(.navbar-brand, .navbar-brand:hover, .navbar-brand:focus) {
    background-color: transparent !important;
}

html[data-theme="dark"] :where(
    .card,
    .card-header,
    .card-footer,
    .panel,
    .panel-heading,
    .panel-body,
    .well,
    .box,
    .box-header,
    .box-body,
    .list-group-item,
    .accordion-item,
    .accordion-button,
    .offcanvas,
    .toast,
    .modal-content,
    .modal-header,
    .modal-body,
    .modal-footer,
    .dropdown-menu,
    .popover
) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .card-header,
    .panel-heading,
    .box-header,
    .modal-header,
    .modal-footer,
    .accordion-button:not(.collapsed)
) {
    background-color: var(--justis-surface-emphasis) !important;
}

html[data-theme="dark"] :where(
    .dropdown-item,
    .dropdown-header,
    .popover-header,
    .popover-body,
    .modal-title,
    .card-title,
    .card-text,
    .list-group-item-action
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .dropdown-item:hover,
    .dropdown-item:focus,
    .dropdown-item.active,
    .list-group-item-action:hover,
    .list-group-item-action:focus
) {
    background-color: var(--justis-surface-raised-hover) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .modal-backdrop,
html[data-theme="dark"] .offcanvas-backdrop {
    background-color: #000;
}

html[data-theme="dark"] :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea,
    .form-control,
    .form-select,
    .input-group-text,
    .selectize-input,
    .selectize-dropdown,
    .bootstrap-select > .dropdown-toggle
) {
    background-color: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

/* The legacy text-input focus rule otherwise restores a white date filter. */
html[data-theme] #filter_by_date:focus {
    background-color: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] :where(input, textarea, .form-control)::placeholder {
    color: var(--justis-text-secondary) !important;
    opacity: 1;
}

html[data-theme] :where(.form-text, .text-muted) {
    color: var(--justis-text-secondary) !important;
    opacity: 1;
}

html[data-theme="dark"] .modal .text-gray {
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] :where(
    input:disabled,
    select:disabled,
    textarea:disabled,
    .form-control:disabled,
    .form-control[readonly]
) {
    background-color: #222f3c !important;
    color: var(--justis-text-disabled) !important;
}

html[data-theme="dark"] :where(.btn-primary, .btn-blue) {
    background-color: var(--justis-action) !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] :where(.btn-primary, .btn-blue):hover,
html[data-theme="dark"] :where(.btn-primary, .btn-blue):focus {
    background-color: var(--justis-action-hover) !important;
    border-color: var(--justis-action-hover) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] :where(.btn-secondary, .btn-outline-primary, .btn-white, .btn-default:not(.btn-primary):not(.btn-blue)) {
    background-image: none !important;
    background-color: transparent !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-action) !important;
}

html[data-theme="dark"] :where(.btn-secondary, .btn-outline-primary, .btn-white, .btn-default:not(.btn-primary):not(.btn-blue)):hover,
html[data-theme="dark"] :where(.btn-secondary, .btn-outline-primary, .btn-white, .btn-default:not(.btn-primary):not(.btn-blue)):focus {
    background-color: var(--justis-surface-raised-hover) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(table, .table, .dataTable) {
    --bs-table-bg: var(--justis-surface-raised);
    --bs-table-color: var(--justis-text-primary);
    --bs-table-striped-bg: var(--justis-surface-emphasis);
    --bs-table-striped-color: var(--justis-text-primary);
    --bs-table-hover-bg: var(--justis-surface-raised-hover);
    --bs-table-hover-color: var(--justis-text-primary);
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(table, .table, .dataTable) > :not(caption) > * > * {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.table thead, table thead, .dataTable thead),
html[data-theme="dark"] :where(.table thead, table thead, .dataTable thead) > tr > * {
    background-color: var(--justis-surface-emphasis) !important;
}

html[data-theme="dark"] :where(.table-striped, table.table-striped) > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--justis-surface-emphasis) !important;
}

html[data-theme="dark"] :where(.table-hover, table.table-hover) > tbody > tr:hover > * {
    background-color: var(--justis-surface-raised-hover) !important;
}

/* Preserve dossier status meaning, including striped and hovered rows. */
html[data-theme="dark"] tr.clickable-row.table-primary > td {
    background: var(--justis-info-bg) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] tr.clickable-row.table-warning > td {
    background: var(--justis-warning-bg) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] tr.clickable-row.table-danger > td {
    background: var(--justis-danger-bg) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] :where(
    .dataTables_wrapper,
    .dataTables_info,
    .dataTables_length,
    .dataTables_filter,
    .dataTables_paginate
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.page-link, .pagination > li > a, .pagination > li > span) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .navbar-toggler {
    border-color: transparent !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .navbar-toggler :where(i, span),
html[data-theme="dark"] .navbar-toggler :where(i, span)::before {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.page-item.active .page-link, .pagination > .active > a) {
    background-color: var(--justis-action) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] :where(.nav-tabs, .nav-tabs .nav-link) {
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] :where(.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.alert-info, .alert-primary) {
    background-color: var(--justis-info-bg) !important;
    border-color: var(--justis-info-text) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .alert-success {
    background-color: var(--justis-success-bg) !important;
    border-color: var(--justis-success-text) !important;
    color: var(--justis-success-text) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page span.bg-warning {
    background-color: var(--justis-warning-bg) !important;
    color: var(--justis-warning-text) !important;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

html[data-theme="dark"] .alert-warning {
    background-color: var(--justis-warning-bg) !important;
    border-color: var(--justis-warning-text) !important;
    color: var(--justis-warning-text) !important;
}

html[data-theme="dark"] :where(.alert-danger, .alert-error, .invalid-feedback) {
    background-color: var(--justis-danger-bg) !important;
    border-color: var(--justis-danger-text) !important;
    color: var(--justis-danger-text) !important;
}

html[data-theme="dark"] :where(.bg-white, .white-bg) {
    background-color: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.bg-light, .bg-grey, .bg-gray, .grey-bg, .gray-bg) {
    background-color: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .bg-lightgreen {
    background-color: var(--justis-editorial-green-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .bg-lightblue {
    background-color: var(--justis-editorial-blue-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .bg-lightpurple {
    background-color: var(--justis-pastel-purple-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .bg-fadedblue {
    background-color: var(--justis-editorial-blue-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.bg-lightgreen, .bg-lightblue, .bg-lightpurple, .bg-fadedblue) > .page-topbanner {
    background: transparent !important;
}

html[data-theme="dark"] :where(
    .ui-widget-content,
    .ui-datepicker,
    .ui-autocomplete,
    .datepicker,
    .datepicker-dropdown
) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .ui-state-default,
    .ui-widget-content .ui-state-default,
    .datepicker table tr td,
    .datepicker table tr th
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .ui-state-hover,
    .ui-state-active,
    .datepicker table tr td.active,
    .datepicker table tr td:hover
) {
    background: var(--justis-surface-raised-hover) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .tiptap-editor-wrapper,
    .tiptap-editor-wrapper .editor-toolbar,
    .tiptap-editor-wrapper .editor-content,
    .tiptap-editor-wrapper .ProseMirror,
    .tiptap-editor-wrapper .color-palette,
    .tiptap-editor-wrapper .heading-dropdown
) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .tiptap-editor-wrapper :where(button, .heading-option) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .tiptap-editor-wrapper :where(button:hover, button.is-active, .heading-option:hover) {
    background-color: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-border-strong) !important;
}

/* Tiptap mounts its link dialog beside the editor or directly under body. */
html[data-theme="dark"] :is(body > .dialog-overlay, .tiptap-editor-wrapper ~ .dialog-overlay) :is(.dialog, .dialog-header, .dialog-body, .dialog-footer) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(body > .dialog-overlay, .tiptap-editor-wrapper ~ .dialog-overlay) :is(h4, label, .dialog-close) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(body > .dialog-overlay, .tiptap-editor-wrapper ~ .dialog-overlay) .dialog-body input {
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
    border-color: var(--justis-border-strong) !important;
}

html[data-theme="dark"] :is(body > .dialog-overlay, .tiptap-editor-wrapper ~ .dialog-overlay) .dialog-body input:focus {
    border-color: var(--justis-action) !important;
}

html[data-theme="dark"] :is(body > .dialog-overlay, .tiptap-editor-wrapper ~ .dialog-overlay) .btn-secondary {
    background: transparent !important;
    color: var(--justis-action) !important;
    border-color: var(--justis-action) !important;
}

html[data-theme="dark"] :where(.tooltip-inner, .bootstrap-tooltip .tooltip-inner) {
    background-color: var(--justis-text-primary) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] :where(.close, .btn-close) {
    filter: invert(1) grayscale(1) brightness(2);
}

/* Public WebFront pages still use legacy surface and text utility classes. */
html[data-theme="dark"] :where(
    .container-white,
    .container-light-blue,
    .container-gray,
    .container-black,
    .block-white,
    .portrait-white-block,
    .faq-detail,
    .landingpage-topics,
    .homepage-product-comparison,
    .angebot-content,
    .offer-faq-section
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

/* Preserve the homepage's alternating full-width sections in dark mode. */
html[data-theme="dark"] #startpage-content .block-options.white-blocks,
html[data-theme="dark"] #startpage-content .block-category-cream,
html[data-theme="dark"] body.startpage .mobile-block-options.block-category-cream {
    background: var(--justis-pastel-gray-bg) !important;
}

html[data-theme="dark"] body.startpage .homepage-product-comparison,
html[data-theme="dark"] .product-comparison-section {
    background: var(--justis-pastel-aqua-bg) !important;
}

html[data-theme="dark"] body.startpage .homepage-product-comparison table.table-content.table-mobile,
html[data-theme="dark"] .product-comparison-section table.table-content.table-mobile {
    background: transparent !important;
}

html[data-theme="dark"] :where(h1, h2, h3, h4, h5, h6) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .portrait-white-block :where(p, span, strong, .icon-link a) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #startpage-content :where(
    .block-green-start,
    .block-category-cream,
    .block-green-content,
    .block-options.white-blocks
),
html[data-theme="dark"] .mobile-block-options.block-category-cream {
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #startpage-content :where(
    .block-options,
    .mobile-block-options
) :where(a, span, p, strong) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .block-green-content h1,
    .block-green-content h2,
    .block-green-content h3,
    .block-green-content a,
    .block-green-content span,
    .block-green-content .block-content,
    .block-green-content .block-content p,
    .main-content-left,
    .main-content-left .block-content,
    .main-content-left .block-content p,
    .landingpage-benefits,
    .landingpage-benefits li,
    .container-black-content,
    .container-black-content p,
    .angebot-content,
    .angebot-content p,
    .offer-faq-section,
    .offer-faq-section p
) {
    color: var(--justis-text-primary) !important;
}

/* Keep every legacy category tile on the same A1 pastel scale, independent of route. */
html[data-theme] :where(
    .cat-block-bg-0,
    .cat-block-bg-1,
    .cat-block-bg-2,
    .cat-block-bg-3,
    .cat-block-bg-4,
    .cat-block-bg-5,
    .cat-block-bg-6,
    .cat-block-bg-7,
    .cat-block-bg-8
) {
    background: var(--justis-tile-bg) !important;
    border: 0 !important;
    color: var(--justis-tile-text) !important;
}

html[data-theme] :where(
    .cat-block-bg-0,
    .cat-block-bg-1,
    .cat-block-bg-2,
    .cat-block-bg-3,
    .cat-block-bg-4,
    .cat-block-bg-5,
    .cat-block-bg-6,
    .cat-block-bg-7,
    .cat-block-bg-8
) :where(a, p, h2, h3, .block-title, .block-content, .text-red) {
    color: var(--justis-tile-text) !important;
}

html[data-theme] .cat-block-bg-0 { --justis-tile-bg: var(--justis-pastel-yellow-bg); --justis-tile-text: var(--justis-pastel-yellow-text); }
html[data-theme] .cat-block-bg-1 { --justis-tile-bg: var(--justis-pastel-orange-bg); --justis-tile-text: var(--justis-pastel-orange-text); }
html[data-theme] .cat-block-bg-2 { --justis-tile-bg: var(--justis-pastel-red-bg); --justis-tile-text: var(--justis-pastel-red-text); }
html[data-theme] .cat-block-bg-3 { --justis-tile-bg: var(--justis-pastel-purple-bg); --justis-tile-text: var(--justis-pastel-purple-text); }
html[data-theme] .cat-block-bg-4 { --justis-tile-bg: var(--justis-pastel-teal-bg); --justis-tile-text: var(--justis-pastel-teal-text); }
html[data-theme] .cat-block-bg-5 { --justis-tile-bg: var(--justis-pastel-aqua-bg); --justis-tile-text: var(--justis-pastel-aqua-text); }
html[data-theme] .cat-block-bg-6 { --justis-tile-bg: var(--justis-pastel-blue-bg); --justis-tile-text: var(--justis-pastel-blue-text); }
html[data-theme] .cat-block-bg-7 { --justis-tile-bg: var(--justis-pastel-green-bg); --justis-tile-text: var(--justis-pastel-green-text); }
html[data-theme] .cat-block-bg-8 { --justis-tile-bg: var(--justis-pastel-gray-bg); --justis-tile-text: var(--justis-pastel-gray-text); }

/* The legacy negative stack level hides the hero film behind the dark page canvas. */
html[data-theme] body.startpage .block-vid {
    z-index: 0;
}

html[data-theme="dark"] .landingpage-topics__list a {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .landingpage-topics__list a:hover,
html[data-theme="dark"] .landingpage-topics__list a:focus {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-border-strong) !important;
}

html[data-theme="dark"] :where(.homepage-product-comparison, .angebot-table, .table-content) :where(
    th,
    td,
    h2,
    h3,
    p,
    .text-gray,
    .table-header,
    .table-list,
    .table-bottom-text,
    .service-from
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.homepage-product-comparison, .angebot-table, .table-content) span:not(.btn *) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.homepage-product-comparison, .angebot-table, .table-content) *:not(.btn, .btn *) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(.homepage-product-comparison, .angebot-table, .table-content) :where(
    thead,
    tr,
    th,
    td,
    .col-white
) {
    background-color: transparent !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] :is(.homepage-product-comparison, .angebot-table, .product-comparison-section) .table-content th > div {
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] :where(.homepage-product-comparison, .angebot-table, .table-content) .text-red,
html[data-theme="dark"] :where(.homepage-product-comparison, .angebot-table, .table-content) .text-red * {
    color: var(--justis-danger-text) !important;
}

/* CMS comparison buttons share the global primary/secondary states on both pages. */
html[data-theme] .table-content .btn :where(i, span) {
    color: inherit !important;
}

html[data-theme="dark"] :where(
    .faq-detail,
    .faq-detail p,
    .faq-detail span,
    .faq-detail li,
    .faq-detail strong,
    .block-faq,
    .block-faq .accordion-body
) {
    background-color: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.faq-detail .back-lnk, .block-faq a) {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] #manualAccordion .accordion-body :where(
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p,
    div,
    span,
    li,
    strong,
    b,
    em,
    small,
    blockquote,
    table,
    th,
    td
) {
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #manualAccordion .accordion-body a {
    color: var(--justis-info-text) !important;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
}

/* CMS contact blocks contain nested spans and list markers with fixed legacy gray. */
html[data-theme="dark"] .block-contact :where(
    h1,
    h2,
    h3,
    h4,
    p,
    span,
    strong,
    li,
    i
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block-contact a:not(.btn) {
    color: var(--justis-info-text) !important;
    text-decoration-color: currentColor;
}

html[data-theme="dark"] .block-contact > .block-content {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .taglistkeyword > a {
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .justis-article-tip__label {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block-content a:not(.btn):not(.btn-primary):not(.nav-link) {
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .block-content a:not(.btn):not(.btn-primary):not(.nav-link) font {
    color: inherit !important;
}

/* Legacy Rechtstipp summaries mix a light CMS background with dark-mode text. */
html[data-theme="dark"] .justis-article-content .light-blue {
    background: var(--justis-info-bg) !important;
    border-left-color: var(--justis-info-text) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .justis-article-content .light-blue li {
    background: transparent !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] .justis-article-content .light-blue :where(p, li) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .justis-article-content .light-blue :where(h3, strong, b, .tick-blue) {
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .justis-article-content [style*="background-color: #f7f7f7"],
html[data-theme="dark"] .justis-article-content [style*="background-color:#f7f7f7"] {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .justis-article-byline__category,
html[data-theme="dark"] .justis-article-byline__category-name {
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .justis-article-byline__category .heading-icon {
    background: var(--justis-info-bg) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .justis-article-byline__category-separator,
html[data-theme="dark"] .justis-article-byline__date,
html[data-theme="dark"] .justis-article-byline__date::before {
    color: var(--justis-text-secondary) !important;
}

/* AVB answers are CMS HTML and contain fixed gray, green and red inline colors. */
html[data-theme="dark"] #avbAccordion .accordion-body :where(
    p,
    li,
    div,
    span,
    strong,
    b,
    em,
    small,
    blockquote
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #avbAccordion .accordion-body a {
    color: var(--justis-info-text) !important;
    text-decoration-color: currentColor;
}

html[data-theme="dark"] :where(#avbAccordion .accordion-body, .faq-detail) .marker {
    background: var(--justis-success-bg) !important;
    border-color: var(--justis-success-text) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(#avbAccordion .accordion-body, .faq-detail) .marker :where(strong, b, a, .marker-icon) {
    color: var(--justis-success-text) !important;
}

html[data-theme="dark"] :where(#avbAccordion .accordion-body, .faq-detail) .marker :where(p, span, strong, b, a, li) {
    background-color: transparent !important;
}

html[data-theme="dark"] :is(#avbAccordion .accordion-body, .faq-detail) :is(
    .text-red,
    .text-red *,
    .marker-red,
    .marker-red *,
    [style*="#c70000" i],
    [style*="#c70000" i] *,
    [style*="rgb(199, 0, 0)" i],
    [style*="rgb(199, 0, 0)" i] *,
    [style*="#c0392b" i],
    [style*="#c0392b" i] *,
    [style*="rgb(192, 57, 43)" i],
    [style*="rgb(192, 57, 43)" i] *
) {
    color: var(--justis-danger-text) !important;
}

/* Insurance checkout: map the A1-light funnel styles to the shared dark tokens. */
html[data-theme="dark"] .webcontract-checkout,
html[data-theme="dark"] .webcontract-checkout > section,
html[data-theme="dark"] .webcontract-checkout .container-rel,
html[data-theme="dark"] .webcontract-checkout .block-wizard {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .webcontract-checkout .block-wizard > .block-content {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .webcontract-checkout :where(.wizard-tabs, .checkout-account-gateway + #checkout-personal-details) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] .webcontract-checkout .wizard-steps {
    background: transparent !important;
}

html[data-theme="dark"] .webcontract-checkout .wizard-steps > li > a,
html[data-theme="dark"] .webcontract-checkout .wizard-steps > li > a :where(span, i) {
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .webcontract-checkout .wizard-steps > li.active {
    border-bottom-color: var(--justis-focus) !important;
}

html[data-theme="dark"] .webcontract-checkout .wizard-steps > li.active > a,
html[data-theme="dark"] .webcontract-checkout .wizard-steps > li.active > a :where(span, i) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .webcontract-checkout :where(
    .form-wizard .card,
    section.card,
    .checkout-account-option,
    .block-bordered.block-product
) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .webcontract-checkout :where(
    .form-wizard .card .card-header,
    section.card .card-header,
    .block-product .block-title,
    .accordion .panel-faq .accordion-header .accordion-button,
    .checkout-password-help
) {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .webcontract-checkout :where(
    .block-product .block-content,
    .block-select-info .block-content,
    .checkout-account-option.is-selected
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .webcontract-checkout :where(
    .block-product .block-content h3,
    .block-product .block-content p,
    .block-select-info .block-title,
    .block-select-info .block-content,
    .block-select-info .block-content p,
    .block-select-info .block-content span,
    .form-label,
    #address .form-label,
    .form-radio-label,
    .checkout-account-option,
    .checkout-account-option-title,
    .checkout-account-option-action,
    .checkout-summary-header .card-title,
    .checkout-summary-label,
    .checkout-summary-value,
    .question-answer .checkout-summary-label,
    .checkout-security-status,
    .required-info
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .webcontract-checkout :where(.text-blue, .text-blue *, .checkout-summary-edit) {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] .webcontract-checkout :where(
    .form-control,
    .form-select,
    .input-group-addon
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] .webcontract-checkout .form-radio-input + .form-radio-label::before {
    border: 1px solid var(--justis-control-border);
    background: transparent;
    box-sizing: border-box;
    width: 20px;
    height: 20px;
    min-width: 20px;
    padding: 0;
}

html[data-theme] .webcontract-checkout .form-radio-input:checked + .form-radio-label::before {
    border-color: var(--justis-action);
    background: radial-gradient(circle, var(--justis-action) 0 4px, transparent 4.5px);
}

html[data-theme] .webcontract-checkout .form-radio-input:focus-visible + .form-radio-label::before {
    outline: 3px solid var(--justis-focus);
    outline-offset: 2px;
}

html[data-theme] .webcontract-checkout .form-radio-input:disabled + .form-radio-label::before {
    border-color: var(--justis-border);
}

html[data-theme] .webcontract-checkout .form-radio-input:disabled:checked + .form-radio-label::before {
    border-color: var(--justis-button-disabled-bg);
    background: radial-gradient(circle, var(--justis-button-disabled-bg) 0 4px, transparent 4.5px);
}

html[data-theme] .webcontract-checkout .form-check-inline:has(.checkout-info-toggle) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

html[data-theme] .webcontract-checkout .checkout-info-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--justis-text-secondary);
    cursor: pointer;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 16px;
    height: 24px;
    justify-content: center;
    padding: 4px;
    width: 24px;
}

html[data-theme] .webcontract-checkout .checkout-info-toggle:hover,
html[data-theme] .webcontract-checkout .checkout-info-toggle[aria-expanded="true"] {
    color: var(--justis-action);
}

html[data-theme] .webcontract-checkout .checkout-info-toggle .icon-Info-Circle-O {
    font-size: 16px;
    line-height: 1;
}

html[data-theme] .checkout-info-popover {
    max-width: min(320px, calc(100vw - 32px));
}

html[data-theme] :is(.webcontract-checkout, .a1-profile-settings) :is(.form-control, .form-select) {
    background: var(--justis-control-bg) !important;
    border: 1px solid var(--justis-control-border) !important;
    border-radius: var(--justis-control-radius) !important;
    color: var(--justis-text-primary) !important;
    font-size: var(--justis-input-font-size);
    line-height: 24px;
    padding: 7px 12px;
}

html[data-theme] :is(.webcontract-checkout, .a1-profile-settings) :is(input.form-control, .form-select, .input-group-addon, .checkout-date-separator) {
    min-height: var(--justis-control-height);
}

html[data-theme] .webcontract-checkout .input-group > .form-control {
    border-radius: var(--justis-control-radius) 0 0 var(--justis-control-radius) !important;
}

html[data-theme] .webcontract-checkout .input-group-addon {
    background: var(--justis-control-bg) !important;
    border-color: var(--justis-control-border) !important;
    border-radius: 0 var(--justis-control-radius) var(--justis-control-radius) 0 !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] .webcontract-checkout .input-group .password-toggle {
    color: var(--justis-action);
    min-height: calc(var(--justis-control-height) - 2px);
    padding: 7px;
}

html[data-theme] :is(.webcontract-checkout, .a1-profile-settings) :is(.form-control, .form-select):focus,
html[data-theme] .webcontract-checkout .input-group:focus-within .input-group-addon {
    border-color: var(--justis-focus) !important;
    box-shadow: none;
}

html[data-theme] :is(.webcontract-checkout, .a1-profile-settings) :is(.form-control, .form-select)[readonly] {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme] :is(.webcontract-checkout, .a1-profile-settings) :is(.form-control, .form-select):disabled {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-disabled) !important;
}

html[data-theme] :is(.webcontract-checkout, .a1-profile-settings) .has-error :is(.form-control, .form-select, .input-group-addon),
html[data-theme] :is(.webcontract-checkout, .a1-profile-settings) :is(.form-control, .form-select).is-invalid {
    border-color: var(--justis-danger-text) !important;
    box-shadow: none;
}

html[data-theme] .webcontract-checkout .checkout-phone-country-code::after {
    border-color: var(--justis-text-secondary);
    border-width: 0 2px 2px 0;
    top: 50%;
    transform: translateY(-70%) rotate(45deg);
}

html[data-theme] .webcontract-checkout .checkout-phone-country-code .form-control {
    padding-right: 28px;
}

html[data-theme="dark"] .webcontract-checkout :where(
    .checkout-account-option:hover,
    .checkout-account-option:focus-visible
) {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-focus) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.page-topbanner, .page-heading) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.page-topbanner, .page-heading) h1 {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .page-topbanner .block.block-white:has(> .page-heading) {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .tips-page-topbanner .tips-page-label {
    color: var(--justis-text-primary) !important;
}

html[data-theme] .auth-card {
    background: var(--justis-surface-raised);
    border: 1px solid var(--justis-border);
    border-radius: var(--justis-control-radius);
    box-shadow: none;
    padding: 32px;
}
html[data-theme] .auth-dialog-card {
    animation: none;
    margin-inline: auto;
}
html[data-theme] .auth-dialog-card .modal-body {
    padding: 0;
}
html[data-theme] :is(#loginModal, #forgotModal) .modal-dialog {
    max-width: 480px;
}
html[data-theme] .auth-dialog-card > .btn-close {
    position: absolute;
    top: 12px;
    right: 12px;
}
html[data-theme] .auth-card .auth-icon {
    background: var(--justis-action);
    border-radius: var(--justis-control-radius);
    box-shadow: none;
    margin-bottom: 24px !important;
}
html[data-theme] .auth-card .auth-icon svg {
    color: var(--justis-on-action);
}
html[data-theme] .auth-card .auth-description {
    margin-bottom: 24px !important;
}
html[data-theme] .auth-card .auth-title {
    color: var(--justis-text-primary);
}
html[data-theme] .auth-card .auth-form-label,
html[data-theme] .webcontract-checkout .form-label {
    color: var(--justis-text-primary);
    font-size: 16px;
    line-height: 24px;
    margin-bottom: 8px;
}
html[data-theme] .auth-card .auth-form-group {
    margin-bottom: 24px;
}
html[data-theme] .webcontract-checkout .required {
    color: var(--justis-danger-text);
}
html[data-theme] .webcontract-checkout .checkout-date-fields {
    align-items: center;
}
html[data-theme] .webcontract-checkout .checkout-date-example {
    color: var(--justis-text-secondary) !important;
    font-size: 14px !important;
    line-height: 20px;
}
html[data-theme] .webcontract-checkout .btn.btn-primary:disabled {
    background: var(--justis-button-disabled-bg) !important;
    border-color: var(--justis-button-disabled-bg) !important;
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}
@media (max-width: 575.98px) {
    html[data-theme] .webcontract-checkout .checkout-date-fields {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.4fr);
        gap: 8px;
    }
    html[data-theme] .webcontract-checkout .checkout-date-fields > * {
        width: auto;
        min-width: 0;
        padding: 0 !important;
    }
    html[data-theme] .webcontract-checkout .checkout-date-fields input {
        padding-inline: 4px;
    }
    html[data-theme] .webcontract-checkout .checkout-date-fields > :is(.checkout-date-example, .help-block) {
        grid-column: 1 / -1;
    }
    html[data-theme] .auth-card {
        padding: 24px;
    }
}

html[data-theme] .auth-card .auth-form-input {
    background: var(--justis-control-bg) !important;
    border: 1px solid var(--justis-control-border) !important;
    border-radius: var(--justis-control-radius) !important;
    box-sizing: border-box;
    color: var(--justis-text-primary) !important;
    font-size: var(--justis-input-font-size);
    height: var(--justis-control-height) !important;
    line-height: 24px;
    min-height: var(--justis-control-height) !important;
    padding: 7px 12px !important;
}

html[data-theme] .auth-card .password-wrapper .auth-form-input {
    padding-right: 48px !important;
}

html[data-theme] .auth-card .password-toggle {
    background: transparent !important;
    border: 0 !important;
    border-radius: var(--justis-control-radius);
    color: var(--justis-action) !important;
    height: 32px;
    padding: 6px;
    right: 4px;
    width: 32px;
}

html[data-theme] .auth-card :where(.submit-btn, .social-login-btn) {
    border-radius: var(--justis-control-radius);
    box-shadow: none;
    box-sizing: border-box;
    font-family: "Allianz Neo", sans-serif;
    font-size: var(--justis-button-font-size);
    font-weight: var(--justis-button-font-weight);
    height: var(--justis-control-height);
    line-height: 20px;
    min-height: var(--justis-control-height);
    padding: 9px 19px;
    transform: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

html[data-theme] .auth-card .submit-btn {
    background: var(--justis-action) !important;
    border: 1px solid var(--justis-action) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme] .auth-card .submit-btn::before {
    display: none;
}

html[data-theme] .auth-card .submit-btn:hover,
html[data-theme] .auth-card .submit-btn:focus {
    background: var(--justis-action-hover) !important;
    border-color: var(--justis-action-hover) !important;
    box-shadow: none;
    color: var(--justis-on-action) !important;
    transform: none;
}

html[data-theme] .auth-card .submit-btn:disabled {
    background: var(--justis-button-disabled-bg) !important;
    border-color: var(--justis-button-disabled-bg) !important;
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}

html[data-theme] .auth-card .social-login-btn {
    background: transparent !important;
    border: 1px solid var(--justis-action) !important;
    color: var(--justis-action) !important;
}

html[data-theme] .auth-card .social-login-btn:hover,
html[data-theme] .auth-card .social-login-btn:focus {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-action-hover) !important;
    color: var(--justis-text-primary) !important;
    transform: none;
}

html[data-theme] .auth-card :where(.auth-description, .auth-divider span, .auth-card-footer, .auth-card-footer p) {
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] section:has(.auth-card) {
    background: var(--justis-page-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.auth-card, .auth-divider span) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.forgot-password-link a, .auth-back-link) {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] .register-section {
    background: var(--justis-page-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .register-text-block,
html[data-theme="dark"] .register-text-block :where(h2, h3, h4, p, li),
html[data-theme="dark"] .register-testimonial :where(.testimonial-name, .testimonial-designation, .testimonial-quote) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .register-testimonial {
    background: var(--justis-surface-raised) !important;
    border: 1px solid var(--justis-border) !important;
    box-shadow: var(--justis-shadow) !important;
}

html[data-theme="dark"] .auth-card-register .submit-btn:disabled {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border-strong) !important;
    box-shadow: none !important;
    color: var(--justis-text-secondary) !important;
    opacity: 1;
}

html[data-theme="dark"] body.startpage .container-black-content a:not(.btn) {
    border-color: var(--justis-action) !important;
    color: var(--justis-action) !important;
}

html[data-theme="dark"] body.startpage table.table-content.table-mobile {
    background: var(--justis-page-bg) !important;
}

html[data-theme="dark"] :where(
    .auth-title,
    .auth-form-label,
    .auth-card-heading
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.auth-form-input, .social-login-btn, .password-toggle) {
    background-color: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .auth-card input.auth-form-input:focus,
html[data-theme="dark"] .auth-card input.auth-form-input:focus-visible,
html[data-theme="dark"] .auth-card input.auth-form-input:active {
    background-color: var(--justis-surface-subtle) !important;
    border-color: var(--justis-focus) !important;
    caret-color: var(--justis-text-primary) !important;
    color: var(--justis-text-primary) !important;
    -webkit-text-fill-color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .auth-card :where(
    .code-input,
    input.code-input,
    input[type="text"].code-input
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
    -webkit-text-fill-color: var(--justis-text-primary) !important;
}

/* Native selects need consistent colors, including their OS-rendered selection. */
html[data-theme] .auth-card :is(select.auth-form-input, select#contact_type) {
    background: var(--justis-control-bg) !important;
    color: var(--justis-text-primary) !important;
    -webkit-text-fill-color: currentColor !important;
}

html[data-theme] .auth-card :is(select.auth-form-input, select#contact_type) option {
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
    -webkit-text-fill-color: currentColor !important;
}

html[data-theme] .auth-card :is(select.auth-form-input, select#contact_type) option:is(:checked, :hover, :focus) {
    background: Highlight !important;
    color: HighlightText !important;
}

html[data-theme="dark"] .auth-card .code-input.filled,
html[data-theme="dark"] .auth-card input.code-input.filled,
html[data-theme="dark"] .auth-card input[type="text"].code-input.filled {
    background: var(--justis-filled-bg) !important;
    border-color: var(--justis-filled-border) !important;
    color: var(--justis-filled-text) !important;
    -webkit-text-fill-color: var(--justis-filled-text) !important;
}

html[data-theme="dark"] .auth-card .code-input.error,
html[data-theme="dark"] .auth-card input.code-input.error,
html[data-theme="dark"] .auth-card input[type="text"].code-input.error {
    background: var(--justis-danger-bg) !important;
    border-color: var(--justis-danger-text) !important;
    color: var(--justis-danger-text) !important;
    -webkit-text-fill-color: var(--justis-danger-text) !important;
}

html[data-theme="dark"] :where(
    .trust-option,
    .profile-secret-key,
    .auth-card blockquote
) {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .trust-text,
    .trust-text strong,
    .profile-secret-key span,
    .code-input-label
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .trust-checkbox .checkmark {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
}

html[data-theme="dark"] .trust-checkbox input:checked + .checkmark {
    background: var(--justis-focus) !important;
    border-color: var(--justis-focus) !important;
}

html[data-theme="dark"] .trust-checkbox input:checked + .checkmark::after {
    border-color: #ffffff !important;
}

html[data-theme="dark"] .profile-status,
html[data-theme="dark"] .profile-status .profile-title {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .portal-dashboard .block-white > .block-content,
    .portal-dashboard .white-blocks .block:not([class*="cat-block-bg-"]),
    .portal .white-blocks .block:not([class*="cat-block-bg-"]),
    .container-white .client-portal-block
) {
    background: var(--justis-surface-raised) !important;
    border: 1px solid var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .portal-dashboard .white-blocks .block:not([class*="cat-block-bg-"]),
    .portal .white-blocks .block:not([class*="cat-block-bg-"]),
    .container-white .client-portal-block
) :where(.block-title, .block-title p, .block-content, .block-content p, .portal-title, .portal-title p, .portal-content) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(
    .portal-dashboard .news-list,
    .portal .news-list,
    .client-portal-block .news-list
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

/* Replace legacy white message separators and unread fills on every portal sibling. */
html[data-theme] :where(.portal-dashboard, .portal, .client-portal-block) .news-list .row {
    border-bottom-color: var(--justis-border) !important;
}

html[data-theme] :where(.portal-dashboard, .portal, .client-portal-block) .news-list .unread {
    background: var(--justis-surface-emphasis) !important;
    color: var(--justis-text-primary) !important;
}

/* Staff profiles and customer portal cards share this compact action pattern. */
html[data-theme] .client-portal-block .btn.btn-sm {
    align-items: center;
    border-radius: var(--justis-control-radius) !important;
    display: inline-flex;
    font-size: var(--justis-button-font-size) !important;
    font-weight: var(--justis-button-font-weight) !important;
    gap: 8px;
    height: auto;
    justify-content: center;
    line-height: 1.2;
    min-height: var(--justis-control-height);
    padding: 8px 16px !important;
}

html[data-theme] .client-portal-block .portal-footer-next {
    align-items: stretch;
    gap: 8px;
}

html[data-theme] .client-portal-block .btn.btn-sm:is(.disabled, [disabled], [aria-disabled="true"]) {
    background: var(--justis-button-disabled-bg) !important;
    border-color: var(--justis-button-disabled-bg) !important;
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}

html[data-theme="dark"] .client-portal-block a:not(.btn),
html[data-theme="dark"] .client-portal-block a:not(.btn) :where(span, strong) {
    color: var(--justis-action) !important;
}

html[data-theme] .client-portal-block .news-list .row.bg-lc-warning {
    background: var(--justis-warning-bg) !important;
    color: var(--justis-warning-text) !important;
}

html[data-theme] .client-portal-block .news-list .row.bg-lc-warning > :where(div, span) {
    color: var(--justis-warning-text) !important;
}

html[data-theme] .client-portal-block .portal-footer-next .badge[style*="#c70000" i] {
    background: var(--justis-danger-bg) !important;
    border-color: var(--justis-danger-text) !important;
    color: var(--justis-danger-text) !important;
}

html[data-theme] .client-portal-block .portal-footer-next .badge[style*="#00008B" i] {
    background: var(--justis-info-bg) !important;
    border-color: var(--justis-info-text) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .portal-dashboard .nav-tabs .nav-link {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .portal-dashboard .nav-tabs .nav-link:hover,
html[data-theme="dark"] .portal-dashboard .nav-tabs .nav-link:focus,
html[data-theme="dark"] .portal-dashboard .nav-tabs .nav-link.active {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.portal-dashboard, .container-white) .profile-title {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.portal-dashboard, .container-white) :where(a, button).btn-primary {
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] .portal-dashboard .block-content a:not(.btn):not(.btn-primary):not(.nav-link),
html[data-theme="dark"] .portal-dashboard .block-content a:not(.btn):not(.btn-primary):not(.nav-link) :where(span, strong) {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] .portal-list .mail-box :where(.sm-side, .lg-side) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .portal-list > .white-blocks {
    background: var(--justis-surface-raised) !important;
}

html[data-theme="dark"] .portal-list .back-lnk {
    color: var(--justis-action) !important;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
}

html[data-theme="dark"] .portal-list .mail-box :where(.inbox-head, .mail-option, .chk-all) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .portal-list .mail-box :where(
    .inbox-head,
    .inbox-head label,
    .mail-option,
    .mail-option a,
    .mail-option button
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .portal-list .mail-box .inbox-nav li a {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .portal-list .mail-box .inbox-nav li a:hover,
html[data-theme="dark"] .portal-list .mail-box .inbox-nav li a:focus,
html[data-theme="dark"] .portal-list .mail-box .inbox-nav li.active a {
    background: var(--justis-info-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .portal-list .mail-box :where(.btn.mini, .btn-nocaps) {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.auth-divider::before, .auth-divider::after) {
    background-color: var(--justis-border) !important;
}

html[data-theme="dark"] hr {
    border-color: var(--justis-border) !important;
    opacity: 1;
}

html[data-theme="dark"] .error-wrapper :where(p, p span) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .error-wrapper a {
    color: var(--justis-action) !important;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
}

html[data-theme="dark"] :where(.justis-product-description, footer .text-blue) {
    color: var(--justis-text-secondary) !important;
}

/* The JUSTIS/CAP brand lockup is monochrome white on dark header and footer surfaces. */
html[data-theme="dark"] :is(.header, .webcon-navbar, footer) :where(.justis-product-name, .justis-product-description) {
    color: #ffffff !important;
}

html[data-theme="dark"] :is(.header, .webcon-navbar, footer) :is(
    img.justis-product-owner-logo,
    img[src*="/JUSTIS_by_CAP_Logo.svg"],
    img[src*="/CAP_logo.svg"],
    img[src*="/cap_logo_new.svg"]
) {
    filter: brightness(0) invert(1);
}

/* The manual-payment artwork has black strokes on a transparent canvas. */
html[data-theme="dark"] img:is([src$="/DEF.svg"], [src*="/DEF.svg?"]) {
    background-color: #ffffff;
    border-radius: 2px;
}

/* Invoice actions have a late, local light palette in the detail template. */
html[data-theme="dark"] .invoice-action-panel {
    background: var(--justis-surface-subtle);
    border-color: var(--justis-border);
    color: var(--justis-text-primary);
}

html[data-theme="dark"] .invoice-action-panel :is(h3, p) {
    color: var(--justis-text-primary);
}

html[data-theme="dark"] .invoice-action-panel .invoice-action-muted {
    color: var(--justis-text-secondary);
}

html[data-theme="dark"] .public-payment-link-group .form-control[readonly] {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(.invoice-action-button, .public-payment-copy-button) {
    background: var(--justis-action);
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] :is(.invoice-action-button, .public-payment-copy-button):is(:hover, :focus) {
    background: var(--justis-action-hover);
}

html[data-theme="dark"] .invoice-action-button.disabled {
    background: var(--justis-button-disabled-bg);
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}

html[data-theme="dark"] .invoice-action-panel .invoice-tertiary-link {
    color: var(--justis-action);
}

html[data-theme="dark"] .invoice-action-panel .invoice-tertiary-link:is(:hover, :focus) {
    color: var(--justis-action-hover);
}

/* A1-style loading state for the shared AJAX overlay and legacy image loaders. */
html[data-theme] .justis-a1-loading-overlay,
html[data-theme] .custom-overlay {
    background: color-mix(in srgb, var(--justis-page-bg) 86%, transparent) !important;
    color: var(--justis-action);
}

html[data-theme] .custom-overlay {
    opacity: 1;
    filter: none;
}

html[data-theme] .custom-overlay > img.justis-a1-legacy-spinner {
    position: absolute;
    top: calc(50% - 16px);
    left: calc(50% - 16px);
    margin: 0;
}

html[data-theme] .justis-a1-loading-spinner {
    color: var(--justis-action);
}

html[data-theme] .justis-a1-loading-spinner .justis-a1-spinner-track {
    stroke: var(--justis-border);
}

html[data-theme] .justis-a1-loading-spinner .justis-a1-spinner-active {
    stroke: currentColor;
}

html[data-theme] img.justis-a1-legacy-spinner {
    background: conic-gradient(transparent 0 22%, var(--justis-action) 22% 100%) border-box !important;
    border: 4px solid transparent !important;
    border-radius: 50% !important;
    box-sizing: border-box !important;
    height: 32px !important;
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0) !important;
    object-position: -9999px -9999px !important;
    width: 32px !important;
    animation: justis-a1-spinner-rotate 900ms linear infinite !important;
}

@keyframes justis-a1-spinner-rotate {
    to { transform: rotate(360deg); }
}

/* Cover both DataTables generations without changing their show/hide lifecycle. */
html[data-theme] :is(.dataTables_processing, .dt-processing) {
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
    border: 1px solid var(--justis-border) !important;
    border-radius: 4px;
    padding: 16px !important;
    height: auto !important;
    box-shadow: var(--justis-shadow) !important;
}
html[data-theme] .dt-processing > div:last-child {
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    border: 3px solid var(--justis-border);
    border-top-color: var(--justis-action);
    border-radius: 50%;
    animation: justis-a1-spinner-rotate 900ms linear infinite;
}
html[data-theme] .dt-processing > div:last-child > div,
html[data-theme] .dt-processing:has(img) > div:last-child {
    display: none;
}
@media (prefers-reduced-motion: reduce) {
    html[data-theme] .dt-processing > div:last-child { animation: none; }
}

/* Grouping dialogs also render outside the v2 dossier page wrapper. */
html[data-theme="dark"] .document-grouping-modal :is(.grouping-panel, .connectedSortable) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}
html[data-theme="dark"] .document-grouping-modal .grouping-panel-header,
html[data-theme="dark"] .document-grouping-modal .connectedSortable li {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}
html[data-theme="dark"] .document-grouping-modal .grouping-panel-target .grouping-panel-header {
    background: var(--justis-editorial-green-bg) !important;
}
html[data-theme="dark"] .document-grouping-modal :is(.grouping-intro, .connectedSortable li p, .connectedSortable li span, .connectedSortable li a) {
    color: var(--justis-text-primary) !important;
}
html[data-theme="dark"] .document-grouping-modal .connectedSortable:empty::before {
    color: var(--justis-text-secondary) !important;
}
html[data-theme="dark"] .document-grouping-modal .modal-footer .btn:disabled {
    background: var(--justis-button-disabled-bg) !important;
    border-color: var(--justis-button-disabled-bg) !important;
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}

/* Staff feedback list and modal retain the same surface hierarchy in dark mode. */
html[data-theme="dark"] :where(.feedback-console, .feedback-console-hero, .feedback-console-body, #feedbacks_wrapper) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .container-white .block-white > .block-content:has(.feedback-console) {
    background: var(--justis-page-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .feedback-console :where(
    .feedback-console-copy,
    .feedback-summary-text,
    .feedback-detail-text,
    .feedback-detail-richtext,
    .dt-info,
    .dt-length,
    .dt-search,
    label
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #feedbacks :where(thead th, tbody td, tbody tr.child td, tbody tr.feedback-detail-child td),
html[data-theme="dark"] :where(.feedback-detail, .feedback-detail-toggle) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .feedback-console :where(a, .feedback-detail-toggle, .dt-paging-button:not(.disabled)) {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] :where(.feedback-console-icon, .feedback-category-pill) {
    background: var(--justis-info-bg) !important;
    border-color: var(--justis-info-text) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] :where(.feedback-console-kicker, .feedback-status.answered) {
    background: var(--justis-success-bg) !important;
    color: var(--justis-success-text) !important;
}

html[data-theme="dark"] .feedback-status.open {
    background: var(--justis-warning-bg) !important;
    color: var(--justis-warning-text) !important;
}

html[data-theme="dark"] #stickyFeedbackModal :where(
    .modal-content,
    .modal-header,
    .modal-body,
    .modal-text,
    .modal-footer,
    .feedback-tiptap-editor .tiptap-editor-wrapper,
    .feedback-tiptap-editor .editor-toolbar,
    .feedback-tiptap-editor .tiptap-editor-container,
    .feedback-tiptap-editor .tiptap,
    .feedback-upload-row
) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #stickyFeedbackModal :where(
    .modal-title,
    .feedback-intro,
    .feedback-label,
    .feedback-upload-row,
    .feedback-upload-row span,
    .feedback-footer-actions
) {
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #stickyFeedbackModal :where(.feedback-hero-icon, .feedback-upload-row .btn-icon) {
    background: var(--justis-info-bg) !important;
    border-color: var(--justis-info-text) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] #stickyFeedbackModal .feedback-kicker {
    background: var(--justis-success-bg) !important;
    color: var(--justis-success-text) !important;
}

/* Shared portal header search: compact A1 controls, including legacy focus states. */
html[data-theme] #searchdata .suchen-update-wrapper {
    row-gap: 24px;
}

html[data-theme] #searchdata .suchen-header {
    padding: 0 0 12px;
    margin-bottom: 20px !important;
    font-size: 24px;
    line-height: 1.25;
    border-bottom: 1px solid var(--justis-border);
}

html[data-theme] #searchdata .col-form-label {
    font-size: 16px;
    line-height: 24px;
}

html[data-theme] #searchdata :is(.form-control, .form-select) {
    min-height: var(--justis-control-height);
    padding: 8px 12px;
    border: 1px solid var(--justis-border-strong) !important;
    border-radius: var(--justis-control-radius) !important;
    background-color: var(--justis-control-bg) !important;
    color: var(--justis-text-primary) !important;
    caret-color: var(--justis-text-primary);
    font-size: var(--justis-input-font-size);
    line-height: 1.4;
}

html[data-theme] #searchdata :is(.form-control, .form-select):focus {
    background-color: var(--justis-control-bg) !important;
    color: var(--justis-text-primary) !important;
    border-color: var(--justis-focus) !important;
    outline: 2px solid var(--justis-focus) !important;
    outline-offset: 2px;
    box-shadow: none !important;
}

html[data-theme] #searchdata .form-checkbox-label::before {
    background-color: var(--justis-control-bg) !important;
    border: 1px solid var(--justis-border-strong) !important;
    color: transparent;
}

html[data-theme] #searchdata .form-checkbox-input:checked + .form-checkbox-label::before {
    background-color: #003781 !important;
    border-color: var(--justis-focus) !important;
    color: #ffffff;
}

html[data-theme] #searchdata .form-checkbox-input:focus-visible + .form-checkbox-label::before {
    outline: 2px solid var(--justis-focus);
    outline-offset: 2px;
}

html[data-theme] #searchdata .btn-primary {
    min-height: var(--justis-control-height);
    padding: 8px 20px;
    margin-bottom: 4px;
    border-radius: var(--justis-control-radius);
    background: #003781 !important;
    border-color: #003781 !important;
    color: #ffffff !important;
    font-size: var(--justis-button-font-size);
    font-weight: var(--justis-button-font-weight);
    letter-spacing: normal;
}

html[data-theme] #searchdata .btn-primary:is(:hover, :focus) {
    background: #00266d !important;
    border-color: var(--justis-focus) !important;
}

html[data-theme] #searchdata .btn-primary i {
    color: inherit !important;
}

html[data-theme] #searchdata .block-content .badge {
    display: inline-block;
    padding: 6px 10px;
    margin-bottom: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

/* Large staff search dropdown. */
html[data-theme="dark"] #searchdata,
html[data-theme="dark"] #searchdata :where(.container, .suchen-update-wrapper, .suchen-update, form) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #searchdata :where(
    .suchen-header,
    .col-form-label,
    .form-check-label,
    .block-title,
    .block-content,
    p,
    i
) {
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #searchdata .block-content :where(span, a) {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #searchdata .block-content :where(span, a):hover,
html[data-theme="dark"] #searchdata .block-content :where(span, a):focus {
    background: var(--justis-surface-raised-hover) !important;
    color: var(--justis-action) !important;
}

/* Direct legacy white panels occur in public document pages and portal overviews. */
/* Nested payment content uses the surrounding card surface in dark mode. */
html[data-theme="dark"] .block.block-white > .block-content .form-wizard .card > .block > .block-content {
    background-color: transparent !important;
}

html[data-theme="dark"] .block.block-white > .block-content {
    background: var(--justis-surface-raised) !important;
    border: 0 !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block.block-white > .block-content :where(
    h1,
    h2,
    h3,
    p,
    label,
    .list-overview-action,
    .list-group-item
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block.block-white > .block-content a:not(.btn):not(.btn-primary):not(.nav-link) {
    color: var(--justis-action) !important;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
}

html[data-theme="dark"] :where(.block-title, .block-content) a:not(.btn):not(.btn-primary):not(.nav-link),
html[data-theme="dark"] :where(.block-title, .block-content) a:not(.btn):not(.btn-primary):not(.nav-link) :where(font, span, strong) {
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .block.block-white > .block-content .nav-tabs .nav-link {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .block.block-white > .block-content .nav-tabs .nav-link:hover,
html[data-theme="dark"] .block.block-white > .block-content .nav-tabs .nav-link:focus,
html[data-theme="dark"] .block.block-white > .block-content .nav-tabs .nav-link.active {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

/* Share label space and align controls, including wrapped translations. */
html[data-theme] .list-group-horizontal:has(#filter_by_mode) {
    display: grid;
    grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

html[data-theme] .list-group-horizontal:has(#filter_by_mode) > .list-group-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 68px;
    min-width: 0;
    padding: 0 !important;
}

html[data-theme] .list-group-horizontal:has(#filter_by_mode) > .list-group-item > span {
    width: 100%;
}

html[data-theme] .list-group-horizontal:has(#filter_by_mode) > .list-group-item > span:has(select, input) {
    margin-top: auto;
}

html[data-theme] .list-group-horizontal:has(#filter_by_mode) :is(select, input) {
    width: 100%;
    min-width: 0;
}

@media (max-width: 991.98px) {
    html[data-theme] .list-group-horizontal:has(#filter_by_mode) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

html[data-theme] body :is(.block-content, .container) .nav.nav-tabs.responsive {
    border: 0;
    border-bottom: 1px solid var(--justis-border) !important;
    gap: 4px;
    margin-bottom: 20px;
}

html[data-theme] body :is(.block-content, .container) .nav.nav-tabs.responsive .nav-item {
    margin: 0 !important;
}

html[data-theme] body :is(.block-content, .container) .nav.nav-tabs.responsive .nav-link {
    align-items: center;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0;
    color: var(--justis-text-secondary) !important;
    display: flex;
    font-weight: 600;
    margin: 0 0 -1px;
    min-height: 48px;
    padding: 12px 16px;
    text-decoration: none;
}

html[data-theme] body :is(.block-content, .container) .nav.nav-tabs.responsive .nav-link:hover,
html[data-theme] body :is(.block-content, .container) .nav.nav-tabs.responsive .nav-link:focus-visible {
    background: var(--justis-surface-raised-hover) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] body :is(.block-content, .container) .nav.nav-tabs.responsive .nav-link.active {
    background: var(--justis-surface-subtle) !important;
    border-bottom-color: var(--justis-action) !important;
    color: var(--justis-action) !important;
}

html[data-theme] body :is(.block-content, .container) .nav.nav-tabs.responsive > li:has(select) {
    margin-inline-start: auto;
    padding: 0 0 8px 16px;
    align-self: center;
}

/* Server-selected profile variants must also work after resizing the window. */
/* Summary sections have the same action regardless of their legacy HTML tag. */
html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout #messagesinfo .documentTags .badge[style*="#f5f5f5" i] {
    background-color: var(--justis-pastel-gray-bg) !important;
    color: var(--justis-pastel-gray-text) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #summary_info .accordion-header > .accordion-button {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout #summary_info :is(.accordion-button, .accordion-body, .accordion-item) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout #summary_info .accordion-button:not(.collapsed) {
    background: var(--justis-surface-emphasis) !important;
}

html[data-theme="dark"] .customer-legalcase-summary-layout #summary_info .accordion-body :is(.row, [class*="col-"], .text-bold) {
    color: var(--justis-text-primary) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout :is(.summary-header-arrow, .header-arrow) {
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme] .a1-profile-settings .form-wizard {
    color: var(--justis-text-primary);
}

html[data-theme] .a1-profile-settings .msg {
    color: var(--justis-text-secondary) !important;
    font-size: 0.875rem !important;
    line-height: 1.5;
}

html[data-theme="dark"] :is(.a1-profile-settings.desktop-view, .a1-profile-settings .desktop-view) .tab-content {
    border-color: var(--justis-border);
}

html[data-theme] .a1-profile-settings .icon-Info-Circle-O {
    color: var(--justis-action) !important;
}

html[data-theme] .a1-profile-settings .text-gray,
html[data-theme] #messageModal .status-content .msg {
    color: var(--justis-text-secondary) !important;
}

html[data-theme] #messageModal .status-content .msg {
    font-size: 0.875rem;
    line-height: 1.5;
}

html[data-theme="dark"] .a1-profile-settings .editprofile-nav .nav-link {
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-secondary) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] .a1-profile-settings .editprofile-nav .nav-link:is(.active, :hover, :focus-visible) {
    background: var(--justis-surface-emphasis) !important;
    color: var(--justis-text-primary) !important;
}

@media (max-width: 575.98px) {
    .a1-profile-settings .nav-pills {
        flex-direction: column;
    }

    .a1-profile-settings .nav-pills .nav-item {
        width: 100%;
    }

    .a1-profile-settings .row:has(> div > #dob_day) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.4fr);
        align-items: center;
        gap: 0.5rem;
        margin: 0;
    }

    .a1-profile-settings .row:has(> div > #dob_day) > div {
        width: auto;
        min-width: 0;
        padding: 0;
    }

    .a1-profile-settings .row:has(> div > #dob_day) > :is(.example, .help-block) {
        grid-column: 1 / -1;
    }

    .a1-profile-settings .form-actions {
        row-gap: 0.75rem;
    }

    #message-list,
    #message-list tbody {
        display: block;
        width: 100%;
    }

    #message-list tr {
        display: grid;
        grid-template-columns: 2rem minmax(0, 1fr) auto;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        border: 1px solid var(--justis-border);
    }

    #message-list tr > td {
        display: block;
        width: auto !important;
        min-width: 0;
        padding: 0.25rem;
        border: 0;
        overflow-wrap: anywhere;
    }

    #message-list tr > td:nth-child(1) { grid-area: 1 / 1; }
    #message-list tr > td:nth-child(2) { grid-area: 1 / 2; }
    #message-list tr > td:nth-child(3) { grid-area: 2 / 2 / auto / 4; }
    #message-list tr > td:nth-child(4) { grid-area: 2 / 1; }
    #message-list tr > td:nth-child(5) { grid-area: 1 / 3; }
    #message-list tr > td:nth-child(6) {
        grid-area: 3 / 2 / auto / 4;
        text-align: left !important;
        color: var(--justis-text-secondary);
    }

    #message-list tr > td[colspan] {
        grid-column: 1 / -1;
    }
}

html[data-theme="dark"] .block.block-white > .block-content #profile_tab .nav-link {
    background: var(--justis-surface-subtle) !important;
    border-color: transparent !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .block.block-white > .block-content #profile_tab .nav-link:hover,
html[data-theme="dark"] .block.block-white > .block-content #profile_tab .nav-link:focus,
html[data-theme="dark"] .block.block-white > .block-content #profile_tab .nav-link.active {
    background: var(--justis-surface-emphasis) !important;
    border-color: transparent !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block.block-white > .block-content :where(.form-radio-input, .form-checkbox-input) {
    background-color: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
}

/* Keep preferences aligned throughout login, role selection, 2FA and the portal. */
@media (min-width: 768px) {
    html[data-theme] .top-header .topheader-navright {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }

    html[data-theme] .topheader-navright > .site-language-switcher > .nav-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        height: 44px;
        margin: 0;
        padding: 8px;
        line-height: 1;
    }

    html[data-theme] .topheader-navright > .a1-theme-switcher-slot--header {
        padding: 0;
        margin-left: 15px;
        align-self: center;
    }
}

/* Keep the desktop dossier search beside language, theme and account controls. */
@media (min-width: 768px) {
    html[data-theme] .dossier-navigation > #navbar {
        display: none !important;
    }

    html[data-theme] .dossier-navigation .topheader-navright {
        display: flex;
        position: static;
        align-items: center;
        flex-wrap: nowrap;
    }

    html[data-theme] .dossier-navigation-search > .nav-link {
        white-space: nowrap;
    }

    html[data-theme] .dossier-navigation .dossier-navigation-search {
        position: static;
    }

    html[data-theme] .dossier-navigation-search > #searchdata {
        inset: 100% 0 auto !important;
        width: 100%;
        margin: 0;
        transform: none !important;
        max-height: calc(100dvh - 100px);
        overflow-y: auto;
    }
}

/* Legacy toolbar icons otherwise retain their fixed dark foreground. */
html[data-theme="dark"] #accordionReminderBody :is(.icon-Trash-O, .icon-Refresh, .icon-link-symbol),
html[data-theme="dark"] #accordionReminderBody :is(.icon-Trash-O, .icon-Refresh, .icon-link-symbol)::before {
    color: var(--justis-action) !important;
}

/* Internal account banners use the same compact rhythm as dossier headers. */
html[data-theme] body:has(.dossier-navigation) .page-topbanner {
    padding: 12px 0;
}

html[data-theme] body:has(.dossier-navigation) .page-topbanner .page-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    min-height: 36px;
    margin: 0;
}

html[data-theme] body:has(.dossier-navigation) .page-topbanner h1 {
    order: -1;
    margin: 0;
    font-size: 24px;
    line-height: 30px;
    font-weight: 600;
}

html[data-theme] body:has(.dossier-navigation) .page-topbanner .profile-status {
    position: static;
    margin-left: auto;
}

/* Dossier identity and actions share available space instead of fixed columns. */
html[data-theme] .dossier-header {
    padding: 12px 0 !important;
}

html[data-theme] .dossier-header-row {
    align-items: center;
    gap: 12px 20px;
}

html[data-theme] .dossier-header-identity {
    flex: 1 1 360px;
    width: auto;
    min-width: 0;
}

html[data-theme] .dossier-header .lv2-title {
    margin: 0;
    font-size: 24px !important;
    line-height: 30px !important;
    font-weight: 600;
    overflow-wrap: anywhere;
}

html[data-theme] .dossier-header-cleanup {
    flex: 0 0 auto;
    width: auto;
}

html[data-theme] .dossier-header-cleanup:not(:has(button)) {
    display: none;
}

html[data-theme] .dossier-header-actions {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    margin-left: auto;
}

html[data-theme] .dossier-header-actions[hidden] {
    display: none !important;
}

html[data-theme] .dossier-header .button-actions-top-center {
    position: static;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
}

html[data-theme] .dossier-header .timer {
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end !important;
    gap: 8px;
    font-size: 14px;
    line-height: 20px;
}

html[data-theme] .dossier-header :is(#remainingHours, #currentTimetrack, .btn) {
    white-space: nowrap;
}

html[data-theme] .dossier-header :is(#remainingHours, #currentTimetrack) {
    display: inline-flex;
    align-items: center;
    margin: 0;
    line-height: 20px;
}

html[data-theme] .dossier-header .btn {
    width: auto;
    font-size: 14px;
    letter-spacing: normal;
}

html[data-theme] .dossier-header .btn-time-register {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

html[data-theme] .dossier-header #currentTimetrack {
    color: inherit;
    font-size: inherit;
    font-variant-numeric: tabular-nums;
}

/* Internal dossier inbox and AJAX-loaded message preview. */
html[data-theme] .internal-legalcase-messages-panel .dossier-message-toolbar {
    flex-wrap: wrap;
    gap: 8px 12px;
}

html[data-theme] .internal-legalcase-messages-panel .dossier-message-navigation {
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

html[data-theme] .internal-legalcase-messages-panel .dossier-message-navigation > .left {
    flex: 0 0 auto;
}

html[data-theme] .internal-legalcase-messages-panel #messageTabs {
    flex-wrap: nowrap;
}

html[data-theme] .internal-legalcase-messages-panel #messageTabs .nav-link {
    white-space: nowrap;
    font-weight: 600 !important;
}

@media (min-width: 1030px) {
    html[data-theme] .a1-dossier-sticky-layout {
        min-height: var(--a1-dossier-sidebar-height, 0px);
    }

    html[data-theme] #rightCol.a1-dossier-sticky-column {
        position: sticky;
        top: 12px;
        align-self: flex-start;
    }

    html[data-theme] .internal-legalcase-messages-panel #accordionReminderBody {
        display: flex;
        flex-direction: column;
        height: var(--internal-legalcase-message-list-height, max(300px, calc(100dvh - 329px)));
        max-height: var(--internal-legalcase-message-list-height, max(300px, calc(100dvh - 329px))) !important;
        overflow: hidden !important;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    html[data-theme] .internal-legalcase-messages-panel #accordionReminderBody > .tab-content,
    html[data-theme] .internal-legalcase-messages-panel #inbox,
    html[data-theme] .internal-legalcase-messages-panel .messages_inbox_list,
    html[data-theme] .internal-legalcase-messages-panel #message_accordion,
    html[data-theme] .internal-legalcase-messages-panel #inbox_msg_list,
    html[data-theme] .internal-legalcase-messages-panel #inbox_msg_list > .d-flex,
    html[data-theme] .internal-legalcase-messages-panel #inbox_msg_list > .d-flex > div {
        min-height: 0;
    }

    html[data-theme] .internal-legalcase-messages-panel #accordionReminderBody > .tab-content {
        flex: 1 1 auto;
    }

    /* Let the preview shrink beside the list instead of being widened by email tables. */
    html[data-theme] .internal-legalcase-messages-panel #inbox_msg_list > .d-flex > .w-100 {
        min-width: 0;
    }

    html[data-theme] .internal-legalcase-messages-panel :where(#reminders, #documents) {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    html[data-theme] .internal-legalcase-messages-panel :where(
        #inbox,
        .messages_inbox_list,
        #message_accordion,
        #inbox_msg_list,
        #inbox_msg_list > .d-flex,
        #inbox_msg_list > .d-flex > div,
        .internal-message-list,
        #showPreviewPanelV2,
        #showPreviewPanelV2 > .accordion,
        #showPreviewPanelV2 .internal-message-detail
    ) {
        height: 100% !important;
        min-height: 0;
    }

    html[data-theme] .internal-legalcase-messages-panel :where(
        .internal-message-list,
        #showPreviewPanelV2 .internal-message-detail
    ) {
        overflow-y: auto !important;
        overscroll-behavior: auto;
    }

    /* The preview owns vertical scrolling; retain horizontal overflow for wide emails. */
    html[data-theme] .internal-legalcase-messages-panel #showPreviewPanelV2 .message-content {
        max-height: none;
    }

    /* Scroll past the composer to the inbox without clipping either section. */
    html[data-theme] .internal-legalcase-messages-panel #message_accordion {
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* Share the preview column between the message header and its selected attachment. */
    html[data-theme] .internal-legalcase-messages-panel #inbox_msg_list > .d-flex > .w-100:has(.attached-files .input-group.active) {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    html[data-theme] .internal-legalcase-messages-panel #showPreviewPanelV2:has(.attached-files .input-group.active),
    html[data-theme] .internal-legalcase-messages-panel #showPreviewPanelV2:has(.attached-files .input-group.active) :where(.accordion, .internal-message-detail) {
        height: auto !important;
        flex: 0 0 auto;
    }

    html[data-theme] .internal-legalcase-messages-panel #showPreviewPanelV2:has(.attached-files .input-group.active) + #showMsgAtt {
        flex: 1 0 300px;
        min-height: 0;
        overflow: auto;
    }

    html[data-theme] .internal-legalcase-messages-panel #showPreviewPanelV2:has(.attached-files .input-group.active) + #showMsgAtt > #pspdfkit0 {
        height: 100% !important;
    }
}

html[data-theme="dark"] .internal-legalcase-messages-panel :where(
    .internal-message-list,
    .internal-message-list-item,
    #showPreviewPanelV2 .internal-message-detail,
    #showPreviewPanelV2 .internal-message-detail > .accordion-header,
    #showPreviewPanelV2 .internal-message-detail .accordion-body
) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel :where(
    .internal-message-list-subject-bar,
    #showPreviewPanelV2 .internal-message-detail-subject
) {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel :where(
    .internal-message-list-card,
    #showPreviewPanelV2 .internal-message-detail-meta
) {
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
}

/* Embedded request lists use the workspace height instead of legacy 500px boxes. */
html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .vl {
    border: 0;
}

html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .downgrade-history-item {
    background: var(--justis-surface-raised) !important;
    color: var(--justis-text-primary) !important;
    border: 1px solid var(--justis-border) !important;
    border-radius: var(--justis-control-radius) !important;
    padding: 8px !important;
    margin-bottom: 8px !important;
    font-size: 12px !important;
    line-height: 17px;
}

html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .downgrade-history-item p {
    font-size: 12px !important;
    line-height: 17px;
    margin-bottom: 4px;
}

html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .downgrade-history-item p:last-child {
    margin-bottom: 0;
}

html[data-theme] #downgrade-legalcase-panel .todo-history-title {
    color: var(--justis-text-primary) !important;
    font-size: 13px !important;
    line-height: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
}

html[data-theme] #downgrade-legalcase-panel .todo-history-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 4px 8px;
    margin: 0;
    font-size: 12px;
    line-height: 17px;
}

html[data-theme] #downgrade-legalcase-panel .todo-history-meta dt {
    color: var(--justis-text-secondary) !important;
    font-weight: 400;
}

html[data-theme] #downgrade-legalcase-panel .todo-history-meta dd {
    margin: 0;
    color: var(--justis-text-primary) !important;
    font-weight: 400;
    overflow-wrap: anywhere;
}

html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .vl > h4 {
    font-size: 18px !important;
    line-height: 24px;
}

html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .downgrade-item-active {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-action) !important;
    box-shadow: inset 3px 0 0 var(--justis-action);
}

@media (min-width: 1030px) {
    /* Only legacy side-by-side lists have internal scrolling; stacked requests grow. */
    html[data-theme] #downgrade-legalcase-panel:has(.frmapprovedowngrade .modal-text > .row .vl) > .modal-dialog {
        height: var(--a1-dossier-work-panel-height, auto);
        align-items: stretch;
    }

    html[data-theme] #downgrade-legalcase-panel:has(.frmapprovedowngrade .modal-text > .row .vl) .modal-content {
        height: 100% !important;
    }

    html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade,
    html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade :is(.modal-body, .modal-wrapper, .modal-text) {
        display: flex;
        flex-direction: column;
        /* Request and assistant panels can have content-based height. */
        flex: 1 1 auto;
        min-height: 0;
    }

    html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .modal-text > .row {
        /* Assistant response rows also live in panels with content-based height. */
        flex: 1 1 auto;
        min-height: 0;
    }

    html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .modal-text > .row > :has(> .vl) {
        height: 100%;
    }

    html[data-theme] #downgrade-legalcase-panel .frmapprovedowngrade .modal-text > .row :is(.vl, .downgrade-response-block) {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list {
    border: 0;
    border-radius: 0;
    background: transparent !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel .internal-message-list-item.active {
    border-color: var(--justis-text-primary) !important;
    box-shadow: 0 0 0 2px rgba(219, 234, 245, 0.24);
}

html[data-theme="dark"] .internal-legalcase-messages-panel .internal-message-list-item.active::before {
    background: var(--justis-text-primary);
}

/* A1 compact density: keep metadata legible while showing more inbox entries. */
html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item {
    flex: 0 0 auto;
    min-height: 0;
    margin-bottom: 8px;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-subject-bar {
    min-height: 0;
    padding: 6px 10px 3px;
    font-size: 15px;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-card {
    min-height: 0;
    padding: 2px 10px 6px !important;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-card .panel-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 6px;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-card .panel-title > .row:nth-child(1) {
    grid-column: 1 / -1;
    min-height: 24px;
    line-height: 20px;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-card .panel-title > .row:nth-child(2) {
    grid-column: 1;
    min-width: 0;
    padding-right: 0;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-card .panel-title > .row:nth-child(3) {
    position: static;
    grid-column: 2;
    grid-row: 2;
    align-self: end;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list .message-header-doc-details {
    gap: 3px;
    max-height: 39px;
    overflow: hidden;
}

html[data-theme] .legalcase-summary-v2-page .nav-link :is(.badge_inbox, .badge_reminders, #badge-documents) {
    background: var(--justis-action) !important;
    color: var(--justis-on-action) !important;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    margin-left: 6px;
    min-width: 20px;
    padding: 4px 6px;
    vertical-align: middle;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list .documentTags .badge {
    top: 0 !important;
    margin: 0 !important;
    padding: 3px 6px;
    box-sizing: border-box;
    height: 18px;
    line-height: 12px;
}

/* Keep the inbox message-type colors visible after the generic card surfaces above. */
html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.message-note,
html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.message-note :where(
    .internal-message-list-subject-bar,
    .internal-message-list-card
) {
    background: var(--justis-warning-bg) !important;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.legalcase_note_open,
html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.legalcase_note_open :where(
    .internal-message-list-subject-bar,
    .internal-message-list-card
) {
    background: var(--justis-success-bg) !important;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.message-reminder,
html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.message-reminder :where(
    .internal-message-list-subject-bar,
    .internal-message-list-card
) {
    background: var(--justis-info-bg) !important;
}

html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.external-message-closed,
html[data-theme] .internal-legalcase-messages-panel .internal-message-list-item.external-message-closed :where(
    .internal-message-list-subject-bar,
    .internal-message-list-card
) {
    background: var(--justis-danger-bg) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail > .accordion-header.message-note {
    background: var(--justis-warning-bg) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail > .accordion-header.legalcase_note_open {
    background: var(--justis-success-bg) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail > .accordion-header.message-reminder {
    background: var(--justis-info-bg) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail > .accordion-header.external-message-closed {
    background: var(--justis-danger-bg) !important;
}

/* Preserve the light-theme two-tone header hierarchy on dark type colors. */
html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail > .accordion-header :where(
    .internal-message-detail-subject,
    .internal-message-detail-meta
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail > .accordion-header .internal-message-detail-subject {
    background: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail > .accordion-header .internal-message-detail-meta {
    background: rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel :where(
    .internal-message-list-sender,
    .internal-message-list-recipient,
    .internal-message-list .text-xs,
    .internal-message-list .date,
    #showPreviewPanelV2 .internal-message-detail-meta .panel-title > .text-bold,
    #showPreviewPanelV2 .internal-message-detail .message-content,
    #showPreviewPanelV2 .sender-message,
    #showPreviewPanelV2 .sender-message :where(p, div, span, strong, em, li)
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .sender-message a {
    color: var(--justis-action) !important;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
}

/* Historical cost-approval messages contain this inline subject-card surface. */
html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .sender-message [style*="#f4f8fb" i] {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail-tabs :where(
    button,
    a,
    .message-tab,
    .text_doc,
    .doc_filesize,
    i
) {
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel #showPreviewPanelV2 .internal-message-detail-tabs :where(a, .text_doc) {
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
}

html[data-theme="dark"] .internal-legalcase-messages-panel .nav-tabs .nav-link {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .internal-legalcase-messages-panel .nav-tabs .nav-link.active {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

/* Message and dossier composers share late inline light-theme component styles. */
html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) :where(
    .reply-composer-surface:not(.alert-danger),
    .message-subject-card,
    .reply-subject-field,
    .message-textblocks-panel,
    .whatsapp-reply-composer,
    .tiptap-editor-wrapper .tiptap-editor-container,
    .tiptap-editor-wrapper .tiptap
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) :where(
    .reply-subject-field label,
    .message-textblocks-search,
    .whatsapp-reply-composer-footer,
    .tiptap-editor-wrapper .word-count-container
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) :where(
    .message-textblocks-edit-button,
    .message-textblocks-refresh,
    ul.msg_txt_blocks li
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) :where(
    .message-textblocks-edit-button,
    .message-textblocks-refresh,
    ul.msg_txt_blocks li
):hover,
html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) :where(
    .message-textblocks-edit-button,
    .message-textblocks-refresh,
    ul.msg_txt_blocks li
):focus {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) :where(
    .message-subject-card .message-subject-label,
    .message-subject-card .message-subject-value,
    .reply-subject-field label,
    .textblock-title,
    .textblock-preview,
    .textblock-source-icon,
    .textblocks-no-results,
    .whatsapp-character-count,
    .tiptap-editor-wrapper .count-value,
    .tiptap-editor-wrapper .readability-text
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) ul.msg_txt_blocks li.has-textblock-variables {
    background: var(--justis-warning-bg) !important;
    border-color: var(--justis-warning-text) !important;
}

html[data-theme="dark"] :is(.legalcase-summary-v2-page, .block-message) .textblock-variable-indicator {
    background: var(--justis-warning-bg) !important;
    border-color: var(--justis-warning-text) !important;
    color: var(--justis-warning-text) !important;
}

html[data-theme="dark"] .block-message .reply-type-options .form-radio-input[value="email"] + .form-radio-label {
    background: var(--justis-success-bg) !important;
    border-color: var(--justis-success-text) !important;
    color: var(--justis-success-text) !important;
}

html[data-theme="dark"] .block-message .reply-type-options .form-radio-input[value="note"] + .form-radio-label {
    background: var(--justis-warning-bg) !important;
    border-color: var(--justis-warning-text) !important;
    color: var(--justis-warning-text) !important;
}

html[data-theme="dark"] .block-message .reply-type-options .form-radio-input[value="reminder"] + .form-radio-label {
    background: var(--justis-info-bg) !important;
    border-color: var(--justis-info-text) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .block-message :where(.message-message, .message-message > .accordion-header) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block-message .message-message > .accordion-header :where(a, button, div, span, strong, .date) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block-message :where(.status-content .msg, .attach + .status-content) {
    color: var(--justis-text-secondary) !important;
}

html[data-theme] .block-message :where(.submitUnchosenData, #submit.btn) {
    border-radius: var(--justis-control-radius) !important;
    font-size: var(--justis-button-font-size) !important;
    font-weight: var(--justis-button-font-weight) !important;
    min-height: var(--justis-control-height);
    padding: 8px 16px !important;
}

html[data-theme] .block-message #submit.btn:disabled {
    background: var(--justis-button-disabled-bg) !important;
    border-color: var(--justis-button-disabled-bg) !important;
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}

/* Keep the final legal-case action legible while required consent is missing. */
html[data-theme] .block-advice #legalcaseform .form-actions :is(.btn, button, input[type="submit"]):disabled {
    background: var(--justis-button-disabled-bg) !important;
    border-color: var(--justis-button-disabled-bg) !important;
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}

/* Requested filenames, including added rows, must retain dark colors on focus. */
html[data-theme="dark"] #requestClientModal .form-label {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #requestClientModal input.form-control {
    background-color: var(--justis-control-bg) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
    caret-color: var(--justis-text-primary);
}

html[data-theme="dark"] #requestClientModal input.form-control:focus {
    background-color: var(--justis-control-bg) !important;
    border-color: var(--justis-focus) !important;
    color: var(--justis-text-primary) !important;
    outline: 2px solid var(--justis-focus) !important;
    outline-offset: 2px;
}

/* Document list editing and AJAX-loaded document details use late legacy light styles. */
html[data-theme="dark"] .legalcase-summary-v2-page .editable-input {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border-strong) !important;
    caret-color: var(--justis-text-primary) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .editable-input::selection {
    background: var(--justis-action) !important;
    color: var(--justis-page-bg) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    .document-detail-modal,
    .document-detail-modal-body,
    .modal-wrapper,
    .modal-text,
    .document-detail-editor,
    .document-detail-form,
    .document-detail-edit-section
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    .document-detail-modal-header,
    .document-detail-readonly-field,
    .document-detail-visibility-status,
    .document-detail-checkbox-card,
    .document-detail-check-group,
    .document-detail-actions
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    .modal-title,
    label,
    dt,
    dd,
    .document-detail-metadata-row,
    .document-detail-input-group,
    .document-detail-visibility-status,
    .document-detail-checkbox-card,
    .document-docx-metadata-actions__title,
    .help-block
) {
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    input.form-control,
    textarea.form-control,
    select.form-control,
    .selectize-input,
    .select2-selection,
    .input-group-text
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    input.form-control,
    textarea.form-control
)::placeholder {
    color: var(--justis-text-secondary) !important;
    opacity: 1;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    .btn-white,
    .btn-imagepreview
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    .btn-white,
    .btn-imagepreview
):hover,
html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(
    .btn-white,
    .btn-imagepreview
):focus {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .document-detail-check-group .form-checkbox-label::before {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .document-detail-check-group .form-checkbox-input:checked + .form-checkbox-label::before {
    background: var(--justis-action) !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-page-bg) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) :where(.tag-ctn, .tag-res-ctn) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .tag-ctn .tag-trigger,
html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .tag-ctn .tag-trigger:hover {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .tag-ctn .tag-trigger .tag-trigger-ico {
    border-top-color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .tag-res-ctn :where(.tag-res-item, .tag-res-group) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .tag-res-ctn .tag-res-odd {
    background: var(--justis-surface-subtle) !important;
}

html[data-theme="dark"] :is(#previewimage, #modalEditDocumentLabel) .tag-res-ctn .tag-res-item-active {
    background: var(--justis-action) !important;
    color: var(--justis-page-bg) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #btn_close_legalcase.red-btn {
    background: var(--justis-danger-bg) !important;
    border-color: var(--justis-danger-text) !important;
    color: var(--justis-danger-text) !important;
    font-weight: 700;
}

html[data-theme="dark"] .legalcase-summary-v2-page .v2-footer-left {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #leftCol a:not(.btn) {
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #btn_close_legalcase.red-btn:hover,
html[data-theme="dark"] .legalcase-summary-v2-page #btn_close_legalcase.red-btn:focus {
    background: var(--justis-danger-text) !important;
    border-color: var(--justis-danger-text) !important;
    color: var(--justis-page-bg) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .accordion-item,
html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .accordion-collapse,
html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .accordion-body {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .accordion-header {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .accordion-header :where(.panel-title, .panel-title .text-bold, .date) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .reminder-edit-btn {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list :where(.reminder-close, .edit-btn-normal) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page :where(#downgrade-three-column-layout, #downgrade-legalcase-panel, #div_unifiedsearch.unified-search-panel) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #downgrade-three-column-layout .downgrade-panel-resize-handle::after {
    background: var(--justis-border-strong) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #downgrade-legalcase-panel :where(.frmapprovedowngrade, .frmdowngradelegalcase, .modal-wrapper, .modal-text, .downgrade-history-item) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #downgrade-legalcase-panel :where([style*="color:#212529"], [style*="color: #212529"], [style*="color:#6c757d"], [style*="color: #6c757d"]) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #div_unifiedsearch :where(.accordion-lcsuche, .unified-search-header, .accordion-body) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #div_unifiedsearch .filterbadgesrc.inactivebadge {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #div_unifiedsearch .filterbadgesrc.inactivebadge:hover,
html[data-theme="dark"] .legalcase-summary-v2-page #div_unifiedsearch .filterbadgesrc.inactivebadge:focus {
    background: var(--justis-surface-raised-hover) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #addOpponentTemplate :where(.modal-content, .modal-header, .modal-body, .modal-footer, #add-template-panel) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #addOpponentTemplate :where(label, .form-label, .control-label, .modal-title) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #addOpponentTemplate :where(.tag-ctn, .tag-trigger, .selectize-control, .selectize-input, .selectize-dropdown, .select2-selection, .select2-dropdown) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #addOpponentTemplate :where(.selectize-dropdown-content > div, .select2-results__option) {
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #addOpponentTemplate :where(.selectize-dropdown-content > div.active, .select2-results__option--highlighted) {
    background: var(--justis-action) !important;
    color: var(--justis-on-action) !important;
}

/* Late AJAX fragments shared by staff, lawyer, assistant and customer dossiers. */
html[data-theme="dark"] .legalcase-summary-v2-page :where(
    .eml-preview-container,
    .eml-body,
    .eml-attachment-detail,
    .eml-attachment-preview,
    .document-grouping-modal .modal-content,
    .document-grouping-modal .modal-header,
    .document-grouping-modal .modal-body,
    .document-grouping-modal .modal-footer,
    .document-grouping-modal .grouping-panel,
    .document-grouping-modal #sortable1,
    .document-grouping-modal #sortable2,
    .document-grouping-modal #sortable3,
    .document-grouping-modal #sortable4,
    .document-grouping-modal #sortable1 li,
    .document-grouping-modal #sortable2 li,
    .document-grouping-modal #sortable3 li,
    .document-grouping-modal #sortable4 li
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page :where(
    .eml-preview-container pre,
    .eml-headers,
    .document-grouping-modal .grouping-panel-header,
    .document-grouping-modal .grouping-panel-source .grouping-panel-header,
    .document-grouping-modal .grouping-panel-target .grouping-panel-header
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .eml-preview-container :where(h1, h2, h3, h4, p, span, strong, pre, th, td) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page :where(
    .assistant-todo-create-panel,
    .double-verification-panel,
    .approval-review-panel
) :where(
    .modal-content,
    .modal-header,
    .modal-body,
    .modal-footer,
    .modal-wrapper,
    .modal-text,
    .assistant-choice-section,
    .assistant-choice-card,
    .assistant-deadline-control,
    .verification-category-control,
    .verification-note-section,
    .verification-attachment-row,
    .double-verification-cancel-summary,
    .double-verification-cancel-actions,
    .approval-request-selector,
    .approval-request-subject,
    .approval-guidance,
    .cost-approval-review-note > div > div:last-child > div:last-child,
    .display-existing-content
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page :where(
    .assistant-todo-create-panel,
    .double-verification-panel,
    .approval-review-panel
) :where(
    h2,
    h3,
    h4,
    label,
    p,
    .modal-title,
    .verification-form-label,
    .verification-form-hint,
    .double-verification-cancel-copy,
    .double-verification-cancel-label,
    .double-verification-cancel-title,
    .double-verification-cancel-meta,
    .approval-request-subject-label,
    .approval-request-subject-value
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page :where(
    .assistant-todo-create-panel,
    .double-verification-panel,
    .approval-review-panel
) a {
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .assistant-claim-panel :where(
    .assistant-claim-list,
    .assistant-claim-item
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .assistant-claim-panel .assistant-claim-item-selectable:hover,
html[data-theme="dark"] .legalcase-summary-v2-page .assistant-claim-panel .assistant-claim-item-active {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-focus) !important;
    box-shadow: inset 4px 0 0 var(--justis-focus) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .assistant-claim-panel :where(
    .assistant-claim-item-title,
    .assistant-claim-item-text,
    .assistant-claim-meta span
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .assistant-claim-panel .assistant-claim-meta-label {
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .assistant-claim-panel .btn-close {
    filter: brightness(0) invert(1);
}

html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel :where(
    .accordion-item,
    .accordion-header,
    .accordion-body,
    .accordion-body > .row:last-child
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel #post_content,
html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel .thoughts-note-tiptap-wrapper,
html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel .thoughts-note-tiptap-wrapper .editor-toolbar,
html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel .thoughts-note-tiptap-wrapper .tiptap-editor-container,
html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel .thoughts-note-tiptap-wrapper .tiptap-editor-container .tiptap {
    background: var(--justis-pastel-yellow-bg) !important;
    border-color: var(--justis-pastel-yellow-text) !important;
    color: var(--justis-pastel-yellow-text) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel #post_content::placeholder,
html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel .thoughts-note-tiptap-wrapper .tiptap p.is-editor-empty:first-child::before {
    color: var(--justis-pastel-yellow-text) !important;
    opacity: 0.78;
}

html[data-theme="dark"] .legalcase-summary-v2-page #div_thoughts_note.thoughts-note-panel .btn-close {
    filter: brightness(0) invert(1);
}

html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"] {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border-strong) !important;
    box-shadow: none !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"]:hover,
html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"]:focus {
    background: var(--justis-surface-raised-hover) !important;
    border-color: var(--justis-focus) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"].btn-primary {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-focus) !important;
    box-shadow: 0 0 0 2px var(--justis-focus) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"].btn-note,
html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"].btn-note:hover,
html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"].btn-note:focus {
    background: var(--justis-pastel-yellow-bg) !important;
    border-color: var(--justis-pastel-yellow-text) !important;
    box-shadow: 0 0 0 2px var(--justis-pastel-yellow-text) !important;
    color: var(--justis-pastel-yellow-text) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page [id="btn_thoughts_note"] i {
    color: currentColor !important;
}

html[data-theme="dark"] .thoughts-note-tooltip .tooltip-inner {
    background: var(--justis-pastel-yellow-bg) !important;
    border-color: var(--justis-pastel-yellow-text) !important;
    color: var(--justis-pastel-yellow-text) !important;
}

html[data-theme="dark"] :where(.textblock-variable-helper, .textblock-variable-instructions) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.textblock-variable-helper, .textblock-variable-instructions) :where(h3, h4, p, li) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .textblock-variable-chip {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .textblock-variable-chip:hover,
html[data-theme="dark"] .textblock-variable-chip:focus {
    background: var(--justis-surface-raised-hover) !important;
}

/* Document summaries are attached to body, outside the dossier pane. */
html[data-theme="dark"] .document-summary-tooltip {
    --bs-tooltip-opacity: 1;
    --bs-tooltip-bg: var(--justis-surface-raised);
}

html[data-theme="dark"] .document-summary-tooltip.show {
    opacity: 1;
}

html[data-theme="dark"] .document-summary-tooltip .tooltip-inner {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border);
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .document-summary-tooltip :is(.document-summary-tooltip-title, .document-summary-tooltip-text) {
    color: var(--justis-text-primary);
}

html[data-theme="dark"] .document-summary-tooltip :is(.document-summary-tooltip-meta, .document-summary-tooltip-meta span, .document-summary-tooltip-section-label) {
    color: var(--justis-text-secondary);
}

html[data-theme="dark"] .document-summary-tooltip .document-summary-tooltip-summary {
    background: var(--justis-surface-subtle);
    border-color: var(--justis-border);
}

/* Customer, staff, lawyer, assistant and boss portals share these dossier panes. */
html[data-theme="dark"] .legalcase-summary-v2-page :where(
    .customer-legalcase-summary-layout,
    .customer-legalcase-summary-layout #leftCol,
    .customer-legalcase-summary-layout #rightCol,
    .customer-legalcase-summary-layout .accordion-item,
    .customer-legalcase-summary-layout .accordion-header,
    .customer-legalcase-summary-layout .accordion-body,
    .customer-legalcase-summary-layout .document-list,
    .customer-legalcase-summary-layout .messages_inbox_list,
    .customer-legalcase-summary-layout .document-summary-mobile-indicator
) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout :where(h1, h2, h3, h4, p, span, label, .date, .text_doc, .doc_filesize) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout :where(
    .legalcase-messages-panel > .messages > .accordion-header a[data-bs-target="#messagesinfo"],
    .documents > .accordion-header a[data-bs-target="#documentinfo"]
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout :where(
    .legalcase-messages-panel .accordion-header .action-lists a,
    .legalcase-messages-panel .accordion-header .action-lists span.header-arrow,
    .documents .accordion-header .action-lists a,
    .documents .accordion-header .action-lists span.header-arrow,
    .legalcase-messages-panel .accordion-header .action-lists i,
    .documents .accordion-header .action-lists i
) {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout :where(
    #msgBtn.customer-message-compose-action,
    #customerDocumentUploadBtn
) {
    background: transparent !important;
    border-color: var(--justis-action) !important;
    border-radius: var(--justis-control-radius) !important;
    color: var(--justis-action) !important;
    min-height: var(--justis-control-height);
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout :where(
    #msgBtn.customer-message-compose-action.btn-primary,
    #customerDocumentUploadBtn.btn-primary
) {
    background: var(--justis-action) !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout .messages_inbox_list .accordion-header .row.mt-2 {
    background: var(--justis-surface-emphasis) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout .messages_inbox_list .accordion-header .row.mt-2 > div {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout a:not(.btn) {
    color: var(--justis-action) !important;
    overflow-wrap: anywhere;
}

html[data-theme] .legalcase-summary-v2-page .legalcase-compose-actions .btn {
    border-radius: var(--justis-control-radius) !important;
    font-size: var(--justis-button-font-size) !important;
    font-weight: var(--justis-button-font-weight) !important;
    min-height: var(--justis-control-height);
}

html[data-theme] .legalcase-summary-v2-page .legalcase-compose-actions .btn:disabled {
    background: var(--justis-button-disabled-bg) !important;
    border-color: var(--justis-button-disabled-bg) !important;
    color: var(--justis-button-disabled-text) !important;
    opacity: 1;
}

html[data-theme="dark"] .legalcase-summary-v2-page .reply-composer-surface .status-content :where(.msg, a) {
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .block-message .form-checkbox-label {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block-message .form-checkbox-label::before {
    background: var(--justis-control-bg) !important;
    border-color: var(--justis-control-border) !important;
}

/* Shared message confirmation view: remove the nested legacy white canvas in dark mode. */
html[data-theme="dark"] .a1-success-page,
html[data-theme="dark"] .a1-success-page > .container,
html[data-theme="dark"] .a1-success-page .block.block-white,
html[data-theme="dark"] .a1-success-page .block-content,
html[data-theme="dark"] .a1-success-page .block.no-bg {
    background: var(--justis-page-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .a1-success-page .card {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .a1-success-page .back-lnk {
    color: var(--justis-action) !important;
}

html[data-theme="dark"] .a1-success-page .text-success {
    color: var(--justis-success-text) !important;
}

/* Customer-visible notes keep their success meaning without the legacy neon-green header. */
html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout .messages_inbox_list .panel-message-archive.legalcase_note_open,
html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout .messages_inbox_list .panel-message-archive.legalcase_note_open > .accordion-header,
html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout .messages_inbox_list .panel-message-archive.legalcase_note_open .accordion-header .row.mt-2 {
    background: var(--justis-success-bg) !important;
    border-color: var(--justis-success-text) !important;
    color: var(--justis-success-text) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .customer-legalcase-summary-layout .messages_inbox_list .panel-message-archive.legalcase_note_open .accordion-header :where(a, div, span, strong, .date, i) {
    color: var(--justis-success-text) !important;
}

/* The shared multi-upload modal is injected dynamically and needs explicit themed queue cards. */
html[data-theme="dark"] #multiUploadLegalcase :where(.modal-content, .modal-header, .modal-body) {
    background: var(--justis-page-bg) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #multiUploadLegalcase .alert {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #multiUploadLegalcase .alert :where(strong, .response) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] #multiUploadLegalcase .alert .response.error {
    color: var(--justis-danger-text) !important;
}

html[data-theme="dark"] #multiUploadLegalcase .progress {
    background: var(--justis-surface-emphasis) !important;
    border: 1px solid var(--justis-border) !important;
}

html[data-theme="dark"] #multiUploadLegalcase .progress-bar {
    background: var(--justis-success-text) !important;
}

/* Legacy portal components with their own late light palette. */
html[data-theme="dark"] :where(.modal-search-360, .popover-title) {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] :where(.block-modal .block-heading h2, .box-register h2, .box-register h3) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .error-page {
    background: var(--justis-page-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .sms-thread-message .chatbox-head {
    color: var(--justis-text-secondary) !important;
}

html[data-theme="dark"] .sms-thread-bubble.chatbox-message,
html[data-theme="dark"] .sms-thread-message.chatbox-wrap-others .sms-thread-bubble {
    background: var(--justis-surface-raised) !important;
    border-color: var(--justis-border) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .sms-thread-message.chatbox-wrap-own .sms-thread-bubble {
    background: var(--justis-success-bg) !important;
    border-color: var(--justis-success-text) !important;
    color: var(--justis-success-text) !important;
}

html[data-theme="dark"] .sms-thread-message .sms-thread-bubble.sms-thread-bubble-note {
    background: var(--justis-warning-bg) !important;
    border-color: var(--justis-warning-text) !important;
    color: var(--justis-warning-text) !important;
}

html[data-theme="dark"] .sms-thread-bubble.sms-thread-bubble-failed {
    border-color: var(--justis-danger-text) !important;
    box-shadow: 0 0 0 1px var(--justis-danger-text) !important;
}

html[data-theme="dark"] .sms-thread-message-text .attached-files {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border) !important;
}

html[data-theme="dark"] .sms-thread-message-footer {
    border-top-color: var(--justis-border) !important;
    color: var(--justis-text-secondary) !important;
}

.reminders_list .reminder-deadline,
.reminders_list .reminder-deadline > .accordion-header {
    background: #ffcccc !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .reminder-deadline,
html[data-theme="dark"] .legalcase-summary-v2-page .reminders_list .reminder-deadline > .accordion-header {
    background: var(--justis-pastel-red-bg) !important;
}

html[data-theme="dark"] tr:is(.reminder-past, .reminder-today, .reminder-future) > td {
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] tr.table-primary:is(.reminder-past, .reminder-today, .reminder-future) > td {
    background: var(--justis-pastel-blue-bg) !important;
}

html[data-theme="dark"] .reminders-legend [style*="0, 0, 255"] {
    color: var(--justis-pastel-blue-text) !important;
}

html[data-theme="dark"] .reminders-legend [style*="255, 0, 0"] {
    color: var(--justis-danger-text) !important;
}

html[data-theme="dark"] .reminders-legend [style*="255, 204, 204"] {
    background: var(--justis-pastel-red-bg) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] tr.table-danger:is(.reminder-past, .reminder-today, .reminder-future) > td {
    background: var(--justis-pastel-red-bg) !important;
}

html[data-theme="dark"] tr.reminder-past > td,
html[data-theme="dark"] tr.reminder-past > td :is(a, i, span) {
    color: var(--justis-danger-text) !important;
}

html[data-theme="dark"] tr.reminder-today > td,
html[data-theme="dark"] tr.reminder-today > td :is(a, i, span) {
    color: var(--justis-pastel-blue-text) !important;
}

html[data-theme="dark"] .table-primary.reminder-past {
    --bs-table-bg: var(--justis-info-bg);
    --bs-table-striped-bg: var(--justis-info-bg);
    --bs-table-striped-color: var(--justis-info-text);
    --bs-table-active-bg: var(--justis-surface-raised-hover);
    --bs-table-active-color: var(--justis-info-text);
    --bs-table-hover-bg: var(--justis-surface-raised-hover);
    --bs-table-hover-color: var(--justis-info-text);
    border-color: var(--justis-info-text) !important;
    color: var(--justis-info-text) !important;
}

html[data-theme="dark"] .table-danger.reminder-past {
    --bs-table-bg: var(--justis-danger-bg);
    --bs-table-striped-bg: var(--justis-danger-bg);
    --bs-table-striped-color: var(--justis-danger-text);
    --bs-table-active-bg: var(--justis-surface-raised-hover);
    --bs-table-active-color: var(--justis-danger-text);
    --bs-table-hover-bg: var(--justis-surface-raised-hover);
    --bs-table-hover-color: var(--justis-danger-text);
    border-color: var(--justis-danger-text) !important;
    color: var(--justis-danger-text) !important;
}

html[data-theme="dark"] :where(.portal-dashboard, #profile_tab) .badge[style*="background:#fff"],
html[data-theme="dark"] :where(.portal-dashboard, #profile_tab) .badge[style*="background: #fff"],
html[data-theme="dark"] :where(.portal-dashboard, #profile_tab) .badge[style*="background-color:#fff"],
html[data-theme="dark"] :where(.portal-dashboard, #profile_tab) .badge[style*="background-color: #fff"] {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
}

/* White article/detail canvases stay flat in light mode and must stay flat in dark mode. */
html[data-theme="dark"] .page-heading,
html[data-theme="dark"] .block.block-white > .block-content.faq-detail {
    border: 0 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .page-heading {
    background: transparent !important;
}

html[data-theme="dark"] .block.block-white > .block-content.faq-detail {
    background: var(--justis-page-bg) !important;
}

/* A white light-mode canvas around pastel tile grids must not become a framed panel in dark mode. */
html[data-theme="dark"] .block.block-white > .block-content:has(.white-blocks [class*="cat-block-bg-"]) {
    background: var(--justis-page-bg) !important;
    border: 0 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .faq-detail :where(p, span, li, strong, b, em, small, blockquote) {
    background-color: transparent !important;
}

html[data-theme="dark"] .faqHeader {
    border-bottom-color: var(--justis-border-strong) !important;
}

html[data-theme="dark"] .faqHeader :where(h2, h3) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block-faq .accordion-body :where(p, li, span, strong, b, em, small) {
    background: transparent !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .block-faq .accordion-body a {
    color: var(--justis-action) !important;
}

/* Keep revealed tile copy, actions and pictograms on the tile's own pastel palette. */
html[data-theme] :is(
    .cat-block-bg-0,
    .cat-block-bg-1,
    .cat-block-bg-2,
    .cat-block-bg-3,
    .cat-block-bg-4,
    .cat-block-bg-5,
    .cat-block-bg-6,
    .cat-block-bg-7,
    .cat-block-bg-8
) :where(.block-title, .block-content, .block-footer-fixed, a, button, p, h2, h3, i, [class*="icon-"]) {
    background: transparent !important;
    color: var(--justis-tile-text) !important;
}

html[data-theme="dark"] body.portal .container-white a.btn-primary {
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .assistant-todo-create-panel :where(
    .form-radio-input,
    .form-checkbox-input
) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page .assistant-todo-create-panel :where(
    .assistant-choice-name,
    .assistant-deadline-label
) {
    color: var(--justis-text-primary) !important;
}

html[data-theme="dark"] .legalcase-summary-v2-page :where(.sort_label.badge, .sort_label.badge.badge-active) {
    background: var(--justis-surface-subtle) !important;
    border-color: var(--justis-border-strong) !important;
    color: var(--justis-text-primary) !important;
}

html[data-theme] .legalcase-summary-v2-page .badge:is([style*="#E1F5FE" i], [style*="#E0F7FA" i]) {
    background: var(--justis-pastel-aqua-bg) !important;
    color: var(--justis-pastel-aqua-text) !important;
}

html[data-theme] .legalcase-summary-v2-page .badge:is([style*="#EDE7F6" i], [style*="#F3E5F5" i], [style*="#E8EAF6" i], [style*="#6f42c1" i]) {
    background: var(--justis-pastel-purple-bg) !important;
    color: var(--justis-pastel-purple-text) !important;
}

html[data-theme] .legalcase-summary-v2-page .badge:is([style*="#FFCCBC" i], [style*="#FFE0B2" i]) {
    background: var(--justis-pastel-orange-bg) !important;
    color: var(--justis-pastel-orange-text) !important;
}

html[data-theme] .legalcase-summary-v2-page .badge:is([style*="#C8E6C9" i], [style*="#F1F8E9" i], [style*="#2E7D32" i], [style*="#76FF03" i], [style*="#E0F2F1" i]) {
    background: var(--justis-pastel-green-bg) !important;
    color: var(--justis-pastel-green-text) !important;
}

html[data-theme] .legalcase-summary-v2-page .badge:is([style*="#FFE082" i], [style*="#FFECB3" i], [style*="#FFFDE7" i], [style*="#FFFF00" i]) {
    background: var(--justis-pastel-yellow-bg) !important;
    color: var(--justis-pastel-yellow-text) !important;
}

html[data-theme] .legalcase-summary-v2-page .badge:is([style*="#FFCDD2" i], [style*="#FCE4EC" i], [style*="#F8BBD0" i], [style*="#FF1111" i]) {
    background: var(--justis-pastel-red-bg) !important;
    color: var(--justis-pastel-red-text) !important;
}

html[data-theme] .legalcase-summary-v2-page .badge:is([style*="#CFD8DC" i], [style*="#ECEFF1" i], [style*="#212529" i], [style*="#777" i]) {
    background: var(--justis-pastel-gray-bg) !important;
    color: var(--justis-pastel-gray-text) !important;
}

/* Keep primary portal actions consistent with the A1 Compact Dark primary button. */
html[data-theme="dark"] :is(body.portal, .legalcase-summary-v2-page) .btn.btn-primary:not(:disabled):not(.disabled):not([aria-disabled="true"]) {
    background: var(--justis-action) !important;
    border-color: var(--justis-action) !important;
    color: var(--justis-on-action) !important;
}

html[data-theme="dark"] :is(body.portal, .legalcase-summary-v2-page) .btn.btn-primary:not(:disabled):not(.disabled):not([aria-disabled="true"]):hover,
html[data-theme="dark"] :is(body.portal, .legalcase-summary-v2-page) .btn.btn-primary:not(:disabled):not(.disabled):not([aria-disabled="true"]):focus {
    background: var(--justis-action-hover) !important;
    border-color: var(--justis-action-hover) !important;
    color: var(--justis-on-action) !important;
}

@media (max-width: 575.98px) {
    .a1-theme-switcher {
        right: 8px;
        top: 8px;
    }

    .a1-theme-switcher__button {
        height: 32px;
        min-height: 32px;
        min-width: 32px;
        padding: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .a1-theme-switcher__button,
    html[data-theme] img.justis-a1-legacy-spinner {
        transition: none;
    }

    html[data-theme] img.justis-a1-legacy-spinner,
    html[data-theme] .justis-a1-loading-spinner,
    html[data-theme] .justis-a1-loading-spinner * {
        animation: none !important;
    }
}

/* A1 expansion indicators: down when closed, up when expanded. */
html[data-theme] .legalcase-summary-v2-page #leftCol > .card > .card-header,
html[data-theme] .legalcase-summary-v2-page a[data-bs-target="#summaryinfo"],
html[data-theme] .legalcase-summary-v2-page a[data-bs-target="#messagesinfo"],
html[data-theme] .legalcase-summary-v2-page a[data-bs-target="#documentinfo"],
html[data-theme] .legalcase-summary-v2-page .header-arrow {
    color: var(--justis-text-primary) !important;
}

html[data-theme] .legalcase-summary-v2-page #summary_info > .accordion-item > .accordion-header .accordion-button::after,
html[data-theme] .legalcase-summary-v2-page .header-arrow > i::before {
    content: "" !important;
    display: inline-block;
    width: 20px;
    height: 20px;
    background: currentColor !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 9 7 7 7-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    transform: none !important;
}
html[data-theme] .legalcase-summary-v2-page #summary_info > .accordion-item > .accordion-header .accordion-button:not(.collapsed)::after,
html[data-theme] .legalcase-summary-v2-page:has(#summaryinfo.show) .header-arrow[data-bs-target="#summaryinfo"] > i::before,
html[data-theme] .legalcase-summary-v2-page:has(#messagesinfo.show) .header-arrow[data-bs-target="#messagesinfo"] > i::before,
html[data-theme] .legalcase-summary-v2-page:has(#documentinfo.show) .header-arrow[data-bs-target="#documentinfo"] > i::before {
    transform: rotate(180deg) !important;
}

/* Shared A1 Compact overview for legal service, team leads and assistants. */
html[data-theme] .a1-work-dashboard .page-heading {
    padding: 16px 0 20px !important;
    border-bottom: 1px solid var(--justis-border);
    margin-bottom: 24px;
}
html[data-theme] .a1-work-dashboard .page-heading h1 {
    color: var(--justis-text-primary) !important;
    font-size: 28px;
    line-height: 36px;
    font-weight: 700;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}
html[data-theme] .a1-work-dashboard .page-heading h1 .icon-Info-Circle-O {
    font-size: 20px !important;
    vertical-align: middle;
    color: var(--justis-action);
}
html[data-theme] .a1-work-dashboard .white-blocks .block {
    padding: 16px !important;
    border: 1px solid var(--justis-border) !important;
    border-radius: var(--justis-control-radius);
}
html[data-theme] .a1-work-dashboard .block-title {
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--justis-border);
}
html[data-theme] .a1-work-dashboard .block-title h2 {
    margin: 0;
    color: var(--justis-text-primary);
    font-size: 20px;
    line-height: 28px;
    font-weight: 700;
}
html[data-theme] .a1-work-dashboard .block-title button {
    min-width: 32px;
    min-height: 32px;
    color: var(--justis-action) !important;
}
html[data-theme] .a1-work-dashboard .block-content > .d-flex.d-md-wrap.gap-15 {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px !important;
}
html[data-theme] .a1-work-dashboard .block-content > .d-flex.d-md-wrap.gap-15 > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: auto !important;
}
html[data-theme] .a1-work-dashboard .block-content > .d-flex.d-md-wrap.gap-15 a[disabled] {
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-secondary) !important;
    border-color: var(--justis-border) !important;
    opacity: 1;
}
html[data-theme] .a1-work-dashboard .p-height {
    height: auto;
    min-height: 40px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 20px;
    flex: 1;
}

@media (min-width: 992px) {
    html[data-theme] .a1-work-dashboard .block-content > .d-flex.d-md-wrap.gap-15 {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        gap: 8px !important;
    }
    html[data-theme] .a1-work-dashboard .block-content > .d-flex.d-md-wrap.gap-15 .p-height {
        font-size: 12px !important;
        line-height: 16px;
        min-height: 48px;
        overflow-wrap: anywhere;
    }
}

/* Overview tables use the same subtle row separators as message lists. */
html[data-theme] .a1-work-dashboard .white-blocks .table {
    border-collapse: collapse;
    border: 0 !important;
}
html[data-theme] .a1-work-dashboard .white-blocks .table > :is(thead, tbody, tfoot),
html[data-theme] .a1-work-dashboard .white-blocks .table > :is(thead, tbody, tfoot) > tr {
    border: 0 !important;
}
html[data-theme] .a1-work-dashboard .white-blocks .table > :is(thead, tbody, tfoot) > tr > :is(th, td) {
    border: 0 !important;
    border-bottom: 1px solid var(--justis-border) !important;
}
html[data-theme] .a1-work-dashboard .white-blocks .table > thead > tr > th {
    border-bottom-color: var(--justis-border-strong) !important;
}
html[data-theme] .a1-work-dashboard .white-blocks .table > tbody > tr.assistant-todo-row-past > td:first-child {
    border-left: 3px solid var(--justis-danger-text) !important;
}

/* Shared customer profile, also used by staff and lawyer portal variants. */
html[data-theme] .a1-client-profile-intro .block-title h1 {
    font-size: 28px;
    line-height: 36px;
    font-weight: 700;
    color: var(--justis-text-primary) !important;
}
html[data-theme] .a1-client-profile-intro .block-content h2 {
    font-size: 22px;
    line-height: 30px;
    color: var(--justis-text-primary) !important;
}
html[data-theme] .a1-client-profile-intro .rounded-circle {
    max-width: 140px;
    height: auto;
}
html[data-theme] .a1-client-profile-intro .block-content .row > div:has(> .testimonial-heading) {
    display: flex;
    flex-direction: column;
}
html[data-theme] .a1-client-profile-intro .testimonial-heading {
    order: 2;
    font-size: 13px;
    line-height: 18px;
    margin: 8px 0 0 !important;
}
html[data-theme] .a1-client-profile-intro .block-content .testimonial-heading + p {
    margin-bottom: 0;
}
html[data-theme] .a1-client-profile-intro .testimonial-heading span {
    font-size: inherit !important;
    line-height: inherit;
}
html[data-theme] .a1-client-profile-intro .testimonial-heading br {
    display: none;
}
html[data-theme] .a1-client-profile-intro .testimonial-heading span:first-child::after {
    content: ",";
}
html[data-theme] .a1-client-profile .client-portal-block {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--justis-border);
    border-radius: var(--justis-control-radius);
    padding: 16px;
}
html[data-theme] .a1-client-profile .client-portal-block > .portal-content {
    height: auto;
    flex: 1;
}
html[data-theme] .a1-client-profile .portal-title {
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--justis-border);
}
html[data-theme] .a1-client-profile .portal-title > p {
    margin: 0;
    font-size: 20px;
    line-height: 28px;
    font-weight: 700;
    color: var(--justis-text-primary) !important;
}
html[data-theme] .a1-client-profile .portal-title .badge {
    margin-inline-start: 8px;
    vertical-align: middle;
}
html[data-theme] .a1-client-profile .news-list .date,
html[data-theme] .a1-client-profile .news-list .date .communication-date {
    color: var(--justis-text-secondary) !important;
}
html[data-theme] .a1-client-profile .portal-content .table,
html[data-theme] .a1-client-profile .portal-content .table tr,
html[data-theme] .a1-client-profile .portal-content .table :is(thead, tbody) {
    border: 0 !important;
}
html[data-theme] .a1-client-profile .portal-content .table :is(th, td) {
    border: 0 !important;
    border-bottom: 1px solid var(--justis-border) !important;
}

@media (max-width: 575px) {
    html[data-theme] .a1-client-profile .content-left {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }
    html[data-theme] .a1-client-profile .content-right {
        flex: 0 0 88px;
        width: 88px;
        padding-inline: 4px;
    }
    html[data-theme] .a1-client-profile .content-right .profile-picture,
    html[data-theme] .a1-client-profile .content-right .profile-picture-wrapper {
        width: 100%;
        max-width: 80px;
    }
    html[data-theme] .a1-client-profile .news-list a > .row:has(> .profile-picture):has(> .date) {
        display: grid;
        grid-template-columns: 32px minmax(0, 1fr) 60px;
        gap: 6px;
    }
    html[data-theme] .a1-client-profile .news-list a > .row:has(> .profile-picture):has(> .date) > div {
        width: auto;
        padding-inline: 0;
        min-width: 0;
    }
    html[data-theme] .a1-client-profile .news-list a > .row > .date {
        font-size: 11px;
        line-height: 16px;
    }
    html[data-theme] .a1-client-profile .client-portal-block .btn.btn-sm {
        min-height: 44px;
    }
}

@media (max-width: 575px) {
    html[data-theme] .a1-client-profile-intro .page-topbanner { padding: 16px 0; }
    html[data-theme] .a1-client-profile-intro .block-content { padding-top: 12px; }
    html[data-theme] .a1-client-profile-intro .block-title h1 {
        font-size: 24px;
        line-height: 32px;
        margin-bottom: 0;
    }
    html[data-theme] .a1-client-profile-intro .block-content h2 {
        font-size: 18px;
        line-height: 24px;
        margin-bottom: 8px;
    }
    html[data-theme] .a1-client-profile-intro .block-content p {
        font-size: 14px;
        line-height: 20px;
        margin-bottom: 12px;
    }
    html[data-theme] .a1-client-profile-intro .block-content .row:has(> div > .rounded-circle) {
        display: grid;
        grid-template-columns: 56px minmax(0, 1fr);
        gap: 12px;
        margin: 0;
    }
    html[data-theme] .a1-client-profile-intro .block-content .row:has(> div > .rounded-circle) > div {
        width: auto;
        padding: 0;
        margin-top: 0 !important;
    }
    html[data-theme] .a1-client-profile-intro .rounded-circle { max-width: 56px; }
    html[data-theme] .a1-client-profile-intro .testimonial-heading {
        font-size: 11px;
        line-height: 15px;
        margin: 6px 0 0 !important;
    }
}

/* A1 Data Display shared by customer, lawyer, staff and assistant summaries. */
html[data-theme] .legalcase-summary-v2-page #summary_info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

html[data-theme] .legalcase-summary-v2-page #summary_info > .accordion-item {
    border: 1px solid var(--justis-border) !important;
    border-radius: var(--justis-control-radius) !important;
    margin-bottom: 0;
}

html[data-theme] .legalcase-summary-v2-page #summary_info > .accordion-item > .accordion-header {
    margin: 0;
    padding: 0 !important;
}

html[data-theme] .legalcase-summary-v2-page #summary_info > .accordion-item > .accordion-header .accordion-button {
    position: relative;
    width: 100%;
    text-align: left;
    background: var(--justis-surface-subtle) !important;
    color: var(--justis-text-primary) !important;
    border: 0;
    padding: 14px 42px 14px 16px !important;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
}

html[data-theme] .legalcase-summary-v2-page #summary_info > .accordion-item > .accordion-header .accordion-button::after {
    position: absolute;
    right: 16px;
    top: 50%;
    margin-top: -11px;
    width: 22px;
    height: 22px;
}

html[data-theme] .legalcase-summary-v2-page #summary_info > .accordion-item > .accordion-header .accordion-button:not(.collapsed) {
    background: var(--justis-surface-emphasis) !important;
    box-shadow: inset 0 -1px var(--justis-border);
}

html[data-theme] .legalcase-summary-v2-page #summary_info .accordion-body {
    padding: 12px 16px !important;
    background: var(--justis-page-bg) !important;
    color: var(--justis-text-primary);
    font-size: 14px;
    line-height: 20px;
}

html[data-theme] .legalcase-summary-v2-page #summary_info .row.bottom-border:has(> .text-bold):has(> [class*="col-"]:not(.text-bold)) {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
    gap: 4px;
    margin: 0;
    padding: 8px 0 !important;
    border-bottom: 1px solid var(--justis-border) !important;
}

html[data-theme] .legalcase-summary-v2-page #summary_info .row.bottom-border:has(> .text-bold) > [class*="col-"] {
    width: 100%;
    flex: none;
    padding: 0;
    font-size: 14px;
    line-height: 20px;
    overflow-wrap: anywhere;
    color: inherit !important;
}

html[data-theme] .legalcase-summary-v2-page #summary_info .row.bottom-border > [class*="col-"].text-bold {
    font-weight: 700;
    line-height: 20px;
}

html[data-theme] .legalcase-summary-v2-page #summary_info .row.bottom-border:has(> .text-bold) > [class*="col-"]:not(.text-bold) {
    font-weight: 400;
}

html[data-theme] .legalcase-summary-v2-page #summary_info .row.bottom-border a {
    color: var(--justis-action) !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Keep customer document search and sorting together, aligned with the list. */
.customer-legalcase-summary-layout .document-list-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 16px;
}

.customer-legalcase-summary-layout .document-list-toolbar-top {
    display: contents;
}

.customer-legalcase-summary-layout .document-list-toolbar-top > div {
    width: auto;
    padding: 0;
}

.customer-legalcase-summary-layout .document-list-search-column {
    flex: 0 1 320px;
    max-width: 100%;
}

.customer-legalcase-summary-layout .document-list-toolbar :is(.tab-rt-actions, .search_filter, .filter_document_actions, .sort_list) {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
}

.customer-legalcase-summary-layout .document-list-toolbar .filter_document_actions .row {
    margin: 0;
}

.customer-legalcase-summary-layout .document-list-toolbar .filter_document_actions [class*="col-"] {
    width: auto;
    padding: 0;
}

html[data-theme] .customer-legalcase-summary-layout #searchfilter {
    width: 100%;
    min-height: var(--justis-control-height);
    padding: 8px 12px;
    border: 1px solid var(--justis-control-border) !important;
    border-radius: var(--justis-control-radius) !important;
    background: var(--justis-control-bg) !important;
    color: var(--justis-text-primary) !important;
    font-size: 16px;
}

/* A1 Compact: persistent label, outlined subject and space before the editor. */
html[data-theme] .reply-subject-field {
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    margin-bottom: 16px;
    overflow: visible;
}

html[data-theme] .reply-subject-field > label {
    display: block;
    margin: 0 0 4px;
    padding: 0;
    border: 0;
    background: transparent !important;
    color: var(--justis-text-primary) !important;
    font-size: 16px;
    font-weight: 400;
    line-height: 20px;
}

html[data-theme] .reply-subject-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

html[data-theme] .reply-subject-field .form-control {
    flex: 1 1 auto;
    min-width: 0;
    min-height: var(--justis-control-height);
    padding: 8px 12px;
    border: 1px solid var(--justis-control-border) !important;
    border-radius: var(--justis-control-radius) !important;
    background: var(--justis-control-bg) !important;
    color: var(--justis-text-primary) !important;
    font-size: 16px;
    line-height: 22px;
}

html[data-theme] .reply-subject-field .form-control:focus {
    border-color: var(--justis-focus) !important;
    outline: 2px solid var(--justis-focus);
    outline-offset: 2px;
    box-shadow: none;
}


/* Keep the starting-price label attached to the amount at every viewport size. */
html[data-theme] .table-content .col-white .text-lg {
    display: inline-flex;
    align-items: flex-start;
    font-size: clamp(72px, 10vw, 150px) !important;
    line-height: 1;
    position: relative;
    white-space: nowrap;
}

html[data-theme] .table-content .col-white .text-lg sup {
    position: static;
    align-self: flex-start;
    font-size: 0.25em;
    line-height: 1;
    margin-top: 0.15em;
}

html[data-theme] .table-content .col-white .text-lg .sup-top {
    align-self: center;
    font-size: 20px;
    margin: 0 8px 0 0;
}

html[data-theme="dark"] .table-content .col-white.text-red :is(.text-lg, .text-md, sup) {
    color: var(--justis-danger-text) !important;
}

/*
 * Shared mobile product comparison for homepage, offer and topic pages.
 * The product copy remains database-driven; this only improves mobile reading.
 */
@media (max-width: 991.98px) {
    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) {
        background: #f4f7f9;
        padding: 32px 0;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .ht-160 {
        background: transparent !important;
        height: 32px;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile {
        background: var(--justis-surface-raised);
        border: 1px solid var(--justis-border);
        border-collapse: separate;
        border-radius: 4px;
        border-spacing: 0;
        box-shadow: 0 4px 12px rgba(0, 55, 129, 0.06);
        margin: 0;
        overflow: hidden;
        padding: 0;
        width: 100%;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tr th,
    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td {
        border-bottom: 1px solid var(--justis-border);
        padding-left: 16px;
        padding-right: 16px;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr:last-child td {
        border-bottom: 0;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tr th div,
    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td div.table-header {
        border: 0;
        margin: 0;
        padding: 20px 0;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tr th h3,
    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td h3 {
        font-size: 24px;
        line-height: 1.3;
        margin: 0;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td span {
        font-size: 16px;
        line-height: 1.5;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td div.table-list {
        font-size: 16px;
        line-height: 1.5;
        padding: 16px 0 16px 32px;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-list-green > span,
    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-list-grey > span {
        left: 0;
        position: absolute;
        top: 16px;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td.np {
        align-items: center;
        display: flex;
        padding: 0;
        width: 100%;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td .col-white {
        height: auto;
        min-height: 0;
        padding: 24px 16px;
        float: none;
        border: 0;
        text-align: center;
        width: 42%;
    }

    html[data-theme] .table-content.table-mobile .col-white .text-lg {
        font-size: 64px !important;
        line-height: 1;
        margin: 0;
    }

    html[data-theme] .table-content.table-mobile .col-white .text-md {
        font-size: 20px;
        line-height: 1.4;
        margin: 8px 0 0;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td .btn-right {
        align-items: center;
        bottom: auto;
        display: flex;
        float: none;
        min-height: 0;
        padding: 16px;
        border: 0;
        position: static;
        right: auto;
        width: 58%;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile .btn {
        align-items: center;
        display: flex;
        font-size: 16px;
        justify-content: center;
        line-height: 1.4;
        min-height: 56px;
        height: auto;
        padding: 16px;
        width: 100%;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td.table-bottom-text {
        padding: 16px;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile .table-bottom-text img {
        height: auto;
        max-width: 180px;
        width: auto;
    }
}

@media (max-width: 575.98px) {
    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) {
        padding: 24px 0;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .ht-160 {
        height: 24px;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td.np {
        display: block;
    }

    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td .col-white,
    :is(.homepage-product-comparison--mobile, .product-comparison-section:has(.table-mobile)) .table-mobile tbody tr td .btn-right {
        min-height: 0;
        text-align: center;
        width: 100%;
    }
}

} /* End screen-only theme rules. */

@media print {
    .a1-theme-switcher {
        display: none !important;
    }

    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
        color-scheme: light !important;
    }
}

/* A WebDAV working copy must remain visible over selection and card borders. */
html[data-theme] .is-webdav-locked {
    border: 2px solid var(--justis-danger-text) !important;
}
