* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #2c3e50;
    line-height: 1.5;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

header {
    background: #1f4e78;
    color: #fff;
    padding: 22px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
header h1 { font-size: 22px; }
header .sub { font-size: 13px; opacity: 0.85; margin-top: 4px; }

main { padding: 30px 0 60px; }

footer {
    background: #eaeef2;
    padding: 14px 0;
    text-align: center;
    color: #6a7684;
    font-size: 12px;
}

/* Formulario */
.form-carga {
    background: #fff;
    padding: 28px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.intro { margin-bottom: 22px; color: #4a5966; }

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

.file {
    display: block;
    padding: 16px;
    border: 1.5px dashed #c5d0dd;
    border-radius: 6px;
    background: #fafbfd;
    transition: border-color 0.2s;
}
.file:hover { border-color: #1f4e78; }
.file .label { display: block; font-weight: 600; color: #1f4e78; margin-bottom: 4px; font-size: 14px; }
.file .hint  { display: block; color: #7a8899; font-size: 12px; margin-bottom: 10px; }
.file input[type="file"] { font-size: 13px; }

.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
}
.btn-primary { background: #1f4e78; color: #fff; }
.btn-primary:hover { background: #163b5c; }
.btn-secondary { background: #eaeef2; color: #2c3e50; margin-right: 10px; }
.btn-secondary:hover { background: #d8dee6; }
.btn-conciliar { width: 100%; padding: 14px; font-size: 16px; }

/* Reporte */
.reporte { background: #fff; padding: 28px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.reporte h2 { color: #1f4e78; margin-bottom: 6px; }
.reporte h3 { color: #1f4e78; margin: 26px 0 12px; font-size: 17px; border-bottom: 2px solid #eaeef2; padding-bottom: 6px; }
.reporte .meta { color: #6a7684; font-size: 13px; margin-bottom: 20px; }

table.tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 10px;
}
table.tabla th {
    background: #d9e1f2;
    color: #1f4e78;
    padding: 10px 8px;
    text-align: left;
    font-weight: 700;
    border: 1px solid #c5d0dd;
}
table.tabla td {
    padding: 8px;
    border: 1px solid #e5ebf1;
    vertical-align: middle;
}
table.tabla td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tabla td.strong { font-weight: 700; }
table.tabla td.cta   { background: #f4f6f8; font-weight: 600; vertical-align: middle; }
table.tabla tr.diff td.strong { color: #b03030; }
table.tabla tr.ok   td.strong { color: #2d7a3e; }

/* Diagnósticos */
.diags { display: flex; flex-direction: column; gap: 12px; }
.diag {
    border-left: 4px solid #c5d0dd;
    padding: 14px 18px;
    background: #fafbfd;
    border-radius: 4px;
}
.diag-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.diag .sev {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}
.diag.sev-alta   { border-left-color: #b03030; }
.diag.sev-alta   .sev { background: #b03030; }
.diag.sev-media  { border-left-color: #d68b1a; }
.diag.sev-media  .sev { background: #d68b1a; }
.diag.sev-info   { border-left-color: #2d7a3e; }
.diag.sev-info   .sev { background: #2d7a3e; }
.diag .titulo { font-weight: 700; color: #1f4e78; }
.diag .desc { margin: 4px 0; color: #4a5966; font-size: 13px; }
.diag .reco { color: #2c3e50; font-size: 13px; }

.actions { margin-top: 24px; text-align: right; }

.error {
    background: #fce4e4;
    color: #7a1e1e;
    padding: 24px;
    border-radius: 6px;
    border-left: 4px solid #b03030;
}
.error h2 { margin-bottom: 10px; color: #7a1e1e; }
.error a  { color: #1f4e78; }

/* ============ NUEVOS COMPONENTES v2 ============ */

/* Navegación */
.nav { margin-top: 12px; display: flex; gap: 20px; }
.nav a {
    color: #cbd8e5;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.nav a:hover { color: #fff; }
.nav a.active { color: #fff; border-bottom-color: #fff; }

/* Dashboard de estado del proceso mensual */
.dashboard {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 5px solid #c5d0dd;
}
.dashboard.ok       { border-left-color: #2d7a3e; background: #f0f8f2; }
.dashboard.pending  { border-left-color: #d68b1a; background: #fff8ec; }
.dashboard.overdue  { border-left-color: #b03030; background: #fce4e4; }
.dashboard-icon {
    font-size: 40px;
    line-height: 1;
    width: 60px;
    text-align: center;
}
.dashboard.ok      .dashboard-icon { color: #2d7a3e; }
.dashboard.pending .dashboard-icon { color: #d68b1a; }
.dashboard.overdue .dashboard-icon { color: #b03030; }
.dashboard-body h2 { color: #1f4e78; font-size: 18px; margin-bottom: 6px; }
.dashboard-body p  { color: #4a5966; font-size: 14px; }
.dashboard-body a  { color: #1f4e78; }

/* Selector de periodo */
.periodo-selector {
    margin-bottom: 20px;
    background: #f4f6f8;
}
.periodo-selector select {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #c5d0dd;
    border-radius: 4px;
    background: #fff;
    color: #2c3e50;
    cursor: pointer;
}
.periodo-selector select:focus { border-color: #1f4e78; outline: none; }

/* Detalle header */
.detalle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.detalle-header h2 { color: #1f4e78; font-size: 18px; }
.detalle-header .meta { color: #6a7684; font-size: 13px; margin-top: 4px; }

/* Badges */
.badge-current, .badge-old {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.badge-current { background: #2d7a3e; color: #fff; }
.badge-old     { background: #c5d0dd; color: #4a5966; }

/* Listado */
.listado {
    background: #fff;
    padding: 28px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.listado h2 { color: #1f4e78; margin-bottom: 8px; }
.listado .intro { color: #4a5966; margin-bottom: 20px; font-size: 14px; }
.listado .empty { color: #7a8899; text-align: center; padding: 40px 0; font-style: italic; }
.listado-tabla { font-size: 13px; }
.listado-tabla tr.grupo-nuevo { border-top: 2px solid #1f4e78; }
.listado-tabla td.resumen { white-space: pre-line; color: #4a5966; font-size: 12px; max-width: 400px; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* Nota informativa */
.nota {
    background: #fff8ec;
    border-left: 3px solid #d68b1a;
    padding: 10px 14px;
    font-size: 13px;
    color: #6a5324;
    margin-bottom: 14px;
    border-radius: 3px;
}

td.hint { color: #7a8899; font-size: 11px; font-style: italic; }

/* ============ V3: cruce por cuenta al estilo del funcionario ============ */
.cuenta-bloque { margin-bottom: 22px; }
.cuenta-tabla { font-size: 14px; }
.cuenta-tabla .cabecera-cuenta th {
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    background: #eaeef2;
    border: 1px solid #c5d0dd;
}
.cuenta-tabla .cabecera-acueducto       th { background: #fff2cc; }
.cuenta-tabla .cabecera-alcantarillado  th { background: #dceffb; }
.cuenta-tabla .cabecera-complementarios th { background: #e2efda; }
.cuenta-tabla th.num, .cuenta-tabla td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cuenta-tabla tr.diff td.strong { color: #b03030; }
.cuenta-tabla tr.ok   td.strong { color: #2d7a3e; }

/* Botón peligroso + aviso */
.btn-danger {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    background: #b03030;
    color: #fff;
}
.btn-danger:hover { background: #8b1e1e; }
.btn-danger.btn-sm { padding: 4px 12px; font-size: 12px; }
td.acciones { white-space: nowrap; }
td.acciones form { margin-left: 4px; }
.aviso {
    background: #e2efda;
    color: #2d7a3e;
    border-left: 4px solid #2d7a3e;
    padding: 12px 18px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Diferencia secundaria (TOTAL AUX vs roll-forward) */
.dif-secundaria {
    display: block;
    font-size: 11px;
    color: #6a7684;
    font-weight: normal;
    margin-top: 3px;
    font-style: italic;
}

/* v9: Desglose arrastre vs nuevo del mes */
.desglose-arrastre {
    display: block;
    font-size: 11px;
    font-weight: normal;
    color: #6a7684;
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px dashed #d0d7de;
    line-height: 1.6;
}
.desglose-arrastre .delta-nuevo {
    color: #b03030;
    font-weight: 600;
}
.desglose-arrastre .delta-cero {
    color: #2d7a3e;
    font-weight: 600;
}
