/* ════════════════════════════════════════════════════════════════
   CATALEIA BANK · Sistema de Préstamos y Cobros
   Paleta: Crema + Coral suave (Marrón profundo · Coral · Crema)
   ════════════════════════════════════════════════════════════════ */

:root {
    /* Marrón primario (oscuro, sólido) */
    --primary: #5C3A2E;
    --primary-dark: #3F2820;
    --primary-light: #8B6F5E;

    /* Coral (acento cálido) */
    --accent: #D85A30;
    --accent-dark: #A3401F;
    --accent-light: #F0997B;

    /* Crema (fondos) */
    --bg: #FAF5F2;
    --bg-soft: #FDFAF8;
    --surface: #FFFFFF;
    --surface-alt: #F5EDE7;

    /* Texto */
    --text: #2C1F18;
    --text-muted: #8B7868;
    --text-soft: #B5A294;
    --text-tertiary: #D4C5B8;

    /* Bordes */
    --border: #ECE0D5;
    --border-soft: #F4ECE3;
    --border-strong: #D9C7B6;

    /* Semánticos */
    --success: #4A7C2F;
    --success-bg: #ECF3E2;
    --danger: #B33A2B;
    --danger-bg: #F9E8E4;
    --warning: #C77A1A;
    --warning-bg: #FBEEDA;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(92,58,46,.05);
    --shadow: 0 4px 12px rgba(92,58,46,.08);
    --shadow-lg: 0 12px 32px rgba(92,58,46,.14);

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }

/* ============ LOGIN ============ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Decoración sutil de fondo */
.login-screen::before,
.login-screen::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.08;
    pointer-events: none;
}
.login-screen::before {
    width: 400px; height: 400px;
    top: -100px; right: -100px;
}
.login-screen::after {
    width: 300px; height: 300px;
    bottom: -80px; left: -80px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px 36px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

.login-brand {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    letter-spacing: -0.5px;
    line-height: 1;
    margin-bottom: 4px;
}

.login-brand-sub {
    font-size: 11px;
    color: var(--accent);
    text-align: center;
    margin-bottom: 28px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
}

.login-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 18px;
    text-align: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.login-error {
    color: var(--danger);
    font-size: 12px;
    min-height: 16px;
    margin-top: 4px;
    margin-bottom: 8px;
    font-weight: 500;
}

.password-wrap { position: relative; }
.btn-eye {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    padding: 4px;
    display: flex;
}
.btn-eye:hover { color: var(--primary); }

.login-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    text-align: center;
}

.powered-by {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--text-soft);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-weight: 500;
}

.powered-logo {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    opacity: 0.7;
}

.powered-logo svg {
    height: 18px;
    width: auto;
}

/* ============ FORM GENERICS ============ */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-size: 14px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    outline: none;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(216,90,48,.12);
}
.form-input-sm { padding: 7px 10px; font-size: 13px; }

/* ============ BUTTONS ============ */
.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    transition: background .15s, transform .05s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.2px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.98); }

.btn-accent {
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
}
.btn-accent:hover { background: var(--accent-dark); }

.btn-secondary {
    background: var(--surface-alt);
    color: var(--text);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
}
.btn-secondary:hover { background: var(--border); }

.btn-full { width: 100%; }

/* ============ HEADER ============ */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--accent-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    font-family: var(--font-display);
    overflow: hidden;
}
.brand-mark svg {
    width: 60%;
    height: 60%;
    display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 17px;
    color: var(--primary);
    letter-spacing: -0.2px;
}
.brand-sub {
    font-size: 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

.header-center { justify-self: center; }
.header-balance {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface-alt);
    padding: 6px 22px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.balance-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.balance-amount {
    font-size: 19px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
    margin-top: 1px;
}

.header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    font-family: var(--font-display);
}
.user-details { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-link {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0;
    transition: color .15s;
}
.user-link:hover { color: var(--accent); }

/* ============ LAYOUT ============ */
.layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 22px 20px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
}

/* ============ SIDEBAR ============ */
.sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    height: fit-content;
    position: sticky;
    top: 80px;
}
.nav-menu { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    transition: background .15s, color .15s;
    text-align: left;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background-color: transparent;
}
.nav-item:hover:not(.disabled) { background: var(--surface-alt); }
.nav-item.active,
button.nav-item.active {
    background-color: var(--accent) !important;
    background-image: none !important;
    color: #fff !important;
    -webkit-tap-highlight-color: transparent;
}
.nav-item.active svg { stroke: #fff !important; }
.nav-item.active .nav-count { background: rgba(255,255,255,.28) !important; color: #fff !important; }
.nav-item.disabled {
    color: var(--text-soft);
    cursor: not-allowed;
    opacity: 0.6;
}
.nav-item svg { flex-shrink: 0; }
.nav-item span:not(.nav-count):not(.nav-soon) { flex: 1; }
.nav-count {
    font-size: 11px;
    background: rgba(255,255,255,.25);
    color: inherit;
    padding: 1px 7px;
    border-radius: 9px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.nav-item:not(.active) .nav-count {
    background: var(--surface-alt);
    color: var(--text-muted);
}
.nav-soon {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-soft);
    background: var(--surface-alt);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
}

/* ============ SECTION HEADERS ============ */
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 14px;
    flex-wrap: wrap;
}
.section-header .card-title { margin-bottom: 2px; }
.section-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============ FILTERS ROW ============ */
.filters-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filters-row .form-input-sm { min-width: 240px; flex: 1; max-width: 360px; }

/* ============ TABLA ============ */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-alt);
}
.data-table th:first-child { border-top-left-radius: var(--radius-sm); }
.data-table th:last-child { border-top-right-radius: var(--radius-sm); }
.data-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--bg-soft); }

.cli-nombre {
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.cli-tel { font-size: 11px; color: var(--text-soft); display: none; }
@media (max-width: 640px) {
    .cli-tel { display: block; }
}

.mora-chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 10px;
    white-space: nowrap;
}
.mora-chip.mora-on { background: var(--warning-bg); color: var(--warning); }
.mora-chip.mora-off { background: var(--surface-alt); color: var(--text-soft); }

.archivado-tag {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface-alt);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.fecha-cell {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.actions-cell { white-space: nowrap; text-align: right; }
.row-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    margin-left: 2px;
    transition: background .15s, color .15s;
}
.row-btn:hover { background: var(--surface-alt); color: var(--primary); }
.row-btn-danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-icon { font-size: 36px; color: var(--accent); opacity: 0.5; margin-bottom: 10px; }
.empty-state p { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-state span { font-size: 12px; }

/* ============ TOGGLE ============ */
.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
}
.filter-toggle input { display: none; }
.toggle-track {
    width: 32px;
    height: 18px;
    background: var(--border-strong);
    border-radius: 18px;
    position: relative;
    transition: background .15s;
    flex-shrink: 0;
}
.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform .15s;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.filter-toggle input:checked + .toggle-track { background: var(--accent); }
.filter-toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(14px); }

/* ============ MODALES ============ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(63, 40, 32, .55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; }
#modalBackdrop { z-index: 300; }

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-icon { font-size: 30px; color: var(--warning); margin-bottom: 6px; }
.modal-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--primary);
}
.modal-msg { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Modal de form (más grande) */
.modal-form {
    max-width: 560px;
    text-align: left;
}
.modal-header-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
    text-align: left;
    gap: 12px;
}
.modal-header-inner .modal-title { margin-bottom: 2px; }
.modal-sub { font-size: 12px; color: var(--text-muted); }
.btn-close-modal {
    color: var(--text-muted);
    font-size: 24px;
    padding: 0 6px;
    line-height: 1;
    flex-shrink: 0;
}
.btn-close-modal:hover { color: var(--accent); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
}
.btn-danger:hover { background: #8E2E22; }

/* ============ FORMS ============ */
.form-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}
.form-section:last-of-type { border-bottom: none; padding-bottom: 0; margin-bottom: 14px; }
.form-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent-dark);
    margin-bottom: 12px;
    font-weight: 700;
}
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-textarea {
    resize: vertical;
    min-height: 50px;
    font-family: inherit;
    line-height: 1.5;
}
.form-hint {
    font-size: 11px;
    color: var(--text-soft);
    margin-top: 4px;
}
.form-error {
    color: var(--danger);
    font-size: 12px;
    min-height: 16px;
    margin: 4px 0 12px;
    font-weight: 500;
}
.req { color: var(--danger); font-weight: 700; }

/* ============ MAIN ============ */
.main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary);
    letter-spacing: -0.3px;
}

/* ============ LOADING ============ */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ FOOTER ============ */
.app-footer {
    text-align: center;
    padding: 14px 0 4px;
    color: var(--text-soft);
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 50px));
    background: var(--primary);
    color: #fff;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 500;
    z-index: 200;
    transition: transform .25s;
    max-width: 90%;
    text-align: center;
    pointer-events: none;
    opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
    .header-inner {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 8px 12px;
    }
    .brand { grid-column: 1; grid-row: 1; }
    .header-actions { grid-column: 2; grid-row: 1; justify-self: end; }
    .header-center {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
    }
    .header-balance {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 6px 14px;
        width: 100%;
    }
    .header-balance .balance-label::after { content: ":"; }
    .balance-amount { font-size: 16px; }
    .layout { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
    .sidebar { position: static; }
}

@media (max-width: 640px) {
    .header-inner { padding: 0 12px; }
    .brand-text { display: none; }
    .user-details { display: none; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .filters-row .form-input-sm { min-width: 0; max-width: none; width: 100%; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 6px; }
    .modal { padding: 18px; }
}

@media (max-width: 480px) {
    .login-card { padding: 32px 24px 22px; }
    .login-brand { font-size: 26px; }
}

/* ============ HEADER BALANCE MULTIMONEDA ============ */
.header-balance {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface-alt);
    padding: 6px 22px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.balance-monedas {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.balance-amount {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.2px;
}
.balance-amount-neg { color: var(--danger); }
.balance-sep {
    color: var(--text-soft);
    font-weight: 400;
}
.balance-empty {
    font-size: 16px;
    color: var(--text-soft);
    font-weight: 500;
}

/* ============ TOTALES POR MONEDA ============ */
.totales-monedas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.total-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}
.total-card::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.18;
    top: -30px;
    right: -30px;
}
.total-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    font-weight: 500;
    position: relative;
    z-index: 1;
}
.total-card-value {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.4px;
    position: relative;
    z-index: 1;
}
.total-card-neg .total-card-value { color: #FFD7CE; }

/* ============ BILLETERAS GRID ============ */
.billeteras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.billetera-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--bc, var(--accent));
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow .15s, transform .1s;
}
.billetera-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.bil-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.bil-info { flex: 1; min-width: 0; }
.bil-nombre {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bil-moneda {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.bil-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity .15s;
}
.billetera-card:hover .bil-actions { opacity: 1; }
.bil-saldo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
}
.bil-saldo-neg { color: var(--danger); }
.bil-footer {
    font-size: 11px;
    color: var(--text-soft);
    padding-top: 4px;
    border-top: 1px solid var(--border-soft);
}

/* ============ SECTION DIVIDER ============ */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0 20px;
}
.subsection-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

/* ============ MOVIMIENTOS TABLE ============ */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.type-income { background: var(--success-bg); color: var(--success); }
.type-expense { background: var(--danger-bg); color: var(--danger); }
.type-transfer { background: var(--warning-bg); color: var(--warning); }

.bil-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--c, var(--primary));
    white-space: nowrap;
}

.amount-pos { color: var(--success); font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-neg { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-neutral { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }

/* ============ COLOR PICKER ============ */
.color-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--c);
    border: 2px solid transparent;
    transition: transform .1s, border-color .15s;
    padding: 0;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text); }

/* ============ MISC ============ */
.moneda-tag {
    font-size: 9px;
    background: var(--surface-alt);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-left: 4px;
}
.form-span-full { grid-column: 1 / -1; }
.movimientos-wrap { margin-top: 8px; }

@media (max-width: 640px) {
    .balance-monedas { gap: 6px; }
    .balance-amount { font-size: 15px; }
    .billeteras-grid { grid-template-columns: 1fr; }
    .bil-actions { opacity: 1; }
    .total-card-value { font-size: 18px; }
}

/* ════════════════════════════════════════════════
   BLOQUE 3 — PRÉSTAMOS
   ════════════════════════════════════════════════ */

/* Tipo de carga: switch nuevo / histórico */
.tipo-carga-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}
.tc-btn {
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    text-align: left;
    transition: all .15s;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
}
.tc-btn:hover { border-color: var(--border-strong); }
.tc-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: var(--primary-dark);
}
.tc-btn.active .tc-desc { color: rgba(255,255,255,0.85); }
.tc-title {
    font-size: 13px;
    font-weight: 700;
    color: inherit;
}
.tc-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Sistema picker (Recargo Simple / Francés / Alemán) */
.sistema-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sistema-opt {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    background: var(--surface);
}
.sistema-opt:hover { background: var(--bg-soft); }
.sistema-opt.active {
    border-color: var(--accent);
    background: var(--surface-alt);
}
.sistema-opt input { margin-top: 2px; accent-color: var(--accent); }
.sistema-content { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sistema-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.sistema-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.45;
}
.sistema-desc b { color: var(--accent-dark); font-weight: 700; }

/* Preview de cronograma */
.preview-resumen { margin-bottom: 14px; }
.prev-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.prev-stat {
    background: var(--surface-alt);
    padding: 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.prev-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.prev-stat-value {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.preview-cuotas {
    margin-top: 12px;
}
.preview-cuotas summary {
    cursor: pointer;
    padding: 8px 12px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark);
    user-select: none;
    list-style: none;
}
.preview-cuotas summary::before {
    content: '▸ ';
    margin-right: 4px;
    display: inline-block;
    transition: transform .15s;
}
.preview-cuotas[open] summary::before { content: '▾ '; }
.preview-cuotas summary:hover { background: var(--border-soft); }
.preview-table {
    margin-top: 10px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.cuota-pagada-prev {
    opacity: 0.55;
    background: var(--success-bg);
}

/* Lista de préstamos */
.prestamo-capital {
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.avance-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 110px;
}
.avance-bar {
    flex: 1;
    height: 6px;
    background: var(--border-soft);
    border-radius: 3px;
    overflow: hidden;
}
.avance-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #6FAA4D);
    transition: width .2s;
}
.avance-text {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.estado-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.estado-activo { background: var(--surface-alt); color: var(--primary); }
.estado-vencido { background: var(--danger-bg); color: var(--danger); }
.estado-pagado { background: var(--success-bg); color: var(--success); }
.estado-pend { background: var(--warning-bg); color: var(--warning); }

/* Detalle préstamo */
.btn-link {
    background: none;
    color: var(--accent);
    padding: 4px 0;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-link:hover { color: var(--accent-dark); text-decoration: underline; }

.prestamo-resumen { margin-top: 8px; }
.resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.resumen-item {
    background: var(--surface-alt);
    padding: 13px 16px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-left: 3px solid var(--accent);
}
.resumen-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 600;
}
.resumen-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}
.resumen-sub {
    font-size: 11px;
    color: var(--text-soft);
    line-height: 1.4;
}

/* Filas de cuotas en detalle */
.cuota-row { transition: background .12s; }
.cuota-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--surface-alt);
    border-radius: 50%;
    font-weight: 700;
    font-size: 12px;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.cuota-total {
    font-weight: 700;
    color: var(--primary);
}
.cuota-pagada { opacity: 0.65; }
.cuota-pagada .cuota-total { color: var(--success); }
.cuota-vencida .cuota-total { color: var(--danger); }

.total-card-sub {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

/* Modal largo (préstamo) */
.modal-large {
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 640px) {
    .tipo-carga-switch { grid-template-columns: 1fr; }
    .resumen-grid { grid-template-columns: 1fr; }
    .prev-stats { grid-template-columns: 1fr 1fr; }
    .prestamo-capital { font-size: 13px; }
}

/* ════════════════════════════════════════════════
   BLOQUE 4 — COBROS Y RECIBOS
   ════════════════════════════════════════════════ */

/* Acciones del detalle del préstamo */
.detalle-acciones {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Botón cobrar en la tabla de cuotas */
.btn-row-cobrar {
    background: var(--accent);
    color: #fff;
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    transition: background .15s, transform .05s;
    cursor: pointer;
    white-space: nowrap;
}
.btn-row-cobrar:hover { background: var(--accent-dark); }
.btn-row-cobrar:active { transform: scale(.96); }

.cuota-locked {
    color: var(--text-soft);
    font-size: 14px;
    opacity: 0.5;
}

/* Estado parcial en cuotas */
.cuota-parcial-info {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3;
    display: block;
    margin-top: 2px;
}

/* Info de cuota dentro del modal de cobro */
.cobro-cuota-info,
.cancelacion-resumen {
    background: var(--surface-alt);
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border-left: 3px solid var(--accent);
}
.cobro-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.cobro-info-grid > div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.cobro-info-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.cobro-info-grid > div > span:last-child {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Recibo en tabla de cobros */
.recibo-num {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--primary);
    font-size: 13px;
}

/* Fila anulada en cobros */
.cobro-anulado {
    opacity: 0.55;
    background: var(--danger-bg);
}
.cobro-anulado .amount-pos { color: var(--text-muted); text-decoration: line-through; }
.cobro-anulado:hover { background: var(--danger-bg); }

@media (max-width: 640px) {
    .detalle-acciones { width: 100%; }
    .detalle-acciones button { flex: 1; font-size: 12px; padding: 10px; }
    .cobro-info-grid { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════
   BLOQUE 5 — MORA
   ════════════════════════════════════════════════ */

/* Caja de mora en el modal de cobro */
.mora-box {
    background: var(--warning-bg);
    border: 1px solid #E8C68A;
    border-left: 3px solid var(--warning);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}
.mora-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    flex-wrap: wrap;
}
.mora-box-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--warning);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mora-box-dias {
    font-size: 11px;
    color: var(--text-muted);
    background: #FFF;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 600;
}
.mora-box-grid { margin-bottom: 0; }

.mora-calculada {
    background: #FFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 12px;
    color: var(--text);
    line-height: 1.4;
    min-height: 36px;
}
.mora-calc-detail { margin-bottom: 4px; }
.mora-calc-detail:last-child { margin-bottom: 0; }
.mora-calc-detail.mora-arrastrada {
    color: var(--danger);
    border-top: 1px dashed var(--border);
    padding-top: 4px;
    margin-top: 4px;
}

/* Caja de total a cobrar (con mora) */
.cobro-total-box {
    background: var(--surface-alt);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 12px;
}
.cobro-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-muted);
}
.cobro-total-row span:first-child {
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.cobro-total-final {
    border-top: 1.5px solid var(--border-strong);
    margin-top: 6px;
    padding-top: 10px;
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
}
.cobro-total-final span:first-child { color: var(--primary); font-size: 11px; }
.cobro-total-final span:last-child {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* Etiqueta de mora en la tabla de cuotas */
.mora-tag {
    display: inline-block;
    font-size: 10px;
    color: var(--warning);
    background: var(--warning-bg);
    padding: 2px 7px;
    border-radius: 8px;
    margin-top: 3px;
    font-weight: 600;
    white-space: nowrap;
}
.mora-tag.mora-pendiente {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Card de mora pendiente en el resumen del préstamo */
.resumen-mora {
    border-left-color: var(--danger) !important;
    background: var(--danger-bg) !important;
}
.resumen-mora .resumen-value { color: var(--danger) !important; }
.resumen-mora .resumen-label { color: var(--danger) !important; }

/* Botón cobrar mora (variante) */
.btn-row-mora {
    background: var(--warning);
}
.btn-row-mora:hover { background: var(--accent-dark); }

@media (max-width: 640px) {
    .mora-box-header { flex-direction: column; align-items: flex-start; }
}

/* ════════════════════════════════════════════════
   BLOQUE 6 — DASHBOARD
   ════════════════════════════════════════════════ */

.dashboard-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-list-icon { font-size: 16px; }

.dashboard-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.dashboard-controls .form-input-sm { min-width: 160px; }

/* KPI cards */
.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.kpi-card {
    padding: 16px 18px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: transform .1s, box-shadow .15s;
}
.kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.kpi-card::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.08;
    top: -40px;
    right: -30px;
}
.kpi-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.kpi-primary::before { background: var(--accent); opacity: 0.18; }
.kpi-success {
    background: linear-gradient(135deg, #4A7C2F, #3A6325);
    color: #fff;
}
.kpi-success::before { background: #97C459; opacity: 0.2; }
.kpi-danger {
    background: linear-gradient(135deg, var(--danger), #8E2E22);
    color: #fff;
}
.kpi-danger::before { background: #FFB8A8; }
.kpi-warning {
    background: linear-gradient(135deg, var(--warning), #A5640D);
    color: #fff;
}
.kpi-warning::before { background: #FFD78C; }
.kpi-neutral {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}
.kpi-neutral::before { background: var(--accent); }
.kpi-empty {
    background: var(--surface-alt) !important;
    color: var(--text-muted) !important;
    border: 1px dashed var(--border-strong);
}
.kpi-empty .kpi-value { color: var(--text-soft) !important; }

.kpi-header {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
}
.kpi-icon { font-size: 16px; }
.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    opacity: 0.9;
}
.kpi-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.4px;
    position: relative;
    z-index: 1;
    line-height: 1.1;
    margin-top: 2px;
}
.kpi-neutral .kpi-value { color: var(--primary); }
.kpi-sub {
    font-size: 11px;
    opacity: 0.85;
    position: relative;
    z-index: 1;
    line-height: 1.4;
}
.kpi-trend {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.9;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}
.kpi-up { color: #C0EFB7 !important; }
.kpi-down { color: #FFD7CE !important; }

/* Gráfico SVG */
.chart-wrap {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}
.chart-svg-wrap { width: 100%; overflow-x: auto; }
.chart-svg {
    width: 100%;
    min-width: 480px;
    height: auto;
}
.chart-grid {
    stroke: var(--border);
    stroke-width: 0.6;
    stroke-dasharray: 3,3;
}
.chart-bar { transition: opacity .12s; cursor: default; }
.chart-bar:hover { opacity: 0.85; }
.chart-axis-label {
    font-size: 10px;
    fill: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 500;
}
.chart-value-label {
    font-size: 9px;
    fill: var(--primary);
    font-family: var(--font-body);
    font-weight: 700;
}
.chart-legend {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}
.legend-note {
    font-size: 10px;
    opacity: 0.7;
    font-style: italic;
}
.chart-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-soft);
    font-size: 13px;
}

/* Listas del dashboard */
.dash-lists-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 8px;
}
.dash-list { min-width: 0; }

.dash-cuota-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    margin-bottom: 6px;
    transition: background .12s, transform .05s;
    cursor: pointer;
    gap: 10px;
}
.dash-cuota-row:hover {
    background: var(--bg-soft);
    border-color: var(--border);
}
.dash-cuota-row.dash-cuota-vencida {
    background: var(--danger-bg);
    border-color: #F0CCC4;
}
.dash-cuota-row.dash-cuota-vencida:hover { background: #F5DDD7; }
.dash-cuota-info { flex: 1; min-width: 0; }
.dash-cliente {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-cuota-meta {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.dash-cuota-monto {
    text-align: right;
    flex-shrink: 0;
}
.dash-monto {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}
.dash-dias {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 700;
    margin-top: 2px;
}
.dias-hoy { color: var(--accent); }
.dias-pronto { color: var(--warning); }
.dias-futuro { color: var(--text-soft); }
.dias-vencido { color: var(--danger); }

.dash-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-soft);
    font-size: 12px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
}

/* Top clientes */
.dash-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}
.dash-top-rank {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    font-family: var(--font-display);
}
.dash-top-info { flex: 1; min-width: 0; }

@media (max-width: 980px) {
    .dash-lists-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .kpis-grid { grid-template-columns: 1fr; }
    .kpi-value { font-size: 20px; }
    .chart-svg { min-width: 360px; }
    .dashboard-controls { width: 100%; }
    .dashboard-controls .form-input-sm { flex: 1; min-width: 0; }
}

/* ════════════════════════════════════════════════
   BLOQUE 7 — ESTADO DE CUENTA PDF
   ════════════════════════════════════════════════ */

/* Wrapper para botones de acción en detalle préstamo
   (permite que "Estado de Cuenta" siempre se vea aunque el préstamo esté pagado) */
.detalle-acciones-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* Preview del Estado de Cuenta en el modal */
.estado-cuenta-preview {
    background: var(--surface-alt);
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border-left: 3px solid var(--accent);
}
.ec-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}
.ec-preview-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
}
.ec-prev-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 600;
}
.ec-prev-val {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.ec-preview-saldo {
    border-left: 2px solid var(--accent);
}
.ec-preview-saldo .ec-prev-val { color: var(--primary); }
.ec-preview-mora {
    border-left: 2px solid var(--danger);
    background: var(--danger-bg);
}
.ec-preview-mora .ec-prev-val { color: var(--danger); }

/* Textarea para observaciones */
.form-textarea {
    resize: vertical;
    min-height: 70px;
    font-family: var(--font-body);
    line-height: 1.5;
}

@media (max-width: 640px) {
    .detalle-acciones-wrap { width: 100%; align-items: stretch; }
    .ec-preview-grid { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════
   CONFIGURACIÓN DEL NEGOCIO + LOGIN AVALDZ
   ════════════════════════════════════════════════ */

/* Logo AVALDZ grande en el login */
.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.login-logo-avaldz {
    width: 80px;
    height: 72px;
    color: var(--primary);
    display: inline-block;
}
.login-logo-avaldz svg {
    width: 100%;
    height: 100%;
}

.login-version {
    font-size: 11px;
    color: var(--text-soft);
    letter-spacing: 0.5px;
}

/* Modal de configuración: caja de bienvenida */
.config-intro {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: linear-gradient(135deg, var(--surface-alt), #FFFFFF);
    border-left: 3px solid var(--accent);
    padding: 16px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.config-intro-icon {
    font-size: 28px;
    line-height: 1;
}
.config-intro-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 4px 0;
}
.config-intro-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Botón de configuración en el header */
#configBtn {
    color: var(--text-muted);
}
#configBtn:hover {
    color: var(--accent);
}

@media (max-width: 640px) {
    .login-logo-avaldz { width: 64px; height: 58px; }
    .config-intro { flex-direction: column; gap: 8px; }
}
