/* ==========================================================================
   Sistema de diseño · Bootstrap 5.3 + estilos propios
   Para cambiar la marca, edita las variables de color de :root.
   ========================================================================== */

:root {
    /* Marca */
    --brand: #10b981;
    --brand-600: #059669;
    --brand-700: #047857;
    --brand-100: #d1fae5;
    --brand-50: #ecfdf5;

    /* Semánticos */
    --income: #10b981;
    --expense: #ef4444;
    --info: #3b82f6;
    --warning: #f59e0b;

    /* Neutros */
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e6ebef;
    --surface: #ffffff;
    --bg: #f5f7f8;

    /* Forma */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);

    --sidebar-w: 264px;
    --topbar-h: 64px;

    --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Ajustes a las variables de Bootstrap */
    --bs-primary: var(--brand);
    --bs-primary-rgb: 16, 185, 129;
    --bs-success: #10b981;
    --bs-success-rgb: 16, 185, 129;
    --bs-danger: #ef4444;
    --bs-danger-rgb: 239, 68, 68;
    --bs-warning: #f59e0b;
    --bs-warning-rgb: 245, 158, 11;
    --bs-info: #3b82f6;
    --bs-info-rgb: 59, 130, 246;
    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: .9375rem;
    --bs-body-color: var(--ink-2);
    --bs-body-color-rgb: 51, 65, 85;
    --bs-body-bg: var(--bg);
    --bs-body-bg-rgb: 245, 247, 248;
    --bs-heading-color: var(--ink);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius-sm);
    --bs-link-color: var(--brand-600);
    --bs-link-color-rgb: 5, 150, 105;
    --bs-link-hover-color: var(--brand-700);
    --bs-link-hover-color-rgb: 4, 120, 87;
    --bs-secondary-color: var(--muted);
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink-2);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { color: var(--ink); letter-spacing: -.01em; }

/* ---------- Utilidades ---------- */
.text-income { color: var(--income) !important; }
.text-expense { color: var(--expense) !important; }
.text-warn { color: #d97706 !important; }
.text-muted-2 { color: var(--muted-2) !important; }
.fw-600 { font-weight: 600; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Estructura: menú lateral + contenido
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* Menú lateral */
.app-sidebar { --bs-offcanvas-width: 284px; --bs-offcanvas-bg: #fff; }
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 1.25rem 1rem 1rem;
    background: #fff;
    border-right: 1px solid var(--line);
}
@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        flex: 0 0 var(--sidebar-w);
        width: var(--sidebar-w);
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .25rem .5rem 1.5rem;
}
.brand-link { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand-link:hover { color: var(--ink); }
.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #34d399 0%, var(--brand) 55%, var(--brand-600) 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    box-shadow: 0 8px 18px rgba(16, 185, 129, .32);
    flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em; }

.sidebar-nav { display: flex; flex-direction: column; gap: .3rem; flex: 1 1 auto; overflow-y: auto; }
.nav-item-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .72rem .95rem;
    border-radius: 12px;
    color: var(--ink-2);
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav-item-link i { font-size: 1.15rem; color: var(--muted); transition: color .15s ease; }
.nav-item-link:hover { background: #f1f5f4; color: var(--ink); }
.nav-item-link:hover i { color: var(--ink-2); }
.nav-item-link.active {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(16, 185, 129, .28);
}
.nav-item-link.active i { color: #fff; }

.sidebar-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: .75rem;
    color: var(--muted-2);
}

/* Barra superior */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.25rem;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
@media (min-width: 1200px) { .app-topbar { padding: 0 2.25rem; } }

.btn-icon {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink-2);
    font-size: 1.3rem;
    line-height: 1;
}
.btn-icon:hover { background: #f1f5f4; }

.user-menu {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .3rem .6rem .3rem .3rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font-weight: 600;
}
.user-menu:hover, .user-menu[aria-expanded="true"] { background: #f1f5f4; border-color: var(--line); }
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .02em;
}
.user-name { font-size: .9rem; }
.user-dropdown { min-width: 230px; border-radius: 14px; border-color: var(--line); box-shadow: 0 12px 32px rgba(15, 23, 42, .12); padding: .4rem; }
.user-dropdown .dropdown-item { border-radius: 8px; padding: .55rem .75rem; font-weight: 500; }
.user-dropdown .dropdown-item:hover { background: #f1f5f4; }
.user-dropdown .dropdown-item.text-danger:hover { background: #fdeaea; }

/* Contenido */
.app-content { flex: 1 0 auto; width: 100%; max-width: 1320px; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; }
@media (min-width: 1200px) { .app-content { padding: 2rem 2.25rem 2.5rem; } }
.app-footer { padding: 1rem 1.25rem 1.5rem; text-align: center; font-size: .78rem; color: var(--muted-2); }

.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.75rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-subtitle { margin: .2rem 0 0; color: var(--muted); }

/* ==========================================================================
   Tarjetas
   ========================================================================== */
.card-soft {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--line);
}
.card-pad { padding: 1.4rem; }
.card-heading { margin: 0; font-size: 1rem; font-weight: 700; color: var(--ink); }
.card-sub { margin: .15rem 0 0; font-size: .8rem; color: var(--muted); }

/* Tarjetas de indicadores */
.stat-card { padding: 1.25rem 1.4rem; height: 100%; }
.stat-label { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat-value {
    margin-top: .4rem;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: -.03em;
    color: var(--ink);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.stat-value.pos { color: var(--income); }
.stat-value.neg { color: var(--expense); }
.stat-value.warn { color: #d97706; }
.stat-foot { margin-top: .85rem; font-size: .78rem; color: var(--muted); }
.stat-foot a { font-weight: 600; text-decoration: none; }

.icon-chip {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.icon-chip--green  { background: #e6f8ef; color: var(--brand-600); }
.icon-chip--red    { background: #fdeceb; color: #dc2626; }
.icon-chip--blue   { background: #e8f0fe; color: #2563eb; }
.icon-chip--amber  { background: #fef3dc; color: #d97706; }
.icon-chip--slate  { background: #eef2f6; color: #475569; }
.icon-chip--purple { background: #f1ebfe; color: #7c3aed; }

.trend { display: inline-flex; align-items: center; gap: .25rem; font-weight: 600; }
.trend.good { color: var(--income); }
.trend.bad { color: var(--expense); }
.trend.flat { color: var(--muted); }

/* Gráficos */
.chart-box { position: relative; height: 300px; }
.chart-box--lg { height: 340px; }
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 200px;
    padding: 1.5rem;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
}
.empty-state i { font-size: 2.2rem; color: var(--muted-2); }

/* ==========================================================================
   Etiquetas (badges) suaves
   ========================================================================== */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .32rem .7rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.badge-soft-success   { background: #e3f8ef; color: #047857; }
.badge-soft-danger    { background: #fdeaea; color: #b91c1c; }
.badge-soft-warning   { background: #fef3dc; color: #b45309; }
.badge-soft-info      { background: #e5efff; color: #1d4ed8; }
.badge-soft-secondary { background: #eef1f5; color: #475569; }

/* ==========================================================================
   Tablas
   ========================================================================== */
.table-modern { --bs-table-bg: transparent; margin: 0; }
.table-modern thead th {
    padding: .8rem 1.1rem;
    background: #f8fafb;
    border-bottom: 1px solid var(--line);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}
.table-modern tbody td { padding: .9rem 1.1rem; border-color: var(--line); vertical-align: middle; }
.table-modern tbody tr:last-child td { border-bottom: 0; }
.table-modern tbody tr:hover { background: #fafcfb; }
.cell-note { margin-top: .15rem; font-size: .76rem; color: var(--muted-2); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amount { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.btn-action {
    --bs-btn-padding-y: .3rem;
    --bs-btn-padding-x: .55rem;
    --bs-btn-font-size: .85rem;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

/* Lista móvil */
.item-card { padding: 1rem 1.1rem; }
.item-card + .item-card { margin-top: .75rem; }

/* ==========================================================================
   Botones, formularios y componentes de Bootstrap
   ========================================================================== */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--radius-sm);
    --bs-btn-padding-y: .55rem;
    --bs-btn-padding-x: 1.1rem;
}
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--brand-700);
    --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: 16, 185, 129;
    box-shadow: 0 6px 14px rgba(16, 185, 129, .22);
}
.btn-danger {
    --bs-btn-bg: var(--expense);
    --bs-btn-border-color: var(--expense);
    --bs-btn-hover-bg: #dc2626;
    --bs-btn-hover-border-color: #dc2626;
    --bs-btn-active-bg: #b91c1c;
    --bs-btn-active-border-color: #b91c1c;
    --bs-btn-focus-shadow-rgb: 239, 68, 68;
}
.btn-outline-danger {
    --bs-btn-color: #dc2626;
    --bs-btn-border-color: #f3b4b4;
    --bs-btn-hover-bg: var(--expense);
    --bs-btn-hover-border-color: var(--expense);
    --bs-btn-active-bg: var(--expense);
    --bs-btn-active-border-color: var(--expense);
    --bs-btn-focus-shadow-rgb: 239, 68, 68;
}
.btn-outline-success {
    --bs-btn-color: var(--brand-700);
    --bs-btn-border-color: #a7e6cf;
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: 16, 185, 129;
}
.btn-outline-primary {
    --bs-btn-color: var(--brand-600);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--brand-600);
    --bs-btn-active-border-color: var(--brand-600);
    --bs-btn-focus-shadow-rgb: 16, 185, 129;
}
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #f1f5f4; --bs-btn-hover-border-color: #d6dde3; }
.btn-soft-danger { background: #fdeaea; color: #b91c1c; border-color: transparent; }
.btn-soft-danger:hover { background: #fbd5d5; color: #991b1b; }
.btn-soft-warning { background: #fef3dc; color: #b45309; border-color: transparent; }
.btn-soft-warning:hover { background: #fde7b8; color: #92400e; }
.btn-soft-primary { background: var(--brand-50); color: var(--brand-700); border-color: transparent; }
.btn-soft-primary:hover { background: var(--brand-100); color: var(--brand-700); }

.form-label { margin-bottom: .35rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.form-control, .form-select {
    min-height: 44px;
    padding: .6rem .9rem;
    border-color: #dbe2e8;
    border-radius: var(--radius-sm);
    color: var(--ink);
}
.form-control, .form-select,
.form-control:focus, .form-select:focus { background-color: #fff; }
.form-control:disabled, .form-select:disabled { background-color: #f1f5f4; }
.form-control::placeholder { color: var(--muted-2); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .22rem rgba(16, 185, 129, .15);
}
textarea.form-control { min-height: 0; }
.input-group-text { background: #f8fafb; border-color: #dbe2e8; color: var(--muted); font-weight: 600; }
.input-group > .form-control:focus { z-index: 3; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .22rem rgba(16, 185, 129, .15); }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; cursor: pointer; }
.form-check-label { cursor: pointer; color: var(--ink-2); }

.alert { border: 0; border-radius: var(--radius-sm); font-size: .9rem; }
.alert-danger { background: #fdeaea; color: #991b1b; }
.alert-success { background: #e3f8ef; color: #065f46; }

.progress { height: 6px; border-radius: 999px; background: #eaf0ef; }
.progress-bar { background: var(--brand); border-radius: 999px; }

.pagination {
    --bs-pagination-color: var(--ink-2);
    --bs-pagination-border-color: var(--line);
    --bs-pagination-border-radius: 10px;
    --bs-pagination-hover-color: var(--brand-700);
    --bs-pagination-hover-bg: var(--brand-50);
    --bs-pagination-hover-border-color: var(--brand-100);
    --bs-pagination-focus-color: var(--brand-700);
    --bs-pagination-focus-bg: var(--brand-50);
    --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .15);
    --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand);
    --bs-pagination-disabled-color: #c3ccd5;
    gap: .25rem;
}
.page-link { border-radius: 10px !important; font-weight: 600; }

.dropdown-menu { --bs-dropdown-link-active-bg: var(--brand); }

/* Atajos / chips */
.chip-btn {
    padding: .3rem .8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink-2);
    font-size: .8rem;
    font-weight: 600;
}
.chip-btn:hover { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }

.period-box { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fcfdfd; }
.period-tag {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .75rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink);
}
.period-dot { width: 10px; height: 10px; border-radius: 3px; }
.period-dot.a { background: #475569; }
.period-dot.b { background: #cbd5e1; border: 1px solid #94a3b8; }

/* Estado del dashboard */
.status-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .9rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }

/* ==========================================================================
   SweetAlert2 con el estilo de la app
   ========================================================================== */
.swal-app { border-radius: var(--radius-lg) !important; font-family: var(--font-sans) !important; padding: 1.5rem 1.25rem !important; }
.swal-app .swal2-title { font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.swal-app .swal2-html-container { color: var(--ink-2); }
.swal-app .swal2-actions { gap: .25rem; }
.swal-toast-app { border-radius: 12px !important; font-family: var(--font-sans) !important; box-shadow: 0 12px 32px rgba(15, 23, 42, .16) !important; }

/* ==========================================================================
   Pantallas de acceso (login / registro)
   ========================================================================== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: #fff; }
@media (min-width: 992px) { .auth-wrap { grid-template-columns: 1.05fr 1fr; } }

.auth-aside {
    position: relative;
    display: none;
    overflow: hidden;
    padding: 3rem 3.5rem;
    color: #fff;
    background: linear-gradient(150deg, #022c22 0%, #047857 52%, #10b981 100%);
}
@media (min-width: 992px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside::before, .auth-aside::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}
.auth-aside::before { width: 420px; height: 420px; right: -140px; top: -120px; }
.auth-aside::after { width: 320px; height: 320px; left: -110px; bottom: -110px; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .brand-link { color: #fff; }
.auth-aside .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; border: 1px solid rgba(255, 255, 255, .25); }
.auth-headline { font-size: 2.1rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; color: #fff; max-width: 440px; }
.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 1.1rem; max-width: 440px; }
.auth-points li { display: flex; gap: .9rem; align-items: flex-start; color: rgba(255, 255, 255, .88); }
.auth-points .pt-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .14);
    font-size: 1.05rem;
    flex-shrink: 0;
}
.auth-points strong { display: block; color: #fff; font-weight: 600; }
.auth-points span.d { font-size: .88rem; }
.auth-aside small { color: rgba(255, 255, 255, .6); }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: #fff; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand-link { margin-bottom: 2rem; }
.auth-title { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.75rem; }
.auth-card .input-group-text { background: #fff; border-right: 0; }
.auth-card .input-group .form-control { border-left: 0; }
.auth-card .input-group .btn-eye { border: 1px solid #dbe2e8; border-left: 0; background: #fff; color: var(--muted); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.auth-card .input-group:focus-within .input-group-text,
.auth-card .input-group:focus-within .btn-eye { border-color: var(--brand); }
.auth-card .input-group:focus-within { box-shadow: 0 0 0 .22rem rgba(16, 185, 129, .15); border-radius: var(--radius-sm); }
.auth-card .input-group .form-control:focus { box-shadow: none; }
.min-w-0 { min-width: 0; }

/* Tarjetas de indicadores compactas (varias en una fila) */
.stat-card--compact { padding: 1.05rem 1.15rem; }
.stat-card--compact .stat-value { font-size: 1.3rem; margin-top: .55rem; }
.icon-chip--sm { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; }
.amount-nowrap, .stat-value, .amount { white-space: nowrap; }

/* ==========================================================================
   Comparativa entre períodos: lista de barras por categoría
   ========================================================================== */
.cmp-legend { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.cmp-legend > span { display: inline-flex; align-items: center; gap: .45rem; }
.cmp-swatch { display: inline-block; width: 22px; height: 10px; border-radius: 999px; }
.cmp-swatch.a { background: #475569; }
.cmp-swatch.b { background: rgba(71, 85, 105, .25); box-shadow: inset 0 0 0 1px #94a3b8; }

.cmp-list { display: flex; flex-direction: column; }
.cmp-row { padding: 0 0 1.1rem; margin-bottom: 1.1rem; border-bottom: 1px dashed var(--line); }
.cmp-row:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .6rem; }
.cmp-name { display: flex; align-items: center; gap: .55rem; min-width: 0; font-weight: 600; color: var(--ink); }
.cmp-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 3px; }
.cmp-line + .cmp-line { margin-top: .75rem; }
.cmp-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: .3rem; }
.cmp-period { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.cmp-period--b { font-weight: 500; color: var(--muted); }
.cmp-period .cmp-swatch { flex-shrink: 0; width: 14px; height: 8px; }
.cmp-track { height: 10px; border-radius: 999px; background: #f0f4f3; overflow: hidden; }
.cmp-bar { height: 100%; border-radius: 999px; transition: width .45s ease; }
.cmp-val { flex-shrink: 0; text-align: right; white-space: nowrap; font-family: var(--font-mono); font-size: .82rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.cmp-val--b { font-weight: 500; color: var(--muted); }
@media (max-width: 575.98px) {
    .cmp-head { align-items: flex-start; }
    .cmp-name-text { white-space: normal; overflow: visible; line-height: 1.3; }
}

/* ==========================================================================
   Cuentas
   ========================================================================== */
.cell-cuenta { margin-top: .2rem; font-size: .76rem; color: var(--muted-2); white-space: nowrap; }
.cell-cuenta i { margin-right: .3rem; }
.cell-cuenta--none { font-style: italic; }

.btn-icon--sm { width: 32px; height: 32px; font-size: 1.05rem; border-radius: 9px; }

.cuenta-card { padding: 1.25rem 1.35rem; }
.cuenta-saldo { margin-top: 1rem; font-family: var(--font-mono); font-size: 1.65rem; font-weight: 700; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cuenta-meta { margin-top: .75rem; display: grid; gap: .3rem; font-size: .8rem; }
.cuenta-meta > div { display: flex; justify-content: space-between; gap: .75rem; }
.cuenta-meta span { color: var(--muted); }
.cuenta-meta strong { font-family: var(--font-mono); font-weight: 600; font-size: .78rem; }

.cuenta-mini { height: 100%; padding: .95rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fcfdfd; }
.cuenta-mini .mono { font-size: 1.15rem; white-space: nowrap; }

/* Interruptor: la perilla no se pone azul al enfocarlo */
.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
}

/* ==========================================================================
   Pago dividido entre varias cuentas
   ========================================================================== */
.pc-fila { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.pc-fila .btn { min-height: 44px; padding-left: .8rem; padding-right: .8rem; }
.pc-toggle { text-decoration: none; font-weight: 600; }
.cell-cuenta--mixta { white-space: normal; max-width: 260px; }
@media (max-width: 575.98px) {
    .pc-fila { grid-template-columns: minmax(0, 1fr) auto auto; }
    .pc-fila .pc-fila-cuenta { grid-column: 1 / -1; }
}

.cell-hora { margin-top: .1rem; font-size: .76rem; color: var(--muted-2); white-space: nowrap; }

/* ==========================================================================
   Modal (Bootstrap) con el estilo de la app
   ========================================================================== */
.modal-content { --bs-modal-bg: #fff; background-color: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg, 16px); box-shadow: 0 24px 60px rgba(15, 23, 42, .18); }
.modal-header, .modal-footer { border-color: var(--line); padding: 1.1rem 1.4rem; }
.modal-body { padding: 1.3rem 1.4rem; }
.modal-header .btn-close:focus { box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .25); }
