/* ===== INVALIDACIONES.CSS ===== */
:root {
    --iv-primary: var(--wk-primary);
    --iv-surface: rgba(255,255,255,0.88);
    --iv-border: rgba(255,255,255,0.55);
    --iv-text: #1a1a1a;
    --iv-text-2: #46443d;
    --iv-text-3: #8a8782;
}
.dark {
    --iv-primary: var(--wk-primary);
    --iv-surface: rgba(28,28,28,0.94);
    --iv-border: rgba(255,255,255,0.10);
    --iv-text: #ededed;
    --iv-text-2: #cfcdc7;
    --iv-text-3: #8a8782;
}

.iv-container { max-width: 1400px; margin: 0 auto; padding: 4px 0 32px; }

/* Header */
.iv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.iv-title { font-size: 28px; font-weight: 900; color: var(--iv-text); letter-spacing: -.02em; margin: 0 0 4px; font-family: 'Manrope', sans-serif; }
.iv-subtitle { font-size: 13px; color: var(--iv-text-3); margin: 0; }

/* KPIs */
.iv-kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.iv-kpi {
    background: var(--iv-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--iv-border); border-radius: 1.5rem;
    padding: 16px 18px; box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.05);
}
.iv-kpi-warn { border-color: rgba(217,119,6,0.25); }
.dark .iv-kpi-warn { border-color: rgba(251,191,36,0.2); }
.iv-kpi-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--iv-text-3); margin-bottom: 8px; }
.iv-kpi-value { font-size: 26px; font-weight: 900; color: var(--iv-text); font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 4px; font-family: 'Manrope', sans-serif; }
.iv-kpi-sub { font-size: 11px; color: var(--iv-text-3); }
.iv-warn { color: #d97706; }
.dark .iv-warn { color: #fbbf24; }

/* Filtros card */
.iv-filters-card {
    background: var(--iv-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--iv-border); border-radius: 1.5rem;
    padding: 14px 18px; margin-bottom: 14px; box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.04);
}
.iv-filters-row { display: grid; grid-template-columns: 160px 140px 140px 1fr auto; gap: 10px; align-items: end; }
.iv-filter-field { display: flex; flex-direction: column; gap: 4px; }
.iv-filter-label { font-size: 11px; font-weight: 600; color: var(--iv-text-3); }
.iv-filter-search { min-width: 0; }
.iv-filter-actions { display: flex; gap: 8px; align-items: flex-end; }

.iv-input {
    padding: 7px 11px; border-radius: 10px; border: 1px solid var(--iv-border);
    background: var(--iv-surface); backdrop-filter: blur(12px);
    font-size: 13px; color: var(--iv-text); font-family: inherit;
    outline: none; height: 34px; transition: border-color .15s, box-shadow .15s;
}
.iv-input:focus { border-color: var(--wk-text); box-shadow: 0 0 0 3px rgba(var(--wk-primary-rgb),.1); }

/* Table card */
.iv-table-card {
    background: var(--iv-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--iv-border); border-radius: 1.5rem;
    overflow: hidden; box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.05);
}
.iv-table-info { font-size: 12px; color: var(--iv-text-3); padding: 10px 18px; border-bottom: 1px solid rgba(70,68,61,0.07); }
.dark .iv-table-info { border-bottom-color: rgba(255,255,255,0.05); }
.iv-count-acept { color: #059669; font-weight: 600; }
.iv-count-inv { color: #d97706; font-weight: 600; }
.dark .iv-count-acept { color: #34d399; }
.dark .iv-count-inv { color: #fbbf24; }
.iv-table-wrap { overflow-x: auto; }
.iv-table { width: 100%; border-collapse: collapse; }
.iv-table thead { border-bottom: 1px solid rgba(70,68,61,0.07); }
.dark .iv-table thead { border-bottom-color: rgba(255,255,255,0.05); }
.iv-table th { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--iv-text-3); padding: 9px 12px; text-align: left; white-space: nowrap; }
.iv-th-r { text-align: right; }
.iv-table td { padding: 10px 12px; border-bottom: 1px solid rgba(70,68,61,0.05); font-size: 13px; color: var(--iv-text); vertical-align: middle; }
.dark .iv-table td { border-bottom-color: rgba(255,255,255,0.04); }
.iv-table tr:last-child td { border-bottom: none; }
.iv-table tbody tr:hover td { background: rgba(var(--wk-primary-rgb),0.025); }
.dark .iv-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.iv-tr-inv td { opacity: .65; }
.iv-td-fecha { white-space: nowrap; color: var(--iv-text-3); font-size: 12px; }
.iv-td-control { font-family: 'Courier New', monospace; font-size: 11px; color: var(--iv-text-3); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-td-receptor { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-td-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; font-family: 'Manrope', sans-serif; }
.iv-td-motivo { max-width: 200px; font-size: 12px; color: var(--iv-text-3); }
.iv-td-actions { width: 80px; white-space: nowrap; }

/* Badges */
.iv-badge-tipo { display: inline-flex; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.iv-badge-tipo.fcf { background: rgba(var(--wk-primary-rgb),0.08); color: var(--wk-text); border: 1px solid rgba(var(--wk-primary-rgb),0.15); }
.iv-badge-tipo.ccf { background: rgba(124,58,237,0.08); color: #7c3aed; border: 1px solid rgba(124,58,237,0.15); }
.dark .iv-badge-tipo.fcf { background: rgba(var(--wk-primary-rgb),0.12); color: var(--wk-text); border-color: rgba(var(--wk-primary-rgb),0.2); }
.dark .iv-badge-tipo.ccf { background: rgba(167,139,250,0.12); color: #a78bfa; border-color: rgba(167,139,250,0.2); }

.iv-badge-estado { display: inline-flex; font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.iv-est-ok   { background: rgba(5,150,105,0.08); color: #059669; border: 1px solid rgba(5,150,105,0.15); }
.iv-est-inv  { background: rgba(217,119,6,0.08); color: #d97706; border: 1px solid rgba(217,119,6,0.15); }
.iv-est-def  { background: rgba(70,68,61,0.07); color: var(--iv-text-3); border: 1px solid rgba(70,68,61,0.10); }
.dark .iv-est-ok  { background: rgba(52,211,153,0.1); color: #34d399; border-color: rgba(52,211,153,0.15); }
.dark .iv-est-inv { background: rgba(251,191,36,0.1); color: #fbbf24; border-color: rgba(251,191,36,0.15); }

/* Icon buttons */
.iv-btn-icon {
    width: 40px; height: 40px; border: none; border-radius: 10px; cursor: pointer;
    background: transparent; display: inline-flex; align-items: center; justify-content: center;
    transition: background .14s, color .14s; color: var(--iv-text-3); touch-action: manipulation;
}
.iv-btn-icon .material-symbols-outlined { font-size: 17px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.iv-btn-icon.info:hover { background: rgba(var(--wk-primary-rgb),0.08); color: var(--wk-text); }
.iv-btn-icon.danger:hover { background: rgba(186,26,26,0.08); color: #ba1a1a; }
.dark .iv-btn-icon.info:hover { background: rgba(var(--wk-primary-rgb),0.12); color: var(--wk-text); }
.dark .iv-btn-icon.danger:hover { background: rgba(255,180,171,0.12); color: #ffb4ab; }

/* Modal */
.iv-modal {
    background: var(--iv-surface); backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--iv-border); border-radius: 1.5rem;
    width: 100%; max-width: 580px; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
    animation: iv-popIn .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes iv-popIn { from { transform: scale(.93) translateY(14px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.iv-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 14px; border-bottom: 1px solid rgba(70,68,61,0.07); flex-shrink: 0; }
.dark .iv-modal-header { border-bottom-color: rgba(255,255,255,0.06); }
.iv-modal-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: var(--iv-text); font-family: 'Manrope', sans-serif; }
.iv-modal-title .material-symbols-outlined { font-size: 20px; color: var(--wk-text); font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.iv-modal-close { width: 28px; height: 28px; border: none; border-radius: 7px; background: transparent; cursor: pointer; color: var(--iv-text-3); display: flex; align-items: center; justify-content: center; transition: background .14s, color .14s; }
.iv-modal-close .material-symbols-outlined { font-size: 18px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.iv-modal-close:hover { background: rgba(186,26,26,0.08); color: #ba1a1a; }
.iv-modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.iv-modal-footer { display: flex; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid rgba(70,68,61,0.07); flex-shrink: 0; }
.dark .iv-modal-footer { border-top-color: rgba(255,255,255,0.06); }

/* Detail grid */
.iv-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.iv-span2 { grid-column: span 2; }
.iv-detail-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--iv-text-3); margin-bottom: 4px; }
.iv-detail-value { font-size: 13px; color: var(--iv-text); }
.iv-mono { font-family: 'Courier New', monospace; }
.iv-small { font-size: 11px; }
.iv-bold { font-weight: 700; }
.iv-soft { color: var(--iv-text-3); }
.iv-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--iv-text-3); padding-top: 4px; border-top: 1px solid rgba(70,68,61,0.08); }
.dark .iv-section-title { border-top-color: rgba(255,255,255,0.06); }

/* Warning box */
.iv-warning-box {
    display: flex; gap: 12px; padding: 14px;
    background: rgba(217,119,6,0.07); border: 1px solid rgba(217,119,6,0.2); border-radius: 14px;
}
.dark .iv-warning-box { background: rgba(120,53,15,0.2); border-color: rgba(251,191,36,0.2); }
.iv-warning-icon .material-symbols-outlined { font-size: 20px; color: #d97706; font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; flex-shrink: 0; }
.dark .iv-warning-icon .material-symbols-outlined { color: #fbbf24; }
.iv-warning-title { font-size: 13px; font-weight: 700; color: #92400e; margin-bottom: 4px; }
.iv-warning-sub { font-size: 12px; color: #78350f; line-height: 1.5; }
.dark .iv-warning-title { color: #fde68a; }
.dark .iv-warning-sub { color: #fbbf24; }

/* Error box */
.iv-error-box {
    display: flex; align-items: flex-start; gap: 8px;
    background: rgba(186,26,26,0.06); border: 1px solid rgba(186,26,26,0.15);
    border-radius: 11px; padding: 10px 14px; font-size: 13px; color: #ba1a1a; font-weight: 500; line-height: 1.5;
}
.iv-error-box .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; flex-shrink: 0; }
.dark .iv-error-box { background: rgba(147,0,10,0.2); border-color: rgba(255,180,171,0.2); color: #ffb4ab; }

/* Buttons */
.iv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; font-family: inherit; transition: all .15s; white-space: nowrap; }
.iv-btn:disabled { opacity: .5; cursor: not-allowed; }
.iv-btn:active:not(:disabled) { transform: scale(.97); }
.iv-btn .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.iv-btn.primary { background: linear-gradient(135deg,var(--wk-primary),var(--wk-primary-strong)); color: var(--wk-on-primary); box-shadow: 0 4px 14px rgba(var(--wk-primary-rgb),0.25); }
.iv-btn.primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(var(--wk-primary-rgb),0.35); filter: brightness(1.05); }
.dark .iv-btn.primary { background: linear-gradient(135deg,var(--wk-primary-strong),var(--wk-primary-strong)); }
.iv-btn.danger { background: #ba1a1a; color: #fff; }
.iv-btn.danger:hover:not(:disabled) { background: #a31515; }
.iv-btn.light { background: transparent; color: var(--iv-text-2); border: 1px solid var(--iv-border); }
.iv-btn.light:hover:not(:disabled) { border-color: var(--wk-text); color: var(--wk-text); background: rgba(var(--wk-primary-rgb),0.04); }
.dark .iv-btn.light { border-color: rgba(255,255,255,0.12); }
.dark .iv-btn.light:hover:not(:disabled) { background: rgba(var(--wk-primary-rgb),0.08); border-color: rgba(var(--wk-primary-rgb),0.3); color: var(--wk-text); }

/* Spinners */
.iv-spinner { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid rgba(var(--wk-primary-rgb),0.12); border-top-color: var(--wk-text); animation: iv-spin .75s linear infinite; }
.iv-spinner-sm { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: iv-spin .7s linear infinite; flex-shrink: 0; }
@keyframes iv-spin { to { transform: rotate(360deg); } }

/* Empty */
.iv-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 56px 20px; color: var(--iv-text-3); }
.iv-empty-icon .material-symbols-outlined { font-size: 44px; font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 48; opacity: .5; }
.iv-empty-text { font-size: 15px; font-weight: 700; color: var(--iv-text-2); }
.iv-empty-sub { font-size: 13px; opacity: .75; }

/* Responsive */
@media (max-width: 1024px) {
    .iv-filters-row { grid-template-columns: 1fr 1fr 1fr; }
    .iv-kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .iv-filters-row { grid-template-columns: 1fr 1fr; }
    .iv-header { flex-direction: column; }
    .iv-table th:nth-child(7), .iv-table td:nth-child(7) { display: none; }
}
