/* ===============================
   GEFRUTS DASHBOARD
   Bootstrap 5.3 — Tema claro
================================ */

/* VARIABLES */

:root {
    --verde: #39B54A;
    --verde-dark: #166534;
    --verde-light: #84CC16;
    --amarillo: #EAB308;
    --azul: #0284C7;
    --bg: #F1F5F9;
    --panel: #FFFFFF;
    --text: #0F172A;
    --muted: #64748B;
    --border: #E2E8F0;
}

/* GENERAL */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
}

/* ===============================
   SIDEBAR
================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: linear-gradient(180deg, #14532d, #166534);
    padding: 16px 10px;
    overflow-y: auto;
    z-index: 1000;
}

.logo-area {
    position: relative;
    text-align: center;
    padding-bottom: 16px;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.navbar-brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-hamburger {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #F8FAFC;
    color: var(--text);
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: .2s;
}

.btn-hamburger:hover {
    background: #ECFDF5;
    border-color: #BBF7D0;
    color: var(--verde-dark);
}

.logo {
    width: 110px;
    background: white;
    border-radius: 14px;
    padding: 6px;
}

.menu {
    list-style: none;
    padding: 0;
}

.menu li {
    margin-bottom: 4px;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    transition: .3s;
}

.menu a:hover,
.menu li.active > a:not([data-bs-toggle]) {
    background: rgba(255, 255, 255, .15);
    color: var(--amarillo);
}

.menu i:first-child {
    font-size: 15px;
}

.menu .collapse a,
.menu .menu-collapse a {
    padding-left: 34px;
    font-size: 12px;
    color: #d1fae5;
}

.menu .collapse a.menu-link-active,
.menu .menu-collapse a.menu-link-active {
    background: rgba(255, 255, 255, .22) !important;
    color: var(--amarillo) !important;
    font-weight: 600;
}

/* ===============================
   CONTENT
================================ */

.content {
    margin-left: 240px;
    min-height: 100vh;
    padding: 20px;
}

.navbar {
    background: var(--panel);
    border-radius: 18px;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
    border: 1px solid var(--border);
}

.navbar h4 {
    margin: 0;
    font-weight: 700;
    color: var(--text);
}

.navbar > div > span {
    font-size: 13px;
    color: var(--muted);
}

/* Acciones del navbar */

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tasa-dia {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ECFDF5;
    border: 1px solid #BBF7D0;
    border-radius: 12px;
    padding: 8px 14px;
    color: var(--verde-dark);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tasa-dia:hover,
.tasa-dia:focus-visible {
    background: #D1FAE5;
    border-color: #86EFAC;
    outline: none;
}

.tasa-dia > i {
    font-size: 20px;
    color: var(--verde);
}

.tasa-dia-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.tasa-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

.tasa-dia strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--verde-dark);
}

.btn-icon {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #F8FAFC;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: .2s;
}

.btn-icon:hover,
.btn-icon[aria-expanded="true"] {
    background: #ECFDF5;
    border-color: #BBF7D0;
    color: var(--verde-dark);
}

.notif-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #DC2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.notif-dropdown {
    width: 320px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
    margin-top: 8px !important;
    overflow: hidden;
}

.notif-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    background: #F8FAFC;
}

.notif-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: .2s;
}

.notif-item:hover {
    background: #F0FDF4;
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.notif-icon.danger {
    background: #FEF2F2;
    color: #DC2626;
}

.notif-icon.warning {
    background: #FFFBEB;
    color: #D97706;
}

.notif-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.notif-body strong {
    font-size: 13px;
    font-weight: 600;
}

.notif-body small {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
}

.notif-footer {
    padding: 10px 16px;
    text-align: center;
    background: #F8FAFC;
}

.notif-footer a {
    font-size: 13px;
    font-weight: 600;
    color: var(--verde-dark);
    text-decoration: none;
}

.notif-footer a:hover {
    text-decoration: underline;
}

/* Usuario / dropdown */

.user-menu {
    position: relative;
}

.user {
    background: #F8FAFC;
    border: 1px solid var(--border);
    padding: 10px 15px;
    border-radius: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.2;
    transition: .2s;
}

.user.dropdown-toggle::after {
    margin-left: 4px;
}

.user:hover,
.user[aria-expanded="true"] {
    background: #ECFDF5;
    border-color: #BBF7D0;
    color: var(--verde-dark);
}

.user i.bi-chevron-down {
    font-size: 12px;
    margin-left: 4px;
    opacity: .7;
}

.user-dropdown {
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
    margin-top: 8px !important;
}

.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
}

.user-dropdown .dropdown-item:hover {
    background: #F0FDF4;
    color: var(--verde-dark);
}

.user-dropdown .dropdown-item.text-danger:hover {
    background: #FEF2F2;
    color: #DC2626;
}

.user-dropdown .dropdown-divider {
    margin: 6px 0;
    border-color: var(--border);
}

/* ===============================
   CARDS
================================ */

.card-box {
    background: var(--panel);
    border-radius: 20px;
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
    border: 1px solid var(--border);
    transition: .3s;
}

a.card-box-link {
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
}

a.card-box-link:link,
a.card-box-link:visited,
a.card-box-link:hover,
a.card-box-link:active,
a.card-box-link:focus {
    text-decoration: none !important;
    color: inherit !important;
}

a.card-box-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .1);
    border-color: #86EFAC;
}

a.card-box-link:focus-visible {
    outline: 2px solid var(--verde);
    outline-offset: 2px;
}

a.card-box-link p,
a.card-box-link h2,
a.card-box-link span,
a.card-box-link .icon {
    text-decoration: none !important;
}

a.card-box-link .icon {
    color: var(--verde);
    opacity: .9;
}

a.card-box-link p {
    color: var(--muted);
}

a.card-box-link h2 {
    color: var(--text);
}

a.card-box-link .text-muted {
    color: var(--muted) !important;
}

.card-box-inventario {
    align-items: flex-start;
    min-height: 140px;
}

.card-box-inventario .btn-editar-campo {
    margin-top: 8px;
    padding: 2px 10px;
    font-size: 12px;
}

.card-box-inventario .btn-editar-campo-spacer {
    visibility: hidden;
    pointer-events: none;
    display: inline-block;
}

.card-box-inventario h2 {
    font-size: 28px;
}

@media (max-width: 1200px) {
    .card-box-inventario h2 {
        font-size: 24px;
    }
}

.card-box p {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 0;
}

.card-box h2 {
    font-size: 32px;
    margin: 5px 0;
    color: var(--text);
}

.positive {
    color: #16A34A;
    font-size: 13px;
}

.icon {
    font-size: 45px;
    color: var(--verde);
    opacity: .9;
}

/* ===============================
   PANELS
================================ */

.panel {
    background: var(--panel);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
    border: 1px solid var(--border);
}

.panel h5 {
    margin-bottom: 25px;
    font-weight: 600;
    color: var(--text);
}

/* ===============================
   STOCK
================================ */

.stock {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--muted);
}

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

.progress {
    height: 10px;
    background: #E2E8F0;
    border-radius: 20px;
    margin-bottom: 25px;
}

.progress-bar {
    background: var(--verde);
    border-radius: 20px;
    width: 75%;
}

.progress-bar.bg-warning {
    background: var(--amarillo) !important;
    width: 60%;
}

/* ===============================
   TABLE
================================ */

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

.table thead {
    color: var(--verde-dark);
}

.table tbody tr {
    border-color: var(--border);
}

.badge {
    padding: 8px 12px;
    border-radius: 20px;
}

/* ===============================
   CHART
================================ */

canvas {
    max-height: 320px;
}

/* ===============================
   MODAL CAMBIO DE CONTRASEÑA
================================ */

.modal-password {
    border: none;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
}

/* Modales altos de zonas: footer siempre visible, body con scroll */
.modal-zona {
    max-height: calc(100vh - 1.5rem);
    margin: 0.75rem auto;
}
.modal-zona .modal-content {
    max-height: calc(100vh - 1.5rem);
    display: flex;
    flex-direction: column;
}
.modal-zona .modal-zona-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.modal-zona .modal-zona-form .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
}
.modal-zona .modal-zona-form .modal-footer {
    flex-shrink: 0;
}

.modal-password .modal-header {
    border-bottom: 1px solid var(--border);
    background: #F8FAFC;
    padding: 16px 20px;
}

.modal-password .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.modal-password .modal-title i {
    color: var(--verde);
}

.modal-password .modal-body {
    padding: 20px;
}

.modal-password .modal-footer {
    border-top: 1px solid var(--border);
    padding: 14px 20px;
}

.password-rules {
    font-size: 13px;
    color: var(--muted);
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.modal-password .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.modal-password .form-control {
    border-radius: 10px;
    border-color: var(--border);
    padding: 10px 42px 10px 12px;
    font-size: 14px;
}

.modal-password .form-control:focus {
    border-color: #86EFAC;
    box-shadow: 0 0 0 .2rem rgba(57, 181, 74, .2);
}

.modal-password .form-control.is-invalid {
    border-color: #DC2626;
    padding-right: 42px;
    background-image: none;
}

.modal-password .input-password:has(.is-invalid) + .invalid-feedback {
    display: block;
}

.input-password {
    position: relative;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--muted);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    z-index: 5;
}

.toggle-password:hover {
    color: var(--verde-dark);
    background: #ECFDF5;
}

.btn-gefruts {
    background: var(--verde);
    border-color: var(--verde);
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 16px;
}

.btn-gefruts:hover {
    background: var(--verde-dark);
    border-color: var(--verde-dark);
    color: #fff;
}

.modal-password .btn-light {
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* ===============================
   MODAL INFORMACIÓN
================================ */

.modal-info {
    border: none;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
}

.modal-info .modal-header {
    border-bottom: 1px solid var(--border);
    background: #F8FAFC;
    padding: 16px 20px;
}

.modal-info .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.modal-info .modal-title i {
    color: var(--verde);
}

.modal-info .modal-body {
    padding: 20px;
}

.modal-info .modal-footer {
    border-top: 1px solid var(--border);
    padding: 14px 20px;
}

.info-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.info-logo {
    width: 64px;
    height: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
}

.info-brand h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.info-brand span {
    font-size: 12px;
    color: var(--muted);
}

.info-resumen {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 18px;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 12px;
    padding: 12px 14px;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.info-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-list span {
    color: var(--muted);
}

.info-list strong {
    color: var(--text);
    font-weight: 600;
    text-align: right;
}

.info-list a {
    color: var(--verde-dark);
    text-decoration: none;
}

.info-list a:hover {
    text-decoration: underline;
}

/* ===============================
   CRUD (Usuarios y módulos)
================================ */

.card-box-crud {
    display: block;
    width: 100%;
}

.card-box-crud .input-group-text {
    border-color: var(--border);
    color: var(--muted);
}

.card-box-crud .input-group .form-control {
    border-color: var(--border);
    font-size: 14px;
}

.card-box-crud .input-group .form-control:focus {
    border-color: #86EFAC;
    box-shadow: 0 0 0 .2rem rgba(57, 181, 74, .2);
}

.card-box-crud .input-group:focus-within .input-group-text {
    border-color: #86EFAC;
}

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

.table-crud thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--verde-dark);
    border-bottom-width: 1px;
}

.table-crud td {
    font-size: 13px;
    vertical-align: middle;
}

/* Zonas: columnas mayorista / zona / vendedores — tinte verde muy sutil */
#tablaZonas th.col-mayorista,
#tablaZonas td.col-mayorista,
#tablaZonas th.col-zona-tint,
#tablaZonas td.col-zona-tint {
    background-color: rgba(57, 181, 74, 0.07);
}

#tablaZonas thead th.col-mayorista,
#tablaZonas thead th.col-zona-tint {
    background-color: rgba(57, 181, 74, 0.11);
}

.historial-acciones {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.historial-acciones-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

.historial-acciones .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    line-height: 1;
}

.venta-estatus-bar {
    height: 8px;
    border-radius: 999px;
    background: #E2E8F0;
}

.venta-estatus-bar .progress-bar {
    border-radius: 999px;
}

.venta-estatus-steps {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-top: 6px;
    font-size: 10px;
    color: var(--muted);
}

.venta-estatus-steps .active {
    color: var(--verde-dark);
    font-weight: 600;
}

/* Tablas CRUD: tarjetas en móvil */
@media (max-width: 767.98px) {
    .table-mobile thead {
        display: none;
    }

    .table-mobile,
    .table-mobile tbody,
    .table-mobile tr,
    .table-mobile td {
        display: block;
        width: 100%;
    }

    .table-mobile tr {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        margin-bottom: 12px;
        padding: 8px 12px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    }

    .table-mobile td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        border: none;
        border-bottom: 1px solid #F1F5F9;
        padding: 10px 4px;
        text-align: right;
    }

    .table-mobile td:last-child {
        border-bottom: none;
    }

    .table-mobile td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: var(--muted);
        text-align: left;
        flex-shrink: 0;
    }

    .table-mobile td .cell-stack {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
        min-width: 0;
        text-align: right;
    }

    .table-mobile td.col-id {
        display: none; /* ID menos útil en móvil */
    }

    /* Acciones: sin etiqueta, botones del mismo tamaño */
    .table-mobile td.cell-acciones,
    .table-mobile td[data-label="Acciones"] {
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .table-mobile td.cell-acciones::before,
    .table-mobile td[data-label="Acciones"]::before {
        display: none;
        content: none;
    }

    .table-mobile td.cell-acciones > .d-inline-flex,
    .table-mobile td.cell-acciones .historial-acciones,
    .table-mobile td[data-label="Acciones"] > .d-inline-flex {
        width: 100%;
        justify-content: flex-end;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .table-mobile td.cell-acciones .btn,
    .table-mobile td[data-label="Acciones"] .btn {
        width: auto;
        height: 2.75rem;
        padding: 10px;
        flex: 0 0 2.75rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
    }

    .table-mobile td.cell-acciones form,
    .table-mobile td[data-label="Acciones"] form {
        display: inline-flex;
        margin: 0;
    }

    .table-mobile .text-break {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* Formularios con filas editables (pagos / ventas): tarjeta por fila en móvil */
    .table-responsive:has(.table-form-cards) {
        overflow: visible;
    }

    .table-form-cards.table-mobile tr.cli-row,
    .table-form-cards.table-mobile tr.item-row {
        padding: 12px 14px 14px;
        margin-bottom: 14px;
    }

    .table-form-cards.table-mobile td {
        display: block;
        text-align: left;
        padding: 8px 0;
        border-bottom: 1px solid #F1F5F9;
    }

    .table-form-cards.table-mobile td::before {
        display: block;
        margin-bottom: 6px;
        flex: none;
    }

    .table-form-cards.table-mobile td.col-tasa.d-none {
        display: none !important;
    }

    .table-form-cards.table-mobile td .form-control,
    .table-form-cards.table-mobile td .form-select,
    .table-form-cards.table-mobile td .select2-container {
        width: 100% !important;
        max-width: 100%;
    }

    .table-form-cards.table-mobile td.cell-acciones {
        border-bottom: none;
        padding-top: 12px;
    }

    .table-form-cards.table-mobile td.cell-acciones::before {
        display: none;
    }

    .table-form-cards.table-mobile td.cell-acciones .btn {
        width: 100%;
    }

    /* Venta: equiv / P.U. / subtotal en una sola fila */
    #tablaItems.table-form-cards.table-mobile tr.item-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 8px;
        align-items: start;
    }

    #tablaItems.table-form-cards.table-mobile tr.item-row > td:nth-child(1),
    #tablaItems.table-form-cards.table-mobile tr.item-row > td:nth-child(2),
    #tablaItems.table-form-cards.table-mobile tr.item-row > td:nth-child(3),
    #tablaItems.table-form-cards.table-mobile tr.item-row > td.cell-acciones {
        grid-column: 1 / -1;
    }

    #tablaItems.table-form-cards.table-mobile tr.item-row > td.item-equiv,
    #tablaItems.table-form-cards.table-mobile tr.item-row > td.item-punit,
    #tablaItems.table-form-cards.table-mobile tr.item-row > td.item-sub {
        width: auto;
        margin: 0;
        padding: 8px 0 10px;
        border-bottom: 1px solid #F1F5F9;
        text-align: left;
        font-variant-numeric: tabular-nums;
    }

    #tablaItems.table-form-cards.table-mobile tr.item-row > td.item-equiv::before,
    #tablaItems.table-form-cards.table-mobile tr.item-row > td.item-punit::before,
    #tablaItems.table-form-cards.table-mobile tr.item-row > td.item-sub::before {
        margin-bottom: 4px;
        font-size: 11px;
    }

    /* Zonas: tarjeta compacta + acordeón de precios en móvil */
    #tablaZonas.table-mobile tr {
        position: relative;
        display: flex;
        flex-direction: column;
        padding: 12px 12px 10px;
        padding-top: 14px;
        gap: 0;
    }

    #tablaZonas.table-mobile td.cell-sel {
        position: absolute;
        top: 10px;
        right: 12px;
        width: auto;
        border: none;
        padding: 0;
        margin: 0;
        justify-content: flex-end;
        z-index: 2;
        order: 1;
    }

    #tablaZonas.table-mobile td.cell-sel::before {
        display: none;
    }

    #tablaVentas.table-mobile td.cell-sel {
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: none;
        padding-top: 12px;
    }

    #tablaVentas.table-mobile td.cell-sel:not(:has(.check-despacho)) {
        display: none;
    }

    #tablaVentas.table-mobile td.cell-sel .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
        margin: 0;
        flex-shrink: 0;
    }

    #tablaZonas.table-mobile td.js-zona-nombre {
        order: 2;
        border-bottom: none;
        padding: 4px 36px 8px 4px;
        justify-content: flex-start;
    }

    #tablaZonas.table-mobile td.js-zona-nombre::before {
        display: none;
    }

    #tablaZonas.table-mobile .btn-zona-acordeon {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        color: var(--verde-dark);
        font-weight: 600;
        font-size: 15px;
        line-height: 1.3;
    }

    #tablaZonas.table-mobile .btn-zona-acordeon:hover,
    #tablaZonas.table-mobile .btn-zona-acordeon:focus {
        color: var(--verde);
    }

    #tablaZonas.table-mobile .zona-acordeon-titulo {
        flex: 1;
        min-width: 0;
        text-align: left;
        word-break: break-word;
    }

    #tablaZonas.table-mobile .zona-acordeon-icon {
        flex-shrink: 0;
        font-size: 1rem;
        color: var(--muted);
        transition: transform .2s ease;
    }

    #tablaZonas.table-mobile tr.is-expanded .zona-acordeon-icon {
        transform: rotate(180deg);
    }

    #tablaZonas.table-mobile td.zona-card-detalle {
        display: none;
        order: 3;
    }

    #tablaZonas.table-mobile tr.is-expanded td.zona-card-detalle {
        display: flex;
    }

    #tablaZonas.table-mobile tr.is-expanded td.js-zona-nombre + td.zona-card-detalle {
        border-top: 1px solid #F1F5F9;
        margin-top: 4px;
        padding-top: 12px;
    }

    #tablaZonas.table-mobile td.cell-acciones {
        order: 4;
        border-bottom: none;
        border-top: 1px solid #F1F5F9;
        margin-top: 4px;
        padding-top: 10px;
        justify-content: flex-end;
    }

    #tablaZonas.table-mobile td.cell-acciones::before {
        display: none;
    }

    #tablaZonas.table-mobile .btn-zona-acordeon {
        pointer-events: auto;
    }

    #tablaZonas.table-mobile .zona-acordeon-icon {
        display: inline-block;
    }

    /* Historial de precios: tarjeta compacta (fecha + acciones) */
    #tablaHistorialPrecios.table-mobile tr {
        display: flex;
        flex-direction: column;
        padding: 12px 12px 10px;
        gap: 0;
    }

    #tablaHistorialPrecios.table-mobile td.js-hist-fecha {
        order: 1;
        border-bottom: none;
        padding: 4px 4px 8px;
        justify-content: flex-start;
    }

    #tablaHistorialPrecios.table-mobile td.js-hist-fecha::before {
        display: none;
    }

    #tablaHistorialPrecios.table-mobile .btn-hist-acordeon {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        color: var(--verde-dark);
        font-weight: 600;
        font-size: 15px;
        line-height: 1.3;
        pointer-events: auto;
    }

    #tablaHistorialPrecios.table-mobile .btn-hist-acordeon:hover,
    #tablaHistorialPrecios.table-mobile .btn-hist-acordeon:focus {
        color: var(--verde);
    }

    #tablaHistorialPrecios.table-mobile .hist-acordeon-titulo {
        flex: 1;
        min-width: 0;
        text-align: left;
        word-break: break-word;
    }

    #tablaHistorialPrecios.table-mobile .hist-acordeon-icon {
        display: inline-block;
        flex-shrink: 0;
        font-size: 1rem;
        color: var(--muted);
        transition: transform .2s ease;
    }

    #tablaHistorialPrecios.table-mobile tr.is-expanded .hist-acordeon-icon {
        transform: rotate(180deg);
    }

    #tablaHistorialPrecios.table-mobile td.hist-card-detalle {
        display: none;
        order: 2;
    }

    #tablaHistorialPrecios.table-mobile tr.is-expanded td.hist-card-detalle {
        display: flex;
    }

    #tablaHistorialPrecios.table-mobile tr.is-expanded td.js-hist-fecha + td.hist-card-detalle {
        border-top: 1px solid #F1F5F9;
        margin-top: 4px;
        padding-top: 12px;
    }

    #tablaHistorialPrecios.table-mobile td.cell-acciones {
        order: 3;
        border-bottom: none;
        border-top: 1px solid #F1F5F9;
        margin-top: 4px;
        padding-top: 10px;
        justify-content: flex-end;
    }

    #tablaHistorialPrecios.table-mobile td.cell-acciones::before {
        display: none;
    }
}

/* Desktop: el botón del acordeón se ve como texto normal */
#tablaZonas .btn-zona-acordeon,
#tablaHistorialPrecios .btn-hist-acordeon {
    color: inherit;
    font-weight: inherit;
    font-size: inherit;
    pointer-events: none;
}

#tablaZonas .zona-acordeon-icon,
#tablaHistorialPrecios .hist-acordeon-icon {
    display: none;
}

.badge-rol {
    background: #ECFDF5;
    color: var(--verde-dark);
    border: 1px solid #BBF7D0;
    font-weight: 600;
}

.crud-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--muted);
}

.modal-password .form-select {
    border-radius: 10px;
    border-color: var(--border);
    font-size: 14px;
    padding: 10px 12px;
}

.modal-password .form-select:focus {
    border-color: #86EFAC;
    box-shadow: 0 0 0 .2rem rgba(57, 181, 74, .2);
}

#modalRegistrarPago .modal-dialog {
    max-height: calc(100vh - 1.5rem);
    margin: 0.75rem auto;
}
#modalRegistrarPago .modal-content {
    max-height: calc(100vh - 1.5rem);
    display: flex;
    flex-direction: column;
}
#modalRegistrarPago .modal-pago-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
#modalRegistrarPago .modal-pago-form .modal-header,
#modalRegistrarPago .modal-pago-form .modal-footer {
    flex-shrink: 0;
}
#modalRegistrarPago .modal-pago-form .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

#modalRegistrarPago .select2-container {
    width: 100% !important;
}

#modalRegistrarPago .select2-container .select2-selection--single {
    min-height: 42px;
    border-radius: 10px;
    border-color: var(--border);
    font-size: 14px;
}

.btn-desc-esp.is-on {
    color: #fff;
    background-color: #198754;
    border-color: #198754;
}

.pago-bloque {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.pago-bloque-cabecera {
    padding: 12px 14px;
    background: #F8FAFC;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.pago-desglose thead th {
    font-size: 11px;
}

.pago-desglose td {
    font-size: 12px;
}

/* Ver venta: tablas con scroll horizontal en móvil */
@media (max-width: 767.98px) {
    #modalDetalleVenta .table-scroll-h {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        margin-bottom: 4px;
        padding-bottom: 2px;
    }

    #modalDetalleVenta .table-scroll-h > table {
        min-width: 560px;
        width: max-content;
        max-width: none;
    }

    #modalDetalleVenta .table-scroll-h th,
    #modalDetalleVenta .table-scroll-h td {
        white-space: nowrap;
    }
}

/* ===============================
   LOGIN
================================ */

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(57, 181, 74, .12), transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(22, 101, 52, .1), transparent 45%),
        var(--bg);
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.login-brand {
    background: linear-gradient(165deg, #14532d 0%, #166534 45%, #39B54A 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    top: -120px;
    right: -100px;
}

.login-brand::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(250, 204, 21, .12);
    bottom: -80px;
    left: -60px;
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 380px;
}

.login-logo {
    width: 140px;
    background: #fff;
    border-radius: 18px;
    padding: 10px;
    margin-bottom: 28px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}

.login-brand h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.login-brand p {
    font-size: 1.05rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, .88);
    margin: 0;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

.login-card-header {
    margin-bottom: 28px;
}

.login-card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.login-card-header p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.login-card .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.input-icon {
    position: relative;
}

.input-icon > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 15px;
    pointer-events: none;
    z-index: 2;
}

.input-icon .form-control {
    border-radius: 10px;
    border-color: var(--border);
    padding: 11px 42px 11px 40px;
    font-size: 14px;
}

.input-icon .form-control:focus {
    border-color: #86EFAC;
    box-shadow: 0 0 0 .2rem rgba(57, 181, 74, .2);
}

.input-icon .form-control.is-invalid {
    border-color: #DC2626;
    background-image: none;
}

.input-icon:has(.is-invalid) + .invalid-feedback {
    display: block;
}

.login-meta {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0 22px;
}

.login-forgot {
    font-size: 13px;
    font-weight: 600;
    color: var(--verde-dark);
    text-decoration: none;
}

.login-forgot:hover {
    color: var(--verde);
    text-decoration: underline;
}

.login-submit {
    padding: 11px 16px;
    font-size: 15px;
    border-radius: 10px;
}

.login-footer {
    margin: 24px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

/* ===============================
   RESPONSIVE
================================ */

@media (max-width: 992px) {
    .sidebar {
        left: -240px;
        transition: left .3s ease;
        box-shadow: 8px 0 30px rgba(15, 23, 42, .2);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-close {
        display: inline-flex;
    }

    .btn-hamburger {
        display: inline-flex;
    }

    .content {
        margin-left: 0;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .login-wrap {
        grid-template-columns: 1fr;
    }

    .login-brand {
        min-height: 240px;
        padding: 36px 24px;
    }

    .login-brand h1 {
        font-size: 1.75rem;
    }

    .login-logo {
        width: 110px;
        margin-bottom: 18px;
    }
}

@media (max-width: 768px) {
    .tasa-label {
        display: none;
    }

    .navbar-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 576px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .navbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .card-box h2 {
        font-size: 25px;
    }

    .login-card {
        padding: 28px 20px;
        border-radius: 16px;
    }

    .login-panel {
        padding: 24px 16px 40px;
    }
}

/* Botón flotante: ir al principio */
.btn-scroll-top {
    position: fixed;
    right: 16px;
    bottom: 22px;
    z-index: 1080;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--verde);
    color: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .22);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.btn-scroll-top.is-visible {
    display: inline-flex;
}

.btn-scroll-top:hover,
.btn-scroll-top:focus {
    background: var(--verde-dark);
    color: #fff;
}

/* CxC: encabezado de cliente apilado (móvil) */
.cxc-grupo-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
    line-height: 1.35;
}

.cxc-grupo-cliente {
    font-weight: 700;
}

.cxc-grupo-head {
    width: 100%;
}

.cxc-grupo-resumen {
    margin-top: 2px;
}

.table-cxc-reporte .cxc-total-cliente td {
    background: #F8FAFC;
}

.table-cxc-reporte .btn-cxc-acordeon {
    color: inherit;
    font-weight: inherit;
    pointer-events: none;
}

.table-cxc-reporte .cxc-acordeon-icon {
    display: none;
}

@media (max-width: 767.98px) {
    .table-mobile tr.cxc-cols-head {
        display: none;
    }

    .table-cxc-reporte.table-mobile .btn-cxc-acordeon {
        pointer-events: auto;
    }

    .table-cxc-reporte.table-mobile .cxc-acordeon-icon {
        display: inline-block;
        flex-shrink: 0;
        color: var(--muted);
        transition: transform .2s ease;
    }

    .table-cxc-reporte.table-mobile tr.cxc-cliente-head.is-expanded .cxc-acordeon-icon {
        transform: rotate(180deg);
    }

    .table-cxc-reporte.table-mobile tr.cxc-detalle {
        display: none !important;
    }

    .table-cxc-reporte.table-mobile tr.cxc-detalle.is-open:not(.cxc-cols-head) {
        display: block !important;
    }

    .table-cxc-reporte.table-mobile tr.cxc-detalle.is-open:not(.cxc-cols-head) td {
        display: flex;
    }

    .table-mobile td.cxc-cliente-grupo {
        display: block;
        text-align: left;
        justify-content: flex-start;
        border-bottom: none;
        padding-bottom: 6px;
    }

    .table-mobile td.cxc-cliente-grupo::before {
        display: none;
    }

    .table-mobile td.cxc-cliente-grupo .cxc-grupo-info {
        align-items: flex-start;
        text-align: left;
        width: 100%;
    }

    .table-mobile tfoot,
    .table-mobile tfoot tr,
    .table-mobile tfoot td {
        display: block;
        width: 100%;
    }

    .table-mobile tfoot tr.cxc-total-general {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        margin-bottom: 12px;
        padding: 8px 12px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    }

    .table-mobile tfoot td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        border: none;
        border-bottom: 1px solid #F1F5F9;
        padding: 10px 4px;
        text-align: right;
    }

    .table-mobile tfoot td:last-child {
        border-bottom: none;
    }

    .table-mobile tfoot td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: var(--muted);
        text-align: left;
        flex-shrink: 0;
    }

    .table-mobile tfoot td[data-label=""]::before {
        content: none;
    }

    .table-mobile tfoot td[data-label=""] {
        justify-content: flex-start;
        text-align: left;
        border-bottom: 1px solid #F1F5F9;
        padding-bottom: 8px;
        margin-bottom: 2px;
    }
}

/* Reporte ventas por vendedor */
.vv-grupo-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
    line-height: 1.35;
}

.vv-grupo-vendedor {
    font-weight: 700;
    width: 100%;
}

.vv-grupo-resumen {
    margin-top: 2px;
}

.vv-cols-head td {
    border-bottom-color: var(--border);
    background: #F8FAFC;
    white-space: nowrap;
}

.table-ventas-vendedor .vv-subtotal-pagina td,
.table-ventas-vendedor .vv-total-vendedor td,
.table-ventas-vendedor .vv-subtotal-general-pagina td {
    background: #F8FAFC;
}

.table-ventas-vendedor .vv-continua td {
    font-style: italic;
}

.table-ventas-vendedor .btn-vv-acordeon {
    color: inherit;
    font-weight: inherit;
    pointer-events: none;
}

.table-ventas-vendedor .vv-acordeon-icon {
    display: none;
}

@media (max-width: 767.98px) {
    .table-mobile tr.vv-cols-head {
        display: none;
    }

    .table-ventas-vendedor.table-mobile .btn-vv-acordeon {
        pointer-events: auto;
    }

    .table-ventas-vendedor.table-mobile .vv-acordeon-icon {
        display: inline-block;
        flex-shrink: 0;
        color: var(--muted);
        transition: transform .2s ease;
    }

    .table-ventas-vendedor.table-mobile tr.vv-vendedor-head.is-expanded .vv-acordeon-icon {
        transform: rotate(180deg);
    }

    .table-ventas-vendedor.table-mobile tr.vv-detalle {
        display: none !important;
    }

    .table-ventas-vendedor.table-mobile tr.vv-detalle.is-open:not(.vv-cols-head) {
        display: block !important;
    }

    .table-ventas-vendedor.table-mobile tr.vv-detalle.is-open:not(.vv-cols-head) td {
        display: flex;
    }

    .table-mobile td.vv-vendedor-grupo {
        display: block;
        text-align: left;
        justify-content: flex-start;
        border-bottom: none;
        padding-bottom: 6px;
    }

    .table-mobile td.vv-vendedor-grupo::before {
        display: none;
    }

    .table-mobile td.vv-vendedor-grupo .vv-grupo-info {
        align-items: flex-start;
        text-align: left;
        width: 100%;
    }

    .table-mobile tfoot tr.vv-subtotal-general-pagina,
    .table-mobile tfoot tr.vv-total-general {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        margin-bottom: 12px;
        padding: 8px 12px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    }
}

.vc-grupo-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
    line-height: 1.35;
}

.vc-grupo-cliente {
    font-weight: 700;
}

.vc-grupo-resumen {
    margin-top: 2px;
}

.vc-cols-head td {
    border-bottom-color: var(--border);
    background: #F8FAFC;
    white-space: nowrap;
}

.table-ventas-cliente .vc-subtotal-pagina td,
.table-ventas-cliente .vc-total-cliente td,
.table-ventas-cliente .vc-subtotal-general-pagina td {
    background: #F8FAFC;
}

.table-ventas-cliente .vc-continua td {
    font-style: italic;
}

.table-ventas-cliente .btn-vc-acordeon {
    color: inherit;
    font-weight: inherit;
    pointer-events: none;
}

.table-ventas-cliente .vc-acordeon-icon {
    display: none;
}

@media (max-width: 767.98px) {
    .table-mobile tr.vc-cols-head {
        display: none;
    }

    .table-ventas-cliente.table-mobile .btn-vc-acordeon {
        pointer-events: auto;
    }

    .table-ventas-cliente.table-mobile .vc-acordeon-icon {
        display: inline-block;
        flex-shrink: 0;
        color: var(--muted);
        transition: transform .2s ease;
    }

    .table-ventas-cliente.table-mobile tr.vc-cliente-head.is-expanded .vc-acordeon-icon {
        transform: rotate(180deg);
    }

    .table-ventas-cliente.table-mobile tr.vc-detalle {
        display: none !important;
    }

    .table-ventas-cliente.table-mobile tr.vc-detalle.is-open:not(.vc-cols-head) {
        display: block !important;
    }

    .table-ventas-cliente.table-mobile tr.vc-detalle.is-open:not(.vc-cols-head) td {
        display: flex;
    }

    .table-mobile td.vc-cliente-grupo {
        display: block;
        text-align: left;
        justify-content: flex-start;
        border-bottom: none;
        padding-bottom: 6px;
    }

    .table-mobile td.vc-cliente-grupo::before {
        display: none;
    }

    .table-mobile td.vc-cliente-grupo .vc-grupo-info {
        align-items: flex-start;
        text-align: left;
        width: 100%;
    }

    .table-mobile tfoot tr.vc-subtotal-general-pagina,
    .table-mobile tfoot tr.vc-total-general {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        margin-bottom: 12px;
        padding: 8px 12px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    }
}

/* Comisiones por vendedor */
.com-grupo-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.com-grupo-vendedor {
    font-size: 1rem;
}

.com-grupo-resumen {
    margin-top: 2px;
}

.com-cols-head td {
    border-bottom-color: var(--border);
    background: #F8FAFC;
    white-space: nowrap;
}

.table-comisiones .btn-com-acordeon {
    color: inherit;
    font-weight: inherit;
}

.table-comisiones .com-acordeon-icon {
    display: inline-block;
    flex-shrink: 0;
    color: var(--muted);
    transition: transform .2s ease;
}

.table-comisiones tr.com-vendedor-head.is-expanded .com-acordeon-icon {
    transform: rotate(180deg);
}

.table-comisiones tr.com-detalle {
    display: none;
}

.table-comisiones tr.com-detalle.is-open {
    display: table-row;
}

@media (max-width: 767.98px) {
    .table-mobile tr.com-cols-head {
        display: none !important;
    }

    .table-comisiones.table-mobile tr.com-detalle {
        display: none !important;
    }

    .table-comisiones.table-mobile tr.com-detalle.is-open:not(.com-cols-head) {
        display: block !important;
    }

    .table-comisiones.table-mobile tr.com-detalle.is-open:not(.com-cols-head) td {
        display: flex;
    }

    .table-mobile td.com-vendedor-grupo {
        display: block;
        text-align: left;
        justify-content: flex-start;
        border-bottom: none;
        padding-bottom: 6px;
    }

    .table-mobile td.com-vendedor-grupo::before {
        display: none;
    }

    .table-mobile td.com-vendedor-grupo .com-grupo-info {
        align-items: flex-start;
        text-align: left;
        width: 100%;
    }
}

/* ===============================
   PERMISOS POR ROL
================================ */

.permisos-roles-nav {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.permisos-roles-nav .nav-link {
    white-space: nowrap;
    border-radius: 10px;
    color: var(--text);
    background: #F8FAFC;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
}

.permisos-roles-nav .nav-link:hover {
    background: #ECFDF5;
    border-color: #BBF7D0;
    color: var(--verde-dark);
}

.permisos-roles-nav .nav-link.active {
    background: var(--verde);
    border-color: var(--verde);
    color: #fff;
}

.permisos-roles-nav .nav-link.permisos-rol-master {
    color: var(--muted);
}

.permisos-roles-nav .nav-link.permisos-rol-master.active {
    background: #64748B;
    border-color: #64748B;
    color: #fff;
}

.permisos-toolbar h6 {
    font-weight: 700;
}

.permisos-modulo {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 18px;
    background: #F8FAFC;
}

.permisos-modulo-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.permisos-modulo-head .form-check-label {
    font-size: 13px;
    color: var(--muted);
}

.permisos-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

.permisos-item:hover {
    border-color: #BBF7D0;
    background: #F0FDF4;
}

.permisos-item .form-check-input {
    margin-top: 4px;
    flex-shrink: 0;
}

.permisos-item-texto {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.permisos-item-texto strong {
    font-size: 14px;
    line-height: 1.2;
}

.permisos-item-texto small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

fieldset:disabled .permisos-item {
    cursor: default;
    opacity: .75;
}

.permisos-item:has(.js-permiso:checked) {
    border-color: #86EFAC;
    background: #F0FDF4;
}

.permisos-item .form-check-input:checked {
    background-color: var(--verde);
    border-color: var(--verde);
}

.permisos-modulo-head .form-check-input:checked {
    background-color: var(--verde);
    border-color: var(--verde);
}
