/* ============================================================================
   Módulo ACTIVO FIJO — prefijo .af-
   Un CSS por módulo (estrategia del repo). Usa las variables corporativas
   globales; no hardcodea los azules salvo como fallback.
   ========================================================================= */

.af-page {
    padding: 18px 20px 40px;
    color: #1b2433;
}

/* ── Encabezado ─────────────────────────────────────────────────────────── */
.af-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    padding-bottom: 14px;
    border-bottom: 3px solid var(--primario, #1e3a5f);
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.af-head__title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primario, #1e3a5f);
}

.af-head__sub {
    margin: 6px 0 0;
    max-width: 78ch;
    font-size: .9rem;
    color: #4a566b;
    line-height: 1.45;
}

.af-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Botones ────────────────────────────────────────────────────────────── */
.af-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: .45rem .9rem;
    border: 1px solid #d9dfe9;
    border-radius: 5px;
    background: #fff;
    color: #2c5282;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.af-btn:hover:not(:disabled) { background: #eef2f8; border-color: #b9c3d3; }
.af-btn:disabled { opacity: .55; cursor: not-allowed; }
.af-btn--chico { padding: .28rem .6rem; font-size: .8rem; }
.af-btn--primary { background: var(--primario, #1e3a5f); border-color: var(--primario, #1e3a5f); color: #fff; }
.af-btn--primary:hover:not(:disabled) { background: #2c5282; border-color: #2c5282; }
.af-btn--exito { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.af-btn--exito:hover:not(:disabled) { background: #276b2a; }
.af-btn--peligro { background: #c62828; border-color: #c62828; color: #fff; }
.af-btn--peligro:hover:not(:disabled) { background: #ad2020; }

.af-icon {
    border: 0;
    background: transparent;
    color: #7a869b;
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 4px;
}
.af-icon:hover { background: #eef2f8; color: #1e3a5f; }

/* ── Pestañas ───────────────────────────────────────────────────────────── */
.af-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e0e4ec; margin-bottom: 16px; flex-wrap: wrap; }
.af-tab {
    border: 0;
    background: transparent;
    padding: .55rem 1rem;
    font-size: .9rem;
    color: #4a566b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.af-tab:hover { color: #1e3a5f; }
.af-tab--on { color: var(--primario, #1e3a5f); font-weight: 600; border-bottom-color: var(--secundario, #d4af37); }
.af-tabs--chico { margin-top: 16px; }

/* ── Tarjetas ───────────────────────────────────────────────────────────── */
.af-card {
    background: #fff;
    border: 1px solid #e0e4ec;
    border-radius: 6px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(20,35,60,.05);
}
.af-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: .8rem 1rem;
    border-bottom: 1px solid #e0e4ec;
    flex-wrap: wrap;
}
.af-card__head h2 { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--primario, #1e3a5f); }

/* ── KPIs ───────────────────────────────────────────────────────────────── */
.af-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.af-kpi {
    background: #fff;
    border: 1px solid #e0e4ec;
    border-left: 4px solid #b9c3d3;
    border-radius: 5px;
    padding: .7rem .9rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.af-kpi__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #7a869b; }
.af-kpi__valor { font-size: 1.25rem; font-weight: 700; color: #1b2433; font-variant-numeric: tabular-nums; }
.af-kpi--acento { border-left-color: var(--secundario, #fe7800); }
.af-kpi--contable { border-left-color: #2c5282; }
.af-kpi--tributario { border-left-color: #d4af37; }

/* ── Filtros y periodo ──────────────────────────────────────────────────── */
.af-filtros, .af-periodo {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: .8rem;
    background: #f5f7fb;
    border: 1px solid #e0e4ec;
    border-radius: 6px;
}
.af-filtro-texto { min-width: 280px; flex: 1 1 280px; }
.af-periodo .af-field { min-width: 120px; }
.af-check { display: flex; align-items: center; gap: 6px; font-size: .87rem; color: #4a566b; margin: 0 0 .35rem; }
.af-select-chico { width: 80px; }

/* ── Formularios ────────────────────────────────────────────────────────── */
.af-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.af-field { display: flex; flex-direction: column; gap: 4px; }
.af-field--wide { grid-column: 1 / -1; }
.af-field label { font-size: .8rem; font-weight: 600; color: #4a566b; }
.af-inline { display: flex; gap: 6px; }
.af-inline .form-control { flex: 1; }
.af-sub { margin: 18px 0 4px; font-size: .95rem; color: var(--primario, #1e3a5f); }
.af-hint { font-size: .85rem; color: #7a869b; margin: 0 0 10px; max-width: 78ch; line-height: 1.45; }
.af-hint-inline { font-size: .75rem; color: #7a869b; }
.af-acciones-pie { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 0 0; }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.af-tabla-wrap { overflow-x: auto; }
.af-tabla { width: 100%; border-collapse: collapse; font-size: .87rem; }
.af-tabla thead th {
    background: #eef2f8;
    color: #2c5282;
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: left;
    padding: .55rem .7rem;
    border-bottom: 2px solid #b9c3d3;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
.af-tabla tbody td { padding: .5rem .7rem; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
.af-tabla tbody tr:nth-child(even) td { background: #fafbfd; }
.af-tabla tbody tr:hover td { background: #eef2f8; }
.af-tabla--chica { font-size: .82rem; }
.af-num, th.af-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.af-num--fuerte { font-weight: 700; }
.af-num--dif { color: #c62828; font-weight: 600; }
.af-mono { font-family: Consolas, "Courier New", monospace; font-size: .84rem; white-space: nowrap; }
.af-td-largo { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-nota-celda { color: #7a869b; font-size: .8rem; }
.af-acciones { white-space: nowrap; display: flex; gap: 4px; }
.af-fila-click { cursor: pointer; }
.af-fila--alerta td { background: #fdebd9 !important; }
.af-fila--anulada td { opacity: .55; text-decoration: line-through; }
.af-fila--proyeccion td { color: #7a869b; font-style: italic; }
.af-fila--sinimporte td { color: #9aa5b8; }

/* ── Barra de avance ────────────────────────────────────────────────────── */
.af-barra { width: 74px; height: 6px; background: #e0e4ec; border-radius: 3px; overflow: hidden; }
.af-barra__fill { height: 100%; background: linear-gradient(90deg, #2c5282, #d4af37); }

/* ── Chips ──────────────────────────────────────────────────────────────── */
.af-chip {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .1rem .45rem;
    border-radius: 3px;
    margin-left: 5px;
    white-space: nowrap;
}
.af-chip--ok { background: #e3f1e4; color: #2e7d32; }
.af-chip--warn { background: #fbefd9; color: #b56a00; }
.af-chip--error { background: #fbe3e1; color: #c62828; }
.af-chip--info { background: #dfe8f5; color: #2c5282; }
.af-chip--neutro { background: #eef2f8; color: #7a869b; }
.af-chip--baja { background: #e5e7eb; color: #4b5563; }

/* ── Notas ──────────────────────────────────────────────────────────────── */
.af-nota {
    border-left: 3px solid #2c5282;
    background: #fff;
    border-radius: 0 5px 5px 0;
    padding: .7rem .9rem;
    margin: 0 0 16px;
    font-size: .88rem;
    line-height: 1.5;
    max-width: 92ch;
}
.af-nota strong { display: block; margin-bottom: 2px; color: #1b2433; }
.af-nota span, .af-nota li { color: #4a566b; }
.af-nota ul { margin: 4px 0 0; padding-left: 1.1rem; }
.af-nota--warn { border-left-color: #c77700; background: #fffaf2; }
.af-nota--ok { border-left-color: #2e7d32; background: #f4faf4; }
.af-nota--bloqueo { border-left-color: #c62828; background: #fef6f5; }

/* ── Vacíos ─────────────────────────────────────────────────────────────── */
.af-vacio { text-align: center; padding: 40px 20px; color: #7a869b; }
.af-vacio i { font-size: 2.2rem; opacity: .35; display: block; margin-bottom: 10px; }
.af-vacio p { margin: 0 auto; max-width: 56ch; font-size: .9rem; line-height: 1.5; }
.af-vacio--ok i { color: #2e7d32; opacity: .5; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.af-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 35, 60, .45);
    z-index: 1040;
}
.af-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(720px, 94vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(20,35,60,.28);
    z-index: 1050;
}
.af-modal--ancho { width: min(1040px, 96vw); }
.af-modal__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: .9rem 1.1rem;
    background: var(--primario, #1e3a5f);
    color: #fff;
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid var(--secundario, #d4af37);
}
.af-modal__head h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.af-modal__head .af-icon { color: #cfd9e8; }
.af-modal__head .af-icon:hover { background: rgba(255,255,255,.14); color: #fff; }
.af-modal__sub { font-size: .8rem; opacity: .85; }
.af-modal__body { padding: 1.1rem; overflow-y: auto; }
.af-modal__foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: .8rem 1.1rem;
    border-top: 1px solid #e0e4ec;
    background: #f5f7fb;
    border-radius: 0 0 8px 8px;
    flex-wrap: wrap;
}

/* ── Ficha del activo ───────────────────────────────────────────────────── */
.af-ficha-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.af-ficha-grid > div { display: flex; flex-direction: column; gap: 2px; }
.af-ficha-grid span { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: #7a869b; }
.af-ficha-grid b { font-size: .9rem; color: #1b2433; }

.af-libros { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.af-libro { border: 1px solid #e0e4ec; border-radius: 6px; padding: .9rem 1rem; background: #fafbfd; }
.af-libro--c { border-top: 3px solid #2c5282; }
.af-libro--t { border-top: 3px solid #d4af37; }
.af-libro h4 { margin: 0 0 8px; font-size: .95rem; color: #1b2433; }
.af-libro-linea { display: flex; justify-content: space-between; gap: 10px; padding: .2rem 0; font-size: .87rem; }
.af-libro-linea span { color: #4a566b; }
.af-libro-linea b { font-variant-numeric: tabular-nums; }
.af-libro-linea--total { border-top: 1px solid #e0e4ec; margin-top: 5px; padding-top: 6px; font-weight: 700; }
.af-libro-nota { margin: 8px 0 0; font-size: .76rem; color: #7a869b; }

/* ── Mensajes y toast ───────────────────────────────────────────────────── */
.af-msg { font-size: .84rem; margin-right: auto; }
.af-msg--error { color: #c62828; }
.af-msg--ok { color: #2e7d32; }

.af-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 460px;
    padding: .75rem 1rem;
    border-radius: 6px;
    font-size: .88rem;
    line-height: 1.45;
    box-shadow: 0 8px 24px rgba(20,35,60,.22);
    background: #fff;
    border-left: 4px solid #2c5282;
}
.af-toast--ok { border-left-color: #2e7d32; }
.af-toast--error { border-left-color: #c62828; }

/* ── Paginación ─────────────────────────────────────────────────────────── */
.af-paginacion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 2px 0;
    font-size: .86rem;
    color: #4a566b;
    flex-wrap: wrap;
}
.af-paginacion__ctrl { display: flex; align-items: center; gap: 8px; }

@media (max-width: 720px) {
    .af-head { flex-direction: column; align-items: flex-start; }
    .af-filtros, .af-periodo { flex-direction: column; align-items: stretch; }
    .af-filtro-texto { min-width: 0; }
}

/* ── Barra de acciones de la ficha (movimientos y baja) ─────────────────── */
.af-acciones-barra {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: .6rem .7rem;
    margin-bottom: 16px;
    background: #f5f7fb;
    border: 1px solid #e0e4ec;
    border-radius: 6px;
}
