:root {
    --color-bg: #eef2f6;
    --color-surface: #f7f9fc;
    --color-text: #0f172a;
    --color-muted: #5b6b82;
    --color-primary: #0f172a;
    --color-secondary: #3b82f6;
    --color-accent: #10b981;
    --color-danger: #ef4444;
    --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

body.dark {
    --color-bg: #111827;
    --color-surface: #1f2937;
    --color-text: #f9fafb;
    --color-muted: #9ca3af;
    --color-primary: #f9fafb;
    --color-secondary: #60a5fa;
    --color-accent: #34d399;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: "Inter", "Segoe UI", sans-serif;
}

.content-wrapper h1,
.content-wrapper h2,
.content-wrapper h3,
.content-wrapper h4,
.content-wrapper h5,
.content-wrapper h6,
.content-wrapper p,
.content-wrapper label {
    color: var(--color-text);
}

.sidebar {
    background: #e9eef5;
    color: #1f2937;
    min-height: 100vh;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

body.dark .sidebar {
    background: #0f172a;
    color: #e2e8f0;
}

.sidebar .user-meta {
    color: #1f2937;
    font-weight: 600;
}

.sidebar .user-meta small {
    color: #475569;
    font-weight: 500;
}

body.dark .sidebar .user-meta {
    color: #e2e8f0;
}

body.dark .sidebar .user-meta small {
    color: #cbd5f5;
}

.sidebar .nav-link {
    color: #1f2937;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: var(--color-secondary);
    color: #fff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
}

.sidebar-footer .theme-toggle {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
    color: inherit;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: var(--color-secondary);
    color: #fff;
}

body.dark .sidebar .nav-link {
    color: rgba(226, 232, 240, 0.85);
}

body.dark .sidebar .nav-link.active,
body.dark .sidebar .nav-link:hover {
    background: #1e40af;
    color: #fff;
}

@media (max-width: 767.98px) {
    body {
        overflow: hidden;
        height: 100dvh;
    }

    .mobile-app-wrap {
        display: flex;
        flex-direction: column;
        height: 100dvh;
        overflow: hidden;
    }

    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        min-height: 56px;
        display: flex;
        align-items: center;
        padding: max(12px, env(safe-area-inset-top, 0px)) 16px 12px;
        background: var(--color-surface);
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
        z-index: 1030;
        flex-shrink: 0;
    }

    body.dark .mobile-header {
        background: #1e293b;
        border-bottom-color: rgba(148, 163, 184, 0.1);
    }

    .mobile-content-area {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-top: calc(80px + env(safe-area-inset-top, 0px)) !important;
    }

    .mobile-content-area .container-fluid {
        padding-top: 0 !important;
    }
}

.mobile-menu-btn {
    color: var(--color-text) !important;
    padding: 8px;
    margin: -8px 8px -8px -8px;
}

.mobile-header-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
}

.sidebar-overlay-backdrop {
    display: none;
    position: fixed;
    left: 280px;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1041;
    pointer-events: none;
}

@media (max-width: 767.98px) {
    body.sidebar-open .sidebar-overlay {
        left: 280px !important;
    }

    .sidebar-overlay-backdrop {
        display: block;
    }

    body.sidebar-open .sidebar-overlay-backdrop {
        pointer-events: auto;
    }

    body.sidebar-open .mobile-content-area {
        z-index: 1050;
    }

    .sidebar-overlay-backdrop {
        z-index: 1060;
    }
}

@media (max-width: 767.98px) {
    body.sidebar-open {
        overflow: hidden;
    }
}

@media (max-width: 767.98px) {
    .sidebar-collapse {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1070;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    body.sidebar-open .sidebar-collapse {
        transform: translateX(0);
    }

    .content-wrapper {
        padding: 16px 16px 24px;
    }

    .card {
        margin-left: 0;
        margin-right: 0;
        border-radius: 12px;
    }

    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .btn, .form-control, .form-select {
        min-height: 44px;
    }
}

@media (min-width: 768px) {
    .sidebar-close {
        display: none !important;
    }

    .content-wrapper {
        padding: 24px;
    }

    .mobile-app-wrap {
        display: block;
    }

    .mobile-content-area {
        padding-top: 0;
    }
}

.card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: var(--color-surface);
    box-shadow: var(--shadow);
}

.card .table-responsive {
    overflow: visible;
}

.card .table-responsive.audit-scroll {
    overflow-x: auto !important;
    overflow-y: auto !important;
}

.table-sale-items {
    min-width: 520px;
}

#client-suggestions,
.product-suggestions {
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
    top: 100%;
    left: 0;
}
body.dark .card {
    background: #1e293b;
}

.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6,
.card p {
    color: var(--color-text);
}

.card ul,
.card li {
    color: var(--color-text);
}

body.dark .card ul,
body.dark .card li {
    color: #e2e8f0;
}

.import-result-stats {
    color: var(--color-text);
}

body.dark .import-result-stats {
    color: #e2e8f0;
}

.detail-card {
    background: rgba(15, 23, 42, 0.08);
}

body.dark .detail-card {
    background: rgba(148, 163, 184, 0.12);
}

.detail-card strong {
    color: var(--color-text);
}

body.dark .detail-card strong {
    color: #e2e8f0;
}

.totals-summary {
    color: var(--color-text);
}

body.dark .totals-summary {
    color: #e2e8f0;
}

.detail-card {
    color: var(--color-text);
}

body.dark .detail-card {
    color: #e2e8f0;
}


.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    font-weight: 600;
}

body.dark .card-header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.text-muted {
    color: var(--color-muted) !important;
}

body.dark .text-muted {
    color: #cbd5f5 !important;
}

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.stat-card.centered {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-card.centered .icon {
    margin-top: 8px;
}

.stat-card h4 {
    color: var(--color-text);
    font-weight: 700;
}

body.dark .stat-card h4 {
    color: #f8fafc;
}

.stat-card small {
    color: var(--color-muted);
}

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-secondary);
}

.kpi-help {
    position: absolute;
    right: 10px;
    bottom: 8px;
    font-size: 14px;
    color: var(--color-muted);
    cursor: help;
}

.kpi-help:hover {
    color: var(--color-secondary);
}

body.dark .kpi-help {
    color: #cbd5f5;
}

.tooltip .tooltip-inner {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.12));
    color: var(--color-text);
    border: 1px solid rgba(59, 130, 246, 0.25);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
    padding: 10px 12px;
    font-size: 0.85rem;
    border-radius: 10px;
}

.tooltip .tooltip-arrow::before {
    border-top-color: rgba(59, 130, 246, 0.4);
}

body.dark .tooltip .tooltip-inner {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.35), rgba(16, 185, 129, 0.25));
    border-color: rgba(148, 163, 184, 0.25);
    color: #f8fafc;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

.badge-soft {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-accent);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
}

.table {
    color: var(--color-text);
    --bs-table-bg: var(--color-surface);
    --bs-table-color: var(--color-text);
}

body.dark .table {
    color: #e2e8f0;
    --bs-table-bg: #1e293b;
    --bs-table-color: #e2e8f0;
}

.table thead th {
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--color-text);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table tbody tr {
    border-color: rgba(148, 163, 184, 0.12);
}

body.dark .table thead th {
    color: #e2e8f0;
}

body.dark .table tbody tr {
    border-color: rgba(148, 163, 184, 0.2);
}

.table td,
.table th {
    color: var(--color-text) !important;
}

body.dark .table td,
body.dark .table th {
    color: #e2e8f0 !important;
}

.table td *,
.table th * {
    color: inherit !important;
}

body.dark .table thead th {
    color: #f8fafc !important;
}

body.dark .table tbody td {
    color: #e2e8f0 !important;
}

body.dark .table,
body.dark .table thead,
body.dark .table tbody,
body.dark .table tr {
    background-color: #1e293b;
}

body.dark .table-hover tbody tr:hover {
    background-color: rgba(30, 64, 175, 0.25);
}

.table tbody tr td {
    vertical-align: middle;
}

.table-form {
    display: contents;
}

.category-card {
    border-radius: 16px;
    color: var(--color-text);
}

.category-title {
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--color-text);
}

body.dark .category-card {
    color: #e2e8f0;
}

body.dark .category-title {
    color: #e2e8f0;
}

body.dark .modal-content {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #1f2a44;
}

body.dark .modal-header,
body.dark .modal-footer {
    border-color: #1f2a44;
}

body.dark .modal-title {
    color: #e2e8f0;
}

body.dark .modal .form-control,
body.dark .modal .form-select {
    background: #111827;
    color: #e2e8f0;
    border-color: #223046;
}

body.dark .modal .form-control::placeholder {
    color: #94a3b8;
}

.table-responsive.audit-scroll {
    max-height: 650px;
    overflow-y: auto !important;
    overflow-x: auto;
    display: block;
    scrollbar-gutter: stable both-edges;
    scrollbar-width: thin;
    -ms-overflow-style: scrollbar;
}

.table-responsive.audit-scroll::-webkit-scrollbar {
    width: 10px;
}

.table-responsive.audit-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 8px;
}

body.dark .table-responsive.audit-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.8);
}

.audit-card {
    max-height: none;
    overflow: hidden;
}

.audit-scroll thead th {
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 2;
}

.products-scroll {
    max-height: calc(100vh - 360px);
}

 .product-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
 }

 .product-details-row td {
    background: rgba(148, 163, 184, 0.08);
 }

 body.dark .product-details-row td {
    background: rgba(30, 64, 175, 0.12);
 }

 .product-details {
    display: flex;
    gap: 16px;
    padding: 12px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 180ms ease, transform 180ms ease;
 }

.product-details-wrap {
    max-height: 0;
    overflow: hidden;
    transition: max-height 220ms ease;
}

.product-details-row.is-collapsed {
    display: none;
}

.product-details-row.is-expanding .product-details,
.product-details-row:not(.is-collapsed) .product-details {
    opacity: 1;
    transform: translateY(0);
}

.product-details-row.is-collapsed .product-details {
    opacity: 0;
    transform: translateY(-6px);
}

.product-toggle.is-open i {
    transform: rotate(180deg);
    transition: transform 180ms ease;
}

.product-toggle i {
    transition: transform 180ms ease;
}
 .product-details-image {
    width: 140px;
    min-width: 140px;
    height: 140px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
 }

 .product-details-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
 }

 .product-details-content {
    flex: 1;
 }


.product-search {
    position: relative;
}

.product-search-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 240px;
    overflow-y: auto;
    display: none;
    z-index: 20;
}

.product-search-item,
.product-search-empty {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--color-text);
}

.product-search-item:hover {
    background: rgba(148, 163, 184, 0.2);
}

body.dark .product-search-list {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.25);
}

body.dark .product-search-item:hover {
    background: rgba(30, 64, 175, 0.2);
}

.product-search-empty {
    cursor: default;
    color: var(--color-muted);
}

body.dark .product-details-image {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.25);
}

.table-hover tbody tr:hover {
    background: rgba(148, 163, 184, 0.12);
}

body.dark .table-hover tbody tr:hover {
    background: rgba(30, 64, 175, 0.15);
}

.btn-primary {
    background: var(--color-secondary);
    border: none;
}

body.dark .btn-primary {
    background: #2563eb;
}

.btn-outline-secondary,
.btn-outline-primary {
    border-radius: 10px;
}

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

body.dark .btn-outline-primary {
    color: #93c5fd;
    border-color: #60a5fa;
}

.btn-outline-secondary {
    color: var(--color-muted);
    border-color: rgba(148, 163, 184, 0.4);
}

body.dark .btn-outline-secondary {
    color: #cbd5f5;
    border-color: rgba(148, 163, 184, 0.5);
}

.page-link {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: rgba(148, 163, 184, 0.4);
}

.page-link:hover {
    color: var(--color-text);
    background: rgba(148, 163, 184, 0.12);
}

.page-item.active .page-link {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #ffffff;
}

body.dark .page-link {
    background: #1e293b;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.3);
}

body.dark .page-link:hover {
    background: rgba(148, 163, 184, 0.18);
}

body.dark .page-item.active .page-link {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.form-control,
.form-select {
    background: var(--color-surface);
    color: var(--color-text);
}

input[name="notes"],
#discount_type,
#discount_value {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0;
    box-shadow: none !important;
}

input[name="notes"]:focus,
#discount_type:focus,
#discount_value:focus {
    border-bottom-color: var(--color-secondary);
}

body.dark input[name="notes"],
body.dark #discount_type,
body.dark #discount_value {
    border-bottom-color: rgba(148, 163, 184, 0.4);
}

body.dark .form-control,
body.dark .form-select {
    background: #1e293b;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.3);
}

body.dark .form-control::placeholder,
body.dark .form-select::placeholder {
    color: #94a3b8;
}

body.dark .form-check strong,
body.dark .form-check small {
    color: #e2e8f0;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.7;
}

body.dark input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.8;
}

.form-label {
    color: var(--color-text);
    font-weight: 600;
}

body.dark .form-label {
    color: #e2e8f0;
}

body.dark .form-control:focus,
body.dark .form-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.25);
}

.badge.bg-secondary {
    background: rgba(100, 116, 139, 0.15) !important;
    color: var(--color-text) !important;
}

body.dark .badge.bg-secondary {
    background: rgba(148, 163, 184, 0.25) !important;
    color: #e2e8f0 !important;
}

.badge.bg-light {
    background: rgba(148, 163, 184, 0.15) !important;
    color: var(--color-text) !important;
}

body.dark .badge.bg-light {
    background: rgba(148, 163, 184, 0.25) !important;
    color: #e2e8f0 !important;
}

.list-group-item {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: rgba(148, 163, 184, 0.15);
}

body.dark .list-group-item {
    background: #1e293b;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.2);
}

#client-suggestions,
.product-suggestions {
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
}


.alert {
    border-radius: 12px;
}

body.dark .alert {
    color: #e2e8f0;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    color: #0f766e;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

body.dark .alert-success {
    background: rgba(16, 185, 129, 0.2);
    color: #d1fae5;
    border-color: rgba(16, 185, 129, 0.35);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

body.dark .alert-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fee2e2;
    border-color: rgba(239, 68, 68, 0.35);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

body.dark .alert-warning {
    background: rgba(245, 158, 11, 0.25);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.4);
}

body.dark .alert-info {
    background: rgba(59, 130, 246, 0.18);
    color: #bfdbfe;
    border-color: rgba(59, 130, 246, 0.4);
}

body.dark .alert-info .text-muted {
    color: rgba(191, 219, 254, 0.85) !important;
}

body.dark .alert-info strong {
    color: #e0f2fe;
}

.scope-info-box {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    background: #cff4fc;
    color: #055160;
}

.scope-info-title {
    font-weight: 600;
    color: #055160;
}

.scope-info-box strong {
    color: #044c52;
}

.scope-info-box .scope-info-note {
    color: #0c5460;
    opacity: 0.95;
}

body.dark .scope-info-box {
    background: #1e3a5f;
    border-color: rgba(59, 130, 246, 0.5);
    color: #bfdbfe;
}

body.dark .scope-info-title {
    color: #e0f2fe !important;
    font-weight: 600;
}

body.dark .scope-info-box strong {
    color: #e0f2fe;
}

body.dark .scope-info-box .scope-info-note {
    color: #93c5fd;
    opacity: 0.95;
}

.text-muted {
    color: var(--color-muted) !important;
}

a {
    color: inherit;
}

body.dark a {
    color: #93c5fd;
}
.btn-accent {
    background: var(--color-accent);
    color: #fff;
    border: none;
}

.btn-compact {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.alert-soft {
    background: rgba(59, 130, 246, 0.1);
    border: none;
    color: var(--color-secondary);
}

.card.greeting-card {
    background: linear-gradient(135deg, #dbeafe 0%, #d1fae5 55%, #e0e7ff 100%) !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
}

.greeting-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e3a8a;
    overflow-wrap: anywhere;
}

.greeting-card .text-muted {
    color: #475569 !important;
}

body.dark .card.greeting-card {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.35), rgba(16, 185, 129, 0.22)) !important;
    border-color: rgba(148, 163, 184, 0.35) !important;
}

body.dark .greeting-title {
    color: #bfdbfe;
}

body.dark .greeting-card .text-muted {
    color: #cbd5e1 !important;
}

a.card .icon i {
    font-size: 1.75rem;
    color: var(--color-secondary);
}

a.card:hover .icon i {
    color: var(--color-accent);
}

a.card:hover {
    transform: translateY(-2px);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.input-group-text {
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--color-text);
}

body.dark .input-group-text {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
}

#items-table input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

#items-table input[type="number"]::-webkit-inner-spin-button,
#items-table input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#items-table .input-group {
    flex-wrap: nowrap;
}

#items-table .input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#items-table .input-group .input-group-text {
    border-left: 0;
}

.price-mod-toast {
    position: fixed;
    z-index: 1080;
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.96);
    padding: 6px 10px;
    border-radius: 8px;
    background: #f59e0b;
    color: #1f2937;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.price-mod-toast.is-in {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.price-mod-toast::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -5px;
    width: 8px;
    height: 8px;
    background: #f59e0b;
    transform: translateX(-50%) rotate(45deg);
}

.price-mod-toast.is-out {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.96);
}

body.dark .price-mod-toast,
body.dark .price-mod-toast::before {
    background: #fbbf24;
    color: #1f2937;
}

.chart-mode-select {
    min-width: 120px;
}

.chart-filters {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.chart-filter-control {
    min-width: 130px;
}

.chart-filter-submit {
    white-space: nowrap;
}

/* Desktop/tablet: filtros en una sola fila */
@media (min-width: 768px) {
    .chart-filters {
        flex-wrap: nowrap;
    }

    .chart-filters .form-select,
    .chart-filters .form-control {
        width: auto;
        flex: 0 0 auto;
    }

    .chart-filters .chart-mode-select {
        width: 110px;
        min-width: 110px;
    }

    .chart-filters input[name="chart_month"] {
        width: 170px;
        min-width: 170px;
    }

    .chart-filters select[name="chart_year"] {
        width: 90px;
        min-width: 90px;
    }
}

@media (max-width: 767.98px) {
    .chart-filters {
        width: 100%;
        justify-content: stretch;
    }

    .chart-filter-control,
    .chart-filter-submit {
        width: 100%;
    }
}

.sales-chart-card {
    display: flex;
    flex-direction: column;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 480px;
    min-height: 480px;
    max-height: none;
    box-sizing: border-box;
    overflow: visible;
    flex-shrink: 0;
}

.chart-canvas-holder {
    position: relative;
    width: 100%;
    height: 440px;
    min-height: 440px;
}

.chart-canvas-holder canvas {
    display: block;
    max-height: none;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

body.dark .login-page {
    position: relative;
    background: radial-gradient(circle at top, rgba(148, 163, 184, 0.2), rgba(15, 23, 42, 0.6)),
        linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
    overflow: hidden;
}

body.dark .login-page::before {
    content: "";
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle at 20% 20%, rgba(148, 163, 184, 0.25), transparent 45%),
        radial-gradient(circle at 80% 30%, rgba(148, 163, 184, 0.18), transparent 40%),
        radial-gradient(circle at 60% 80%, rgba(148, 163, 184, 0.2), transparent 45%);
    filter: blur(28px);
    opacity: 0.7;
    pointer-events: none;
}

body.dark .login-page .container {
    position: relative;
    z-index: 1;
}

.login-card {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.login-card-theme {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

.login-theme-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

body.dark .login-theme-toggle {
    border-color: rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
}

body.dark .login-theme-toggle:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.5);
    color: #f8fafc;
}

body.dark .login-card {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(148, 163, 184, 0.2);
}

.login-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.08);
    color: var(--color-text);
    font-size: 28px;
}

body.dark .login-avatar {
    background: rgba(148, 163, 184, 0.18);
    color: #e2e8f0;
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
}

.input-icon .form-control {
    padding-left: 38px;
}

.footer-note {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.low-stock-alert-wrap {
    max-width: 100%;
}

.card.low-stock-alert {
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%) !important;
    box-shadow: 0 10px 28px rgba(245, 158, 11, 0.12);
    overflow: hidden;
    width: 100%;
    padding: 0 !important;
}

.low-stock-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 12px;
}

.low-stock-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.18);
    color: #d97706;
    font-size: 1rem;
    flex-shrink: 0;
}

.low-stock-alert h6 {
    color: #92400e;
    font-weight: 700;
    font-size: 0.95rem;
}

.low-stock-meta {
    display: block;
    font-size: 0.75rem;
    color: #a16207;
}

.low-stock-body {
    margin: 0 12px 12px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 12px;
    overflow: hidden;
}

.low-stock-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    color: inherit;
}

.low-stock-table thead th {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #92400e;
    background: rgba(245, 158, 11, 0.1);
    border: none;
    padding: 7px 10px;
    white-space: nowrap;
}

.low-stock-table thead th:nth-child(3),
.low-stock-table thead th:nth-child(4),
.low-stock-table td:nth-child(3),
.low-stock-table td:nth-child(4) {
    text-align: right;
}

.low-stock-sku {
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: #78716c;
}

.low-stock-table td {
    vertical-align: middle;
    border: none;
    border-top: 1px solid rgba(251, 191, 36, 0.28);
    padding: 8px 10px;
}

.low-stock-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
    font-size: 0.88rem;
    color: #1f2937;
}

.low-stock-min {
    color: #78716c;
    font-variant-numeric: tabular-nums;
}

.low-stock-qty {
    display: inline-flex;
    min-width: 2.1rem;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.low-stock-qty.is-low {
    background: rgba(245, 158, 11, 0.22);
    color: #b45309;
}

.low-stock-qty.is-empty {
    background: rgba(239, 68, 68, 0.18);
    color: #b91c1c;
}

.low-stock-pager {
    padding: 0 16px 12px;
}

body.dark .card.low-stock-alert {
    background: linear-gradient(180deg, rgba(120, 53, 15, 0.35), rgba(30, 41, 59, 0.95)) !important;
    border-color: rgba(251, 191, 36, 0.4) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

body.dark .low-stock-icon {
    background: rgba(251, 191, 36, 0.16);
    color: #fbbf24;
}

body.dark .low-stock-alert h6 {
    color: #fde68a;
}

body.dark .low-stock-meta {
    color: #fcd34d;
}

body.dark .low-stock-body {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(251, 191, 36, 0.18);
}

body.dark .low-stock-table thead th {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.08);
}

body.dark .low-stock-table td {
    border-top-color: rgba(251, 191, 36, 0.12);
}

body.dark .low-stock-name {
    color: #f8fafc;
}

body.dark .low-stock-sku {
    color: #94a3b8;
}

body.dark .low-stock-min {
    color: #cbd5e1;
}

body.dark .low-stock-qty.is-low {
    background: rgba(251, 191, 36, 0.18);
    color: #fbbf24;
}

body.dark .low-stock-qty.is-empty {
    background: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}

.notif-widget {
    position: relative;
}

.notif-bell-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    color: inherit;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notif-bell-btn:hover {
    background: rgba(148, 163, 184, 0.15);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notif-panel {
    width: min(300px, calc(100vw - 16px));
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    z-index: 3000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(420px, 70vh);
}

.notif-panel-head,
.notif-panel-foot {
    flex-shrink: 0;
}

.notif-panel-foot {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    text-decoration: none;
    color: var(--color-secondary);
    font-weight: 600;
}

.notif-panel-foot:hover {
    text-decoration: underline;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.notif-list::-webkit-scrollbar {
    width: 8px;
}

.notif-list::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.55);
    border-radius: 999px;
}

.notif-list::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.18);
}

.notif-item-title {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.notif-item-msg {
    font-size: 0.8rem;
    color: var(--color-muted);
    overflow-wrap: anywhere;
    margin-top: 2px;
}

body.dark .notif-panel {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.25);
}

.notif-panel-head,
.notif-panel-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    font-size: 0.85rem;
}

.notif-list li {
    padding: 10px 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    font-size: 0.85rem;
}

.notif-list li.notif-unread,
.notif-page-list .notif-unread {
    background: rgba(245, 158, 11, 0.12);
}

.notif-empty {
    padding: 16px 12px !important;
    border-top: none !important;
}

.notif-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    margin-right: 6px;
}

#live-toast-container {
    z-index: 2100;
}
