/* Native scrollbars: theme colours only; preserve browser scrolling, controls and hit areas. */
:root {
    --portal-scrollbar-track: #f1f5f9;
    --portal-scrollbar-thumb: #64748b;
    --portal-scrollbar-thumb-hover: #475569;
}
html.dark {
    --portal-scrollbar-track: #1e293b;
    --portal-scrollbar-thumb: #64748b;
    --portal-scrollbar-thumb-hover: #94a3b8;
}

/* Inherited by page, sidebar, dropdown and other nested scrolling areas.
   Keep the default width, including any existing SimpleBar hiding rules. */
@media (forced-colors: none) {
    html { scrollbar-color: var(--portal-scrollbar-thumb) var(--portal-scrollbar-track); }

    /* Older Chromium/Safari: ignored by browsers without these pseudo-elements. */
    @supports not (scrollbar-color: auto) {
        ::-webkit-scrollbar { background-color: var(--portal-scrollbar-track); }
        ::-webkit-scrollbar-track,
        ::-webkit-scrollbar-corner { background-color: var(--portal-scrollbar-track); }
        ::-webkit-scrollbar-thumb {
            background-color: var(--portal-scrollbar-thumb);
            border: 3px solid var(--portal-scrollbar-track);
            border-radius: 999px;
        }
        ::-webkit-scrollbar-thumb:hover,
        ::-webkit-scrollbar-thumb:active { background-color: var(--portal-scrollbar-thumb-hover); }
    }
}
/* High-contrast mode retains system-provided scrollbar colours. */
@media (forced-colors: active) {
    html { scrollbar-color: auto; }
}

/* Dashboard/notification actions follow the subtle Process Job button treatment.
   Retain semantic colours and leave light mode, text links and status badges alone. */
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a):is(
    .bg-green-100, .bg-green-600, .bg-emerald-100,
    .bg-red-100, .bg-red-600, .bg-yellow-600,
    .bg-sky-100, .bg-sky-600, .bg-gray-100
):not(.hidden) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: .25rem .75rem;
    border: 0;
    border-radius: .375rem;
    box-shadow: none;
    font-size: .75rem;
    font-weight: 500;
    background-color: rgb(var(--action-tone) / .3);
    color: var(--action-text);
    transition: background-color 150ms ease, color 150ms ease;
}
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a):is(.bg-green-100, .bg-green-600, .bg-emerald-100) {
    --action-tone: 6 78 59; --action-text: #6ee7b7;
}
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a):is(.bg-red-100, .bg-red-600) {
    --action-tone: 127 29 29; --action-text: #fca5a5;
}
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a).bg-yellow-600 {
    --action-tone: 120 53 15; --action-text: #fcd34d;
}
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a):is(.bg-sky-100, .bg-sky-600) {
    --action-tone: 12 74 110; --action-text: #7dd3fc;
}
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a).bg-gray-100 {
    --action-tone: 71 85 105; --action-text: #cbd5e1;
}
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a):is(
    .bg-green-100, .bg-green-600, .bg-emerald-100,
    .bg-red-100, .bg-red-600, .bg-yellow-600,
    .bg-sky-100, .bg-sky-600, .bg-gray-100
):hover { background-color: rgb(var(--action-tone) / .5); }
html.dark :is(.dashboard-screen, .notification-alerts) :is(button, a):focus-visible {
    outline: 2px solid #38bdf8; outline-offset: 3px;
}

@view-transition {
    navigation:auto;
}

::view-transition-group(root){
    animation-duration:300ms;
}

.light.login-page body { background:none!important; }
.table-heading-control input[type=text] { margin:0!important; }
/* Select2 */
html .select2-container > .selection > .select2-selection{ font-weight:normal!important; font-size:.875rem!important; border-color:rgb(226 232 240)!important; }
html.dark .select2-container > .selection > .select2-selection{ border-color:rgb(51 65 85)!important; background:rgb(15 23 42)!important; }
.select2-container--default .select2-results__option--selected { background:#eee!important;}
html.dark .select2-container--default .select2-results__option--selected { background:rgba(255,255,255,.05)!important;}
.select2-container--default .select2-search--dropdown .select2-search__field,.select2-dropdown {  border-color:#ddd!important; outline:none!important; border-radius:4px;}
html.dark .select2-container--default .select2-search--dropdown .select2-search__field,html.dark .select2-dropdown {  background:rgb(15 23 42)!important; border-color:rgb(51 65 85)!important;}
html.dark .select2-dropdown { background:rgb(15 23 42)!important;color:rgb(203 213 225)!important;}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background:rgb(14 165 233)!important;}
html.dark .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background:rgb(14 165 233)!important;}
.select2-container--default .select2-selection--single { height:38px!important;}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height:38px!important;}
.select2-container--default .select2-selection--single .select2-selection__arrow { height:38px!important;}
.select2-container--default .select2-selection--single .select2-selection__clear { position:absolute; right:10px; top:5px;}
.select2-container .select2-selection--multiple { min-height:38px!important;}
.select2-container--default .select2-selection--multiple .select2-selection__choice { background:#eee; color:#333; border-color:#ddd;}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color:#333; border-left:none;}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { background:none!important; color:#333;}
html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice { background:rgba(15 23 42); color:rgb(203 213 225); border-color:rgb(51 65 85);}
html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color:rgb(203 213 225); border-left:none;}
html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { background:none!important; color:rgb(203 213 225);}
html.dark .select2-container > .selection > .select2-selection,.select2-container--default .select2-selection--single .select2-selection__rendered:is(.dark *) {color: rgb(203 213 225);}
th .select2-container--default .select2-selection--single .select2-selection__arrow b { margin-left:-24px;}
html.dark hr { opacity:.2;}
.filtered .filter-icon { background:rgb(14 165 233); color:#fff; }
/* Dropzone */
html.dark .dropzone .dz-message .dz-button { color:rgb(255 255 255)!important; }
.dashcode-app .ql-editor { background:#fff;}
.history-section hr { margin-top:40px;}
#history_form textarea { min-height:300px;}

.table-td { padding: 1.25rem 1rem; }

.form-select { background:none!important;}

textarea.form-control { min-height:210px!important;}

.auth-box > div > div > div > a { justify-content:center!important; }
.auth-box > div > div > div > a img { height:inherit!important;}
.auth-box .collapsed-logo { display:none!important; }
.extend .extended-logo { display:block!important; }
.extend .collapsed-logo { display:none!important; }
.collapsed .collapsed-logo{ display:block!important; }
.collapsed .extended-logo { display:none!important; }

table.table-fixed tr {
    animation-name: animateIn;
    animation-duration: 350ms;
    animation-delay: calc(var(--animation-order) * 100ms);
    animation-fill-mode: backwards;
    animation-timing-function: ease-in-out;
    }

@media (min-width: 768px) {
    .app-header:where([dir="ltr"], [dir="ltr"] *), .content-wrapper:where([dir="ltr"], [dir="ltr"] *), .site-footer:where([dir="ltr"], [dir="ltr"] *) {
        margin-left:248px;
        }
    .card-body { overflow-x:auto;}
}

@keyframes animateIn {
    0% {opacity: 0; transform: translateY(5px)}
    100% {opacity: 1;}
    }
