/*
=============================================================================
ESTILOS GLOBALES DEL ERP
=============================================================================
CAMBIOS FRECUENTES:
- Color del menú lateral: .erp-sidebar -> background.
- Ancho del menú: .erp-sidebar width y .erp-main margin-left/width.
- Fondo general: html, body -> background.
- Tarjetas, tablas, formularios y responsive están separados por secciones.
Evita usar selectores demasiado generales que puedan afectar dashboard.css.
=============================================================================
*/

/* =====================================================
   STYLE.CSS - CONTROL CORPORATIVO DE ARRIENDOS
   VERSIÓN RESPONSIVE COMPLETA
   Incluye:
   - Base general del ERP
   - Sidebar / Topbar / Cards / KPIs
   - Login
   - Autocomplete proveedores
   - Arriendos responsive V3
   - Garantías responsive V3
===================================================== */


/* =====================================================
   1. BASE GENERAL
===================================================== */

html,
body {
    margin: 0;
    max-width: 100%;
    overflow-x: hidden;
    background: #f4f6f9;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #1f2933;
}

* {
    box-sizing: border-box;
}


/* =====================================================
   2. LAYOUT PRINCIPAL ERP
===================================================== */

.erp-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.erp-sidebar {
    width: 260px;
    background: #161d69;
    color: #ffffff;
    padding: 24px 18px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;

    display: flex;
    flex-direction: column;
}

.erp-main {
    margin-left: 260px;
    width: calc(100% - 260px);
    max-width: calc(100vw - 260px);
    min-height: 100vh;
    overflow-x: hidden;
}


/* =====================================================
   3. LOGO SISTEMA
===================================================== */

.erp-logo {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 35px;
    letter-spacing: 1px;
    color: #ffffff;
    padding: 6px 4px;
}


/* =====================================================
   4. MENÚ LATERAL
===================================================== */

.erp-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.erp-link {
    color: #ffffff;
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 10px;
    font-size: 15px;
    transition: 0.2s ease;
}

.erp-link:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.erp-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-weight: 700;
    border-left: 4px solid #ffffff;
    padding-left: 10px;
}

.erp-link.logout {
    background: #991b1b;
    margin-top: 28px;
}

.erp-link.logout:hover {
    background: #dc2626;
}


/* =====================================================
   5. LOGO EMPRESA INFERIOR
===================================================== */

.sidebar-bottom-logo {
    margin-top: auto;
    padding: 28px 4px 4px 4px;

    display: flex;
    justify-content: center;
    align-items: center;
}

.bottom-logo-img {
    width: 100%;
    max-width: 220px;
    height: auto;
    object-fit: contain;
    opacity: 0.98;
    transition: 0.25s ease;
}

.bottom-logo-img:hover {
    opacity: 1;
    transform: scale(1.02);
}


/* =====================================================
   6. TOPBAR
===================================================== */

.erp-topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;
    max-width: 100%;
    overflow: hidden;
}


/* =====================================================
   7. CONTENIDO GENERAL
===================================================== */

.erp-content {
    padding: 28px;
    max-width: 100%;
    overflow-x: hidden;
}

.erp-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;

    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;

    max-width: 100%;
    overflow-x: hidden;
}


/* =====================================================
   8. KPI DASHBOARD
===================================================== */

.kpi-card {
    border-radius: 16px;
    padding: 22px;
    color: #ffffff;
    min-height: 130px;

    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
}

.kpi-title {
    font-size: 15px;
    opacity: 0.95;
}

.kpi-value {
    font-size: 38px;
    font-weight: 700;
    margin-top: 8px;
    line-height: 1;
}

.kpi-subtitle {
    font-size: 12px;
    margin-top: 8px;
    opacity: 0.85;
}

.kpi-blue {
    background: #1d4ed8;
}

.kpi-yellow {
    background: #f59e0b;
}

.kpi-red {
    background: #dc2626;
}

.kpi-green {
    background: #16a34a;
}


/* =====================================================
   9. ELEMENTOS BOOTSTRAP AJUSTADOS
===================================================== */

.table {
    margin-bottom: 0;
}

.table th,
.table td {
    vertical-align: middle;
}

.table-dark th {
    background: #1f2933 !important;
}

.badge {
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
}

.btn {
    border-radius: 9px;
}

.dropdown-menu {
    min-width: 180px;
}


/* =====================================================
   10. AUTOCOMPLETE PROVEEDORES
===================================================== */

.autocomplete-box {
    position: absolute;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #d1d5db;
    width: calc(100% - 24px);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    border-radius: 10px;
    margin-top: 4px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.15);
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
}

.autocomplete-item:hover {
    background: #eff6ff;
}

.autocomplete-item small {
    color: #6b7280;
}


/* =====================================================
   11. LOGIN
===================================================== */

.login-body {
    min-height: 100vh;
    margin: 0;
    background: #d7dce5;
    background-image:
        linear-gradient(rgba(215, 220, 229, 0.88), rgba(215, 220, 229, 0.88)),
        url("../Img/login.jpg");
    background-size: cover;
    background-position: center;
    font-family: "Segoe UI", Arial, sans-serif;
}

.login-overlay {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.login-container {
    width: 100%;
    max-width: 430px;
    text-align: center;
}

.login-logo-box {
    margin-bottom: 24px;
}

.login-logo {
    width: 100%;
    max-width: 360px;
    height: auto;
}

.login-card {
    background: #ffffff;
    padding: 34px 34px 30px 34px;
    border-radius: 4px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.18);
    text-align: left;
}

.login-title {
    text-align: center;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1f2933;
}

.login-subtitle {
    text-align: center;
    color: #5b6472;
    font-size: 15px;
    margin-bottom: 28px;
}

.login-label {
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
    font-size: 13px;
}

.login-input {
    border-radius: 0;
    height: 44px;
}

.login-button {
    background: #29328c;
    border: none;
    color: #ffffff;
    height: 46px;
    border-radius: 0;
    font-weight: 600;
}

.login-button:hover {
    background: #1f276f;
    color: #ffffff;
}


/* =====================================================
   12. MÓDULO ARRIENDOS - ESTRUCTURA GENERAL
===================================================== */

.arriendos-page {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.arriendos-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}

.arriendos-title {
    margin-bottom: 4px;
    font-weight: 700;
}

.arriendos-subtitle {
    color: #6b7280;
    margin-bottom: 0;
}

.arriendos-new-btn {
    white-space: nowrap;
}

.arriendos-filter-card {
    overflow: visible;
}

.arriendos-list-card {
    overflow: visible;
}

.arriendos-list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.arriendos-list-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.arriendos-count-badge {
    white-space: nowrap;
}


/* =====================================================
   13. MÓDULO ARRIENDOS - LISTADO RESPONSIVE
===================================================== */

.arriendos-table {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
}

.arriendos-table-head {
    display: grid;
    grid-template-columns:
        minmax(58px, 0.6fr)
        minmax(78px, 0.75fr)
        minmax(230px, 2.5fr)
        minmax(110px, 1.2fr)
        minmax(120px, 1.05fr)
        minmax(50px, 0.45fr)
        minmax(62px, 0.55fr)
        minmax(145px, 1.35fr)
        minmax(55px, 0.45fr);
    background: #1f2933;
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.2;
}

.arriendos-table-head > div {
    padding: 12px 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.arriendos-table-head > div:last-child {
    border-right: none;
}

.arriendo-row {
    display: grid;
    grid-template-columns:
        minmax(58px, 0.6fr)
        minmax(78px, 0.75fr)
        minmax(230px, 2.5fr)
        minmax(110px, 1.2fr)
        minmax(120px, 1.05fr)
        minmax(50px, 0.45fr)
        minmax(62px, 0.55fr)
        minmax(145px, 1.35fr)
        minmax(55px, 0.45fr);
    border-top: 1px solid #e5e7eb;
}

.arriendo-cell {
    padding: 11px 10px;
    border-right: 1px solid #e5e7eb;
    min-width: 0;
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.arriendo-cell:last-child {
    border-right: none;
}

.arriendo-proveedor {
    font-weight: 700;
    color: #111827;
}

.arriendo-producto {
    margin-top: 3px;
    color: #111827;
}

.arriendo-muted {
    color: #6b7280;
    font-size: 11px;
    margin-top: 3px;
}

.arriendo-mini-label {
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
}

.arriendo-cantidad,
.arriendo-dias,
.arriendo-acciones {
    align-items: center;
    text-align: center;
}

.arriendo-form-fecha {
    display: flex;
    gap: 6px;
    align-items: center;
}

.arriendo-form-fecha input {
    min-width: 0;
    font-size: 11px;
    padding: 4px 5px;
}


/* =====================================================
   14. MÓDULO GARANTÍAS - ESTRUCTURA GENERAL
===================================================== */

.garantias-page {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.garantias-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}

.garantias-title {
    margin-bottom: 4px;
    font-weight: 700;
}

.garantias-subtitle {
    color: #6b7280;
    margin-bottom: 0;
}

.garantias-new-btn {
    white-space: nowrap;
}

.garantias-filter-card {
    overflow: visible;
}

.garantias-list-card {
    overflow: visible;
}

.garantias-list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.garantias-list-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.garantias-count-badge {
    white-space: nowrap;
}


/* =====================================================
   15. MÓDULO GARANTÍAS - LISTADO RESPONSIVE
===================================================== */

.garantias-table {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
}

.garantias-table-head {
    display: grid;
    grid-template-columns:
        minmax(115px, 1.15fr)
        minmax(145px, 1.35fr)
        minmax(125px, 1.15fr)
        minmax(95px, 0.85fr)
        minmax(150px, 1.45fr)
        minmax(90px, 0.85fr)
        minmax(82px, 0.75fr)
        minmax(120px, 1.1fr)
        minmax(55px, 0.45fr);
    background: #1f2933;
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.2;
}

.garantias-table-head > div {
    padding: 12px 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.garantias-table-head > div:last-child {
    border-right: none;
}

.garantia-row {
    display: grid;
    grid-template-columns:
        minmax(115px, 1.15fr)
        minmax(145px, 1.35fr)
        minmax(125px, 1.15fr)
        minmax(95px, 0.85fr)
        minmax(150px, 1.45fr)
        minmax(90px, 0.85fr)
        minmax(82px, 0.75fr)
        minmax(120px, 1.1fr)
        minmax(55px, 0.45fr);
    border-top: 1px solid #e5e7eb;
}

.garantia-cell {
    padding: 11px 10px;
    border-right: 1px solid #e5e7eb;
    min-width: 0;
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.garantia-cell:last-child {
    border-right: none;
}

.garantia-main-text {
    font-weight: 700;
    color: #111827;
}

.garantia-secondary-text {
    color: #111827;
    margin-top: 3px;
}

.garantia-mini-label {
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
}

.garantia-dias {
    margin-top: 4px;
    font-size: 12px;
}

.garantia-monto,
.garantia-vigencia,
.garantia-estado,
.garantia-acciones {
    text-align: center;
    align-items: center;
}

.garantia-acciones .btn-sm {
    padding: 3px 8px;
}


/* =====================================================
   16. NOTEBOOK 13" / 1366PX
===================================================== */

@media (max-width: 1366px) {

    .erp-sidebar {
        width: 220px;
        padding: 22px 12px;
    }

    .erp-main {
        margin-left: 220px;
        width: calc(100% - 220px);
        max-width: calc(100vw - 220px);
    }

    .erp-logo {
        font-size: 21px;
    }

    .erp-link {
        font-size: 14px;
        padding: 12px 12px;
    }

    .bottom-logo-img {
        max-width: 190px;
    }

    .erp-content {
        padding: 16px;
    }

    .erp-card {
        padding: 18px;
        border-radius: 14px;
    }

    .kpi-card {
        min-height: 112px;
        padding: 18px;
    }

    .kpi-value {
        font-size: 31px;
    }

    .kpi-title {
        font-size: 13px;
    }

    .kpi-subtitle {
        font-size: 11px;
    }

    .arriendos-header,
    .garantias-header {
        margin-bottom: 18px;
    }

    .arriendos-title,
    .garantias-title {
        font-size: 25px;
    }

    .arriendos-subtitle,
    .garantias-subtitle {
        font-size: 14px;
    }

    .arriendos-list-toolbar,
    .garantias-list-toolbar {
        margin-bottom: 14px;
    }

    .arriendos-table-head,
    .arriendo-row {
        grid-template-columns:
            56px
            78px
            minmax(210px, 2.6fr)
            minmax(90px, 1fr)
            minmax(112px, 1.15fr)
            46px
            56px
            minmax(120px, 1.15fr)
            44px;
    }

    .garantias-table-head,
    .garantia-row {
        grid-template-columns:
            minmax(92px, 1fr)
            minmax(118px, 1.25fr)
            minmax(104px, 1fr)
            minmax(76px, 0.72fr)
            minmax(120px, 1.25fr)
            minmax(78px, 0.75fr)
            minmax(72px, 0.68fr)
            minmax(92px, 0.9fr)
            44px;
    }

    .arriendos-table-head,
    .garantias-table-head {
        font-size: 10.5px;
    }

    .arriendos-table-head > div,
    .garantias-table-head > div {
        padding: 10px 7px;
    }

    .arriendo-cell,
    .garantia-cell {
        padding: 9px 7px;
        font-size: 11.2px;
        line-height: 1.18;
    }

    .arriendo-muted,
    .arriendo-mini-label,
    .garantia-mini-label,
    .garantia-dias {
        font-size: 9.8px;
    }

    .arriendo-cell .badge,
    .garantia-cell .badge {
        font-size: 8.5px;
        padding: 4px 4px;
    }

    .arriendo-form-fecha {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .arriendo-form-fecha input,
    .arriendo-form-fecha button {
        width: 100%;
        font-size: 9.5px;
    }
}


/* =====================================================
   17. PANTALLA MEDIANA
===================================================== */

@media (max-width: 1100px) {

    .arriendos-table,
    .garantias-table {
        border: none;
        background: transparent;
    }

    .arriendos-table-head,
    .garantias-table-head {
        display: none;
    }

    .arriendo-row,
    .garantia-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        padding: 14px;
        margin-bottom: 14px;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    }

    .arriendo-cell,
    .garantia-cell {
        border: none;
        padding: 0;
        font-size: 13px;
        align-items: flex-start;
        text-align: left;
    }

    .arriendo-cell::before,
    .garantia-cell::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: #6b7280;
        margin-bottom: 4px;
    }

    .arriendo-main,
    .arriendo-devolucion,
    .garantia-beneficiario,
    .garantia-observaciones {
        grid-column: span 2;
    }
}


/* =====================================================
   18. TABLET / MÓVIL
===================================================== */

@media (max-width: 900px) {

    .erp-wrapper {
        flex-direction: column;
    }

    .erp-sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .erp-main {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }

    .erp-content {
        padding: 18px;
    }

    .sidebar-bottom-logo {
        margin-top: 30px;
    }

    .arriendos-header,
    .garantias-header {
        flex-direction: column;
        align-items: stretch;
    }

    .arriendos-new-btn,
    .garantias-new-btn {
        width: 100%;
    }

    .arriendos-list-toolbar,
    .garantias-list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .arriendos-list-title-group,
    .garantias-list-title-group {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .arriendos-count-badge,
    .garantias-count-badge {
        align-self: flex-start;
    }
}

@media (max-width: 576px) {

    .erp-content {
        padding: 14px;
    }

    .erp-card {
        padding: 14px;
    }

    .arriendo-row,
    .garantia-row {
        grid-template-columns: 1fr;
    }

    .arriendo-main,
    .arriendo-devolucion,
    .garantia-beneficiario,
    .garantia-observaciones {
        grid-column: span 1;
    }
}


/* =====================================================
   AJUSTE FINAL RESPONSIVE ERP - 13" / 1366PX
   Objetivo:
   - Sin scroll horizontal en notebook.
   - Tabla compacta y vendible.
   - Acciones visibles en Arriendos.
===================================================== */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.erp-main,
.erp-content,
.erp-card,
.arriendos-page,
.garantias-page,
.arriendos-list-card,
.garantias-list-card,
.arriendos-table,
.garantias-table {
    max-width: 100%;
    box-sizing: border-box;
}

.arriendos-list-card,
.garantias-list-card,
.arriendos-table,
.garantias-table {
    overflow: visible;
}

.arriendo-acciones {
    align-items: stretch;
    text-align: center;
}

.arriendo-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.arriendo-action-buttons .btn,
.garantia-acciones .btn {
    width: 100%;
    white-space: nowrap;
    font-size: 11px;
    padding: 4px 7px;
    line-height: 1.15;
}

/* Tabla normal compacta para escritorio y notebook 13" */
@media (min-width: 1101px) {

    .arriendos-table-head,
    .arriendo-row {
        grid-template-columns:
            54px
            76px
            minmax(165px, 2.2fr)
            minmax(82px, 0.95fr)
            minmax(104px, 1.05fr)
            42px
            52px
            minmax(92px, 0.95fr)
            100px;
    }

    .garantias-table-head,
    .garantia-row {
        grid-template-columns:
            minmax(82px, 0.95fr)
            minmax(108px, 1.15fr)
            minmax(96px, 0.95fr)
            minmax(72px, 0.7fr)
            minmax(105px, 1.1fr)
            minmax(76px, 0.75fr)
            minmax(72px, 0.7fr)
            minmax(92px, 0.9fr)
            76px;
    }

    .arriendos-table-head,
    .garantias-table-head {
        font-size: 10.5px;
    }

    .arriendos-table-head > div,
    .garantias-table-head > div,
    .arriendo-cell,
    .garantia-cell {
        padding-left: 6px;
        padding-right: 6px;
    }

    .arriendo-cell,
    .garantia-cell {
        font-size: 11.2px;
        line-height: 1.18;
    }

    .arriendo-muted,
    .arriendo-mini-label,
    .garantia-mini-label,
    .garantia-dias {
        font-size: 9.5px;
    }

    .arriendo-cell .badge,
    .garantia-cell .badge {
        font-size: 8.5px;
        padding: 4px 4px;
        white-space: normal;
    }

    .arriendo-form-fecha {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .arriendo-form-fecha input,
    .arriendo-form-fecha button {
        width: 100%;
        font-size: 9.5px;
    }
}

/* Ajuste fino para notebooks 13" con sidebar */
@media (min-width: 1101px) and (max-width: 1366px) {

    .erp-sidebar {
        width: 210px;
        padding: 20px 10px;
    }

    .erp-main {
        margin-left: 210px;
        width: calc(100% - 210px);
        max-width: calc(100vw - 210px);
    }

    .erp-content {
        padding: 14px;
    }

    .erp-card {
        padding: 14px;
    }

    .arriendos-subtitle,
    .garantias-subtitle {
        font-size: 13px;
    }

    .arriendos-table-head,
    .arriendo-row {
        grid-template-columns:
            50px
            72px
            minmax(150px, 2fr)
            minmax(74px, 0.85fr)
            minmax(96px, 0.95fr)
            38px
            48px
            minmax(82px, 0.8fr)
            94px;
    }

    .garantias-table-head,
    .garantia-row {
        grid-template-columns:
            minmax(76px, 0.85fr)
            minmax(96px, 1fr)
            minmax(86px, 0.85fr)
            minmax(64px, 0.62fr)
            minmax(92px, 0.95fr)
            minmax(70px, 0.68fr)
            minmax(64px, 0.62fr)
            minmax(80px, 0.75fr)
            70px;
    }

    .arriendos-table-head > div,
    .garantias-table-head > div,
    .arriendo-cell,
    .garantia-cell {
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* Vista tipo ficha desde 1100px hacia abajo: evita scroll y mantiene legibilidad */
@media (max-width: 1100px) {

    .arriendos-table,
    .garantias-table {
        border: none;
        background: transparent;
    }

    .arriendos-table-head,
    .garantias-table-head {
        display: none;
    }

    .arriendo-row,
    .garantia-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        padding: 14px;
        margin-bottom: 14px;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    }

    .arriendo-cell,
    .garantia-cell {
        border: none;
        padding: 0;
        font-size: 13px;
        align-items: flex-start;
        text-align: left;
    }

    .arriendo-cell::before,
    .garantia-cell::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: #6b7280;
        margin-bottom: 4px;
    }

    .arriendo-main,
    .arriendo-devolucion,
    .arriendo-acciones,
    .garantia-beneficiario,
    .garantia-observaciones,
    .garantia-acciones {
        grid-column: span 2;
    }

    .arriendo-action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .arriendo-action-buttons .btn {
        width: auto;
        min-width: 105px;
    }
}

@media (max-width: 576px) {

    .arriendo-row,
    .garantia-row {
        grid-template-columns: 1fr;
    }

    .arriendo-main,
    .arriendo-devolucion,
    .arriendo-acciones,
    .garantia-beneficiario,
    .garantia-observaciones,
    .garantia-acciones {
        grid-column: span 1;
    }

    .arriendo-action-buttons {
        flex-direction: column;
    }

    .arriendo-action-buttons .btn {
        width: 100%;
    }
}


/* =====================================================
   UX ACCIONES ERP - ARRIENDOS / GARANTÍAS
   Botones visibles, compactos y profesionales.
   Reemplaza visualmente los dropdown de tres puntos.
===================================================== */

.arriendo-acciones,
.garantia-acciones {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    overflow: visible !important;
}

.erp-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 7px;
    align-items: stretch;
    justify-content: center;
}

.erp-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 30px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}

.erp-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(15, 23, 42, 0.14);
}

.erp-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.28);
}

.erp-action-edit {
    color: #ffffff !important;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
}

.erp-action-return {
    color: #ffffff !important;
    background: linear-gradient(135deg, #16a34a, #15803d);
    border-color: #15803d;
}

.erp-action-close {
    color: #1f2937 !important;
    background: linear-gradient(135deg, #facc15, #f59e0b);
    border-color: #f59e0b;
}

.erp-action-delete {
    color: #ffffff !important;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #b91c1c;
}

.erp-action-muted {
    color: #64748b !important;
    background: #f1f5f9;
    border-color: #e2e8f0;
    box-shadow: none;
    cursor: default;
}

/* Dar espacio real a la columna de acciones en escritorio/notebook */
@media (min-width: 1101px) {
    .arriendos-table-head,
    .arriendo-row {
        grid-template-columns:
            minmax(56px, 0.55fr)
            minmax(82px, 0.75fr)
            minmax(170px, 2fr)
            minmax(88px, 0.9fr)
            minmax(105px, 1fr)
            minmax(44px, 0.45fr)
            minmax(56px, 0.55fr)
            minmax(105px, 1fr)
            minmax(128px, 1.05fr) !important;
    }

    .garantias-table-head,
    .garantia-row {
        grid-template-columns:
            minmax(95px, 1fr)
            minmax(120px, 1.15fr)
            minmax(105px, 1fr)
            minmax(76px, 0.7fr)
            minmax(115px, 1.1fr)
            minmax(82px, 0.8fr)
            minmax(82px, 0.75fr)
            minmax(96px, 0.9fr)
            minmax(128px, 1.05fr) !important;
    }
}

/* En pantallas medianas los botones quedan horizontales dentro de la ficha */
@media (max-width: 1100px) {
    .erp-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .erp-action-btn {
        min-width: 112px;
    }
}

@media (max-width: 576px) {
    .erp-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .erp-action-btn {
        width: 100%;
    }
}


/* =====================================================
   FIX FINAL MENÚ HAMBURGUESA TABLET / MÓVIL
   - El sidebar NO ocupa espacio blanco cuando está cerrado.
   - El botón abre/cierra el menú correctamente.
   - Se activa desde 1100px hacia abajo.
===================================================== */

.erp-mobile-menu-btn,
.erp-mobile-overlay {
    display: none;
}

@media (max-width: 1100px) {

    body.menu-open {
        overflow: hidden;
    }

    .erp-wrapper {
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
    }

    .erp-mobile-menu-btn {
        display: inline-flex !important;
        position: fixed !important;
        top: 18px !important;
        left: 18px !important;
        width: 48px !important;
        height: 48px !important;
        border: 0 !important;
        border-radius: 14px !important;
        background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
        color: #ffffff !important;
        z-index: 5000 !important;
        align-items: center !important;
        justify-content: center !important;
        flex-direction: column !important;
        gap: 5px !important;
        box-shadow: 0 12px 25px rgba(37, 99, 235, .35) !important;
        cursor: pointer !important;
    }

    .erp-mobile-menu-btn span {
        display: block !important;
        width: 22px !important;
        height: 3px !important;
        border-radius: 999px !important;
        background: #ffffff !important;
        transition: transform .2s ease, opacity .2s ease !important;
    }

    body.menu-open .erp-mobile-menu-btn span:nth-child(1) {
        transform: translateY(8px) rotate(45deg) !important;
    }

    body.menu-open .erp-mobile-menu-btn span:nth-child(2) {
        opacity: 0 !important;
    }

    body.menu-open .erp-mobile-menu-btn span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg) !important;
    }

    .erp-mobile-overlay {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(15, 23, 42, .48) !important;
        backdrop-filter: blur(2px) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity .22s ease !important;
        z-index: 3990 !important;
    }

    body.menu-open .erp-mobile-overlay {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .erp-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: min(84vw, 320px) !important;
        max-width: 320px !important;
        height: 100vh !important;
        min-height: 100vh !important;
        padding: 26px 18px !important;
        transform: translateX(-110%) !important;
        transition: transform .25s ease !important;
        z-index: 4500 !important;
        overflow-y: auto !important;
        box-shadow: 18px 0 45px rgba(15, 23, 42, .28) !important;
    }

    .erp-sidebar.sidebar-open {
        transform: translateX(0) !important;
    }

    .erp-main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-height: 100vh !important;
    }

    .erp-topbar {
        min-height: 72px !important;
        height: auto !important;
        padding: 14px 18px 14px 84px !important;
        gap: 10px !important;
        flex-wrap: wrap !important;
        overflow: visible !important;
    }

    .erp-content {
        padding: 20px !important;
    }

    .sidebar-bottom-logo {
        margin-top: 28px !important;
    }
}

@media (max-width: 576px) {
    .erp-mobile-menu-btn {
        top: 14px !important;
        left: 14px !important;
        width: 44px !important;
        height: 44px !important;
    }

    .erp-topbar {
        padding-left: 74px !important;
    }

    .erp-content {
        padding: 16px !important;
    }
}

/* =====================================================
   AJUSTE TABLAS ERP - SOLICITADO
===================================================== */

/* Aumentar fuente tablas */

.arriendo-cell,
.garantia-cell{
    font-size:15px !important;
}

.arriendos-table-head,
.garantias-table-head{
    font-size:14px !important;
}

/* -------- ARRIENDOS -------- */

/* Encabezados */

.arriendos-table-head > div:nth-child(2),
.arriendos-table-head > div:nth-child(6),
.arriendos-table-head > div:nth-child(7),
.arriendos-table-head > div:nth-child(9){
    text-align:center !important;
}

/* Contenido */

.arriendo-estado,
.arriendo-cantidad,
.arriendo-dias,
.arriendo-acciones{
    align-items:center !important;
    justify-content:center !important;
    text-align:center !important;
}

/* -------- GARANTÍAS -------- */

/* Encabezados */

.garantias-table-head > div:nth-child(4),
.garantias-table-head > div:nth-child(6),
.garantias-table-head > div:nth-child(7),
.garantias-table-head > div:nth-child(9){
    text-align:center !important;
}

/* Contenido */

.garantia-monto,
.garantia-vigencia,
.garantia-estado,
.garantia-acciones{
    align-items:center !important;
    justify-content:center !important;
    text-align:center !important;
}


/* =====================================================
   AJUSTE FINAL TAMAÑOS TABLAS ERP
===================================================== */

/* Estado Arriendos */

.arriendo-estado .badge{
    font-size:13px !important;
    font-weight:700 !important;
    padding:6px 12px !important;
}

/* Estado Garantías */

.garantia-estado .badge{
    font-size:13px !important;
    font-weight:700 !important;
    padding:6px 12px !important;
}

/* Inicio / Término */

.arriendo-fechas{
    font-size:14px !important;
}

.arriendo-fechas div{
    font-size:14px !important;
}

/* Etiquetas Inicio y Término */

.arriendo-mini-label{
    font-size:13px !important;
    font-weight:600 !important;
}

/* Vigencia Garantías */

.garantia-vigencia{
    font-size:14px !important;
}

/* Días restantes Garantías */

.garantia-dias{
    font-size:14px !important;
}

/* RUT proveedor */

.arriendo-muted{
    font-size:13px !important;
}

/* =====================================================
   FIX LOGO INFERIOR SIDEBAR
   Mantiene el logo CASAA completo y visible.
===================================================== */

.erp-sidebar {
    overflow: hidden;
}

.erp-menu {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.erp-menu::-webkit-scrollbar {
    width: 5px;
}

.erp-menu::-webkit-scrollbar-track {
    background: transparent;
}

.erp-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
}

.sidebar-bottom-logo {
    flex: 0 0 auto;
    width: 100%;
    margin-top: 12px;
    padding: 12px 4px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    background: #161d69;
}

.bottom-logo-img {
    display: block;
    width: 100%;
    max-width: 210px;
    max-height: 76px;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

@media (min-width: 1101px) and (max-width: 1366px) {
    .sidebar-bottom-logo {
        padding-top: 10px;
    }

    .bottom-logo-img {
        max-width: 180px;
        max-height: 64px;
    }
}

@media (max-width: 1100px) {
    .erp-sidebar {
        overflow: hidden !important;
    }

    .erp-logo {
        flex: 0 0 auto;
        margin-bottom: 18px;
    }

    .erp-menu {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        padding-bottom: 8px;
    }

    .sidebar-bottom-logo {
        flex: 0 0 auto;
        margin-top: 10px !important;
        padding: 10px 4px 2px !important;
    }

    .bottom-logo-img {
        max-width: 225px;
        max-height: 72px;
    }
}

@media (max-width: 576px) {
    .erp-sidebar {
        padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    .erp-logo {
        font-size: 22px;
        margin-bottom: 14px;
    }

    .erp-link {
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .erp-link.logout {
        margin-top: 16px;
    }

    .sidebar-bottom-logo {
        padding-bottom: calc(4px + env(safe-area-inset-bottom)) !important;
    }

    .bottom-logo-img {
        max-width: 220px;
        max-height: 68px;
    }
}

/* =====================================================
   CUSTODIA PRIVADA DE RESPALDOS PDF - GARANTÍAS
===================================================== */

.respaldo-status {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin-top: 7px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.respaldo-status--ok {
    color: #047857;
    background: #dff7ec;
    border: 1px solid #b7ead5;
}

.respaldo-status--empty {
    color: #667085;
    background: #f2f4f7;
    border: 1px solid #e4e7ec;
}

.garantia-alerta-dias {
    color: #b54708;
    font-weight: 800;
}

.erp-action-form {
    width: 100%;
    margin: 0;
}

.erp-action-form .erp-action-btn {
    width: 100%;
}

.erp-action-btn[type="submit"] {
    cursor: pointer;
}

.private-file-box,
.private-custody-card {
    border: 1px solid #dbe4f0;
    background: #f8fafc;
}

.private-file-box {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(260px, 0.9fr);
    align-items: center;
    gap: 18px;
    padding: 18px;
    border-radius: 14px;
}

.private-file-box strong {
    display: block;
    color: #101828;
    margin-bottom: 4px;
}

.private-file-box p,
.private-file-box small,
.private-custody-card p,
.private-file-form small {
    color: #667085;
    font-size: 12px;
}

.private-file-box p {
    margin: 0;
}

.private-file-box small {
    grid-column: 2;
    margin-top: -12px;
}

.private-custody-card {
    overflow: visible;
}

.private-custody-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid #dbe4f0;
}

.private-custody-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #155eef;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.1em;
}

.private-file-metadata {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.private-file-metadata > div {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 11px;
    background: #ffffff;
}

.private-file-metadata span,
.private-file-metadata strong {
    display: block;
}

.private-file-metadata span {
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.private-file-metadata strong {
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: #101828;
    font-size: 12px;
}

.private-file-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
    gap: 14px;
}

.private-file-form .btn {
    min-height: 40px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .private-file-box,
    .private-file-form {
        grid-template-columns: 1fr;
    }

    .private-file-box small {
        grid-column: auto;
        margin-top: -8px;
    }

    .private-file-metadata {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .private-custody-header {
        flex-direction: column;
    }

    .private-file-metadata {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   PREVISUALIZACIÓN PROTEGIDA DE RESPALDOS PDF
===================================================== */

.garantias-scope-badge {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    padding: 5px 9px;
    border: 1px solid #cbdafc;
    border-radius: 999px;
    background: #eef4ff;
    color: #1849a9;
    font-size: 11px;
    font-weight: 800;
}

.respaldo-status--preview {
    color: #1849a9;
    background: #eaf2ff;
    border: 1px solid #bfd3ff;
    text-decoration: none;
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        transform 150ms ease;
}

.respaldo-status--preview:hover,
.respaldo-status--preview:focus-visible {
    color: #0b3b91;
    background: #dce9ff;
    border-color: #9fbeff;
    text-decoration: none;
    transform: translateY(-1px);
}

.private-preview-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid #bfd3ff;
    border-radius: 12px;
    background: #eef4ff;
}

.private-preview-actions .btn {
    flex: 0 0 auto;
    min-height: 38px;
}

.private-preview-actions span {
    color: #475467;
    font-size: 12px;
    line-height: 1.45;
}

@media (max-width: 650px) {
    .private-preview-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .private-preview-actions .btn {
        width: 100%;
    }
}
