: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;
    overflow-x: hidden;
}

.app-wrapper {
    min-height: 100vh;
}

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

.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-width: 0;
}

.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(0,0,0,0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.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 !important;
        height: 100% !important;
        z-index: 1040;
        left: 0;
        top: 0;
        bottom: 0;
        margin-left: -260px;
    }

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

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

/* ============================================================
   AUTH PAGES - Estafeta Redesign
   ============================================================ */

.auth-bg {
    background: linear-gradient(160deg, #0F172A 0%, #1a1030 40%, #B01E14 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.auth-logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
}
.auth-logo-accent { color: #F59E0B; }
.auth-badge {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 3px 12px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0F172A;
    text-align: center;
    margin-bottom: 0.25rem;
}
.auth-subtitle {
    font-size: 0.875rem;
    color: #64748B;
    text-align: center;
    margin-bottom: 2rem;
}

.auth-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.35rem;
}
.auth-input-icon {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-right: none;
    color: #94A3B8;
}
.auth-input {
    border: 2px solid #E2E8F0;
    border-left: none;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
    box-shadow: none !important;
    transition: border-color 0.2s;
}
.auth-input:focus {
    border-color: #DA291C;
}
.auth-input-icon + .auth-input {
    border-left: 2px solid #E2E8F0;
}
.auth-input:focus,
.auth-input:focus ~ .auth-input-icon {
    border-color: #DA291C;
}

.auth-link {
    color: #DA291C;
    text-decoration: none;
    font-weight: 500;
}
.auth-link:hover { color: #B01E14; text-decoration: underline; }

.btn-auth-submit {
    background: linear-gradient(135deg, #DA291C, #B01E14);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 10px;
    transition: all 0.2s;
}
.btn-auth-submit:hover {
    background: linear-gradient(135deg, #B01E14, #8B120C);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(218,41,28,0.35);
}

/* ============================================================
   ADMIN SIDEBAR & NAVBAR - Estafeta
   ============================================================ */

.sidebar {
    background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%) !important;
    border-right: none !important;
}
.sidebar .sidebar-brand a { color: #fff !important; }
.sidebar .sidebar-brand .badge { background: rgba(255,255,255,0.1) !important; color: rgba(255,255,255,0.6) !important; }
.sidebar .nav-link {
    color: rgba(255,255,255,0.55) !important;
}
.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.06) !important;
    color: rgba(255,255,255,0.9) !important;
}
.sidebar .nav-link.active {
    background: rgba(218,41,28,0.2) !important;
    color: #fff !important;
}
.sidebar .sidebar-footer {
    border-color: rgba(255,255,255,0.08) !important;
    color: rgba(255,255,255,0.5) !important;
}

/* Navbar */
.navbar {
    background: #fff !important;
    border-bottom: 1px solid #E2E8F0 !important;
}
