/* ═══════════════════════════════════════
   ANFU Assistant — Estilos Globales
   Dark theme con glassmorphism
   Colores: Índigo (#6366f1) + Magenta (#ec4899)
   ═══════════════════════════════════════ */

/* --- Reset & Variables CSS --- */
/* 
   IMPORTANTE: El reset y body solo aplican en las páginas propias del bot 
   (index.html, admin.html), NO en sitios externos donde se embebe el widget.
   Para eso usamos la clase .anfu-page en el <body> de nuestras páginas.
*/
.anfu-page,
.anfu-page *,
.anfu-page *::before,
.anfu-page *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores primarios */
    --indigo: #6366f1;
    --indigo-light: #818cf8;
    --indigo-dark: #4f46e5;
    --magenta: #ec4899;
    --magenta-light: #f472b6;
    --magenta-dark: #db2777;

    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--indigo), var(--magenta));
    --gradient-dark: linear-gradient(135deg, #0f0c29, #1a1a2e, #16213e);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.05));

    /* Backgrounds */
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(17, 17, 40, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(255, 255, 255, 0.05);

    /* Texto */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Bordes */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.4);

    /* Sombras */
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    /* Tipografía */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Radios */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

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

.anfu-page {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════
   WIDGET DE CHAT — Flotante embebible
   ═══════════════════════════════════════ */

/* Botón flotante del chat */
.anfu-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: var(--shadow-glow), 0 8px 32px rgba(99, 102, 241, 0.3);
    transition: all var(--transition-normal);
    z-index: 10000;
    animation: anfu-pulse 2s infinite;
}

.anfu-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.5), 0 12px 40px rgba(99, 102, 241, 0.4);
}

@keyframes anfu-pulse {

    0%,
    100% {
        box-shadow: var(--shadow-glow), 0 8px 32px rgba(99, 102, 241, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.35), 0 8px 32px rgba(99, 102, 241, 0.4);
    }
}

/* Ventana del chat */
.anfu-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    animation: anfu-slideUp 0.3s ease;
}

.anfu-chat-window.active {
    display: flex;
}

@keyframes anfu-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header del chat */
.anfu-chat-header {
    padding: 16px 20px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.anfu-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.anfu-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.anfu-chat-title h3 {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 1px;
}

.anfu-chat-title span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

.anfu-chat-header-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.anfu-chat-admin-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.anfu-chat-admin-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.anfu-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.anfu-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Área de mensajes */
.anfu-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glass) transparent;
}

.anfu-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.anfu-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: var(--radius-full);
}

/* Burbujas de mensaje */
.anfu-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: anfu-fadeIn 0.3s ease;
}

@keyframes anfu-fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anfu-msg-user {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.anfu-msg-bot {
    align-self: flex-start;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

/* Indicador de escritura */
.anfu-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
}

.anfu-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: anfu-bounce 1.4s infinite;
}

.anfu-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.anfu-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes anfu-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Cards de productos en el chat */
.anfu-product-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.anfu-product-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.anfu-product-card:hover {
    border-color: var(--border-active);
    background: rgba(99, 102, 241, 0.05);
}

.anfu-product-card img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.anfu-product-info {
    flex: 1;
    min-width: 0;
}

.anfu-product-info h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anfu-product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--magenta);
}

.anfu-product-stock {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.anfu-product-stock.in-stock {
    color: #10b981;
}

.anfu-product-stock.low-stock {
    color: #f59e0b;
}

.anfu-product-stock.no-stock {
    color: #ef4444;
}

.anfu-product-btn {
    margin-top: 4px;
    padding: 4px 10px;
    font-size: 10px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition-fast);
    text-decoration: none;
    display: inline-block;
}

.anfu-product-btn:hover {
    opacity: 0.85;
}

/* Input del chat */
.anfu-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.anfu-chat-input {
    flex: 1;
    padding: 10px 14px !important;
    background: var(--bg-input) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: var(--radius-full) !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-family: var(--font-main) !important;
    outline: none !important;
    transition: border-color var(--transition-fast);
}

.anfu-chat-input:focus {
    border-color: var(--border-active) !important;
}

.anfu-chat-input::placeholder {
    color: var(--text-muted) !important;
}

.anfu-chat-send {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    color: white;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.anfu-chat-send:hover {
    transform: scale(1.05);
}

.anfu-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════
   MODAL DE TICKET
   ═══════════════════════════════════════ */

.anfu-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: anfu-fadeIn 0.2s ease;
}

.anfu-modal-overlay.active {
    display: flex;
}

.anfu-modal {
    width: 90%;
    max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
}

.anfu-modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.anfu-modal p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.anfu-form-group {
    margin-bottom: 14px;
}

.anfu-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.anfu-form-group input,
.anfu-form-group textarea,
.anfu-form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-main);
    outline: none;
    transition: border-color var(--transition-fast);
}

.anfu-form-group input:focus,
.anfu-form-group textarea:focus,
.anfu-form-group select:focus {
    border-color: var(--border-active);
}

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

.anfu-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.anfu-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    font-family: var(--font-main);
}

.anfu-btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.anfu-btn-primary:hover {
    opacity: 0.9;
}

.anfu-btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.anfu-btn-secondary:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════
   PÁGINA INDEX — HERO
   ═══════════════════════════════════════ */

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    background: var(--gradient-dark);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 70% 50%, rgba(236, 72, 153, 0.06) 0%, transparent 50%);
    animation: hero-bg-rotate 30s linear infinite;
}

@keyframes hero-bg-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.hero-logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.hero-content h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content .subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.hero-features {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
}

.hero-feature span {
    font-size: 16px;
}

/* ═══════════════════════════════════════
   PANEL ADMIN — LOGIN
   ═══════════════════════════════════════ */

.admin-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-dark);
    padding: 20px;
}

.admin-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.admin-login-card h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-login-card .login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

.admin-login-card .anfu-form-group {
    text-align: left;
}

.login-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 8px;
    display: none;
}

/* ═══════════════════════════════════════
   PANEL ADMIN — DASHBOARD
   ═══════════════════════════════════════ */

.admin-container {
    display: none;
    min-height: 100vh;
    background: var(--gradient-dark);
}

.admin-container.active {
    display: block;
}

/* Topbar */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-topbar-left h1 {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Selector de tienda */
.store-selector {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    padding: 3px;
    border: 1px solid var(--border-glass);
}

.store-btn {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-main);
}

.store-btn.active {
    background: var(--gradient-primary);
    color: white;
}

.store-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Botón logout */
.admin-logout {
    padding: 6px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-main);
}

.admin-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Grid del dashboard */
.admin-content {
    padding: 24px 28px;
    max-width: 1400px;
    margin: 0 auto;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Cards de métricas */
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.metric-card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.metric-card .metric-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.metric-card .metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-card .metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-card .metric-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Secciones del dashboard */
.dashboard-section {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.dashboard-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Gráficos */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    backdrop-filter: blur(10px);
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.chart-card canvas {
    max-height: 280px;
}

/* Health Score */
.health-score-container {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px;
}

.health-score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    flex-shrink: 0;
    border: 3px solid;
    position: relative;
}

.health-score-circle.verde {
    border-color: #10b981;
}

.health-score-circle.amarillo {
    border-color: #f59e0b;
}

.health-score-circle.rojo {
    border-color: #ef4444;
}

.health-score-value {
    font-size: 32px;
    font-weight: 700;
}

.health-score-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.health-score-details {
    flex: 1;
}

.health-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-glass);
}

.health-detail-item:last-child {
    border-bottom: none;
}

.health-detail-bar {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.health-detail-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    transition: width var(--transition-slow);
}

/* Alertas */
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.alert-item:hover {
    border-color: var(--border-active);
}

.alert-item.alta {
    border-left: 3px solid #ef4444;
}

.alert-item.media {
    border-left: 3px solid #f59e0b;
}

.alert-item.baja {
    border-left: 3px solid #10b981;
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* Tabla de tickets */
.tickets-table-container {
    overflow-x: auto;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tickets-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-glass);
}

.tickets-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-secondary);
}

.tickets-table tr:hover td {
    background: rgba(99, 102, 241, 0.03);
    color: var(--text-primary);
}

/* Badges de estado */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
}

.badge-abierto {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-en_proceso {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-cerrado {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Selector de estado inline */
.estado-select {
    padding: 4px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font-main);
}

/* Filtros de tickets */
.ticket-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-main);
}

.filter-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.filter-btn:hover:not(.active) {
    border-color: var(--border-active);
    color: var(--text-primary);
}

/* Insights IA */
.insight-card {
    padding: 16px;
    background: var(--gradient-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.insight-card h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.insight-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-glass);
    border-top-color: var(--indigo);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Ticket stats mini cards */
.ticket-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.ticket-stat {
    text-align: center;
    padding: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
}

.ticket-stat-value {
    font-size: 24px;
    font-weight: 700;
}

.ticket-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Stock crítico */
.stock-critico-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.stock-item-count {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
}

.stock-item-count.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.stock-item-count.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
    .anfu-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 10px;
    }

    .hero-content h1 {
        font-size: 28px;
    }

    .hero-features {
        flex-direction: column;
        align-items: center;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ticket-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-topbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .admin-content {
        padding: 16px;
    }

    .health-score-container {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .store-selector {
        flex-wrap: wrap;
    }
}