:root {
    /* Color Palette: Corporativo Light Mode ($2M Aesthetic) */
    --bg-main: #f8f9fa; /* Gris perla */
    --bg-card: #ffffff; /* Blanco puro */
    --bg-hover: #f0f0f0; 
    
    --bg-sidebar: #17171b; /* Charcoal oscuro de la marca */
    --sidebar-text: #ffffff;
    --sidebar-text-muted: #9ca3af;
    
    --text-primary: #17171b; /* Texto carbón */
    --text-muted: #6b7280; /* Gris */
    
    --accent-gold: #578B31; /* GC Verde Corporativo */
    --accent-gold-hover: #467028; 
    
    --primary-blue: #404041; /* GC Primary Dark */
    --success: #059669; /* Emerald de alto contraste */
    --danger: #dc2626; /* Rojo más profundo */
    --warning: #d97706; /* Ámbar de alto contraste */
    --info: #2563eb; /* Azul para completado */
    
    --border-color: #eaeaea;
    --bg-overlay: rgba(0, 0, 0, 0.03);
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.03);
    
    /* Layout */
    --sidebar-width: 250px;
    --header-height: 70px;
}

[data-theme="dark"] {
    /* Color Palette: Corporativo Dark Mode ($2M Aesthetic) */
    --bg-main: #121215; /* Charcoal muy oscuro */
    --bg-card: #1c1c21; /* Charcoal tarjetas */
    --bg-hover: #2a2a32; 
    
    --bg-sidebar: #0f0f12; /* Sidebar casi negro */
    --sidebar-text: #ffffff;
    --sidebar-text-muted: #9ca3af;
    
    --text-primary: #ffffff; /* Blanco */
    --text-muted: #9ca3af; /* Gris claro */
    
    --accent-gold: #6da641; /* Verde Corporativo Brillante */
    --accent-gold-hover: #7bba4a; 
    
    --primary-blue: #e5e7eb; /* Gris muy claro para destacar en dark mode */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6; /* Azul claro para completado */
    
    --border-color: rgba(255, 255, 255, 0.08);
    --bg-overlay: rgba(255, 255, 255, 0.05);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}

/* =========================================
   LOGIN SCREEN
   ========================================= */
.login-body {
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(circle at top right, #1e293b, transparent 40%),
                      radial-gradient(circle at bottom left, rgba(251, 191, 36, 0.05), transparent 40%);
}

.login-card {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.6s ease-out forwards;
}

.login-card h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--text-primary), var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gold);
    color: var(--bg-main);
}

.btn-primary:hover {
    background: var(--accent-gold-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(251, 191, 36, 0.3);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* =========================================
   DASHBOARD LAYOUT
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

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

.sidebar-header h2 {
    font-size: 1.2rem;
    color: var(--accent-gold);
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 0;
    list-style: none;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background: rgba(74, 124, 89, 0.15); /* Verde con opacidad */
    color: var(--accent-gold);
    border-right: 3px solid var(--accent-gold);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    height: var(--header-height);
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.content-area {
    padding: 2rem;
    flex: 1;
}

/* Utilities */
.data-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: all 0.3s ease;
}
.data-box:hover {
    box-shadow: var(--shadow-md);
}

.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.pt-2 { padding-top: 1rem; }
.pb-2 { padding-bottom: 1rem; }
.p-0 { padding: 0; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-between { justify-content: space-between; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.text-primary { color: var(--text-primary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-gold { color: var(--accent-gold); }
.text-blue { color: var(--primary-blue); }

.font-bold { font-weight: bold; }
.font-semibold { font-weight: 600; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.border-t { border-top: 1px solid var(--border-color); }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-none { border: none; }

.bg-transparent { background-color: transparent; }
.bg-card { background-color: var(--bg-card); }
.bg-blue { background-color: var(--primary-blue); }
.bg-dark { background-color: var(--bg-overlay); }

.rounded { border-radius: 4px; }
.rounded-md { border-radius: 6px; }

.flex-1 { flex: 1; }
.overflow-hidden { overflow: hidden; }
.cursor-pointer { cursor: pointer; }
.mt-1 { margin-top: 0.25rem; }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal Estilos Globales */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1000; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal-content { background: var(--bg-card); width: 95%; max-width: 600px; max-height: 85vh; border-radius: 8px; border: 1px solid var(--border-color); display: flex; flex-direction: column; animation: fadeInUp 0.3s ease-out; }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.close-btn { background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
.close-btn:hover { color: var(--danger); }

/* Controles de Formulario en Modales */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }
.form-control { width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: var(--text-primary); padding: 0.8rem; border-radius: 4px; font-size: 1rem; }
.form-control:focus { border-color: var(--primary-blue); outline: none; }
select.form-control option { background-color: var(--bg-main); color: var(--text-primary); }

@media (max-width: 768px) {
    .modal-content { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; border: none; }
    .modal-body { padding: 1rem; }
}

/* =========================================
   UI COMPONENTS (Toasts & Toggles)
   ========================================= */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-notification {
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.95rem;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    opacity: 0;
    pointer-events: auto;
    background: var(--bg-card);
    color: var(--text-primary);
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-error { border-left: 4px solid var(--danger); }
.toast-success { border-left: 4px solid var(--success); }

.toast-icon { font-size: 1.2rem; }
.toast-content { line-height: 1.4; }

.toast-title {
    display: block;
    margin-bottom: 4px;
    font-size: 1.05rem;
}
.toast-error .toast-title { color: var(--danger); }
.toast-success .toast-title { color: var(--success); }

.theme-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    margin-right: 0.5rem;
    transition: color 0.3s ease;
}
.theme-toggle-btn:hover {
    color: var(--text-primary);
}

/* =========================================
   DASHBOARD & STATS UTILITIES
   ========================================= */
.animate-fade-in-up { animation: fadeInUp 0.8s ease-out; }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--text-primary); margin-top: 1rem; }
.stat-desc { color: var(--text-muted); margin-top: 0.5rem; font-size: 0.9rem; }
.border-gold { border-color: var(--accent-gold); }
.mt-2 { margin-top: 1rem; }
.m-0 { margin: 0; }

/* =========================================
   PROJECTS VIEW UTILITIES
   ========================================= */
.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.empty-state { grid-column: 1 / -1; text-align: center; padding: 4rem 2rem; }
.empty-state-text { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 1rem; }
.btn-center { margin: 0 auto; }
.max-w-sm { max-width: 250px; }

.text-lg { font-size: 1.25rem; }
.text-md { font-size: 1.1rem; }

.status-indicator {
    background-color: transparent;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
}
.status-indicator option { background: var(--bg-card); }
.opt-activo { color: var(--success); }
.opt-pausado { color: var(--accent-gold); }
.opt-completado { color: var(--primary-blue); }
.opt-cancelado { color: var(--danger); }

.btn-icon-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.label-sm { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.2rem; }

.summary-box {
    margin-bottom: 1.5rem;
    background: var(--bg-overlay);
    padding: 0.8rem;
    border-radius: 6px;
}
.amount-usd { color: var(--accent-gold); font-size: 1.4rem; font-weight: bold; }
.amount-nio { color: var(--primary-blue); font-size: 0.9rem; font-weight: bold; margin-top: 0.2rem; }

.progress-header { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--text-muted); }
.progress-bar-bg { width: 100%; background-color: var(--bg-overlay); height: 8px; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; transition: width 0.3s ease; }

.btn-secondary { background-color: var(--bg-overlay); color: var(--text-primary); }
.btn-secondary:hover { background-color: rgba(255,255,255,0.1); }

/* =========================================
   FORM UTILITIES
   ========================================= */
.container-sm { max-width: 800px; margin: 0 auto; }
.pb-5 { padding-bottom: 50px; }
.back-link { color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; transition: color 0.3s; }
.back-link:hover { color: var(--text-primary); }
.form-card { padding: 2.5rem; margin-bottom: 2rem; }
.form-section-title { margin-bottom: 1.5rem; color: var(--text-primary); border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.grid-1 { grid-template-columns: 1fr; }
.input-group { display: flex; align-items: center; gap: 0.5rem; }
.input-group-addon { color: var(--text-muted); }
.form-actions { margin-top: 3rem; display: flex; justify-content: flex-end; gap: 1rem; }
.btn-outline { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background-color: var(--bg-overlay); }
.btn-lg { font-size: 1.1rem; }
.max-w-xs { max-width: 150px; }
.max-w-md { max-width: 300px; }
.text-right { text-align: right; }

/* Status Options */
.opt-activo { color: var(--success); font-weight: 600; background: var(--bg-card); }
.opt-pausado { color: var(--warning); font-weight: 600; background: var(--bg-card); }
.opt-completado { color: var(--info); font-weight: 600; background: var(--bg-card); }
.opt-cancelado { color: var(--danger); font-weight: 600; background: var(--bg-card); }

/* =========================================
   CUSTOM MODAL / CONFIRM
   ========================================= */
.custom-modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 9999; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.custom-modal-overlay.show { opacity: 1; visibility: visible; }
.custom-modal { background: var(--bg-card); width: 90%; max-width: 450px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); transform: scale(0.9) translateY(20px); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); padding: 2rem; border: 1px solid var(--border-color); text-align: center; }
.custom-modal-overlay.show .custom-modal { transform: scale(1) translateY(0); }
.custom-modal-icon { font-size: 3rem; margin-bottom: 1rem; }
.custom-modal-icon.danger { color: var(--danger); }
.custom-modal-icon.warning { color: var(--warning); }
.custom-modal-icon.info { color: var(--info); }
.custom-modal-title { font-family: var(--font-heading); font-size: 1.5rem; color: var(--text-primary); margin-bottom: 1rem; font-weight: 700; }
.custom-modal-text { color: var(--text-muted); font-size: 1rem; margin-bottom: 2rem; white-space: pre-wrap; line-height: 1.6; }
.custom-modal-actions { display: flex; gap: 1rem; justify-content: center; }
.custom-modal-actions .btn { flex: 1; padding: 0.8rem; border-radius: 8px; font-weight: 600; text-transform: none; letter-spacing: normal; width: auto; font-size: 1rem; }
.custom-modal-actions .btn-cancel { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.custom-modal-actions .btn-cancel:hover { background: var(--bg-hover); transform: none; box-shadow: none; }
.custom-modal-actions .btn-confirm.danger { background: var(--danger); border: none; color: white; }
.custom-modal-actions .btn-confirm.danger:hover { background: #b91c1c; transform: none; }
.items-end { align-items: flex-end; }
.total-box { text-align: right; background: rgba(87, 139, 49, 0.1); padding: 1rem 1.5rem; border-radius: 8px; border: 1px solid var(--accent-gold); }
.total-box-label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.total-box-value { font-size: 2rem; font-weight: bold; color: var(--accent-gold); }
.table-container { padding: 0; overflow-x: auto; max-height: 60vh; border-bottom: 2px solid var(--accent-gold); }
.wbs-table { width: 100%; border-collapse: collapse; min-width: 1200px; }
.wbs-thead { position: sticky; top: 0; z-index: 50; background: var(--bg-card); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
[data-theme="dark"] .wbs-thead { background: rgba(28, 28, 33, 0.95); backdrop-filter: blur(8px); box-shadow: 0 4px 6px rgba(0,0,0,0.3); }
.wbs-thead-tr { border-bottom: 2px solid var(--border-color); }
.wbs-th-left { padding: 1.2rem 1rem; text-align: left; color: var(--text-primary); }
.wbs-th-right { padding: 1.2rem 1rem; text-align: right; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }
.text-accent { color: var(--accent-gold); }
.w-12 { width: 12%; }
.w-15 { width: 15%; }
.w-25 { width: 25%; }
.wbs-act-row { background: var(--bg-hover); border-bottom: 1px solid var(--border-color); }
[data-theme="dark"] .wbs-act-row { background: rgba(255,255,255,0.05); }
.wbs-act-title { padding: 0.8rem 1rem; font-weight: bold; color: var(--primary-blue); }
.wbs-act-total { padding: 0.8rem 1rem; text-align: right; font-weight: bold; color: var(--text-primary); }
.wbs-sub-row { border-bottom: 1px dashed var(--border-color); }
[data-theme="dark"] .wbs-sub-row { border-bottom: 1px dashed rgba(255,255,255,0.05); }
.wbs-sub-title { padding: 0.8rem 1rem; color: var(--text-muted); font-size: 0.9rem; padding-left: 2rem; }
.wbs-td-input { padding: 0.5rem; }
.wbs-input { width: 100%; text-align: right; font-family: monospace; font-size: 0.9rem; padding: 0.4rem; }
.wbs-sub-total { padding: 0.8rem 1rem; text-align: right; font-weight: bold; color: var(--text-muted); }
.sticky-footer { position: sticky; bottom: 0; background: var(--bg-card); padding: 1.5rem; border-top: 1px solid var(--accent-gold); display: flex; justify-content: flex-end; align-items: center; gap: 2rem; margin-top: 2rem; box-shadow: 0 -10px 20px rgba(0,0,0,0.1); z-index: 100; }
[data-theme="dark"] .sticky-footer { background: rgba(28, 28, 33, 0.95); backdrop-filter: blur(10px); box-shadow: 0 -10px 20px rgba(0,0,0,0.5); }
.mega-total-label { color: var(--text-muted); text-align: right; }
.mega-total-value { font-size: 1.5rem; font-weight: bold; color: var(--primary-blue); }
.btn-save-mega { min-width: 250px; font-size: 1.1rem; padding: 1rem; }
