:root {
    --store-sidebar-width: 288px;
    --store-sidebar-collapsed: 96px;
    --store-topbar-height: 72px;
    --store-bg: #f5f7fb;
    --store-panel: #ffffff;
    --store-border: rgba(15, 23, 42, 0.08);
    --store-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body,
.form-control,
.btn,
.dropdown-menu,
.card {
    font-family: 'Inter', sans-serif;
}

body.storehouse-body,
body.login-page {
    background: var(--store-bg);
    color: #0f172a;
    min-height: 100vh;
}

html.storehouse-html,
html.storehouse-html body {
    display: block;
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body.storehouse-body {
    overflow-x: hidden;
    overflow-y: auto;
}

#tabellaFormFields .form-label {
    margin-top: 10px;
    margin-bottom: 0;
}

.store-layout {
    display: flex;
    min-height: 100vh;
}

.store-sidebar {
    width: var(--store-sidebar-width);
    background: linear-gradient(180deg, #0b1225 0%, #111e40 100%);
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.25rem 1rem;
    box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
    transition: width .25s ease, transform .25s ease;
    z-index: 1040;
}

.store-sidebar-brand {
    position: relative;
    padding: .5rem .5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 1rem;
}

.store-sidebar-close {
    display: none;
    position: absolute;
    top: .35rem;
    right: .35rem;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: rgba(255,255,255,.1);
}

.store-sidebar-scroll {
    overflow-y: auto;
    height: calc(100vh - 110px);
    padding-right: .25rem;
}

.store-brand-mark {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(99,102,241,.22);
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 12px 24px rgba(99,102,241,.25);
}

.store-brand-mark.large {
    width: 64px;
    height: 64px;
    font-size: 1.9rem;
}

.store-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.store-topbar {
    position: relative;
    min-height: var(--store-topbar-height);
    background: rgba(15, 23, 47, 0.97);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.store-topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.store-topbar-sale-btn {
    color: #fff;
    background: rgba(12, 131, 255, .95);
    border: 1px solid rgba(255,255,255,.2);
    box-shadow: 0 10px 24px rgba(12, 131, 255, .22);
}

.store-topbar-sale-btn:hover,
.store-topbar-sale-btn:focus {
    color: #fff;
    background: #0b76e6;
    border-color: rgba(255,255,255,.32);
}

.store-logout-btn {
    color: #fff;
}

.store-content {
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.store-page-header {
    background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(14,165,233,.08));
    border: 1px solid var(--store-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--store-shadow);
}

.store-nav-link,
.store-nav-toggle,
.store-subnav-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .75rem;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,.76);
    text-decoration: none;
    border-radius: 1rem;
    padding: .8rem .9rem;
    transition: all .2s ease;
    margin-bottom: .2rem;
}

.store-nav-link:hover,
.store-nav-toggle:hover,
.store-subnav-link:hover,
.store-nav-group.active > .store-nav-toggle,
.store-nav-link.active,
.store-subnav-link.active {
    color: #fff;
    background: rgba(255,255,255,.1);
    transform: translateX(2px);
}

.store-nav-link.disabled {
    color: rgba(255, 255, 255, .42);
    cursor: not-allowed;
    pointer-events: none;
}

.store-nav-group .toggle-icon {
    margin-left: auto;
    transition: transform .2s ease;
}

.store-nav-group.active .toggle-icon {
    transform: rotate(180deg);
}

.store-subnav {
    display: none;
    padding-left: 1.25rem;
    margin-bottom: .75rem;
}

.store-subnav-link {
    font-size: .95rem;
    padding: .65rem .9rem;
}

.sidebar-collapsed .store-sidebar {
    width: var(--store-sidebar-collapsed);
}

.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .sidebar-label-wrap,
.sidebar-collapsed .toggle-icon {
    display: none !important;
}

.sidebar-collapsed .store-subnav {
    display: none !important;
}

.stat-card {
    border-radius: 1.25rem;
    overflow: hidden;
}

.stat-card .stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card.tone-primary .stat-card-icon { background: rgba(79,70,229,.1); color: #4f46e5; }
.stat-card.tone-success .stat-card-icon { background: rgba(34,197,94,.12); color: #16a34a; }
.stat-card.tone-warning .stat-card-icon { background: rgba(245,158,11,.14); color: #d97706; }
.stat-card.tone-info .stat-card-icon { background: rgba(14,165,233,.12); color: #0284c7; }
.stat-card.tone-danger .stat-card-icon { background: rgba(244,63,94,.12); color: #e11d48; }

.module-card,
.panel-card,
.table-card,
.chart-card,
.builder-card,
.report-card {
    border: 0;
    border-radius: 1.25rem;
    box-shadow: var(--store-shadow);
    background: #fff;
}

.table-soft thead th {
    color: #64748b;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom-width: 1px;
}

.table-soft tbody tr {
    cursor: pointer;
    transition: background .18s ease;
}

.table-soft tbody tr:hover {
    background: rgba(99,102,241,.04);
}

.table-compact > :not(caption) > * > * {
    padding-top: .35rem;
    padding-bottom: .35rem;
}

.tag-grid,
.size-qty-grid {
    display: grid;
    gap: .75rem;
}

.tag-grid {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
}

.size-qty-grid {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.variant-rows-grid {
    display: grid;
    gap: .35rem;
}

.variant-line-row {
    padding: 0;
}

.variant-line-row .form-select,
.variant-line-row .form-control {
    min-height: 38px;
}

.tag-card,
.size-box,
.search-result-card,
.line-item-row,
.summary-item,
.activity-item {
    border: 1px solid var(--store-border);
    border-radius: 1rem;
    background: #fff;
    padding: 1rem;
}

.tag-card.active,
.size-box.active {
    border-color: rgba(79,70,229,.5);
    box-shadow: 0 0 0 4px rgba(79,70,229,.08);
    background: rgba(79,70,229,.04);
}

.search-results,
.line-items,
.summary-list {
    display: grid;
    gap: .75rem;
}

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, .95fr);
    gap: 1.25rem;
}

.barcode-preview {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.25rem;
    border: 1px dashed rgba(15,23,42,.18);
    background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(241,245,249,.95));
}

.barcode-svg {
    max-width: 100%;
    height: auto;
}

.vendita-barcode-wrap {
    width: min(100%, 720px);
    margin-inline: auto;
}

.vendita-barcode-input {
    background: #eef6ff;
    border: 2px solid rgba(12, 131, 255, .55);
    box-shadow: 0 0 0 6px rgba(12, 131, 255, .09), 0 10px 28px rgba(12, 131, 255, .12);
    text-align: center;
    font-weight: 700;
    letter-spacing: .12em;
    min-height: 58px;
    padding-inline: 3rem;
}

.vendita-barcode-input:focus {
    background: #f6faff;
    border-color: #0c83ff;
}

.barcode-label {
    border: 1px solid var(--store-border);
    border-radius: .5rem;
    background: #fff;
    padding: .75rem;
    text-align: center;
}

.barcode-manual {
    border: 1px dashed rgba(15, 23, 42, .15);
    border-radius: .75rem;
    padding: .75rem;
    background: rgba(248, 250, 252, .8);
}

@media print {
    .store-sidebar,
    .store-topbar,
    .store-page-header,
    .page-actions,
    .btn,
    .barcode-manual {
        display: none !important;
    }
    .barcode-label {
        break-inside: avoid;
        box-shadow: none;
    }
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(79,70,229,.08);
    color: #4f46e5;
    font-size: 1.8rem;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr minmax(420px, .9fr);
}

.login-hero {
    background: linear-gradient(135deg, rgba(15,23,47,.96), rgba(49,46,129,.88)), url('/assets/images/login_cover.jpg') center/cover no-repeat;
    padding: clamp(2rem, 6vw, 4rem);
    display: flex;
    align-items: flex-end;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: min(480px, 100%);
    border-radius: 2rem;
}

.glass-card {
    border-radius: 1.25rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    padding: 1rem;
}

.glass-card-label {
    color: rgba(255,255,255,.7);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.glass-card-value {
    color: #fff;
    font-weight: 600;
    margin-top: .35rem;
}

.offcanvas-xl-wide {
    width: min(760px, 100vw);
}

.offcanvas.offcanvas-detail-wide {
    --offcanvas-width: min(1400px, calc(100vw - 2rem));
    width: var(--offcanvas-width) !important;
    max-width: calc(100vw - 2rem);
}

.article-detail-form {
    display: grid;
    gap: 1rem;
}

.detail-form-row,
.detail-form-grid {
    display: grid;
    gap: 1rem;
}

.detail-form-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.detail-form-row-3 {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.detail-form-row-4 {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.detail-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 1199.98px) {
    .offcanvas.offcanvas-detail-wide {
        --offcanvas-width: 100vw;
        max-width: 100vw;
    }
    .detail-form-grid,
    .detail-form-row-3,
    .detail-form-row-4 {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 575.98px) {
    .detail-form-grid,
    .detail-form-row-3,
    .detail-form-row-4 {
        grid-template-columns: 1fr;
    }
}

.store-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, .48);
    z-index: 1035;
}

@media (max-width: 1199.98px) {
    .store-layout {
        display: block;
        min-height: 100vh;
    }
    .store-sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        max-width: calc(100vw - 3rem);
    }
    .store-sidebar-close {
        display: inline-flex;
    }
    .store-main {
        height: auto;
        min-height: 100vh;
    }
    .store-content {
        overflow: visible;
    }
    .sidebar-mobile-open .store-sidebar {
        transform: translateX(0);
    }
    .sidebar-mobile-open {
        overflow: hidden;
    }
    html.storehouse-html:has(.sidebar-mobile-open) {
        overflow: hidden;
    }
    .sidebar-mobile-open .store-sidebar-backdrop {
        display: block;
    }
    .sidebar-collapsed .store-sidebar {
        width: var(--store-sidebar-width);
    }
    .sidebar-collapsed .sidebar-label,
    .sidebar-collapsed .sidebar-label-wrap,
    .sidebar-collapsed .toggle-icon {
        display: inline-flex !important;
    }
    .sidebar-collapsed .store-subnav {
        display: none;
    }
    .pos-layout,
    .login-shell {
        grid-template-columns: 1fr;
    }
    .pos-layout .sticky-top {
        position: static !important;
    }
    .login-hero {
        min-height: 320px;
    }
}

@media (max-width: 575.98px) {
    .store-topbar-center {
        position: static;
        transform: none;
        margin-left: .75rem;
    }
    .store-topbar-sale-btn {
        padding-left: .75rem;
        padding-right: .75rem;
    }
    .store-topbar-sale-btn .me-2 {
        margin-right: 0 !important;
    }
    .store-topbar-sale-btn {
        font-size: 0;
    }
    .store-topbar-sale-btn i {
        font-size: var(--icon-font-size);
    }
}

@media (min-width: 1200px) {
    html.storehouse-html,
    html.storehouse-html body.storehouse-body {
        overflow-y: auto;
    }
    #sidebarToggle {
        display: none;
    }
}

.barcode-print-module {
    border-color: rgba(99, 102, 241, .18);
    background: linear-gradient(135deg, rgba(99, 102, 241, .045), #fff 55%);
}

.barcode-sheet-summary {
    min-height: 42px;
    border-radius: .75rem;
    background: rgba(99, 102, 241, .08);
    color: #4338ca;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
}

.barcode-sheet-summary strong {
    font-size: 1.1rem;
}

.barcode-sheet-summary span {
    font-size: .7rem;
}

.barcode-label-content {
    width: 100%;
    text-align: center;
}

.barcode-label-content svg {
    display: block;
    width: 72%;
    height: auto;
    max-height: 92px;
    margin: 0 auto;
}

.barcode-variant {
    margin-top: .1rem;
    margin-bottom: .25rem;
    color: #111827;
    font-size: .78rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.barcode-article-code {
    color: #374151;
    font-size: .78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.barcode-bottom-row {
    margin-top: .25rem;
    width: 72%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    color: #111827;
    font-size: .82rem;
    line-height: 1.1;
}

.barcode-bottom-row span,
.barcode-bottom-row strong {
    min-width: 0;
    white-space: nowrap;
}

.barcode-bottom-row span {
    padding-left: 10px;
}

.barcode-bottom-row strong {
    padding-right: 10px;
}

.barcode-profile-editor .form-label {
    font-size: .78rem;
}

#barcodeBatchTable input[type="number"] {
    max-width: 130px;
}
