/* Shared appearance tokens for authentication and signed-in panels. */
:root {
    --app-light-scrollbar: #c6d4df;
    --app-light-scrollbar-hover: #9fb4c2;
    --app-dark-page: #17232e;
    --app-dark-surface: #22313e;
    --app-dark-inset: #1c2b37;
    --app-dark-raised: #263743;
    --app-dark-hover: #304657;
    --app-dark-border: #3a4e5e;
    --app-dark-border-hover: #65839a;
    --app-dark-divider: #263743;
    --app-dark-scrollbar: #3a4e5e;
    --app-dark-scrollbar-hover: #526b7e;
    --app-dark-text: #e6eef5;
    --app-dark-secondary: #b4c6d6;
    --app-dark-muted: #93a9bb;
    --app-dark-link: #82bee0;
    --app-dark-link-hover: #b9dff3;
    --app-dark-focus: #5ea6ce;
    --app-dark-accent: #8fc8e8;
    --app-dark-primary: #317da5;
    --app-dark-primary-hover: #286b8e;
    --app-dark-success-background: #203e34;
    --app-dark-success-border: #446e59;
    --app-dark-success-text: #b8e4c8;
    --app-dark-warning-background: #443a27;
    --app-dark-warning-border: #766344;
    --app-dark-warning-text: #eed7a6;
    --app-dark-danger-background: #432d34;
    --app-dark-danger-border: #85505a;
    --app-dark-danger-text: #f5b9bd;
    --app-dark-info-background: #20394c;
    --app-dark-info-border: #416982;
    --app-dark-info-text: #b6daf0;
}

html[data-app-theme="dark"] {
    --app-sidebar-background: var(--app-dark-surface);
    --app-sidebar-border: var(--app-dark-border);
    --app-sidebar-control-background: var(--app-dark-raised);
    --app-sidebar-control-hover: var(--app-dark-hover);
    --app-sidebar-counter-background: var(--app-dark-border);
    --app-sidebar-counter-hover: #456175;
    --app-sidebar-submenu-background: #2b3e4d;
    --app-sidebar-focus: var(--app-dark-focus);
    --app-sidebar-text: var(--app-dark-secondary);
    --app-sidebar-text-strong: var(--app-dark-text);
}

/* Keep native and plugin scrollbars consistent within each appearance. */
html[data-app-theme="light"] {
    scrollbar-color: #c6d4df transparent;
    scrollbar-color: var(--app-light-scrollbar) transparent;
}

html[data-app-theme="dark"] {
    scrollbar-color: #3a4e5e transparent;
    scrollbar-color: var(--app-dark-scrollbar) transparent;
}

html[data-app-theme]::-webkit-scrollbar-track,
html[data-app-theme] ::-webkit-scrollbar-track,
html[data-app-theme]::-webkit-scrollbar-corner,
html[data-app-theme] ::-webkit-scrollbar-corner {
    background: transparent;
}

html[data-app-theme="light"]::-webkit-scrollbar-thumb,
html[data-app-theme="light"] ::-webkit-scrollbar-thumb {
    background-color: #c6d4df;
    background-color: var(--app-light-scrollbar);
    border-radius: 6px;
}

html[data-app-theme="light"]::-webkit-scrollbar-thumb:hover,
html[data-app-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background-color: #9fb4c2;
    background-color: var(--app-light-scrollbar-hover);
}

html[data-app-theme="dark"]::-webkit-scrollbar-thumb,
html[data-app-theme="dark"] ::-webkit-scrollbar-thumb {
    background-color: #3a4e5e;
    background-color: var(--app-dark-scrollbar);
    border-radius: 6px;
}

html[data-app-theme="dark"]::-webkit-scrollbar-thumb:hover,
html[data-app-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background-color: #526b7e;
    background-color: var(--app-dark-scrollbar-hover);
}

html[data-app-theme] .public-language-options::-webkit-scrollbar,
html[data-app-theme] .app-theme-menu-options::-webkit-scrollbar,
html[data-app-theme] .dropdown-menu::-webkit-scrollbar,
html[data-app-theme] .select2-results__options::-webkit-scrollbar,
html[data-app-theme] .phone-country-search-results::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

/* Standard scrollbar colours override WebKit styling in newer Chromium. */
@supports selector(::-webkit-scrollbar) {
    html[data-app-theme] {
        scrollbar-color: auto;
    }
}

@supports not selector(::-webkit-scrollbar) {
    html[data-app-theme] .public-language-options,
    html[data-app-theme] .app-theme-menu-options,
    html[data-app-theme] .dropdown-menu,
    html[data-app-theme] .select2-results__options,
    html[data-app-theme] .phone-country-search-results {
        scrollbar-width: thin;
    }
}

html[data-app-theme="light"] .slimScrollBar {
    background: #c6d4df !important;
    background: var(--app-light-scrollbar) !important;
}

html[data-app-theme="light"] .slimScrollBar:hover {
    background: #9fb4c2 !important;
    background: var(--app-light-scrollbar-hover) !important;
}

/* The established Light sidebar remains dark and retains a matching thumb. */
html[data-app-theme="light"] .main-sidebar {
    --app-light-scrollbar: #3f545f;
    --app-light-scrollbar: var(--app-sidebar-border, #3f545f);
    --app-light-scrollbar-hover: #526b7e;
}

html[data-app-theme="light"] .main-sidebar .slimScrollBar {
    background: #3f545f !important;
    background: var(--app-light-scrollbar) !important;
}

html[data-app-theme="light"] .main-sidebar .slimScrollBar:hover {
    background: #526b7e !important;
    background: var(--app-light-scrollbar-hover) !important;
}

html[data-app-theme="dark"] .slimScrollBar {
    background: #3a4e5e !important;
    background: var(--app-dark-scrollbar) !important;
}

html[data-app-theme="dark"] .slimScrollBar:hover {
    background: #526b7e !important;
    background: var(--app-dark-scrollbar-hover) !important;
}

html[data-app-theme="dark"] .skin-blue .main-sidebar,
html[data-app-theme="dark"] .skin-blue .left-side,
html[data-app-theme="dark"] .skin-blue .wrapper {
    background: #22313e;
    background: var(--app-dark-surface);
}

/* Expanded groups retain the lighter submenu surface of the original navigation. */
html[data-app-theme="dark"] .skin-blue .sidebar-menu > li > .treeview-menu {
    background: #2b3e4d;
    background: var(--app-sidebar-submenu-background);
}

html[data-app-theme="dark"] .skin-blue .main-sidebar,
html[data-app-theme="dark"] .app-sidebar-user-panel {
    border-color: #3a4e5e;
    border-color: var(--app-dark-border);
}

/* Keep the divider inside the sidebar without changing navigation widths. */
html[data-app-theme="dark"] .skin-blue .main-sidebar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: #3a4e5e;
    background: var(--app-sidebar-border);
    pointer-events: none;
}

html[data-app-theme="dark"] .skin-blue .main-sidebar .copyright-box {
    background: #22313e;
    background: var(--app-dark-surface);
    border-color: #3a4e5e;
    border-color: var(--app-dark-border);
    color: #93a9bb;
    color: var(--app-dark-muted);
}

html[data-app-theme="dark"] .skin-blue .main-sidebar .copyright-box a:not(:hover) {
    color: inherit;
}

html[data-app-theme="dark"] .skin-blue .main-sidebar .copyright-box a:hover {
    color: #82bee0;
    color: var(--app-dark-link);
}

html[data-app-theme="dark"] .skin-blue .main-sidebar .copyright-box .divider {
    color: #65839a;
    color: var(--app-dark-border-hover);
}

html[data-app-theme="dark"] .skin-blue .sidebar-menu > li > a,
html[data-app-theme="dark"] .skin-blue .main-sidebar .sidebar-menu > li > a:focus {
    color: #b4c6d6;
    color: var(--app-dark-secondary);
}

html[data-app-theme="dark"] .skin-blue .treeview-menu > li > a,
html[data-app-theme="dark"] .skin-blue .main-sidebar .treeview-menu > li > a:focus {
    color: #93a9bb;
    color: var(--app-dark-muted);
}

html[data-app-theme="dark"] .skin-blue .sidebar-menu > li.active > a,
html[data-app-theme="dark"] .skin-blue .sidebar-menu > li:hover > a,
html[data-app-theme="dark"] .skin-blue .main-sidebar .sidebar-menu > li.active > a:focus,
html[data-app-theme="dark"] .skin-blue .main-sidebar .sidebar-menu > li:hover > a:focus {
    background: #17232e;
    background: var(--app-dark-page);
    border-left-color: #5ea6ce;
    border-left-color: var(--app-dark-focus);
    color: #e6eef5;
    color: var(--app-dark-text);
}

html[data-app-theme="dark"] .skin-blue .treeview-menu > li.active > a,
html[data-app-theme="dark"] .skin-blue .treeview-menu > li > a:hover,
html[data-app-theme="dark"] .skin-blue .main-sidebar .treeview-menu > li.active > a:focus,
html[data-app-theme="dark"] .skin-blue .main-sidebar .treeview-menu > li > a:hover:focus {
    color: #e6eef5;
    color: var(--app-dark-text);
}

html[data-app-theme="dark"] .app-sidebar-user-menu-items,
html[data-app-theme="dark"] .app-sidebar-user-menu-items > li > a,
html[data-app-theme="dark"] .app-sidebar-user-menu-items > li > a:focus {
    background: #263743;
    background: var(--app-dark-raised);
    border-color: #3a4e5e;
    border-color: var(--app-dark-border);
    color: #e6eef5;
    color: var(--app-dark-text);
}

html[data-app-theme="dark"] .app-sidebar-user-menu-items > li + li {
    border-color: #3a4e5e;
    border-color: var(--app-dark-border);
}

html[data-app-theme="dark"] .app-sidebar-user-dropdown.open .app-sidebar-user-trigger,
html[data-app-theme="dark"] .app-sidebar-user-trigger:hover,
html[data-app-theme="dark"] .app-sidebar-user-menu-items > li > a:hover {
    background: #304657;
    background: var(--app-dark-hover);
    color: #e6eef5;
    color: var(--app-dark-text);
}

/* Sidebar controls share the authentication palette without changing their layout. */
html[data-app-theme="dark"] .main-sidebar .sidebar-toggle .icon-toggle {
    background: #263743;
    background: var(--app-dark-raised);
    border-color: #3a4e5e;
    border-color: var(--app-dark-border);
    color: #b4c6d6;
    color: var(--app-dark-secondary);
}

html[data-app-theme="dark"] .main-sidebar .sidebar-toggle:hover .icon-toggle,
html[data-app-theme="dark"] .main-sidebar .sidebar-toggle:focus .icon-toggle {
    background: #304657;
    background: var(--app-dark-hover);
    border-color: #65839a;
    border-color: var(--app-dark-border-hover);
    color: #e6eef5;
    color: var(--app-dark-text);
}

html[data-app-theme="dark"] .sidebar-collapse .main-sidebar:hover .sidebar-toggle::after {
    position: absolute;
    box-shadow: 20px 0 30px rgba(94, 166, 206, 0.22);
}

html[data-app-theme="dark"] .switch-profile-box {
    background: #22313e !important;
    background: var(--app-dark-surface) !important;
}

html[data-app-theme="dark"] #switch_profile,
html[data-app-theme="dark"] .switch-profile-box .select2-selection--single,
html[data-app-theme="dark"] .switch-profile-box .select2-dropdown,
html[data-app-theme="dark"] .eto-availability-status-box .select2-selection--single,
html[data-app-theme="dark"] .eto-availability-status-box .select2-dropdown {
    background-color: #1c2b37 !important;
    background-color: var(--app-dark-inset) !important;
    border-color: #3a4e5e !important;
    border-color: var(--app-dark-border) !important;
    color: #e6eef5 !important;
    color: var(--app-dark-text) !important;
}

html[data-app-theme="dark"] .switch-profile-box .select2-selection--single > span,
html[data-app-theme="dark"] .eto-availability-status-box .select2-selection--single > span {
    color: #e6eef5 !important;
    color: var(--app-dark-text) !important;
}

html[data-app-theme="dark"] .switch-profile-box .select2-results__option,
html[data-app-theme="dark"] .eto-availability-status-box .select2-results__option {
    background-color: #1c2b37;
    background-color: var(--app-dark-inset);
    color: #e6eef5;
    color: var(--app-dark-text);
}

html[data-app-theme="dark"] .switch-profile-box .select2-results__option[aria-selected="true"],
html[data-app-theme="dark"] .switch-profile-box .select2-results__option--highlighted[aria-selected],
html[data-app-theme="dark"] .eto-availability-status-box .select2-results__option[aria-selected="true"],
html[data-app-theme="dark"] .eto-availability-status-box .select2-results__option--highlighted[aria-selected] {
    background-color: #286b8e !important;
    background-color: var(--app-dark-primary-hover) !important;
    color: #e6eef5 !important;
    color: var(--app-dark-text) !important;
}

html[data-app-theme="dark"] .skin-blue .navbar-nav > li > a:hover,
html[data-app-theme="dark"] .skin-blue .navbar-nav > li > a:focus,
html[data-app-theme="dark"] .skin-blue .navbar-nav > .open > a {
    background: #304657;
    background: var(--app-dark-hover);
}

/* Complete native dialog fields and validation without changing plugin geometry. */
html[data-app-theme="dark"] .swal2-popup .swal2-file,
html[data-app-theme="dark"] .swal2-popup .swal2-input,
html[data-app-theme="dark"] .swal2-popup .swal2-textarea,
html[data-app-theme="dark"] .swal2-popup .swal2-select {
    background-color: #1c2b37;
    background-color: var(--app-dark-inset);
    border-color: #3a4e5e;
    border-color: var(--app-dark-border);
    color: #e6eef5;
    color: var(--app-dark-text);
}

html[data-app-theme="dark"] .swal2-popup .swal2-file:focus,
html[data-app-theme="dark"] .swal2-popup .swal2-input:focus,
html[data-app-theme="dark"] .swal2-popup .swal2-textarea:focus,
html[data-app-theme="dark"] .swal2-popup .swal2-select:focus {
    border-color: #5ea6ce;
    border-color: var(--app-dark-focus);
    outline: 2px solid #5ea6ce;
    outline: 2px solid var(--app-dark-focus);
    outline-offset: 2px;
}

html[data-app-theme="dark"] .swal2-popup .swal2-validation-message {
    background: #432d34;
    background: var(--app-dark-danger-background);
    color: #f5b9bd;
    color: var(--app-dark-danger-text);
}

html[data-app-theme="dark"] .swal2-popup .swal2-validation-message::before {
    background-color: #85505a;
    background-color: var(--app-dark-danger-border);
}

html[data-app-theme="dark"] .swal2-popup .swal2-footer {
    border-color: #263743;
    border-color: var(--app-dark-divider);
    color: #b4c6d6;
    color: var(--app-dark-secondary);
}

html[data-app-theme="dark"] .swal2-popup .swal2-close {
    color: #b4c6d6;
    color: var(--app-dark-secondary);
}

html[data-app-theme="dark"] .swal2-popup .swal2-close:hover,
html[data-app-theme="dark"] .swal2-popup .swal2-close:focus {
    color: #b9dff3;
    color: var(--app-dark-link-hover);
}

html[data-app-theme="dark"] .btn-primary:focus,
html[data-app-theme="dark"] .btn-primary.focus {
    background-color: #286b8e;
    background-color: var(--app-dark-primary-hover);
    border-color: #5ea6ce;
    border-color: var(--app-dark-focus);
}

html[data-app-theme="dark"] .alert-success,
html[data-app-theme="dark"] .callout.callout-success {
    background-color: #203e34 !important;
    background-color: var(--app-dark-success-background) !important;
    border-color: #446e59;
    border-color: var(--app-dark-success-border);
    color: #b8e4c8 !important;
    color: var(--app-dark-success-text) !important;
}

html[data-app-theme="dark"] .alert-warning,
html[data-app-theme="dark"] .callout.callout-warning {
    background-color: #443a27 !important;
    background-color: var(--app-dark-warning-background) !important;
    border-color: #766344;
    border-color: var(--app-dark-warning-border);
    color: #eed7a6 !important;
    color: var(--app-dark-warning-text) !important;
}

html[data-app-theme="dark"] .alert-danger,
html[data-app-theme="dark"] .alert-error,
html[data-app-theme="dark"] .callout.callout-danger {
    background-color: #432d34 !important;
    background-color: var(--app-dark-danger-background) !important;
    border-color: #85505a;
    border-color: var(--app-dark-danger-border);
    color: #f5b9bd !important;
    color: var(--app-dark-danger-text) !important;
}

html[data-app-theme="dark"] .alert-info,
html[data-app-theme="dark"] .callout.callout-info {
    background-color: #20394c !important;
    background-color: var(--app-dark-info-background) !important;
    border-color: #416982;
    border-color: var(--app-dark-info-border);
    color: #b6daf0 !important;
    color: var(--app-dark-info-text) !important;
}

html[data-app-theme="dark"] .text-success {
    color: #b8e4c8;
    color: var(--app-dark-success-text);
}

html[data-app-theme="dark"] .text-warning {
    color: #eed7a6;
    color: var(--app-dark-warning-text);
}

html[data-app-theme="dark"] .text-info {
    color: #b6daf0;
    color: var(--app-dark-info-text);
}

html[data-app-theme="dark"] .alert a,
html[data-app-theme="dark"] .callout a {
    color: inherit;
    text-decoration: underline;
}

.app-theme-control {
    align-items: center;
    color: inherit;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 4px 8px;
    text-align: left;
    white-space: normal;
}

.app-theme-options {
    display: flex;
    flex: 0 0 auto;
}

.app-theme-options button {
    background: rgba(49, 125, 165, .04);
    border: 0;
    border-radius: 6px;
    color: #71828d;
    flex: 0 0 36px;
    font-size: 14px;
    margin-right: 6px;
    min-height: 36px;
    padding: 6px;
    width: 36px;
}

.app-theme-options button:last-child {
    margin-right: 0;
}

.app-theme-options button[aria-pressed="true"] {
    background: rgba(49, 125, 165, .14);
    color: #276481;
}

.app-theme-options button:hover {
    background: rgba(49, 125, 165, .07);
}

.app-theme-options button[aria-pressed="true"]:hover {
    background: rgba(49, 125, 165, .18);
}

.app-theme-options button:focus {
    outline: 2px solid #5ea6ce;
    outline-offset: 2px;
}

.app-sidebar-user-menu-items .app-theme-options button,
html[data-app-theme="dark"] .app-theme-options button {
    background: rgba(173, 203, 222, .05);
    color: #a3b6c3;
}

.app-sidebar-user-menu-items .app-theme-options button[aria-pressed="true"],
html[data-app-theme="dark"] .app-theme-options button[aria-pressed="true"] {
    background: rgba(173, 203, 222, .16);
    color: #d4e4ee;
}

.app-sidebar-user-menu-items .app-theme-options button:hover,
html[data-app-theme="dark"] .app-theme-options button:hover {
    background: rgba(173, 203, 222, .08);
}

.app-sidebar-user-menu-items .app-theme-options button[aria-pressed="true"]:hover,
html[data-app-theme="dark"] .app-theme-options button[aria-pressed="true"]:hover {
    background: rgba(173, 203, 222, .2);
}

.app-sidebar-user-menu-items .app-theme-options button,
.admin-topbar-user-actions .app-theme-options button,
.driver-topbar-user-actions .app-theme-options button {
    cursor: pointer;
}

html[data-app-theme="light"] .admin-topbar-user-actions .app-theme-options button,
html[data-app-theme="light"] .driver-topbar-user-actions .app-theme-options button {
    background: #e7eef2;
    box-shadow: inset 0 0 0 1px #ccd9e1;
    color: #526977;
}

html[data-app-theme="light"] .admin-topbar-user-actions .app-theme-options button[aria-pressed="true"],
html[data-app-theme="light"] .driver-topbar-user-actions .app-theme-options button[aria-pressed="true"] {
    background: #dce9f0;
    box-shadow: inset 0 0 0 1px #aac4d3;
    color: #215f80;
}

html[data-app-theme="light"] .admin-topbar-user-actions .app-theme-options button:hover,
html[data-app-theme="light"] .driver-topbar-user-actions .app-theme-options button:hover {
    background: #d1e3ed;
    box-shadow: inset 0 0 0 1px #91b3c7;
    color: #215f80;
}

html[data-app-theme="light"] .admin-topbar-user-actions .app-theme-options button[aria-pressed="true"]:hover,
html[data-app-theme="light"] .driver-topbar-user-actions .app-theme-options button[aria-pressed="true"]:hover {
    background: #c7ddea;
    box-shadow: inset 0 0 0 1px #8fb4c9;
}

.app-sidebar-user-menu-items .app-theme-options button:hover,
html[data-app-theme="dark"] .admin-topbar-user-actions .app-theme-options button:hover,
html[data-app-theme="dark"] .driver-topbar-user-actions .app-theme-options button:hover {
    background: rgba(173, 203, 222, .16);
    box-shadow: inset 0 0 0 1px rgba(173, 203, 222, .3);
    color: #e6eef5;
}

.app-sidebar-user-menu-items .app-theme-options button[aria-pressed="true"]:hover,
html[data-app-theme="dark"] .admin-topbar-user-actions .app-theme-options button[aria-pressed="true"]:hover,
html[data-app-theme="dark"] .driver-topbar-user-actions .app-theme-options button[aria-pressed="true"]:hover {
    background: rgba(173, 203, 222, .24);
}

.app-sidebar-user-menu-items .app-theme-control {
    padding: 10px 8px;
}

.admin-topbar-user-actions .app-theme-control,
.driver-topbar-user-actions .app-theme-control {
    padding: 6px 0;
    width: 100%;
}

.app-theme-storage-error {
    display: block;
    flex: 1 1 100%;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 8px;
}

.app-theme-storage-error[hidden] {
    display: none;
}

@supports selector(:focus-visible) {
    html[data-app-theme="dark"] .app-sidebar-user-trigger:focus-visible,
    html[data-app-theme="dark"] .app-sidebar-user-menu-items > li > a:focus-visible {
        background: #304657;
        background: var(--app-dark-hover);
        color: #e6eef5;
        color: var(--app-dark-text);
    }

    .app-theme-options button:focus:not(:focus-visible) {
        outline: none;
    }
}
