:root {
    --bg-dark: #09090b;       /* Zinc 950 */
    --bg-panel: rgba(24, 24, 27, 0.4); /* Zinc 900 con 40% opacidad */
    --bg-panel-hover: rgba(39, 39, 42, 0.6); 
    
    --neon-cyan: #06b6d4;     /* Principal */
    --neon-cyan-glow: rgba(6, 182, 212, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --border-light: rgba(255, 255, 255, 0.08);
    --border-neon: rgba(6, 182, 212, 0.3);
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --blur-xl: blur(20px);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    /* Optional: una sutil malla o gradiente radial para darle más "profundidad" ci-fi */
    background-image: radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Glassmorphism Panel Base */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--blur-xl);
    -webkit-backdrop-filter: var(--blur-xl);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

/* == SIDEBAR == */
.sidebar {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    border-right: 1px solid var(--border-light);
    background: var(--bg-panel);
    backdrop-filter: var(--blur-xl);
    z-index: 10;
    transition: width 0.3s ease;
}

.brand {
    color: var(--neon-cyan);
    font-size: 32px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-shadow: 0 0 10px var(--neon-cyan-glow);
}
.brand span { display: none; font-size: 16px; font-weight: 700; letter-spacing: 1px;}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    align-items: center;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 24px;
    padding: 12px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}
.nav-item span { display: none; font-size: 14px; font-weight: 500;}

.nav-item:hover, .nav-item.active {
    color: var(--neon-cyan);
    background: rgba(6, 182, 212, 0.1);
    box-shadow: inset 2px 0 0 var(--neon-cyan);
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--bg-panel-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    border: 1px solid var(--border-light);
}
.user-info { display: none; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 600; }
.user-status { font-size: 11px; color: #10b981; }

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* HEADER */
.top-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}
.top-header h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.search-bar {
    position: relative;
}
.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}
.search-bar input {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: white;
    padding: 8px 16px 8px 36px;
    width: 250px;
    outline: none;
    transition: all 0.2s;
}
.search-bar input:focus {
    border-color: var(--border-neon);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

/* BUTTONS */
.btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn:hover {
    background: var(--bg-panel-hover);
}
.btn-primary {
    background: var(--neon-cyan);
    color: #000;
    border: none;
    box-shadow: 0 0 15px var(--neon-cyan-glow);
}
.btn-primary:hover {
    background: #0891b2;
}
.btn-icon {
    padding: 8px;
    border-radius: 50%;
    font-size: 18px;
}
.btn-block { width: 100%; }

/* VIEWS */
.views-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}
.view {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 16px;
}
.view.active {
    opacity: 1;
    pointer-events: all;
    display: flex;
}

/* CHAT LAYOUT */
.chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr 280px;
    gap: 16px;
    width: 100%;
    height: 100%;
}

.panel-header {
    padding: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.convos-sidebar, .info-sidebar {
    display: flex;
    flex-direction: column;
}

.convos-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.convo-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    align-items: center;
}
.convo-item:hover { background: var(--bg-panel-hover); }
.convo-item.active {
    background: rgba(6, 182, 212, 0.1);
    border-left: 2px solid var(--neon-cyan);
}
.convo-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-cyan), #3b82f6);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: #000;
}
.convo-meta h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.convo-meta p { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px;}
.convo-time { font-size: 11px; color: var(--text-secondary); }

/* CHAT WINDOW */
.chat-window {
    display: flex;
    flex-direction: column;
}
.chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.status-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 700;
}
.status-badge.lead { background: rgba(16, 185, 129, 0.2); color: #10b981; border: 1px solid #10b981;}

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.message { display: flex; flex-direction: column; max-width: 70%; }
.message.inbound { align-self: flex-start; }
.message.outbound { align-self: flex-end; align-items: flex-end; }
.msg-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.5;
}
.inbound .msg-bubble {
    background: var(--bg-panel-hover);
    border-bottom-left-radius: 4px;
}
.outbound .msg-bubble {
    background: var(--neon-cyan);
    color: #000;
    border-bottom-right-radius: 4px;
}
.msg-time { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
}
.chat-input-area input {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 0 20px;
    color: white;
    outline: none;
}
.chat-input-area input:focus { border-color: var(--neon-cyan); }

/* KANBAN */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    height: 100%;
    width: 100%;
}
.kanban-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.column-header h3 { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;}
.column-header .count {
    background: var(--bg-panel-hover);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100px;
}
.kanban-card {
    padding: 16px;
    cursor: grab;
    transition: transform 0.2s;
}
.kanban-card:hover { transform: translateY(-2px); border-color: var(--neon-cyan); }
.kanban-card h4 { font-size: 14px; margin-bottom: 4px; }
.kanban-card p { font-size: 12px; color: var(--text-secondary); }

/* MODAL LOGIN */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.login-box {
    padding: 40px;
    width: 400px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.brand-icon { font-size: 48px; color: var(--neon-cyan); text-shadow: 0 0 20px var(--neon-cyan-glow); }
.form-group input {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-light);
    color: white;
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
    letter-spacing: 2px;
}
.form-group input:focus { outline: none; border-color: var(--neon-cyan); box-shadow: 0 0 10px var(--neon-cyan-glow); }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-group-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}
.btn-group-row .btn { flex: 1; }

/* CONTACTS TABLE */
.contacts-layout {
    width: 100%;
    height: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.contacts-table-wrapper {
    flex: 1;
    overflow-y: auto;
    margin-top: 20px;
}
.contacts-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.contacts-table th, .contacts-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}
.contacts-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}
.contacts-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.kanban-card {
    position: relative;
    padding-right: 40px; /* Espacio para el botón de editar */
}
.card-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0.3;
    transition: opacity 0.2s;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}
.kanban-card:hover .card-edit-btn {
    opacity: 1;
}

.reminders-mini-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.reminder-mini-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px;
    transition: all 0.2s;
}

.reminder-mini-card:hover {
    border-color: var(--border-neon);
    background: rgba(6, 182, 212, 0.05);
}

.rem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.rem-date {
    font-size: 10px;
    font-weight: 700;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

.rem-check {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.rem-check:hover {
    background: #10b981;
    color: #000;
    border-color: #10b981;
}

.rem-notes {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }

/* Completed Reminders */
.reminder-mini-card.completed {
    opacity: 0.5;
    background: transparent;
    border-style: dashed;
}
.reminder-mini-card.completed .rem-notes {
    text-decoration: line-through;
}
.reminder-mini-card.completed .rem-date {
    color: var(--text-secondary);
}
.completed-list {
    max-height: 200px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-sidebar {
    width: 320px;
    height: 100%;
    padding: 20px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.info-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.info-group p {
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
    word-break: break-all;
    line-height: 1.4;
}

.toast {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.info { border-left: 4px solid var(--primary); }
.toast.warning { border-left: 4px solid var(--accent); }

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

/* Date Picker Reset */
input[type="datetime-local"] {
    position: relative;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
    z-index: 10;
}
input[type="datetime-local"]::after {
    content: '🕒 Escoger';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 12px;
    pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-panel-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-cyan); }
