@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --accent-red: #e11d48;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f8fafc;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    color: var(--text-dark);
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: rgba(59, 130, 246, 0.3);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 600px;
    height: 600px;
    background: rgba(216, 180, 254, 0.3);
    bottom: -150px;
    right: -100px;
}

.app-container {
    width: 95vw;
    height: 90vh;
    display: flex;
    border-radius: 30px;
    overflow: hidden;
}

.glass-panel, .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-card {
    border-radius: 24px;
    padding: 24px;
    transition: transform 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
}

.sidebar {
    width: 280px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

/* --- Ajuste Logo Monylab --- */
.logo {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -1.5px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 50px;
}

.ai-badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 14px;
    letter-spacing: 0;
    font-weight: 600;
}
/* --------------------------- */

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

/* REEMPLAZA ESTAS CLASES EN TU STYLES.CSS */

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center; /* Alineación vertical perfecta */
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.avatar {
    flex-shrink: 0; /* LA MAGIA: Evita que el nombre aplaste el círculo */
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-name { 
    font-weight: 700; 
    font-size: 15px; 
    line-height: 1.2; /* Junta un poco las líneas si el nombre es largo */
    color: var(--text-dark);
    margin-bottom: 2px;
}

.user-plan { 
    font-size: 13px; 
    color: var(--text-muted); 
    font-weight: 500;
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px;}
.subtitle { color: var(--text-muted); margin-top: 4px; }

.btn-primary {
    background: var(--text-dark);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary:hover {
    background: var(--primary-color);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.side-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.metric-card h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-card h2 {
    font-size: 32px;
    margin: 12px 0;
    font-weight: 600;
    letter-spacing: -1px;
}

.badge {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.badge.positive { background: #dcfce7; color: #166534; }
.badge.neutral { background: #f1f5f9; color: #475569; }
.badge.negative { background: #fee2e2; color: #991b1b; }
.badge.warning { background: #fef08a; color: #854d0e; }

.chart-container canvas {
    margin-top: 20px;
    width: 100% !important;
    height: 380px !important; 
}

.progress-bar {
    background: rgba(0,0,0,0.05);
    height: 12px;
    border-radius: 100px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), #60a5fa);
    height: 100%;
    border-radius: 100px;
}

.progress-text {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: right;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.installments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.installment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease;
}

.installment-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.6);
}

.item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.8);
}

.item-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.item-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-stats {
    text-align: right;
}

.cuota-amount {
    font-weight: 700;
    font-size: 15px;
}

.cuota-progress {
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(0,0,0,0.05);
}

.negative-flow .cuota-amount { color: var(--accent-red); }
.positive-flow .cuota-amount { color: #059669; }

/* CSS Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 16, 20, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

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

.modal-content {
    width: 450px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--accent-red);
}

.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.05);
    padding: 5px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--glass-bg);
    color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ia-input-area textarea {
    width: 100%;
    height: 120px;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-dark);
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
}

.ia-input-area textarea:focus {
    border-color: var(--primary-color);
}