/* ============================================
   SISTEMA DIAMELAB - ESTILOS GLOBALES
   Identidad Visual: Azul Navy, Verde Lab, Blanco
   ============================================ */

/* ============================================
   VARIABLES CSS (Design Tokens)
   ============================================ */
:root {
    /* Colores principales - Identidad Diamelab */
    --diamelab-primary: #1a237e;      /* Azul Navy del logo */
    --diamelab-primary-light: #283593;
    --diamelab-primary-dark: #0d1642;
    --diamelab-accent: #4CAF50;        /* Verde laboratorio */
    --diamelab-accent-light: #66BB6A;
    --diamelab-accent-dark: #388E3C;
    
    /* Colores neutros */
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f0f1f3;
    --gray-200: #e4e6e9;
    --gray-300: #c8cdd4;
    --gray-400: #9ba3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Colores semánticos */
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Tipografía */
    --font-primary: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Courier New', monospace;
    
    /* Espaciado */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Bordes */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    
    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ============================================
   RESET Y BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--diamelab-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--diamelab-primary-light);
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--diamelab-primary) 0%, var(--diamelab-primary-light) 100%);
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--diamelab-primary-dark) 0%, var(--diamelab-primary) 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: var(--white);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: var(--white);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-xs);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    color: var(--gray-800);
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    outline: none;
}

.form-control:focus {
    border-color: var(--diamelab-primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-valid {
    border-color: var(--success);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 2px;
    display: none;
}

.form-error.visible {
    display: block;
}

/* Input groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
    flex: 1;
}

.input-group .input-group-text {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--gray-100);
    border: 1.5px solid var(--gray-300);
}

.input-group > *:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
}

.input-group > *:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
}

.input-group > *:not(:last-child) {
    border-right: none;
}

/* ============================================
   TABLAS
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--white);
}

.table thead {
    background: linear-gradient(135deg, var(--diamelab-primary) 0%, var(--diamelab-primary-light) 100%);
    color: var(--white);
}

.table thead th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.8125rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody td {
    padding: 0.875rem 1rem;
    color: var(--gray-700);
    vertical-align: middle;
}

.table tbody tr:last-child {
    border-bottom: none;
}

/* Badges en tablas */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-pendiente {
    background: var(--warning-light);
    color: #92400e;
}

.badge-pagada {
    background: var(--success-light);
    color: #166534;
}

.badge-parcial {
    background: var(--info-light);
    color: #1e40af;
}

.badge-anulada {
    background: var(--danger-light);
    color: #991b1b;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2, .card-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-800);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ============================================
   ALERTAS
   ============================================ */
.diamelab-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 1rem 1.25rem;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

.diamelab-alert.alert-success {
    border-left-color: var(--success);
    background: var(--success-light);
}

.diamelab-alert.alert-error {
    border-left-color: var(--danger);
    background: var(--danger-light);
}

.diamelab-alert.alert-warning {
    border-left-color: var(--warning);
    background: var(--warning-light);
}

.diamelab-alert.alert-info {
    border-left-color: var(--info);
    background: var(--info-light);
}

.alert-icon {
    font-size: 1.125rem;
    font-weight: bold;
    flex-shrink: 0;
}

.alert-message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
    padding: 0 0 0 4px;
}

.alert-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   MODALES
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.25s ease;
}

.modal-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-body {
    padding: var(--space-lg) var(--space-xl);
}

.modal-footer {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    transition: color var(--transition-fast);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.modal-close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   MODAL ACERCA DE
   ============================================ */
.about-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(4px);
}

.about-modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
    animation: scaleIn 0.3s ease;
}

.about-modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all var(--transition-base);
}

.about-modal-close:hover {
    background: var(--danger);
    color: var(--white);
}

.about-header {
    text-align: center;
    padding: var(--space-2xl) var(--space-xl) var(--space-lg);
    background: linear-gradient(135deg, var(--diamelab-primary) 0%, var(--diamelab-primary-light) 100%);
    color: var(--white);
    position: relative;
}

.about-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--white);
    border-radius: 50% 50% 0 0;
}

.about-logo {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 4px solid var(--white);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-md);
}

.about-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.about-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.about-body {
    padding: var(--space-lg) var(--space-xl);
}

.about-section {
    margin-bottom: var(--space-lg);
}

.about-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--diamelab-primary);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.about-section p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: var(--space-xs);
}

.developer-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.developer-avatar {
    flex-shrink: 0;
}

.developer-info h4 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--diamelab-primary);
    margin-bottom: 2px;
}

.developer-info p {
    font-size: 0.8125rem;
    margin-bottom: 0;
}

.developer-motto {
    font-style: italic;
    color: var(--diamelab-accent) !important;
    font-weight: 600;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tech-tag {
    padding: 0.25rem 0.625rem;
    background: var(--diamelab-primary-light);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.about-footer {
    text-align: center;
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--gray-100);
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ============================================
   CONFIRM MODAL
   ============================================ */
.confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.2s ease;
}

.confirm-modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    padding: var(--space-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.confirm-message {
    font-size: 1rem;
    margin-bottom: var(--space-lg);
    color: var(--gray-700);
}

.confirm-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* ============================================
   SPINNER / LOADING
   ============================================ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

.spinner-tasa {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--diamelab-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--diamelab-primary-dark) 0%, var(--diamelab-primary) 50%, var(--diamelab-primary-light) 100%);
    padding: var(--space-md);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(circle, rgba(76, 175, 80, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 1000px;
    min-height: 580px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.login-brand {
    flex: 1;
    background: linear-gradient(135deg, var(--diamelab-primary) 0%, var(--diamelab-primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--white);
    position: relative;
}

.login-brand::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.login-brand-logo {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 4px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: var(--space-xl);
    position: relative;
    z-index: 1;
}

.login-brand h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    position: relative;
    z-index: 1;
}

.login-brand p {
    font-size: 0.9375rem;
    opacity: 0.85;
    text-align: center;
    max-width: 280px;
    position: relative;
    z-index: 1;
}

.login-brand-tagline {
    margin-top: var(--space-lg);
    padding: var(--space-sm) var(--space-lg);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.login-form-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-2xl);
    max-width: 450px;
}

.login-form-wrapper h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--space-xs);
}

.login-form-wrapper .login-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: var(--space-xl);
}

.login-form .form-group {
    margin-bottom: var(--space-lg);
}

.login-form .form-label {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form .btn-login {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    margin-top: var(--space-sm);
}

.login-footer {
    margin-top: var(--space-xl);
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-400);
}

.login-footer a {
    color: var(--diamelab-primary);
    font-weight: 500;
}

/* ============================================
   LAYOUT PRINCIPAL (Dashboard)
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sidebar-header img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.sidebar-header .brand-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--diamelab-primary);
}

.sidebar-header .brand-tagline {
    font-size: 0.6875rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    padding: 0 var(--space-md);
    margin-bottom: var(--space-xs);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.625rem var(--space-md);
    border-radius: var(--radius-md);
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--gray-50);
    color: var(--diamelab-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--diamelab-primary) 0%, var(--diamelab-primary-light) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(26, 35, 126, 0.25);
}

.nav-link svg, .nav-link .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--gray-100);
}

.user-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    margin-bottom: var(--space-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--diamelab-primary) 0%, var(--diamelab-accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.6875rem;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: 64px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    color: var(--gray-600);
}

.menu-toggle:hover {
    background: var(--gray-100);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.tasa-bcv-display {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, var(--diamelab-accent-light) 0%, var(--diamelab-accent) 100%);
    color: var(--white);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
}

.tasa-valor {
    font-weight: 700;
}

.tasa-fuente {
    font-size: 0.6875rem;
    opacity: 0.8;
    font-weight: 400;
}

.tasa-error {
    font-size: 0.75rem;
    color: var(--danger);
}

.topbar-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.5rem 0.875rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--gray-600);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.topbar-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: var(--space-xl);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.primary::before {
    background: linear-gradient(90deg, var(--diamelab-primary) 0%, var(--diamelab-primary-light) 100%);
}

.stat-card.success::before {
    background: linear-gradient(90deg, var(--success) 0%, #16a34a 100%);
}

.stat-card.warning::before {
    background: linear-gradient(90deg, var(--warning) 0%, #d97706 100%);
}

.stat-card.danger::before {
    background: linear-gradient(90deg, var(--danger) 0%, #dc2626 100%);
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: var(--space-xs);
}

/* ============================================
   FILTROS Y TOOLBAR
   ============================================ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.toolbar-filters .form-control {
    width: auto;
    min-width: 180px;
}

.toolbar-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ============================================
   ESTADOS DE VACÍO
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--gray-400);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================
   VENTAS - ÍTEMS DINÁMICOS
   ============================================ */
.items-container {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    background: var(--gray-50);
}

.items-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr 1fr 40px;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-sm);
}

.item-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr 1fr 40px;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-sm);
}

.item-row .form-control {
    font-size: 0.8125rem;
    padding: 0.5rem;
}

.btn-remove-item {
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.btn-remove-item:hover {
    background: var(--danger);
    color: var(--white);
}

/* ============================================
   PAGOS - COMPROBANTES
   ============================================ */
.comprobante-preview {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--info-light);
    border-radius: var(--radius-md);
    margin-top: var(--space-xs);
}

.comprobante-preview a {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .login-container {
        flex-direction: column;
        max-width: 400px;
    }
    
    .login-brand {
        padding: var(--space-xl);
        min-height: 200px;
    }
    
    .login-brand-logo {
        width: 100px;
        height: 100px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-filters .form-control {
        width: 100%;
    }
    
    .items-header,
    .item-row {
        grid-template-columns: 1fr 1fr 80px 40px;
    }
    
    .items-header > :nth-child(2),
    .item-row > :nth-child(2) {
        display: none;
    }
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--diamelab-primary) !important; }
.text-muted { color: var(--gray-400) !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.d-flex { display: flex !important; }
.justify-between { justify-content: space-between !important; }
.items-center { align-items: center !important; }
.gap-2 { gap: var(--space-sm) !important; }
.mt-2 { margin-top: var(--space-sm) !important; }
.mt-3 { margin-top: var(--space-md) !important; }
.mb-3 { margin-bottom: var(--space-md) !important; }
.w-100 { width: 100% !important; }
.hidden { display: none !important; }
