:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
}

/* App Layout */
#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
aside {
    width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.nav-link.active,
.nav-link:hover {
    background: var(--glass);
    color: var(--text-main);
}

.nav-link i {
    margin-right: 0.75rem;
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Cards & Components */
.card {
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: #000000;
    outline: none;
    transition: border-color 0.2s;
    text-transform: uppercase;
}

select option {
    background: #ffffff;
    color: #000000;
}

input:focus,
select:focus {
    border-color: var(--primary);
}

button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
}

.actions {
    display: flex;
    gap: 0.25rem;
}

.inactive-item {
    opacity: 0.5;
    text-decoration: line-through;
    color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

th {
    padding: 0.75rem 0.5rem;
    font-size: 0.7rem;
}

/* Responsive Table Utils */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.table-responsive table {
    min-width: 800px;
}

/* Dense table inputs */
.table-responsive input[type="number"],
.table-responsive input[type="date"] {
    padding: 0.4rem;
    font-size: 0.85rem;
    width: auto !important;
    min-width: 80px;
}

#projection-list table,
#confirmation-list table {
    min-width: 1000px;
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-badge.pendiente {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-badge.pagado {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.status-badge.proyectado {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent);
}

.status-badge.vencido {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: auto;
    padding: 2rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    aside {
        width: 80px;
        padding: 1rem 0.5rem;
    }

    .nav-link span {
        display: none;
    }

    .nav-link i {
        margin-right: 0;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    aside {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        overflow-x: auto;
    }

    main {
        padding: 1rem;
    }
}

/* Searchable Dropdown */
.search-container {
    position: relative;
    width: 100%;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    color: #000000;
}

.search-results.active {
    display: block;
}

.search-results li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    list-style: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.search-results li:last-child {
    border-bottom: none;
}

.search-results li:hover {
    background: #f1f5f9;
}

.search-results b {
    color: var(--accent);
}

footer {
    width: 100%;
}

main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}