
* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f8fd;
    --card: #ffffff;
    --line: #d9e6f4;
    --text: #17324d;
    --muted: #6d84a0;
    --primary: #3b82f6;
    --primary-2: #2563eb;
    --primary-soft: #e8f1ff;
    --success: #dff7ea;
    --success-text: #0f7a4b;
    --warning: #fff2d8;
    --warning-text: #996800;
    --danger: #fde3e3;
    --danger-text: #b42318;
    --shadow: 0 16px 34px rgba(49, 94, 160, .10);
    --radius: 22px;
    --sidebar-grad-1: #eef6ff;
    --sidebar-grad-2: #dcecff;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f7fd 100%);
    color: var(--text);
}

a { text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #e7f2ff 0%, #f8fbff 60%, #dcebff 100%);
    color: var(--text);
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 30px;
    align-items: center;
    padding: 32px;
}

.login-hero {
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(108, 156, 230, .18);
    border-radius: 32px;
    padding: 40px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.login-hero h1 {
    font-size: 44px;
    line-height: 1.1;
    margin: 20px 0;
    color: #16406f;
}

.login-hero p {
    color: #5f7c9f;
    max-width: 780px;
    font-size: 17px;
}

.pill {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 999px;
    background: #e7f1ff;
    color: #2455a7;
    font-size: 13px;
    font-weight: 700;
}

.role-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
}

.role-card {
    background: #f7fbff;
    border-radius: 20px;
    padding: 18px;
    border: 1px solid #dfeafb;
}

.role-card h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #23508d;
}

.role-card p {
    font-size: 14px;
    color: #6a84a4;
}

.login-card {
    background: #fff;
    color: var(--text);
    border-radius: 30px;
    padding: 34px;
    box-shadow: var(--shadow);
    border: 1px solid #e5eef9;
}

.demo-box {
    margin-top: 24px;
    background: #f5f9ff;
    border-radius: 18px;
    padding: 16px;
    color: var(--muted);
    border: 1px solid #e4eefb;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid .full-width,
.voucher-grid .full {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 13px 14px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: .2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: #8ab6ff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .10);
}

.btn-primary, .btn-secondary, .btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 16px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 700;
    transition: .2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(37, 99, 235, .18);
}

.btn-secondary {
    background: #edf4ff;
    color: var(--text);
    border: 1px solid #d7e6fb;
}

.btn-secondary:hover {
    background: #e4efff;
}

.btn-danger-mini {
    border: 0;
    border-radius: 10px;
    background: #dc2626;
    color: #fff;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    font-weight: 700;
    border: 1px solid transparent;
}

.alert.success {
    background: var(--success);
    color: var(--success-text);
    border-color: #c8efd9;
}

.alert.error {
    background: var(--danger);
    color: var(--danger-text);
    border-color: #f5c9c9;
}

.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--sidebar-grad-1), var(--sidebar-grad-2));
    color: var(--text);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-right: 1px solid #d5e5fa;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(59,130,246,.20);
    overflow: hidden;
    flex-shrink: 0;
}

.brand-icon-logo {
    background: #ffffff;
    border: 1px solid #d7e6fb;
}

.brand-icon-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 2px;
}

.sidebar-brand h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

.sidebar-brand p {
    margin: 0;
    color: #6985a6;
    font-size: 13px;
}

.user-box {
    background: rgba(255,255,255,.70);
    border: 1px solid rgba(173, 200, 241, .70);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(85, 127, 184, .08);
}

.user-box strong {
    display: block;
    margin-bottom: 6px;
}

.user-box span {
    color: #6b84a3;
    font-size: 14px;
}

.nav-menu {
    display: grid;
    gap: 8px;
}

.nav-link {
    padding: 13px 16px;
    border-radius: 16px;
    color: #24486d;
    transition: .2s ease;
    font-weight: 600;
}

.nav-link:hover {
    background: rgba(255,255,255,.85);
    color: #17324d;
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, .20);
}

.btn-logout {
    margin-top: auto;
    background: #edf4ff;
    color: var(--text);
    border: 1px solid #d5e4fa;
}

.main-content {
    padding: 24px;
    position: relative;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    background: #f8fbff;
    border-radius: 24px;
    padding: 22px 24px;
    box-shadow: 0 14px 28px rgba(49, 94, 160, .12);
    border: 1px solid #dfeafb;
    position: sticky;
    top: 12px;
    z-index: 12000;
    isolation: isolate;
    overflow: hidden;
    backdrop-filter: none;
}

.topbar p {
    color: var(--muted);
    margin-bottom: 0;
}

.muted-pill {
    background: #edf4ff;
    color: #2b5fae;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card,
.card {
    background: rgba(255,255,255,.92);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid #e6effb;
    backdrop-filter: blur(8px);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 12px;
}

.stat-card strong {
    display: block;
    font-size: 34px;
    margin-bottom: 10px;
    color: #205293;
}

.stat-card small {
    color: var(--muted);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 22px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    margin-bottom: 18px;
}

.card-head p {
    color: var(--muted);
    margin-bottom: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    align-items: end;
}

.compact-filters {
    margin-bottom: 18px;
}

.action-row {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mini-input {
    min-width: 120px;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

table th,
table td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid #edf3fc;
    font-size: 14px;
    vertical-align: top;
}

table th {
    color: var(--muted);
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: var(--success);
    color: var(--success-text);
}

.badge-warning {
    background: var(--warning);
    color: var(--warning-text);
}

.badge-danger {
    background: var(--danger);
    color: var(--danger-text);
}

.table-link {
    color: #2563eb;
    font-weight: 700;
}

.stack-list {
    display: grid;
    gap: 14px;
}

.mini-alert {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 1px solid #e7eef8;
    background: #f8fbff;
    border-radius: 18px;
    padding: 16px;
}

.mini-alert small,
.empty,
.muted {
    color: var(--muted);
}

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 24px 10px;
}

.danger-card {
    border-color: #f3d4d4;
    background: linear-gradient(180deg, #fffefe, #fff7f7);
}

.warning-card {
    border-color: #f1dfaf;
    background: linear-gradient(180deg, #fffefb, #fffaf0);
}

canvas {
    width: 100% !important;
    height: 320px !important;
}

.print-body {
    background: #eef4fc;
    padding: 30px;
}

.print-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.voucher {
    background: #fff;
    max-width: 900px;
    margin: 0 auto;
    padding: 36px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid #e5eef9;
    position: relative;
}

.voucher-void {
    border-color: #f0c7c7;
}

.void-banner {
    background: #fff1f1;
    color: #b42318;
    border: 1px solid #efc7c7;
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    font-weight: 800;
    margin-bottom: 18px;
    letter-spacing: 1px;
}

.voucher-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 2px solid #e6edf7;
    padding-bottom: 18px;
    margin-bottom: 24px;
}

.voucher-doc {
    text-align: right;
}

.voucher-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.voucher-grid label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.voucher-grid p {
    margin: 0;
    background: #f7fbff;
    border-radius: 14px;
    padding: 12px 14px;
    border: 1px solid #e5eef9;
}

.signatures {
    margin-top: 44px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.sign-box {
    border-top: 1px solid #7d93af;
    padding-top: 12px;
    text-align: center;
    min-height: 60px;
    color: #48617f;
}

@media (max-width: 1200px) {
    .stats-grid,
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1100px) {
    .login-wrap,
    .app-layout,
    .grid-2,
    .voucher-grid,
    .signatures,
    .role-boxes {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
    }

    .topbar,
    .card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 700px) {
    .stats-grid,
    .filters-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 18px;
    }

    .topbar,
    .card,
    .stat-card {
        padding: 18px;
    }
}

@media print {
    .print-actions {
        display: none;
    }

    body {
        background: #fff;
    }

    .voucher {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
    }
    
    .signatures {
            display: grid !important;
            grid-template-columns: 1fr 1fr !important;
            gap: 32px !important;
            align-items: end !important;
        }

        .sign-box {
            width: 100% !important;
            page-break-inside: avoid;
        }
        
}
.check-row {
    grid-column: 1 / -1;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text);
}

.check-inline input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.login-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid #dbe6f5;
    text-align: center;
    padding: 12px 16px;
    z-index: 999;
}

.login-footer-fixed p {
    margin: 0;
    font-size: 14px;
    color: #5f7c9f;
    font-weight: 600;
}

.login-body {
    padding-bottom: 70px;
}

.product-combo {
    position: relative;
}

.product-combo-input {
    width: 100%;
}

.product-combo-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-height: 260px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.product-combo.open .product-combo-list {
    display: block;
}

.product-combo-option {
    width: 100%;
    border: 0;
    background: #ffffff;
    text-align: left;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #edf3fc;
    display: block;
}

.product-combo-option:last-child {
    border-bottom: 0;
}

.product-combo-option:hover,
.product-combo-option:focus {
    background: #edf4ff;
    outline: none;
}

.product-combo-option strong {
    display: block;
    color: var(--text);
    font-size: 14px;
}

.product-combo-option small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.product-combo-empty {
    display: none;
    padding: 12px 14px;
    color: var(--muted);
    font-size: 13px;
}

.card-kardex-selector {
    position: relative;
    z-index: 200;
    overflow: visible;
}

.card-kardex-selector .filters-grid,
.card-kardex-selector .action-row,
.card-kardex-selector .product-combo-kardex {
    overflow: visible;
}

.product-combo-kardex {
    position: relative;
}

.product-combo-kardex.open {
    z-index: 500;
}

.product-combo-kardex .product-combo-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    margin-top: 0;
    max-height: 260px;
    z-index: 9999;
    display: none;
}

.product-combo-kardex.open .product-combo-list {
    display: block;
}


.card-productos-filtro {
    position: relative;
    z-index: 200;
    overflow: visible;
}

.card-productos-filtro .filters-grid,
.card-productos-filtro .action-row,
.card-productos-filtro .product-combo-filter {
    overflow: visible;
}

.product-combo-filter {
    position: relative;
}

.product-combo-filter.open {
    z-index: 500;
}

.product-combo-filter .product-combo-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    margin-top: 0;
    max-height: 260px;
    z-index: 9999;
    display: none;
}

.product-combo-filter.open .product-combo-list {
    display: block;
}

.table-pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin-top: 16px;
}

.input-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.card-proveedores-filtro {
    position: relative;
    z-index: 200;
    overflow: visible;
}

.card-proveedores-filtro .filters-grid,
.card-proveedores-filtro .action-row,
.card-proveedores-filtro .product-combo-filter {
    overflow: visible;
}

.card-categorias-filtro {
    position: relative;
    z-index: 200;
    overflow: visible;
}

.card-categorias-filtro .filters-grid,
.card-categorias-filtro .action-row,
.card-categorias-filtro .product-combo-filter {
    overflow: visible;
}

.card-categorias-filtro .product-combo-filter {
    position: relative;
}

.card-categorias-filtro .product-combo-filter.open {
    z-index: 500;
}

.card-categorias-filtro .product-combo-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    margin-top: 0;
    max-height: 260px;
    z-index: 9999;
    display: none;
}

.card-categorias-filtro .product-combo-filter.open .product-combo-list {
    display: block;
}

.card-catalogos-filtro {
    position: relative;
    z-index: 200;
    overflow: visible;
}

.card-catalogos-filtro .filters-grid,
.card-catalogos-filtro .action-row,
.card-catalogos-filtro .product-combo-filter {
    overflow: visible;
}

.card-catalogos-filtro .product-combo-filter {
    position: relative;
}

.card-catalogos-filtro .product-combo-filter.open {
    z-index: 500;
}

.card-catalogos-filtro .product-combo-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    margin-top: 0;
    max-height: 260px;
    z-index: 9999;
    display: none;
}

.card-catalogos-filtro .product-combo-filter.open .product-combo-list {
    display: block;
}

/* ===== AJUSTE VISUAL MÁS COMPACTO + SIDEBAR FIJO ===== */

body {
    font-size: 15px;
}

.topbar h1 {
    font-size: 26px;
    line-height: 1.15;
    margin-bottom: 8px;
}

.sidebar-brand h2 {
    font-size: 17px;
}

.sidebar-brand p,
.user-box span,
.topbar p,
.card-head p,
.stat-card span,
.stat-card small,
.pill,
.input-help,
.product-combo-option small,
.empty,
.muted {
    font-size: 12.5px;
}

.user-box strong {
    font-size: 15px;
}

.card h3,
.card-head h3 {
    font-size: 16px;
}

label,
.nav-link,
input,
select,
textarea,
table th,
table td,
.btn-primary,
.btn-secondary,
.btn-logout,
.product-combo-option strong {
    font-size: 13.5px;
}

.stat-card strong {
    font-size: 30px;
}

input,
select,
textarea {
    padding: 11px 13px;
}

.btn-primary,
.btn-secondary,
.btn-logout {
    padding: 12px 16px;
}

table th,
table td {
    padding: 12px 9px;
}

.badge {
    padding: 6px 10px;
    font-size: 11px;
}

.topbar,
.card,
.stat-card {
    padding: 20px;
}

.card-head {
    margin-bottom: 16px;
}

.filters-grid {
    gap: 12px;
}

.grid-2,
.stats-grid {
    gap: 18px;
}

canvas {
    height: 290px !important;
}

/* Desktop: sidebar fija, menú con scroll propio y logout estable */
@media (min-width: 981px) {
    .app-layout {
        height: 100vh;
        overflow: hidden;
    }

    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow: hidden;
    }

    .nav-menu {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-right: 4px;
        align-content: start;
    }

    .btn-logout {
        margin-top: 16px;
        flex-shrink: 0;
    }

    .main-content {
        height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
        scroll-padding-top: 110px;
    }
}
.section-divider {
    height: 1px;
    background: #dbe6f5;
    margin: 20px 0;
}

.card-planificacion-compras {
    position: relative;
    z-index: 200;
    overflow: visible;
}

.card-planificacion-compras .filters-grid,
.card-planificacion-compras .action-row,
.card-planificacion-compras .product-combo-filter {
    overflow: visible;
}

.card-planificacion-compras .product-combo-filter {
    position: relative;
}

.card-planificacion-compras .product-combo-filter.open {
    z-index: 500;
}

.card-planificacion-compras .product-combo-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    margin-top: 0;
    max-height: 260px;
    z-index: 9999;
    display: none;
}

.card-planificacion-compras .product-combo-filter.open .product-combo-list {
    display: block;
}

.card-planificacion-compras {
    overflow: visible;
}

.report-table-card {
    display: flex;
    flex-direction: column;
}

.report-table-card .table-wrap {
    flex: 1 1 auto;
}

.table-pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 14px;
}

#chartCategory {
    min-height: 320px;
}

@media (max-width: 1200px) {
    .filters-grid.compact-filters {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .filters-grid.compact-filters {
        grid-template-columns: 1fr;
    }
}

#chartCategory {
    min-height: 420px;
    width: 100%;
}

.topbar::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 1px;
    background: #e3edf9;
    pointer-events: none;
}

.main-content > *:not(.topbar) {
    position: relative;
    z-index: 1;
}

@media(max-width: 980px){
    .topbar{
        top: 8px;
        padding: 18px 20px;
    }
}

/* ===== AJUSTE FINAL: TOPBAR FIJA LIMPIA + COMBOS POR ENCIMA ===== */

/* fondo sólido del área de trabajo */
.main-content {
    background: linear-gradient(180deg, #f8fbff 0%, #f1f7fd 100%);
}

/* topbar fija sin mostrar contenido detrás */
.topbar {
    top: 0;
    z-index: 12000;
    background: #f8fbff;
    border: 1px solid #dfeafb;
    box-shadow: 0 18px 30px rgba(49, 94, 160, .14);
    overflow: visible;
}

/* “cortina” superior para tapar cualquier contenido al hacer scroll */
.topbar::before {
    content: "";
    position: absolute;
    left: -28px;
    right: -28px;
    top: -24px;
    bottom: -18px;
    background: linear-gradient(
        180deg,
        #f8fbff 0%,
        #f6faff 82%,
        rgba(248, 251, 255, 0) 100%
    );
    z-index: -1;
    pointer-events: none;
}

/* borde/sombra inferior suave para que no se note el contenido pasando debajo */
.topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 18px;
    background: linear-gradient(
        180deg,
        rgba(248, 251, 255, 1) 0%,
        rgba(248, 251, 255, .96) 50%,
        rgba(248, 251, 255, 0) 100%
    );
    pointer-events: none;
}

/* todo el contenido normal queda por debajo del topbar */
.main-content > *:not(.topbar) {
    position: relative;
    z-index: 1;
}

/* ===== COMBOS / LISTAS FLOTANTES ===== */

/* base */
.product-combo,
.product-combo-filter,
.product-combo-kardex {
    position: relative;
}

/* cuando un combo está abierto, sube por encima de todos los contenedores */
.product-combo.open,
.product-combo-filter.open,
.product-combo-kardex.open {
    z-index: 11000;
}

/* la lista queda encima de cards, grids y tablas, pero debajo del título fijo */
.product-combo .product-combo-list,
.product-combo-filter .product-combo-list,
.product-combo-kardex .product-combo-list {
    z-index: 11001;
}

/* la card o sección que contiene un combo abierto también sube */
.card:has(.product-combo.open),
.card:has(.product-combo-filter.open),
.card:has(.product-combo-kardex.open),
section:has(.product-combo.open),
section:has(.product-combo-filter.open),
section:has(.product-combo-kardex.open),
.grid-2:has(.product-combo.open),
.grid-2:has(.product-combo-filter.open),
.grid-2:has(.product-combo-kardex.open) {
    position: relative;
    z-index: 10000;
    overflow: visible;
}

/* evita que grids y cabeceras corten visualmente las listas */
.card,
.stat-card,
.grid-2,
.stats-grid,
.filters-grid,
.action-row,
.card-head {
    overflow: visible;
}

/* deja más espacio de anclaje para el sticky */
@media (min-width: 981px) {
    .main-content {
        scroll-padding-top: 130px;
    }
}

/* ajuste móvil */
@media (max-width: 980px) {
    .topbar {
        top: 0;
    }

    .topbar::before {
        left: -18px;
        right: -18px;
        top: -14px;
        bottom: -14px;
    }
}

.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    color: var(--muted);
    font-weight: 700;
    padding: 0 4px;
}