:root {
    --sidebar-width: 270px;
    --primary: #6f42c1;
    --primary-dark: #59359c;
    --sidebar-bg: #161b26;
    --body-bg: #f4f6fa;
    --border-color: #e8ebf0;
    --text-primary: #252b36;
    --text-secondary: #7b8190;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--body-bg);
    color: var(--text-primary);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

a {
    text-decoration: none;
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
}

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

.bg-primary {
    background-color: var(--primary) !important;
}

.admin-wrapper {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: #ffffff;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    min-height: 82px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #8d5ce7, #6334b5);
    font-size: 22px;
    box-shadow: 0 8px 22px rgba(111, 66, 193, 0.35);
}

.brand-title,
.brand-version {
    display: block;
}

.brand-title {
    font-size: 17px;
    font-weight: 700;
}

.brand-version {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 22px 14px;
}

.menu-title {
    display: block;
    margin: 0 12px 10px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
}

.menu-link {
    min-height: 46px;
    margin-bottom: 5px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 14px;
    transition: 0.2s ease;
}

.menu-link i {
    width: 21px;
    font-size: 17px;
}

.menu-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.menu-link.active {
    color: #ffffff;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-dark)
    );
    box-shadow: 0 8px 22px rgba(111, 66, 193, 0.25);
}

.sidebar-footer {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-footer strong,
.sidebar-footer small {
    display: block;
}

.sidebar-footer strong {
    font-size: 13px;
}

.sidebar-footer small {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 11px;
}

.admin-main {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.admin-navbar {
    min-height: 82px;
    padding: 15px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.navbar-left,
.navbar-right,
.user-dropdown {
    display: flex;
    align-items: center;
}

.navbar-left {
    gap: 15px;
}

.navbar-right {
    gap: 14px;
}

.btn-menu {
    display: none;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 9px;
    background: #f1f3f7;
    font-size: 24px;
}

.navbar-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.navbar-subtitle {
    display: block;
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
}

.navbar-action {
    position: relative;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: #ffffff;
    color: #596071;
    font-size: 18px;
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 12px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.notification-menu { width: min(390px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; padding: 0; }
.notification-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border-color); }
.notification-header small { color: var(--text-secondary); }
.notification-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 12px 16px; color: var(--text-primary); text-decoration: none; border-bottom: 1px solid var(--border-color); }
.notification-item:hover { background: #f7f5ff; color: var(--text-primary); }
.notification-item small { display: block; color: var(--text-secondary); font-size: 11px; margin-top: 2px; }
.notification-icon { font-size: 19px; text-align: center; }
.notification-item b { min-width: 25px; padding: 3px 7px; border-radius: 12px; background: #f1eafa; color: #6f42c1; text-align: center; }
.notification-empty { padding: 30px 16px; color: var(--text-secondary); text-align: center; }

/* SIC: el motivo siempre ocupa una fila propia y no invade la tabla de productos. */
#cuerpoDetalleSic > .row.mb-3 > .col:last-child {
    flex: 0 0 100%;
    max-width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8f9fb;
    overflow-wrap: anywhere;
}
#cuerpoDetalleSic .table td:first-child {
    min-width: 240px;
    max-width: 520px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.user-dropdown {
    padding: 5px 7px;
    gap: 10px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
}

.user-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ede5fb;
    color: var(--primary);
    font-size: 19px;
}

.user-info strong,
.user-info small {
    display: block;
}

.user-info strong {
    font-size: 13px;
}

.user-info small {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
}

.admin-content {
    flex: 1;
    padding: 28px;
}

.dashboard-header {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.dashboard-header h2 {
    margin: 0 0 5px;
    font-size: 24px;
    font-weight: 700;
}

.dashboard-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.dashboard-date {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-card {
    height: 100%;
    min-height: 145px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 17px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(32, 40, 60, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(32, 40, 60, 0.08);
}

.stat-icon,
.quick-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
}

.stat-icon {
    width: 58px;
    height: 58px;
    border-radius: 15px;
    font-size: 24px;
}

.icon-purple {
    background: #eee5fc;
    color: #6f42c1;
}

.icon-blue {
    background: #e2edff;
    color: #0d6efd;
}

.icon-green {
    background: #e0f4ea;
    color: #198754;
}

.icon-orange {
    background: #fff0df;
    color: #fd7e14;
}

.stat-content span,
.stat-content strong,
.stat-content small {
    display: block;
}

.stat-content span {
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-content strong {
    line-height: 1;
    font-size: 28px;
}

.stat-content small {
    margin-top: 8px;
    color: #a0a5b0;
    font-size: 11px;
}

.dashboard-card {
    padding: 22px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(32, 40, 60, 0.04);
}

.card-heading {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-heading h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
}

.card-heading p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.card-action {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #ffffff;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    height: 320px;
}

.quick-actions {
    display: flex;
    flex-direction: column;
}

.quick-action {
    padding: 13px 4px;
    display: grid;
    grid-template-columns: 43px 1fr auto;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.quick-action:last-child {
    border-bottom: 0;
}

.quick-action:hover {
    color: var(--primary);
}

.quick-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    font-size: 17px;
}

.quick-action strong,
.quick-action span {
    display: block;
}

.quick-action strong {
    font-size: 13px;
}

.quick-action span {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
}

.admin-footer {
    min-height: 60px;
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 12px;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.sidebar-visible {
        transform: translateX(0);
    }

    .admin-main {
        width: 100%;
        margin-left: 0;
    }

    .btn-menu {
        display: grid;
        place-items: center;
    }
}

@media (max-width: 767.98px) {
    .admin-navbar,
    .admin-content,
    .admin-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .user-info,
    .user-dropdown > .bi-chevron-down {
        display: none;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-date {
        width: 100%;
        justify-content: center;
    }

    .admin-footer {
        text-align: center;
        flex-direction: column;
    }
}

/* Dashboard ejecutivo compacto: optimizado para 100% de zoom. */
.erp-dashboard-compact .erp-welcome {
    margin-bottom: 14px;
    padding: 15px 18px;
    border-radius: 14px;
}
.erp-dashboard-compact .erp-welcome h2 { font-size: 20px; }
.erp-dashboard-compact .erp-welcome p { font-size: 12px; }
.erp-dashboard-compact .dashboard-date { padding: 7px 10px; font-size: 11px; }
.erp-dashboard-compact .row.g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
.erp-dashboard-compact .row.g-4 { --bs-gutter-x: .9rem; --bs-gutter-y: .9rem; }
.erp-dashboard-compact .mb-4 { margin-bottom: .9rem !important; }
.erp-dashboard-compact .erp-kpi-card {
    min-height: 105px;
    padding: 13px 15px;
    border-radius: 13px;
}
.erp-dashboard-compact .erp-kpi-top { margin-bottom: 7px; font-size: 11px; }
.erp-dashboard-compact .erp-kpi-icon { width: 31px; height: 31px; border-radius: 9px; font-size: 15px; }
.erp-dashboard-compact .erp-kpi-card > strong { font-size: 21px; }
.erp-dashboard-compact .erp-kpi-card > small { margin-top: 4px; font-size: 9px; }
.erp-dashboard-compact .dashboard-card { padding: 15px; border-radius: 13px; }
.erp-dashboard-compact .card-heading { margin-bottom: 11px; }
.erp-dashboard-compact .card-heading h3 { font-size: 14px; }
.erp-dashboard-compact .card-heading p { font-size: 10px; }
.erp-dashboard-compact .chart-container { height: 215px; }
.erp-dashboard-compact .erp-alert-item { padding: 7px 0; grid-template-columns: 32px 1fr auto; gap: 8px; }
.erp-dashboard-compact .erp-alert-icon { width: 31px; height: 31px; border-radius: 8px; font-size: 13px; }
.erp-dashboard-compact .erp-alert-copy strong { font-size: 11px; }
.erp-dashboard-compact .erp-alert-copy small { font-size: 9px; }
.erp-dashboard-compact .erp-finance-row { min-height: 35px; padding: 6px 11px; font-size: 10px; }
.erp-dashboard-compact .erp-finance-row.heading { min-height: 30px; font-size: 9px; }
.erp-dashboard-compact .quick-action { padding: 7px 3px; grid-template-columns: 34px 1fr auto; gap: 9px; }
.erp-dashboard-compact .quick-icon { width: 33px; height: 33px; border-radius: 9px; font-size: 14px; }
.erp-dashboard-compact .quick-action strong { font-size: 11px; }
.erp-dashboard-compact .quick-action span { font-size: 9px; }
.erp-dashboard-compact .erp-mini-card { padding: 10px 13px; border-radius: 11px; }
.erp-dashboard-compact .erp-mini-card > i { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; }
.erp-dashboard-compact .erp-mini-card small { font-size: 9px; }
.erp-dashboard-compact .erp-mini-card strong { font-size: 17px; }
.erp-dashboard-compact .erp-web-stat { padding: 8px 11px; }
.erp-dashboard-compact .erp-web-stat > i { font-size: 19px; }
.erp-dashboard-compact .erp-web-stat small { font-size: 9px; }
.erp-dashboard-compact .erp-web-stat strong { font-size: 17px; }

@media (max-width: 1199.98px) {
    .erp-dashboard-compact .chart-container { height: 235px; }
}

.erp-welcome {
    margin-bottom: 24px;
    padding: 24px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(120deg, #221638 0%, #6f42c1 62%, #9368df 100%);
    box-shadow: 0 14px 34px rgba(73, 42, 125, .18);
}

.erp-welcome h2 { margin: 4px 0 5px; font-size: 25px; font-weight: 750; }
.erp-welcome p { margin: 0; color: rgba(255,255,255,.72); font-size: 14px; }
.erp-eyebrow { color: #dbcaf8; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }
.erp-welcome .dashboard-date { border-color: rgba(255,255,255,.18); color: #fff; background: rgba(255,255,255,.10); }

.erp-kpi-card {
    height: 100%;
    min-height: 152px;
    padding: 20px;
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    background: #fff;
    box-shadow: 0 6px 20px rgba(32,40,60,.04);
    transition: transform .2s ease, box-shadow .2s ease;
}
.erp-kpi-card:hover { color: var(--text-primary); transform: translateY(-3px); box-shadow: 0 13px 30px rgba(32,40,60,.09); }
.erp-kpi-top { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; color: var(--text-secondary); font-size: 13px; }
.erp-kpi-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; font-size: 18px; }
.erp-kpi-icon.purple { color: #6f42c1; background: #eee5fc; }
.erp-kpi-icon.green { color: #198754; background: #e0f4ea; }
.erp-kpi-icon.orange { color: #d66a00; background: #fff0df; }
.erp-kpi-icon.blue { color: #0d6efd; background: #e2edff; }
.erp-kpi-card > strong { display: block; font-size: 25px; line-height: 1.15; }
.erp-kpi-card > small { margin-top: 9px; display: block; color: #9298a5; font-size: 11px; }

.erp-live { padding: 5px 9px; border: 1px solid #cce9d9; border-radius: 20px; color: #157347; background: #e9f7ef; font-size: 10px; font-weight: 700; }
.erp-alert-total { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #dc3545; font-size: 12px; font-weight: 800; }
.erp-alert-list { display: flex; flex-direction: column; }
.erp-alert-item { padding: 12px 0; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 11px; border-bottom: 1px solid var(--border-color); color: var(--text-primary); }
.erp-alert-item:last-child { border-bottom: 0; }
.erp-alert-item:hover { color: var(--primary); }
.erp-alert-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; }
.erp-alert-icon.danger { color: #dc3545; background: #fde8ea; }
.erp-alert-icon.warning { color: #b76e00; background: #fff3d6; }
.erp-alert-icon.info { color: #087990; background: #dff6fb; }
.erp-alert-copy strong, .erp-alert-copy small { display: block; }
.erp-alert-copy strong { font-size: 12px; }
.erp-alert-copy small { margin-top: 2px; color: var(--text-secondary); font-size: 10px; line-height: 1.35; }
.erp-alert-item > b { min-width: 27px; padding: 4px 7px; border-radius: 15px; color: #dc3545; background: #fde8ea; text-align: center; font-size: 11px; }
.erp-empty-state { padding: 45px 15px; display: flex; flex-direction: column; align-items: center; color: var(--text-secondary); text-align: center; }
.erp-empty-state i { margin-bottom: 9px; color: #198754; font-size: 30px; }
.erp-empty-state strong { color: var(--text-primary); font-size: 13px; }
.erp-empty-state span { margin-top: 3px; font-size: 11px; }

.erp-finance-table { overflow: hidden; border: 1px solid var(--border-color); border-radius: 12px; }
.erp-finance-row { min-height: 48px; padding: 10px 15px; display: grid; grid-template-columns: 1.3fr 1fr 1fr; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); font-size: 12px; }
.erp-finance-row:last-child { border-bottom: 0; }
.erp-finance-row.heading { min-height: 38px; color: var(--text-secondary); background: #f7f8fb; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.erp-finance-row strong { text-align: right; }
.erp-finance-row.heading span:not(:first-child) { text-align: right; }

.erp-mini-card { padding: 17px 19px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--border-color); border-radius: 14px; color: var(--text-primary); background: #fff; }
.erp-mini-card:hover { color: var(--primary); border-color: #d9caef; }
.erp-mini-card > i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--primary); background: #eee5fc; font-size: 18px; }
.erp-mini-card small, .erp-mini-card strong { display: block; }
.erp-mini-card small { color: var(--text-secondary); font-size: 10px; }
.erp-mini-card strong { margin-top: 1px; font-size: 20px; }
.erp-web-stat { padding: 13px 15px; display: flex; align-items: center; gap: 12px; border-radius: 12px; background: #f7f8fb; }
.erp-web-stat > i { color: var(--primary); font-size: 23px; }
.erp-web-stat small, .erp-web-stat strong { display: block; }
.erp-web-stat small { color: var(--text-secondary); font-size: 10px; }
.erp-web-stat strong { font-size: 20px; }

@media (max-width: 767.98px) {
    .erp-welcome { padding: 20px; align-items: flex-start; flex-direction: column; }
    .erp-welcome h2 { font-size: 21px; }
    .erp-finance-row { grid-template-columns: 1.2fr 1fr 1fr; padding: 9px 10px; gap: 7px; font-size: 10px; }
    .erp-kpi-card { min-height: 135px; }
}

.brand-logo,
.auth-brand-logo {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: contain;
}

.brand-logo {
    padding: 4px;
    background: #ffffff;
}

/* Navegación superior estilo ERP */
.admin-wrapper {
    flex-direction: column;
}

.admin-main {
    width: 100%;
    margin-left: 0;
}

.erp-topbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    min-height: 72px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    background: #161b26;
    color: #fff;
    box-shadow: 0 3px 14px rgba(20, 25, 35, .18);
}

.erp-brand {
    flex: 0 0 auto;
    min-width: 205px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fff;
}

.erp-brand:hover {
    color: #fff;
}

.erp-brand-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 11px;
    background: #fff;
}

.erp-brand strong,
.erp-brand small {
    display: block;
}

.erp-brand strong {
    font-size: 15px;
}

.erp-brand small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .55);
    font-size: 11px;
}

.erp-menu {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
}

.erp-menu-link {
    min-height: 44px;
    padding: 9px 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, .76);
    font-size: 13px;
    white-space: nowrap;
}

.erp-menu-link:hover,
.erp-menu-link:focus,
.erp-menu-link.active,
.erp-menu .dropdown.show > .erp-menu-link {
    color: #fff;
    background: rgba(255, 255, 255, .11);
}

.erp-menu-link.active {
    box-shadow: inset 0 -3px 0 var(--primary);
}

.erp-dropdown {
    min-width: 235px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.erp-dropdown .dropdown-item {
    padding: 9px 11px;
    border-radius: 7px;
    font-size: 13px;
}

.erp-dropdown .dropdown-item:hover {
    color: var(--primary);
    background: #f4effd;
}

@media (max-width: 1199.98px) {
    .erp-topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .erp-menu {
        display: none;
        align-items: stretch;
        flex-direction: column;
        padding-top: 5px;
    }

    .erp-topbar.sidebar-visible .erp-menu {
        display: flex;
    }

    .erp-menu-link {
        width: 100%;
        justify-content: flex-start;
    }

    .erp-menu .dropdown-menu {
        position: static !important;
        width: 100%;
        transform: none !important;
        box-shadow: none !important;
    }

    .btn-menu {
        display: grid;
        place-items: center;
    }
}

/* Acceso y perfiles */
.auth-body {
    min-height: 100vh;
    background: #f5f6fb;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr);
}

.auth-presentation {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(
            circle at 85% 15%,
            rgba(255, 255, 255, .18),
            transparent 28%
        ),
        linear-gradient(
            145deg,
            var(--primary-dark),
            var(--primary) 70%,
            color-mix(
                in srgb,
                var(--primary) 75%,
                #ffffff
            )
        );
}

.auth-presentation::after {
    content: "";
    position: absolute;
    width: 330px;
    height: 330px;
    right: -130px;
    bottom: -150px;
    border: 55px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
}

.auth-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-brand-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: rgba(255, 255, 255, .16);
    font-size: 25px;
}

.auth-brand strong,
.auth-brand small {
    display: block;
}

.auth-brand strong {
    font-size: 20px;
}

.auth-brand small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .66);
}

.auth-copy {
    position: relative;
    z-index: 1;
    max-width: 620px;
}

.auth-eyebrow {
    display: inline-block;
    margin-bottom: 18px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    color: rgba(255, 255, 255, .82);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.auth-copy h1 {
    max-width: 560px;
    margin-bottom: 20px;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    font-weight: 750;
    line-height: 1.03;
}

.auth-copy p {
    max-width: 540px;
    margin: 0;
    color: rgba(255, 255, 255, .72);
    font-size: 18px;
    line-height: 1.7;
}

.auth-features {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
}

.auth-features i {
    margin-right: 7px;
}

.auth-form-panel {
    padding: 30px;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 470px);
    padding: clamp(2rem, 5vw, 3.25rem);
    border: 1px solid #e9eaf0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(37, 21, 67, .10);
}

.auth-card h2 {
    margin-bottom: 8px;
    font-weight: 750;
}

.auth-card p {
    margin: 0;
    color: var(--text-secondary);
}

.auth-card .input-group-text {
    color: #786e89;
    background: #f8f7fb;
}

.auth-card .form-control,
.auth-card .input-group-text,
.auth-card .input-group .btn {
    border-color: #e2dfeb;
}

.auth-support {
    margin-top: 25px;
    padding: 14px;
    border-radius: 10px;
    color: #696174;
    background: #f7f5fb;
    font-size: 13px;
    line-height: 1.5;
}

.auth-support i {
    margin-right: 6px;
    color: var(--primary);
}

.profile-avatar {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(
        135deg,
        color-mix(
            in srgb,
            var(--primary) 78%,
            #ffffff
        ),
        var(--primary-dark)
    );
    box-shadow: 0 10px 25px rgba(111, 66, 193, .25);
    font-size: 32px;
}

.config-summary-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    font-size: 21px;
}

.config-logo-preview {
    min-height: 190px;
    padding: 20px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px dashed #d8dbe4;
    border-radius: 16px;
    background: #f8f9fc;
}

.config-logo-preview img {
    max-width: 100%;
    max-height: 155px;
    object-fit: contain;
}

.config-logo-preview > div {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border-radius: 25px;
    color: #ffffff;
    background: var(--primary);
    font-size: 47px;
    box-shadow: 0 13px 30px
        rgba(111, 66, 193, .25);
}

.config-web-logo-preview,
.config-favicon-preview {
    min-height: 165px;
}

.config-web-logo-preview img {
    width: auto;
    max-width: min(100%, 420px);
    max-height: 120px;
}

.config-favicon-preview img {
    width: 104px;
    height: 104px;
    border-radius: 22px;
    object-fit: contain;
    box-shadow: 0 12px 30px
        rgba(32, 35, 47, .16);
}

.config-content-image-preview {
    min-height: 210px;
    padding: 12px;
}

.config-content-image-preview img {
    width: 100%;
    height: 190px;
    max-height: 190px;
    object-fit: contain;
    border-radius: 12px;
}

#modalRol .modal-dialog {
    height: calc(100vh - 2rem);
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#modalRol .modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

#modalRol form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#modalRol .modal-header,
#modalRol .modal-footer {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    background-color: #ffffff;
}

#modalRol .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

#matrizPermisos .form-check:last-child {
    border-bottom: 0 !important;
}

#matrizPermisos .form-check,
#matrizPermisos .form-check-input,
#matrizPermisos .form-check-label {
    cursor: pointer;
}

/* El modal y su backdrop deben quedar sobre la barra superior del ERP. */
#modalRol,
#modalUsuario {
    z-index: 1060;
}

.modal-backdrop {
    z-index: 1050;
}

@media (max-width: 575.98px) {
    #modalRol .modal-dialog {
        height: calc(100vh - 1rem);
        margin: 0.5rem;
    }

    #modalRol .modal-content {
        max-height: calc(100vh - 1rem);
    }
}

@media (max-width: 991.98px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-presentation {
        min-height: 310px;
        gap: 45px;
    }

    .auth-copy h1 {
        font-size: clamp(2.2rem, 8vw, 3.7rem);
    }
}

@media (max-width: 575.98px) {
    .auth-presentation {
        min-height: 255px;
        padding: 24px;
    }

    .auth-copy p,
    .auth-features {
        display: none;
    }

    .auth-form-panel {
        padding: 16px;
    }

    .auth-card {
        padding: 25px 20px;
        border-radius: 16px;
    }
}

/* 60B: estas reglas deben permanecer al final para prevalecer. */
.erp-dashboard-compact .erp-welcome {
    min-height: 58px;
    margin-bottom: 10px;
    padding: 10px 16px;
}
.erp-dashboard-compact .erp-welcome h2 { margin: 1px 0 2px; font-size: 18px; }
.erp-dashboard-compact .erp-welcome p { font-size: 10px; }
.erp-dashboard-compact .erp-eyebrow { font-size: 8px; }
.erp-dashboard-compact .row.g-3,
.erp-dashboard-compact .row.g-4 { --bs-gutter-x: .65rem; --bs-gutter-y: .65rem; }
.erp-dashboard-compact .mb-4 { margin-bottom: .65rem !important; }
.erp-dashboard-compact .erp-kpi-card {
    min-height: 88px;
    padding: 10px 13px;
}
.erp-dashboard-compact .erp-kpi-top { margin-bottom: 3px; }
.erp-dashboard-compact .erp-kpi-icon { width: 28px; height: 28px; }
.erp-dashboard-compact .erp-kpi-card > strong { font-size: 19px; }
.erp-dashboard-compact .erp-kpi-card > small { margin-top: 2px; }
.erp-dashboard-compact .dashboard-card { padding: 12px; }
.erp-dashboard-compact .card-heading { margin-bottom: 7px; }
.erp-dashboard-compact .card-heading h3 { margin-bottom: 1px; font-size: 13px; }
.erp-dashboard-compact .card-heading p { font-size: 9px; }
.erp-dashboard-compact .chart-container { height: 165px; }
.erp-dashboard-compact .erp-alert-item { padding: 5px 0; }
.erp-dashboard-compact .erp-finance-row { min-height: 30px; padding: 4px 9px; }
.erp-dashboard-compact .erp-finance-row.heading { min-height: 25px; }
.erp-dashboard-compact .quick-action { padding: 5px 2px; }
.erp-dashboard-compact .quick-icon { width: 29px; height: 29px; }
.erp-dashboard-compact .erp-mini-card { padding: 7px 10px; }
.erp-dashboard-compact .erp-mini-card > i { width: 30px; height: 30px; }
.erp-dashboard-compact .erp-web-stat { padding: 6px 9px; }

@media (max-width: 1199.98px) {
    .erp-dashboard-compact .chart-container { height: 190px; }
}

.treasury-page { max-width: 1920px; }
.treasury-kpi { border-radius: 14px; }
.treasury-kpi-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; font-size: 18px; }
.treasury-table { font-size: 12px; }
.treasury-table thead th { padding-top: 11px; padding-bottom: 11px; color: var(--text-secondary); font-size: 10px; text-transform: uppercase; white-space: nowrap; }
.treasury-table tbody td { padding-top: 10px; padding-bottom: 10px; }

/* Actualización 62: órdenes de producción */
.production-page .production-icon {
    align-items: center;
    border-radius: 12px;
    display: inline-flex;
    font-size: 1.25rem;
    height: 42px;
    justify-content: center;
    width: 42px;
}
.production-page .production-table { font-size: .875rem; }
.production-page .progress-bar { background: var(--primary); }
@media (max-width: 991.98px) {
    .production-page { padding-left: .5rem !important; padding-right: .5rem !important; }
}

/* Actualizacion 81: tema ERP profesional global, inspirado en SAP Web. */
:root {
    --erp-surface: #f7fafe;
    --erp-surface-soft: #eef4fa;
    --erp-surface-blue: #e5eff8;
    --erp-surface-header: #dce8f4;
    --erp-line: #c8d6e5;
    --erp-line-strong: #aebfd1;
    --erp-ink: #243447;
    --erp-muted: #64768a;
    --erp-focus: color-mix(in srgb, var(--primary) 58%, #6fa8dc);
    --body-bg: #edf3f8;
    --border-color: var(--erp-line);
    --text-primary: var(--erp-ink);
    --text-secondary: var(--erp-muted);
}

body {
    background:
        radial-gradient(circle at 85% 0%, rgba(111, 153, 196, .12), transparent 30rem),
        linear-gradient(145deg, #f3f7fb 0%, #eaf1f7 55%, #f5f8fb 100%);
}

.admin-navbar {
    background: linear-gradient(180deg, #fafdff 0%, #edf4fa 100%);
    border-bottom-color: var(--erp-line);
    box-shadow: 0 3px 12px rgba(51, 78, 104, .07);
}

.admin-content {
    background: transparent;
}

/* Superficies principales de formularios, listados y ventanas. */
.admin-content .card,
.admin-content .dashboard-card,
.admin-content .modal-content,
.admin-content .offcanvas,
.admin-content .accordion-item,
.admin-content .list-group-item,
.admin-content .dropdown-menu,
.admin-content .dt-container,
.admin-content .table-responsive {
    border-color: var(--erp-line) !important;
    background: linear-gradient(145deg, rgba(250, 252, 255, .98), rgba(234, 242, 249, .96));
    box-shadow: 0 7px 20px rgba(46, 72, 98, .08);
}

.admin-content .card,
.admin-content .dashboard-card,
.admin-content .modal-content,
.admin-content .offcanvas {
    border-radius: 13px;
}

/* Cabeceras internas: mantienen jerarquia sin colores fuertes. */
.admin-content .card-header,
.admin-content .modal-header,
.admin-content .offcanvas-header,
.admin-content .accordion-button,
.admin-content .table thead th,
.admin-content table.dataTable thead th,
.admin-content .dt-layout-row:first-child {
    color: #173b63;
    border-color: var(--erp-line) !important;
    background: linear-gradient(180deg, #e8f1f9 0%, #dce8f4 100%) !important;
}

.admin-content .card-header,
.admin-content .modal-header,
.admin-content .offcanvas-header {
    padding-top: .85rem;
    padding-bottom: .85rem;
}

.admin-content .card-body,
.admin-content .modal-body,
.admin-content .offcanvas-body,
.admin-content .accordion-body {
    background: linear-gradient(145deg, rgba(249, 252, 255, .96), rgba(236, 243, 249, .94));
}

.admin-content .card-footer,
.admin-content .modal-footer {
    border-color: var(--erp-line) !important;
    background: linear-gradient(180deg, #eef4f9 0%, #e3edf6 100%);
}

/* Campos: fondo azul muy claro, texto oscuro y foco visible. */
.admin-content .form-control,
.admin-content .form-select,
.admin-content .input-group-text,
.admin-content .form-check-input,
.admin-content .dt-input {
    color: var(--erp-ink);
    border-color: var(--erp-line-strong);
    background-color: #f9fcff;
    box-shadow: inset 0 1px 2px rgba(39, 66, 92, .04);
}

.admin-content .form-control,
.admin-content .form-select,
.admin-content .dt-input {
    min-height: 39px;
}

.admin-content textarea.form-control {
    min-height: 86px;
}

.admin-content .form-control:focus,
.admin-content .form-select:focus,
.admin-content .form-check-input:focus,
.admin-content .dt-input:focus {
    border-color: var(--erp-focus);
    background-color: #ffffff;
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--erp-focus) 20%, transparent);
}

.admin-content .form-control:disabled,
.admin-content .form-select:disabled,
.admin-content .form-control[readonly] {
    color: #5d6d7e;
    background-color: #e8eff5;
}

.admin-content .form-label,
.admin-content legend,
.admin-content .col-form-label {
    color: #314a63;
    font-weight: 650;
}

.admin-content .form-text {
    color: var(--erp-muted);
}

/* Tablas mas sobrias y legibles. */
.admin-content .table {
    --bs-table-bg: rgba(250, 252, 255, .75);
    --bs-table-color: var(--erp-ink);
    --bs-table-border-color: var(--erp-line);
    --bs-table-striped-bg: rgba(219, 232, 244, .48);
    --bs-table-hover-bg: rgba(205, 224, 240, .58);
    margin-bottom: 0;
}

.admin-content .table thead th,
.admin-content table.dataTable thead th {
    padding-top: .72rem;
    padding-bottom: .72rem;
    color: #173b63;
    font-size: .78rem;
    font-weight: 750;
    letter-spacing: .01em;
    vertical-align: middle;
}

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

/* Agrupaciones de campos con apariencia de seccion ERP. */
.admin-content fieldset,
.admin-content .form-section,
.admin-content .section-box,
.admin-content .border.rounded,
.admin-content .border.rounded-3 {
    border-color: var(--erp-line) !important;
    background: linear-gradient(145deg, rgba(248, 251, 254, .94), rgba(229, 239, 248, .82));
}

.admin-content .nav-tabs {
    border-bottom-color: var(--erp-line-strong);
}

.admin-content .nav-tabs .nav-link {
    color: #536b82;
    border-color: transparent;
    background: rgba(221, 233, 244, .68);
}

.admin-content .nav-tabs .nav-link.active {
    color: #173b63;
    border-color: var(--erp-line-strong) var(--erp-line-strong) #f7fbff;
    background: linear-gradient(180deg, #ffffff, #edf4fa);
    font-weight: 700;
}

.admin-content .alert {
    border-color: color-mix(in srgb, currentColor 22%, transparent);
    box-shadow: 0 4px 12px rgba(48, 73, 98, .06);
}

/* SweetAlert se usa en todo el ERP y queda alineado con el nuevo tema. */
.swal2-popup {
    color: var(--erp-ink);
    border: 1px solid var(--erp-line);
    border-radius: 15px;
    background: linear-gradient(145deg, #fbfdff, #eaf2f8) !important;
    box-shadow: 0 18px 45px rgba(35, 60, 85, .2) !important;
}

.swal2-actions {
    padding-top: .25rem;
}

@media (max-width: 767.98px) {
    .admin-content .card-body,
    .admin-content .modal-body {
        padding: .85rem;
    }
}

/* Actualizacion 81A: jerarquia oficial de cabeceras tipo SAP Web. */
:root {
    --erp-header-blue: #4f7fe8;
    --erp-header-blue-dark: #3769d5;
    --erp-header-blue-soft: #d5e4f5;
    --erp-header-blue-soft-2: #c4d8ee;
}

/* Cabecera principal de formularios emergentes. */
.admin-content .modal-header,
.modal-content > .modal-header {
    color: #ffffff !important;
    border-bottom: 1px solid #315fc4 !important;
    background: linear-gradient(135deg, var(--erp-header-blue) 0%, var(--erp-header-blue-dark) 100%) !important;
    box-shadow: 0 4px 12px rgba(43, 91, 180, .22);
}

.admin-content .modal-header h1,
.admin-content .modal-header h2,
.admin-content .modal-header h3,
.admin-content .modal-header h4,
.admin-content .modal-header h5,
.admin-content .modal-header h6,
.admin-content .modal-header .modal-title,
.admin-content .modal-header small,
.admin-content .modal-header p,
.modal-content > .modal-header .modal-title,
.modal-content > .modal-header small,
.modal-content > .modal-header p {
    color: #ffffff !important;
}

.admin-content .modal-header small,
.admin-content .modal-header p,
.modal-content > .modal-header small,
.modal-content > .modal-header p {
    opacity: .84;
}

.admin-content .modal-header .btn-close,
.modal-content > .modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: .92;
}

.admin-content .modal-header .btn-close:hover,
.modal-content > .modal-header .btn-close:hover {
    opacity: 1;
}

/* Cabeceras de tarjetas y secciones: nivel secundario. */
.admin-content .card-header,
.admin-content .offcanvas-header,
.admin-content .accordion-button,
.admin-content .section-header,
.admin-content .form-section-title {
    color: #173f6e !important;
    border-color: #a9bfd7 !important;
    background: linear-gradient(180deg, var(--erp-header-blue-soft) 0%, var(--erp-header-blue-soft-2) 100%) !important;
}

.admin-content .card-header h1,
.admin-content .card-header h2,
.admin-content .card-header h3,
.admin-content .card-header h4,
.admin-content .card-header h5,
.admin-content .card-header h6 {
    color: #173f6e;
}

/* Cabeceras de tablas: visibles sin sobrecargar el formulario. */
.admin-content .table thead th,
.admin-content table.dataTable thead th {
    color: #163a62 !important;
    border-color: #aebfd1 !important;
    background: linear-gradient(180deg, #dce9f6 0%, #c9dced 100%) !important;
}

/* Cabecera de SweetAlert para mantener el mismo lenguaje visual. */
.swal2-title {
    color: #173f6e !important;
}
