/* Fase 9.2 — CSS verbatim de los <style> de Pages/Inventarios/Productos/Main/ModalIAProducto.razor. Igual que hoy, es global mientras el componente está en pantalla:
   se enlaza con <link> donde estaba el <style>. Cambios: @@ → @ y capas D-51. */
.mia-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.40);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal); /* D-51 (era 1050) */
}

.mia-modal {
    background: #fff;
    border-radius: 10px;
    width: 680px;
    max-width: 97vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 0.5px solid #CFE3F7;
    box-shadow: 0 8px 32px rgba(21,101,192,.18);
}

/* Header */
.mia-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 0.5px solid #CFE3F7;
    flex-shrink: 0;
    background: #FAFCFF;
}

.mia-header-left { display: flex; align-items: center; gap: 10px; }

.mia-header-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.mia-title { font-size: 13px; font-weight: 600; color: #0D47A1; }
.mia-sub   { font-size: 10px; color: #6B7280; margin-top: 1px; }

.mia-close {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    border: none;
    background: #F3F4F6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #6B7280;
    flex-shrink: 0;
}
.mia-close:hover { background: #FEE2E2; color: #DC2626; }

/* Módulos */
.mia-modulos {
    display: flex;
    gap: 0;
    padding: 0;
    border-bottom: 0.5px solid #CFE3F7;
    background: #F8FAFF;
    overflow-x: auto;
    flex-shrink: 0;
}

.mia-mod {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-size: 10.5px;
    color: #6B7280;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: color .1s, border-color .1s;
    margin-bottom: -1px;
}
.mia-mod:hover { color: #1565C0; background: #E3F2FD; }

.mia-mod-active {
    color: #1565C0;
    border-bottom-color: #1565C0;
    font-weight: 600;
    background: #fff;
}

.mia-mod-icon { font-size: 14px; }
.mia-mod-name { font-size: 10.5px; }

/* Body */
.mia-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

/* Loading */
.mia-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
    color: #6B7280;
}
.mia-spinner { font-size: 28px; color: #1565C0; animation: mia-spin 1s linear infinite; }
@keyframes mia-spin { 100% { transform: rotate(360deg); } }
.mia-loading-text { font-size: 11px; margin-top: 8px; }

/* Empty */
.mia-empty { text-align: center; padding: 40px 20px; color: #6B7280; }
.mia-empty-icon { font-size: 36px; color: #BBDEFB; display: block; margin-bottom: 10px; }
.mia-empty-title { font-size: 12px; font-weight: 500; color: #0D47A1; margin-bottom: 4px; }
.mia-empty-sub   { font-size: 10.5px; }

/* KPI grids */
.mia-kpi-grid4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.mia-kpi {
    background: #E3F2FD;
    border-radius: 7px;
    padding: 8px 10px;
    text-align: center;
}
.mia-kpi-val { font-size: 18px; font-weight: 600; color: #0D47A1; line-height: 1.1; }
.mia-kpi-lbl { font-size: 9px;  color: #6B7280; margin-top: 2px; }
.mia-kpi-val.ok   { color: #059669; }
.mia-kpi-val.bad  { color: #DC2626; }
.mia-kpi-val.warn { color: #D97706; }

/* Tabla */
.mia-table-wrap { overflow-x: auto; }

.mia-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.5px;
}
.mia-table thead th {
    background: #0D47A1;
    color: #fff;
    padding: 4px 6px;
    text-align: center;
    font-weight: 500;
    border-right: 0.5px solid rgba(255,255,255,.18);
    position: sticky;
    top: 0;
    white-space: nowrap;
}
.mia-table thead th:last-child { border-right: none; }
.mia-table thead th.thl { text-align: left; }
.mia-table tbody td {
    padding: 3px 6px;
    border-bottom: 0.5px solid #CFE3F7;
    border-right: 0.5px solid #CFE3F7;
    color: #374151;
}
.mia-table tbody td:last-child { border-right: none; }
.mia-table tbody tr:nth-child(even) td { background: #DBEAFE; }
.mia-table tfoot td {
    background: #0D47A1;
    color: #E3F2FD;
    font-weight: 600;
    padding: 3px 6px;
    text-align: right;
}

.td-c    { text-align: center; }
.td-r    { text-align: right; }
.txt-ok  { color: #059669; font-weight: 500; }
.txt-bad { color: #DC2626; font-weight: 500; }
.txt-warn{ color: #D97706; }
.txt-muted{ color: #9CA3AF; }
.txt-bold { font-weight: 600; color: #0D47A1; }

/* Insights */
.mia-insight {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-radius: 0 7px 7px 0;
    padding: 8px 10px;
    font-size: 10.5px;
    margin-bottom: 6px;
}
.mia-insight i { flex-shrink: 0; margin-top: 1px; font-size: 14px; }
.mia-insight-ok   { background: #F0FDF4; border-left: 3px solid #22C55E; color: #166534; }
.mia-insight-warn { background: #FFFBEB; border-left: 3px solid #F59E0B; color: #78350F; }
.mia-insight-info { background: #EFF6FF; border-left: 3px solid #3B82F6; color: #1D4ED8; }
.mia-insight-bad  { background: #FEF2F2; border-left: 3px solid #DC2626; color: #991B1B; }

/* Footer */
.mia-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 0.5px solid #CFE3F7;
    background: #FAFCFF;
    flex-shrink: 0;
}
.mia-footer-badge {
    font-size: 9.5px;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 4px;
}
.mia-btn-sec {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    height: 26px;
    border: 0.5px solid #BBDEFB;
    border-radius: 6px;
    background: #fff;
    font-size: 11px;
    color: #0D47A1;
    cursor: pointer;
    font-family: inherit;
    transition: background .1s;
}
.mia-btn-sec:hover { background: #E3F2FD; }
