/*
    StoreOffice theme
    Brand colours come from the logo: blue gradient #0058D9 -> #0098FD and the neutral grey of the word mark.
    Soft, brand-forward look: blue-tinted page, white cards with soft shadows, the gradient on primary actions,
    the active menu item and the headline figure of the dashboard.
    Loaded after main.css and data-grid.css, so it only overrides Bootstrap / Havit variables and the layout chrome.
*/

/* ------------------------------------------------------------------ */
/* Tokens                                                             */
/* ------------------------------------------------------------------ */

:root,
[data-bs-theme=light],
[data-bs-theme=auto] {
    --so-blue-dark: #0058D9;
    --so-blue: #0068E0;
    --so-blue-light: #0098FD;
    --so-gradient: linear-gradient(135deg, #0058D9 0%, #0098FD 100%);
    --so-gradient-hover: linear-gradient(135deg, #004FC4 0%, #0089EA 100%);
    --so-gradient-soft: linear-gradient(135deg, rgba(0, 88, 217, .09) 0%, rgba(0, 152, 253, .09) 100%);
    --so-brand-shadow: 0 6px 16px -6px rgba(0, 104, 224, .55);

    --so-page-bg: #F4F7FB;
    --so-surface: #FFFFFF;
    --so-surface-muted: #F7F9FC;
    --so-border: #E6EBF2;
    --so-border-strong: #D5DDE8;
    --so-text: #142033;
    --so-text-muted: #66738A;
    --so-text-subtle: #97A2B4;
    --so-sidebar-bg: #FFFFFF;
    --so-sidebar-text: #3A475C;
    --so-sidebar-icon: #8E9AAE;
    --so-header-bg: rgba(244, 247, 251, .8);
    --so-shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --so-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px -2px rgba(16, 24, 40, .06);
    --so-shadow-md: 0 2px 4px rgba(16, 24, 40, .04), 0 10px 24px -6px rgba(16, 24, 40, .1);
    --so-shadow-lg: 0 18px 36px -10px rgba(16, 24, 40, .18), 0 4px 10px -4px rgba(16, 24, 40, .06);
    --so-focus-ring: rgba(0, 120, 235, .2);
    --so-positive: #0F7A55;
    --so-positive-bg: #E3F6EE;
    --so-negative: #C0341F;
    --so-negative-bg: #FDECE9;
    --so-radius-sm: 8px;
    --so-radius: 10px;
    --so-radius-lg: 16px;
    --so-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --bs-primary: #0068E0;
    --bs-primary-rgb: 0, 104, 224;
    --bs-primary-text-emphasis: #0047A3;
    --bs-primary-bg-subtle: #E8F1FF;
    --bs-primary-border-subtle: #B8D5FF;
    --bs-link-color: #0068E0;
    --bs-link-color-rgb: 0, 104, 224;
    --bs-link-hover-color: #0058D9;
    --bs-link-hover-color-rgb: 0, 88, 217;
    --bs-body-font-family: var(--so-font);
    --bs-body-font-size: .9375rem;
    --bs-body-color: #142033;
    --bs-body-color-rgb: 20, 32, 51;
    --bs-emphasis-color: #0B1424;
    --bs-secondary-color: #66738A;
    --bs-tertiary-color: #97A2B4;
    --bs-secondary-bg: #EEF2F7;
    --bs-tertiary-bg: #F7F9FC;
    --bs-border-color: #E6EBF2;
    --bs-border-color-translucent: rgba(15, 35, 70, .08);
    --bs-border-radius: .625rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: .875rem;
    --bs-border-radius-xl: 1rem;
    --bs-focus-ring-color: var(--so-focus-ring);
    --bs-table-bg: transparent;

    --hx-sidebar-width: 260px;
    --hx-sidebar-background-color: var(--so-sidebar-bg);
    --hx-sidebar-brand-logo-width: 160px;
    --hx-sidebar-brand-logo-height: 34px;
    --hx-sidebar-header-padding: 1.5rem 1.25rem 1.5rem 1.375rem;
    --hx-sidebar-body-padding: 0 .875rem 1rem .875rem;
    --hx-sidebar-body-nav-gap: 2px;
    --hx-sidebar-footer-padding: .75rem .875rem 1rem .875rem;
    --hx-sidebar-item-font-size: .90625rem;
    --hx-sidebar-item-content-gap: .75rem;
    --hx-sidebar-item-padding: .625rem .75rem;
    --hx-sidebar-item-border-radius: var(--so-radius);
    --hx-sidebar-item-color: var(--so-sidebar-text);
    --hx-sidebar-item-icon-color: var(--so-sidebar-icon);
    --hx-sidebar-item-hover-color: var(--so-text);
    --hx-sidebar-item-hover-icon-color: var(--bs-primary);
    --hx-sidebar-item-hover-background-color: var(--bs-primary-rgb);
    --hx-sidebar-item-hover-background-opacity: .06;
    --hx-sidebar-item-active-color: #fff;
    --hx-sidebar-item-active-icon-color: #fff;
    --hx-sidebar-item-active-background-color: var(--bs-primary-rgb);
    --hx-sidebar-item-active-background-opacity: 1;
    --hx-sidebar-item-active-font-weight: 600;
    --hx-sidebar-parent-item-active-color: var(--so-text);
    --hx-sidebar-parent-item-active-font-weight: 600;
    --hx-sidebar-parent-item-active-icon-color: var(--bs-primary);
    --hx-sidebar-subitem-font-size: .875rem;
    --hx-sidebar-subitem-padding: .5rem .75rem;
    --hx-sidebar-subitem-margin: 0 0 0 2.125rem;
}

[data-bs-theme=dark] {
    --so-blue: #4A9EFF;
    --so-gradient-soft: linear-gradient(135deg, rgba(0, 88, 217, .2) 0%, rgba(0, 152, 253, .2) 100%);
    --so-brand-shadow: 0 6px 18px -6px rgba(0, 120, 255, .6);
    --so-page-bg: #0B1120;
    --so-surface: #121A2B;
    --so-surface-muted: #162036;
    --so-border: #212D45;
    --so-border-strong: #2C3A57;
    --so-text: #E8EDF5;
    --so-text-muted: #8E9BB2;
    --so-text-subtle: #67748C;
    --so-sidebar-bg: #0E1626;
    --so-sidebar-text: #C5CEDC;
    --so-sidebar-icon: #6F7D95;
    --so-header-bg: rgba(11, 17, 32, .8);
    --so-shadow-xs: none;
    --so-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --so-shadow-md: 0 10px 24px -6px rgba(0, 0, 0, .5);
    --so-shadow-lg: 0 18px 36px -10px rgba(0, 0, 0, .6);
    --so-focus-ring: rgba(74, 158, 255, .3);
    --so-positive: #4ADE9B;
    --so-positive-bg: rgba(74, 222, 155, .12);
    --so-negative: #FF8A7A;
    --so-negative-bg: rgba(255, 138, 122, .12);

    --bs-primary: #4A9EFF;
    --bs-primary-rgb: 74, 158, 255;
    --bs-primary-text-emphasis: #93C5FD;
    --bs-primary-bg-subtle: #0C2547;
    --bs-primary-border-subtle: #1D4A85;
    --bs-link-color: #6BB0FF;
    --bs-link-color-rgb: 107, 176, 255;
    --bs-link-hover-color: #93C5FD;
    --bs-link-hover-color-rgb: 147, 197, 253;
    --bs-body-bg: #121A2B;
    --bs-body-bg-rgb: 18, 26, 43;
    --bs-body-color: #E8EDF5;
    --bs-body-color-rgb: 232, 237, 245;
    --bs-emphasis-color: #FFFFFF;
    --bs-secondary-color: #8E9BB2;
    --bs-tertiary-color: #67748C;
    --bs-secondary-bg: #18233A;
    --bs-tertiary-bg: #162036;
    --bs-border-color: #212D45;
    --bs-border-color-translucent: rgba(255, 255, 255, .07);

    --rz-grid-header-background-color: var(--so-surface-muted);
    --rz-grid-header-color: var(--so-text);
    --rz-grid-cell-color: var(--so-text);
    --rz-grid-stripe-odd-background-color: var(--so-surface);
    --rz-grid-stripe-background-color: var(--so-surface);
    --rz-pager-background-color: var(--so-surface);
    --rz-pager-back-button-color: var(--so-text);
    --rz-pager-next-button-color: var(--so-text);
    --rz-pager-numeric-button-color: var(--so-text);
}

/* ------------------------------------------------------------------ */
/* Base                                                               */
/* ------------------------------------------------------------------ */

body {
    background-color: var(--so-page-bg);
    font-family: var(--so-font);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--bs-emphasis-color);
}

h3, .h3 {
    font-size: 1.4375rem;
}

h4, .h4 {
    font-size: 1.1875rem;
}

::selection {
    background: rgba(0, 152, 253, .22);
}

/* ------------------------------------------------------------------ */
/* Components                                                         */
/* ------------------------------------------------------------------ */

.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-font-size: .875rem;
    --bs-btn-padding-y: .5rem;
    --bs-btn-padding-x: 1rem;
    --bs-btn-border-radius: var(--so-radius);
    --bs-btn-focus-box-shadow: 0 0 0 .25rem var(--so-focus-ring);
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--so-blue-dark);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--so-blue-dark);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #004CBD;
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--so-blue);
    --bs-btn-disabled-border-color: transparent;
    background-image: var(--so-gradient);
    box-shadow: var(--so-brand-shadow), inset 0 1px 0 rgba(255, 255, 255, .14);
}

.btn-primary:hover {
    background-image: var(--so-gradient-hover);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary-border-subtle);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--so-blue-dark);
    --bs-btn-active-border-color: var(--so-blue-dark);
    --bs-btn-disabled-color: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary-border-subtle);
}

.btn-link {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-hover-color: var(--bs-link-hover-color);
}

.form-control,
.form-select {
    font-size: .90625rem;
    border-color: var(--so-border-strong);
    border-radius: var(--so-radius);
}

.form-control::placeholder {
    color: var(--so-text-subtle);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--so-blue-light);
    box-shadow: 0 0 0 .25rem var(--so-focus-ring);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-label {
    font-size: .84375rem;
    font-weight: 500;
}

.card {
    --bs-card-bg: var(--so-surface);
    --bs-card-border-color: var(--so-border);
    --bs-card-border-radius: var(--so-radius-lg);
    --bs-card-inner-border-radius: calc(var(--so-radius-lg) - 1px);
    --bs-card-cap-bg: transparent;
    --bs-card-cap-padding-y: .875rem;
    --bs-card-cap-padding-x: 1.25rem;
    --bs-card-spacer-x: 1.25rem;
    box-shadow: var(--so-shadow-sm);
}

.card-header {
    font-weight: 600;
    border-bottom-color: var(--so-border);
}

.card-footer {
    border-top-color: var(--so-border);
}

.table {
    --bs-table-border-color: var(--so-border);
}

.table > thead th {
    color: var(--so-text-muted);
    font-size: .8125rem;
    font-weight: 600;
}

.dropdown-menu {
    --bs-dropdown-bg: var(--so-surface);
    --bs-dropdown-border-color: var(--so-border);
    --bs-dropdown-border-radius: 12px;
    --bs-dropdown-inner-border-radius: 11px;
    --bs-dropdown-padding-x: .375rem;
    --bs-dropdown-padding-y: .375rem;
    --bs-dropdown-font-size: .90625rem;
    --bs-dropdown-item-padding-x: .75rem;
    --bs-dropdown-item-padding-y: .5rem;
    --bs-dropdown-link-color: var(--so-text);
    --bs-dropdown-link-active-bg: var(--bs-primary);
    --bs-dropdown-link-hover-bg: var(--bs-tertiary-bg);
    --bs-dropdown-header-color: var(--so-text-muted);
    --bs-dropdown-divider-bg: var(--so-border);
    box-shadow: var(--so-shadow-lg);
}

.dropdown-item {
    border-radius: var(--so-radius-sm);
}

.dropdown-header {
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.modal {
    --bs-modal-bg: var(--so-surface);
    --bs-modal-border-color: var(--so-border);
    --bs-modal-border-radius: 18px;
    --bs-modal-inner-border-radius: 17px;
    --bs-modal-header-border-color: var(--so-border);
    --bs-modal-footer-border-color: var(--so-border);
    --bs-modal-box-shadow: var(--so-shadow-lg);
}

.modal-content {
    box-shadow: var(--bs-modal-box-shadow);
}

.nav-tabs {
    --bs-nav-tabs-border-color: var(--so-border);
    --bs-nav-tabs-link-active-color: var(--bs-primary);
    --bs-nav-tabs-link-active-border-color: var(--so-border) var(--so-border) var(--bs-body-bg);
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--bs-primary);
}

.nav-link {
    --bs-nav-link-color: var(--so-text-muted);
    --bs-nav-link-hover-color: var(--bs-primary);
}

.pagination {
    --bs-pagination-color: var(--so-text);
    --bs-pagination-bg: var(--so-surface);
    --bs-pagination-border-color: var(--so-border);
    --bs-pagination-border-radius: var(--so-radius);
    --bs-pagination-hover-color: var(--bs-primary);
    --bs-pagination-hover-bg: var(--bs-tertiary-bg);
    --bs-pagination-hover-border-color: var(--so-border);
    --bs-pagination-focus-color: var(--bs-primary);
    --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--so-focus-ring);
    --bs-pagination-active-bg: var(--bs-primary);
    --bs-pagination-active-border-color: var(--bs-primary);
    --bs-pagination-disabled-bg: var(--so-surface);
    --bs-pagination-disabled-border-color: var(--so-border);
}

.badge {
    font-weight: 600;
}

.list-group {
    --bs-list-group-border-color: var(--so-border);
    --bs-list-group-active-bg: var(--bs-primary);
    --bs-list-group-active-border-color: var(--bs-primary);
}

.toast {
    --bs-toast-border-radius: 12px;
    --bs-toast-box-shadow: var(--so-shadow-lg);
}

/* ------------------------------------------------------------------ */
/* Layout: sidebar                                                    */
/* ------------------------------------------------------------------ */

.sidebar {
    border-right: 1px solid var(--so-border) !important;
}

.sidebar .hx-sidebar-brand-logo {
    text-align: left;
}

.sidebar .hx-sidebar-brand-logo img {
    width: var(--hx-sidebar-brand-logo-width);
    height: auto;
}

.sidebar a.nav-link {
    transition: background-color .15s ease, color .15s ease;
}

/* Active top level page: filled with the logo gradient */
.sidebar a.nav-link.active {
    background-image: var(--so-gradient);
    box-shadow: var(--so-brand-shadow);
}

.sidebar a.nav-link.active:hover {
    color: #fff;
}

.sidebar a.nav-link.active:hover .hx-sidebar-item-icon {
    color: #fff;
}

/* Active sub page: a quiet blue tint, the gradient stays reserved for the top level */
.sidebar .hx-sidebar-subitems a.nav-link.active,
.sidebar .hx-sidebar-subitems a.nav-link.active:hover {
    background-image: none;
    background-color: rgba(var(--bs-primary-rgb), .1);
    color: var(--bs-primary);
    box-shadow: none;
}

.sidebar-sync {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .625rem .75rem;
    border-radius: 12px;
    background: var(--so-gradient-soft);
    border: 1px solid rgba(var(--bs-primary-rgb), .14);
    color: var(--so-text);
    cursor: pointer;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.sidebar-sync:hover {
    border-color: rgba(var(--bs-primary-rgb), .28);
    box-shadow: var(--so-shadow-sm);
}

.sidebar-sync-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 9px;
    background: var(--so-gradient);
    box-shadow: var(--so-brand-shadow);
    color: #fff;
    font-size: .9375rem;
}

.sidebar-sync-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.sidebar-sync-title {
    font-weight: 600;
    font-size: .875rem;
}

.sidebar-sync-subtitle {
    white-space: nowrap;
    font-size: .75rem;
    color: var(--so-text-muted);
}

.sidebar-sync-chevron {
    margin-left: auto;
    font-size: .75rem;
    color: var(--so-text-subtle);
}

/* ------------------------------------------------------------------ */
/* Layout: header + content                                           */
/* ------------------------------------------------------------------ */

.app-content {
    min-width: 0;
}

.app-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 60px;
    padding: 0 2rem;
    background: var(--so-header-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--so-border);
    z-index: 1020;
}

.app-header-store {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-right: auto;
    min-width: 0;
}

.app-header-store-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 9px;
    background: var(--so-surface);
    box-shadow: 0 0 0 1px var(--so-border), var(--so-shadow-xs);
    color: var(--bs-primary);
    font-size: .9375rem;
}

.app-header-store-name {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--so-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: var(--so-radius);
    background: transparent;
    color: var(--so-text-muted);
    font-size: 1.0625rem;
    transition: color .15s ease, background-color .15s ease;
}

.app-header-icon-button:hover {
    color: var(--bs-primary);
    background-color: rgba(var(--bs-primary-rgb), .08);
}

.app-header-divider {
    width: 1px;
    height: 1.5rem;
    margin: 0 .5rem;
    background: var(--so-border-strong);
}

.app-header-user {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .25rem .5rem .25rem .25rem;
    border-radius: 999px;
    transition: background-color .15s ease;
}

.app-header-user:hover {
    background-color: rgba(var(--bs-primary-rgb), .07);
}

.app-header-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 50%;
    background: var(--so-gradient);
    box-shadow: 0 0 0 2px var(--so-surface), 0 0 0 3px rgba(var(--bs-primary-rgb), .25);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.app-header-user-name {
    font-weight: 500;
    font-size: .90625rem;
    color: var(--so-text);
}

.app-header-user-chevron {
    font-size: .6875rem;
    color: var(--so-text-subtle);
}

.main {
    max-width: none;
    padding: 1.75rem 2rem 3rem 2rem !important;
}

@media (max-width: 767.98px) {
    .app-header {
        position: static !important;
        padding: 0 1rem;
    }

    .main {
        padding: 1rem !important;
    }
}

/* ------------------------------------------------------------------ */
/* Background job panel                                               */
/* ------------------------------------------------------------------ */

.task-runner {
    width: 320px;
    max-width: calc(100vw - 2rem);
    right: 1.25rem;
    bottom: 1.25rem;
    overflow: hidden;
    background-color: var(--so-surface);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-lg);
    box-shadow: var(--so-shadow-lg);
    z-index: 1030;
}

.task-runner .task {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--so-border);
}

.task-runner .task:last-child {
    border-bottom: 0;
}

.task-runner .task .process {
    font-weight: 600;
}

.task-runner .task .close {
    color: var(--so-text-subtle);
}

.task-runner .task .process-status {
    margin-top: .25rem;
    font-style: normal;
    font-size: .8125rem;
    color: var(--so-text-muted);
}

.task-runner .task-checkout-number {
    padding: .5rem 1rem 0 1rem;
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--so-text-muted);
}

/* ------------------------------------------------------------------ */
/* Page header helpers (usable on any page)                           */
/* ------------------------------------------------------------------ */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-eyebrow {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: var(--so-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.page-title {
    margin: .25rem 0 .25rem 0;
    font-size: 1.75rem;
    letter-spacing: -.025em;
}

.page-subtitle {
    font-size: .90625rem;
    color: var(--so-text-muted);
    margin: 0;
}

.page-subtitle strong {
    font-weight: 600;
    color: var(--so-text);
}
