/* ══════════════════════════════════════════
   Contabilidad Module — Main Styles
   ══════════════════════════════════════════ */

/* KPI Row */
.contab-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* KPI Card */
.contab-kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(16, 185, 129, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contab-kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.1);
}

.contab-kpi-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.contab-kpi-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.contab-kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contab-kpi-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* Color variants */
.contab-kpi-ingresos {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

.contab-kpi-ingresos .contab-kpi-value { color: #34d399; }

.contab-kpi-egresos {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.contab-kpi-egresos .contab-kpi-value { color: #f87171; }

.contab-kpi-balance {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

.contab-kpi-balance .contab-kpi-value { color: #60a5fa; }

.contab-kpi-cobrar {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(245, 158, 11, 0.2);
}

.contab-kpi-cobrar .contab-kpi-value { color: #fbbf24; }

.contab-kpi-pagar {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(139, 92, 246, 0.2);
}

.contab-kpi-pagar .contab-kpi-value { color: #a78bfa; }

/* Responsive */
@media (max-width: 768px) {
    .contab-kpi-row {
        grid-template-columns: 1fr 1fr;
    }
    .contab-kpi-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .contab-kpi-row {
        grid-template-columns: 1fr;
    }
}

/* ══════════════════════════════════════════
   Flujo Dashboard — Real y Proyectado
   ══════════════════════════════════════════ */

/* Table base */
.flujo-dash-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.flujo-dash-table th,
.flujo-dash-table td {
    padding: 8px 10px;
    white-space: nowrap;
}

/* ── Sticky Header (single row) ── */
.flujo-dash-thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

.flujo-dash-thead th {
    background: var(--dark-card, #1e293b);
    border-bottom: 2px solid rgba(245, 158, 11, 0.25);
    vertical-align: bottom;
    padding: 10px 8px 8px;
}

.flujo-month-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.flujo-month-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f59e0b;
    text-transform: capitalize;
}

.flujo-month-subs {
    display: flex;
    gap: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.flujo-sub-real { color: #3b82f6; }
.flujo-sub-presp { color: #8b5cf6; }

/* Fixed columns */
.flujo-col-num {
    min-width: 34px;
    text-align: center;
    color: #64748b;
    font-size: 0.8rem;
}

.flujo-col-code {
    min-width: 70px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #94a3b8;
}

.flujo-col-name {
    min-width: 160px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Group Header Row (collapsible) ── */
.flujo-group-row {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.flujo-group-row:hover {
    background: rgba(245, 158, 11, 0.12) !important;
}

.flujo-group-row td {
    background: rgba(245, 158, 11, 0.06);
    border-top: 1px solid rgba(245, 158, 11, 0.15);
    border-bottom: 1px solid rgba(245, 158, 11, 0.10);
    font-weight: 700;
    padding-top: 10px;
    padding-bottom: 10px;
}

.flujo-group-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flujo-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    color: #f59e0b;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.flujo-chevron.collapsed {
    transform: rotate(-90deg);
}

.flujo-group-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.flujo-group-name {
    color: #f59e0b;
    font-size: 0.92rem;
    font-weight: 700;
}

/* ── Sub-item rows ── */
.flujo-item-row td {
    border-bottom: 1px solid rgba(100, 116, 139, 0.08);
    padding-top: 6px;
    padding-bottom: 6px;
}

.flujo-item-row:hover td {
    background: rgba(100, 116, 139, 0.06);
}

.flujo-item-row.flujo-hidden {
    display: none;
}

.flujo-item-row .flujo-col-name {
    padding-left: 18px;
    font-size: 0.84rem;
    color: #cbd5e1;
}

.flujo-item-row .flujo-col-code {
    padding-left: 10px;
}

/* ── Value cells ── */
.flujo-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.flujo-val-pos { color: #10b981; }
.flujo-val-neg { color: #ef4444; }
.flujo-val-zero { color: #475569; }

.flujo-val-presp {
    color: #8b5cf6;
    opacity: 0.85;
}

/* Group totals in header rows are bolder */
.flujo-group-row .flujo-val {
    font-size: 0.85rem;
    font-weight: 700;
}

/* ── Spacer between groups ── */
.flujo-spacer td {
    height: 4px;
    border: none !important;
    padding: 0 !important;
}

/* ── Scrollable container tweak ── */
.flujo-dash-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border-radius: 8px;
    border: 1px solid rgba(100, 116, 139, 0.12);
}

/* ══════════════════════════════════════════
   Registro de Cargos — Table & Modal
   ══════════════════════════════════════════ */

/* Container */
.rc-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 72vh;
    border-radius: 8px;
    border: 1px solid rgba(100, 116, 139, 0.12);
}

/* Table base */
.rc-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
    table-layout: fixed;
}

.rc-table th,
.rc-table td {
    padding: 6px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid rgba(100, 116, 139, 0.08);
}

/* Column widths (fixed layout) */
.rc-col-oc       { width: 55px; }
.rc-col-nombre   { width: 260px; }
.rc-col-date     { width: 100px; }
.rc-col-status   { width: 95px; }
.rc-col-money    { width: 105px; }
.rc-col-cat      { width: 130px; }
.rc-col-subcat   { width: 200px; }
.rc-col-cuenta   { width: 140px; }
.rc-col-conc     { width: 110px; }
.rc-col-balance  { width: 100px; }

/* Sticky header */
.rc-thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

.rc-thead th {
    background: var(--dark-card, #1e293b);
    border-bottom: 2px solid rgba(245, 158, 11, 0.25);
    font-size: 0.78rem;
    font-weight: 700;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 8px;
}

/* Nombre column — allow wrapping/tooltip on hover */
.rc-table td.rc-cell-nombre {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

/* Editable cells */
.rc-editable {
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.rc-editable:hover {
    background: rgba(245, 158, 11, 0.06) !important;
    outline: 1px solid rgba(245, 158, 11, 0.2);
}

.rc-editable.rc-editing {
    outline: 2px solid #f59e0b !important;
    background: rgba(245, 158, 11, 0.1) !important;
}

.rc-editable.rc-editing input,
.rc-editable.rc-editing select {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    width: 100%;
    outline: none;
    padding: 0;
}

/* Name column hover — show full text */
.rc-table td.rc-cell-nombre:hover {
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    position: relative;
    z-index: 2;
    background: var(--dark-card, #1e293b);
    box-shadow: 2px 2px 8px rgba(0,0,0,.4);
    border-radius: 4px;
}

/* Money cells */
.rc-money {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.rc-money-pos { color: #10b981; }
.rc-money-neg { color: #ef4444; }
.rc-money-zero { color: #475569; }

/* Read-only balance cells */
.rc-balance {
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-size: 0.78rem;
}

/* Status badge */
.rc-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rc-status-ejecutado {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.rc-status-pendiente {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* Conciliación */
.rc-conc-ok { color: #10b981; }
.rc-conc-no { color: #ef4444; }

/* Row hover */
.rc-table tbody tr:hover td {
    background: rgba(100, 116, 139, 0.04);
}

/* Date cells */
.rc-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #94a3b8;
}

/* Modal */
.rc-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.rc-modal-content {
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

/* Form labels */
.rc-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Save indicator */
.rc-saving {
    opacity: 0.5;
    pointer-events: none;
}

/* ══════════════════════════════════════════
   Aux. Bancos — Summary & Table
   ══════════════════════════════════════════ */

.ab-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.ab-summary-card {
    padding: 14px 18px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.12);
}

.ab-saldo-card {
    border-left: 3px solid #3b82f6;
}

.ab-summary-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.ab-summary-value {
    font-size: 1.3rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    color: #e2e8f0;
}

/* Table container */
.ab-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
    border-radius: 8px;
    border: 1px solid rgba(100, 116, 139, 0.12);
}

.ab-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84rem;
    table-layout: fixed;
}

.ab-table th,
.ab-table td {
    padding: 8px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid rgba(100, 116, 139, 0.06);
}

.ab-thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

.ab-thead th {
    background: var(--dark-card, #1e293b);
    border-bottom: 2px solid rgba(59, 130, 246, 0.25);
    font-size: 0.78rem;
    font-weight: 700;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 12px;
}

/* Money columns */
.ab-money {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ab-money-pos { color: #10b981; }
.ab-money-neg { color: #ef4444; }
.ab-money-zero { color: #475569; }

/* Saldo column (blue) */
.ab-saldo { color: #93c5fd; font-weight: 600; }

/* Date */
.ab-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Row hover */
.ab-table tbody tr:hover td {
    background: rgba(59, 130, 246, 0.04);
}

/* Active day highlight */
.ab-row-today {
    background: rgba(59, 130, 246, 0.06) !important;
}
.ab-row-today td { font-weight: 600; }

/* Conciliación badges */
.ab-conc-val {
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
}
.ab-conc-pos { color: #10b981; }
.ab-conc-neg { color: #ef4444; }
