/* ============================================================================
   5-SECTIONS.CSS - Estilos Específicos de Página/Sección
   ============================================================================
   
   Este archivo contiene SOLO los estilos específicos de cada página/sección:
   - Dashboard: KPI cards, timeline, chart containers
   - Clientes: tabla y filtros específicos
   - Facturas: tabla optimizada, badges, paginación
   - Abonos: tabla y filtros específicos
   - Perfil: formularios y cards de perfil
   - Login: toda la página de login con animaciones
   
   NO incluye componentes genéricos (botones, cards, forms) ni layout (header, sidebar)
   ============================================================================ */

/* ============================================================================
   SECCIÓN: DASHBOARD (#dashboard)
   ============================================================================ */

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-24);
    margin-bottom: var(--space-32);
}

.kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-24);
    display: flex;
    align-items: center;
    gap: var(--space-16);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration-normal) var(--ease-standard);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    color: var(--color-white);
}

.kpi-icon.primary {
    background: var(--color-bg-1);
    color: #2563eb;
}

.kpi-icon.warning {
    background: var(--color-bg-2);
    color: #f59e0b;
}

.kpi-icon.success {
    background: var(--color-bg-3);
    color: #22c55e;
}

.kpi-icon.error {
    background: var(--color-bg-4);
    color: #ef4444;
}

.kpi-content h3 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    margin: 0;
    color: var(--color-text);
}

.kpi-content p {
    color: var(--color-text-secondary);
    margin: var(--space-4) 0 0 0;
    font-size: var(--font-size-sm);
}

/* Chart Containers Específicos del Dashboard */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: var(--space-24);
    margin-bottom: var(--space-32);
}

.chart-container {
    min-height: 400px;
}

/* Timeline del Dashboard */
.timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-12);
}

.timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    background: var(--color-primary);
    color: var(--color-btn-primary-text);
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
}

.timeline-content h4 {
    margin: 0 0 var(--space-4) 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
}

.timeline-content p {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.time {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.activity-icon {
    font-size: var(--font-size-sm);
}

/* Tablas del Dashboard */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-24);
    margin-bottom: var(--space-32);
}

.kpi-trend {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

/* ============================================================================
   SECCIÓN: CLIENTES (#clientes)
   ============================================================================ */

/* Filtros de Clientes */
#clientes .filters-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    align-items: end;
    margin-bottom: 1rem;
}

#clientes .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

#clientes .filter-field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

#clientes .filter-field input,
#clientes .filters-grid select {
    background: var(--color-surface);
    border: 1px solid var(--color-card-border);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    transition: border-color .2s, box-shadow .2s;
}

#clientes .filter-field input:focus,
#clientes .filters-grid select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-teal-500-rgb), .15);
}

#clientes .filter-actions {
    display: flex;
    align-items: flex-end;
}

#clientes .filter-actions .btn {
    white-space: nowrap;
}

/* Tabla de Clientes - Estilos Específicos */
#clientes .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#clientes #clientesTable {
    font-size: 12px;
}

#clientes #clientesTable th,
#clientes #clientesTable td {
    padding: 8px 10px;
    white-space: nowrap;
}

/* Autocomplete Cliente */
.cliente-search-wrapper {
    position: relative;
}

.cliente-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.cliente-dropdown.hidden {
    display: none;
}

.cliente-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    line-height: 1.4;
}

.cliente-dropdown-item:hover,
.cliente-dropdown-item.active {
    background-color: #f8f9fa;
}

.cliente-dropdown-item:last-child {
    border-bottom: none;
}

.cliente-dropdown-empty {
    padding: 10px 12px;
    color: #666;
    font-style: italic;
    font-size: 14px;
}

.cliente-search-wrapper input.field-error {
    border-color: #c62828;
}

/* Optimizaciones PC - Tabla Clientes */
@media (min-width: 1024px) {
    #clientes .card .table-container {
        max-height: calc(100vh - 300px);
        overflow-y: auto;
        overflow-x: auto;
        position: relative;
    }

    /* Modern browsers (Firefox 64+, Chrome 121+) */
    @supports (scrollbar-width: thin) {
        #clientes .card .table-container {
            scrollbar-width: thin;
        }
    }

    /* Webkit browsers (Chrome, Safari, Edge) - fallback and current standard */
    #clientes .card .table-container::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    #clientes .card .table-container::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.04);
    }

    #clientes .card .table-container::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.18);
        border-radius: 6px;
    }

    #clientes #clientesTable {
        font-size: 12px;
        table-layout: fixed;
    }

    /* Anchos específicos de columnas */
    #clientes #clientesTable th:nth-child(1) {
        width: 140px;
    }

    #clientes #clientesTable th:nth-child(2) {
        width: 160px;
    }

    #clientes #clientesTable th:nth-child(3) {
        width: 90px;
    }

    #clientes #clientesTable th:nth-child(4) {
        width: 120px;
    }

    #clientes #clientesTable th:nth-child(5),
    #clientes #clientesTable th:nth-child(6) {
        width: 110px;
    }

    #clientes #clientesTable th:nth-child(7) {
        width: 60px;
    }

    #clientes #clientesTable th:nth-child(8) {
        width: 110px;
    }

    #clientes #clientesTable th:nth-child(9) {
        width: 110px;
    }

    #clientes #clientesTable th:nth-child(10),
    #clientes #clientesTable th:nth-child(11) {
        width: 90px;
    }

    #clientes #clientesTable th:nth-child(12) {
        width: 130px;
    }

    #clientes #clientesTable th:nth-child(13) {
        width: 110px;
    }

    #clientes #clientesTable th,
    #clientes #clientesTable td {
        padding: 6px 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }

    /* Columna Acciones fija a la derecha con fondo blanco */
    #clientes #clientesTable th:last-child,
    #clientes #clientesTable td:last-child {
        position: sticky;
        right: 0;
        background: #ffffff;
        z-index: 3;
        box-shadow: -4px 0 6px -4px rgba(0, 0, 0, 0.12);
    }

    #clientes #clientesTable tbody tr:hover td:last-child {
        background: #ffffff;
    }

    #clientes #clientesTable tbody tr:hover {
        background: var(--color-secondary);
    }
}

/* Responsive Móvil - Tabla Clientes */
@media (max-width: 780px) {
    #clientes #clientesTable {
        font-size: 11px;
    }

    #clientes #clientesTable th,
    #clientes #clientesTable td {
        padding: 6px 8px;
    }

    /* Ocultar columnas menos críticas */
    #clientes #clientesTable th:nth-child(9),
    #clientes #clientesTable td:nth-child(9),
    #clientes #clientesTable th:nth-child(10),
    #clientes #clientesTable td:nth-child(10),
    #clientes #clientesTable th:nth-child(11),
    #clientes #clientesTable td:nth-child(11),
    #clientes #clientesTable th:nth-child(12),
    #clientes #clientesTable td:nth-child(12) {
        display: none;
    }

    #clientes #clientesTable th:last-child,
    #clientes #clientesTable td:last-child {
        position: static;
        box-shadow: none;
    }
}

@media (max-width: 640px) {

    /* Cards Mode */
    #clientes #clientesTable thead {
        display: none;
    }

    #clientes #clientesTable,
    #clientes #clientesTable tbody,
    #clientes #clientesTable tr,
    #clientes #clientesTable td {
        display: block;
        width: 100%;
    }

    #clientes #clientesTable {
        border: 0;
    }

    #clientes #clientesTable tbody tr {
        margin: 0 0 10px;
        background: var(--color-surface);
        border: 1px solid var(--color-card-border);
        border-radius: 10px;
        padding: 8px 10px 6px;
        box-shadow: var(--shadow-xs);
    }

    #clientes #clientesTable tbody tr:hover {
        background: var(--color-surface);
    }

    #clientes #clientesTable tbody tr td {
        padding: 4px 0;
        font-size: 11px;
        line-height: 1.35;
        border: 0;
        display: flex;
        gap: 6px;
    }

    #clientes #clientesTable tbody tr td::before {
        content: attr(data-label);
        flex: 0 0 95px;
        font-weight: 600;
        color: var(--color-text-secondary);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: .5px;
    }

    /* Etiquetas dinámicas */
    #clientes #clientesTable tbody tr td:nth-child(1) {
        --lbl: "Nombre";
    }

    #clientes #clientesTable tbody tr td:nth-child(2) {
        --lbl: "Email";
    }

    #clientes #clientesTable tbody tr td:nth-child(3) {
        --lbl: "Teléfono";
    }

    #clientes #clientesTable tbody tr td:nth-child(4) {
        --lbl: "Empresa";
    }

    #clientes #clientesTable tbody tr td:nth-child(5) {
        --lbl: "Ciudad";
    }

    #clientes #clientesTable tbody tr td:nth-child(6) {
        --lbl: "Provincia";
    }

    #clientes #clientesTable tbody tr td:nth-child(7) {
        --lbl: "CP";
    }

    #clientes #clientesTable tbody tr td:nth-child(8) {
        --lbl: "NIF/CIF";
    }

    #clientes #clientesTable tbody tr td:nth-child(9) {
        --lbl: "Desc.Com.";
    }

    #clientes #clientesTable tbody tr td:nth-child(10) {
        --lbl: "Plazo";
    }

    #clientes #clientesTable tbody tr td:nth-child(11) {
        --lbl: "Forma Pago";
    }

    #clientes #clientesTable tbody tr td:nth-child(12) {
        --lbl: "Últ. Compra";
    }

    #clientes #clientesTable tbody tr td:nth-child(13) {
        --lbl: "Acciones";
    }

    #clientes #clientesTable tbody tr td::before {
        content: var(--lbl);
    }

    /* Ocultar campos menos críticos */
    #clientes #clientesTable tbody tr td:nth-child(9),
    #clientes #clientesTable tbody tr td:nth-child(10),
    #clientes #clientesTable tbody tr td:nth-child(11),
    #clientes #clientesTable tbody tr td:nth-child(12) {
        display: none;
    }

    /* Acciones al final */
    #clientes #clientesTable tbody tr td:last-child {
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid var(--color-border);
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    #clientes #clientesTable tbody tr td:last-child::before {
        flex: 0 0 100%;
        margin-bottom: 2px;
    }

    #clientes #clientesTable tbody tr td:last-child .action-btn {
        background: var(--color-secondary);
        padding: 4px 8px;
        border-radius: 6px;
        font-size: 11px;
    }

    #clientes #clientesTable tbody tr td:last-child .action-btn:hover {
        background: var(--color-secondary-hover);
    }
}

@media (max-width: 780px) {
    .cliente-dropdown {
        max-height: 160px;
        border-radius: 6px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    }

    .cliente-dropdown-item {
        padding: 12px 14px;
        font-size: 15px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .cliente-dropdown-item:active {
        background-color: #e3f2fd;
    }

    .cliente-search-wrapper input {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
}

/* ============================================================================
   SECCIÓN: FACTURAS (#facturas)
   ============================================================================ */

/* Filtros de Facturas */
#facturas .filters-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    align-items: end;
    margin-bottom: 1rem;
}

#facturas .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

#facturas .filter-field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

#facturas .filter-field input,
#facturasFilters select {
    background: var(--color-surface);
    border: 1px solid var(--color-card-border);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
}

#facturas .filter-field input:focus,
#facturasFilters select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-teal-500-rgb), .15);
}

/* Badges de Estado Específicos de Facturas */
.estado-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .3px;
    border-radius: 12px;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

.estado-pendiente {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.4);
}

.estado-vencida {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.45);
}

.estado-pagada {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.45);
}

/* Tabla Facturas - Estilos Específicos */
#facturas .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#facturas #facturasTable {
    font-size: 11px;
}

#facturas #facturasTable th,
#facturas #facturasTable td {
    padding: 5px 6px;
}

.estado-select {
    padding: 4px 6px;
    font-size: .85rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.read-only {
    background: #f4f4f4;
    cursor: not-allowed;
    opacity: .9;
}

.flash-new {
    animation: flashRow 2s ease-in-out;
}

@keyframes flashRow {
    0% {
        background: #d1f5e5;
    }

    100% {
        background: transparent;
    }
}

/* Optimizaciones PC - Tabla Facturas */
@media (min-width: 1024px) {
    #facturas .card .table-container {
        max-height: calc(100vh - 320px);
        overflow-y: auto;
        overflow-x: auto;
        position: relative;
    }

    /* Modern browsers (Firefox 64+, Chrome 121+) */
    @supports (scrollbar-width: thin) {
        #facturas .card .table-container {
            scrollbar-width: thin;
        }
    }

    /* Webkit browsers (Chrome, Safari, Edge) - fallback and current standard */
    #facturas .card .table-container::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    #facturas .card .table-container::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.04);
    }

    #facturas .card .table-container::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.18);
        border-radius: 6px;
    }

    #facturas #facturasTable {
        font-size: 11px;
        table-layout: fixed;
        min-width: 1600px;
    }

    /* Anchos optimizados para cada columna */
    #facturas #facturasTable th:nth-child(1) {
        width: 100px;
    }

    #facturas #facturasTable th:nth-child(2) {
        width: 150px;
    }

    #facturas #facturasTable th:nth-child(3) {
        width: 85px;
    }

    #facturas #facturasTable th:nth-child(4) {
        width: 90px;
    }

    #facturas #facturasTable th:nth-child(5) {
        width: 85px;
    }

    #facturas #facturasTable th:nth-child(6) {
        width: 120px;
    }

    #facturas #facturasTable th:nth-child(7) {
        width: 90px;
    }

    #facturas #facturasTable th:nth-child(8) {
        width: 50px;
    }

    #facturas #facturasTable th:nth-child(9) {
        width: 65px;
    }

    #facturas #facturasTable th:nth-child(10) {
        width: 95px;
    }

    #facturas #facturasTable th:nth-child(11) {
        width: 100px;
    }

    #facturas #facturasTable th:nth-child(12) {
        width: 75px;
    }

    #facturas #facturasTable th:nth-child(13) {
        width: 90px;
    }

    #facturas #facturasTable th:nth-child(14) {
        width: 130px;
    }

    #facturas #facturasTable th,
    #facturas #facturasTable td {
        padding: 5px 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
        text-align: center;
    }

    /* Centrar TODOS los valores de las columnas */
    #facturas #facturasTable td {
        text-align: center;
    }

    /* Badges más compactos */
    #facturas #facturasTable .estado-badge {
        padding: 2px 7px;
        font-size: 9px;
        letter-spacing: 0.3px;
        border-radius: 10px;
        font-weight: 700;
    }

    /* Columna Acciones fija con fondo blanco para evitar transparencias */
    #facturas #facturasTable th:last-child,
    #facturas #facturasTable td:last-child {
        position: sticky;
        right: 0;
        background: #ffffff;
        z-index: 3;
        box-shadow: -4px 0 6px -4px rgba(0, 0, 0, 0.12);
        text-align: center;
    }

    #facturas #facturasTable tbody tr:hover td:last-child {
        background: #ffffff;
    }

    #facturas #facturasTable tbody tr:hover {
        background: var(--color-secondary);
    }

    #facturas #facturasTable .action-btn {
        padding: 4px 6px;
        font-size: 11px;
    }

    #facturas #facturasTable .action-btn i {
        font-size: 11px;
    }
}

/* Responsive Móvil - Tabla Facturas */
@media (max-width: 780px) {
    #facturas #facturasTable {
        font-size: 11px;
    }

    #facturas #facturasTable th,
    #facturas #facturasTable td {
        padding: 5px 6px;
    }

    /* Ocultar columnas IVA y Recargo */
    #facturas #facturasTable th:nth-child(8),
    #facturas #facturasTable td:nth-child(8),
    #facturas #facturasTable th:nth-child(9),
    #facturas #facturasTable td:nth-child(9) {
        display: none;
    }

    #facturas #facturasTable th:last-child,
    #facturas #facturasTable td:last-child {
        position: static;
        box-shadow: none;
    }

    #facturas .table-container {
        overflow-x: auto;
    }
}

@media (max-width: 640px) {

    /* Cards Mode */
    #facturas #facturasTable thead {
        display: none;
    }

    #facturas #facturasTable,
    #facturas #facturasTable tbody,
    #facturas #facturasTable tr,
    #facturas #facturasTable td {
        display: block;
        width: 100%;
    }

    #facturas #facturasTable tbody tr {
        margin: 0 0 10px;
        background: var(--color-surface);
        border: 1px solid var(--color-card-border);
        border-radius: 10px;
        padding: 8px 10px 6px;
        box-shadow: var(--shadow-xs);
    }

    #facturas #facturasTable tbody tr:hover {
        background: var(--color-surface);
    }

    #facturas #facturasTable tbody tr td {
        padding: 4px 0;
        font-size: 11px;
        line-height: 1.35;
        border: 0;
        display: flex;
        gap: 6px;
    }

    #facturas #facturasTable tbody tr td::before {
        flex: 0 0 90px;
        font-weight: 600;
        color: var(--color-text-secondary);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: .5px;
        content: var(--lbl);
    }

    /* Etiquetas */
    #facturas #facturasTable tbody tr td:nth-child(1) {
        --lbl: "Número";
    }

    #facturas #facturasTable tbody tr td:nth-child(2) {
        --lbl: "Cliente";
    }

    #facturas #facturasTable tbody tr td:nth-child(3) {
        --lbl: "Fecha";
    }

    #facturas #facturasTable tbody tr td:nth-child(4) {
        --lbl: "Vencimiento";
    }

    #facturas #facturasTable tbody tr td:nth-child(5) {
        --lbl: "Estado";
    }

    #facturas #facturasTable tbody tr td:nth-child(6) {
        --lbl: "Empresa";
    }

    #facturas #facturasTable tbody tr td:nth-child(7) {
        --lbl: "Total s/IVA";
    }

    #facturas #facturasTable tbody tr td:nth-child(8) {
        --lbl: "IVA";
    }

    #facturas #facturasTable tbody tr td:nth-child(9) {
        --lbl: "Recargo Eq.";
    }

    #facturas #facturasTable tbody tr td:nth-child(10) {
        --lbl: "Total";
    }

    #facturas #facturasTable tbody tr td:nth-child(11) {
        --lbl: "Forma Pago";
    }

    #facturas #facturasTable tbody tr td:nth-child(12) {
        --lbl: "Dto.PP";
    }

    #facturas #facturasTable tbody tr td:nth-child(13) {
        --lbl: "Comisión";
    }

    #facturas #facturasTable tbody tr td:nth-child(14) {
        --lbl: "Acciones";
    }

    /* Ocultar columnas menos críticas */
    #facturas #facturasTable tbody tr td:nth-child(6),
    #facturas #facturasTable tbody tr td:nth-child(7),
    #facturas #facturasTable tbody tr td:nth-child(8),
    #facturas #facturasTable tbody tr td:nth-child(9),
    #facturas #facturasTable tbody tr td:nth-child(11),
    #facturas #facturasTable tbody tr td:nth-child(12) {
        display: none;
    }

    /* Acciones al final */
    #facturas #facturasTable tbody tr td:last-child {
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid var(--color-border);
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    #facturas #facturasTable tbody tr td:last-child::before {
        flex: 0 0 100%;
        margin-bottom: 2px;
    }

    #facturas #facturasTable tbody tr td:last-child .action-btn {
        background: var(--color-secondary);
        padding: 4px 8px;
        border-radius: 6px;
        font-size: 11px;
    }

    #facturas #facturasTable tbody tr td:last-child .action-btn:hover {
        background: var(--color-secondary-hover);
    }
}

/* Visor PDF embebido - Específico de Facturas */
.pdf-embed-panel {
    margin-top: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-card-border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.pdf-embed-panel.hidden {
    display: none;
}

.pdf-embed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--color-primary);
    color: #fff;
    flex-wrap: wrap;
}

.pdf-embed-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.pdf-embed-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pdf-sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, .35);
}

.pdf-btn {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .25);
    color: #fff;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.1;
    transition: background .15s;
}

.pdf-btn:hover {
    background: rgba(255, 255, 255, .28);
}

.pdf-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.pdf-btn.danger {
    background: rgba(255, 80, 80, .20);
    border-color: rgba(255, 80, 80, .35);
}

.pdf-btn.danger:hover {
    background: rgba(255, 80, 80, .35);
}

.pdf-embed-body {
    position: relative;
    max-height: clamp(320px, 60vh, 860px);
    overflow: auto;
    background: #111;
    padding: 18px;
    -webkit-overflow-scrolling: touch;
}

.pdf-pages {
    display: flex;
    flex-direction: column;
    gap: 22px;
    align-items: center;
    margin: 0 auto;
    width: 100%;
    max-width: 1400px;
}

.pdf-page-wrapper {
    position: relative;
    background: #222;
    padding: 6px 6px 14px;
    border-radius: 10px;
    box-shadow: 0 8px 28px -8px rgba(0, 0, 0, .65);
    display: flex;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

.pdf-page-wrapper canvas {
    background: #fff;
    border-radius: 6px;
    max-width: 100%;
    height: auto;
    touch-action: none;
}

.pdf-page-skel {
    width: 100%;
    max-width: 900px;
    aspect-ratio: 1/1.414;
    background: linear-gradient(120deg, #2c2c2c, #262626);
    border-radius: 8px;
    animation: pdfPulse 1.3s ease-in-out infinite;
}

@keyframes pdfPulse {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.25);
    }
}

.pdf-error-box {
    max-width: 680px;
    margin: 20px auto;
    padding: 16px 18px;
    background: #471d1d;
    border: 1px solid #8a3d3d;
    color: #f2d7d7;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.pdf-fallback {
    max-width: 680px;
    margin: 24px auto;
    padding: 24px;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    text-align: center;
    color: #ddd;
}

.pdf-page-info {
    font-weight: 500;
    font-size: 12px;
}

.pdf-zoom-label {
    min-width: 42px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 780px) {
    .pdf-embed-header {
        padding: 10px 12px;
    }

    .pdf-embed-actions {
        gap: 4px;
    }

    .pdf-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .pdf-embed-body {
        padding: 14px;
        max-height: 65vh;
    }

    .pdf-page-wrapper {
        box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .6);
    }
}

@media (max-width: 600px) {
    .pdf-embed-actions {
        justify-content: flex-end;
    }

    .pdf-embed-title span {
        font-size: 13px;
    }

    .pdf-btn i {
        font-size: 12px;
    }
}

/* ============================================================================
   SECCIÓN: ABONOS (#abonos)
   ============================================================================ */

/* Filtros de Abonos */
#abonos .filters-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    align-items: end;
    margin-bottom: 1rem;
}

#abonos .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

#abonos .filter-field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

#abonos .filter-field input,
#abonos .filters-grid select {
    background: var(--color-surface);
    border: 1px solid var(--color-card-border);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
}

#abonos .filter-field input:focus,
#abonos .filters-grid select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-teal-500-rgb), .15);
}

/* Tabla de Abonos - Estilos Específicos */
#abonos .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#abonos #abonosTable {
    font-size: 12px;
}

#abonos #abonosTable th,
#abonos #abonosTable td {
    padding: 8px 10px;
    white-space: nowrap;
}

/* Optimizaciones PC - Tabla Abonos */
@media (min-width: 1024px) {
    #abonos .card .table-container {
        max-height: calc(100vh - 320px);
        overflow-y: auto;
        overflow-x: auto;
        position: relative;
    }

    /* Modern browsers (Firefox 64+, Chrome 121+) */
    @supports (scrollbar-width: thin) {
        #abonos .card .table-container {
            scrollbar-width: thin;
        }
    }

    /* Webkit browsers (Chrome, Safari, Edge) */
    #abonos .card .table-container::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    #abonos .card .table-container::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.04);
    }

    #abonos .card .table-container::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.18);
        border-radius: 6px;
    }

    #abonos #abonosTable {
        font-size: 12px;
        table-layout: fixed;
        min-width: 1400px;
    }

    #abonos #abonosTable th,
    #abonos #abonosTable td {
        padding: 6px 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
        text-align: center;
    }

    /* Columna Acciones fija con fondo blanco */
    #abonos #abonosTable th:last-child,
    #abonos #abonosTable td:last-child {
        position: sticky;
        right: 0;
        background: #ffffff;
        z-index: 3;
        box-shadow: -4px 0 6px -4px rgba(0, 0, 0, 0.12);
        text-align: center;
    }

    #abonos #abonosTable tbody tr:hover td:last-child {
        background: #ffffff;
    }

    #abonos #abonosTable tbody tr:hover {
        background: var(--color-secondary);
    }

    #abonos #abonosTable .action-btn {
        padding: 4px 6px;
        font-size: 11px;
    }

    #abonos #abonosTable .action-btn i {
        font-size: 11px;
    }
}

/* Responsive Móvil - Tabla Abonos */
@media (max-width: 780px) {
    #abonos #abonosTable {
        font-size: 11px;
    }

    #abonos #abonosTable th,
    #abonos #abonosTable td {
        padding: 5px 6px;
    }

    #abonos #abonosTable th:last-child,
    #abonos #abonosTable td:last-child {
        position: static;
        box-shadow: none;
    }

    #abonos .table-container {
        overflow-x: auto;
    }
}

@media (max-width: 640px) {

    /* Cards Mode para móvil */
    #abonos #abonosTable thead {
        display: none;
    }

    #abonos #abonosTable,
    #abonos #abonosTable tbody,
    #abonos #abonosTable tr,
    #abonos #abonosTable td {
        display: block;
        width: 100%;
    }

    #abonos #abonosTable tbody tr {
        margin: 0 0 10px;
        background: var(--color-surface);
        border: 1px solid var(--color-card-border);
        border-radius: 10px;
        padding: 8px 10px 6px;
        box-shadow: var(--shadow-xs);
    }

    #abonos #abonosTable tbody tr:hover {
        background: var(--color-surface);
    }

    #abonos #abonosTable tbody tr td {
        padding: 4px 0;
        font-size: 11px;
        line-height: 1.35;
        border: 0;
        display: flex;
        gap: 6px;
        text-align: left;
    }

    #abonos #abonosTable tbody tr td::before {
        flex: 0 0 90px;
        font-weight: 600;
        color: var(--color-text-secondary);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: .5px;
        content: attr(data-label);
    }

    /* Acciones al final */
    #abonos #abonosTable tbody tr td:last-child {
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid var(--color-border);
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    #abonos #abonosTable tbody tr td:last-child::before {
        flex: 0 0 100%;
        margin-bottom: 2px;
    }

    #abonos #abonosTable tbody tr td:last-child .action-btn {
        background: var(--color-secondary);
        padding: 4px 8px;
        border-radius: 6px;
        font-size: 11px;
    }

    #abonos #abonosTable tbody tr td:last-child .action-btn:hover {
        background: var(--color-secondary-hover);
    }
}

/* ============================================================================
   SECCIÓN: PERFIL (#perfil)
   ============================================================================ */

.profile-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 1200px;
}

.profile-info-card,
.profile-password-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.profile-info-card h3,
.profile-password-card h3 {
    color: var(--color-charcoal-700);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-info-card h3 i,
.profile-password-card h3 i {
    color: var(--color-teal-500);
}

.profile-form .form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.profile-form .form-group {
    display: flex;
    flex-direction: column;
}

.profile-form label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-slate-900);
    margin-bottom: 0.5rem;
}

.profile-form input[type="text"],
.profile-form input[type="email"],
.profile-form input[type="password"] {
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    background-color: var(--color-white);
}

.profile-form input[type="text"]:focus,
.profile-form input[type="email"]:focus,
.profile-form input[type="password"]:focus {
    outline: none;
    border-color: var(--color-teal-500);
    box-shadow: 0 0 0 3px rgba(33, 128, 141, 0.1);
}

.profile-form input:disabled,
.profile-form input[readonly] {
    background-color: #f1f5f9;
    cursor: not-allowed;
    color: #64748b;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 3rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.password-toggle-btn:hover {
    color: var(--color-teal-500);
}

.password-toggle-btn i {
    font-size: 1rem;
}

.form-hint {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.25rem;
    display: block;
}

.profile-form .form-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.profile-form .form-actions .btn {
    min-width: 160px;
}

/* Sidebar link específico de perfil */
.sidebar-footer .nav-link-perfil {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #64748b;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.sidebar-footer .nav-link-perfil:hover {
    background-color: rgba(33, 128, 141, 0.1);
    color: var(--color-teal-500);
}

.sidebar-footer .nav-link-perfil.active {
    background-color: rgba(33, 128, 141, 0.1);
    color: var(--color-teal-500);
}

.sidebar-footer .nav-link-perfil i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    font-size: 1.125rem;
}

/* Responsive Perfil */
@media (min-width: 768px) {
    .profile-container {
        grid-template-columns: 1fr 1fr;
    }

    .profile-info-card {
        grid-column: 1 / -1;
    }

    .profile-password-card {
        grid-column: 1 / -1;
        max-width: 600px;
    }

    .profile-form .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================================
   SECCIÓN: LOGIN PAGE (Página Completa de Login)
   ============================================================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
    background: linear-gradient(120deg, #f5f7fa 0%, #e3ecfc 60%, #cbe7ff 100%);
    position: relative;
    overflow: hidden;
}

.background-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.decoration-element {
    position: absolute;
    border-radius: 50%;
    opacity: .1;
    background: linear-gradient(45deg, var(--color-teal-500), var(--color-primary));
}

.decoration-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: -5%;
    animation: float 6s ease-in-out infinite;
}

.decoration-2 {
    width: 150px;
    height: 150px;
    top: 70%;
    right: -5%;
    animation: float 8s ease-in-out infinite reverse;
}

.decoration-3 {
    width: 100px;
    height: 100px;
    top: 30%;
    right: 20%;
    animation: float 10s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    33% {
        transform: translateY(-20px) rotate(5deg);
    }

    66% {
        transform: translateY(10px) rotate(-3deg);
    }
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, .95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 10px 10px -5px rgba(0, 0, 0, .04);
    padding: var(--space-32);
    transition: transform var(--duration-normal) var(--ease-standard);
}

.login-card:hover {
    transform: translateY(-2px);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-32);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-12);
    margin-bottom: var(--space-16);
}

.logo-img {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .15));
}

.app-name {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    background: linear-gradient(135deg, #1e40af, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.tagline {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin: 0 0 var(--space-24) 0;
}

.login-title h2 {
    font-size: var(--font-size-2xl);
    color: var(--color-text);
    margin: 0 0 var(--space-8) 0;
}

.login-title p {
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-20);
}

.login-form .form-group {
    position: relative;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    padding: var(--space-16) var(--space-16) var(--space-16) 48px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-base);
    font-size: var(--font-size-md);
    background: var(--color-surface);
    color: var(--color-text);
    transition: all var(--duration-normal) var(--ease-standard);
    outline: none;
}

.form-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.form-input:focus+.form-label,
.form-input:not(:placeholder-shown)+.form-label,
.form-input.has-value+.form-label {
    transform: translateY(-28px) scale(.875);
    color: #2563eb;
    background: var(--color-surface);
    padding: 0 var(--space-4);
}

.login-form .form-label {
    position: absolute;
    left: 48px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    pointer-events: none;
    transition: all var(--duration-normal) var(--ease-standard);
    transform-origin: left center;
}

.input-icon {
    position: absolute;
    left: var(--space-12);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    pointer-events: none;
    z-index: 2;
}

.form-input:focus~.input-icon {
    color: #2563eb;
}

.validation-icon {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-standard);
}

.form-input.valid~.validation-icon::before {
    content: '✓';
    color: #059669;
    font-weight: bold;
    opacity: 1;
}

.form-input.invalid~.validation-icon::before {
    content: '✗';
    color: #dc2626;
    font-weight: bold;
    opacity: 1;
}

.form-input.valid~.validation-icon,
.form-input.invalid~.validation-icon {
    opacity: 1;
}

.password-toggle {
    position: absolute;
    right: var(--space-12);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-standard);
    z-index: 2;
}

.password-toggle:hover {
    color: var(--color-text);
    background: var(--color-secondary);
}

.password-toggle:focus {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

.password-toggle .eye-closed {
    display: none;
}

.password-toggle.active .eye-open {
    display: none;
}

.password-toggle.active .eye-closed {
    display: block;
}

.login-form .error-message {
    color: #dc2626;
    font-size: var(--font-size-sm);
    margin-top: var(--space-6);
    padding-left: var(--space-4);
    min-height: 20px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all var(--duration-normal) var(--ease-standard);
}

.login-form .error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.password-requirements {
    margin-top: var(--space-12);
    padding: var(--space-12);
    background: rgba(37, 99, 235, .05);
    border-radius: var(--radius-sm);
    border-left: 3px solid #2563eb;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--duration-normal) var(--ease-standard);
}

.password-requirements.show {
    opacity: 1;
    transform: translateY(0);
}

.requirement {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-6);
    font-size: var(--font-size-sm);
}

.requirement:last-child {
    margin-bottom: 0;
}

.requirement-icon {
    color: #dc2626;
    font-weight: bold;
    min-width: 16px;
    transition: color var(--duration-normal) var(--ease-standard);
}

.requirement.valid .requirement-icon {
    color: #059669;
    content: '✓';
}

.requirement-text {
    color: var(--color-text-secondary);
    transition: color var(--duration-normal) var(--ease-standard);
}

.requirement.valid .requirement-text {
    color: #059669;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: var(--space-4) 0;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all var(--duration-normal) var(--ease-standard);
}

.checkbox-container input[type="checkbox"]:checked~.checkmark {
    background: #2563eb;
    border-color: #2563eb;
}

.checkbox-container input[type="checkbox"]:checked~.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container:hover .checkmark {
    border-color: #2563eb;
}

.forgot-password {
    color: #1e40af;
    font-size: var(--font-size-sm);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: color var(--duration-fast) var(--ease-standard);
}

.forgot-password:hover {
    color: #2563eb;
}

.login-button {
    position: relative;
    background: linear-gradient(135deg, #1e40af, #2563eb);
    color: #fff;
    font-weight: var(--font-weight-semibold);
    padding: var(--space-16) var(--space-24);
    border-radius: var(--radius-base);
    border: none;
    font-size: var(--font-size-md);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-standard);
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-button:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, .3);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-text {
    transition: opacity var(--duration-normal) var(--ease-standard);
}

.login-button .loading-spinner {
    position: absolute;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-standard);
}

.login-button.loading .button-text {
    opacity: 0;
}

.login-button.loading .loading-spinner {
    opacity: 1;
}

.login-button .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spinLogin 1s linear infinite;
}

@keyframes spinLogin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.signup-link {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-16);
}

.signup-link a {
    color: #1e40af;
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: color var(--duration-fast) var(--ease-standard);
}

.signup-link a:hover {
    color: #2563eb;
}

.message-container {
    position: fixed;
    top: var(--space-20);
    right: var(--space-20);
    z-index: 1000;
    max-width: 400px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: var(--space-12);
    padding: var(--space-16);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--duration-normal) var(--ease-standard);
    margin-bottom: var(--space-8);
}

.message.show {
    transform: translateX(0);
    opacity: 1;
}

.success-message {
    background: rgba(5, 150, 105, .1);
    border: 1px solid rgba(5, 150, 105, .2);
    color: #059669;
}

.login-form .error-message {
    background: rgba(220, 38, 38, .1);
    border: 1px solid rgba(220, 38, 38, .2);
    color: #dc2626;
}

.message-icon {
    flex-shrink: 0;
    margin-top: var(--space-2);
}

.message-content h3 {
    margin: 0 0 var(--space-4) 0;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
}

.message-content p {
    margin: 0;
    font-size: var(--font-size-sm);
    opacity: .9;
}

/* Inline alerts para login */
.inline-alert {
    margin: 12px 0 4px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: .92rem;
    line-height: 1.35;
    border: 1px solid transparent;
}

.inline-alert--error {
    background: #fff4f4;
    border-color: #e02e2e;
    color: #a60000;
}

.inline-alert--info {
    background: #f0f6ff;
    border-color: #1d6fdc;
    color: #0b417d;
}

.inline-alert__list {
    margin: 0;
    padding-left: 18px;
}

.inline-alert__list li {
    margin: 2px 0;
}

/* Login responsive */
@media (max-width: 768px) {
    .login-container {
        padding: var(--space-12);
    }

    .login-card {
        padding: var(--space-24);
        max-width: 100%;
    }

    .app-name {
        font-size: var(--font-size-2xl);
    }

    .login-title h2 {
        font-size: var(--font-size-xl);
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-12);
    }

    .message-container {
        top: var(--space-12);
        right: var(--space-12);
        left: var(--space-12);
        max-width: none;
    }

    .decoration-1,
    .decoration-2,
    .decoration-3 {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: var(--space-20);
    }

    .logo-container {
        flex-direction: column;
        gap: var(--space-8);
    }

    .logo-img {
        width: 80px;
        height: 80px;
    }

    .app-name {
        font-size: var(--font-size-xl);
    }

    .form-input {
        padding: var(--space-12) var(--space-12) var(--space-12) 44px;
    }

    .login-form .form-label {
        left: 44px;
    }

    .input-icon {
        left: var(--space-10);
    }
}

@media (min-width: 1024px) {
    .login-container {
        background: linear-gradient(120deg, #f5f7fa 0%, #e3ecfc 60%, #cbe7ff 100%);
    }

    .login-card {
        max-width: 440px;
        padding: var(--space-32) 40px;
    }
}

body.login-action-lostpassword .login>.notice,
body.login-action-retrievepassword .login>.notice,
body.login-action-lostpassword #login_error,
body.login-action-retrievepassword #login_error {
    display: none !important;
}