/* Paleta CESCA — tomada de AgenciaVirtual (logo real + plantillas HTML de CONFIGURACION_PLANTILLAS) */
:root {
    --rojo:         #A30000;
    --rojo-oscuro:  #7A0000;
    --verde:        #009742;
    --verde-oscuro: #007A35;
    --azul-marino:  #1B2A4A;
    --morado:       #6A1B9A;
    --bg:           #F5F7FA;
    --surface:      #fff;
    --text:         #333333;
    --text-muted:   #757575;
    --border:       #E0E0E0;
    --error:        #D32F2F;
    --success:      #009742;
    --radius:       10px;
    --shadow:       0 4px 24px rgba(0,0,0,.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--rojo); }

.av-barra-superior {
    height: 14px;
    background: var(--rojo);
}

.av-footer {
    background: var(--rojo);
    color: #fff;
    padding: 2px 0;
    font-size: .75rem;
    text-align: center;
}

.av-footer-diag {
    background: #4a4a4a;
    color: #ddd;
    font-size: .72rem;
    padding: 6px 16px;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

/* Tablas responsivas: en pantallas angostas cada fila se vuelve tarjeta apilada */
table.resp-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}
table.resp-table thead th {
    background: #F0F0F0;
    text-align: left;
    padding: 10px 12px;
    font-size: .85rem;
    color: var(--text-muted);
    font-weight: 600;
}
table.resp-table tbody td {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    font-size: .9rem;
}
table.resp-table tbody tr {
    background: #fff;
}
table.resp-table tbody tr:nth-child(even) {
    background: #EFEFEF;
}
table.resp-table tbody tr:hover {
    background: #FFF0F2;
}
@media (max-width: 600px) {
    table.resp-table thead { display: none; }
    table.resp-table, table.resp-table tbody, table.resp-table tr, table.resp-table td {
        display: block; width: 100%;
    }
    table.resp-table tr {
        margin-bottom: 10px;
        border: 1px solid var(--border);
        border-radius: 8px;
        overflow: hidden;
    }
    table.resp-table td {
        border-top: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        gap: 8px;
    }
    table.resp-table td:last-child { border-bottom: none; }
    table.resp-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-right: 8px;
    }
}

/* Estado de Cuenta: nueve columnas compactas, con los valores alineados a la derecha.
   Se vuelve tarjetas antes que las demás tablas porque por debajo de 900px ya no cabe. */
@media (min-width: 901px) {
    table.resp-table-extracto thead th, table.resp-table-extracto tbody td {
        padding: 9px 8px;
        font-size: .85rem;
    }
    table.resp-table-extracto thead th:nth-child(n+5), table.resp-table-extracto tbody td:nth-child(n+5) {
        text-align: right;
        white-space: nowrap;
    }
}
@media (max-width: 900px) {
    table.resp-table-extracto thead { display: none; }
    table.resp-table-extracto, table.resp-table-extracto tbody, table.resp-table-extracto tr, table.resp-table-extracto td {
        display: block; width: 100%;
    }
    table.resp-table-extracto tr {
        margin-bottom: 10px;
        border: 1px solid var(--border);
        border-radius: 8px;
        overflow: hidden;
    }
    table.resp-table-extracto td {
        border-top: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        gap: 8px;
    }
    table.resp-table-extracto td:last-child { border-bottom: none; }
    table.resp-table-extracto td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-right: 8px;
    }
}

/* Paginación de tablas largas (tablaPaginada en dashboard.js) */
.av-paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 0 4px;
}
.av-pagina-btn {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--rojo);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.av-pagina-btn:hover:not(:disabled) {
    background: #FFF0F2;
}
.av-pagina-btn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: .6;
}
.av-pagina-info {
    font-size: .85rem;
    color: var(--text-muted);
}
@media (max-width: 600px) {
    .av-pagina-btn {
        flex: 1 1 auto;
        min-width: 44px;
        padding: 10px 14px;
    }
    .av-pagina-info {
        order: -1;
        width: 100%;
        text-align: center;
    }
}

/* Encabezado de solo lectura de "Estado de Cuenta" (Identificación / Fecha de ingreso / Nombre) */
.av-form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.av-form-field label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.av-form-field input:disabled {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #F5F5F5;
    color: #444;
    font-size: .9rem;
    box-sizing: border-box;
    cursor: default;
}
/* Botón "Descargar PDF" del Estado de Cuenta: rojo sólido para que resalte en la página */
.av-btn-imprimir {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    flex-shrink: 0;
    border: none;
    border-radius: 6px;
    background: var(--rojo);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(163, 0, 0, .35);
    transition: background .2s, transform .15s, box-shadow .2s;
}
.av-btn-imprimir svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.av-btn-imprimir:hover {
    background: var(--rojo-oscuro);
    box-shadow: 0 4px 12px rgba(163, 0, 0, .45);
    transform: translateY(-1px);
}
.av-btn-imprimir:focus-visible {
    outline: 3px solid rgba(163, 0, 0, .35);
    outline-offset: 2px;
}
@media (max-width: 600px) {
    /* En celular solo el ícono, para no apretar el campo de fecha */
    .av-btn-imprimir { width: 42px; padding: 0; }
    .av-btn-imprimir span { display: none; }
}
@media (max-width: 600px) {
    .av-form-row {
        flex-direction: column;
        gap: 12px;
    }
}

/* Grilla de campos de "Actualización de Datos" — a ancho completo, igual que en SiiwcesNew.
   auto-fit/minmax en vez de columnas fijas por breakpoint: cada columna nunca baja de 210px,
   así que el número de columnas se ajusta solo al ancho real disponible (4 en escritorio,
   menos en tablet, 1 sola en celular) sin depender de adivinar un umbral exacto. */
.avd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px 24px;
}

/* Pestañas numeradas de "Actualización de Datos" — en celular el círculo pasa arriba
   de la etiqueta para que las 3 quepan cómodas en el ancho disponible. */
.avd-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 6px;
    border: none;
    background: none;
    cursor: pointer;
}
.avd-tab-circulo {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
}
.avd-tab-label {
    font-size: .9rem;
}
@media (max-width: 600px) {
    .avd-tab-btn {
        flex-direction: column;
        gap: 4px;
        padding: 8px 2px;
    }
    .avd-tab-label {
        font-size: .68rem;
        text-align: center;
        line-height: 1.15;
    }
}

/* Botones Guardar/Anterior — ancho completo y apilados en celular para tocar más fácil */
.avd-botones {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}
.avd-btn-accion {
    width: auto;
    padding: .6rem 1.2rem;
}
@media (max-width: 600px) {
    .avd-botones {
        flex-direction: column;
    }
    .avd-btn-accion {
        width: 100%;
    }
}
