/* ════════════════════════════════════════════════════════════════════
   137-aprobaciones.css — MOD-137 APROBACIONES (OMN-357, 4.15.x)
   Pestañas por área, Overview, tarjetas compactas, Archivo tipo hoja de
   cálculo y el modal de detalle (#mo-aprob-det). Todo con prefijo `apr-` y
   sólo con las variables del tema de app.css (§5: una variable que no existe
   invalida la declaración sin dar error).
   ════════════════════════════════════════════════════════════════════ */

#page-aprobaciones { padding: 0; }
/* La raíz es `.apr-root` y no `.apr`: el PDF de WAREX ya usa `.aut.apr` dentro del DOM de la app. */
.apr-root { padding: 18px 24px 28px; max-width: 1480px; margin: 0 auto; }

/* ── cabecera ─────────────────────────────────────────────────────── */
.apr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.apr-head > i { color: var(--turq); font-size: 17px; }
.apr-head h2 { margin: 0; font-size: 14px; font-weight: 900; letter-spacing: .05em; color: var(--text); }
.apr-head-sub { font-size: 10px; letter-spacing: .08em; color: var(--dim); }
.apr-head .apr-act { margin-left: auto; padding: 4px 10px; font-size: 9px; }

/* ── pestañas ─────────────────────────────────────────────────────── */
.apr-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.apr-tab {
    background: none; border: none; border-bottom: 2px solid transparent; color: var(--dim);
    padding: 8px 12px; font: inherit; font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
    cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.apr-tab:hover { color: var(--text); }
.apr-tab.active { color: var(--turq); border-bottom-color: var(--turq); }
.apr-tab-n {
    min-width: 16px; padding: 0 5px; border-radius: 8px; background: var(--bg3); color: var(--text);
    font-size: 9px; line-height: 16px; text-align: center;
}
.apr-tab.active .apr-tab-n { background: var(--turq); color: var(--bg); }

/* ── avisos ───────────────────────────────────────────────────────── */
.apr-error, .apr-aviso {
    border: 1px solid var(--red); border-radius: 6px; padding: 8px 12px; margin-bottom: 10px;
    font-size: 11px; color: var(--red); font-weight: 700;
}
.apr-error span { font-weight: 400; text-transform: none; }
.apr-aviso { border-color: var(--yellow); color: var(--yellow); font-weight: 400; text-transform: none; }
.apr-vacio { border: 1px dashed var(--border); border-radius: 8px; padding: 30px; text-align: center; color: var(--dim); font-size: 11px; letter-spacing: .05em; }
.apr-vacio i { color: var(--turq); margin-right: 6px; }
.apr-sec { font-size: 9.5px; font-weight: 900; letter-spacing: .1em; color: var(--dim); margin: 18px 0 8px; }

/* ── Overview: una ficha por área ─────────────────────────────────── */
.apr-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.apr-kpi {
    text-align: left; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; cursor: pointer; font: inherit; color: var(--text);
    display: flex; flex-direction: column; gap: 2px;
}
.apr-kpi:hover { border-color: var(--turq); }
.apr-kpi.cero { opacity: .55; }
.apr-kpi-lbl { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; color: var(--dim); }
.apr-kpi-lbl i { color: var(--turq); margin-right: 3px; }
.apr-kpi-n { font-size: 24px; font-weight: 900; line-height: 1.1; }
.apr-kpi-sub { font-size: 10px; color: var(--dim); text-transform: none; }
.apr-kpi-monto { font-size: 10.5px; font-weight: 800; color: var(--green); }

/* ── tarjeta compacta ─────────────────────────────────────────────── */
.apr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.apr-card {
    position: relative; text-align: left; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 10px; cursor: pointer; font: inherit; color: var(--text);
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.apr-card:hover, .apr-card:focus-visible { border-color: var(--turq); outline: none; }
.apr-card-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.apr-card-tipo { font-size: 9px; font-weight: 900; letter-spacing: .06em; color: var(--turq); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apr-card-edad { margin-left: auto; font-size: 9px; color: var(--dim); white-space: nowrap; text-transform: none; }
.apr-card-main { font-size: 12px; font-weight: 700; text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apr-card-sub { font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apr-card-pie { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.apr-card-monto { font-size: 11px; font-weight: 800; color: var(--green); }
.apr-card-alerta { font-size: 9px; font-weight: 900; letter-spacing: .05em; color: var(--red); white-space: nowrap; }
.apr-card-lock { position: absolute; right: 9px; bottom: 7px; font-size: 10px; color: var(--yellow); }

/* ── estado (chip) ────────────────────────────────────────────────── */
.apr-est { font-size: 9px; font-weight: 900; letter-spacing: .06em; padding: 2px 7px; border-radius: 9px; border: 1px solid var(--border); color: var(--dim); white-space: nowrap; }
.apr-est.ok { color: var(--green); border-color: var(--green); }
.apr-est.no { color: var(--red); border-color: var(--red); }
.apr-est.pend { color: var(--yellow); border-color: var(--yellow); }

/* ── Archivo: filtros y hoja de cálculo ───────────────────────────── */
.apr-fil { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.apr-fil .fc { width: auto; min-width: 0; padding: 4px 8px; font-size: 10.5px; height: 28px; }
.apr-fil input[type="search"] { flex: 1 1 220px; }
.apr-fil select { flex: 0 1 140px; }
.apr-fil .apr-fil-monto { flex: 0 1 110px; }
.apr-fil .ibtn { padding: 4px 10px; font-size: 9.5px; height: 28px; }
.apr-tabla-meta { font-size: 10px; color: var(--dim); margin: 0 0 6px; text-transform: none; }
.apr-tabla-meta b { color: var(--yellow); }
.apr-tabla-wrap { border: 1px solid var(--border); border-radius: 6px; overflow: auto; }
/* En escritorio la tabla tiene su propio scroll con la cabecera fija; en pantallas
   angostas los filtros se apilan y un segundo scroll dentro del de la página estorba. */
@media (min-width: 900px) { .apr-tabla-wrap { max-height: calc(100vh - 290px); } }
.apr-tabla { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.apr-tabla th {
    position: sticky; top: 0; z-index: 1; background: var(--bg3); color: var(--dim);
    font-size: 9px; font-weight: 900; letter-spacing: .07em; text-align: left;
    padding: 5px 6px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.apr-tabla th.ord { cursor: pointer; }
.apr-tabla th.ord:hover { color: var(--text); }
.apr-tabla td { font-size: 10.5px; padding: 3px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; height: 22px; }
.apr-tabla td.txt { text-transform: none; }
/* En una tabla de ancho automático el `max-width` de la celda no limita nada:
   lo limita un hijo en bloque con su propio ancho máximo. */
.apr-cel { display: inline-block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.apr-cel.tipo { max-width: 180px; }
.apr-cel.com { max-width: 160px; }
.apr-tabla td.num { font-variant-numeric: tabular-nums; }
.apr-tabla td.apr-com { color: var(--dim); }
.apr-tabla tbody tr { cursor: pointer; }
.apr-tabla tbody tr:hover td { background: var(--bg2); }
.apr-tabla .apr-est { font-size: 8.5px; padding: 1px 6px; }
.apr-tabla td.apr-tabla-vacia { text-align: center; color: var(--dim); padding: 20px; cursor: default; }

/* ── modal de detalle ─────────────────────────────────────────────── */
#mo-aprob-det .apr-mo { max-width: 620px; }
#mo-aprob-det .mo-head h3 { flex: 1; margin: 0; font-size: 12.5px; letter-spacing: .05em; }
.apr-det-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; margin-bottom: 10px; }
.apr-det-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.apr-det-f span { font-size: 9px; letter-spacing: .08em; color: var(--dim); }
.apr-det-f b { font-size: 11.5px; font-weight: 700; text-transform: none; overflow-wrap: anywhere; }
.apr-det-f a { color: var(--turq); text-decoration: none; }
.apr-det-monto { color: var(--green); font-weight: 900; }
.apr-det-falta { color: var(--red); }
.apr-det-texto { font-size: 11.5px; line-height: 1.5; text-transform: none; white-space: pre-wrap; background: var(--bg3); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.apr-det-adj { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.apr-det-adj img { width: 54px; height: 54px; object-fit: cover; border: 1px solid var(--border); border-radius: 4px; }
.apr-det-adj .ibtn { padding: 3px 8px; font-size: 9.5px; }
.apr-det-aviso, .apr-det-lock { border: 1px solid var(--yellow); color: var(--yellow); border-radius: 6px; padding: 8px 10px; font-size: 11px; margin-bottom: 10px; text-transform: none; }
.apr-det-dec { border-left: 3px solid var(--border); background: var(--bg3); padding: 8px 10px; margin-bottom: 10px; font-size: 10px; letter-spacing: .05em; color: var(--dim); }
.apr-det-dec.ok { border-left-color: var(--green); }
.apr-det-dec.no { border-left-color: var(--red); }
.apr-det-dec p { margin: 4px 0 0; font-size: 11.5px; color: var(--text); text-transform: none; letter-spacing: 0; }
.apr-det-com { display: flex; flex-direction: column; gap: 4px; }
.apr-det-com span { font-size: 9px; letter-spacing: .08em; color: var(--dim); }
#mo-aprob-det .mo-foot .apr-izq { margin-right: auto; }
#mo-aprob-det .mo-foot .apr-acc-borrar { color: var(--red); }
