/* ============================================================================
   Sprint 1 · Matriz Financiera 360 · estilos
   Prefix isw-mf- · border-radius 0 · respeta design system ISW
   ============================================================================ */

.isw-mf-wrap {
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    min-height: calc(100vh - 0px);
    padding: 0;
    margin: 0;
    color: #222;
}

/* ---------------------------------------------------------------------------- */
/* Topbar                                                                       */
/* ---------------------------------------------------------------------------- */
.isw-mf-topbar {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 3px solid #f39c12;
}
.isw-mf-back {
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 8px 14px;
    background: #f39c12;
    border: 1px solid #e67e22;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    transition: background .15s ease;
}
.isw-mf-back:hover { background: #e67e22; color: #fff; }
.isw-mf-back i { font-size: 13px; }
.isw-mf-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex: 1;
}
.isw-mf-title i { color: #f39c12; margin-right: 8px; }
.isw-mf-topbar-right {
    display: flex;
    gap: 12px;
    font-size: 12px;
    align-items: center;
}
.isw-mf-entity, .isw-mf-user {
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    font-weight: 600;
}

/* ---------------------------------------------------------------------------- */
/* KPI cards                                                                    */
/* ---------------------------------------------------------------------------- */
.isw-mf-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px 20px 4px;
}
.isw-mf-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-left-width: 5px;
    padding: 14px 16px;
    position: relative;
}
.isw-mf-card-total { border-left-color: #2C1445; }
.isw-mf-card-ttc   { border-left-color: #3498db; }
.isw-mf-card-paid  { border-left-color: #27ae60; }
.isw-mf-card-pend  { border-left-color: #e74c3c; }
.isw-mf-card-lbl {
    font-size: 10px;
    letter-spacing: 1.2px;
    color: #888;
    text-transform: uppercase;
    font-weight: 700;
}
.isw-mf-card-val {
    font-size: 24px;
    font-weight: 700;
    margin-top: 6px;
    color: #2C1445;
}
.isw-mf-card-pct {
    font-size: 11px;
    color: #27ae60;
    font-weight: 700;
    margin-top: 4px;
}

/* ---------------------------------------------------------------------------- */
/* Resumen por categoria                                                        */
/* ---------------------------------------------------------------------------- */
.isw-mf-cats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 4px 20px 12px;
}
.isw-mf-cat {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px 12px;
    border-top: 4px solid #7f8c8d;
}
.isw-mf-cat.cat-VENTA_MANDOS     { border-top-color: #9b59b6; }
.isw-mf-cat.cat-MONTAJE_NUEVO    { border-top-color: #27ae60; }
.isw-mf-cat.cat-SERVICIO_TECNICO { border-top-color: #e67e22; }
.isw-mf-cat.cat-OTROS            { border-top-color: #7f8c8d; }
.isw-mf-cat-lbl {
    font-size: 10px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
}
.isw-mf-cat-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
}
.isw-mf-cat-n {
    color: #2C1445;
    font-weight: 700;
}
.isw-mf-cat-ttc {
    color: #34495e;
    font-weight: 600;
}

/* ---------------------------------------------------------------------------- */
/* Filtros                                                                      */
/* ---------------------------------------------------------------------------- */
.isw-mf-filters {
    background: #fff;
    margin: 0 20px;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-bottom: none;
}
.isw-mf-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.isw-mf-filter-row:last-child { margin-bottom: 0; }
.isw-mf-filter-row label {
    font-size: 11px;
    color: #555;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.isw-mf-filter-row select,
.isw-mf-filter-row input[type="date"],
.isw-mf-filter-row input[type="text"] {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #bbb;
    background: #fff;
    font-family: inherit;
}
.isw-mf-filter-row input[type="text"] { min-width: 180px; }
.isw-mf-spacer { flex: 1; }

.isw-mf-btn {
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: opacity .15s ease;
}
.isw-mf-btn:hover { opacity: 0.85; }
.isw-mf-btn i { margin-right: 4px; }
.isw-mf-btn-apply { background: #2C1445; }
.isw-mf-btn-clear { background: #95a5a6; }
.isw-mf-btn-csv   { background: #27ae60; }
.isw-mf-btn-pdf   { background: #e74c3c; }

/* ---------------------------------------------------------------------------- */
/* Tabla                                                                        */
/* ---------------------------------------------------------------------------- */
.isw-mf-table-wrap {
    margin: 0 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    overflow-x: auto;
}
.isw-mf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.isw-mf-table thead th {
    background: #2C1445;
    color: #fff;
    padding: 9px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 5;
}
.isw-mf-table .isw-mf-th-num { text-align: right; }
.isw-mf-table .isw-mf-th-sort { cursor: pointer; user-select: none; }
.isw-mf-table .isw-mf-th-sort:hover { background: #3a1e5e; }
.isw-mf-table .isw-mf-th-sort.sorted-asc::after  { content: ' ▲'; font-size: 9px; }
.isw-mf-table .isw-mf-th-sort.sorted-desc::after { content: ' ▼'; font-size: 9px; }
.isw-mf-table tbody tr {
    border-bottom: 1px solid #eef1f4;
    transition: background .12s ease;
}
.isw-mf-table tbody tr:hover { background: #f8fafc; }
.isw-mf-table tbody tr:nth-child(even) { background: #fafbfc; }
.isw-mf-table tbody tr:nth-child(even):hover { background: #f3f6f9; }
.isw-mf-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
}
.isw-mf-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.isw-mf-table .ref-cell {
    font-weight: 700;
    color: #2C1445;
    cursor: pointer;
}
.isw-mf-table .ref-cell:hover { text-decoration: underline; }

/* Badge categoria */
.isw-mf-badge-cat {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.cat-VENTA_MANDOS-bg     { background: #9b59b6; }
.cat-MONTAJE_NUEVO-bg    { background: #27ae60; }
.cat-SERVICIO_TECNICO-bg { background: #e67e22; }
.cat-OTROS-bg            { background: #7f8c8d; }

/* Badge estado */
.isw-mf-badge-estado {
    display: inline-block;
    padding: 2px 10px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}

.isw-mf-cell-acciones a {
    color: #2C1445;
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid #ddd;
    font-size: 11px;
    margin-right: 3px;
    background: #fff;
    transition: all .12s ease;
}
.isw-mf-cell-acciones a:hover {
    background: #2C1445;
    color: #fff;
    border-color: #2C1445;
}

.isw-mf-loading, .isw-mf-empty {
    text-align: center;
    padding: 30px;
    color: #888;
    font-style: italic;
}
.isw-mf-empty i { font-size: 28px; display: block; margin-bottom: 8px; color: #ccc; }

/* ---------------------------------------------------------------------------- */
/* Footer · paginacion                                                          */
/* ---------------------------------------------------------------------------- */
.isw-mf-footer {
    margin: 0 20px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    display: flex;
    align-items: center;
    gap: 12px;
}
.isw-mf-pager {
    display: flex;
    gap: 4px;
}
.isw-mf-pager button {
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #bbb;
    color: #2C1445;
    cursor: pointer;
    font-size: 12px;
    min-width: 32px;
    font-family: inherit;
}
.isw-mf-pager button:hover:not(:disabled) { background: #2C1445; color: #fff; border-color: #2C1445; }
.isw-mf-pager button.active { background: #2C1445; color: #fff; border-color: #2C1445; }
.isw-mf-pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.isw-mf-counter {
    margin-left: auto;
    font-size: 12px;
    color: #666;
}

/* ---------------------------------------------------------------------------- */
/* Responsive                                                                    */
/* ---------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .isw-mf-kpis, .isw-mf-cats { grid-template-columns: repeat(2, 1fr); }
    .isw-mf-table thead th, .isw-mf-table tbody td { padding: 7px 8px; font-size: 12px; }
}
@media (max-width: 700px) {
    .isw-mf-kpis, .isw-mf-cats { grid-template-columns: 1fr; padding: 12px; }
    .isw-mf-filters, .isw-mf-table-wrap, .isw-mf-footer { margin: 0 8px; }
    .isw-mf-title { font-size: 16px; }
    .isw-mf-table { font-size: 11px; }
    .isw-mf-filter-row { gap: 6px; }
}

/* ---------------------------------------------------------------------------- */
/* Print                                                                         */
/* ---------------------------------------------------------------------------- */
@media print {
    .isw-mf-topbar, .isw-mf-filters, .isw-mf-footer { display: none !important; }
    .isw-mf-table thead th { background: #ddd !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================================
   Modo embebido: la matriz dentro de la columna central del dashboard
   ============================================================================ */
.isw-mf-embed { min-height: 0 !important; background: transparent !important; }
.isw-mf-embed .isw-mf-topbar { display: none !important; }
.isw-mf-embed .isw-mf-kpis,
.isw-mf-embed .isw-mf-cats,
.isw-mf-embed .isw-mf-filters,
.isw-mf-embed .isw-mf-table-wrap,
.isw-mf-embed .isw-mf-footer { margin-left: 0; margin-right: 0; }
.isw-mf-embed .isw-mf-kpis { padding-top: 10px; }
.isw-mf-embed .isw-mf-table-wrap { overflow-x: auto; }
.isw-mf-embed .isw-mf-table { font-size: 12px; }
.isw-mf-embed .isw-mf-card-val { font-size: 22px; }
.isw-sh-matriz { color: #fff; }
