:root {
    --btn-radius: 10px;
    --btn-font-weight: 600;
    --btn-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    --btn-shadow-hover: 0 2px 8px rgba(15, 23, 42, 0.1);
    --btn-primary: #1e293b;
    --btn-primary-hover: #0f172a;
    --btn-primary-active: #020617;
    --btn-accent: #2563eb;
    --btn-accent-hover: #1d4ed8;
    --btn-accent-soft: #eff6ff;
    --btn-success: #059669;
    --btn-success-hover: #047857;
    --btn-success-soft: #ecfdf5;
    --btn-danger: #dc2626;
    --btn-danger-hover: #b91c1c;
    --btn-danger-soft: #fef2f2;
    --btn-neutral-border: #cbd5e1;
    --btn-neutral-text: #0f172a;
    --btn-neutral-hover-bg: #f8fafc;
    --btn-neutral-hover-border: #94a3b8;
    --btn-muted: #64748b;
    --btn-disabled-bg: #e2e8f0;
    --btn-disabled-text: #94a3b8;
}

.page-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-heading h1 {
    margin-bottom: 0;
}

/* —— Button UI kit (Bootstrap overrides) —— */
.btn {
    --bs-btn-border-radius: var(--btn-radius);
    --bs-btn-font-weight: var(--btn-font-weight);
    --bs-btn-padding-x: 0.95rem;
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-font-size: 0.925rem;
    --bs-btn-line-height: 1.25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: var(--btn-radius);
    font-weight: var(--btn-font-weight);
    line-height: 1.25;
    box-shadow: var(--btn-shadow);
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.btn:hover:not(:disabled):not(.disabled) {
    box-shadow: var(--btn-shadow-hover);
}

.btn:focus-visible {
    outline: 2px solid var(--btn-accent);
    outline-offset: 2px;
    box-shadow: var(--btn-shadow-hover);
}

.btn:active:not(:disabled):not(.disabled) {
    transform: translateY(1px);
    box-shadow: none;
}

.btn:disabled,
.btn.disabled {
    box-shadow: none;
    opacity: 1;
    background-color: var(--btn-disabled-bg) !important;
    border-color: var(--btn-disabled-bg) !important;
    color: var(--btn-disabled-text) !important;
}

.btn i,
.btn .las,
.btn .la {
    font-size: 1.1em;
    line-height: 1;
}

.btn-sm {
    --bs-btn-padding-x: 0.7rem;
    --bs-btn-padding-y: 0.32rem;
    --bs-btn-font-size: 0.8125rem;
    --bs-btn-border-radius: 8px;
    gap: 0.3rem;
}

.btn-lg {
    --bs-btn-padding-x: 1.15rem;
    --bs-btn-padding-y: 0.65rem;
    --bs-btn-font-size: 1rem;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--btn-primary);
    --bs-btn-border-color: var(--btn-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--btn-primary-hover);
    --bs-btn-hover-border-color: var(--btn-primary-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--btn-primary-active);
    --bs-btn-active-border-color: var(--btn-primary-active);
    --bs-btn-disabled-color: var(--btn-disabled-text);
    --bs-btn-disabled-bg: var(--btn-disabled-bg);
    --bs-btn-disabled-border-color: var(--btn-disabled-bg);
}

.btn-outline-primary {
    --bs-btn-color: var(--btn-accent);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #93c5fd;
    --bs-btn-hover-color: var(--btn-accent-hover);
    --bs-btn-hover-bg: var(--btn-accent-soft);
    --bs-btn-hover-border-color: var(--btn-accent);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--btn-accent);
    --bs-btn-active-border-color: var(--btn-accent);
    --bs-btn-disabled-color: var(--btn-disabled-text);
    --bs-btn-disabled-bg: #fff;
    --bs-btn-disabled-border-color: var(--btn-disabled-bg);
}

.btn-secondary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #64748b;
    --bs-btn-border-color: #64748b;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #475569;
    --bs-btn-hover-border-color: #475569;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #334155;
    --bs-btn-active-border-color: #334155;
}

.btn-outline-secondary {
    --bs-btn-color: var(--btn-neutral-text);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--btn-neutral-border);
    --bs-btn-hover-color: var(--btn-neutral-text);
    --bs-btn-hover-bg: var(--btn-neutral-hover-bg);
    --bs-btn-hover-border-color: var(--btn-neutral-hover-border);
    --bs-btn-active-color: var(--btn-neutral-text);
    --bs-btn-active-bg: #e2e8f0;
    --bs-btn-active-border-color: var(--btn-neutral-hover-border);
}

.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--btn-success);
    --bs-btn-border-color: var(--btn-success);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--btn-success-hover);
    --bs-btn-hover-border-color: var(--btn-success-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #065f46;
    --bs-btn-active-border-color: #065f46;
}

.btn-outline-success {
    --bs-btn-color: var(--btn-success);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #6ee7b7;
    --bs-btn-hover-color: var(--btn-success-hover);
    --bs-btn-hover-bg: var(--btn-success-soft);
    --bs-btn-hover-border-color: var(--btn-success);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--btn-success);
    --bs-btn-active-border-color: var(--btn-success);
}

.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--btn-danger);
    --bs-btn-border-color: var(--btn-danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--btn-danger-hover);
    --bs-btn-hover-border-color: var(--btn-danger-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #991b1b;
    --bs-btn-active-border-color: #991b1b;
}

.btn-outline-danger {
    --bs-btn-color: var(--btn-danger);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #fca5a5;
    --bs-btn-hover-color: var(--btn-danger-hover);
    --bs-btn-hover-bg: var(--btn-danger-soft);
    --bs-btn-hover-border-color: var(--btn-danger);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--btn-danger);
    --bs-btn-active-border-color: var(--btn-danger);
}

.btn-group {
    border-radius: var(--btn-radius);
    box-shadow: var(--btn-shadow);
}

.btn-group > .btn {
    box-shadow: none;
}

.btn-group > .btn:not(:first-child) {
    margin-left: -1px;
}

.btn-group > .btn:focus-visible {
    z-index: 2;
}

.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary {
    color: #fff;
    background-color: var(--btn-accent);
    border-color: var(--btn-accent);
}

/* Index: template categories as horizontal buttons */
.templates-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.templates-category-btn {
    color: var(--btn-accent);
    background-color: #fff;
    border: 1px solid var(--btn-accent);
    box-shadow: var(--btn-shadow);
}

.templates-category-btn:hover {
    color: var(--btn-accent-hover);
    background-color: var(--btn-accent-soft);
    border-color: var(--btn-accent);
}

.templates-category-btn.active,
.templates-category-btn[aria-selected="true"] {
    color: #fff;
    background-color: var(--btn-accent);
    border-color: var(--btn-accent);
}

.templates-category-btn .badge {
    font-weight: 600;
}

.templates-category-btn.active .badge,
.templates-category-btn[aria-selected="true"] .badge {
    color: var(--btn-accent);
    background-color: #fff !important;
}

.templates-category-panel {
    padding: 0.85rem 1rem;
    border: 1px solid var(--btn-neutral-border);
    border-radius: var(--btn-radius);
    background-color: #fff;
    box-shadow: var(--btn-shadow);
}

.templates-category-panel:not(.is-open) {
    display: none;
}

/* Menu toggle shares outline-secondary language */
.site-nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--btn-neutral-border);
    border-radius: var(--btn-radius);
    background: #fff;
    color: var(--btn-neutral-text);
    font-size: 0.95rem;
    font-weight: var(--btn-font-weight);
    line-height: 1;
    box-shadow: var(--btn-shadow);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.site-nav-toggle:hover,
.site-nav-toggle:focus-visible {
    background: var(--btn-neutral-hover-bg);
    border-color: var(--btn-neutral-hover-border);
    box-shadow: var(--btn-shadow-hover);
    outline: none;
}

.site-nav-toggle:focus-visible {
    outline: 2px solid var(--btn-accent);
    outline-offset: 2px;
}

.site-nav-toggle-bars {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 16px;
}

.site-nav-toggle-bars span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: #0f172a;
}

.site-drawer {
    --bs-offcanvas-width: min(320px, 88vw);
    border-right: none;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 48%, #243447 100%);
    color: #e2e8f0;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.28);
}

.site-drawer .btn-close {
    --bs-btn-close-color: #fff;
    --bs-btn-close-opacity: 0.7;
    filter: invert(1) grayscale(100%);
}

.site-drawer-header {
    align-items: flex-start;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.site-drawer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.site-drawer-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    background: linear-gradient(145deg, #38bdf8, #2563eb);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.site-drawer-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.02em;
}

.site-drawer-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.site-drawer-body {
    padding: 0.75rem 0.85rem 1rem;
    display: flex;
    flex-direction: column;
}

.site-drawer-section-label {
    margin: 0.85rem 0.75rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.site-drawer-section-label:first-child {
    margin-top: 0.25rem;
}

.site-drawer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.site-drawer-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.site-drawer-link i {
    font-size: 1.2rem;
    width: 1.25rem;
    text-align: center;
    color: #94a3b8;
    transition: color 0.15s ease;
}

.site-drawer-link:hover,
.site-drawer-link:focus-visible {
    background: rgba(148, 163, 184, 0.16);
    color: #fff;
    outline: none;
}

.site-drawer-link:hover i,
.site-drawer-link:focus-visible i {
    color: #38bdf8;
}

.site-drawer-footer {
    margin-top: auto;
    padding: 0.85rem 1rem 1.15rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.site-nav-logout {
    display: block;
    margin: 0;
}

.site-drawer-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.site-drawer-logout:hover,
.site-drawer-logout:focus-visible {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(248, 113, 113, 0.55);
    color: #fff;
    outline: none;
}

.site-drawer-logout i {
    font-size: 1.15rem;
}

.table {
    font-size: 12px;
}

.table .warehouse-data {
    font-size: 10px;
    color: gray;
}

.table .warehouse-data .warehouse-cabinet-group + .warehouse-cabinet-group {
    margin-top: 6px;
}

.table .warehouse-data .warehouse-cabinet-label {
    font-weight: 600;
    color: #555;
}

.table .warehouse-data .warehouse-stock-row {
    padding-left: 8px;
}

/* Shared page panels & data tables */
.page-panel,
.products-panel {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.page-toolbar,
.products-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #d8dee8;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.page-toolbar-meta,
.products-toolbar-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

.page-toolbar-title,
.products-count-total {
    font-weight: 600;
    color: #334155;
}

.page-toolbar-hint {
    color: #64748b;
}

.page-count-pill,
.products-selected-count {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
    font-size: 0.8rem;
}

.products-selected-count.is-active {
    background: #dbeafe;
    color: #1d4ed8;
}

.page-toolbar-actions,
.products-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.page-toolbar-actions .btn,
.products-toolbar-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.page-toolbar-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.page-toolbar-filter input {
    margin: 0;
}

.page-toolbar-sort {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.page-table-wrapper {
    overflow: auto;
    max-height: calc(100vh - 260px);
    border: 1px solid #c5cad3;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    background: #fff;
}

/* Index products: page scroll + sticky toolbar/thead (no inner max-height) */
.products-panel {
    --products-sticky-offset: 4.75rem;
}

.products-panel > .products-toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 8px 16px -12px rgba(15, 23, 42, 0.35);
}

.products-table-wrapper {
    max-height: none;
    overflow: visible;
    border: 1px solid #c5cad3;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    background: #fff;
}

.products-panel .products-table thead th {
    top: var(--products-sticky-offset);
    z-index: 30;
}

.page-table,
.products-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: #fff;
}

.page-table thead th,
.products-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.7rem 0.85rem;
    background: #1e293b;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    vertical-align: middle;
}

.page-table thead th + th,
.products-table thead th + th {
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.page-table .products-select-all,
.products-table .products-select-all {
    margin: 0;
    float: none;
    width: 1.05rem;
    height: 1.05rem;
    border-color: rgba(255, 255, 255, 0.55);
    background-color: transparent;
    cursor: pointer;
}

.page-table .products-select-all:checked,
.products-table .products-select-all:checked {
    background-color: #38bdf8;
    border-color: #38bdf8;
}

.page-table .products-select-all:indeterminate,
.products-table .products-select-all:indeterminate {
    background-color: #38bdf8;
    border-color: #38bdf8;
}

.page-table tbody td,
.products-table tbody td {
    padding: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    background: #fff;
}

.page-table tbody tr:nth-child(even) td,
.products-table tbody tr.products-row:nth-child(even) td {
    background: #f8fafc;
}

.page-table tbody tr:hover td,
.products-table tbody tr.products-row:hover td {
    background: #eef2f7;
}

.page-table tbody tr.is-inactive td {
    color: #94a3b8;
    background: #f1f5f9;
}

.page-table .col-actions {
    white-space: nowrap;
}

.page-table .col-actions .btn + .btn,
.page-table .col-actions form {
    display: inline-block;
    margin-left: 0.25rem;
}

.page-empty {
    margin: 0;
    padding: 1.25rem 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.status-pill-on {
    background: #dcfce7;
    color: #166534;
}

.status-pill-off {
    background: #e2e8f0;
    color: #475569;
}

.color-swatch {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.settings-card {
    border: 1px solid #d8dee8;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.settings-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.settings-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.settings-card-body {
    padding: 1.15rem;
}

.settings-card-body .page-table-wrapper {
    max-height: none;
    margin-bottom: 1rem;
}

.settings-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Product list (index) specifics */

.products-table tbody td {
    vertical-align: top;
}

.products-table .col-check,
.products-table .col-stock,
.products-table .col-updated,
.products-table .col-actions {
    vertical-align: middle;
}

.products-table .col-check {
    width: 44px;
    text-align: center;
    vertical-align: middle;
}

.products-table .col-check .form-check-input {
    margin: 0;
    float: none;
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
}

.products-table .col-product {
    min-width: 280px;
    width: 42%;
}

.products-table .col-attrs {
    min-width: 140px;
    width: 18%;
}

.products-table .col-stock {
    min-width: 110px;
    text-align: center;
    vertical-align: middle;
}

.products-table .col-updated {
    min-width: 118px;
    white-space: nowrap;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    vertical-align: middle;
}

.products-table .col-actions {
    min-width: 110px;
    text-align: center;
    vertical-align: middle;
}

.product-cell {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.product-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
}

.product-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.4rem;
}

.product-cell-body {
    min-width: 0;
    flex: 1;
}

.products-table .product-name-text {
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.products-table .product-barcode {
    margin-top: 0.2rem;
}

.products-table .warehouse-data {
    margin-top: 0.55rem;
    font-size: 0.75rem;
    color: #64748b;
}

.products-table .warehouse-cabinet-group + .warehouse-cabinet-group {
    margin-top: 0.45rem;
}

.products-table .warehouse-cabinet-label {
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: #475569;
}

.warehouse-stock-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.warehouse-stock-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    line-height: 1.3;
}

.warehouse-stock-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.warehouse-stock-qty {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

.product-attrs {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
}

.product-attr {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 0.4rem;
    align-items: baseline;
}

.product-attr dt {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
}

.product-attr dd {
    margin: 0;
    color: #1e293b;
    font-weight: 500;
    word-break: break-word;
}

.vf-stock-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.products-table .product-plans-btn {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .page-toolbar,
    .products-toolbar {
        align-items: stretch;
    }

    .page-toolbar-actions,
    .products-toolbar-actions {
        width: 100%;
    }

    .page-toolbar-actions .btn,
    .products-toolbar-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .page-table-wrapper {
        max-height: calc(100vh - 220px);
    }
}

/* Стили для таблицы отчета */
.legend-card-horizontal {
    margin-bottom: 16px;
    padding: 8px;
}

.legend-table-horizontal {
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.legend-table-horizontal td {
    margin-bottom: 0;
    text-align: center;
}

.unassigned-orders {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 3px solid #dc3545;
}

.unassigned-orders-title {
    font-size: 18px;
    font-weight: 600;
    color: #7f1d1d;
    margin-bottom: 12px;
}

.report-table-wrapper {
    overflow-x: auto;
    max-height: calc(100vh - 280px);
    border: 1px solid #c5cad3;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    background: white;
}

.report-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: white;
}

.report-table thead.table-header {
    background: #1e293b;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.report-table thead.table-header th {
    padding: 10px 8px;
    font-weight: 600;
    text-align: center;
    background: #1e293b;
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    white-space: nowrap;
    font-size: 13px;
    vertical-align: middle;
}

.report-table thead.table-header th:last-child {
    border-right: none;
}

.report-table thead .marketplace-header {
    letter-spacing: 0.02em;
}

.report-table thead .plan-fact-header {
    font-weight: 500;
    font-size: 12px;
}

.report-table tbody tr.table-row:nth-child(even) {
    background-color: #f8fafc;
}

.report-table tbody tr.table-row:hover {
    background-color: #eef2f7;
}

.report-table tbody td {
    padding: 8px 10px;
    border-right: 1px solid #d8dee8;
    border-bottom: 1px solid #d8dee8;
    text-align: center;
    vertical-align: middle;
}

.report-table tbody tr.table-row td:last-child {
    border-right: none;
}

.report-table .product-name-cell {
    font-weight: 500;
    text-align: left;
    padding-left: 12px;
    min-width: 160px;
    max-width: 240px;
    width: 200px;
}

.product-name-text {
    line-height: 1.25;
}

.product-barcode {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

.report-table .plan-cell {
    font-weight: 600;
    color: #334155;
    min-width: 72px;
}

.report-table .warehouse-header {
    min-width: 120px;
    font-size: 12px;
}

.report-table .marketplace-header,
.report-table .scheme-header,
.report-table .plan-fact-header {
    min-width: 88px;
    font-size: 12px;
    vertical-align: middle;
}

.report-table .mp-group-start {
    border-left: 2px solid #64748b !important;
}

.report-table thead .mp-group-start {
    border-left: 2px solid rgba(255, 255, 255, 0.45) !important;
}

.report-table .scheme-group-start {
    border-left: 1px solid #94a3b8 !important;
}

.report-table thead .scheme-group-start {
    border-left: 1px solid rgba(255, 255, 255, 0.28) !important;
}

.report-table .plan-fact-divider {
    border-left-style: dashed !important;
    border-left-color: #cbd5e1 !important;
}

.report-table thead .plan-fact-divider {
    border-left-style: dashed !important;
    border-left-color: rgba(255, 255, 255, 0.28) !important;
}

.report-table .vf-group-start {
    border-left: 2px solid #64748b !important;
}

.report-table thead .vf-group-start {
    border-left: 2px solid rgba(255, 255, 255, 0.45) !important;
}

.report-table .scheme-seller-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 0;
    margin: 0;
    text-align: left;
}

.report-table .scheme-seller-row + .scheme-seller-row {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dotted #cbd5e1;
}

/* «План по складам»: название склада только в колонке План, Факт — число. */
.stock-report-table:not(.plan-mode-general) td.report-fact-cell .seller-label {
    display: none;
}

.stock-report-table:not(.plan-mode-general) td.report-fact-cell .scheme-seller-row {
    justify-content: center;
}

.stock-report-table:not(.plan-mode-general) th.plan-fact-header.plan-fact-divider,
.stock-report-table:not(.plan-mode-general) td.report-fact-cell {
    min-width: 52px;
}

/* «План по складам»: светофор на строке склада внутри ячейки */
.report-table .report-fact-cell .scheme-seller-row.green-background,
.report-table .report-fact-cell .scheme-seller-row.yellow-background,
.report-table .report-fact-cell .scheme-seller-row.orange-background,
.report-table .report-fact-cell .scheme-seller-row.red-background,
.report-table .report-fact-cell .scheme-seller-row.dark-red-background,
.report-table .report-fact-cell .scheme-seller-row.purple-background,
.report-table .report-fact-cell .scheme-seller-row.blue-background,
.report-table .report-fact-cell .scheme-seller-row.cyan-background {
    margin-left: -10px;
    margin-right: -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-top: none;
    border-radius: 0;
}

.report-table .report-fact-cell .scheme-seller-row.green-background {
    background: #bbf7d0;
    color: #14532d;
}

.report-table .report-fact-cell .scheme-seller-row.yellow-background {
    background: #fef08a;
    color: #713f12;
}

.report-table .report-fact-cell .scheme-seller-row.orange-background {
    background: #fdba74;
    color: #7c2d12;
}

.report-table .report-fact-cell .scheme-seller-row.red-background {
    background: #fca5a5;
    color: #7f1d1d;
}

.report-table .report-fact-cell .scheme-seller-row.dark-red-background {
    background: #b91c1c;
    color: #fff;
}

.report-table .report-fact-cell .scheme-seller-row.purple-background {
    background: #c4b5fd;
    color: #4c1d95;
}

.report-table .report-fact-cell .scheme-seller-row.blue-background {
    background: #93c5fd;
    color: #1e3a8a;
}

.report-table .report-fact-cell .scheme-seller-row.cyan-background {
    background: #a5f3fc;
    color: #155e75;
}

.report-table .report-fact-cell .scheme-seller-row.green-background .seller-label,
.report-table .report-fact-cell .scheme-seller-row.yellow-background .seller-label,
.report-table .report-fact-cell .scheme-seller-row.orange-background .seller-label,
.report-table .report-fact-cell .scheme-seller-row.red-background .seller-label,
.report-table .report-fact-cell .scheme-seller-row.purple-background .seller-label,
.report-table .report-fact-cell .scheme-seller-row.blue-background .seller-label,
.report-table .report-fact-cell .scheme-seller-row.cyan-background .seller-label {
    color: inherit;
    opacity: 0.85;
}

.report-table .report-fact-cell .scheme-seller-row.dark-red-background .seller-label {
    color: rgba(255, 255, 255, 0.9);
}

.report-table .scheme-seller-row .seller-label {
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    line-height: 1.3;
    flex: 1 1 auto;
    min-width: 0;
}

.report-table .scheme-seller-row .plan-value,
.report-table .scheme-seller-row .fact-value {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}

.report-table .empty-value {
    color: #94a3b8;
    font-weight: 500;
}

.report-table .warehouse-cell {
    font-weight: 600;
    font-size: 13px;
    padding: 8px 10px;
    text-align: center;
    vertical-align: middle;
    min-width: 120px;
}

.report-table td.report-plan-cell,
.report-table td.report-fact-cell {
    text-align: left;
}

.report-table .scheme-general-plan-row-solo {
    justify-content: center;
}

.report-table .scheme-general-plan-row-solo .plan-value {
    font-size: 14px;
}

/* Светофор: заливка всей ячейки, сетка границ не ломается */
.report-table td.green-background,
.report-table tr.green-background > td {
    background: #bbf7d0;
    color: #14532d;
}

.report-table td.yellow-background,
.report-table tr.yellow-background > td {
    background: #fef08a;
    color: #713f12;
}

.report-table td.orange-background,
.report-table tr.orange-background > td {
    background: #fdba74;
    color: #7c2d12;
}

.report-table td.red-background,
.report-table tr.red-background > td {
    background: #fca5a5;
    color: #7f1d1d;
}

.report-table td.dark-red-background,
.report-table tr.dark-red-background > td {
    background: #b91c1c;
    color: #fff;
}

.report-table td.purple-background,
.report-table tr.purple-background > td {
    background: #c4b5fd;
    color: #4c1d95;
}

.report-table td.blue-background,
.report-table tr.blue-background > td {
    background: #93c5fd;
    color: #1e3a8a;
}

.report-table td.cyan-background,
.report-table tr.cyan-background > td {
    background: #a5f3fc;
    color: #155e75;
}

.report-table td.green-background .seller-label,
.report-table td.yellow-background .seller-label,
.report-table td.orange-background .seller-label,
.report-table td.red-background .seller-label,
.report-table td.purple-background .seller-label,
.report-table td.blue-background .seller-label,
.report-table td.cyan-background .seller-label {
    color: inherit;
    opacity: 0.85;
}

.report-table td.dark-red-background .seller-label {
    color: rgba(255, 255, 255, 0.9);
}

/* Легенда */
.legend-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 0;
}

.legend-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
    font-size: 16px;
}

.legend-table {
    margin-bottom: 0;
}

.legend-table td {
    padding: 12px 15px;
    border: none;
    border-radius: 6px;
    margin-bottom: 8px;
}

.legend-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.legend-label {
    font-weight: 500;
    font-size: 13px;
}

.legend-table .green-background {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #155724;
    border: 2px solid #28a745;
}

.legend-table .yellow-background {
    background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
    color: #856404;
    border: 2px solid #ffc107;
}

.legend-table .orange-background {
    background: linear-gradient(135deg, #fdba74 0%, #fb923c 100%);
    color: #7c2d12;
    border: 2px solid #fd7e14;
}

.legend-table .red-background {
    background: linear-gradient(135deg, #fca5a5 0%, #ef4444 100%);
    color: #7f1d1d;
    border: 2px solid #dc3545;
}

.legend-table .dark-red-background {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    border: 2px solid #7f1d1d;
}


.legend-table .purple-background {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
    border: 2px solid #7c3aed;
}

.legend-table .blue-background {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    border: 2px solid #2563eb;
}

.legend-table .cyan-background {
    background: linear-gradient(135deg, #67e8f9 0%, #06b6d4 100%);
    color: #0c4a6e;
    border: 2px solid #0891b2;
}
.table hr {
    margin: 0.5rem 0;
}
#save-plan-btn {
    right: 60px;
    top: 60px;
    position: fixed;
}
#generate-report-btn {
    right: 60px;
    top: 100px;
    position: fixed;
}
#create-template-btn {
    right: 60px;
    top: 140px;
    position: fixed;
}
.sticky-col {
  position: sticky;
  background-color: white; /* Важно! Иначе под ней будет просвечивать контент */
  z-index: 10;
}

/* Первая колонка — прилипает к левому краю */
.first-col {
  left: 0;
  min-width: 80px;
  width: 80px;
}

.report-table .first-col {
  min-width: 160px;
  width: 200px;
}

/* Sticky колонки в отчёте */
.report-table .sticky-col {
  background-color: white;
  z-index: 50;
  box-shadow: 2px 0 0 #d8dee8;
}

.report-table thead .sticky-col {
  background: #1e293b;
  color: #fff;
  z-index: 150;
  box-shadow: 2px 0 0 rgba(255, 255, 255, 0.2);
}

.report-table tbody tr:nth-child(even) .sticky-col {
  background-color: #f8fafc;
}

.report-table tbody tr:hover .sticky-col {
  background-color: #eef2f7;
}
.selectmultiple {
    height: 350px;
}

.guide-toc {
    position: sticky;
    top: 1rem;
}

.guide-toc a {
    display: block;
    padding: 0.2rem 0;
    color: #334155;
    text-decoration: none;
}

.guide-toc a:hover,
.guide-toc a:focus {
    color: #0d6efd;
    text-decoration: underline;
}

.guide-content h2 {
    scroll-margin-top: 1rem;
}

.guide-content section + section {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

/* Product plans modal — compact layout */
#product-plans-modal .modal-body {
    max-height: min(70vh, 640px);
    overflow-y: auto;
}

.product-plans-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin: 0 0 0.5rem;
}

.product-plans-vf {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.product-plans-marketplaces {
    margin-bottom: 0;
}

.product-plans-accordion {
    --bs-accordion-border-color: #cbd5e1;
    --bs-accordion-border-width: 1px;
    --bs-accordion-btn-focus-box-shadow: none;
}

.product-plans-accordion .accordion-button {
    font-size: 0.9375rem;
    font-weight: 600;
}

.product-plans-accordion .accordion-button:not(.collapsed) {
    background-color: #f1f5f9;
    box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--bs-accordion-border-color);
}

.product-plans-accordion > .accordion-item {
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.product-plans-accordion > .accordion-item:last-child {
    margin-bottom: 0;
}

.product-plans-seller + .product-plans-seller {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e2e8f0;
}

.product-plans-seller-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.product-plans-scheme {
    margin-bottom: 0.5rem;
}

.product-plans-scheme:last-child {
    margin-bottom: 0;
}

.product-plans-scheme-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.product-plans-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.product-plans-row-label {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-plans-row-input {
    flex: 0 0 5.5rem;
    width: 5.5rem;
}

.statistics-table th,
.statistics-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    text-align: right;
    white-space: nowrap;
    font-size: 19.2px;
    font-weight: 700;
    color: #111111;
}

.statistics-table thead th {
    text-align: center;
    font-size: 19.2px;
    font-weight: 700;
    color: #111111;
    background-color: #e9ecef;
}

.statistics-seller-cell {
    text-align: left;
    vertical-align: top;
    min-width: 11rem;
    white-space: normal;
    background: #fff;
}

.statistics-metric {
    text-align: left;
    color: #111111;
    font-size: 19.2px;
    font-weight: 700;
}

.statistics-table tr.statistics-seller-start > th,
.statistics-table tr.statistics-seller-start > td {
    border-top: 2px solid #cbd5e1;
}

.statistics-table tbody > tr:first-child > th,
.statistics-table tbody > tr:first-child > td {
    border-top: 0;
}

.statistics-mp-label {
    font-weight: 700;
    font-size: 19.2px;
    line-height: 1.2;
}

.statistics-mp-wb {
    color: #6d28d9;
}

.statistics-mp-ozon {
    color: #00a3e0;
}

.statistics-mp-ym {
    color: #e6ac00;
}

.statistics-mp-sm {
    color: #1d4ed8;
}

.statistics-seller-name {
    color: #111111;
    font-weight: 700;
    font-size: 19.2px;
}

.statistics-updated {
    color: #334155;
    font-size: 16px;
    font-weight: 600;
}

.statistics-seller-cell .statistics-warning {
    margin: 0.35rem 0 0;
    padding: 0.2rem 0.35rem;
    font-size: 16px;
    font-weight: 600;
    white-space: normal;
}

.statistics-period-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.statistics-period-field {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 600;
}

.statistics-period-field input[type="date"] {
    border: 1px solid #d8dee8;
    border-radius: 10px;
    padding: 0.35rem 0.55rem;
    color: #1e293b;
    background: #fff;
}

.statistics-warning {
    color: #92400e;
    background: #fef3c7;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.statistics-error {
    color: #7f1d1d;
    background: #fee2e2;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0;
    text-align: left;
    white-space: normal;
}

.statistics-table th[scope="row"] {
    white-space: nowrap;
}

.statistics-table th.orange-background,
.statistics-table td.orange-background {
    background: #fdba74;
    color: #7c2d12;
}
