:root { font-family: system-ui, sans-serif; color: #152738; background: #f1f5f8; }
* { box-sizing: border-box; }
body { margin: 0; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1rem max(1rem, 4vw); background: #10344a; color: white; }
header strong { font-size: 1.35rem; }
nav { display: flex; gap: .35rem; flex-wrap: wrap; flex: 1; }
nav a { color: #e5f1f7; text-decoration: none; padding: .5rem .7rem; border-radius: .4rem; }
nav a[aria-current] { background: #256581; }
main { max-width: 1550px; margin: auto; padding: 1rem max(1rem, 3vw) 3rem; }
h1 { font-size: clamp(1.7rem,4vw,2.5rem); margin-block: .65em; }
h2 { font-size: 1.24rem; }
details, section, article, .picker { background: white; padding: 1rem; border: 1px solid #d7e2e9; border-radius: .65rem; margin-block: .7rem; }
summary { cursor: pointer; font-weight: 650; }
details form { margin-top: 1rem; }
form { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; }
label { display: grid; gap: .3rem; font-size: .9rem; min-width: min(12rem,100%); flex: 1; }
input, select, button { font: inherit; border: 1px solid #9eb4c2; border-radius: .4rem; padding: .55rem; min-width: 0; }
button { cursor: pointer; border-color: #075b5d; background: #075b5d; color: white; }
button.secondary { background: white; color: #16465c; }
.table { overflow: auto; max-height: 58vh; margin-block: .8rem; border: 1px solid #d7e2e9; border-radius: .5rem; }
table { border-spacing: 0; width: 100%; font-size: .875rem; background: white; }
th, td { text-align: left; white-space: nowrap; padding: .7rem; border-bottom: 1px solid #e4edf2; }
th { position: sticky; top: 0; background: #174660; color: white; }
tbody tr:nth-child(even) { background: #f5f8fa; }
td a { color: #075b5d; }
.error, .notice { padding: .8rem; border-radius: .4rem; }
.error { background: #ffe3df; color: #7a2015; }
.notice { background: #d8f2e8; color: #104d3b; }
.login { max-width: 30rem; margin: 3rem auto; }
.login form { display: grid; }
article { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }

td.concepto {
    min-width: 14rem;
    max-width: 36rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

td.cruces { white-space: pre-line; }
td.estado-conciliado { color: #156341; font-weight: 700; }
td.estado-parcial { color: #825000; font-weight: 700; }
td.estado-pendiente { color: #495d6e; }

.cruce-compacto { padding: .45rem .7rem; margin: .3rem 0; gap: .45rem .8rem; }
.cruce-compacto p { margin: .2rem 0; }
.detalle-cruce { margin: 0; padding: .35rem .6rem; max-width: 100%; }
.detalle-cruce form { margin-top: .65rem; }
.filtro-cruces { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; padding-bottom: .55rem; }
.paginacion-cruces { align-items: center; gap: .75rem; margin-top: .6rem; }
.paginacion-cruces a { color: #184760; text-decoration: underline; }

#historial { padding: .75rem; }
#historial h2 { margin: 0 0 .5rem; }
.filtros-historial { gap: .4rem .75rem; margin-bottom: .5rem; }
.filtros-historial > label:first-of-type { flex: 0 1 19rem; }
.filtros-historial .filtro-cruces { min-width: 0; }
.filtros-historial input[type="checkbox"] { margin: 0; }
.cruce-compacto { justify-content: flex-start; border: 0; border-bottom: 1px solid #d7e2e9; border-radius: 0; margin: 0; padding: .28rem .2rem; font-size: .9rem; }
.cruce-compacto > p { flex: 1 1 15rem; }
.abrir-cruce { margin-left: auto; padding: .25rem .45rem; }
.ventana-cruce { width: min(29rem, calc(100% - 1.5rem)); max-height: 80vh; overflow: auto; padding: 1rem; border: 1px solid #9eb4c2; border-radius: .7rem; background: #fff; color: #173b4f; box-shadow: 0 12px 42px #142d4850; overflow-wrap: anywhere; }
.ventana-cruce::backdrop { background: #142d4840; }
.cabecera-cruce { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.cabecera-cruce h3 { margin: 0; }
.ventana-cruce p, .ventana-cruce form { margin: .65rem 0 0; }

#resumen-cliente {
    box-sizing: border-box;
    width: calc(100% - 2rem);
    height: calc(100vh - 2rem);
    height: calc(100dvh - 2rem);
    max-width: none;
    max-height: none;
}
#resumen-cliente .table:last-child { max-height: none; }
#resumen-cliente th { white-space: normal; }
#resumen-cliente th,
#resumen-cliente td { padding: .55rem .6rem; }
#resumen-cliente td.concepto,
#resumen-cliente .table:last-child td:nth-child(5) {
    min-width: 0;
    max-width: 18rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    #resumen-cliente {
        width: calc(100% - .75rem);
        height: calc(100dvh - .75rem);
        padding: .7rem;
    }
}
#resumen-cliente .cabecera-cruce h2 { margin: 0 0 .75rem; }

td.importe-negativo { color: #b42318; font-weight: 600; }
