/* === CSS Variables & Design System === */
:root {
    /* Color Palette: Dark Modern Premium */
    --bg-base: #0a0a0f;
    --bg-gradient-center: #151520;
    --bg-surface: rgba(20, 20, 28, 0.6);
    --bg-surface-hover: rgba(30, 30, 42, 0.8);
    
    /* Accents & Neon */
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #a855f7; /* Purple */
    --accent-success: #10b981; /* Emerald */
    --accent-warning: #f59e0b; /* Amber */
    --accent-danger: #ef4444; /* Red */
    --accent-info: #0ea5e9; /* Sky */
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Glassmorphism */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    /* Utilities */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === THEMES === */
/* Light Theme */
[data-theme="light"] {
    --bg-base: #f1f5f9;
    --bg-gradient-center: #e2e8f0;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-surface-hover: rgba(255, 255, 255, 1);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

/* Pastel Theme */
[data-theme="pastel"] {
    --bg-base: #fdf4f5;
    --bg-gradient-center: #fce7f3;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.9);
    
    --accent-primary: #a78bfa;
    --accent-secondary: #f472b6;
    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-danger: #fb7185;
    --accent-info: #38bdf8;
    
    --text-primary: #475569;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

/* Fix Inputs for Bright Themes */
[data-theme="light"] .input-wrapper input,
[data-theme="pastel"] .input-wrapper input,
[data-theme="light"] .form-control,
[data-theme="pastel"] .form-control,
[data-theme="light"] .cf-input,
[data-theme="pastel"] .cf-input {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0,0,0,0.1);
    color: var(--text-primary);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden; /* App feels native */
}

/* === Views Management === */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    height: 100vh;
    width: 100vw;
}

.view.active {
    display: flex;
    opacity: 1;
}

/* === Glassmorphism Utility === */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* === Typography === */
h1, h2, h3, h4 { color: var(--text-primary); font-weight: 600; }
p { color: var(--text-secondary); line-height: 1.5; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* === Login View === */
#login-view {
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle at top right, var(--bg-gradient-center) 0%, var(--bg-base) 100%);
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.5;
    animation: float 10s infinite alternate;
}

.orb-1 {
    width: 300px; height: 300px;
    background: var(--accent-primary);
    top: -50px; left: -50px;
}

.orb-2 {
    width: 250px; height: 250px;
    background: var(--accent-secondary);
    bottom: -50px; right: -50px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(30px) scale(1.1); }
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: var(--radius-lg);
    z-index: 10;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    width: 90px; height: 90px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    display: inline-flex;
    justify-content: center; align-items: center;
    margin-bottom: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 6px;
}

.logo img {
    width: 100%; height: 100%; object-fit: contain;
}

.logo.small {
    width: 45px; height: 45px;
    margin-bottom: 0; margin-right: 12px;
    padding: 4px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute; left: 14px; top: 14px;
    color: var(--text-muted);
}

.input-wrapper input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 12px 12px 40px;
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(0,0,0,0.4);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

.error-message {
    color: var(--accent-danger); font-size: 13px;
    text-align: center; margin-top: 12px; height: 20px;
}

.login-help { margin-top: 20px; text-align: center; color: var(--text-muted); }

/* === App Dashboard Layout === */
#app-view {
    display: flex; /* Sidebar + Main */
    background: radial-gradient(circle at 50% 0%, var(--bg-gradient-center) 0%, var(--bg-base) 100%);
}

/* Sidebar */
.sidebar {
    width: 260px;
    display: flex; flex-direction: column;
    border-right: 1px solid var(--glass-border);
    border-radius: 0; box-shadow: none; z-index: 20;
}

.sidebar-header {
    height: 70px; display: flex; align-items: center; padding: 0 24px;
    border-bottom: 1px solid var(--glass-border);
}

.user-profile {
    padding: 24px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg-surface-hover);
    display: flex; justify-content: center; align-items: center;
    border: 1px solid var(--glass-border); color: var(--text-secondary);
}

.user-info h4 { font-size: 14px; margin-bottom: 4px; }
.badge {
    font-size: 10px; padding: 2px 8px; border-radius: 10px;
    background: rgba(99, 102, 241, 0.2); color: var(--accent-primary);
    border: 1px solid rgba(99, 102, 241, 0.3); font-weight: 600; text-transform: uppercase;
}

.sidebar-nav {
    flex: 1; padding: 20px 12px; overflow-y: auto;
}

.nav-title {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    letter-spacing: 1px; margin-bottom: 12px; padding: 0 12px;
}

#nav-menu { list-style: none; }

.nav-item {
    padding: 10px 12px; border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 12px;
    color: var(--text-secondary); cursor: pointer;
    transition: var(--transition); font-size: 14px; font-weight: 500;
    margin-bottom: 4px; border: 1px solid transparent;
}

.nav-item i { width: 16px; text-align: center; }

.nav-item:hover {
    background: var(--bg-surface-hover); color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15); color: var(--accent-primary);
    border-color: rgba(99, 102, 241, 0.3);
}

.sidebar-footer {
    padding: 20px; border-top: 1px solid var(--glass-border);
}

.btn-logout {
    width: 100%; background: transparent; color: var(--text-secondary);
    border: 1px solid var(--glass-border); padding: 10px;
    border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1); color: var(--accent-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Main Content */
.main-content {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.topbar {
    height: 70px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px; border-bottom: 1px solid var(--glass-border);
    border-radius: 0; box-shadow: none; z-index: 10;
}

.breadcrumb h2 { font-size: 20px; font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }

.access-info-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    color: #10b981;
    font-size: 12px;
    font-weight: 500;
    margin-right: 10px;
}

.access-info-badge i {
    font-size: 14px;
}

.icon-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-surface); border: 1px solid var(--glass-border);
    color: var(--text-secondary); cursor: pointer; transition: var(--transition);
    display: flex; justify-content: center; align-items: center;
}

.icon-btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); }

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    height: 18px;
    min-width: 18px;
    border-radius: 9px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 4px;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.clock-display {
    font-variant-numeric: tabular-nums; font-family: monospace; font-size: 14px;
    padding: 6px 12px; background: rgba(0,0,0,0.3); border-radius: var(--radius-sm);
    color: var(--accent-primary); font-weight: 600; border: 1px solid var(--glass-border);
}

.content-area {
    flex: 1; padding: 30px; overflow-y: auto; overflow-x: hidden;
}

.content-section {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Dashboard Components === */

/* KPI Grid */
.kpi-grid {
    display: grid; gap: 24px; margin-bottom: 30px;
}

.kpi-grid.summary-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
#depto-kpi-cards { grid-template-columns: repeat(2, 1fr); }

.kpi-card {
    padding: 24px; border-radius: var(--radius-lg);
    display: flex; flex-direction: column; position: relative;
    overflow: hidden; transition: var(--transition);
}

.kpi-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,0.2); }

.kpi-card.clickable-card { cursor: pointer; }

/* Indicador de color lateral / fondo suave */
.kpi-bg-glow {
    position: absolute; right: -20px; top: -20px; width: 100px; height: 100px;
    border-radius: 50%; filter: blur(40px); opacity: 0.15; z-index: 0;
}

.kpi-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; position: relative; z-index: 1;
}

.kpi-title { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.kpi-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; justify-content: center; align-items: center;
    background: rgba(255,255,255,0.05); font-size: 14px;
}

.kpi-value-container { position: relative; z-index: 1; }
.kpi-value { font-size: 32px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: baseline; gap: 4px; }
.kpi-scale { font-size: 16px; color: var(--text-muted); font-weight: 500; }

.kpi-progress-bar {
    height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px;
    overflow: hidden; margin-bottom: 12px; width: 100%;
}

.progress-fill { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }

.kpi-status { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;}

/* Status Colors Classes */
.status-good { color: var(--accent-success); }
.status-warning { color: var(--accent-warning); }
.status-danger { color: var(--accent-danger); }
.bg-good { background: var(--accent-success); }
.bg-warning { background: var(--accent-warning); }
.bg-danger { background: var(--accent-danger); }

/* Charts */
.charts-row { display: flex; gap: 24px; margin-bottom: 30px; }
.charts-row.split .chart-container { flex: 1; }
.chart-container {
    padding: 24px; border-radius: var(--radius-lg); flex: 1;
}
.chart-container h3 { font-size: 16px; margin-bottom: 20px; font-weight: 500; }
.canvas-wrapper { position: relative; height: 300px; width: 100%; }

/* Vista Detalle Depto Header */
.depto-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 24px 30px; border-radius: var(--radius-lg); margin-bottom: 30px;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.1), var(--bg-surface));
    border-left: 4px solid var(--accent-primary);
}

.depto-info { display: flex; align-items: center; gap: 20px; }
.depto-icon {
    width: 60px; height: 60px; border-radius: 16px;
    background: rgba(99, 102, 241, 0.2); color: var(--accent-primary);
    display: flex; justify-content: center; align-items: center; font-size: 24px;
}
.depto-info h2 { font-size: 28px; margin-bottom: 4px; }
.depto-info p { font-size: 14px; }

.depto-score { text-align: right; }
.depto-score span { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; letter-spacing: 1px;}
.score-value { font-size: 36px; font-weight: 700; color: var(--accent-primary); text-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }

/* Directivas / Reglas de Oro */
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.rule-card { 
    background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); 
    padding: 16px; border-radius: var(--radius-md); display: flex; gap: 16px;
    align-items: flex-start; transition: var(--transition);
}
.rule-card:hover { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.1); }
.rule-icon { font-size: 20px; min-width: 24px; margin-top: 2px;}
.rule-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.rule-card p { font-size: 13px; line-height: 1.4; color: var(--text-secondary); }

.text-danger { color: var(--accent-danger); }
.text-warning { color: var(--accent-warning); }
.text-primary { color: var(--accent-primary); }
.text-success { color: var(--accent-success); }

/* Data Table */
.data-table-container { padding: 24px; border-radius: var(--radius-lg); }
.data-table-container h3 { font-size: 16px; margin-bottom: 20px; font-weight: 500; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th {
    padding: 12px 16px; background: rgba(0,0,0,0.2); color: var(--text-secondary);
    font-size: 13px; font-weight: 600; text-transform: uppercase; border-bottom: 1px solid var(--glass-border);
}
.data-table td {
    padding: 16px; border-bottom: 1px solid var(--glass-border); font-size: 14px;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.formula-tag { font-family: monospace; background: rgba(0,0,0,0.3); padding: 4px 8px; border-radius: 4px; color: var(--accent-primary); font-size: 12px; }

.mt-4 { margin-top: 30px; }

/* === Task Management Module === */
.tasks-module { padding: 24px; }
.tasks-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid var(--glass-border); padding-bottom: 16px; }
.tasks-header h3 { font-size: 18px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.tasks-header p { font-size: 13px; }

.task-form-wrapper { background: rgba(0,0,0,0.2); border-radius: var(--radius-md); padding: 20px; margin-bottom: 24px; border: 1px solid var(--glass-border); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 8px; }

.form-control {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--accent-primary); background: rgba(0,0,0,0.4); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; padding-right: 40px; }
select.form-control option { background-color: var(--bg-surface-hover); color: var(--text-primary); }

input[type="date"].form-control::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.5; cursor: pointer; }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.btn-secondary { background: transparent; border: 1px solid var(--glass-border); color: var(--text-primary); padding: 10px 20px; border-radius: var(--radius-md); cursor: pointer; font-weight: 500; transition: var(--transition); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.badge-prioridad { font-size: 11px; padding: 4px 8px; border-radius: 4px; font-weight: 600; text-transform: uppercase; }
.badge-alta { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-media { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-baja { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }

.badge-estado { font-size: 11px; padding: 4px 8px; border-radius: 4px; font-weight: 600; background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.4); }

/* === Orden de Pago (Excel View) === */
.op-container {
    background: #eef2f6; 
    padding: 24px;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    border: 1px solid var(--glass-border);
}
.op-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    color: #000000;
    min-width: 900px;
}
.op-table td {
    border: 1px solid #000000;
    padding: 6px 8px;
    font-size: 12px;
    vertical-align: middle;
}
.op-table .no-border-cell {
    border: none !important;
    background-color: transparent !important;
}
.op-table .bg-yellow {
    background-color: #ffeb3b;
}
.op-table .bg-header-blue {
    background-color: #b4c6e7;
}
.op-table .txt-center { text-align: center; }
.op-table .txt-right { text-align: right; }
.op-table .fw-bold { font-weight: bold; }
.op-table .v-middle { vertical-align: middle; }
.op-table .text-blue { color: #0070c0; }
.op-table .text-dark-blue { color: #0b1a30; }
.op-table .font-small { font-size: 11px; }

.op-table .date-cell {
    text-align: left;
    padding-left: 10%;
    font-style: italic;
    font-size: 13px;
    background: transparent;
}
.disable-wrap {
    white-space: nowrap;
}

/* Editability interaction */
.op-table .editable-cell {
    cursor: text;
    transition: all 0.2s ease;
}
.op-table .editable-cell:hover {
    background-color: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 0 0 1px var(--accent-primary);
}
.op-table .editable-cell:focus {
    background-color: rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 0 0 2px var(--accent-primary);
    outline: none;
}
.op-table .p-0 {
    padding: 0 !important;
}
.table-select {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    padding: 6px 8px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 14px;
}
.table-select:focus {
    background-color: rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 0 0 2px var(--accent-primary);
}
.table-select option {
    background: #ffffff;
    color: #000000;
}

/* === Currency Selector (Topbar) === */
.currency-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    padding: 4px 6px 4px 10px;
    transition: var(--transition);
    position: relative;
}

.currency-selector-wrapper:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.15));
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.currency-selector-wrapper .currency-icon {
    color: var(--accent-primary);
    font-size: 13px;
    pointer-events: none;
}

.currency-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    padding: 4px 22px 4px 2px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 2px center;
    background-size: 14px;
}

.currency-select option {
    background: #1a1a2e;
    color: var(--text-primary);
    padding: 8px;
}

/* === Admin Finance Module === */
.admin-finance-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.finance-card {
    padding: 20px;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.finance-card .fc-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; justify-content: center; align-items: center;
    font-size: 16px; margin-bottom: 12px;
}

.finance-card .fc-value {
    font-size: 26px; font-weight: 700; margin-bottom: 4px;
}

.finance-card .fc-label {
    font-size: 12px; color: var(--text-muted); text-transform: uppercase;
    font-weight: 600; letter-spacing: 0.5px;
}

.finance-card .fc-sub {
    font-size: 11px; color: var(--text-secondary); margin-top: 6px;
}

/* Cashflow Table */
.cashflow-section { margin-bottom: 24px; }

.cashflow-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}

.cashflow-table th {
    padding: 10px 14px; background: rgba(0,0,0,0.3);
    color: var(--text-secondary); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border); text-align: right;
}

.cashflow-table th:first-child { text-align: left; }

.cashflow-table td {
    padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
    text-align: right; font-variant-numeric: tabular-nums;
}

.cashflow-table td:first-child { text-align: left; font-weight: 500; }

.cashflow-table tr:hover { background: rgba(255,255,255,0.02); }

.cashflow-table .row-category {
    background: rgba(255,255,255,0.03); font-weight: 600;
    color: var(--text-primary);
}

.cashflow-table .row-category td { padding: 6px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--glass-border); }

.cashflow-table .row-subtotal { background: rgba(99, 102, 241, 0.08); font-weight: 600; }
.cashflow-table .row-subtotal td { border-top: 1px solid rgba(99, 102, 241, 0.2); color: var(--text-primary); }

.cashflow-table .row-total { background: rgba(16, 185, 129, 0.1); font-weight: 700; font-size: 14px; }
.cashflow-table .row-total td { border-top: 2px solid var(--accent-success); color: var(--accent-success); padding: 12px 14px; }

.cashflow-table .row-total.negative td { color: var(--accent-danger); border-top-color: var(--accent-danger); background: rgba(239, 68, 68, 0.08); }

.cashflow-table .row-acumulado { font-weight: 600; }
.cashflow-table .row-acumulado td { border-top: none; padding-top: 4px; }

.cf-input {
    width: 90px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px; color: var(--text-primary); padding: 4px 8px; font-size: 13px;
    text-align: right; font-family: 'Outfit', sans-serif; font-variant-numeric: tabular-nums;
    transition: var(--transition);
}

.cf-input:focus { outline: none; border-color: var(--accent-primary); background: rgba(99, 102, 241, 0.1); }
.cf-input:read-only { background: transparent; border-color: transparent; cursor: default; }
.cf-input:read-only:focus { border-color: transparent; }

/* Collection Calendar */
.collection-calendar-container {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}

.cal-month {
    background: rgba(0,0,0,0.15); border-radius: var(--radius-md);
    padding: 16px; border: 1px solid var(--glass-border);
}

.cal-month-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--glass-border);
}

.cal-month-header h4 { font-size: 14px; font-weight: 600; }

.cal-month-nav {
    display: flex; gap: 4px;
}

.cal-month-nav button {
    width: 28px; height: 28px; border-radius: 6px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    color: var(--text-secondary); cursor: pointer; display: flex;
    justify-content: center; align-items: center; font-size: 11px;
    transition: var(--transition);
}

.cal-month-nav button:hover { background: rgba(99, 102, 241, 0.2); color: var(--text-primary); }

.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}

.cal-day-header {
    text-align: center; font-size: 10px; font-weight: 600;
    color: var(--text-muted); padding: 4px 0; text-transform: uppercase;
}

.cal-day {
    aspect-ratio: 1; display: flex; flex-direction: column;
    justify-content: center; align-items: center; border-radius: 6px;
    font-size: 12px; color: var(--text-secondary); position: relative;
    transition: var(--transition); cursor: default;
}

.cal-day.empty { opacity: 0; }
.cal-day.today { background: rgba(99, 102, 241, 0.15); color: var(--accent-primary); font-weight: 700; border: 1px solid rgba(99, 102, 241, 0.3); }

.cal-day.has-due {
    background: rgba(16, 185, 129, 0.15); color: var(--accent-success); font-weight: 600;
    cursor: pointer; border: 1px solid rgba(16, 185, 129, 0.3);
}

.cal-day.has-due:hover { background: rgba(16, 185, 129, 0.25); transform: scale(1.1); }

.cal-day.has-overdue {
    background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); font-weight: 600;
    cursor: pointer; border: 1px solid rgba(239, 68, 68, 0.3);
}

.cal-day.has-overdue:hover { background: rgba(239, 68, 68, 0.25); transform: scale(1.1); }

.cal-day .cal-dot {
    width: 4px; height: 4px; border-radius: 50%; margin-top: 2px;
}

.cal-day.has-due .cal-dot { background: var(--accent-success); }
.cal-day.has-overdue .cal-dot { background: var(--accent-danger); }

/* Cobranza Table */
.cobranza-badge {
    font-size: 10px; padding: 3px 8px; border-radius: 4px;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
    display: inline-block;
}

.cobranza-badge.vigente { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.cobranza-badge.vencida { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); animation: pulseGlow 2s infinite; }
.cobranza-badge.cobrada { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.3); }
}

.days-indicator {
    font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px;
}

.days-indicator.positive { color: var(--accent-success); }
.days-indicator.negative { color: var(--accent-danger); }
.days-indicator.zero { color: var(--accent-warning); }

/* Inline Add Form */
.admin-inline-form {
    display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
    padding: 16px; background: rgba(0,0,0,0.2); border-radius: var(--radius-sm);
    border: 1px dashed rgba(99, 102, 241, 0.3); margin-top: 16px;
}

.admin-inline-form .mini-group {
    display: flex; flex-direction: column; gap: 4px;
}

.admin-inline-form .mini-group label {
    font-size: 10px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.3px;
}

.admin-inline-form .mini-input {
    background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
    border-radius: 4px; color: var(--text-primary); padding: 6px 10px;
    font-size: 13px; font-family: 'Outfit', sans-serif; transition: var(--transition);
}

.admin-inline-form .mini-input:focus { outline: none; border-color: var(--accent-primary); background: rgba(99, 102, 241, 0.08); }

.admin-inline-form .btn-add {
    background: linear-gradient(135deg, var(--accent-success), #059669);
    color: white; border: none; padding: 7px 16px; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: var(--transition); white-space: nowrap;
}

.admin-inline-form .btn-add:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4); }

/* Admin finance module section headers */
.admin-section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}

.admin-section-header h3 {
    font-size: 16px; font-weight: 600;
    display: flex; align-items: center; gap: 10px;
}

.admin-section-header p {
    font-size: 12px; color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1200px) {
    .admin-finance-summary { grid-template-columns: repeat(2, 1fr); }
    .collection-calendar-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-finance-summary { grid-template-columns: 1fr; }
}

/* =========================================
   MÓDULO DE COMPRAS - Control de Precios
   ========================================= */

/* Dropzone */
.compras-dropzone {
    border: 2px dashed rgba(245, 158, 11, 0.4);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(245, 158, 11, 0.03);
    position: relative;
    overflow: hidden;
}

.compras-dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.compras-dropzone:hover,
.compras-dropzone.dragover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15);
}

.compras-dropzone:hover::before,
.compras-dropzone.dragover::before {
    opacity: 1;
}

.compras-dropzone.dragover {
    animation: dropzonePulse 1.5s infinite;
}

@keyframes dropzonePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
    50% { box-shadow: 0 0 20px 5px rgba(245, 158, 11, 0.2); }
}

.dropzone-content {
    position: relative;
    z-index: 1;
}

.dropzone-icon {
    font-size: 48px;
    color: #f59e0b;
    margin-bottom: 16px;
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.compras-dropzone:hover .dropzone-icon {
    transform: scale(1.1) translateY(-4px);
}

.dropzone-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dropzone-subtext {
    font-size: 13px;
    color: var(--text-muted);
}

/* File Info Badge */
.compras-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    margin-top: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    animation: slideInUp 0.3s ease;
}

.compras-file-info span:last-child {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Price Variation Cells */
.price-up {
    color: #ef4444 !important;
    font-weight: 700;
}

.price-down {
    color: #10b981 !important;
    font-weight: 700;
}

.price-neutral {
    color: var(--text-muted) !important;
    font-weight: 500;
}

.price-new {
    color: #6366f1 !important;
    font-style: italic;
}

.trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.trend-badge.up {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.trend-badge.down {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.trend-badge.neutral {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.trend-badge.new {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Summary Badge */
.compras-summary-badge {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.compras-summary-badge .summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
}

/* Compras Metrics Cards Grid */
#compras-metrics-kpis {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
