/* ============================================
   PAINEL DE ATENDIMENTO — Estilos
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === RESET & VARIABLES === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a3e;
    --bg-card: #1e1e45;
    --bg-hover: #252560;
    --bg-chat: #12122e;
    --bg-input: #1a1a3e;
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(168, 85, 247, 0.4);
    --text-primary: #f0f0ff;
    --text-secondary: #b0b0d0;
    --text-muted: #6b6b90;
    --purple: #A855F7;
    --purple-dark: #7C3AED;
    --green: #10B981;
    --green-dark: #059669;
    --cyan: #06B6D4;
    --cyan-dark: #0891B2;
    --red: #EF4444;
    --yellow: #F59E0B;
    --pink: #EC4899;
    --orange: #F97316;
    --bubble-sent: #7C3AED;
    --bubble-received: #1e1e45;
    --gradient-primary: linear-gradient(135deg, #A855F7, #EC4899);
    --gradient-green: linear-gradient(135deg, #10B981, #06B6D4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-bubble: 18px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.5);
}

/* === LOGIN SCREEN === */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
}

.login-screen.hidden {
    display: none;
}

.login-logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.login-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    width: 380px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-box h3 {
    margin-bottom: 16px;
    font-weight: 600;
}

.login-box input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    transition: var(--transition);
}

.login-box input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.login-box .btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.login-box .btn-login:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.login-error {
    color: var(--red);
    font-size: 13px;
    margin-top: 8px;
}

/* === MAIN LAYOUT === */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* === SIDEBAR (Instances + Conversations) === */
.sidebar {
    width: 380px;
    min-width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    font-size: 20px;
}

.sidebar-title {
    font-weight: 700;
    font-size: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    flex: 1;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Instance Tabs */
.instance-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
}

.instance-tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.instance-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.instance-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--purple);
}

.instance-tab .tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.instance-tab .tab-dot.online {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.instance-tab .tab-dot.offline {
    background: var(--red);
}

.instance-tab .tab-dot.connecting {
    background: var(--yellow);
    animation: pulse 1.5s infinite;
}

.instance-tab .tab-unread {
    background: var(--purple);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Search */
.search-bar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 38px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b6b90'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.search-input:focus {
    border-color: var(--purple);
}

/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.chat-item:hover {
    background: var(--bg-hover);
}

.chat-item.active {
    background: rgba(168, 85, 247, 0.1);
    border-left: 3px solid var(--purple);
}

.chat-item.hidden-chat {
    opacity: 0.4;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    border: 2px solid var(--border);
    overflow: hidden;
    position: relative;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar .avatar-letter {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-secondary);
}

.chat-info {
    flex: 1;
    overflow: hidden;
}

.chat-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-last-msg {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.chat-time {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-unread {
    background: var(--purple);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.chat-labels {
    display: flex;
    gap: 3px;
    margin-top: 3px;
}

.chat-label-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* === MAIN CHAT AREA === */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
}

/* Chat Header */
.chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
}

.chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-weight: 600;
    font-size: 15px;
}

.chat-header-status {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-date-separator {
    text-align: center;
    margin: 16px 0 8px;
}

.msg-date-separator span {
    background: rgba(168, 85, 247, 0.15);
    color: var(--text-muted);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.message {
    max-width: 65%;
    padding: 8px 14px;
    border-radius: var(--radius-bubble);
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: msgIn 0.2s ease;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    align-self: flex-end;
    background: var(--bubble-sent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: var(--bubble-received);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.msg-text {
    white-space: pre-wrap;
}

.msg-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    text-align: right;
}

.message.received .msg-time {
    color: var(--text-muted);
}

.msg-image {
    max-width: 280px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    cursor: pointer;
}

.msg-audio {
    width: 250px;
}

/* Input Area */
.chat-input-area {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-secondary);
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 46px;
    transition: var(--transition);
}

.chat-input:focus {
    border-color: var(--purple);
}

.btn-send {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-primary);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
}

.btn-send:active {
    transform: scale(0.95);
}

.btn-attach {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-attach:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* === EMPTY STATE === */
.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-state-subtitle {
    font-size: 14px;
}

/* === DASHBOARD (NO INSTANCE SELECTED) === */
.dashboard {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 32px;
    padding: 40px;
}

.dashboard-title {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-subtitle {
    color: var(--text-muted);
    font-size: 15px;
}

.instance-cards {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.instance-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    width: 280px;
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    text-align: center;
}

.instance-card:hover {
    border-color: var(--border-active);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.instance-card-avatar {
    font-size: 48px;
    margin-bottom: 12px;
}

.instance-card-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.instance-card-phone {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.instance-card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.instance-card-status.online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
}

.instance-card-status.offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

.instance-card-status.connecting {
    background: rgba(245, 158, 11, 0.15);
    color: var(--yellow);
}

.instance-card-qr {
    margin-top: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--radius-sm);
    display: none;
}

.instance-card-qr img {
    width: 200px;
    height: 200px;
}

.instance-card-qr.visible {
    display: block;
}

.instance-card-stats {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* === CONTEXT MENU === */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 0;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}

.context-menu.visible {
    display: block;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.context-menu-item:hover {
    background: var(--bg-hover);
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* === LABELS PANEL === */
.labels-panel {
    position: fixed;
    right: -320px;
    top: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 500;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.labels-panel.open {
    right: 0;
}

.labels-panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.labels-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.label-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.label-item:hover {
    background: var(--bg-hover);
}

.label-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.label-name {
    flex: 1;
    font-size: 14px;
}

.label-count {
    font-size: 12px;
    color: var(--text-muted);
}

.add-label-row {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
}

.add-label-row input {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.add-label-row button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--purple);
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

/* === QR CODE MODAL === */
.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 900;
}

.qr-modal.visible {
    display: flex;
}

.qr-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.qr-modal-content h3 {
    margin-bottom: 8px;
    font-weight: 600;
}

.qr-modal-content p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

.qr-modal-content canvas,
.qr-modal-content img {
    width: 260px;
    height: 260px;
    border-radius: var(--radius-sm);
    background: white;
    padding: 16px;
}

/* === CONFIG MODAL === */
.config-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 950;
}

.config-modal.visible {
    display: flex;
}

.config-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
    width: 90%;
    border: 1px solid var(--border);
}

.config-modal-content h3 {
    margin-bottom: 16px;
    font-weight: 600;
}

.config-modal-content label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.config-modal-content input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
}

.config-modal-content input:focus {
    border-color: var(--purple);
}

.config-modal-content .btn-save {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
        position: absolute;
        z-index: 100;
    }

    .sidebar.chat-open {
        display: none;
    }

    .chat-area {
        display: none;
    }

    .chat-area.active {
        display: flex;
        position: absolute;
        inset: 0;
        z-index: 101;
    }

    .instance-cards {
        flex-direction: column;
        align-items: center;
    }

    .instance-card {
        width: 100%;
        max-width: 320px;
    }

    .btn-back-mobile {
        display: flex !important;
    }

    .message {
        max-width: 85%;
    }
}

@media (min-width: 769px) {
    .btn-back-mobile {
        display: none !important;
    }
}

/* === KANBAN BOARD === */
.kanban-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.kanban-toolbar {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.kanban-toolbar-title {
    font-weight: 700;
    font-size: 18px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.kanban-motto {
    font-style: italic;
    font-weight: 600;
    font-size: 13px;
    opacity: 0.7;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.kanban-toolbar-spacer {
    flex: 1;
}

.kanban-filter {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.kanban-filter option {
    background: var(--bg-card);
}

.view-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.view-toggle-btn {
    padding: 6px 14px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
}

.view-toggle-btn.active {
    background: var(--purple);
    color: white;
}

.kanban-board {
    display: flex;
    gap: 16px;
    padding: 16px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
}

.kanban-column {
    min-width: 280px;
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    border: 1px solid var(--border);
}

.kanban-column-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kanban-column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.kanban-column-title {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-column-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.kanban-column-body.drag-over {
    background: rgba(168, 85, 247, 0.08);
    border: 2px dashed rgba(168, 85, 247, 0.3);
    border-radius: 8px;
}

.kanban-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: grab;
    transition: var(--transition);
    border: 1px solid var(--border);
    position: relative;
    border-left: 3px solid transparent;
}

.kanban-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.kanban-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    overflow: hidden;
}

.kanban-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kanban-card-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.kanban-card-time {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.kanban-card-msg {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.kanban-card-label {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.kanban-card-agent {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
}

.kanban-card:hover .kanban-card-actions {
    display: flex;
    gap: 4px;
}

.kanban-card-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanban-card-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* === SECTION TABS (Conversas / Grupos) === */
.section-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
}

.section-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.section-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.section-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--purple);
}

/* === TRANSFER OPTIONS === */
.transfer-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-primary);
}

.transfer-option:hover {
    border-color: var(--purple);
    background: rgba(168, 85, 247, 0.08);
}

.transfer-option.selected {
    border-color: var(--purple);
    background: rgba(168, 85, 247, 0.15);
}

.transfer-option-avatar {
    font-size: 24px;
}

.transfer-option-name {
    font-weight: 600;
    font-size: 14px;
}

.transfer-option-status {
    font-size: 11px;
    color: var(--text-muted);
}

/* === BROADCAST CONTACT === */
.broadcast-contact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.broadcast-contact:hover {
    background: rgba(255, 255, 255, 0.05);
}

.broadcast-contact input[type="checkbox"] {
    accent-color: var(--purple);
}

.broadcast-contact-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === CLIENT PROFILE PANEL === */
.client-profile {
    position: fixed;
    right: -360px;
    top: 0;
    width: 340px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 200;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.client-profile.open {
    right: 0;
}

.client-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.client-profile-header h3 {
    margin: 0;
    font-size: 16px;
}

.client-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: var(--gradient-primary);
    font-weight: 700;
}

.client-profile-name {
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
}

.client-profile-phone {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.client-profile-section {
    margin-bottom: 16px;
}

.client-profile-section h4 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* === QUICK REPLY ITEM === */
.quick-reply-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.quick-reply-item:hover {
    border-color: var(--purple);
    background: rgba(168, 85, 247, 0.08);
}

.quick-reply-item-title {
    font-weight: 600;
    font-size: 13px;
}

.quick-reply-item-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-reply-item-del {
    margin-left: auto;
    font-size: 14px;
    opacity: 0.5;
    cursor: pointer;
}

.quick-reply-item-del:hover {
    opacity: 1;
    color: #EF4444;
}

/* === METRICS GRID === */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.metric-card-value {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 4px;
}

.metric-card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metrics-agents {
    margin-top: 12px;
}

.metric-agent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
}

.metric-agent-avatar {
    font-size: 20px;
}

.metric-agent-name {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
}

.metric-agent-stat {
    font-size: 13px;
    color: var(--text-muted);
    text-align: right;
}

/* === SCHEDULED ITEM === */
.scheduled-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 12px;
}

.scheduled-item-time {
    font-weight: 600;
    color: var(--purple);
    white-space: nowrap;
}

.scheduled-item-msg {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

.scheduled-item-del {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.5;
}

.scheduled-item-del:hover {
    opacity: 1;
    color: #EF4444;
}

/* === AUTO-REPLY ITEM === */
.auto-reply-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.auto-reply-keyword {
    background: var(--purple);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.auto-reply-response {
    flex: 1;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auto-reply-del {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.5;
}

.auto-reply-del:hover {
    opacity: 1;
    color: #EF4444;
}

/* === EXTRACT BUTTON === */
.btn-extract {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.2s;
    opacity: 0.6;
}

.btn-extract:hover {
    opacity: 1;
    background: rgba(168, 85, 247, 0.15);
    transform: scale(1.15);
}

.btn-save {
    background: linear-gradient(135deg, #A855F7, #EC4899);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    width: 100%;
}

.btn-save:hover {
    filter: brightness(1.1);
}