/* MultiShop backend theme tokens and component normalization. */
:root,
[data-theme="light"] {
    color-scheme: light;
    --app-bg: #ecf0f4;
    --app-surface: #ffffff;
    --app-surface-raised: #ffffff;
    --app-surface-muted: #f5f7fa;
    --app-text: #17212b;
    --app-text-strong: #031e23;
    --app-text-muted: #667085;
    --app-text-subtle: #98a2b3;
    --app-border: #d9dee7;
    --app-border-strong: #c4ccd8;
    --app-primary: #3f5aa9;
    --app-primary-hover: #31478a;
    --app-on-primary: #172033;
    --app-focus: rgba(63, 90, 169, .25);
    --app-overlay: rgba(15, 23, 42, .48);
    --app-shadow-sm: 0 2px 8px rgba(15, 23, 42, .08);
    --app-shadow-md: 0 10px 28px rgba(15, 23, 42, .14);
}

[data-theme="dark"] {
    color-scheme: dark;
    --app-bg: #111827;
    --app-surface: #1f2937;
    --app-surface-raised: #273449;
    --app-surface-muted: #253247;
    --app-text: #e5e7eb;
    --app-text-strong: #f8fafc;
    --app-text-muted: #aab6c8;
    --app-text-subtle: #8290a5;
    --app-border: #3b4a60;
    --app-border-strong: #52627a;
    --app-primary: #93a7ee;
    --app-primary-hover: #b4c2ff;
    --app-on-primary: #172033;
    --app-focus: rgba(147, 167, 238, .34);
    --app-overlay: rgba(2, 6, 23, .72);
    --app-shadow-sm: 0 2px 8px rgba(2, 6, 23, .35);
    --app-shadow-md: 0 10px 28px rgba(2, 6, 23, .5);
}

html,
body {
    background-color: var(--app-bg);
    color: var(--app-text);
}

body {
    font-family: var(--app-font-family, var(--locale-font-stack, 'Inter', sans-serif));
    font-size: var(--app-font-size-base, 14px);
    font-weight: var(--app-font-weight-body, 400);
}

h1, h2, h3, h4, h5, h6,
.card-title,
.page-header .title {
    font-weight: var(--app-font-weight-heading, 700);
}

.card, .card-box, .da-card, .page-header,
.form-control, .custom-select, select, textarea,
.dropdown-menu, .modal-content {
    border-width: var(--app-border-width, 1px);
    border-color: var(--app-border);
    border-radius: var(--app-radius-md, 8px);
}

.btn-primary {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
    color: var(--app-on-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
    color: var(--app-on-primary);
}

body,
.card,
.card-box,
.da-card,
.page-header,
.form-control,
.custom-select,
.dropdown-menu,
.modal-content,
.table,
.right-sidebar,
.notification-box,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    transition: background-color .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease;
}

[data-theme="dark"] .card,
[data-theme="dark"] .card-box,
[data-theme="dark"] .da-card,
[data-theme="dark"] .page-header,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .right-sidebar,
[data-theme="dark"] .notification-box,
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light {
    background-color: var(--app-surface) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
    box-shadow: var(--app-shadow-sm);
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-body,
[data-theme="dark"] .card-title,
[data-theme="dark"] .card-box h1,
[data-theme="dark"] .card-box h2,
[data-theme="dark"] .card-box h3,
[data-theme="dark"] .card-box h4,
[data-theme="dark"] .card-box h5,
[data-theme="dark"] .card-box h6,
[data-theme="dark"] label,
[data-theme="dark"] .form-label,
[data-theme="dark"] .col-form-label {
    color: var(--app-text) !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] small,
[data-theme="dark"] .help-block,
[data-theme="dark"] .form-text {
    color: var(--app-text-muted) !important;
}

[data-theme="dark"] a {
    color: var(--app-primary);
}

[data-theme="dark"] a:hover {
    color: var(--app-primary-hover);
}

[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-right,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-left,
[data-theme="dark"] hr,
[data-theme="dark"] .dropdown-divider,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .custom-select,
[data-theme="dark"] select,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] .select2-container--default .select2-selection--single,
[data-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border-strong) !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] .search-input::placeholder {
    color: var(--app-text-subtle) !important;
    opacity: 1;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .custom-select:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] button:focus-visible,
[data-theme="dark"] a:focus-visible,
[data-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--single,
[data-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 .2rem var(--app-focus) !important;
    outline: none;
}

[data-theme="dark"] option,
[data-theme="dark"] optgroup {
    background: var(--app-surface-raised);
    color: var(--app-text);
}

[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .select2-container--default .select2-results > .select2-results__options,
[data-theme="dark"] .select2-dropdown {
    background-color: var(--app-surface-raised) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
    box-shadow: var(--app-shadow-md);
}

[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .select2-results__option,
[data-theme="dark"] .select2-search__field {
    color: var(--app-text) !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus,
[data-theme="dark"] .select2-results__option--highlighted,
[data-theme="dark"] .select2-results__option[aria-selected="true"] {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text-strong) !important;
}

[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light > th,
[data-theme="dark"] .table-light > td {
    background-color: var(--app-surface) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text-strong) !important;
}

[data-theme="dark"] .custom-control-label::before,
[data-theme="dark"] .custom-file-label,
[data-theme="dark"] .input-group-text {
    background-color: var(--app-surface-muted);
    color: var(--app-text);
    border-color: var(--app-border-strong);
}

[data-theme="dark"] .modal-backdrop,
[data-theme="dark"] .sidebar-overlay {
    background-color: var(--app-overlay);
}

[data-theme="dark"] .btn-outline-primary {
    color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-primary:focus {
    background-color: var(--app-primary) !important;
    color: var(--app-on-primary) !important;
}

[data-theme="dark"] .alert-success { background-color: #12352d !important; color: #6ee7b7 !important; border-color: rgba(110, 231, 183, .34) !important; }
[data-theme="dark"] .alert-warning { background-color: #3a2b13 !important; color: #f8c56b !important; border-color: rgba(248, 197, 107, .34) !important; }
[data-theme="dark"] .alert-danger { background-color: #3b1d24 !important; color: #fda4af !important; border-color: rgba(253, 164, 175, .34) !important; }
[data-theme="dark"] .alert-info { background-color: #172f4d !important; color: #93c5fd !important; border-color: rgba(147, 197, 253, .34) !important; }

[data-theme="dark"] .btn:disabled,
[data-theme="dark"] .btn.disabled,
[data-theme="dark"] input:disabled,
[data-theme="dark"] select:disabled,
[data-theme="dark"] textarea:disabled {
    color: var(--app-text-subtle) !important;
    background-color: var(--app-surface-muted) !important;
    border-color: var(--app-border) !important;
    opacity: .72;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
