/* Variables CSS y Definiciones de Tema */
:root[data-theme="dark"] {
    --bg-primary: #090d16;
    --bg-secondary: #0f1524;
    --bg-card: rgba(21, 30, 52, 0.5);
    --bg-card-hover: rgba(29, 41, 71, 0.65);
    --bg-card-border: rgba(255, 255, 255, 0.07);
    --bg-card-light: rgba(255, 255, 255, 0.03);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.06);
    
    --input-bg: rgba(13, 20, 37, 0.8);
    --input-border: rgba(255, 255, 255, 0.08);
    --input-focus-border: #6366f1;
    --input-focus-shadow: rgba(99, 102, 241, 0.15);
    
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-card-hover: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
    --shadow-modal: 0 30px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
    
    --glow-color-1: rgba(99, 102, 241, 0.15);
    --glow-color-2: rgba(236, 72, 153, 0.12);
    
    --scrollbar-track: #090d16;
    --scrollbar-thumb: #1e293b;
    --scrollbar-thumb-hover: #334155;
}

:root[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --bg-card-border: rgba(0, 0, 0, 0.05);
    --bg-card-light: rgba(0, 0, 0, 0.02);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(0, 0, 0, 0.05);
    
    --input-bg: #f8fafc;
    --input-border: rgba(0, 0, 0, 0.08);
    --input-focus-border: #4f46e5;
    --input-focus-shadow: rgba(79, 70, 229, 0.15);
    
    --shadow-premium: 0 20px 40px -15px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    --shadow-card-hover: 0 25px 50px -12px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
    --shadow-modal: 0 30px 60px -15px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
    
    --glow-color-1: rgba(99, 102, 241, 0.08);
    --glow-color-2: rgba(236, 72, 153, 0.06);
    
    --scrollbar-track: #f3f4f6;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
}

/* Constantes en todos los temas */
:root {
    /* Colores de Marca */
    --color-primary: #6366f1;
    --color-primary-hover: #4f46e5;
    --color-secondary: #0ea5e9;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #f43f5e;
    
    /* Colores de Categoría */
    --color-indigo: #6366f1;
    --color-emerald: #10b981;
    --color-sky: #0ea5e9;
    --color-rose: #f43f5e;
    --color-amber: #f59e0b;
    --color-violet: #8b5cf6;
    --color-pink: #ec4899;
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estilos Base y Restablecimiento */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    position: relative;
}

/* Brillo Ambiental de Fondo */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    transition: background-color var(--transition-slow);
}

.glow-1 {
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background-color: var(--glow-color-1);
}

.glow-2 {
    bottom: -10%;
    left: -10%;
    width: 45vw;
    height: 45vw;
    background-color: var(--glow-color-2);
}

/* Barra de Desplazamiento Premium */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Ocultar controles de flechas para campos numéricos HTML5 globalmente */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* Ayudantes de Tipografía */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Base de Panel Glassmorphism */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: 20px;
    box-shadow: var(--shadow-premium);
    transition: background-color var(--transition-normal), 
                border-color var(--transition-normal), 
                box-shadow var(--transition-normal),
                transform var(--transition-normal);
}

/* Contenedor de la Aplicación */
.app-container {
    max-width: 1650px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Estilos de Cabecera */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.5);
    overflow: hidden;
    padding: 4px;
}

/* Imagen del logo personalizada */
.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.logo-area h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--text-primary), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Badge de Tipo de Cambio en la Cabecera */
.exchange-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    background: var(--bg-card-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.exchange-badge:hover {
    transform: translateY(-2px);
    background: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.exchange-badge strong {
    font-weight: 700;
    color: var(--color-success);
}

.exchange-badge i,
.exchange-badge svg {
    width: 16px;
    height: 16px;
    color: var(--color-success);
    transition: transform var(--transition-normal);
}

.exchange-badge .trend-icon.spinning {
    animation: spin 1.5s linear infinite;
    width: 16px !important;
    height: 16px !important;
    display: inline-block;
}

/* Estilos de Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px -3px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -4px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: var(--bg-card-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

/* Lógica del Botón de Cambio de Tema */
#theme-toggle .sun-icon {
    display: none;
}
:root[data-theme="light"] #theme-toggle .moon-icon {
    display: none;
}
:root[data-theme="light"] #theme-toggle .sun-icon {
    display: block;
}

/* Tarjetas de Métricas del Panel */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-indigo);
    opacity: 0.8;
}

.metric-card:nth-child(2)::before { background: var(--color-emerald); }
.metric-card:nth-child(3)::before { background: var(--color-sky); }
.metric-card:nth-child(4)::before { background: var(--color-violet); }

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    transition: color var(--transition-normal);
}

.metric-value .divider {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-muted);
}

.metric-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.metric-icon-wrapper {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon-wrapper.monthly { background: rgba(99, 102, 241, 0.1); color: var(--color-indigo); }
.metric-icon-wrapper.yearly { background: rgba(16, 185, 129, 0.1); color: var(--color-emerald); }
.metric-icon-wrapper.count { background: rgba(14, 165, 233, 0.1); color: var(--color-sky); }
.metric-icon-wrapper.average { background: rgba(139, 92, 246, 0.1); color: var(--color-violet); }

/* Diseño Principal: Estructura de Cuadrícula */
.main-layout {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

/* Paneles Laterales */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.panel-card {
    padding: 1.5rem;
}

.panel-title {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Contenedor de Gráfico SVG */
.chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.donut-chart-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
}

.donut-chart {
    transform: rotate(-90deg);
}

.chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    width: 70%;
}

.chart-center-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.chart-center-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Estilos de ruta dinámicos para segmentos Donut */
.chart-segment {
    fill: transparent;
    stroke-linecap: round;
    transition: stroke-dasharray var(--transition-slow), stroke var(--transition-normal), stroke-width 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s ease;
    cursor: pointer;
}

.chart-segment:hover {
    stroke-width: 15;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.2));
}

.chart-legend {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.legend-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Panel de Próximas Renovaciones */
.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.upcoming-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    transition: transform var(--transition-fast);
}

.upcoming-item:hover {
    transform: translateX(4px);
    background: var(--border-color);
}

.upcoming-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upcoming-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
}

.upcoming-details {
    display: flex;
    flex-direction: column;
}

.upcoming-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.upcoming-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upcoming-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.upcoming-price {
    font-size: 0.875rem;
    font-weight: 700;
}

.upcoming-days {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    width: fit-content;
    margin-left: auto;
}

.upcoming-days.critical { background: rgba(244, 63, 94, 0.15); color: var(--color-danger); }
.upcoming-days.warning { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.upcoming-days.normal { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }

/* Barra de Control de Búsqueda y Filtros */
.filters-bar {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border-radius: 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Estilo de Selección Personalizado */
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
}

.select-wrapper select:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.select-icon {
    position: absolute;
    right: 0.75rem;
    pointer-events: none;
    color: var(--text-muted);
    width: 16px;
    height: 16px;
}

/* Cuadrícula y Tarjetas de Suscripciones */
.subs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1.5rem;
}

.sub-card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sub-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    border-color: rgba(255, 255, 255, 0.25);
}

/* Línea indicadora de color personalizado en la parte superior de la tarjeta */
.sub-card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.sub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-card-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sub-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #ffffff;
}

.sub-card-title {
    display: flex;
    flex-direction: column;
}

.sub-card-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.sub-card-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Menú desplegable de opciones en la tarjeta */
.sub-card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sub-card-price-section {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 0.25rem;
}

.sub-card-price {
    font-size: 1.65rem;
    font-weight: 800;
}

.sub-card-cycle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.sub-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.detail-label {
    color: var(--text-muted);
}

.detail-val {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Sección de Notas de la Tarjeta */
.sub-card-notes {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-card-light);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 2px solid var(--text-muted);
}

/* Barra de Progreso para Días de Renovación */
.sub-card-progress {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.progress-days {
    font-weight: 600;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-card-light);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width var(--transition-slow);
}

/* Estilos de Interruptores Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-card-light);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: var(--color-success);
}

input:checked + .slider:before {
    transform: translateX(18px);
    background-color: var(--color-success);
}

/* Estado Pausado para Tarjetas */
.sub-card.paused {
    opacity: 0.6;
}

.sub-card.paused .sub-card-price {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Estilos de Estado Vacío */
.empty-state {
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
}

.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: var(--bg-card-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.empty-icon i {
    width: 36px;
    height: 36px;
}

.empty-state h3 {
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 320px;
    margin-bottom: 0.5rem;
}

.hidden {
    display: none !important;
}

/* Estilo del Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 7, 15, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    box-shadow: var(--shadow-modal);
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.45rem;
    font-weight: 800;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 520px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    outline: none;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.price-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.price-input-wrapper .currency-symbol {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.price-input-wrapper input {
    padding-left: 2rem !important;
    width: 100%;
}

/* Nuevo estilo de entrada combinada dentro del modal */
.combined-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding-right: 0.5rem;
    transition: all var(--transition-fast);
}

.combined-input:focus-within {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.combined-input .currency-symbol {
    position: static !important;
    padding-left: 1rem;
    flex-shrink: 0;
}

.combined-input input {
    border: none !important;
    background: transparent !important;
    padding-left: 0.5rem !important;
    outline: none !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
}

.input-currency-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    padding: 0 0.5rem;
    text-align: center;
}

.input-currency-select::-ms-expand {
    display: none;
}

.input-currency-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* CSS de Barra de Progreso de Presupuesto KPI */
.monthly-kpi {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.budget-progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.25rem;
}

.budget-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-card-light);
    border-radius: 3px;
    overflow: hidden;
}

.budget-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width var(--transition-slow), background-color var(--transition-normal);
}

.budget-progress-text {
    font-size: 0.725rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* CSS del Widget de Configuración Lateral */
.settings-widget-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group.compact label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group.compact input {
    padding: 0.5rem 0.75rem;
    padding-left: 2rem !important;
    font-size: 0.85rem;
    border-radius: 8px;
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    line-height: 1;
}

.sync-badge.loading {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-indigo);
}

.sync-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.sync-badge.error {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-danger);
}

.spinning {
    animation: spin 1.5s linear infinite;
    display: inline-block;
    width: 10px;
    height: 10px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Opciones del Selector de Color Personalizado */
.color-picker-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.25rem 0;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option input {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.color-option .checkmark {
    display: none;
    color: #ffffff;
}

.color-option .checkmark i {
    width: 14px;
    height: 14px;
}

.color-option input:checked + .checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Menú desplegable de sugerencias del formulario */
.suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-modal);
    z-index: 10;
    max-height: 180px;
    overflow-y: auto;
    display: none;
}

.suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.suggestion-item:hover {
    background: var(--bg-card-light);
}

/* Alineación de Botones de Acciones del Formulario */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

/* Estilos de Notificaciones Emergentes (Toast) */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 200;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 4px solid var(--color-primary);
    border-top: 1px solid var(--bg-card-border);
    border-right: 1px solid var(--bg-card-border);
    border-bottom: 1px solid var(--bg-card-border);
    box-shadow: var(--shadow-modal);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    border-radius: 0 10px 10px 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    pointer-events: all;
    animation: toast-slide-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: all var(--transition-fast);
}

.toast.success { border-left-color: var(--color-success); }
.toast.info { border-left-color: var(--color-secondary); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.danger { border-left-color: var(--color-danger); }

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.toast-icon.success { color: var(--color-success); }
.toast-icon.info { color: var(--color-secondary); }
.toast-icon.warning { color: var(--color-warning); }
.toast-icon.danger { color: var(--color-danger); }

.toast-msg {
    font-size: 0.85rem;
    font-weight: 500;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast.removing {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
}

/* Banner de Alertas */
.alerts-banner-container {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: fadeIn 0.4s ease;
}

.alert-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    box-shadow: 0 4px 20px -5px rgba(244, 63, 94, 0.15);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.alert-banner.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    box-shadow: 0 4px 20px -5px rgba(245, 158, 11, 0.15);
}

.alert-banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-danger);
}

.alert-banner.warning::after {
    background: var(--color-warning);
}

.alert-banner i,
.alert-banner svg {
    width: 24px;
    height: 24px;
    color: var(--color-danger);
    flex-shrink: 0;
}

.alert-banner.warning i,
.alert-banner.warning svg {
    color: var(--color-warning);
}

.alert-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.alert-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.alert-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Selector de Vista */
.view-toggle-group {
    display: inline-flex;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    padding: 0.25rem;
    border-radius: 12px;
    gap: 0.25rem;
}

.btn-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-toggle i,
.btn-toggle svg {
    width: 18px;
    height: 18px;
}

.btn-toggle:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.btn-toggle.active {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 10px -3px rgba(99, 102, 241, 0.4);
}

/* Vista de Calendario */
.calendar-view-panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.4s ease;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--text-primary), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
}

.calendar-day {
    min-height: 100px;
    border-radius: 12px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all var(--transition-fast);
    position: relative;
    cursor: default;
}

.calendar-day:hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px -5px rgba(0, 0, 0, 0.2);
}

.calendar-day.empty {
    opacity: 0.25;
    pointer-events: none;
}

.calendar-day.today {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.03);
}

.calendar-day.today::before {
    content: 'Hoy';
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.calendar-day-num {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.calendar-day.today .calendar-day-num {
    color: var(--color-primary);
}

.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    max-height: 65px;
    scrollbar-width: none;
}

.calendar-day-events::-webkit-scrollbar {
    display: none;
}

.calendar-day-event {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-left: 3px solid var(--event-color, var(--color-indigo));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.calendar-day-event:hover {
    transform: scale(1.03);
    filter: brightness(1.1);
}

/* Botones pequeños de solo icono (ej. navegación del calendario) */
.btn-icon.compact-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-icon.compact-btn i,
.btn-icon.compact-btn svg {
    width: 16px !important;
    height: 16px !important;
}

/* Botones pequeños de texto/acción (ej. Limpiar Historial) */
.btn.compact-btn {
    width: auto !important;
    height: 32px !important;
    padding: 0 0.85rem !important;
    font-size: 0.8rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.4rem !important;
}

/* Widget de Análisis e Insights */
.insights-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.insight-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    line-height: 1.4;
    transition: all var(--transition-fast);
}

.insight-item:hover {
    background: var(--border-color);
    transform: translateX(2px);
}

.insight-item.info {
    border-left: 3px solid var(--color-secondary);
}

.insight-item.warning {
    border-left: 3px solid var(--color-warning);
}

.insight-item.success {
    border-left: 3px solid var(--color-success);
}

.insight-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.insight-item.info .insight-icon-wrapper { color: var(--color-secondary); }
.insight-item.warning .insight-icon-wrapper { color: var(--color-warning); }
.insight-item.success .insight-icon-wrapper { color: var(--color-success); }

.insight-icon-wrapper i,
.insight-icon-wrapper svg {
    width: 14px;
    height: 14px;
}

.insight-text {
    color: var(--text-secondary);
}

.insight-text strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Keyframes Personalizados */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ajustes responsivos para el Calendario */
@media (max-width: 768px) {
    .calendar-weekdays {
        font-size: 0.75rem;
    }
    
    .calendar-day {
        min-height: 70px;
        padding: 0.35rem;
    }
    
    .calendar-day-event {
        padding: 0.1rem 0.2rem;
        font-size: 0.6rem;
    }
    
    .calendar-day.today::before {
        display: none;
    }
}

/* Estilo del panel y contenedor desplegable de Tipo de Cambio */
.exchange-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.indicators-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    padding: 1.25rem;
    z-index: 120;
    transform-origin: top right;
    animation: dropdownOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.indicators-dropdown.hidden {
    display: none !important;
}

@keyframes dropdownOpen {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.indicators-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
    margin-bottom: 0.75rem;
}

.indicators-header span {
    background: linear-gradient(to right, var(--text-primary), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.indicators-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

/* Estilos de barra de desplazamiento para lista de indicadores */
.indicators-list::-webkit-scrollbar {
    width: 4px;
}
.indicators-list::-webkit-scrollbar-track {
    background: transparent;
}
.indicators-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}

.indicator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.indicator-row:hover {
    background: var(--border-color);
}

.indicator-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.indicator-name {
    font-size: 0.775rem;
    font-weight: 700;
    color: var(--text-primary);
}

.indicator-code {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.indicator-val-col {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.indicator-value {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--color-success);
}

.indicator-unit {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.indicator-loading,
.indicator-error {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.indicator-error {
    color: var(--color-danger);
}

/* Contenedor y panel desplegable de notificaciones */
.notifications-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    padding: 1.25rem;
    z-index: 120;
    transform-origin: top right;
    animation: dropdownOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.notifications-dropdown.hidden {
    display: none !important;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
    margin-bottom: 0.75rem;
}

.notifications-header span {
    background: linear-gradient(to right, var(--text-primary), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.notifications-list::-webkit-scrollbar {
    width: 4px;
}
.notifications-list::-webkit-scrollbar-track {
    background: transparent;
}
.notifications-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}

.notification-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    font-size: 0.775rem;
    line-height: 1.35;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--border-color);
}

.notification-item.urgent {
    border-left: 2px solid var(--color-danger);
}

.notification-item.info {
    border-left: 2px solid var(--color-secondary);
}

.notification-item.success {
    border-left: 2px solid var(--color-success);
}

.notification-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.notification-item.urgent .notification-item-icon { color: var(--color-danger); }
.notification-item.info .notification-item-icon { color: var(--color-secondary); }
.notification-item.success .notification-item-icon { color: var(--color-success); }

.notification-item-icon i,
.notification-item-icon svg {
    width: 12px;
    height: 12px;
}

.notification-item-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
}

.notification-item-text {
    color: var(--text-secondary);
}

.notification-item-text strong {
    color: var(--text-primary);
}

.notification-item-time {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.notification-empty {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Badge de notificación en el botón de campana */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    animation: pulseBadge 1.5s infinite;
}

.notification-badge.hidden {
    display: none !important;
}

@keyframes pulseBadge {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(244, 63, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

/* Contenedor y panel desplegable de configuración */
.settings-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    padding: 1.25rem;
    z-index: 120;
    transform-origin: top right;
    animation: dropdownOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.settings-dropdown.hidden {
    display: none !important;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
    margin-bottom: 0.75rem;
}

.settings-header span {
    background: linear-gradient(to right, var(--text-primary), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Estilos del desglose de Métodos de Pago */
.payment-method-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.payment-method-row:hover {
    background: var(--border-color);
    transform: translateX(2px);
}

.payment-method-name-col {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.payment-method-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.payment-method-icon-wrapper i,
.payment-method-icon-wrapper svg {
    width: 14px;
    height: 14px;
}

.payment-method-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.payment-method-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.payment-method-count {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.payment-method-val-col {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.payment-method-total {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-primary);
}

.payment-method-label-clp {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.payment-methods-empty {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Estilo personalizado para selectores de modal para expandirlos al 100% */
.form-group .select-wrapper {
    width: 100%;
}

.form-group .select-wrapper select {
    width: 100%;
}

/* Estilo hover del botón de cierre de alerta */
.alert-close-btn:hover {
    color: var(--text-primary) !important;
    transform: scale(1.1);
}

/* CSS del Widget de Salud Financiera */
.financial-health-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.health-score-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.health-gauge {
    transform: rotate(-90deg);
}

.health-score-value {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#health-score-num {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    transition: color 0.5s ease;
}

.score-total {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.health-status-desc {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.health-status-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.5s ease;
}

.health-status-quote {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Estilo de la opción del selector de color personalizado */
.color-option.custom-color-picker .pipette-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.color-option.custom-color-picker .pipette-icon i,
.color-option.custom-color-picker .pipette-icon svg {
    width: 14px;
    height: 14px;
}

/* Ocultar icono de pipeta al estar seleccionado (marcado) */
.color-option.custom-color-picker input:checked ~ .pipette-icon {
    display: none;
}

/* Panel emergente de color personalizado (en la página) */
.custom-color-popover {
    margin-top: 0.75rem;
    padding: 1.25rem;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    animation: fadeIn var(--transition-fast) ease;
}

.custom-color-popover.hidden {
    display: none !important;
}

.popover-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Estilos de la Rueda de Color */
.color-wheel-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.4rem 0;
}

.color-wheel-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    cursor: crosshair;
}

#color-wheel-canvas {
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: block;
}

.color-wheel-pointer {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
    background-color: transparent;
    transform: translate(-50%, -50%);
    pointer-events: none;
    top: 50%;
    left: 50%;
}

/* Estilos del deslizador de brillo */
.color-brightness-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.color-brightness-wrapper label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#color-brightness-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(to right, #000000, var(--slider-hue-color, #ff007f), #ffffff);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#color-brightness-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease;
}

#color-brightness-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Estilos de la fila de entrada Hex */
.popover-hex-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hex-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.hex-hash {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
}

.hex-input-wrapper input {
    width: 100%;
    padding: 0.5rem 0.5rem 0.5rem 1.75rem !important;
    font-size: 0.85rem;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.color-preview-swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #ff007f;
    flex-shrink: 0;
    transition: background-color var(--transition-fast);
}


/* Badge flotante de tooltip de la Rueda de Color */
.color-wheel-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #1f2937;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 10;
}

[data-theme="dark"] .color-wheel-tooltip {
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Flecha pequeña del tooltip */
.color-wheel-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.85) transparent transparent transparent;
}

[data-theme="dark"] .color-wheel-tooltip::after {
    border-color: rgba(17, 24, 39, 0.85) transparent transparent transparent;
}

/* Colores personalizados recientes dentro del panel emergente */
.recent-colors-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.2rem;
}
.recent-colors-container.hidden {
    display: none !important;
}
.recent-colors-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.recent-colors-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.recent-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.recent-color-swatch:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 0 1px #ffffff;
}

/* Efecto hover en celdas interactivas del Calendario */
.calendar-day:not(.empty) {
    cursor: pointer;
    transition: background-color var(--transition-fast) ease, transform 0.1s ease;
}
.calendar-day:not(.empty):hover {
    background-color: var(--bg-card-hover) !important;
    transform: translateY(-1px);
}
.calendar-day:not(.empty):active {
    transform: translateY(0);
}

/* Tarjeta KPI con alerta de presupuesto en rojo parpadeante */
.monthly-kpi.budget-alert {
    animation: pulse-red-alert 2.5s infinite ease-in-out;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
}

@keyframes pulse-red-alert {
    0% {
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37), 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37), 0 0 12px 3px rgba(239, 68, 68, 0.45);
    }
    100% {
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37), 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
}

/* Estilo del panel de Vista de Historial */
.history-view-panel {
    padding: 1.5rem;
    border-radius: var(--border-radius-lg, 16px);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: fadeIn var(--transition-fast) ease;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    padding-bottom: 0.85rem;
}

.history-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.history-timeline {
    position: relative;
    padding-left: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Línea vertical del historial */
.history-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--border-color, rgba(255, 255, 255, 0.08));
}

.history-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem 0;
    animation: slideInLeft 0.2s ease;
}

/* Punto de nodo del historial */
.history-item::before {
    content: '';
    position: absolute;
    left: calc(-2rem + 0.15rem);
    top: 0.95rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--timeline-color, var(--color-indigo));
    box-shadow: 0 0 0 3px var(--bg-body, #111), 0 0 8px var(--timeline-color, var(--color-indigo));
    z-index: 2;
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-item-badge {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background-color: var(--badge-bg, rgba(255, 255, 255, 0.08));
    color: var(--timeline-color, var(--text-secondary));
}

.history-item-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.history-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Colores del historial por tipo de actividad */
.history-item.create {
    --timeline-color: var(--color-success, #10b981);
    --badge-bg: rgba(16, 185, 129, 0.12);
}
.history-item.edit {
    --timeline-color: var(--color-primary, #6366f1);
    --badge-bg: rgba(99, 102, 241, 0.12);
}
.history-item.delete {
    --timeline-color: var(--color-danger, #f43f5e);
    --badge-bg: rgba(244, 63, 94, 0.12);
}
.history-item.status {
    --timeline-color: var(--color-warning, #f59e0b);
    --badge-bg: rgba(245, 158, 11, 0.12);
}
.history-item.import {
    --timeline-color: var(--color-violet, #8b5cf6);
    --badge-bg: rgba(139, 92, 246, 0.12);
}

.history-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.history-empty i, .history-empty svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Casilla de verificación personalizada premium */
.custom-checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.custom-checkbox-wrapper {
    display: inline-flex;
    align-items: center;
}

.custom-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.custom-checkbox-label:hover {
    color: var(--text-primary);
}

.custom-checkbox-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.custom-checkbox-svg {
    width: 14px;
    height: 14px;
    color: #ffffff;
    stroke: currentColor;
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    transition: stroke-dashoffset 0.25s ease-out;
}

.custom-checkbox-input:checked + .custom-checkbox-label .custom-checkbox-box {
    background: var(--color-indigo);
    border-color: var(--color-indigo);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.custom-checkbox-input:checked + .custom-checkbox-label .custom-checkbox-svg {
    stroke-dashoffset: 0;
}

.custom-checkbox-text {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.custom-checkbox-text .gift-icon,
.custom-checkbox-text svg,
.custom-checkbox-text i {
    width: 16px;
    height: 16px;
    color: var(--color-indigo);
    display: inline-block;
    vertical-align: middle;
}

/* Estilos del panel desplegable de exportación */
.export-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.export-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    padding: 0;
    z-index: 120;
    transform-origin: top right;
    animation: dropdownOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    overflow: hidden;
}

.export-dropdown.hidden {
    display: none !important;
}

.export-dropdown .dropdown-item:hover {
    background: var(--border-color) !important;
    color: var(--text-primary) !important;
}
