[v-cloak] {
    display: none !important;
}

:root {
    /* Brand Colors */
    --primary: #3470e4;
    --primary-hover: #295cc4;
    --primary-light: #e8effc;
    
    /* Layout Colors */
    --bg-dark: #3867d6; /* Sidebar left */
    --bg-main: #f8fafc; /* Main background */
    --bg-white: #ffffff;
    
    /* Text Colors */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #f1f5f9;
    
    /* UI Colors */
    --border: #e2e8f0;
    --success: #22c55e;
    --success-bg: #e8f5e9;
    --warning: #f59e0b;
    --warning-bg: #fff8e1;
    --danger: #ef4444;
    --whatsapp: #25d366;
    
    /* Dimensions */
    --sidebar-width: 240px;
    --list-width: 320px;
    --drawer-width: 340px;
    --header-height: 64px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* Base Components */
button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    background: none;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 20px;
}
.icon-btn:hover {
    background-color: var(--bg-main);
    color: var(--primary);
}
.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.chat-actions .icon-btn.active {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary-circle {
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(52, 112, 228, 0.3);
}
.btn-primary-circle:hover {
    background-color: var(--primary-hover);
    color: white;
}

.btn-outline {
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 20px;
    font-weight: 500;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    color: var(--text-main);
    transition: 0.2s;
}
.btn-outline:hover {
    border-color: var(--text-muted);
}
.btn-outline.btn-danger {
    color: var(--danger);
    border-color: #fca5a5;
}
.btn-outline.btn-danger:hover {
    background: #fef2f2;
}

.badge {
    background: var(--success);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

/* Avatares */
.avatar-sm, .avatar-md, .large-avatar {
    position: relative;
    border-radius: 50%;
    flex-shrink: 0;
}
.avatar-sm img, .avatar-md img, .large-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 44px; height: 44px; }
.large-avatar { width: 80px; height: 80px; }

.status-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}
.status-indicator.online { background-color: var(--success); }

.channel-badge {
    position: absolute;
    bottom: -4px;
    left: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    border: 2px solid white;
}
.channel-badge.whatsapp { background-color: var(--whatsapp); }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-dark);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s;
}

.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 24px;
    font-weight: 700;
    gap: 8px;
}
.brand i { font-size: 28px; }

.menu {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s;
}
.menu a i { font-size: 20px; }
.menu a:hover:not(.disabled) {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}
.menu a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}
.menu a.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
}

.sidebar-whatsapp {
    margin: 0 12px 12px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 12px;
    background: rgba(15, 23, 42, .16);
}
.sidebar-whatsapp-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}
.sidebar-whatsapp-title > span:first-child {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar-whatsapp-title i { color: #6ee7a0; font-size: 16px; }
.sidebar-whatsapp-total {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: rgba(255,255,255,.82);
    font-size: 10px;
}
.sidebar-whatsapp-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 154px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.25) transparent;
}
.sidebar-whatsapp-item {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 9px;
    background: rgba(255,255,255,.08);
}
.sidebar-signal {
    position: relative;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: #cbd5e1;
}
.sidebar-signal i { position: relative; z-index: 1; font-size: 17px; }
.sidebar-whatsapp-item.is-connected .sidebar-signal {
    color: #fff;
    background: #22c55e;
}
.sidebar-whatsapp-item.is-connected .sidebar-signal-pulse {
    position: absolute;
    inset: -3px;
    border: 1px solid rgba(110,231,160,.7);
    border-radius: 50%;
    animation: sidebar-signal-pulse 2s ease-out infinite;
}
.sidebar-whatsapp-item.is-connecting .sidebar-signal {
    color: #422006;
    background: #fbbf24;
}
.sidebar-whatsapp-item.is-offline .sidebar-signal {
    color: #fecaca;
    background: rgba(239,68,68,.24);
}
@keyframes sidebar-signal-pulse {
    0% { transform: scale(.82); opacity: .9; }
    70%, 100% { transform: scale(1.25); opacity: 0; }
}
.sidebar-whatsapp-info { min-width: 0; flex: 1; }
.sidebar-whatsapp-info strong,
.sidebar-whatsapp-info span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.sidebar-whatsapp-info strong { color: white; font-size: 11px; font-weight: 600; }
.sidebar-whatsapp-info span { margin-top: 2px; color: rgba(255,255,255,.62); font-size: 10px; }
.sidebar-whatsapp-info .sidebar-whatsapp-number { color: rgba(255,255,255,.82); }
.sidebar-restart-btn {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: white;
    background: rgba(255,255,255,.12);
    font-size: 14px;
    transition: transform .2s, background .2s;
}
.sidebar-restart-btn:hover {
    background: rgba(255,255,255,.24);
    transform: rotate(22deg);
}
.sidebar-connect-btn,
.sidebar-whatsapp-empty button {
    flex: 0 0 auto;
    padding: 5px 7px;
    border-radius: 7px;
    background: white;
    color: #2856b6;
    font-size: 10px;
    font-weight: 700;
}
.sidebar-connect-btn:hover,
.sidebar-whatsapp-empty button:hover { background: #dcfce7; color: #166534; }
.sidebar-whatsapp-empty {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 7px;
    color: rgba(255,255,255,.66);
    font-size: 10px;
}
.sidebar-whatsapp-empty > i { font-size: 18px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sidebar-footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-footer a:hover { color: white; }
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}
.user-profile:hover { background-color: rgba(255,255,255,0.1); }
.user-profile span { flex: 1; font-weight: 500; font-size: 14px; }


/* --- Main Content Area --- */
.main-content {
    flex: 1;
    display: flex;
    background-color: var(--bg-white);
    position: relative;
    overflow: hidden;
}

/* --- Panel 1: Lista de Conversas --- */
.conversations-panel {
    width: var(--list-width);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: white;
}

.conversations-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}
.conversations-header h2 { font-size: 18px; font-weight: 600; }
.header-actions { display: flex; gap: 4px; }

.search-bar {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.search-bar > i { color: var(--text-muted); cursor: pointer; }
.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.search-input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}
.search-input-wrapper input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 20px;
    outline: none;
    font-family: 'Inter';
    transition: 0.2s;
}
.search-input-wrapper input:focus { border-color: var(--primary); }

/* São quatro abas em 320px de lista, duas delas com contador: tudo aqui é
   apertado de propósito. O rótulo não quebra — em tela menor a fileira rola de
   lado em vez de virar duas linhas. */
.tabs {
    display: flex;
    padding: 12px;
    gap: 4px;
    background-color: white;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
    flex: 1;
    padding: 7px 6px;
    border-radius: 20px;
    font-size: 11px;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tabs button.active {
    background-color: var(--primary);
    color: white;
}
/* O contador dentro da aba é o que estoura a largura: aqui ele encolhe */
.tabs .badge {
    font-size: 10px;
    padding: 1px 5px;
    margin-left: 4px;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}
.conversation-item {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-main);
    cursor: pointer;
    transition: background 0.2s;
}
.conversation-item:hover { background-color: var(--bg-main); }
.conversation-item.active {
    background-color: #dbe7ff;
    box-shadow: inset 4px 0 0 var(--primary);
}

/* Conversa que a IA acabou de passar para a equipe e ninguém abriu ainda.
   O pulso acompanha o toque: quem estiver de olho na tela vê antes de ouvir. */
.conversation-item.chamando {
    background-color: #fff7ed;
    box-shadow: inset 3px 0 0 #f59e0b;
    animation: chamando-pulso 2s ease-in-out infinite;
}
.tabs button.chamando { color: #b45309; font-weight: 600; }

@keyframes chamando-pulso {
    0%, 100% { background-color: #fff7ed; }
    50%      { background-color: #ffedd5; }
}

/* Aviso acima da lista, com a saída para quem precisa de silêncio */
.chamada-fila {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #fffbeb;
    border-bottom: 1px solid #fde68a;
    color: #92400e;
    font-size: 14px;
    font-weight: 500;
}
.chamada-fila i { font-size: 18px; }
.chamada-fila button {
    margin-left: auto;
    padding: 4px 12px;
    font: inherit;
    font-size: 13px;
    color: #92400e;
    background: transparent;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    cursor: pointer;
}
.chamada-fila button:hover { background-color: #fef3c7; }

/* O convite tem outro dono: a fila é do time, ele é seu. Cor diferente para
   não se confundir com o aviso de cliente esperando. */
.chamada-fila.chamada-convite {
    background-color: #eff6ff;
    border-bottom-color: #bfdbfe;
    color: #1d4ed8;
}
.chamada-fila.chamada-convite button {
    color: #1d4ed8;
    border-color: #93c5fd;
}
.chamada-fila.chamada-convite button:hover { background-color: #dbeafe; }

/* Movimento incomoda quem prefere a tela parada; a cor e o som continuam */
@media (prefers-reduced-motion: reduce) {
    .conversation-item.chamando { animation: none; }
}

.conversation-info {
    flex: 1;
    overflow: hidden;
}
.conv-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.conv-header .name { font-weight: 600; font-size: 15px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-header .time { font-size: 12px; color: var(--text-muted); }

.conv-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.preview-text {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}
.preview-text i { color: var(--primary); font-size: 14px; }

.tag-pill {
    font-size: 11px;
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --- Panel 2: Área de Chat --- */
#app {
    display: flex;
    height: 100vh;
    width: 100vw;
    background-color: var(--bg-main);
    overflow: hidden;
}

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

/* =========================================
   LOGIN VIEW
========================================= */
.login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    font-family: 'Inter', sans-serif;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box .brand {
    color: var(--primary);
    font-size: 32px;
    justify-content: center;
    margin-bottom: 20px;
}

.login-box h2 {
    color: var(--text-dark);
    margin-bottom: 8px;
}

.login-box p {
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: 30px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

.login-form .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.login-form .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: var(--transition-fast);
}

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

.login-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    justify-content: center;
    margin-top: 10px;
}

.error-msg {
    background-color: #fee2e2;
    color: #ef4444;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   SIDEBAR
========================================= */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    position: relative;
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.placeholder-graphics {
    margin-bottom: 32px;
    position: relative;
    width: 280px;
    height: 140px;
}
.mock-message {
    width: 200px;
    height: 48px;
    border-radius: 12px;
    background: white;
    position: absolute;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.mock-left { top: 0; left: 0; }
.mock-right { bottom: 0; right: 0; background: var(--bg-white); }
.no-chat-selected h2 { font-weight: 600; font-size: 20px; color: var(--text-main); }

.chat-header {
    min-height: 84px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    flex-shrink: 0;
}
.contact-brief {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}
.contact-brief .details { min-width: 0; }
.contact-brief h3 {
    max-width: min(360px, 30vw);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 600;
    margin-bottom: 2px;
}
.chat-header .tags { margin-top: 3px; line-height: 1; }
.chat-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

/* Puxar a conversa da IA. É o único botão do cabeçalho com texto: tirar o
   cliente das mãos do agente não é coisa para se descobrir passando o mouse
   por cima de um ícone. */
.btn-puxar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    padding: 7px 14px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.btn-puxar:hover { filter: brightness(1.08); }
.btn-puxar:disabled { opacity: .6; cursor: default; }

/* Devolver a vez ao agente. Vazado de propósito: ele aparece ao lado do
   "Puxar para mim", e dois botões cheios lado a lado disputam o mesmo olhar —
   quem assume a conversa continua sendo a ação principal do cabeçalho. */
.btn-responder-ia {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    padding: 7px 14px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.btn-responder-ia:hover { background: rgba(0, 0, 0, .04); }
.btn-responder-ia:disabled { opacity: .6; cursor: default; }

/* Em tela estreita o cabeçalho já está cheio: fica só o ícone */
@media (max-width: 700px) {
    .btn-puxar span, .btn-responder-ia span { display: none; }
    .btn-puxar, .btn-responder-ia { padding: 7px 10px; }
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
}

.date-separator {
    text-align: center;
    margin: 16px 0;
    position: relative;
}
.date-separator span {
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.message-wrapper { display: flex; gap: 8px; margin-bottom: 8px; }
.msg-in { justify-content: flex-start; }
.msg-out { justify-content: flex-end; }
.msg-system { justify-content: center; }

.system-text {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.msg-in .message-bubble {
    background: white;
    border-top-left-radius: 4px;
}
.msg-out .message-bubble {
    background: var(--success-bg);
    border-top-right-radius: 4px;
}
.msg-note .message-bubble {
    background: var(--warning-bg);
    border: 1px dashed #fcd34d;
}
.msg-pending .message-bubble { opacity: .72; }
.msg-pending .message-meta i {
    animation: mensagem-enviando .8s ease-in-out infinite alternate;
}
@keyframes mensagem-enviando { from { opacity: .3; } to { opacity: 1; } }

.message-text { font-size: 15px; line-height: 1.5; color: var(--text-main); word-wrap: break-word; }

/* Agente montando a resposta: o atendente vê antes de a mensagem existir */
.preview-text.ia-digitando { color: var(--primary); font-style: italic; }

.bubble-digitando {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
}
.bubble-digitando .rotulo {
    font-size: 12px;
    color: var(--text-soft, #64748b);
    margin-left: 4px;
}
.bubble-digitando .ponto {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-soft, #64748b);
    animation: pulsoDigitando 1.2s infinite ease-in-out;
}
.bubble-digitando .ponto:nth-child(2) { animation-delay: 0.2s; }
.bubble-digitando .ponto:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulsoDigitando {
    0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* Formatação do WhatsApp dentro do balão */
.message-text a {
    color: var(--primary);
    text-decoration: underline;
    word-break: break-all;
}
.message-text strong { font-weight: 600; }
.message-text del { opacity: 0.75; }
.message-text code {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
    background: rgba(15, 23, 42, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
}
.message-text .msg-code {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
    background: rgba(15, 23, 42, 0.06);
    padding: 8px 10px;
    border-radius: 8px;
    margin: 6px 0;
    white-space: pre-wrap;
    overflow-x: auto;
}
.message-text blockquote {
    border-left: 3px solid rgba(15, 23, 42, 0.2);
    padding-left: 10px;
    margin: 4px 0;
    color: var(--text-soft, #64748b);
}
.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}
.message-meta i { font-size: 14px; color: var(--primary); }
/* Os tiques do WhatsApp: cinza até ler, azul quando leu */
.message-meta i.tique-pendente,
.message-meta i.tique-enviado,
.message-meta i.tique-entregue { color: #94a3b8; }
.message-meta i.tique-lido { color: #34b7f1; }
.message-meta i.tique-falhou { color: #ef4444; }

.avatar-xs {
    width: 24px;
    height: 24px;
    align-self: flex-end;
}
.avatar-xs img { width: 100%; height: 100%; border-radius: 50%; }

/* Área de Input */
.input-area {
    background: white;
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    margin: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.05);
    transition: background 0.3s;
    flex-shrink: 0;
}
.input-area.is-note { background: #fffdf5; border-color: #fef08a; }

.input-toolbar-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.toggle-switch input { display: none; }
.slider {
    width: 36px;
    height: 20px;
    background-color: var(--border);
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}
.slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .slider { background-color: var(--primary); }
.toggle-switch input:checked + .slider::before { transform: translateX(16px); }
.toggle-switch .label { font-size: 14px; font-weight: 500; }

.compose-tabs {
    display: flex;
    background: var(--bg-main);
    border-radius: 20px;
    padding: 2px;
}
.compose-tabs button {
    padding: 6px 16px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.compose-tabs button.active {
    background: var(--primary);
    color: white;
}
.input-area.is-note .compose-tabs button.active {
    background: var(--warning);
}

.input-area textarea {
    width: 100%;
    border: none;
    resize: none;
    height: 60px;
    outline: none;
    font-family: 'Inter';
    font-size: 15px;
    background: transparent;
}

.input-toolbar-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.left-actions { display: flex; gap: 4px; }
.send-btn, .mic-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.2s;
}
.send-btn:hover, .mic-btn:hover { transform: scale(1.05); }

/* Calendário com relógio: o relógio sobreposto diferencia o envio programado
   do calendário de retorno da IA que já existe no cabeçalho. */
.icone-calendario-relogio {
    position: relative;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
}
.icone-calendario-relogio > .ph-calendar-blank { font-size: 21px; }
.icone-calendario-relogio > .ph-clock {
    position: absolute;
    right: -2px;
    bottom: -2px;
    font-size: 11px;
    color: currentColor;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px white;
}
.sidebar .icone-calendario-relogio > .ph-clock { background: var(--bg-dark); box-shadow: 0 0 0 1px var(--bg-dark); }
.sidebar .menu a.active .icone-calendario-relogio > .ph-clock { background: rgba(255,255,255,.14); box-shadow: none; }
.botao-agendar-mensagem { color: var(--primary); margin-right: 4px; }

/* Enquanto a mensagem sai. O botão precisa PARECER travado: sem isto o
   atendente clica de novo achando que o primeiro clique não pegou, que foi
   exatamente como um cliente recebeu a mesma mensagem seis vezes. */
.send-btn:disabled, .mic-btn:disabled { opacity: 0.5; cursor: default; }
.send-btn:disabled:hover, .mic-btn:disabled:hover { transform: none; }


/* --- Panel 3: Gaveta Direita --- */
.details-drawer {
    width: var(--drawer-width);
    background: white;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: absolute;
    right: -100%;
    top: 0;
    height: 100%;
    transition: right 0.3s ease;
    z-index: 10;
    box-shadow: -10px 0 30px rgba(0,0,0,0.05);
}
.details-drawer.open { right: 0; }

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.close-drawer {
    position: absolute;
    top: 16px;
    left: 16px;
}
.edit-btn {
    position: absolute;
    top: 16px;
    right: 16px;
}
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 16px;
}
.profile-header h2 { font-size: 18px; font-weight: 600; margin-top: 12px; }
.profile-header p { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.profile-header .lid { font-size: 12px; color: #94a3b8; }

.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.drawer-tabs button {
    flex: 1;
    padding: 16px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
}
.drawer-tabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.section { margin-bottom: 24px; }
.section h4 { font-size: 13px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin-bottom: 12px; }
.add-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px dashed var(--text-muted);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
}
.section.expandable {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
}
.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--primary);
}
.section-header .caret { margin-left: auto; color: var(--text-muted); }

.info-fields {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}
.field {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.field:last-child { border-bottom: none; }
.field label { color: var(--text-muted); }
.field .value { font-weight: 500; display: flex; align-items: center; gap: 4px; }
.field .action { color: var(--primary); cursor: pointer; }

.drawer-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


/* --- Agentes de IA View --- */
.bg-light { background-color: var(--bg-main); }
.ai-agents-view {
    flex-direction: column;
    overflow-y: auto;
}
.ai-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}
.breadcrumb { font-size: 14px; color: var(--text-muted); }
.breadcrumb .brand-text { font-weight: 700; color: var(--primary); }
.breadcrumb .current { color: var(--text-main); font-weight: 500; }
.credits-info { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.btn-outline-small {
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    background: white;
}

.ai-content-wrapper { padding: 32px; max-width: 1200px; margin: 0 auto; width: 100%; }
.ai-title-section h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.ai-title-section p { color: var(--text-muted); line-height: 1.6; max-width: 800px; margin-bottom: 32px; }

.banner-blue {
    background: var(--primary-light);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    margin-bottom: 32px;
}
.banner-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.banner-text h4 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--primary); }
.banner-text p { color: var(--text-main); margin-bottom: 16px; font-size: 14px; }
.close-banner { position: absolute; top: 16px; right: 16px; }

.ai-list-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    overflow: hidden;
}
.list-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.list-header .search-input-wrapper { max-width: 300px; }
.agents-count { font-size: 14px; color: var(--text-muted); }
.agents-count a { color: var(--primary); text-decoration: none; font-weight: 500; margin-left: 8px; }

.agents-table {
    width: 100%;
    border-collapse: collapse;
}
.agents-table th, .agents-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.agents-table th { font-weight: 500; color: var(--text-muted); font-size: 13px; }
.agents-table th i { margin-right: 4px; }
.agent-name-cell { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.badge-expert {
    background: #e9d8fd;
    color: #6b46c1;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.status-active {
    border: 1px solid var(--success);
    color: var(--success);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}
.actions-cell { display: flex; align-items: center; gap: 12px; }
.icon-text-btn { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-muted); font-weight: 500; }
.icon-text-btn:hover { color: var(--primary); }

/* Wizard */
.wizard-wrapper { display: flex; justify-content: center; }
.wizard-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 900px;
    padding: 40px;
    position: relative;
}
.close-wizard { position: absolute; top: 24px; right: 24px; }
.wizard-header { margin-bottom: 40px; display: flex; align-items: center; gap: 12px; }
.wizard-header h2 { font-size: 24px; font-weight: 700; }

.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 48px;
}
.step { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-muted); }
.step.active { color: var(--primary); }
.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}
.step.active .step-circle { background: var(--primary); color: white; }
.step span { font-size: 12px; font-weight: 500; }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 16px; margin-bottom: 24px; }

.wizard-body h3 { font-size: 18px; margin-bottom: 24px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 14px; color: var(--text-muted); }

.custom-select {
    position: relative;
    max-width: 400px;
}
.select-trigger {
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
}
.custom-select.open .select-trigger { border-color: var(--primary); }
.select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 20;
}
.select-search {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.select-search input { border: none; outline: none; width: 100%; font-family: 'Inter'; }
.options-list { list-style: none; max-height: 250px; overflow-y: auto; }
.options-list li { padding: 12px 16px; cursor: pointer; font-size: 14px; }
.options-list li:hover { background: var(--bg-main); color: var(--primary); }

.wizard-footer { margin-top: 48px; display: flex; justify-content: flex-end; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-card {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    padding: 32px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-card h2 { margin-bottom: 24px; font-size: 20px;}
.modal-card .actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px;}

.anexo-preview-modal { max-width: 620px; }
.anexo-preview-conteudo {
    width: 100%;
    min-height: 220px;
    max-height: 52vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #0f172a;
}
.anexo-preview-conteudo video,
.anexo-preview-conteudo img {
    display: block;
    width: 100%;
    max-height: 52vh;
    object-fit: contain;
}
.anexo-preview-conteudo audio { width: calc(100% - 40px); }
.anexo-preview-documento {
    width: 92px;
    height: 110px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: white;
    color: var(--primary);
}
.anexo-preview-documento i { font-size: 58px; }
.anexo-preview-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    min-width: 0;
}
.anexo-preview-info strong {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.anexo-preview-info span {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 12px;
}
.anexo-preview-aviso {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

/* Fechar no canto de cima: em modal comprido o Cancelar do rodapé fica longe,
   e o X acompanha a rolagem em vez de sumir junto com o título */
.modal-topo {
    position: sticky;
    top: -12px;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    margin: -12px -12px 0 0;
}
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 20px;
    color: var(--text-soft, #64748b);
    cursor: pointer;
}
.modal-close:hover { background: #f1f5f9; color: var(--text-main, #1e293b); }

/* QR de pareamento: imagem + anel de validade ao lado */
.qr-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.qr-contador {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}
.qr-contador-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Número do contato ao lado do nome */
.conv-phone {
    font-size: 11px;
    color: #94a3b8;
    margin: 1px 0 2px;
}
.chat-header .details .chat-phone {
    display: block;
    font-size: 12px;
    color: #64748b;
}

/* Player de áudio dentro do balão de mensagem */
.message-audio audio {
    display: block;
    width: 240px;
    max-width: 100%;
    height: 40px;
}
.msg-out .message-audio audio {
    filter: hue-rotate(85deg) saturate(0.6);
}

/* Convite de transferência esperando resposta. Fica entre a conversa e o campo
   de escrever, que é onde o olho de quem vai decidir já está. */
.aviso-transferencia {
    border-top: 1px solid var(--border);
    background: #fffbeb;
    padding: 14px 20px;
}
.aviso-transferencia .titulo {
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 6px;
}
.aviso-transferencia .recado {
    font-size: 13px;
    color: #78350f;
    font-style: italic;
    margin-top: 6px;
}
.aviso-transferencia .explica {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}
.aviso-transferencia .botoes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.aviso-transferencia .botoes button {
    width: auto;
    display: inline-flex;
}

/* Há quanto tempo esta conversa teve movimento. Discreto de propósito: é
   informação de canto de olho, e não pode competir com o nome do cliente.
   O texto sempre diz "Última mensagem" — não é presença do WhatsApp, e um
   rótulo mais curto viraria "visto por último" na cabeça de quem lê. */
.chat-header .details .chat-visto {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}
.chat-header .details .chat-visto i {
    font-size: 12px;
    vertical-align: -1px;
}
.profile-header .visto {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

/* O retorno agendado fica à vista de quem abre a conversa. Verde de combinado
   cumprido, e não amarelo de pendência: é algo que já está resolvido — alguém
   marcou, e o agente vai lá no dia. */
.tag-pill.retorno {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

/* O calendário com data marcada não pode parecer o botão de perigo, que é o
   que a regra geral de .icon-btn.active faz (vermelho, para o invisível à IA) */
.chat-actions .icon-btn.active .ph-calendar-check {
    color: #16a34a;
}
.chat-actions .icon-btn.active:has(.ph-calendar-check) {
    background: rgba(22, 163, 74, 0.12);
}

/* O convite que é para mim não pode se perder no meio das etiquetas */
.tag-pill.pill-transferencia {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

/* O que o cliente falou, escrito. Fica discreto: quem manda no balão continua
   sendo o áudio, e a transcrição é a legenda dele. */
.audio-transcricao {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(15, 23, 42, .08);
    font-size: 13px;
    line-height: 1.45;
    color: #475569;
    max-width: 320px;
    overflow-wrap: anywhere;
}
.audio-transcricao i {
    color: #94a3b8;
    margin-right: 2px;
}

/* A resposta que saiu falada: o arquivo não fica guardado, então o balão traz
   o texto de referência com este selo por cima dizendo como o cliente recebeu */
.audio-enviado {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .06);
    font-size: 11px;
    font-weight: 600;
    color: #475569;
}
.audio-enviado i {
    font-size: 13px;
}

/* Selects e upload nos formulários seguem a mesma caixa dos inputs */
.login-form .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    outline: none;
    transition: var(--transition-fast);
}
.login-form .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.login-form .form-group input[type="file"] {
    padding: 10px;
    font-size: 13px;
    background: #f8fafc;
    cursor: pointer;
}
.login-form .form-group input[type="checkbox"] {
    padding: 0;
}

/* Dentro do formulário, o label é block: a chave precisa voltar a ser flex,
   senão o slider vira inline, perde tamanho e monta em cima do texto */
.login-form .form-group label.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    font-size: 14px;
    color: var(--text-dark);
}
.slider {
    display: inline-block;
    flex-shrink: 0;
}


/* =========================================================
   CAMPOS E TABELAS FORA DO LOGIN
   As regras de input/select/textarea estavam escopadas em
   .login-form, entao todo formulario fora dele caia no visual
   nativo do navegador. Aqui vale para qualquer .form-group.
   ========================================================= */

.form-group {
    margin-bottom: 16px;
}

/* Dentro do .login-form o espaco vem do gap: 20px do container.
   Somar a margem aqui afrouxaria todos os modais. */
.login-form .form-group {
    margin-bottom: 0;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="search"],
.form-group input:not([type]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-white);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
}

/* Caixa de selecao e arquivo nao levam largura total */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    padding: 0;
}
.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--bg-main);
    font-size: 13px;
}

/* O rotulo dentro de um toggle nao e um campo empilhado */
.form-group label.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0;
}

/* Cartao branco que embrulha tabela e formulario */
.table-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    overflow-x: auto;
}

.table-container {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    overflow-x: auto;
}

/* Mesma pinta da agents-table, para as telas que usam data-table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
}
.data-table tbody tr:last-child td,
.agents-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table tbody tr:hover,
.agents-table tbody tr:hover {
    background: var(--bg-main);
}

.agents-table td {
    vertical-align: middle;
}

/* Lista e modal dos envios futuros */
.fuso-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}
.agendamento-previa {
    max-width: 330px;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-agendamento {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    background: #e2e8f0;
    color: #475569;
}
.status-agendado { background: #dbeafe; color: #1d4ed8; }
.status-pausado { background: #fef3c7; color: #92400e; }
.status-enviado { background: #dcfce7; color: #166534; }
.status-falhou { background: #fee2e2; color: #991b1b; }
.agendamento-vazio { text-align: center !important; color: var(--text-muted); padding: 32px !important; }
.agenda-data-hora { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-explicacao { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: -12px 0 18px; }
.detalhes-agendamento-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detalhes-agendamento-grid > div { background: var(--bg-main); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.detalhes-agendamento-grid span { display: block; color: var(--text-muted); font-size: 11px; margin-bottom: 3px; }
.detalhes-agendamento-grid strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.mensagem-agendada-integra { padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-main); white-space: pre-wrap; line-height: 1.5; font-size: 14px; }
.campo-label-acoes {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}
.campo-label-acoes label { margin-bottom: 0; }
.botao-respostas-agendamento {
    padding: 5px 10px;
    font-size: 12px;
    flex-shrink: 0;
}
.botao-respostas-agendamento.active {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}
.respostas-no-agendamento { margin: 0 0 10px; }
.respostas-no-agendamento .respostas-seletor-lista { max-height: 190px; }

@media (max-width: 720px) {
    .agenda-data-hora, .detalhes-agendamento-grid { grid-template-columns: 1fr; }
    .agendamentos-table th:nth-child(2), .agendamentos-table td:nth-child(2) { display: none; }
    .campo-label-acoes { align-items: flex-start; flex-direction: column; }
}

.page-header h1 {
    margin: 0 0 4px;
}
.page-header p {
    margin: 0;
}

/* Cabecalho com titulo de um lado e botao do outro. Escopado no
   painel: em Conversas a mesma classe e so uma fileira de botoes
   de icone, que nao pode ganhar space-between nem margem. */
.dashboard-content .header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.dashboard-content .header-actions h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.status-inactive {
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    display: inline-block;
}

/* Password Input Wrapper */
.password-input-wrapper { position: relative; }
.password-input-wrapper input { padding-right: 40px !important; }
.password-input-wrapper .toggle-password {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    cursor: pointer; color: var(--text-muted); font-size: 18px;
    transition: color 0.2s;
}
.password-input-wrapper .toggle-password:hover { color: var(--primary); }


/* =========================================
   RESPOSTAS SALVAS
   O seletor mora dentro da área de input, acima do campo. Fica no fluxo de
   propósito: flutuando, ele saía da tela nas conversas curtas.
   ========================================= */
.respostas-seletor {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-main);
    margin-bottom: 12px;
    overflow: hidden;
}

.respostas-seletor-topo {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: white;
}
.respostas-seletor-topo input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Inter';
    font-size: 14px;
}
.respostas-seletor-topo .icon-btn { width: 30px; height: 30px; font-size: 17px; }

.respostas-seletor-dica {
    padding: 8px 12px 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* Cabe cerca de quatro respostas; o resto rola. Mais alto que isto cobre a
   conversa que o atendente está lendo para escrever a resposta. */
.respostas-seletor-lista {
    max-height: 230px;
    overflow-y: auto;
    padding: 6px;
}

.resposta-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.15s;
}
.resposta-item:hover { background: white; }

.resposta-item-titulo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main, #0f172a);
}
.resposta-item-titulo code {
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
    background: rgba(52, 112, 228, 0.1);
    padding: 1px 6px;
    border-radius: 5px;
}

/* Uma linha só: a lista serve para reconhecer a resposta, não para lê-la. */
.resposta-item-texto {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.respostas-seletor-vazio {
    padding: 16px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.input-toolbar-bottom .icon-btn.active {
    background: rgba(52, 112, 228, 0.12);
    color: var(--primary);
}

.btn-secondary {
    background-color: white;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-secondary:hover { background-color: var(--bg-main); color: var(--primary); }

/* =========================================
   RESPONSIVIDADE MOBILE
   No celular cabe uma coisa por vez: a lista OU a conversa, e o menu
   lateral vira gaveta aberta pelo botão do canto. A conversa aberta cobre a
   lista (classe com-conversa no .app-layout, posta pelo Vue) e o voltar do
   cabeçalho devolve a lista.
========================================= */
.btn-menu-mobile, .sidebar-fundo { display: none; }

@media (max-width: 1000px) {
    /* 100vh no celular inclui a barra do navegador: o campo de digitar
       ficava escondido atrás dela. dvh é a altura que sobra de verdade. */
    #app, .app-layout, .login-view { height: 100vh; height: 100dvh; width: 100%; }
    .app-layout { position: relative; overflow: hidden; }

    /* --- Menu lateral em gaveta --- */
    .btn-menu-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 60;
        width: 52px;
        height: var(--header-height);
        font-size: 24px;
        color: var(--text-main);
        background: transparent;
        border: 0;
        cursor: pointer;
    }
    .app-layout.com-conversa .btn-menu-mobile { display: none; }
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(300px, 84vw);
        transform: translateX(-100%);
        z-index: 1001;
        transition: transform .25s ease;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .sidebar.aberta { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.25); }
    .sidebar-fundo {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: rgba(15, 23, 42, .45);
    }
    .menu a { padding-top: 13px; padding-bottom: 13px; }

    /* Espaço do botão de menu nos cabeçalhos das telas */
    .conversations-header, .ai-header { padding-left: 56px; }
    .main-content > .header-actions { padding-left: 56px !important; }

    /* --- Lista e conversa, uma de cada vez --- */
    .main-content { position: relative; width: 100%; }
    .conversations-panel { width: 100%; min-width: 100%; max-width: 100%; border-right: 0; }
    .chat-area {
        position: absolute;
        inset: 0;
        z-index: 50;
        transform: translateX(100%);
        transition: transform .25s ease;
    }
    .app-layout.com-conversa .chat-area,
    .chat-area:has(.chat-header) { transform: translateX(0); }

    /* --- Lista de conversas --- */
    .tabs button { flex: 0 0 auto; padding: 8px 14px; font-size: 12px; }
    .conv-header { gap: 8px; }
    .conv-header .name { min-width: 0; }
    .conv-header .time { flex-shrink: 0; }
    .conv-preview { gap: 8px; min-width: 0; }
    .preview-text { min-width: 0; flex: 1; display: block; }
    .tags-preview { flex-shrink: 0; max-width: 45%; overflow: hidden; display: flex; gap: 4px; }
    .tags-preview .tag-pill { white-space: nowrap; }

    /* --- Cabeçalho da conversa: contato numa linha, ações na outra --- */
    .chat-header {
        flex-wrap: wrap;
        min-height: 0;
        padding: 6px 8px 4px;
        gap: 2px;
    }
    .contact-brief { flex: 1 1 100%; gap: 8px; }
    .contact-brief h3 { max-width: 100%; font-size: 15px; }
    .chat-header .details { flex: 1; overflow: hidden; }
    .chat-header .details .chat-phone,
    .chat-header .details .chat-visto { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .chat-header .tags { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
    .chat-header .tags::-webkit-scrollbar { display: none; }
    .back-btn { display: flex; flex-shrink: 0; font-size: 22px; }
    /* Oito ações não cabem lado a lado em 390px: correm de lado, todas à mão */
    .chat-actions {
        flex: 1 1 100%;
        overflow-x: auto;
        scrollbar-width: none;
        justify-content: flex-start;
        padding: 4px 0 2px;
        border-top: 1px solid var(--border);
    }
    .chat-actions::-webkit-scrollbar { display: none; }
    .chat-actions > * { flex-shrink: 0; }
    .chat-actions .icon-btn { width: 40px; height: 40px; }
    /* A fileira rola, então o texto dos dois botões principais volta */
    .btn-puxar span, .btn-responder-ia span { display: inline; }

    /* --- Mensagens --- */
    .messages-container { padding: 12px 10px; gap: 10px; }
    .message-bubble { max-width: 85%; padding: 9px 12px; }
    .message-wrapper { margin-bottom: 2px; }
    .avatar-xs { display: none; }

    /* --- Campo de digitar --- */
    .input-area {
        margin: 0;
        border-radius: 14px 14px 0 0;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 16px rgba(0,0,0,.05);
    }
    .input-toolbar-top { flex-wrap: wrap; gap: 6px; }
    /* Abaixo de 16px o iPhone dá zoom na página ao tocar no campo */
    .input-area textarea, input, select, textarea { font-size: 16px; }
    .input-area textarea { min-height: 44px; max-height: 30dvh; }
    .left-actions { gap: 0; overflow-x: auto; scrollbar-width: none; }
    .left-actions::-webkit-scrollbar { display: none; }

    /* --- Gaveta de detalhes em tela cheia --- */
    .details-drawer {
        position: fixed;
        inset: 0;
        right: auto;
        width: 100%;
        max-width: 100%;
        z-index: 999;
        transform: translateX(100%);
        transition: transform .25s ease;
        box-shadow: none;
    }
    .details-drawer.open { right: auto; transform: translateX(0); }

    /* --- Telas de tabela (Contatos, Agendamentos, Agentes) --- */
    .ai-agents-view { overflow-y: auto; flex-direction: column; }
    .ai-header { padding-right: 16px; }
    .ai-content-wrapper { padding: 16px; }
    .ai-title-section h1 { font-size: 22px; }
    .ai-title-section p { margin-bottom: 16px; }
    .table-card table, .table-container table { min-width: 560px; }
    .table-card td, .table-container td { white-space: nowrap; }
    .main-content > div[style*="padding: 24px 30px"] { padding: 16px !important; }
    .tabs { flex-wrap: nowrap; }

    /* Tabela fora de .table-card (as de Configurações) rola dentro dela
       mesma, em vez de alargar a página inteira */
    .agents-table:not(.tabela-contatos) { display: block; overflow-x: auto; max-width: 100%; }
    td[colspan] { white-space: normal !important; }
    .main-content div[style*="justify-content: space-between"] { flex-wrap: wrap; gap: 10px; }
    .list-header { flex-wrap: wrap; gap: 10px; }
    .list-header .search-input-wrapper { flex: 1 1 100%; }
    .list-header .btn-primary { margin-left: auto; }

    /* Ícones de ação na mesma linha (o .icon-btn é flex e empilhava) */
    td > .icon-btn { display: inline-flex; vertical-align: middle; }
    /* Recuos e larguras fixas escritos direto no HTML das telas */
    .ai-agents-view > div[style*="padding: 0 32px"] { padding: 0 16px 16px !important; }
    .ai-agents-view .form-group[style*="min-width"] { min-width: 0 !important; width: 100%; }

    /* --- Janelas --- */
    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal-card { padding: 20px 16px; max-height: 92dvh; border-radius: 16px; }
    .modal-card .actions { flex-wrap: wrap; }
    .modal-card .actions > * { flex: 1 1 auto; }

    /* --- Login --- */
    .login-view { padding: 16px; }
    .login-box { padding: 28px 20px; }
}

/* Contatos no celular: cada linha vira um cartão. Seis colunas não cabem, e
   rolar de lado para achar o telefone de alguém é pior que ler de cima. */
@media (max-width: 700px) {
    .table-card .tabela-contatos { min-width: 0; }
    .tabela-contatos thead { display: none; }
    .tabela-contatos tbody tr {
        display: grid;
        grid-template-columns: auto auto 1fr auto;
        grid-template-areas:
            "nome nome nome acoes"
            "fone fone fone acoes"
            "etq  sit  data data";
        align-items: center;
        gap: 4px 10px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
    }
    .tabela-contatos tbody td { padding: 0 !important; border: 0 !important; white-space: normal; }
    .tabela-contatos td:nth-child(1) { grid-area: nome; min-width: 0; }
    .tabela-contatos td:nth-child(2) { grid-area: fone; padding-left: 42px !important; font-size: 13px; color: var(--text-muted); }
    .tabela-contatos td:nth-child(3) { grid-area: etq; padding-left: 42px !important; }
    .tabela-contatos td:nth-child(4) { grid-area: sit; font-size: 12px; color: var(--text-muted); }
    .tabela-contatos td:nth-child(5) { grid-area: data; font-size: 12px !important; text-align: right; }
    .tabela-contatos td:nth-child(6) { grid-area: acoes; display: flex; gap: 0; }
    .tabela-contatos td[colspan] { grid-column: 1 / -1; grid-row: 1 / -1; }
}

/* =========================================
   INSTALAR COMO APLICATIVO (PWA)
   Convite depois do login: cartão no canto no computador, faixa embaixo
   no celular. O item "Instalar aplicativo" do menu ganha destaque.
========================================= */
.sidebar-footer a.sidebar-instalar { color: white; font-weight: 600; }
.sidebar-footer a.sidebar-instalar:hover { color: white; }

.convite-instalar {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 900;
    width: min(380px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 12px 14px;
    align-items: center;
    padding: 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
.convite-instalar-icone { width: 52px; height: 52px; border-radius: 12px; display: block; }
.convite-instalar-texto { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.convite-instalar-texto strong { font-size: 15px; color: var(--text-main); }
.convite-instalar-texto span { font-size: 13px; color: var(--text-muted); line-height: 1.35; }
.convite-instalar-acoes { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.convite-instalar-acoes button { width: auto; margin: 0; padding: 9px 18px; }

.ajuda-instalar { max-width: 420px; text-align: center; }
.ajuda-instalar .convite-instalar-icone { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 12px; }
.ajuda-instalar h2 { margin-bottom: 16px; }
.ajuda-instalar ol { text-align: left; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.45; }
.ajuda-instalar ol i { vertical-align: -2px; color: var(--primary); }
.ajuda-instalar .actions button { width: 100%; justify-content: center; text-align: center; }

@media (max-width: 1000px) {
    .convite-instalar {
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        width: auto;
    }
    .ajuda-instalar { margin: 0 16px; padding: 24px; }
}

/* =========================================
   ENDEREÇO SEM EMPRESA (/admin, /empresax)
   Mesmo fundo do login, sem formulário: só o aviso e o caminho de volta.
========================================= */
.endereco-carregando { color: rgba(255,255,255,.85); font-size: 40px; }
.endereco-carregando i { display: block; animation: endereco-girar 1s linear infinite; }
@keyframes endereco-girar { to { transform: rotate(360deg); } }

.endereco-erro .brand { margin-bottom: 24px; }
.endereco-erro-icone {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 36px;
}
.endereco-erro p { margin-bottom: 24px; line-height: 1.5; }
.endereco-erro p strong { color: var(--text-main); word-break: break-all; }
.endereco-erro .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    text-decoration: none;
}
.endereco-erro-link {
    display: inline-block;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
}
.endereco-erro-link:hover { color: var(--primary); }

/* =========================================
   DASHBOARD
   Cores por papel, fixas em todo o painel: recebidas = azul, IA = verde-água,
   equipe = laranja, automáticas = cinza. Os três primeiros tons da paleta
   validada (separáveis também para daltônicos); a tabela cobre o resto.
========================================= */
.dash {
    --dash-recebidas: #2a78d6;
    --dash-ia: #1baf7a;
    --dash-equipe: #eb6834;
    --dash-auto: #a8a29e;
    --dash-superficie: #ffffff;
    --dash-grade: #eef1f5;
}
.cor-recebidas { background: var(--dash-recebidas); }
.cor-ia { background: var(--dash-ia); }
.cor-equipe { background: var(--dash-equipe); }
.cor-auto { background: var(--dash-auto); }
.dash-cor { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.girando { display: inline-block; animation: endereco-girar 1s linear infinite; }
.atualizando { opacity: .55; transition: opacity .2s; }

.dash-filtro {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.dash-filtro button {
    border: 1px solid var(--border);
    background: var(--dash-superficie);
    color: var(--text-main);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.dash-filtro button:hover { border-color: var(--primary); color: var(--primary); }
.dash-filtro button.ativo { background: var(--primary); border-color: var(--primary); color: white; }

.dash-personalizado {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.dash-personalizado label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.dash-personalizado input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    font: inherit;
    font-size: 14px;
    color: var(--text-main);
    background: var(--dash-superficie);
}
.dash-personalizado .btn-primary { padding: 9px 18px; }

.dash-erro { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-carregando { color: var(--text-muted); padding: 40px 0; text-align: center; }

.dash-periodo { font-size: 13px; color: var(--text-muted); margin: 4px 0 14px; display: flex; align-items: center; gap: 6px; }

.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.dash-card {
    background: var(--dash-superficie);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.dash-card-rotulo { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.dash-card strong { font-size: 28px; line-height: 1.1; color: var(--text-main); font-variant-numeric: tabular-nums; }
.dash-card-detalhe { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.dash-agora {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    background: var(--dash-superficie);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.dash-agora strong { color: var(--text-main); font-size: 15px; }
.dash-agora-titulo { font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: 6px; }
.dash-ao-vivo { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }

.dash-painel {
    background: var(--dash-superficie);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    min-width: 0;
}
.dash-painel-topo {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.dash-painel h2 { font-size: 15px; color: var(--text-main); }
.dash-sub { font-size: 12px; color: var(--text-muted); }
.dash-legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.dash-legenda span { display: flex; align-items: center; gap: 6px; }

/* Gráfico de colunas em HTML: cada coluna é um período, com recebidas ao
   lado das respostas (IA + equipe empilhadas). Barras a partir da base,
   cantos de cima arredondados, 2px de folga entre as peças. */
.dash-grafico {
    display: grid;
    grid-template-columns: repeat(var(--colunas), minmax(0, 1fr));
    align-items: end;
    gap: 2px;
    height: 220px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
    background-image: linear-gradient(var(--dash-grade) 1px, transparent 1px);
    background-size: 100% 25%;
    position: relative;
}
.dash-pico { height: 170px; }
.dash-coluna {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    outline: none;
    cursor: default;
}
.dash-coluna:hover, .dash-coluna:focus-visible { background: rgba(52, 112, 228, .06); border-radius: 6px 6px 0 0; }
.dash-barras {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    padding: 0 12%;
    min-height: 0;
}
.dash-barras > .dash-barra, .dash-pilha { flex: 1 1 0; max-width: 18px; }
.dash-barra { border-radius: 4px 4px 0 0; min-height: 0; }
.dash-barras > .dash-barra { min-height: 1px; }
.dash-pilha { display: flex; flex-direction: column; gap: 2px; }
.dash-pilha .dash-barra { flex-basis: 0; border-radius: 0; }
.dash-pilha .dash-barra:first-child { border-radius: 4px 4px 0 0; }
.dash-eixo {
    position: absolute;
    left: 50%;
    bottom: -20px;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.dash-eixo.oculto { visibility: hidden; }

.dash-dica {
    display: none;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: #0f172a;
    color: white;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
    flex-direction: column;
    gap: 3px;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(15,23,42,.25);
}
.dash-dica span { display: flex; align-items: center; gap: 6px; color: #cbd5e1; }
.dash-dica b { color: white; margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; }
.dash-coluna:hover .dash-dica, .dash-coluna:focus-visible .dash-dica { display: flex; }
.dash-coluna:first-child .dash-dica, .dash-coluna:nth-child(2) .dash-dica { left: 0; transform: none; }
.dash-coluna:last-child .dash-dica, .dash-coluna:nth-last-child(2) .dash-dica { left: auto; right: 0; transform: none; }

.dash-ver-tabela {
    margin-top: 14px;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}
.dash-tabela-rolagem { max-height: 320px; overflow: auto; margin-top: 10px; }
.dash-tabela td, .dash-tabela th { font-variant-numeric: tabular-nums; }

.dash-duas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.dash-duas .dash-painel { margin-bottom: 0; }

.dash-vazio { color: var(--text-muted); font-size: 13px; padding: 20px 0; }
.dash-ranking { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.dash-ranking li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.dash-ranking-nome { display: flex; align-items: center; gap: 8px; color: var(--text-main); font-weight: 500; min-width: 0; }
.dash-ranking-nome small { color: var(--text-muted); font-weight: 400; }
.dash-ranking-valor { color: var(--text-muted); white-space: nowrap; }
.dash-ranking-valor strong { color: var(--text-main); }
.dash-ranking-trilho { grid-column: 1 / -1; height: 6px; background: var(--dash-grade); border-radius: 3px; overflow: hidden; }
.dash-ranking-trilho span { display: block; height: 100%; border-radius: 3px; }

@media (max-width: 700px) {
    .dash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .dash-card { padding: 12px; }
    .dash-card strong { font-size: 22px; }
    .dash-grafico { height: 180px; }
    .dash-barras { padding: 0 4%; }
    .dash-duas { grid-template-columns: 1fr; }
    .dash-filtro { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .dash-filtro button { flex-shrink: 0; }
}
