/* CSS SYSTEM: ERP Obra Jade */

:root {
    /* Fonts */
    --font-primary: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', sans-serif;

    /* Theme colors: Dark (Default) */
    --bg-primary: #0a0c10;
    --bg-secondary: #121620;
    --bg-tertiary: #1a1f2c;
    --border-color: #262f45;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Semantic Colors */
    --primary: #0284c7;
    --primary-glow: rgba(2, 132, 199, 0.15);
    --primary-hover: #0369a1;
    
    --emerald: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.2);
    
    --rose: #f43f5e;
    --rose-glow: rgba(244, 63, 94, 0.2);
    
    --amber: #f59e0b;
    --amber-glow: rgba(245, 158, 11, 0.2);
    
    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, 0.2);

    /* Transitions & Shadows */
    --transition-speed: 0.25s;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow-emerald: 0 0 15px rgba(16, 185, 129, 0.3);
    
    /* Layout */
    --sidebar-width: 260px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
}

/* Light Theme overrides */
body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --primary-glow: rgba(2, 132, 199, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.08);
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

/* Install Modal Specifics */
#install-modal .modal-body ol li {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}
#install-modal .modal-body strong {
    color: var(--text-primary);
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Utility classes */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--emerald) !important; }
.text-danger { color: var(--rose) !important; }
.text-warning { color: var(--amber) !important; }
.text-info { color: var(--primary) !important; }
.text-right { text-align: right; }
.col-span-2 { grid-column: span 2; }
.mb-4 { margin-bottom: 1.5rem; }

/* APP LAYOUT */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 2000; /* Higher z-index to overlap content on mobile */
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transition: transform var(--transition-speed);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom sleek scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--emerald);
}

.logo-icon.emerald-glow {
    box-shadow: var(--shadow-glow-emerald);
}

.brand-text h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-text h2 span {
    color: var(--emerald);
}

.badge-role {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.sidebar-menu {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-speed);
}

.menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.menu-item:hover, .menu-item.active {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.menu-item.active {
    border-left: 3px solid var(--emerald);
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.avatar-placeholder {
    font-size: 1.8rem;
    color: var(--primary);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

#sidebar-username {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar-role {
    font-size: 0.7rem;
    margin: 0;
}

#btn-logout {
    color: var(--rose) !important;
    font-size: 1.2rem;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 32px;
    width: 100%;
    transition: margin-left var(--transition-speed);
}

.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* HEADER */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

#view-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

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

.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition-speed);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: none;
}

.btn-primary {
    background-color: var(--emerald);
    color: #052e16;
}

.btn-primary:hover {
    background-color: #34d399;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.4);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
}

/* VIEWS CONTROLLER */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view-section.active {
    display: block;
}

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

/* KPI CARDS */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: var(--text-muted);
}

.kpi-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--border-radius-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

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

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-details h3 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.kpi-trend {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Card Glow Accent Lines */
.kpi-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.purple-glow::after { background-color: var(--purple); }
.red-glow::after { background-color: var(--rose); }
.green-glow::after { background-color: var(--emerald); }
.blue-glow::after { background-color: var(--primary); }

/* BANNERS */
.alert {
    display: flex;
    gap: 16px;
    padding: 20px;
    border-radius: var(--border-radius-md);
    margin-bottom: 32px;
}

.alert-warning {
    background-color: var(--amber-glow);
    border: 1px solid var(--amber);
    color: var(--text-primary);
}

.alert-icon {
    font-size: 1.5rem;
    color: var(--amber);
}

.alert-content h4 {
    margin-bottom: 4px;
    font-size: 1.05rem;
    font-weight: 700;
}

.alert-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.animate-pulse {
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* CARDS */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
}

/* CHARTS GRID */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
    margin-bottom: 24px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* SUMMARY BOTTOM GRID */
.overview-bottom-grid {
    display: grid;
    grid-template-columns: 1.2fr 2fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .overview-bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* M2 WIDGET */
.m2-widget {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.m2-number-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    border: 1px dashed var(--border-color);
}

.m2-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--emerald);
}

.m2-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.m2-details p {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* RECENT ACTIVITY LIST */
.recent-list-container {
    max-height: 250px;
    overflow-y: auto;
}

.recent-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-menu {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-sm);
    background-color: var(--primary); /* Blue color to be visible */
    color: white;
    cursor: pointer;
    border: none;
    z-index: 1100;
    flex-shrink: 0;
}

.btn-menu:active {
    transform: scale(0.95);
}

.btn-menu i {
    font-size: 1.25rem;
}

.recent-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-title {
    font-weight: 600;
    color: var(--text-primary);
}

.recent-desc {
    color: var(--text-muted);
}

.recent-amount {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--rose);
}

/* TABLES CONTROL & FILTERS */
.table-control-card {
    padding: 20px 24px;
    margin-bottom: 24px;
}

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

.search-box {
    position: relative;
    flex-grow: 1;
    max-width: 450px;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    border-radius: var(--border-radius-md);
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: all var(--transition-speed);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.filter-group select {
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition-speed);
}

.filter-group select:focus {
    border-color: var(--primary);
}

/* DATA TABLES */
.data-table-card {
    padding: 0;
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table, .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 600px; /* Force minimum width to allow scrolling instead of squeezing */
    text-align: left;
}

.table th, .table td, .data-table th, .data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.table th, .data-table th {
    background-color: rgba(0, 0, 0, 0.1);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.table th.sortable, .data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.table th.sortable:hover, .data-table th.sortable:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.02);
}

.table tbody tr, .data-table tbody tr {
    transition: background-color var(--transition-speed);
}

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

.status-badge {
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-speed);
}

.status-badge:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.status-badge.paid {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--emerald);
}

.status-badge.unpaid {
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--rose);
}

.btn-delete-tx, .btn-edit-tx {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-speed);
}

.btn-delete-tx:hover {
    color: var(--rose);
}

.btn-edit-tx:hover {
    color: var(--accent-primary);
}

/* PAGINATION */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

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

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-pag {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-pag:hover:not(:disabled) {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-pag:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 4px;
}

.page-num {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.page-num.active {
    background-color: var(--primary);
    border-color: var(--primary);
    font-weight: 700;
}

.page-num:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05);
}

/* DEPOSITS VIEW */
.deposits-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
}

.deposits-info-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-block-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.purple-card-bg {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(139, 92, 246, 0.02) 100%);
    border-color: var(--purple-glow);
}

.code-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--purple);
}

/* RADIAL PROGRESS */
.progress-radial-container {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 10px 0;
}

.progress-radial {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--emerald) calc(var(--percent) * 1%), var(--bg-tertiary) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-radial::before {
    content: "";
    position: absolute;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
}

.progress-radial-val {
    position: relative;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.progress-radial-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.9rem;
}

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

/* AVANCE FÍSICO (CONCEPTS) */
.progress-overview-card {
    margin-bottom: 32px;
}

.progress-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.progress-hero-metrics {
    display: flex;
    gap: 32px;
    align-items: center;
}

.progress-percentage-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.progress-percentage-hero h2 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--emerald);
}

.progress-percentage-hero.progress-budget-hero h2 {
    color: var(--text-primary);
}

.progress-percentage-hero span {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.progress-metric-bar-container {
    width: 100%;
    height: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
}

.progress-metric-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--emerald) 100%);
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.concepts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.concept-progress-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.concept-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.concept-title-row h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 70%;
}

.concept-amount-tag {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.concept-progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--bg-tertiary);
    border-radius: 3px;
    margin-bottom: 8px;
}

.concept-progress-bar {
    height: 100%;
    background-color: var(--emerald);
    border-radius: 3px;
    transition: width 1s ease-out;
}

.concept-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ADMIN VIEW */
.admin-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

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

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

.comm-stat-box {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comm-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
}

.comm-stat-box h4 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.admin-shares {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-shares h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.share-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px 20px;
}

.share-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.share-info i {
    font-size: 1.4rem;
    color: var(--text-muted);
}

.share-info h5 {
    font-size: 0.9rem;
    font-weight: 600;
}

.share-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.share-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.share-amount strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--emerald);
}

.share-amount span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.red-card-bg {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.05) 0%, rgba(244, 63, 94, 0.02) 100%);
    border-color: var(--rose-glow);
}

.deficit-calc-widget {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.calc-divider {
    border: none;
    border-top: 1px solid var(--border-color);
}

.calc-row.total-row {
    font-weight: 700;
}

.calc-row.total-row span:last-child {
    font-size: 1.15rem;
    font-family: var(--font-display);
}

.deficit-text-desc p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* BITACORA TIMELINE */
.notes-timeline {
    position: relative;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.notes-timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 3px solid var(--border-color);
}

.timeline-dot.highlighted {
    border-color: var(--amber);
}

.timeline-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.timeline-card p {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.timeline-value-badge {
    background-color: var(--primary-glow);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 8px;
}

/* MODAL OVERLAY */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.1, 0.8, 0.2, 1);
}

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

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

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-speed);
}

.btn-close-modal:hover {
    color: var(--rose);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

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

@media (max-width: 500px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid .col-span-2 {
        grid-column: span 1;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 10px 14px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-speed);
}

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

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* PROJECTS VIEW STYLES */
.projects-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    margin-top: 10px;
}

.project-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
    position: relative;
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: var(--emerald);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.08);
}

.project-card.active-project {
    border-color: var(--emerald);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.project-card.active-project::before {
    content: "ACTIVO";
    position: absolute;
    top: 16px;
    right: 16px;
    background-color: var(--emerald);
    color: #052e16;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 10;
}

.project-card-header {
    padding: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.project-card-header h3 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.project-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
}

.project-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.spec-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.project-progress-section {
    margin-top: 8px;
}

.project-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 6px;
    font-weight: 600;
}

.project-card-footer {
    padding: 20px 24px;
    background-color: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-active { background-color: rgba(16, 185, 129, 0.1); color: var(--emerald); }
.status-process { background-color: rgba(2, 132, 199, 0.1); color: var(--primary); }
.status-planning { background-color: rgba(245, 158, 11, 0.1); color: var(--amber); }
.status-completed { background-color: rgba(139, 92, 246, 0.1); color: var(--purple); }

.btn-finalize-project {
    color: var(--purple);
    border-color: rgba(139, 92, 246, 0.4);
    background: transparent;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}
.btn-finalize-project:hover {
    color: #ffffff !important;
    background-color: var(--purple) !important;
    border-color: var(--purple) !important;
    box-shadow: 0 0 10px var(--purple-glow) !important;
}


/* SUPPLIERS VIEW */
.suppliers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.supplier-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.supplier-card:hover {
    transform: translateY(-4px);
    border-color: rgba(2, 132, 199, 0.4);
    box-shadow: var(--shadow-md);
}

.supplier-card-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.supplier-card-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.supplier-card-header .supplier-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.supplier-card-body {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.supplier-amount-section {
    display: flex;
    flex-direction: column;
}

.supplier-amount-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.supplier-amount-val {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 4px;
}

.supplier-progress-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.supplier-progress-bar-container {
    height: 6px;
    background-color: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    display: flex;
}

.supplier-progress-bar {
    height: 100%;
    background-color: var(--emerald);
    border-radius: 3px;
    transition: width var(--transition-speed);
}

.supplier-categories-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.supplier-categories-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.supplier-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.supplier-cat-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(2, 132, 199, 0.1);
    color: var(--primary);
    text-transform: uppercase;
}

.supplier-card-footer {
    padding: 16px 24px;
    background-color: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-xs {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
}

/* FILE EXPLORER / EXPEDIENTE */
.explorer-layout {
    display: flex;
    gap: 24px;
    margin-top: 24px;
    align-items: stretch;
}

.explorer-sidebar {
    width: 320px;
    flex-shrink: 0;
    padding: 24px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.explorer-sidebar h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.explorer-main {
    flex-grow: 1;
    padding: 24px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.explorer-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.explorer-main-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* FOLDER TREE STYLE */
.explorer-folder-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.folder-node-wrapper {
    display: flex;
    flex-direction: column;
}

.folder-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.folder-node:hover {
    background-color: rgba(2, 132, 199, 0.08);
    color: var(--text-primary);
}

.folder-node.active {
    background-color: var(--primary-glow);
    color: var(--primary);
}

.folder-node i {
    font-size: 1rem;
}

.folder-sub-tree {
    padding-left: 20px;
    border-left: 1px dashed var(--border-color);
    margin-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
    margin-bottom: 4px;
}

/* FILE GRID STYLE */
.file-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.file-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.file-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-delete-file {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(244, 63, 94, 0.1);
    border: none;
    color: var(--rose);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}
.btn-delete-file:hover {
    color: #ffffff !important;
    background-color: var(--rose) !important;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.4) !important;
    transform: scale(1.1);
}


.file-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 2rem;
}

.file-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 6px;
    word-break: break-all;
}

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

/* File Icon Colors */
.file-pdf { background-color: rgba(244, 63, 94, 0.1); color: var(--rose); }
.file-image { background-color: rgba(16, 185, 129, 0.1); color: var(--emerald); }
.file-video { background-color: rgba(139, 92, 246, 0.1); color: var(--purple); }
.file-cad { background-color: rgba(245, 158, 11, 0.1); color: var(--amber); }
.file-doc { background-color: rgba(2, 132, 199, 0.1); color: var(--primary); }
.file-generic { background-color: rgba(100, 116, 139, 0.1); color: var(--text-muted); }

/* WEEKLY TIMELINE IN FILE EXPLORER */
.weekly-timeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    padding: 16px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

.timeline-week-btn {
    padding: 8px 4px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

.timeline-week-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background-color: var(--primary-glow);
}

.timeline-week-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.timeline-week-btn.has-report {
    border-color: var(--emerald-glow);
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.1);
}

.schedule-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* GANTT DIAGRAM SCHEDULE */
.gantt-scroll-container {
    overflow-x: auto;
    width: 100%;
    margin-top: 15px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.gantt-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.gantt-table th, .gantt-table td {
    padding: 14px 10px;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    text-align: center;
}

.gantt-table th {
    background-color: rgba(0, 0, 0, 0.15);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.gantt-table th.concept-header-col,
.gantt-table td.concept-name-col {
    text-align: left;
    padding-left: 20px;
    width: 260px;
    min-width: 260px;
    position: sticky;
    left: 0;
    background-color: var(--bg-secondary);
    z-index: 10;
    border-right: 2px solid var(--border-color);
    font-weight: 700;
}

.gantt-table th.concept-header-col {
    background-color: var(--bg-secondary);
}

.gantt-week-col {
    width: 38px;
    min-width: 38px;
    font-weight: 600;
}

.gantt-cell {
    position: relative;
    padding: 6px 4px !important;
}

.gantt-cell.active-bar {
    background-color: rgba(2, 132, 199, 0.05);
}

.gantt-bar {
    height: 24px;
    border-radius: var(--border-radius-sm);
    background-color: rgba(2, 132, 199, 0.15);
    border: 1px solid rgba(2, 132, 199, 0.4);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.gantt-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.2) 0%, var(--emerald-glow) 100%);
    border-right: 2px solid var(--emerald);
    position: absolute;
    left: 0;
    top: 0;
}

.gantt-bar.complete {
    background-color: var(--emerald-glow);
    border-color: rgba(16, 185, 129, 0.4);
}

.gantt-bar.complete .gantt-bar-fill {
    background: var(--emerald-glow);
    width: 100% !important;
}

.gantt-cell-tooltip {
    visibility: hidden;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    text-align: left;
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-speed), transform var(--transition-speed);
    font-size: 0.75rem;
    pointer-events: none;
    line-height: 1.4;
}

.gantt-cell-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.gantt-cell:hover .gantt-cell-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Gantt Chart Footer Sum Row */
.gantt-table tfoot tr {
    background-color: rgba(0, 0, 0, 0.25);
    border-top: 2px solid var(--border-color);
}

.gantt-table tfoot td {
    padding: 14px 10px;
    font-weight: 700;
    border-top: 2px solid var(--border-color);
}

.gantt-table tfoot td.concept-name-col {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    z-index: 10;
}

/* PAYMENT SCHEDULE ON GANTT AND TIMELINE CARD */
.payment-milestone-cell {
    background: rgba(16, 185, 129, 0.02) !important;
}

.payment-badge {
    transition: all 0.3s ease;
}

.payment-badge.paid {
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.payment-badge.pending {
    box-shadow: none;
}

/* Secondary Payment Schedule Card below Gantt */
.payment-schedule-overview-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.payment-step-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.payment-step-card.paid {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.01) 100%);
}

.payment-step-card.pending {
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.payment-step-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--text-muted);
}

.payment-step-card.paid::before {
    background-color: var(--emerald);
}

.payment-step-card.active-next::before {
    background-color: var(--primary);
}

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

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

.payment-step-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.payment-step-badge.paid {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--emerald);
}

.payment-step-badge.pending {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.payment-step-amount {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 4px 0;
}

.payment-step-card.paid .payment-step-amount {
    color: var(--emerald);
}

.payment-step-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.payment-step-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 8px;
    margin-top: 4px;
}




.payment-timeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

/* --- LOGIN INTERFACE & USER ROLES STYLES --- */

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 12, 16, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.light-theme .login-overlay {
    background: rgba(248, 250, 252, 0.95);
}

.modal-content {
    background-color: var(--bg-secondary);
    width: 95%;
    max-width: 600px;
    max-height: 85vh !important;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease-out;
}

#new-tx-form, #new-project-form, #new-deposit-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.modal-body {
    padding: 20px;
    overflow-y: auto !important;
    flex: 1;
    -webkit-overflow-scrolling: touch; /* Smooth scroll for iPhone */
}

.modal-footer {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(16, 185, 129, 0.05);
    text-align: left;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.login-brand .logo-icon {
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.login-brand h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-brand h2 span {
    color: var(--emerald);
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.login-card h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.login-card .form-group {
    margin-bottom: 18px;
}

.login-card .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-card .form-group label i {
    margin-right: 4px;
    color: var(--text-muted);
}

.login-card .form-group input {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
}

.login-card .form-group input:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* User Profile in Sidebar */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.user-profile #btn-logout:hover {
    color: #fda4af !important;
    background: rgba(244, 63, 94, 0.1) !important;
    border-radius: 50%;
}

/* Role restrictions CSS helper classes */
body.client-role .role-admin-only,
body.client-role .role-write-only,
body.client-role .btn-delete-row,
body.client-role .action-col,
body.client-role th.action-col {
    display: none !important;
}

body.resident-role .role-admin-only,
body.resident-role .btn-delete-row,
body.supervisor-role .role-admin-only,
body.supervisor-role .btn-delete-row,
body.supervisor-role .role-resident-only {
    display: none !important;
}

/* Order Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-status.pendiente {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-status.surtido {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-status.cancelado {
    background-color: rgba(244, 63, 94, 0.15) !important;
    color: #fb7185 !important;
    border: 1px solid rgba(244, 63, 94, 0.3);
}
.badge-status.comprado {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Gantt Clip styling */
.gantt-bar-evidence-indicator {
    position: absolute;
    right: 4px;
    bottom: 4px;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    pointer-events: none;
}

/* Evidence Modal Styles */
.evidence-files-list {
    margin-top: 15px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-tertiary);
}

.evidence-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}

.evidence-file-item:last-child {
    border-bottom: none;
}

.evidence-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.evidence-file-info i {
    font-size: 1.1rem;
}

.evidence-file-info a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.evidence-file-info a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.evidence-file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.btn-delete-evidence {
    background: none;
    border: none;
    color: var(--rose);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    transition: background 0.2s;
}

.btn-delete-evidence:hover {
    background: var(--rose-glow);
}

/* Dropzone styling */
.evidence-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 24px;
    text-align: center;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-top: 15px;
}

.evidence-upload-zone:hover {
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.03);
}

.evidence-upload-zone i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.evidence-upload-zone p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* User management specific styles */
.data-table td .user-role-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
}

.user-role-badge.admin {
    background-color: var(--rose-glow);
    color: var(--rose);
}

.user-role-badge.resident {
    background-color: var(--primary-glow);
    color: var(--primary);
}

.user-role-badge.client {
    background-color: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================
   RESPONSIVE MOBILE — SIDEBAR DRAWER
   ============================================ */

/* Hamburger button — oculto en desktop */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    transition: background var(--transition-speed);
}

.hamburger-btn:hover {
    background: var(--bg-tertiary);
}

.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-speed);
}

/* Estado "abierto" del hamburger (X) */
.hamburger-btn.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.is-open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger-btn.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Overlay semitransparente detrás del sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* Header title group (envuelve h1 + subtitle) */
.header-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* RESPONSIVE DESIGN UNIFIED - MOBILE FIX */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 3000;
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    .sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 16px !important; /* Slightly smaller padding to fit better */
    }

    .top-header {
        padding: 12px 16px !important;
        margin-bottom: 20px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .header-left {
        gap: 12px;
        max-width: 100%;
        width: 100%;
    }

    #view-title {
        font-size: 1.25rem !important;
        white-space: normal; /* Allow title to wrap if very long */
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
    }

    .header-actions .btn {
        font-size: 0.8rem;
        padding: 6px 10px;
        flex: 1; /* Make buttons grow to fill space */
        justify-content: center;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    /* Botones de acción: texto más corto en móvil */
    #btn-open-modal .btn-label-text::after    { content: "Egreso"; }
    #btn-open-deposit-modal .btn-label-text::after { content: "Depósito"; }

    /* Stats cards: 2 columnas en móvil */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    /* Overview bottom grid */
    .overview-bottom-grid {
        grid-template-columns: 1fr;
    }

    /* Charts grid */
    .charts-grid {
        grid-template-columns: 1fr !important;
    }

    /* Tables: scroll horizontal */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 560px;
    }

    /* Modales: full width en móvil y scroll */
    .modal-content {
        width: 96vw !important;
        max-width: 96vw !important;
        padding: 0 !important; /* Let modal-body and footer handle padding */
        max-height: 85vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .modal-body {
        padding: 16px !important;
    }

    .modal-footer {
        padding: 12px 16px !important;
    }

    .modal-grid-2col {
        grid-template-columns: 1fr !important;
    }

    /* Projects grid: 1 columna */
    .projects-grid-container {
        grid-template-columns: 1fr !important;
    }

    /* Progress / Schedule views: simplify */
    .schedule-grid,
    .progress-grid {
        grid-template-columns: 1fr !important;
    }

    /* File explorer sidebar */
    .explorer-layout {
        flex-direction: column !important;
        gap: 12px;
    }

    .file-tree-panel {
        width: 100% !important;
        max-height: 220px;
        overflow-y: auto;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
    }

    /* Supplier & deposit cards */
    .suppliers-grid,
    .deposits-grid {
        grid-template-columns: 1fr !important;
    }

    /* Admin view */
    .admin-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ---- BREAKPOINT PEQUEÑO: ≤ 480px ---- */
@media (max-width: 480px) {

    .main-content {
        padding: 12px;
    }

    /* Stats: 1 columna en pantallas muy pequeñas */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    #view-title {
        font-size: 1.15rem !important;
    }

    .btn {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* Modales */
    .modal-content {
        padding: 16px 12px;
    }
}

/* Restricción de Dinero/Presupuesto para Supervisor y Residente de Obra */
body.supervisor-role .progress-budget-hero,
body.supervisor-role .progress-budget-hero + div,
body.supervisor-role .concept-amount-tag,
body.supervisor-role .gantt-budget-col,
body.supervisor-role .gantt-payment-row,
body.supervisor-role #payment-schedule-container,
body.supervisor-role #btn-export-gantt,
body.supervisor-role .spec-budget,
body.supervisor-role .spec-spent,
body.resident-role .progress-budget-hero,
body.resident-role .progress-budget-hero + div,
body.resident-role .concept-amount-tag,
body.resident-role .gantt-budget-col,
body.resident-role .gantt-payment-row,
body.resident-role #payment-schedule-container,
body.resident-role #btn-export-gantt,
body.resident-role .spec-budget,
body.resident-role .spec-spent {
    display: none !important;
}

/* Globo de notificaciones en el menú lateral */
.menu-badge {
    background-color: var(--rose);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto; /* Empuja el globo al extremo derecho del contenedor flex */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.4);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Estilos personalizados para el selector de archivos de comprobante */
.form-group input[type="file"] {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    width: 100%;
}
.form-group input[type="file"]::file-selector-button {
    background: var(--primary);
    color: var(--text-primary);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background var(--transition-speed);
}
.form-group input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
}
body.light-theme .form-group input[type="file"] {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}
body.light-theme .form-group input[type="file"]::file-selector-button {
    background: var(--primary);
    color: #ffffff;
}
body.light-theme .form-group input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
}


