:root {
    --primary: #8E44AD;
    --primary-light: #BB8FDB;
    --accent: #E056FD;
    --success: #27AE60;
    --danger: #EB4D4B;
    --warning: #F0932B;
    --bg-dark: #0F172A;
    --sidebar-bg: rgba(30, 41, 59, 0.7);
    --card-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-main: #F8FAFC;
    --text-dim: #94A3B8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 100% 0%, rgba(142, 68, 173, 0.1) 0%, transparent 40%),
                      radial-gradient(circle at 0% 100%, rgba(224, 86, 253, 0.05) 0%, transparent 40%);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

h1, h2, h3 { font-family: 'Outfit', sans-serif; }

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(25px);
    border-right: 1px solid var(--border-glass);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-glass);
}

.logo-area h1 { font-size: 1.4rem; font-weight: 700; color: var(--primary-light); }

.nav-group { display: flex; flex-direction: column; gap: 8px; }

.nav-item {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.nav-item:hover, .nav-item.active {
    background: rgba(142, 68, 173, 0.2);
    color: var(--text-main);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.nav-item.active { border-left: 3px solid var(--primary); }

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-content {
    display: none;
    flex: 1;
    padding: 1.5rem;
    overflow: hidden; /* Importante para o scroll interno do grid */
    animation: slideUp 0.4s ease;
}

.tab-content.active { display: flex; flex-direction: column; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* INBOX 3.0 (Multi-Column) */
.inbox-layout {
    display: flex;
    background: var(--card-glass);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    flex: 1;
    overflow: hidden;
    backdrop-filter: blur(15px);
}

/* Col 1: Chat List */
.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
}

.col-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    font-weight: 600;
    font-family: 'Outfit';
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-items { overflow-y: auto; flex: 1; }

.chat-card {
    padding: 1.2rem;
    border-bottom: 1px solid var(--border-glass);
    cursor: pointer;
    transition: background 0.3s;
}

.chat-card:hover { background: rgba(255,255,255,0.05); }
.chat-card.active { background: rgba(142, 68, 173, 0.15); border-left: 4px solid var(--primary); }

.chat-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.chat-preview { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Col 2: Chat Main window */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.1);
}

.chat-scroll {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bubble {
    max-width: 80%;
    padding: 1rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Inbound = Cliente (Esquerda) */
.bubble.in { 
    align-self: flex-start; 
    background: #334155; 
    border: 1px solid var(--border-glass);
    border-bottom-left-radius: 4px;
    color: white;
}

/* Outbound = Hana Intel (Direita) */
.bubble.out { 
    align-self: flex-end; 
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-bottom-right-radius: 4px;
}

.bubble-meta { font-size: 0.7rem; opacity: 0.6; margin-bottom: 6px; display: block; }
.bubble.out .bubble-meta { text-align: right; }

/* Chat Input area */
.chat-input-container {
    padding: 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    gap: 12px;
}

.chat-input-v5 {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    padding: 1rem 1.2rem;
    border-radius: 14px;
    color: white;
    outline: none;
    font-family: inherit;
}

.btn-send {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* Col 3: Customer Info (Opcional, escondido em mobile) */
.profile-sidebar {
    width: 300px;
    border-left: 1px solid var(--border-glass);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.v5-card {
    background: var(--card-glass);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 1.5rem;
}

.health-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    margin-bottom: 8px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--success); box-shadow: 0 0 10px var(--success); }
.dot-red { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* Audit logs */
.audit-v5 { width: 100%; border-collapse: collapse; }
.audit-v5 th { text-align: left; padding: 12px; font-size: 0.8rem; color: var(--text-dim); }
.audit-v5 td { padding: 12px; font-size: 0.85rem; border-bottom: 1px solid rgba(255,255,255,0.02); }

/* Switch design */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #475569; transition: .4s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

@media (max-width: 1300px) {
    .profile-sidebar { display: none; }
}
@media (max-width: 900px) {
    .chat-sidebar { display: none; }
    .sidebar { width: 70px; padding: 2rem 0.5rem; }
    .sidebar h1, .sidebar .nav-item span { display: none; }
}

/* Modal (v6.7) */
.modal-v5 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    padding: 2.5rem;
}
