/* ================================================================
   ZAPDESK — MULTI ATENDIMENTO WHATSAPP
   Arquivo: public/css/styles.css
   ================================================================ */

/* ============ VARIÁVEIS E TEMAS ============ */
:root {
    --primary-h: 165;
    --primary-s: 100%;
    --primary-l: 33%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-hover: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 6%));
    --primary-light: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.10);
    --primary-medium: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.18);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition: all 0.22s cubic-bezier(.4, 0, .2, 1);
    --blue: #3b82f6;
    --amber: #f59e0b;
    --green: #10b981;
    --red: #ef4444;
}

[data-theme="light"] {
    --bg-app: #f4f6f8;
    --bg-panel: #ffffff;
    --bg-chat: #eef1f4;
    --bg-input: #f0f2f5;
    --bg-hover: #f5f7f9;
    --border: #e6eaee;
    --text-main: #14232c;
    --text-secondary: #6b7c88;
    --msg-in: #ffffff;
    --shadow-sm: 0 1px 3px rgba(16, 30, 54, 0.06);
    --shadow-md: 0 6px 24px rgba(16, 30, 54, 0.10);
    --shadow-lg: 0 16px 48px rgba(16, 30, 54, 0.18);
    --modal-bg: rgba(20, 30, 40, 0.45);
}

[data-theme="dark"] {
    --bg-app: #0f171d;
    --bg-panel: #18242d;
    --bg-chat: #0b141a;
    --bg-input: #243340;
    --bg-hover: #1e2c36;
    --border: #253541;
    --text-main: #e9eef2;
    --text-secondary: #8699a6;
    --msg-in: #1f2c35;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --modal-bg: rgba(0, 0, 0, 0.6);
}

/* ============ RESET E BASE ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    background: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    display: flex;
    transition: background-color .3s;
}

button {
    font-family: inherit;
}

/* ============ SCROLLBAR CUSTOMIZADA ============ */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ================================================================
   1. TELA DE LOGIN
   ================================================================ */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    padding: 16px;
    overflow: hidden;
}

.login-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .35;
    pointer-events: none;
}

.blob-1 {
    width: 420px;
    height: 420px;
    background: var(--primary);
    top: -120px;
    right: -80px;
}

.blob-2 {
    width: 380px;
    height: 380px;
    background: var(--blue);
    bottom: -140px;
    left: -100px;
    opacity: .2;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 410px;
    background: var(--bg-panel);
    border-radius: var(--radius-xl);
    padding: 38px 34px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: cardIn .5s cubic-bezier(.34, 1.3, .64, 1);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card.shake {
    animation: shake .4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-9px); }
    75%      { transform: translateX(9px); }
}

.login-brand {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    margin: 0 auto 18px;
    background: linear-gradient(135deg, var(--primary), hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) + 16%)));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.7rem;
    box-shadow: 0 8px 24px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .4);
}

.login-card h1 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.5px;
    margin-bottom: 4px;
}

.login-card h1 span {
    color: var(--primary);
}

.login-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: .84rem;
    margin-bottom: 26px;
}

.login-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .6px;
    display: block;
    margin-bottom: 6px;
}

.login-input-wrap {
    position: relative;
    margin-bottom: 14px;
}

.login-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: .85rem;
}

.login-input {
    width: 100%;
    padding: 13px 14px 13px 40px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: .9rem;
    transition: var(--transition);
}

.login-input:focus {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    transition: var(--transition);
    box-shadow: 0 6px 18px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .35);
}

.login-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 14px;
    color: var(--text-secondary);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.demo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
}

.demo-chip {
    padding: 7px 13px;
    border-radius: 20px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    font-size: .74rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.demo-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.demo-chip.admin-chip {
    color: var(--primary);
    border-color: var(--primary-medium);
    background: var(--primary-light);
}

/* ================================================================
   2. SIDEBAR MENU
   ================================================================ */
.sidebar-menu {
    width: 74px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 0;
    border-right: 1px solid var(--border);
    z-index: 40;
    flex-shrink: 0;
}

.brand-dot {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    margin-bottom: 22px;
    background: linear-gradient(135deg, var(--primary), hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) + 14%)));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 4px 14px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .35);
}

.menu-item {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.15rem;
    position: relative;
    border: none;
    background: transparent;
}

.menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .35);
}

.menu-spacer {
    flex: 1;
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    margin-bottom: 10px;
}

.menu-item.logout:hover {
    background: rgba(239, 68, 68, .1);
    color: var(--red);
}

/* ================================================================
   3. LISTA DE CLIENTES
   ================================================================ */
.contact-list-panel {
    width: 372px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.list-header {
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--border);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.header-title span {
    color: var(--primary);
}

.user-hello {
    font-size: .72rem;
    color: var(--text-secondary);
    margin-top: 3px;
    font-weight: 600;
}

.user-hello b {
    color: var(--primary);
}

/* Botões de ícone genéricos */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.btn-icon.accent {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .3);
}

.btn-icon.accent:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: scale(1.06);
}

/* Busca */
.search-box {
    position: relative;
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    padding: 11px 14px 11px 38px;
    border-radius: var(--radius-lg);
    color: var(--text-main);
    font-size: 0.88rem;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* Abas de status */
.status-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
}

.tab-btn {
    flex: 1;
    padding: 8px 2px;
    font-size: 0.68rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 9px;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--bg-panel);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Select de área */
.area-select-wrap {
    position: relative;
}

.area-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    padding: 10px 36px 10px 36px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.area-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.area-select-wrap > i.fa-filter {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 0.78rem;
    pointer-events: none;
}

.area-select-wrap > i.fa-chevron-down {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.68rem;
    pointer-events: none;
}

.my-area-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--primary-light);
    border: 1.5px dashed var(--primary-medium);
    border-radius: var(--radius-md);
    font-size: .8rem;
    font-weight: 700;
    color: var(--primary);
}

/* Container de contatos */
.contacts-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    border-radius: var(--radius-lg);
    transition: var(--transition);
    margin-bottom: 4px;
}

.contact-item:hover {
    background: var(--bg-hover);
}

.contact-item.active {
    background: var(--primary-light);
}

.avatar-wrapper {
    position: relative;
    margin-right: 12px;
    flex-shrink: 0;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-input);
    display: block;
}

.status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2.5px solid var(--bg-panel);
}

.status-new { background: var(--blue); }
.status-open { background: var(--amber); }
.status-resolved { background: var(--green); }

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

.contact-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
    gap: 8px;
}

.contact-name {
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-time {
    font-size: 0.68rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.contact-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dept-tag {
    font-size: 0.6rem;
    padding: 2.5px 7px;
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 700;
    flex-shrink: 0;
}

.dept-tag.transferred {
    background: rgba(245, 158, 11, .14);
    color: var(--amber);
}

.attending-icon {
    color: var(--amber);
    font-size: .7rem;
    flex-shrink: 0;
}

.unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.followup-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--amber);
    background: rgba(245, 158, 11, .12);
    padding: 2.5px 7px;
    border-radius: 6px;
    flex-shrink: 0;
}

.empty-list {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.empty-list i {
    font-size: 2.2rem;
    opacity: .3;
    margin-bottom: 12px;
    display: block;
}

/* ================================================================
   4. ÁREA DO CHAT
   ================================================================ */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-chat);
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 22px 22px;
    position: relative !important; /* 🚨 Ancoragem para os popups de emojis/anexos */
}


.chat-header {
    padding: 10px 18px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    z-index: 5;
}

.chat-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.chat-header-user .avatar {
    width: 42px;
    height: 42px;
}

.chat-header-info {
    min-width: 0;
}

.chat-header-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-info p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.back-btn {
    display: none;
}

.chat-messages {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-divider {
    align-self: center;
    background: var(--bg-panel);
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    margin: 10px 0;
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.sys-divider {
    color: var(--primary);
    background: var(--primary-light);
}

.message {
    max-width: min(65%, 480px);
    padding: 9px 12px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.45;
    position: relative;
    box-shadow: var(--shadow-sm);
    animation: msgIn .25s ease;
}

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

.msg-in {
    align-self: flex-start;
    background: var(--msg-in);
    border-top-left-radius: 4px;
}

.msg-out {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-top-right-radius: 4px;
}

.msg-time {
    font-size: 0.62rem;
    opacity: 0.65;
    text-align: right;
    margin-top: 3px;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    align-items: center;
}

.message img.msg-img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    margin-bottom: 4px;
    max-height: 300px;
    object-fit: cover;
}

.msg-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px;
}

.msg-file-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.msg-in .msg-file-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.msg-file-name {
    font-size: 0.8rem;
    font-weight: 600;
    word-break: break-all;
}

.msg-file-size {
    font-size: 0.65rem;
    opacity: .7;
}

.chat-empty {
    text-align: center;
    color: var(--text-secondary);
    margin: auto;
}

.chat-empty .icon-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--bg-panel);
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

/* Input do chat */
.chat-input-area {
    padding: 12px 18px;
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    border-top: 1px solid var(--border);
}

#inputForm {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
}


.input-wrapper {
    flex: 1;
    background: var(--bg-input);
    border-radius: var(--radius-xl);
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid transparent;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.9rem;
    min-width: 0;
}

.input-emoji-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.15rem;
    transition: var(--transition);
    padding: 2px;
}

.input-emoji-btn:hover,
.input-emoji-btn.active {
    color: var(--primary);
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: var(--transition);
    box-shadow: 0 4px 12px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .3);
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.07);
    background: var(--primary-hover);
}

.send-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Barras de estado do input (Atender / Bloqueado) */
.input-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 18px;
    background: var(--bg-input);
    border-radius: var(--radius-xl);
    border: 1.5px dashed var(--border);
    animation: msgIn .25s ease;
}

.input-bar.lock {
    border-color: rgba(245, 158, 11, .55);
    background: rgba(245, 158, 11, .08);
}

.bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    font-size: .84rem;
    color: var(--text-secondary);
}

.bar-info > i {
    font-size: 1.25rem;
    color: var(--primary);
    flex-shrink: 0;
}

.input-bar.lock .bar-info > i {
    color: var(--amber);
}

.bar-info small {
    display: block;
    font-size: .7rem;
    opacity: .8;
}

.bar-info b {
    color: var(--text-main);
}

.start-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: .86rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 4px 14px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .35);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.start-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.start-btn.takeover {
    background: var(--amber);
    box-shadow: 0 4px 14px rgba(245, 158, 11, .35);
}

.start-btn.takeover:hover {
    filter: brightness(.94);
}

/* Emoji picker */
.emoji-picker {
    position: absolute !important;
    bottom: 75px !important;
    left: 20px !important;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 12px;
    display: none;
    z-index: 1000 !important;
    animation: popIn .18s ease;
}


.emoji-picker.open {
    display: block !important;
}


.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    max-height: 220px;
    overflow-y: auto;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.35rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    line-height: 1;
}

.emoji-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.15);
}


/* Popover de anexos */
.attach-pop {
    position: absolute !important;
    bottom: 75px !important;
    left: 20px !important;
    background: var(--bg-panel);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 6px;
    display: none;
    z-index: 1000 !important;
    animation: popIn .18s ease;
    min-width: 210px;
}


.attach-pop.open {
    display: block !important;
}

.attach-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    transition: var(--transition);
}

.attach-option:hover {
    background: var(--bg-hover);
    color: var(--primary);
}


.attach-option i {
    width: 18px;
    text-align: center;
    color: var(--primary);
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ================================================================
   5. PAINEL DE INFORMAÇÕES (DIREITA)
   ================================================================ */
.info-panel {
    width: 330px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    transition: width .25s ease, opacity .2s;
}

body.info-collapsed .info-panel {
    width: 0;
    opacity: 0;
    border: none;
}

/* Área rolável do painel */
.info-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Ações rápidas FIXAS no fim da coluna */
.actions-fixed {
    flex-shrink: 0;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 18px rgba(16, 30, 54, .06);
    position: relative;
    z-index: 2;
}

.info-close-mobile {
    display: none;
}

.profile-header {
    text-align: center;
    padding: 28px 20px 22px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.profile-avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    margin: 0 auto 12px;
    border: 4px solid var(--primary-light);
    display: block;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 3px;
}

.profile-phone {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.profile-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.pill-new { background: rgba(59, 130, 246, .12); color: var(--blue); }
.pill-open { background: rgba(245, 158, 11, .14); color: var(--amber); }
.pill-resolved { background: rgba(16, 185, 129, .12); color: var(--green); }

.area-line {
    font-size: .78rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.area-line b {
    color: var(--primary);
}

.agent-line {
    font-size: .78rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.agent-line b {
    color: var(--amber);
}

.transfer-info {
    margin-top: 8px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--amber);
    background: rgba(245, 158, 11, .1);
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.panel-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary);
}

/* Retorno agendado */
.followup-card {
    background: rgba(245, 158, 11, .08);
    border: 1.5px dashed rgba(245, 158, 11, .4);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 0.82rem;
}

.followup-card .f-date {
    font-weight: 700;
    color: var(--amber);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
}

.followup-card .f-note {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-bottom: 8px;
}

.followup-none {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.link-btn {
    background: none;
    border: none;
    color: var(--red);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

/* Anotações */
.notes-area {
    width: 100%;
    min-height: 96px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--text-main);
    font-size: 0.84rem;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.5;
}

.notes-area:focus {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.save-note-btn {
    margin-top: 8px;
    width: 100%;
    padding: 9px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: var(--transition);
    pointer-events: none;
}

.save-note-btn.visible {
    max-height: 44px;
    opacity: 1;
    pointer-events: all;
}

/* Grade de ações rápidas */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.action-btn {
    padding: 12px 8px;
    border: 1.5px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-main);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    transition: var(--transition);
}

.action-btn i {
    font-size: 1.1rem;
    color: var(--primary);
}

.action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.action-btn.warn i {
    color: var(--amber);
}

.action-btn.warn:hover {
    background: rgba(245, 158, 11, .1);
    border-color: var(--amber);
}

/* Conexões */
.conn-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.conn-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.conn-icon.on { background: rgba(16, 185, 129, .12); color: var(--green); }
.conn-icon.off { background: rgba(239, 68, 68, .1); color: var(--red); }

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

.conn-label {
    font-weight: 700;
    font-size: .84rem;
}

.conn-number {
    font-size: .74rem;
    color: var(--text-secondary);
}

.conn-status {
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 12px;
    flex-shrink: 0;
    font-size: .62rem;
}

.conn-status.on { background: rgba(16, 185, 129, .12); color: var(--green); }
.conn-status.off { background: rgba(239, 68, 68, .1); color: var(--red); }

/* ================================================================
   6. MODAIS
   ================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-panel);
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-xl);
    padding: 26px;
    box-shadow: var(--shadow-lg);
    transform: scale(.94) translateY(10px);
    transition: transform .22s cubic-bezier(.34, 1.4, .64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

.modal h2 {
    font-size: 1.05rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal h2 i {
    color: var(--primary);
}

.modal-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.field-label {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.modal-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-main);
    margin-bottom: 16px;
    font-size: 0.88rem;
    transition: var(--transition);
    font-family: inherit;
}

.modal-input:focus {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.btn-cancel {
    padding: 11px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-cancel:hover {
    background: var(--bg-hover);
}

.btn-confirm {
    padding: 11px 24px;
    background: var(--primary);
    border: none;
    color: #fff;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: var(--transition);
    box-shadow: 0 4px 12px hsla(var(--primary-h), var(--primary-s), var(--primary-l), .3);
}

.btn-confirm:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Preview de arquivo */
.file-preview-box {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.file-preview-box img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
}

.file-preview-generic {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.file-preview-generic i {
    font-size: 2.2rem;
    color: var(--primary);
}

.file-preview-generic .fp-name {
    font-weight: 700;
    font-size: 0.88rem;
    word-break: break-all;
}

.file-preview-generic .fp-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Seletor de cores */
.color-picker-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.color-option {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.color-option:hover {
    transform: scale(1.12);
}

.color-option.active {
    border-color: var(--text-main);
    transform: scale(1.12);
}

/* ================================================================
   7. TOAST E BACKDROP
   ================================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--text-main);
    color: var(--bg-panel);
    padding: 12px 22px;
    border-radius: var(--radius-xl);
    font-size: 0.84rem;
    font-weight: 600;
    z-index: 600;
    transition: transform .3s cubic-bezier(.34, 1.4, .64, 1);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    max-width: 90vw;
}

.toast i {
    color: var(--green);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.info-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

/* ================================================================
   8. RESPONSIVIDADE — MOBILE
   ================================================================ */
@media (max-width: 900px) {
    .info-panel {
        display: none;
    }
    body.info-collapsed .info-panel {
        display: none;
    }
}

@media (max-width: 820px) {
    body {
        flex-direction: column;
        padding-bottom: 64px;
    }

    /* Sidebar vira barra inferior */
    .sidebar-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 64px;
        flex-direction: row;
        justify-content: space-around;
        padding: 0 8px;
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 100;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .06);
    }

    .brand-dot,
    .sidebar-avatar,
    .menu-spacer {
        display: none;
    }

    .menu-item {
        margin: 0;
        width: 48px;
        height: 48px;
    }

    /* Lista de contatos ocupa toda a tela */
    .contact-list-panel {
        width: 100%;
        border-right: none;
        height: calc(100dvh - 64px);
    }

    /* Chat vira tela deslizante */
    .chat-area {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 64px;
        z-index: 60;
        transform: translateX(100%);
        transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    }

    body.mobile-chat-open .chat-area {
        transform: translateX(0);
    }

    .back-btn {
        display: inline-flex;
    }

    /* Painel de info vira drawer lateral */
    .info-panel {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 64px;
        width: min(340px, 88vw);
        z-index: 90;
        transform: translateX(105%);
        transition: transform .3s cubic-bezier(.4, 0, .2, 1);
        box-shadow: var(--shadow-lg);
    }

    body.info-open .info-panel {
        transform: translateX(0);
    }

    body.info-open .info-backdrop {
        opacity: 1;
        pointer-events: all;
    }

    .info-close-mobile {
        display: inline-flex;
        position: absolute;
        top: 14px;
        right: 14px;
        z-index: 3;
    }

    .chat-messages {
        padding: 16px 14px;
    }

    .message {
        max-width: 82%;
    }

    .emoji-picker {
        left: 10px;
        bottom: 72px;
    }

    .attach-pop {
        left: 54px;
        bottom: 72px;
    }

    .chat-input-area {
        padding: 10px 12px;
    }

     .toast {
        bottom: 80px !important; /* Fica acima da barra inferior do celular */
        width: 90% !important;
        max-width: 360px !important;
        text-align: center;
    }

    .input-bar {
        flex-wrap: wrap;
    }
}
/* ================================================================
   VIEW SYSTEM
   ================================================================ */
.view-container {
    flex: 1;
    display: none;
    min-width: 0;
    overflow: hidden;
}
.view-container.view-active {
    display: flex;
}

.page-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-app);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.5px;
}
.page-title span { color: var(--primary); }
.page-sub {
    color: var(--text-secondary);
    font-size: .85rem;
    margin-top: 4px;
}

.page-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ================================================================
   TABELA DE DADOS
   ================================================================ */
.contacts-table-wrap {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden; /* Mantém os cantos arredondados da borda */
    max-height: 75vh; /* Altura máxima (ocupa 75% da tela), force o scroll ao passar disso */
    overflow-y: auto; /* Habilita a barra de rolagem vertical */
}
.contacts-table-wrap thead th {
    position: sticky;
    top: 0;
    background: var(--bg-input); /* Mesma cor de fundo do seu cabeçalho atual */
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Leve sombra para destacar do conteúdo */
}
.contacts-table-wrap::-webkit-scrollbar {
    width: 8px;
}
.contacts-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}
.contacts-table-wrap::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}
.contacts-table-wrap::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background: var(--bg-input);
    padding: 12px 16px;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 16px;
    font-size: .88rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.table-actions {
    display: flex;
    gap: 6px;
}
.table-action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
}
.table-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.table-action-btn.danger:hover {
    border-color: var(--red);
    color: var(--red);
    background: rgba(239,68,68,.08);
}

.status-pill-small {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.status-pill-small.new { background: rgba(59,130,246,.12); color: var(--blue); }
.status-pill-small.open { background: rgba(245,158,11,.14); color: var(--amber); }
.status-pill-small.resolved { background: rgba(16,185,129,.12); color: var(--green); }

/* ================================================================
   CONEXÕES (CARDS)
   ================================================================ */
.connections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.connection-card {
    background: var(--bg-panel);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.connection-card:hover {
    border-color: var(--primary-medium);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.conn-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}
.conn-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.conn-card-icon.on { background: rgba(16,185,129,.12); color: var(--green); }
.conn-card-icon.off { background: rgba(239,68,68,.1); color: var(--red); }
.conn-card-icon.pending { background: rgba(245,158,11,.12); color: var(--amber); }

.conn-card-info { flex: 1; min-width: 0; }
.conn-card-name {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conn-card-number {
    font-size: .78rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-family: monospace;
}
.conn-card-status {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    flex-shrink: 0;
}
.conn-card-status.on { background: rgba(16,185,129,.12); color: var(--green); }
.conn-card-status.off { background: rgba(239,68,68,.1); color: var(--red); }
.conn-card-status.pending { background: rgba(245,158,11,.12); color: var(--amber); }

.conn-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .78rem;
}
.conn-card-meta-tag {
    background: var(--bg-input);
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 600;
}
.conn-card-meta-tag.area { background: var(--primary-light); color: var(--primary); }
.conn-card-meta-tag.ura { background: rgba(139,92,246,.12); color: #8b5cf6; }

.conn-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.conn-action-btn {
    flex: 1;
    padding: 9px;
    border: 1.5px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}
.conn-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.conn-action-btn.danger:hover {
    border-color: var(--red);
    color: var(--red);
    background: rgba(239,68,68,.08);
}
.conn-action-btn.connect {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.conn-action-btn.connect:hover {
    background: var(--primary-hover);
    color: #fff;
}

/* ================================================================
   URA CONFIG BOX
   ================================================================ */
.ura-config-box {
    background: var(--bg-input);
    padding: 14px;
    border-radius: var(--radius-md);
    margin: 12px 0;
}
.ura-config-fields {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

/* ================================================================
   CONECTAR: QR + PAIR
   ================================================================ */
.connect-tabs {
    display: flex;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    gap: 4px;
}
.connect-tab {
    flex: 1;
    padding: 9px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: .82rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.connect-tab.active {
    background: var(--bg-panel);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.qr-container {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-loading {
    text-align: center;
    color: var(--text-secondary);
}
.qr-loading i { font-size: 2rem; margin-bottom: 12px; }

.pair-code-display {
    background: var(--bg-input);
    padding: 20px;
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 6px;
    color: var(--primary);
}

/* ================================================================
   CAMPANHAS
   ================================================================ */
.campaign-card {
    background: var(--bg-panel);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.campaign-card:hover {
    border-color: var(--primary-medium);
    box-shadow: var(--shadow-md);
}

.camp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.camp-name { font-size: 1rem; font-weight: 700; }
.camp-status {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
    flex-shrink: 0;
}
.camp-status.pending { background: rgba(59,130,246,.12); color: var(--blue); }
.camp-status.running { background: rgba(245,158,11,.14); color: var(--amber); }
.camp-status.completed { background: rgba(16,185,129,.12); color: var(--green); }
.camp-status.failed { background: rgba(239,68,68,.1); color: var(--red); }

.camp-message {
    font-size: .82rem;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 10px;
    border-radius: var(--radius-sm);
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.camp-stats {
    display: flex;
    gap: 8px;
    font-size: .78rem;
}
.camp-stat {
    flex: 1;
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    text-align: center;
}
.camp-stat b { display: block; font-size: 1rem; color: var(--text-main); }

.camp-progress {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}
.camp-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width .3s;
}

.camp-actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ================================================================
   RESPONSIVO ADICIONAL
   ================================================================ */
@media (max-width: 820px) {
    .view-container.view-active#viewAttendances {
        display: flex;
    }
    .page-view { padding: 16px; }
    .connections-grid {
        grid-template-columns: 1fr;
    }
    .data-table { font-size: .82rem; }
    .data-table th, .data-table td { padding: 10px 8px; }
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) { display: none; }
}
/* ================================================================
   ESTADO INICIAL DO CHAT (sem contato selecionado)
   ================================================================ */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

.chat-empty .icon-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    font-size: 3.5rem;
    color: var(--primary);
}

.chat-empty h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.chat-empty p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Garante que o painel de info some no estado inicial */
.info-panel[style*="display: none"] {
    display: none !important;
}

/* Garante que o header do chat some no estado inicial */
.chat-header[style*="display: none"] {
    display: none !important;
}

/* Animação suave ao mostrar/esconder elementos */
.chat-header,
.info-panel {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Ajuste para o chat ocupar todo o espaço quando painel está oculto */
.chat-area:has(~ .info-panel[style*="display: none"]) {
    width: 100%;
}

/* ================================================================
   MAPEAMENTO VISUAL DE OPÇÕES DO MENU
   ================================================================ */
.menu-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.menu-option-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}

.menu-option-arrow {
    color: var(--text-secondary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.menu-option-select {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-panel);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.menu-option-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.menu-option-remove {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.menu-option-remove:hover {
    background: rgba(239, 68, 68, .1);
    border-color: var(--red);
}

.menu-options-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: .82rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
}

/* Conexões: status connecting */
.conn-card-icon.pending {
    background: rgba(245, 158, 11, .12);
    color: var(--amber);
}
.conn-card-status.pending {
    background: rgba(245, 158, 11, .12);
    color: var(--amber);
}



/* Badge em formato de Red Dot Flutuante sobre o ícone do menu */
.menu-item {
    position: relative !important;
}

.alert-dot {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    background-color: var(--red, #ef4444) !important;
    color: #ffffff !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    min-width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    padding: 0 4px !important;
    z-index: 10 !important;
}

/* ================================================================
   MÓDULO DE USUÁRIOS — COMPLEMENTO CSS
   ================================================================ */

/* Card de modal (alternativa ao .modal) */
.modal-card {
    background: var(--bg-panel);
    width: 100%;
    max-width: 460px;
    border-radius: var(--radius-xl);
    padding: 26px;
    box-shadow: var(--shadow-lg);
    transform: scale(.94) translateY(10px);
    transition: transform .22s cubic-bezier(.34, 1.4, .64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.open .modal-card {
    transform: scale(1) translateY(0);
}

.modal-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 18px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-card label {
    font-size: .72rem;
    color: var(--text-secondary);
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.modal-card input,
.modal-card select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-main);
    margin-bottom: 14px;
    font-size: .88rem;
    font-family: inherit;
    transition: var(--transition);
}

.modal-card input:focus,
.modal-card select:focus {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Botão de perigo (exclusão) */
.btn-danger {
    padding: 11px 24px;
    background: var(--red);
    border: none;
    color: #fff;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    font-size: .85rem;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(239, 68, 68, .3);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Status "Bloqueado" para usuários */
.status-pill-small.blocked {
    background: rgba(239, 68, 68, .12);
    color: var(--red);
}
/* === PREVIEW DE RESPOSTA === */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--bg-card, var(--bg-secondary));
    border-left: 4px solid var(--primary);
    padding: 8px 12px;
    margin-bottom: 8px; /* Empurra a barra de digitação para baixo */
    border-radius: var(--radius-md, 8px);
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.reply-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.reply-name {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary);
}

.reply-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.95rem;
    transition: color 0.15s ease;
}

.reply-close:hover {
    color: var(--red, #ef4444);
}

/* === BARRA DE FORMATAÇÃO === */
.formatting-bar { 
    display: flex; 
    gap: 6px; 
    padding: 4px 12px 0 12px; 
}
.formatting-bar button {
    background: transparent; 
    border: 1px solid var(--border, #ddd);
    border-radius: 4px; 
    width: 28px; 
    height: 28px; 
    cursor: pointer; 
    font-size: 0.85rem;
    color: var(--text-primary, #111b21);
}
.formatting-bar button:hover { background: var(--bg-hover, #e9edef); }

/* === CITAÇÃO DENTRO DA MENSAGEM (RENDER) === */
.quoted-msg {
    background: rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary, #00a884);
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: pointer;
}
.quoted-msg strong { font-size: 0.75rem; color: var(--primary, #00a884); display: block; margin-bottom: 2px; }
.quoted-msg p { margin: 0; font-size: 0.8rem; color: var(--text-secondary, #667781); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === AJUSTE DO TEXTAREA === */
textarea.chat-input {
    resize: none;
    overflow-y: auto;
    max-height: 150px;
    line-height: 1.4;
    padding-top: 10px !important;
}


/* === LIGHTBOX (Tela Cheia para Imagens) === */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: zoom-out;
}
.lightbox-overlay.active { display: flex; }
.lightbox-img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.lightbox-controls {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}
.lightbox-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}
.lightbox-btn:hover { background: rgba(255,255,255,0.4); }

/* === CARD DE ARQUIVO MELHORADO === */
.msg-file-card {
    background: var(--bg-secondary, #f0f2f5);
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 280px;
    cursor: pointer;
    transition: transform 0.2s;
}
.msg-file-card:hover {
    background: var(--bg-hover, #e9edef);
    transform: translateY(-2px);
}
.msg-file-icon {
    width: 40px; height: 40px;
    background: var(--primary-light, #d9f4ec);
    color: var(--primary, #00a884);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.msg-file-info { flex: 1; min-width: 0; }
.msg-file-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file-size { font-size: 0.75rem; color: var(--text-secondary); }
.msg-file-actions { display: flex; gap: 8px; }
.file-action-btn {
    background: transparent; border: none; cursor: pointer;
    color: var(--text-secondary); font-size: 0.9rem; padding: 4px;
}
.file-action-btn:hover { color: var(--primary); }
/* ================= POPUP DE RESPOSTAS RÁPIDAS ================= */
.quick-reply-popup {
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    margin-bottom: 8px;
}

.quick-reply-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.quick-reply-item:last-child {
    border-bottom: none;
}

.quick-reply-item:hover,
.quick-reply-item.active {
    background: var(--primary-light);
}

.qr-shortcut {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.85rem;
}

.qr-text {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qr-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-secondary);
}

/* ================= BARRA DE GRAVAÇÃO DE ÁUDIO ================= */
.recording-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    gap: 12px;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--red);
}

.recording-dot {
    width: 10px;
    height: 10px;
    background-color: var(--red);
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.2; }
    100% { opacity: 1; }
}

.mic-btn {
    color: var(--primary);
}

.mic-btn:hover {
    background: var(--primary-light);
}
