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

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

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

.rp-btn-export {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
    border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer;
    border: none; font-family: inherit; transition: all .15s; white-space: nowrap;
}
.rp-btn-export .material-symbols-outlined { font-size: 17px; font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.rp-btn-export:hover { filter: brightness(1.08); transform: translateY(-1px); }
.rp-btn-export:active { transform: scale(.97); }
.rp-btn-export.excel { background: rgba(5,150,105,0.1); color: #059669; border: 1px solid rgba(5,150,105,0.2); }
.rp-btn-export.excel:hover { background: #059669; color: #fff; }
.rp-btn-export.pdf { background: rgba(186,26,26,0.08); color: #ba1a1a; border: 1px solid rgba(186,26,26,0.15); }
.rp-btn-export.pdf:hover { background: #ba1a1a; color: #fff; }
.dark .rp-btn-export.excel { background: rgba(52,211,153,0.1); color: #34d399; border-color: rgba(52,211,153,0.2); }
.dark .rp-btn-export.pdf { background: rgba(255,180,171,0.1); color: #ffb4ab; border-color: rgba(255,180,171,0.15); }

/* KPI Grid */
.rp-kpi-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; margin-bottom: 16px; }
.rp-kpi {
    background: var(--rp-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--rp-border); border-radius: 1.5rem;
    padding: 15px 18px; box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.05);
    transition: transform .18s, box-shadow .18s;
}
.rp-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(var(--wk-primary-rgb),0.09); }
.rp-kpi-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--rp-text-3); margin-bottom: 8px; }
.rp-kpi-value { font-size: 24px; font-weight: 900; color: var(--rp-text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; font-family: 'Manrope', sans-serif; }
.rp-kpi-money { color: var(--wk-text); }
.dark .rp-kpi-money { color: var(--wk-text); }
.rp-kpi-ok { border-color: rgba(5,150,105,0.2); }
.rp-kpi-err { border-color: rgba(186,26,26,0.2); }
.rp-kpi-warn { border-color: rgba(217,119,6,0.2); }
.dark .rp-kpi-ok { border-color: rgba(52,211,153,0.2); }
.dark .rp-kpi-err { border-color: rgba(255,180,171,0.2); }
.dark .rp-kpi-warn { border-color: rgba(251,191,36,0.2); }
.rp-kpi-ok .rp-kpi-value { color: #059669; }
.rp-kpi-err .rp-kpi-value { color: #ba1a1a; }
.rp-kpi-warn .rp-kpi-value { color: #d97706; }
.dark .rp-kpi-ok .rp-kpi-value { color: #34d399; }
.dark .rp-kpi-err .rp-kpi-value { color: #ffb4ab; }
.dark .rp-kpi-warn .rp-kpi-value { color: #fbbf24; }

/* Filtros */
.rp-filters-card {
    background: var(--rp-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--rp-border); border-radius: 1.5rem;
    padding: 16px 20px; margin-bottom: 14px; box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.04);
}
.rp-filters-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--rp-text-3); margin-bottom: 14px; display: flex; align-items: center; gap: 7px; }
.rp-filters-title .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; color: var(--wk-text); }
.rp-filters-grid { display: grid; grid-template-columns: 1fr 1fr 160px 140px 140px auto; gap: 10px; align-items: end; }
.rp-filter-field { display: flex; flex-direction: column; gap: 4px; }
.rp-filter-label { font-size: 11px; font-weight: 600; color: var(--rp-text-3); }
.rp-filter-action { justify-content: flex-end; }

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

.rp-btn-clear {
    display: inline-flex; align-items: center; gap: 5px;
    height: 34px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rp-border);
    background: transparent; color: var(--rp-text-3); font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; white-space: nowrap; transition: all .15s;
}
.rp-btn-clear .material-symbols-outlined { font-size: 14px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.rp-btn-clear:hover { border-color: rgba(186,26,26,0.3); color: #ba1a1a; background: rgba(186,26,26,0.05); }

/* Table card */
.rp-table-card {
    background: var(--rp-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--rp-border); border-radius: 1.5rem;
    box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.05); overflow: hidden;
}
.rp-table-info { font-size: 12px; color: var(--rp-text-3); padding: 12px 20px; border-bottom: 1px solid rgba(70,68,61,0.07); }
.dark .rp-table-info { border-bottom-color: rgba(255,255,255,0.05); }
.rp-table-info strong { color: var(--rp-text); }
.rp-table-wrap { overflow-x: auto; }
.rp-table { width: 100%; border-collapse: collapse; }
.rp-table thead { border-bottom: 1px solid rgba(70,68,61,0.07); }
.dark .rp-table thead { border-bottom-color: rgba(255,255,255,0.05); }
.rp-table th { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--rp-text-3); padding: 10px 14px; text-align: left; white-space: nowrap; }
.rp-th-right { text-align: right; }
.rp-table td { padding: 11px 14px; border-bottom: 1px solid rgba(70,68,61,0.05); font-size: 13px; color: var(--rp-text); vertical-align: middle; }
.dark .rp-table td { border-bottom-color: rgba(255,255,255,0.04); }
.rp-table tr:last-child td { border-bottom: none; }
.rp-table tbody tr:hover td { background: rgba(var(--wk-primary-rgb),0.025); }
.dark .rp-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.rp-td-date { color: var(--rp-text-3); font-size: 12.5px; white-space: nowrap; }
.rp-td-control { font-family: 'Courier New', monospace; font-size: 12px; color: var(--rp-text-3); white-space: nowrap; }
.rp-td-cliente { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-td-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-family: 'Manrope', sans-serif; }
.rp-td-actions { width: 150px; }
.rp-actions { display: flex; gap: 6px; align-items: center; }

.rp-btn-ver {
    padding: 5px 12px; border-radius: 9px; font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: all .15s;
    background: rgba(var(--wk-primary-rgb),0.08); color: var(--wk-text); border: 1px solid rgba(var(--wk-primary-rgb),0.15);
}
.rp-btn-ver:hover { background: var(--wk-primary); color: var(--wk-on-primary); }
.dark .rp-btn-ver { background: rgba(var(--wk-primary-rgb),0.1); color: var(--wk-text); border-color: rgba(var(--wk-primary-rgb),0.15); }
.dark .rp-btn-ver:hover { background: rgba(var(--wk-primary-rgb),0.2); }

.rp-btn-cancelar {
    padding: 5px 12px; border-radius: 9px; font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: all .15s;
    background: rgba(186,26,26,0.07); color: #ba1a1a; border: 1px solid rgba(186,26,26,0.15);
}
.rp-btn-cancelar:hover { background: #ba1a1a; color: #fff; }
.dark .rp-btn-cancelar { background: rgba(255,180,171,0.1); color: #ffb4ab; border-color: rgba(255,180,171,0.15); }
.dark .rp-btn-cancelar:hover { background: rgba(255,180,171,0.2); }

/* Estado pills */
.rp-estado { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.rp-estado-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.rp-ok      { background: rgba(5,150,105,0.08); color: #059669; border: 1px solid rgba(5,150,105,0.15); }
.rp-proc    { background: rgba(var(--wk-primary-rgb),0.08); color: var(--wk-text); border: 1px solid rgba(var(--wk-primary-rgb),0.15); }
.rp-firm    { background: rgba(124,58,237,0.08); color: #7c3aed; border: 1px solid rgba(124,58,237,0.15); }
.rp-borr    { background: rgba(70,68,61,0.07); color: var(--rp-text-3); border: 1px solid rgba(70,68,61,0.10); }
.rp-rech,.rp-error { background: rgba(186,26,26,0.08); color: #ba1a1a; border: 1px solid rgba(186,26,26,0.15); }
.rp-invalid { background: rgba(217,119,6,0.08); color: #d97706; border: 1px solid rgba(217,119,6,0.15); }
.rp-default { background: rgba(70,68,61,0.07); color: var(--rp-text-3); border: 1px solid rgba(70,68,61,0.10); }
.dark .rp-ok   { background: rgba(52,211,153,0.1); color: #34d399; border-color: rgba(52,211,153,0.15); }
.dark .rp-proc { background: rgba(var(--wk-primary-rgb),0.1); color: var(--wk-text); border-color: rgba(var(--wk-primary-rgb),0.15); }
.dark .rp-firm { background: rgba(167,139,250,0.1); color: #a78bfa; border-color: rgba(167,139,250,0.15); }
.dark .rp-borr,.dark .rp-default { background: rgba(255,255,255,0.05); color: var(--rp-text-3); border-color: rgba(255,255,255,0.08); }
.dark .rp-rech,.dark .rp-error { background: rgba(255,180,171,0.1); color: #ffb4ab; border-color: rgba(255,180,171,0.15); }
.dark .rp-invalid { background: rgba(251,191,36,0.1); color: #fbbf24; border-color: rgba(251,191,36,0.15); }

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

/* Pagination */
.rp-pagination { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid rgba(70,68,61,0.07); }
.dark .rp-pagination { border-top-color: rgba(255,255,255,0.05); }
.rp-page-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--rp-border); background: transparent; color: var(--rp-text-2); font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .15s; }
.rp-page-btn .material-symbols-outlined { font-size: 18px; }
.rp-page-btn:hover:not(:disabled) { border-color: var(--wk-text); color: var(--wk-text); background: rgba(var(--wk-primary-rgb),0.05); }
.rp-page-btn:disabled { opacity: .35; cursor: not-allowed; }
.rp-page-info { font-size: 12.5px; color: var(--rp-text-3); font-variant-numeric: tabular-nums; }

/* Export overlay */
.rp-export-overlay { position: fixed; inset: 0; background: rgba(16,16,16,.6); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.rp-export-card {
    background: var(--rp-surface); backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--rp-border); border-radius: 1.5rem;
    padding: 32px 40px; text-align: center; width: 280px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18); animation: rp-fadeUp .22s ease;
}
.rp-export-spinner { width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid rgba(var(--wk-primary-rgb),0.12); border-top-color: var(--wk-text); animation: rp-spin .75s linear infinite; margin: 0 auto 16px; }
.rp-export-title { font-size: 14.5px; font-weight: 800; color: var(--rp-text); margin-bottom: 14px; font-family: 'Manrope', sans-serif; }
.rp-export-sub { font-size: 12px; color: var(--rp-text-3); line-height: 1.5; }
.rp-export-bar-wrap { height: 3px; background: rgba(var(--wk-primary-rgb),0.1); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.rp-export-bar { height: 100%; width: 45%; background: linear-gradient(90deg,var(--wk-primary),var(--wk-primary-strong)); animation: rp-barMove 1.1s infinite ease-in-out; }

/* Modal cancelar */
.rp-cancel-info { font-size: 13px; color: var(--rp-text-3); margin-bottom: 16px; line-height: 1.55; padding: 10px 14px; background: rgba(var(--wk-primary-rgb),0.04); border-radius: 12px; border: 1px solid var(--rp-border); }
.rp-cancel-control { font-family: 'Courier New', monospace; font-size: 12px; color: var(--rp-text); margin-left: 4px; }
.rp-cancel-fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.rp-cancel-error { display: flex; align-items: flex-start; gap: 9px; background: rgba(186,26,26,0.07); border: 1px solid rgba(186,26,26,0.15); border-radius: 11px; padding: 12px 14px; font-size: 13px; color: #ba1a1a; font-weight: 500; margin-bottom: 14px; line-height: 1.55; }
.dark .rp-cancel-error { background: rgba(147,0,10,0.2); border-color: rgba(255,180,171,0.2); color: #ffb4ab; }
.rp-cancel-error-icon .material-symbols-outlined { font-size: 16px; flex-shrink: 0; font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.rp-btn-cancelar-confirm { flex: 1; padding: 11px; background: #ba1a1a; color: #fff; border: none; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .15s; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.rp-btn-cancelar-confirm:hover:not(:disabled) { background: #a31515; }
.rp-btn-cancelar-confirm:disabled { opacity: .55; cursor: not-allowed; }
.rp-cancel-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: rp-spin .7s linear infinite; flex-shrink: 0; }

@keyframes rp-spin { to { transform: rotate(360deg); } }
@keyframes rp-fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rp-barMove { 0% { transform: translateX(-120%); } 100% { transform: translateX(280%); } }

/* Responsive */
@media (max-width: 1100px) {
    .rp-kpi-grid { grid-template-columns: repeat(3,1fr); }
    .rp-filters-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 768px) {
    .rp-kpi-grid { grid-template-columns: 1fr 1fr; }
    .rp-filters-grid { grid-template-columns: 1fr 1fr; }
    .rp-title { font-size: 22px; }
    .rp-table th:nth-child(2), .rp-table td:nth-child(2) { display: none; }
}
@media (max-width: 520px) {
    .rp-filters-grid { grid-template-columns: 1fr; }
    .rp-header { flex-direction: column; align-items: flex-start; }
    .rp-table th:nth-child(3), .rp-table td:nth-child(3) { display: none; }
}
