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

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Inter', sans-serif; 
}

body {
    background-color: #f8fafc; 
    height: 100vh; 
    overflow: hidden; 
    color: #1e293b;
}

/* =========================================
   ESTILOS DEL LOGIN (INTACTOS - LOS QUE TE GUSTAN)
   ========================================= */

.login-body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: #f4f6f9;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 61, 166, 0.1);
    overflow: hidden;
    margin: 20px;
}

.login-brand-panel {
    flex: 1;
    background: linear-gradient(135deg, #FFA480 0%, #FFE4D6 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: white;
    overflow: hidden;
}

.brand-logo {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2;
    color: #FF6C2C;
}

.brand-content { position: relative; z-index: 2; }
.brand-content h1 { font-size: 42px; line-height: 1.2; font-weight: 700; margin-bottom: 20px; }
.brand-content p { font-size: 18px; opacity: 0.9; line-height: 1.5; max-width: 400px; margin-bottom: 50px; }
.brand-footer { display: flex; gap: 20px; font-size: 24px; opacity: 0.8; color: #FF6C2C; }

.brand-decoration {
    position: absolute;
    bottom: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: rgba(255, 108, 44, 0.1);
    border-radius: 50%;
}
.brand-decoration::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -100px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.login-form-panel { flex: 1; background: #ffffff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 400px; }
.login-header { margin-bottom: 30px; }
.login-header h2 { font-size: 28px; color: #003DA6; margin: 0 0 10px 0; font-weight: 600; }
.login-header p { font-size: 15px; color: #64748b; margin: 0; }

.login-error {
    background: #fff3ed; color: #FF6C2C; padding: 12px; border-radius: 8px; font-size: 14px;
    margin-bottom: 20px; display: flex; align-items: center; gap: 8px; border: 1px solid #ffe0d1;
}

.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 14px; color: #334155; font-weight: 500; margin-bottom: 8px; }

.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"] {
    width: 100%; padding: 12px 16px; border: 1px solid #FFE4D6; border-radius: 8px; font-size: 15px;
    color: #1e293b; background: #f8fafc; transition: all 0.2s; box-sizing: border-box;
}

.login-form input:focus { outline: none; border-color: #003DA6; background: #fff; box-shadow: 0 0 0 4px rgba(0, 61, 166, 0.1); }

.password-wrapper { position: relative; }
.toggle-password { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 16px; padding: 0; }
.toggle-password:hover { color: #FF6C2C; }

.form-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; font-size: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; color: #64748b; cursor: pointer; font-weight: 400; margin-bottom: 0; }
.forgot-link { color: #003DA6; text-decoration: none; font-weight: 600; }
.forgot-link:hover { color: #FF6C2C; text-decoration: underline; }

.btn-login {
    width: 100%; padding: 14px; background: #FF6C2C; color: white; border: none; border-radius: 8px;
    font-size: 16px; font-weight: 600; cursor: pointer; display: flex; justify-content: center;
    align-items: center; gap: 10px; transition: all 0.3s;
}
.btn-login:hover { background: #e55a1d; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255, 108, 44, 0.3); }
.btn-login:active { transform: translateY(0); }

.login-footer { margin-top: 30px; text-align: center; font-size: 14px; color: #64748b; }
.login-footer a { color: #003DA6; text-decoration: none; font-weight: 600; }
.login-footer a:hover { color: #FF6C2C; text-decoration: underline; }

.bottom-links { margin-top: 40px; font-size: 12px; color: #94a3b8; display: flex; gap: 15px; }
.bottom-links a { color: #94a3b8; text-decoration: none; }
.bottom-links a:hover { color: #003DA6; }


/* =========================================
   ESTILOS DEL DASHBOARD
   ========================================= */

body:not(.login-body) { 
    background-color: #f4f6f8; 
    height: 100vh; 
    overflow: hidden; 
    color: #1e293b;
}

.app-container { 
    display: flex; 
    height: 100vh; 
    padding: 15px; 
    gap: 15px;
    box-sizing: border-box; 
    overflow: hidden; 
}

/* 1. SIDEBAR (Menú Izquierdo) */
.sidebar { 
    width: 200px; 
    background: #ffffff; 
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex; 
    flex-direction: column; 
    padding: 20px 15px; 
}

.sidebar .logo { 
    font-size: 20px; 
    font-weight: 700; 
    color: #FF6C2C; 
    margin-bottom: 30px; 
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 10px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 5px; }
.sidebar nav a { 
    display: flex; align-items: center; gap: 12px; padding: 10px 15px; 
    color: #64748b; text-decoration: none; border-radius: 8px; 
    font-size: 14px; font-weight: 500; transition: all 0.2s;
}

.sidebar nav a:hover { background: #f8fafc; color: #FF6C2C; }

.sidebar nav a.active { 
    background: #fff3ed; 
    color: #FF6C2C; 
    font-weight: 600;
}

.sidebar nav a.active i { color: #FF6C2C; }

.sidebar .user-profile { 
    margin-top: auto; padding-top: 15px; border-top: 1px solid #e2e8f0; 
    display: flex; justify-content: space-between; align-items: center; color: #64748b; font-size: 13px; font-weight: 500;
    padding-left: 10px;
}

.sidebar .user-profile a { color: #FF6C2C; text-decoration: none; font-weight: 600; }
.sidebar .user-profile a:hover { text-decoration: underline; }


/* 2. LISTA DE CHATS (Columna 2) */
.chat-list { 
    width: 340px; 
    background: #ffffff; 
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    height: 100%; 
}

.chat-list-header { 
    padding: 15px 20px; 
    border-bottom: 1px solid #e2e8f0; 
    flex-shrink: 0; 
}

.chat-list-header input { 
    width: 100%; 
    padding: 10px 15px; 
    border: 1px solid #e2e8f0; 
    background: #f8fafc; 
    border-radius: 8px; 
    outline: none; 
    font-size: 13px; 
    transition: all 0.2s;
    box-sizing: border-box; 
}

.chat-list-header input:focus { border-color: #FF6C2C; background: #fff; }

.chat-items { flex: 1; overflow-y: auto; }
.chat-items::-webkit-scrollbar { width: 5px; }
.chat-items::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.chat-item { 
    display: flex; align-items: flex-start; padding: 15px; 
    border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: all 0.2s;
}
.chat-item:hover { background: #f8fafc; }
.chat-item.active { background: #fff7f3; border-left: 3px solid #FF6C2C; }

.chat-item img { border-radius: 50%; margin-right: 12px; width: 42px; height: 42px; object-fit: cover; border: 1px solid #e2e8f0; }
.chat-info { flex: 1; display: flex; flex-direction: column; }
.chat-info h4 { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 3px; display: flex; justify-content: space-between; align-items: center;}
.chat-info h4 span { font-size: 11px; font-weight: 400; color: #94a3b8; } 
.chat-info p { font-size: 13px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }


/* 3. ÁREA DE CHAT (Columna 3) */
.chat-area { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

/* Header flotante*/
.chat-header { 
    padding: 12px 20px; 
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.chat-header-left { display: flex; align-items: center; gap: 15px; }
.chat-avatar-header { 
    width: 40px; height: 40px; 
    background: #e8f5e9; 
    border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
}
.chat-title h3 { font-size: 16px; font-weight: 600; color: #1e293b; margin-bottom: 2px; }
.chat-title p { font-size: 12px; color: #64748b; display: flex; align-items: center; gap: 5px; }

.chat-actions button { 
    background: #fff; border: 1px solid #e2e8f0; padding: 8px; width: 36px; height: 36px;
    border-radius: 8px; cursor: pointer; color: #64748b; transition: all 0.2s;
    display: inline-flex; align-items: center; justify-content: center; margin-left: 5px;
}
.chat-actions button:hover { background: #f8fafc; color: #FF6C2C; border-color: #FF6C2C; }

/* Contenedor de mensajes flotante */
.messages-container { 
    flex: 1; 
    padding: 25px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    background: #ffffff; 
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.day-divider { text-align: center; margin: 10px 0; }
.day-divider span { background: #f1f5f9; color: #64748b; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; }

.message { 
    max-width: 65%; 
    padding: 12px 16px; 
    border-radius: 10px; 
    font-size: 14px; 
    line-height: 1.5;
    position: relative;
}

.message.out { 
    align-self: flex-end; 
    background: #FFF9F5; 
    color: #1e293b; 
    border-bottom-right-radius: 2px; 
}

.message.in { 
    align-self: flex-start; 
    background: #ffffff; 
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px; 
}

/* La línea naranja a la izquierda de los mensajes entrantes (opcional) */
.message-border-left { border-left: 3px solid #FF6C2C; background: #fafafa; }

.msg-time { display: block; font-size: 10px; color: #94a3b8; text-align: right; margin-top: 4px; }
.message.out .msg-time { color: #d9754a; }

/* Input flotante (El bloque de escribir) */
.chat-input-area { 
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    flex-shrink: 0; 
}

/* Barra de herramientas superior del input */
.input-toolbar {
    padding: 10px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    gap: 18px;
    color: #94a3b8;
    font-size: 14px;
    background: #fff;
}

.input-toolbar i { cursor: pointer; transition: color 0.2s; }
.input-toolbar i:hover { color: #FF6C2C; }

/* Área donde se escribe */
.input-main {
    display: flex;
    align-items: flex-end; 
    padding: 10px 20px 0 20px; 
    gap: 15px;
}

.chat-input-area textarea { 
    flex: 1; 
    padding: 10px 0; 
    border: none; 
    resize: none; 
    outline: none; 
    font-size: 14.5px; 
    background: transparent; 
    min-height: 40px; 
    max-height: 120px; 
    color: #1e293b;
    line-height: 1.4;
}

.chat-input-area textarea::placeholder { color: #94a3b8; }

.send-btn { 
    background: #FF6C2C; 
    color: white; 
    border: none; 
    width: 40px; 
    height: 40px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 16px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    transition: all 0.2s;
    flex-shrink: 0; 
    margin-bottom: 5px; 
}
.send-btn:hover { background: #e55a1d; }

/* Barra inferior de herramientas (Adjuntar, reloj, micro) */
.input-footer {
    padding: 5px 20px 15px 20px; 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    color: #94a3b8; 
    font-size: 16px;
}
.input-footer i { cursor: pointer; transition: color 0.2s; }
.input-footer i:hover { color: #FF6C2C; }
.char-count { margin-left: auto; font-size: 12px; color: #cbd5e1; }


/* 4. PANEL DE DETALLES (Columna 4) */
.details-panel { 
    width: 320px; 
    background: #ffffff; 
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    height: 100%;
}

.panel-tabs { display: flex; border-bottom: 1px solid #e2e8f0; }
.panel-tabs .tab { 
    flex: 1; text-align: center; padding: 15px 0; font-size: 13px; font-weight: 500; color: #64748b; 
    cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 6px;
}
.panel-tabs .tab.active { color: #1e293b; border-bottom: 2px solid #FF6C2C; }

.panel-content { padding: 20px; overflow-y: auto; flex: 1; }
.panel-title { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 15px; }

.profile-avatar-large {
    width: 80px; height: 80px; background: #f1f5f9; border-radius: 50%; margin: 0 auto 20px auto;
    display: flex; justify-content: center; align-items: center; font-size: 24px; font-weight: bold; color: #94a3b8;
}

.details-panel .client-info p { font-size: 13.5px; margin-bottom: 15px; color: #334155; line-height: 1.5; }
.details-panel .client-info strong { color: #94a3b8; font-weight: 500; font-size: 11px; text-transform: uppercase; display: block; margin-bottom: 2px;}
.details-panel hr { border: 0; border-top: 1px solid #f1f5f9; margin: 20px 0; }
.text-muted { font-size: 13.5px; color: #64748b; line-height: 1.6; }


/* Responsive */
@media (max-width: 1200px) {
    .details-panel { display: none; }
    .chat-list { width: 300px; }
}

@media (max-width: 900px) {
    .login-container { flex-direction: column; height: auto; margin: 10px; }
    .login-brand-panel { padding: 40px 20px; text-align: center; }
    .brand-content h1 { font-size: 28px; }
    .brand-footer { justify-content: center; }
    .login-form-panel { padding: 40px 20px; }
}

/* =========================================
   ESTILOS DEL FUNNEL (Embudo de Ventas)
   ========================================= */

.funnel-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.funnel-header {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.funnel-header h2 {
    font-size: 20px;
    color: #1e293b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.funnel-actions {
    display: flex;
    gap: 10px;
}

.funnel-actions button {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.funnel-actions button:hover {
    background: #f8fafc;
    color: #FF6C2C;
    border-color: #FF6C2C;
}

.funnel-actions .btn-primary {
    background: #FF6C2C;
    color: #fff;
    border-color: #FF6C2C;
}

.funnel-actions .btn-primary:hover {
    background: #e55a1d;
    color: #fff;
}

/* Tablero Kanban */
.kanban-board {
    flex: 1;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.kanban-board::-webkit-scrollbar { height: 8px; }
.kanban-board::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.kanban-column {
    min-width: 300px;
    max-width: 300px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.kanban-header {
    background: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.kanban-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.kanban-header .badge {
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.kanban-cards {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 150px; /* Para que se pueda soltar aunque esté vacío */
}

/* Tarjeta de Lead */
.kanban-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    cursor: grab;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.card-header .avatar {
    width: 32px;
    height: 32px;
    background: #FFE4D6;
    color: #FF6C2C;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.card-header h4 {
    font-size: 14px;
    color: #1e293b;
    font-weight: 600;
}

.card-phone {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 15px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    font-size: 11px;
    color: #94a3b8;
}

/* =========================================
   ESTILOS DEL FUNNEL 
   ========================================= */

.funnel-area { flex: 1; display: flex; flex-direction: column; gap: 15px; overflow: hidden; }

.funnel-header {
    background: #fff; border-radius: 12px; border: 1px solid #e2e8f0;
    padding: 15px 25px; display: flex; justify-content: space-between; align-items: center;
}
.funnel-header h2 { font-size: 18px; color: #1e293b; font-weight: 600; display: flex; align-items: center; gap: 10px; }

.funnel-actions { display: flex; align-items: center; gap: 15px; }
.steps-count { font-size: 13px; color: #64748b; font-weight: 500; }
.funnel-actions button {
    background: #fff; border: 1px solid #e2e8f0; padding: 8px 15px; border-radius: 8px;
    font-size: 13px; font-weight: 500; color: #64748b; cursor: pointer;
    display: flex; align-items: center; gap: 8px; transition: all 0.2s;
}
.funnel-actions button:hover { background: #f8fafc; color: #FF6C2C; border-color: #FF6C2C; }
.funnel-actions .btn-primary { background: #FF6C2C; color: #fff; border-color: #FF6C2C; }
.funnel-actions .btn-primary:hover { background: #e55a1d; }

/* Tablero Kanban */
.kanban-board { flex: 1; display: flex; gap: 15px; overflow-x: auto; padding-bottom: 10px; }
.kanban-board::-webkit-scrollbar { height: 8px; }
.kanban-board::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.kanban-column {
    min-width: 280px; max-width: 280px; background: #f8fafc;
    border-radius: 12px; border: 1px solid #e2e8f0; display: flex; flex-direction: column;
}

.kanban-header {
    background: #fff; padding: 12px 15px; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid #e2e8f0; border-radius: 12px 12px 0 0;
}

.kanban-title { display: flex; align-items: center; gap: 8px; }
.badge-color { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.kanban-title h3 { font-size: 13px; font-weight: 600; color: #1e293b; text-transform: uppercase; letter-spacing: 0.5px; }
.kanban-title .badge { background: #f1f5f9; color: #64748b; font-size: 11px; padding: 2px 6px; border-radius: 10px; font-weight: 600; }
.kanban-tools { display: flex; gap: 10px; color: #94a3b8; font-size: 12px; cursor: pointer; }
.kanban-tools i:hover { color: #FF6C2C; }

.kanban-filter { padding: 10px 15px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.kanban-filter input {
    width: 100%; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 12px; background: #f8fafc; outline: none; color: #64748b;
}

.kanban-cards { flex: 1; padding: 10px 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 100px; }
.kanban-cards::-webkit-scrollbar { width: 4px; }
.kanban-cards::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Tarjetas Estilo*/
/*.kanban-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px;
    cursor: grab; box-shadow: 0 1px 3px rgba(0,0,0,0.02); transition: transform 0.2s;
}*/
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.5; transform: scale(1.02); }

.card-main { display: flex; align-items: flex-start; gap: 10px; position: relative; }
.card-avatar {
    width: 28px; height: 28px; background: #f1f5f9; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-size: 14px;
}
.card-info { flex: 1; overflow: hidden; }
.card-info h4 { font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-preview { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

.card-meta {
    position: absolute; right: 0; top: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
}
.card-time { font-size: 10px; color: #94a3b8; white-space: nowrap; }

.empty-stage { text-align: center; font-size: 12px; color: #94a3b8; padding: 20px 0; font-style: italic; }

/* =========================================
   ESTILOS DEL INICIO Y SIDEBAR COLAPSABLE
   ========================================= */

/* --- Sidebar Colapsable --- */
.sidebar {
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar .toggle-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
    transition: color 0.2s;
}

.sidebar .toggle-btn:hover {
    color: #FF6C2C;
}

.sidebar.collapsed {
    width: 80px; /* Ancho reducido */
    padding: 20px 10px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed nav a span,
.sidebar.collapsed .user-name,
.sidebar.collapsed .company-phone-display {
    display: none !important;
}

.sidebar.collapsed .logo {
    justify-content: center;
    padding-left: 0;
    font-size: 24px;
}

.sidebar.collapsed nav a {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed nav a i {
    font-size: 18px;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
}

/* --- Layout del Dashboard --- */
.main-content {
    flex: 1;
    padding: 0 10px 10px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.page-header h1 {
    font-size: 22px;
    color: #1e293b;
    font-weight: 700;
}

.page-header .text-muted {
    font-size: 14px;
    margin-top: 4px;
}

.btn-export {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-export:hover {
    border-color: #FF6C2C;
    color: #FF6C2C;
}

.section-title {
    font-size: 16px;
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 15px;
    margin-top: 30px;
}

/* --- Tarjetas de Estadísticas --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 24px;
    color: #1e293b;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-info p {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* --- Tarjetas de Métricas --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.metric-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.metric-sub {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
    display: block;
    margin-top: 5px;
}

/* --- Gráficos CSS --- */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

.chart-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

.chart-header {
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 15px;
    color: #1e293b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.chart-header .text-muted {
    font-size: 12px;
}

.chart-area {
    height: 200px;
    display: flex;
    align-items: flex-end;
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.bars-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    gap: 10px;
}

.bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 100%;
    position: relative;
}

.bar {
    width: 100%;
    max-width: 40px;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    min-height: 5px;
}

.bar-label {
    position: absolute;
    bottom: -25px;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

/* =========================================
   ESTILOS DE TABLAS Y MODALES (Contactos)
   ========================================= */

.table-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    text-align: left;
    padding: 15px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
}

.data-table td {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #1e293b;
}

.data-table tr:hover {
    background: #f8fafc;
}

.table-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    background: #FFE4D6;
    color: #FF6C2C;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.badge-channel {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-tag {
    background: #e2e8f0;
    color: #475569;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.btn-icon {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: #FF6C2C;
}

/* Modales */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 450px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    color: #1e293b;
    font-weight: 600;
}

.modal-header button {
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-body label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 6px;
}

.modal-body input,
.modal-body select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.modal-body input:focus,
.modal-body select:focus {
    border-color: #FF6C2C;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: #64748b;
}

.btn-primary {
    background: #FF6C2C;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary:hover {
    background: #e55a1d;
}

/* =========================================
   MODO OSCURO (Dark Mode)
   ========================================= */

body.dark-mode {
    background-color: #0f172a !important; /* Fondo general oscuro */
    color: #e2e8f0;
}

body.dark-mode .app-container {
    background-color: #0f172a;
}

/* Sidebar y Paneles */
body.dark-mode .sidebar,
body.dark-mode .chat-list,
body.dark-mode .chat-area,
body.dark-mode .details-panel,
body.dark-mode .chat-header,
body.dark-mode .chat-input-area,
body.dark-mode .chart-card,
body.dark-mode .stat-card,
body.dark-mode .metric-card,
body.dark-mode .table-container,
body.dark-mode .funnel-header,
body.dark-mode .kanban-column {
    background-color: #1e293b !important; /* Gris azulado oscuro */
    border-color: #334155 !important;
}

/* Textos */
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode h5, body.dark-mode h6, body.dark-mode .logo-text {
    color: #f8fafc !important;
}
body.dark-mode p, body.dark-mode span, body.dark-mode .text-muted, body.dark-mode .chat-info p, body.dark-mode .chat-info h4 {
    color: #94a3b8 !important;
}
body.dark-mode .chat-header h3 {
    color: #f8fafc !important;
}

/* Buscador y Inputs */
body.dark-mode .chat-list-header input,
body.dark-mode .modal-body input,
body.dark-mode .modal-body select,
body.dark-mode .chat-input-area textarea {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* Mensajes */
body.dark-mode .messages-container {
    background-color: #1e293b !important;
}
body.dark-mode .message.in {
    background-color: #334155 !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}
body.dark-mode .message.out {
    background-color: #9a3412 !important; /* Naranja oscuro */
    color: #fff !important;
}
body.dark-mode .msg-time {
    color: #94a3b8 !important;
}

/* Menú lateral */
body.dark-mode .sidebar nav a {
    color: #94a3b8;
}
body.dark-mode .sidebar nav a:hover {
    background-color: #334155;
    color: #FF6C2C;
}
body.dark-mode .sidebar nav a.active {
    background-color: #431407; /* Fondo naranja oscuro */
    color: #FF6C2C;
}

/* Tablas */
body.dark-mode .data-table th {
    background-color: #0f172a;
    color: #94a3b8;
    border-color: #334155;
}
body.dark-mode .data-table td {
    border-color: #334155;
    color: #e2e8f0;
}
body.dark-mode .data-table tr:hover {
    background-color: #1e293b;
}

/* Tarjetas Kanban (Funnel) */
body.dark-mode .kanban-card {
    background-color: #0f172a;
    border-color: #334155;
}
body.dark-mode .kanban-header {
    background-color: #1e293b;
    border-color: #334155;
}
body.dark-mode .kanban-filter input {
    background-color: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

/* Arreglos del Modo Oscuro para el Chat */
body.dark-mode .input-toolbar {
    background-color: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
    color: #94a3b8 !important;
}

body.dark-mode .input-main {
    background-color: #1e293b !important;
}

body.dark-mode .chat-input-area {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* Arreglo para los modales */
body.dark-mode .modal-box {
    background-color: #1e293b !important;
}
body.dark-mode .modal-header {
    border-bottom: 1px solid #334155 !important;
}
body.dark-mode .modal-footer {
    border-top: 1px solid #334155 !important;
}

/* Arreglo para el botón de enviar */
body.dark-mode .send-btn {
    background-color: #FF6C2C !important;
}

.dropdown-content a:hover { background-color: #f8fafc; color: #FF6C2C !important; }
body.dark-mode .dropdown-content { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-mode .dropdown-content a { color: #e2e8f0 !important; }
body.dark-mode .dropdown-content a:hover { background-color: #334155 !important; }

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Selector de Emojis */
.emoji-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: background 0.2s;
}
.emoji-btn:hover {
    background: #f1f5f9;
}

body.dark-mode #emoji-picker {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .emoji-btn:hover {
    background: #334155;
}

.filter-btn.active { background: #fff3ed !important; color: #FF6C2C !important; border-color: #FF6C2C !important; }
body.dark-mode .filter-btn { background: #1e293b; color: #94a3b8; border-color: #334155; }
body.dark-mode .filter-btn.active { background: #431407 !important; color: #FF6C2C !important; }

/* Estilos para la lista de etiquetas en el modal */
#tags-list-container label {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Alinea todo a la izquierda */
    gap: 12px; /* Espacio entre el checkbox y la etiqueta */
    padding: 10px 15px;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

#tags-list-container label:hover {
    background: #f8fafc;
}

/* Hacer el checkbox un poco más grande */
#tags-list-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #FF6C2C; /* Color naranja al marcar */
}

/* Modo Oscuro */
body.dark-mode #tags-list-container label:hover {
    background: #334155;
}

/* Estilo para el selector de emojis de PicMo */
.emoji-picker {
    position: absolute !important;
    bottom: 60px !important;
    right: 20px !important;
    z-index: 9999 !important;
}

/* Modo Oscuro para PicMo */
body.dark-mode .emoji-picker {
    background-color: #1e293b !important;
    color: #fff !important;
}

/* Estilos para chats con mensajes sin leer */
.chat-item.unread {
    background-color: #fff7f3; /* Fondo naranja suave */
    border-left: 3px solid #FF6C2C; /* Línea naranja a la izquierda */
}

.chat-item.unread .chat-info h4 {
    font-weight: 700; /* Nombre en negrita */
    color: #FF6C2C;
}

.unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #FF6C2C;
    border-radius: 50%;
    margin-left: 5px;
    animation: pulse 1.5s infinite; /* Animación de pulso */
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Modo oscuro */
body.dark-mode .chat-item.unread {
    background-color: #431407;
    border-left-color: #FF6C2C;
}
body.dark-mode .chat-item.unread .chat-info h4 {
    color: #FF6C2C;
}

/* Forzar visibilidad del botón de reacción para probar */
.reaction-trigger {
    position: absolute !important;
    top: -10px !important;
    right: 10px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important; /* Forzamos que se vea siempre */
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #94a3b8 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
    z-index: 10 !important;
}

#message-input {
    white-space: pre-wrap;
    overflow-y: auto;
    resize: vertical; /* Permite redimensionar solo verticalmente */
    min-height: 50px;
    max-height: 400px; /* Altura máxima antes de que aparezca el scroll */
    width: 100%; /* Ocupa todo el ancho disponible */
}

/* =========================================
   ESTILOS PERSONALIZADOS PARA DATATABLES
   ========================================= */

/* Contenedor general */
.dataTables_wrapper {
    padding: 20px;
}

/* Selector de cantidad de registros */
.dataTables_length {
    margin-bottom: 15px;
    font-size: 14px;
    color: #475569;
}
.dataTables_length select {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    margin: 0 5px;
}

/* Buscador */
.dataTables_filter {
    margin-bottom: 15px;
    font-size: 14px;
    color: #475569;
}
.dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 14px;
    outline: none;
    margin-left: 10px;
    width: 250px;
    transition: all 0.2s;
}
.dataTables_filter input:focus {
    border-color: #FF6C2C;
    box-shadow: 0 0 0 3px rgba(255, 108, 44, 0.1);
}

/* Tabla */
.data-table {
    width: 100% !important;
    border-collapse: collapse;
    margin: 0 !important;
}
.data-table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    position: relative;
}
.data-table thead th:hover {
    color: #FF6C2C;
}
.data-table tbody td {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #1e293b;
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: #f8fafc;
}

/* Paginación */
.dataTables_info {
    margin-top: 15px;
    font-size: 14px;
    color: #64748b;
}
.dataTables_paginate {
    margin-top: 15px;
}
.dataTables_paginate .paginate_button {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    margin: 0 3px !important;
    font-size: 14px !important;
    color: #64748b !important;
    background: #fff !important;
    cursor: pointer;
    transition: all 0.2s;
}
.dataTables_paginate .paginate_button:hover {
    background: #f8fafc !important;
    color: #FF6C2C !important;
    border-color: #FF6C2C !important;
}
.dataTables_paginate .paginate_button.current {
    background: #FF6C2C !important;
    color: #fff !important;
    border-color: #FF6C2C !important;
}
.dataTables_paginate .paginate_button.disabled {
    color: #cbd5e1 !important;
    cursor: not-allowed;
    background: #f8fafc !important;
}

/* Íconos de ordenación */
.data-table thead th.sorting:after,
.data-table thead th.sorting_asc:after,
.data-table thead th.sorting_desc:after {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 10px;
    color: #cbd5e1;
}
.data-table thead th.sorting:after {
    content: "\f0dc"; /* Icono de ordenación */
}
.data-table thead th.sorting_asc:after {
    content: "\f0de"; /* Flecha arriba */
    color: #FF6C2C;
}
.data-table thead th.sorting_desc:after {
    content: "\f0dd"; /* Flecha abajo */
    color: #FF6C2C;
}

/* Modo oscuro */
body.dark-mode .dataTables_length,
body.dark-mode .dataTables_filter,
body.dark-mode .dataTables_info {
    color: #94a3b8;
}
body.dark-mode .dataTables_length select,
body.dark-mode .dataTables_filter input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
body.dark-mode .data-table thead th {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}
body.dark-mode .data-table tbody td {
    border-color: #334155;
    color: #e2e8f0;
}
body.dark-mode .data-table tbody tr:hover {
    background: #1e293b;
}
body.dark-mode .dataTables_paginate .paginate_button {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}
body.dark-mode .dataTables_paginate .paginate_button.current {
    background: #FF6C2C !important;
    color: #fff !important;
    border-color: #FF6C2C !important;
}

/* Estilos para el avatar con badge de canal */
.avatar-wrapper {
    position: relative;
    width: 42px;
    height: 42px;
    margin-right: 12px;
    flex-shrink: 0;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.channel-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Estilos para el modal de filtros */
.filter-option-btn {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
    transition: all 0.2s;
    text-align: center;
}

.filter-option-btn:hover {
    background: #f8fafc;
    border-color: #FF6C2C;
}

.filter-option-btn.active {
    background: #fff3ed;
    border-color: #FF6C2C;
    color: #FF6C2C;
    font-weight: 600;
}

.modal-body textarea {
    width: 100%;
    min-height: 150px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    resize: vertical;
}