:root {
    --af-primary: #1a1a2e;
    --af-accent: #4a6cf7;
    --af-success: #10b981;
    --af-warning: #f59e0b;
    --af-danger: #ef4444;
    --af-gray-50: #f9fafb;
    --af-gray-100: #f3f4f6;
    --af-gray-200: #e5e7eb;
    --af-gray-600: #6b7280;
    --af-gray-800: #1f2937;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    -webkit-font-smoothing: antialiased;
}

.sidebar {
    min-width: 260px;
    max-width: 260px;
    overflow-y: auto;
    transition: margin-left 0.3s ease;
}

.sidebar .nav-link {
    color: #64748b;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

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

.sidebar .nav-link.active {
    background-color: #eff6ff;
    color: #3b82f6;
}

.main-content {
    min-height: 100vh;
}

.content {
    flex: 1;
}

.footer {
    font-size: 0.8rem;
}

.auth-bg {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
}

.auth-header h4 {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.portal-bg {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
}

.portal-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 4rem 1.5rem 2rem;
}

.portal-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.portal-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.03);
}

.card-stat {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease;
}

.card-stat:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-stat .stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.card-stat .stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 4px;
}

.card-stat .stat-icon {
    font-size: 1.5rem;
}

.badge-status {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

.badge-facturado {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-pendiente {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-cancelado {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-error {
    background-color: #fce7f3;
    color: #9d174d;
}

.table-modern {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.table-modern thead th {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 0.75rem 1rem;
}

.table-modern tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #9ca3af;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spin-refresh {
    animation: spin 0.6s ease-in-out;
}

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

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        z-index: 1040;
        left: 0;
        top: 0;
        bottom: 0;
        margin-left: -260px;
    }

    .sidebar.show {
        margin-left: 0;
    }

    .main-content {
        width: 100%;
    }
}
