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

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
    font-size: 0.9rem;
}

#wrapper { display: flex; }

/* ===================== SIDEBAR ===================== */
#sidebar {
    width: 260px;
    min-height: 100vh;
    background: #0f172a;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 20px 16px;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    border-bottom: 1px solid #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-section {
    padding: 16px 16px 4px;
    color: #475569;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

#sidebar .nav-link {
    color: #94a3b8;
    padding: 9px 16px;
    border-radius: 6px;
    margin: 1px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all .15s;
    font-size: 0.88rem;
    text-decoration: none;
}

#sidebar .nav-link i {
    width: 16px;
    text-align: center;
}

#sidebar .nav-link:hover {
    background: #1e293b;
    color: #e2e8f0;
}

#sidebar .nav-link.active {
    background: #1e40af;
    color: #fff;
    font-weight: 500;
}

.sidebar-user {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid #1e293b;
    color: #94a3b8;
    font-size: 0.82rem;
}

.sidebar-user a {
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.8rem;
}

.sidebar-user a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* ===================== MAIN CONTENT ===================== */
#main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
}

.top-navbar {
    background: #fff;
    padding: 12px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-content { padding: 24px; }

.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.breadcrumb {
    margin: 0;
    font-size: 0.82rem;
}

.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }

/* ===================== CARDS ===================== */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 14px 20px;
    font-weight: 600;
    color: #0f172a;
    font-size: 0.9rem;
    border-radius: 8px 8px 0 0 !important;
}

.card-body { padding: 20px; }

/* Stat cards */
.stat-card { border-left: 4px solid #2563eb; }
.stat-card.green { border-left-color: #16a34a; }
.stat-card.orange { border-left-color: #d97706; }
.stat-card.purple { border-left-color: #7c3aed; }
.stat-card.red { border-left-color: #dc2626; }

.stat-number { font-size: 2rem; font-weight: 700; color: #0f172a; line-height: 1; }
.stat-label { font-size: 0.82rem; color: #64748b; margin-top: 4px; }
.stat-icon { font-size: 2rem; opacity: 0.15; }

/* ===================== TABLES ===================== */
.table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    vertical-align: middle;
    font-size: 0.88rem;
}

/* ===================== BADGES ===================== */
.badge-activo { background: #dcfce7; color: #15803d; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-inactivo { background: #fee2e2; color: #dc2626; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-borrador { background: #f1f5f9; color: #475569; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-enviado { background: #dbeafe; color: #1d4ed8; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-aprobado { background: #dcfce7; color: #15803d; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-rechazado { background: #fee2e2; color: #dc2626; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-vencido { background: #fef3c7; color: #d97706; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }

/* Role badges */
.badge-admin { background: #dbeafe; color: #1d4ed8; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-operador { background: #f1f5f9; color: #475569; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }

/* ===================== BUTTONS ===================== */
.btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
}
.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-action { padding: 4px 10px; font-size: 0.78rem; border-radius: 5px; }

/* ===================== FORMS ===================== */
.form-label { font-weight: 500; font-size: 0.85rem; color: #374151; }

.form-control, .form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.88rem;
}

.form-control:focus, .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.section-divider { border: none; border-top: 1px solid #e2e8f0; margin: 20px 0; }

/* ===================== ITEMS TABLE (BUDGET) ===================== */
.items-table th { background: #f8fafc; }
.items-table td input {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    width: 100%;
}
.items-table td input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}

/* Totals box */
.totals-box {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px 20px;
    border: 1px solid #e2e8f0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9rem;
    color: #374151;
}

.total-row.grand-total {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    border-top: 2px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 6px;
}

/* ===================== LOGIN PAGE ===================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
}

.login-left {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    width: 45%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: white;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

/* ===================== PRINT STYLES ===================== */
@media print {
    #sidebar, .top-navbar, .btn-print, .no-print { display: none !important; }
    #main-content { margin-left: 0 !important; }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-260px);
        transition: transform .3s;
    }
    #sidebar.open {
        transform: translateX(0);
    }
    #main-content {
        margin-left: 0;
    }
    .login-left {
        display: none;
    }
    .login-right {
        width: 100%;
    }
}

/* ===================== MISC ===================== */
.text-muted-sm { font-size: 0.8rem; color: #94a3b8; }

.alert { border-radius: 8px; }

.modal-header { border-bottom: 1px solid #f1f5f9; }
.modal-footer { border-top: 1px solid #f1f5f9; }

/* Select2 Bootstrap 5 fix */
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.88rem;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
