/* ================================================================
   WisersApp — CSS Principal
   Versão: 1.0.0 | Preparado para White Label
   ================================================================ */

/* ---- CSS Variables (Light Theme) ---- */
:root {
    --primary-color: #0078d7;
    --primary-hover: #0063b1;
    --primary-light: #e3f2fd;
    --primary-dark: #005a9e;
    --bg-body: #f7f5f3;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-input: #ffffff;
    --bg-chat: #f7f5f3;
    --bg-msg-out: #dcf8c6;
    --bg-msg-in: #ffffff;
    --bg-hover: #f5f6f7;
    --bg-active: #e8f3fc;
    --nav-user-bg: #fafbfc;
    --bg-unread: #f0f7ff;
    --text-primary: #1a1a2e;
    --text-secondary: #667085;
    --text-muted: #adb5bd;
    --text-white: #ffffff;
    --text-link: #0078d7;
    --border-color: #e9ecef;
    --border-input: #ced4da;
    --border-focus: #0078d7;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 50px;
    --sidebar-width: 340px;
    --header-height: 60px;
    --contact-panel-width: 300px;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-md: 15px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --transition: all 0.2s ease;
    --status-online: #25d366;
    --status-away: #ffc107;
    --status-offline: #adb5bd;
    --badge-ia: #6f42c1;
    --badge-humano: #0078d7;
    --badge-cliente: #6c757d;
    --badge-sistema: #fd7e14;
    --badge-api: #0f766e;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --bg-body: #0d1117;
    --bg-sidebar: #161b22;
    --bg-card: #1c2128;
    --bg-header: #161b22;
    --bg-input: #21262d;
    --bg-chat: #0d1117;
    --bg-msg-out: #1a3a2a;
    --bg-msg-in: #1c2128;
    --bg-hover: #21262d;
    --bg-active: #1a2744;
    --nav-user-bg: #232930;
    --bg-unread: #161d2b;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-link: #58a6ff;

    --border-color: #30363d;
    --border-input: #30363d;
    --border-focus: #58a6ff;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    --primary-color: #58a6ff;
    --primary-hover: #79b8ff;
    --primary-light: #1a2744;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    height: 100dvh;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-body);
    line-height: 1.5;
    overflow: hidden;
    overscroll-behavior: none;
    height: 100vh;
    height: 100dvh;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================================================================
   LAYOUT APP (authenticated)
   ================================================================ */
.app-wrapper {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: 420px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-header);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary-color);
}

.sidebar-logo img { width: 32px; height: 32px; border-radius: 8px; }

.sidebar-actions { display: flex; gap: 6px; }

#btn-filtrar-atendimento.is-filter-on { color: var(--primary-color); }

.sidebar-filter-wrap {
    position: relative;
    display: inline-flex;
}

.sidebar-filter-clear {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 53, 69, 0.12);
    color: rgba(220, 53, 69, 0.72);
    cursor: pointer;
    z-index: 2;
}

.sidebar-filter-clear:hover {
    background: rgba(220, 53, 69, 0.2);
}

.sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    outline: none;
    transition: var(--transition);
}

.sidebar-search input:focus {
    border-color: var(--border-focus);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.sidebar-search-wrap {
    position: relative;
}

.sidebar-search-wrap .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.sidebar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    min-width: 0;
    width: 100%;
}

.filter-form {
    margin: 0;
    display: contents;
}

.filter-btn {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.filter-btn .filter-count {
    margin-left: 6px;
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar-carregar-mais-wrap {
    padding: 0;
    margin: 0;
}

.sidebar-carregar-mais {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-link);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    padding: 12px 16px;
    transition: var(--transition);
}

.sidebar-carregar-mais:hover {
    background: var(--bg-active);
    text-decoration: none;
}

.sidebar-carregar-mais:disabled {
    opacity: 0.7;
    cursor: default;
    background: none;
    text-decoration: none;
}

/* ---- Conversa Item ---- */
.conversa-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 12px 14px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.conversa-item:hover { background: var(--bg-hover); }
.conversa-item.active { background: var(--bg-active); }
.conversa-item.unread { background: var(--bg-unread); }

.conversa-departamento-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    z-index: 1;
}

.conversa-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-md);
    flex-shrink: 0;
    position: relative;
}

.conversa-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
    position: absolute;
    bottom: 1px;
    right: 1px;
}

.status-dot.online { background: var(--status-online); }
.status-dot.away { background: var(--status-away); }
.status-dot.offline { background: var(--status-offline); }

.conversa-info { flex: 1; min-width: 0; }

.conversa-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    min-width: 0;
}

.conversa-conexao,
.conversa-atendente {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: var(--font-size-xs);
    line-height: 1.3;
    color: var(--text-muted);
}

.conversa-conexao {
    flex: 1 1 0;
}

.conversa-conexao i,
.conversa-conexao svg,
.conversa-atendente i {
    flex-shrink: 0;
    font-size: 12px;
    color: inherit;
}

.conversa-icone-whatsapp {
    display: block;
    width: 12px;
    height: 12px;
}

.conversa-conexao-texto,
.conversa-atendente-nome {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversa-atendente {
    flex: 0 1 auto;
    max-width: 45%;
    margin-left: auto;
    justify-content: flex-end;
}

.conversa-atendente-nome {
    color: #999;
}

.conversa-atendente.is-meu .conversa-atendente-nome {
    font-weight: 600;
}

.conversa-info-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.conversa-nome {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversa-hora {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.conversa-followup {
    display: inline-flex;
    align-items: center;
    color: var(--text-link);
    font-size: 11px;
}

.conversa-preview {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.conversa-info-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conversa-unread-badge {
    background: var(--status-online);
    color: var(--text-white);
    border-radius: var(--radius-pill);
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1;
}

/* ---- Main Content ---- */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-chat);
    position: relative;
    min-width: 0;
}

/* ---- Chat Header ---- */
.chat-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    padding-left: 8px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
    flex: 1;
}

.chat-header-meta {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.chat-header-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.chat-header-phone-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.chat-header-phone {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.chat-header-info .status-badge {
    flex-shrink: 0;
}

.chat-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* ---- Chat Header Split Button ---- */
.chat-split-btn-wrap {
    position: relative;
}

.chat-split-btn {
    display: inline-flex;
    align-items: stretch;
    border-radius: var(--radius-md);
    overflow: visible;
}

.chat-split-btn-main,
.chat-split-btn-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    background: var(--primary-color);
    color: var(--text-white);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.chat-split-btn-main {
    padding: 8px 14px;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.chat-split-btn-toggle {
    padding: 8px 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.chat-split-btn-main:hover,
.chat-split-btn-toggle:hover {
    background: var(--primary-hover);
}

.chat-split-btn-main svg,
.chat-split-btn-toggle svg {
    flex-shrink: 0;
}

.chat-split-btn--success .chat-split-btn-main,
.chat-split-btn--success .chat-split-btn-toggle {
    background: var(--status-online);
    color: var(--text-white);
}

.chat-split-btn--success .chat-split-btn-main:hover,
.chat-split-btn--success .chat-split-btn-toggle:hover {
    background: #1da851;
}

.chat-split-btn--warning .chat-split-btn-main,
.chat-split-btn--warning .chat-split-btn-toggle {
    background: var(--badge-sistema);
    color: var(--text-white);
}

.chat-split-btn--warning .chat-split-btn-main:hover,
.chat-split-btn--warning .chat-split-btn-toggle:hover {
    background: #e8590c;
}

.chat-split-btn-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 1050;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    animation: navUserMenuIn 0.15s ease;
}

.chat-split-btn-menu:not([hidden]) {
    display: block;
}

.chat-split-btn-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.chat-split-btn-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-split-btn-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

/* ---- Chat Body ---- */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
    position: relative;
}

.chat-body.has-conversa {
    background-color: var(--bg-chat);
    background-image: url('/img/bg-chat.png');
    background-repeat: repeat;
    background-position: top left;
    background-size: 540px auto;
    background-attachment: local;
}

.chat-body.is-preparing {
    opacity: 0;
    pointer-events: none;
}
*[data-theme="dark"] .chat-body.has-conversa {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.80), rgba(0, 0, 0, 0.80)),
        url('/img/bg-chat.png');
}

/* ---- Mensagens ---- */
.msg-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 1;
    width: 100%;
}

.msg-group.out { align-items: flex-end; }
.msg-group.in { align-items: flex-start; }

.msg-group.atribuicao {
    align-items: center;
    margin: 6px 0;
}

.msg-atribuicao {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    max-width: min(90%, 520px);
    padding: 5px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.msg-atribuicao-texto {
    font-size: 12px;
    line-height: 1.35;
    color: #54656f;
}

.msg-atribuicao-hora {
    font-size: 11px;
    color: #8696a0;
    white-space: nowrap;
}

*[data-theme="dark"] .msg-atribuicao {
    background: rgba(32, 44, 51, 0.88);
    border-color: rgba(255, 255, 255, 0.08);
}

*[data-theme="dark"] .msg-atribuicao-texto {
    color: #d1d7db;
}

*[data-theme="dark"] .msg-atribuicao-hora {
    color: #8696a0;
}

.msg-dia {
    display: flex;
    justify-content: center;
    margin: 10px 0 6px;
    position: relative;
    z-index: 1;
}

.msg-dia span {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    font-size: 12px;
    font-weight: 500;
    color: #54656f;
}

*[data-theme="dark"] .msg-dia span {
    background: rgba(32, 44, 51, 0.88);
    border-color: rgba(255, 255, 255, 0.08);
    color: #d1d7db;
}

.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 0;
    max-width: 100%;
}

.msg-group.out .msg-row {
    justify-content: flex-end;
    margin-left: auto;
    max-width: calc(65% + 34px);
}

.msg-acoes {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
}

.msg-menu-btn {
    position: relative;
    display: inline-flex;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-top: 4px;
    margin-right: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--bg-header);
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    z-index: 3;
}

.msg-group .msg-row:has(.msg-bubble:hover) .msg-menu-btn,
.msg-group .msg-menu-btn:hover,
.msg-acoes.is-open .msg-menu-btn {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.msg-menu-btn:hover,
.msg-acoes.is-open .msg-menu-btn {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.msg-menu-btn::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -8px;
    bottom: -4px;
    left: 0;
}

.msg-acoes-menu {
    position: fixed;
    z-index: 1200;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
}

.msg-acoes-menu[hidden] {
    display: none;
}

.msg-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}

.msg-menu-item:hover {
    background: var(--bg-hover);
}

.msg-menu-item--danger {
    color: #c0392b;
}

.msg-menu-item--danger:hover {
    background: rgba(192, 57, 43, 0.08);
}

.msg-menu-item svg {
    flex-shrink: 0;
    color: currentColor;
}

/* ---- Bloco de citação dentro da bolha ---- */
.msg-citacao {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
    padding: 6px 10px;
    border-left: 3px solid var(--primary, #0d6efd);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    overflow: hidden;
    max-width: 100%;
    transition: background 0.15s;
}

.msg-citacao:hover {
    background: rgba(0, 0, 0, 0.1);
}

.msg-bubble.is-privada .msg-citacao {
    background: rgba(255, 255, 255, 0.15);
}

.msg-group.out .msg-citacao {
    border-left-color: var(--primary, #0d6efd);
}

.msg-group.in .msg-citacao {
    border-left-color: #25d366;
}

.msg-citacao-nome {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary, #0d6efd);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-group.in .msg-citacao-nome {
    color: #25d366;
}

.msg-citacao-texto {
    font-size: 12px;
    color: var(--text-secondary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

*[data-theme="dark"] .msg-citacao {
    background: rgba(255, 255, 255, 0.06);
}

*[data-theme="dark"] .msg-citacao:hover {
    background: rgba(255, 255, 255, 0.1);
}

*[data-theme="dark"] .msg-citacao-texto {
    color: var(--text-secondary, #aaa);
}

/* ---- Highlight ao navegar para mensagem original ---- */
.msg-group--highlight .msg-bubble {
    animation: msg-highlight 1.8s ease;
}

@keyframes msg-highlight {
    0%   { box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.70), 0 2px 8px rgba(0,0,0,0.10); }
    60%  { box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.35), 0 2px 8px rgba(0,0,0,0.10); }
    100% { box-shadow: 0 2px 4px rgba(0,0,0,0.08); }
}

/* ---- Banner de preview de resposta acima do input ---- */
.resposta-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-header, #f0f2f5);
    border-top: 1px solid var(--border-color, #e9ecef);
    border-bottom: 1px solid var(--border-color, #e9ecef);
    min-height: 52px;
}

.resposta-preview[hidden] {
    display: none;
}

.resposta-preview-barra {
    width: 3px;
    flex-shrink: 0;
    align-self: stretch;
    border-radius: 2px;
    background: var(--primary, #0d6efd);
}

.resposta-preview-conteudo {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.resposta-preview-nome {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary, #0d6efd);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resposta-preview-texto {
    font-size: 12px;
    color: var(--text-secondary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resposta-preview-fechar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary, #888);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.resposta-preview-fechar:hover {
    background: var(--bg-hover, #e2e8f0);
    color: var(--text-primary, #333);
}

*[data-theme="dark"] .resposta-preview {
    background: var(--bg-header);
    border-color: var(--border-color);
}

*[data-theme="dark"] .resposta-preview-texto {
    color: var(--text-secondary);
}

.msg-bubble {
    max-width: 65%;
    min-width: 80px;
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    position: relative;
    word-wrap: break-word;
    overflow: visible;
}

.msg-row .msg-bubble {
    max-width: 100%;
    min-width: 0;
}

.msg-group.out .msg-bubble {
    background: var(--bg-msg-out);
    border-bottom-right-radius: 4px;
}

.msg-group.in .msg-bubble {
    background: var(--bg-msg-in);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.msg-group.out .msg-bubble.is-privada,
.msg-group.in .msg-bubble.is-privada {
    background: #fffbd1;
}

.msg-sender {
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: 3px;
}

.msg-sender.ia { color: var(--badge-ia); }
.msg-sender.humano { color: var(--badge-humano); }
.msg-sender.cliente { color: var(--badge-cliente); }
.msg-sender.api { color: var(--badge-api); }

.msg-text {
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
}

.msg-time {
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.msg-audio {
    display: block;
    width: 220px;
    max-width: 100%;
    height: 40px;
    margin: 0;
}

.msg-midia {
    position: relative;
    margin: 2px 0 4px;
}

.msg-midia-imagem,
.msg-midia-video {
    display: inline-block;
    max-width: 280px;
    width: 100%;
}

.msg-midia-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 180px;
    height: 180px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-hover);
    color: var(--text-muted);
    box-sizing: border-box;
}

.msg-midia-placeholder-nome {
    font-size: 12px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-midia-placeholder-icone {
    flex-shrink: 0;
}

.msg-midia-imagem:not(.is-ready) .msg-imagem,
.msg-midia-video:not(.is-ready) .msg-video {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.msg-midia-imagem.is-ready .msg-midia-placeholder,
.msg-midia-video.is-ready .msg-midia-placeholder {
    display: none;
}

.msg-imagem {
    display: block;
    max-width: 280px;
    max-height: 320px;
    width: 100%;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
}

.msg-video {
    display: block;
    max-width: 280px;
    width: 100%;
    max-height: 280px;
    border-radius: 8px;
    background: #000;
}

.msg-midia-audio {
    display: flex;
    align-items: center;
    gap: 6px;
}

.msg-midia-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
    cursor: pointer;
}

.msg-midia-download:hover {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
}

.msg-midia-imagem .msg-midia-download,
.msg-midia-video .msg-midia-download {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
}

.msg-midia-audio .msg-midia-download,
.msg-arquivo .msg-midia-download {
    position: static;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.msg-midia-audio .msg-midia-download:hover,
.msg-arquivo .msg-midia-download:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.msg-arquivo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    max-width: 280px;
}

.msg-arquivo:hover { background: var(--border-color); }

.msg-arquivo-icone {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.msg-arquivo-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.msg-arquivo-info:hover {
    color: inherit;
}

#chat-midia-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-midia-overlay[hidden] {
    display: none;
}

.chat-midia-toolbar {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.chat-midia-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}

.chat-midia-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
}

#chat-midia-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.msg-origem-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 2px;
}

.badge-ia { background: #ede7f6; color: var(--badge-ia); }
.badge-humano { background: #e3f2fd; color: var(--badge-humano); }
.badge-cliente { background: #f5f5f5; color: var(--badge-cliente); }
.badge-sistema { background: #fff3e0; color: var(--badge-sistema); }
.badge-api { background: #ccfbf1; color: var(--badge-api); }

/* ---- Chat Footer ---- */
.chat-footer {
    padding: 12px 16px;
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-input-blocked {
    text-align: center;
    padding: 8px 12px;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.chat-input-blocked strong {
    color: #666;
    font-weight: 600;
}

#chat-arquivo-preview {
    padding-bottom: 5px;
    width: 300px;
}

#chat-arquivo-preview .btn-icon {
    width: 22px;
    height: 22px;
}

#chat-arquivo-preview .btn-ghost:hover {
    background: var(--border-color);
}

.chat-arquivo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px 6px;
}

.chat-arquivo-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.chat-arquivo-info {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.chat-arquivo-nome {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.chat-arquivo-tamanho {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 5px 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0;
}

.chat-attach-wrap {
    position: relative;
}

.chat-attach-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 1050;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    animation: navUserMenuIn 0.15s ease;
}

.chat-attach-menu:not([hidden]) {
    display: block;
}

.chat-attach-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.chat-attach-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-attach-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.chat-privada-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chat-privada-icon-lock,
.chat-privada-icon-unlock {
    display: block;
    color: var(--text-secondary);
}

.chat-privada-icon-unlock {
    display: none;
}

.chat-input-wrap.is-privada .chat-privada-icon-lock {
    display: none;
}

.chat-input-wrap.is-privada .chat-privada-icon-unlock {
    display: block;
}

.chat-input-wrap.is-privada {
    background: #fffbd1;
}

.chat-input-wrap.is-multiline {
    align-items: flex-end;
}

.chat-input-wrap:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    resize: none;
    max-height: 124px;
    overflow-y: hidden;
    scrollbar-width: thin;
    font-family: var(--font-family);
    line-height: 22px;
    padding: 7px 0;
    margin: 0;
    min-height: 22px;
}

.chat-input::placeholder { color: var(--text-muted); }

/* ---- Audio Recorder ---- */
.btn-audio-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-audio-recorder {
    display: none;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.chat-input-wrap.is-recording .chat-input-actions,
.chat-input-wrap.is-recording .chat-input {
    display: none;
}

.chat-input-wrap.is-recording .chat-audio-recorder {
    display: flex;
}

.chat-audio-action {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.chat-audio-resume {
    color: #dc3545;
}

.chat-audio-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc3545;
    flex-shrink: 0;
    animation: audioRecBlink 1s ease-in-out infinite;
}

@keyframes audioRecBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.chat-audio-time {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 34px;
}

.chat-audio-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    height: 24px;
    overflow: hidden;
}

.chat-audio-wave span {
    flex: 1;
    min-width: 2px;
    max-width: 3px;
    height: 50%;
    background: var(--text-muted);
    border-radius: 2px;
    transform-origin: center;
}

.chat-audio-wave.is-active span {
    animation: audioWave 0.9s ease-in-out infinite alternate;
}

@keyframes audioWave {
    from { transform: scaleY(0.3); }
    to { transform: scaleY(1); }
}

/* ---- Contact Panel ---- */
.contact-panel {
    width: 0;
    min-width: 0;
    background: var(--bg-sidebar);
    border-left: none;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: var(--transition);
}

.contact-panel.open {
    width: var(--contact-panel-width);
    min-width: var(--contact-panel-width);
    border-left: 1px solid var(--border-color);
    overflow: hidden;
}

.contact-panel-header {
    height: var(--header-height);
    padding: 0 8px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.contact-panel-title {
    flex: 1;
    text-align: left;
    font-size: var(--font-size-md);
}

.chat-header.has-conversa {
    cursor: pointer;
}

.contact-panel-form .form-group {
    margin-bottom: 12px;
}

.contact-panel-form .form-label {
    font-size: var(--font-size-xs);
    margin-bottom: 4px;
}

.contact-panel-form .form-control,
.contact-panel-form .form-select {
    font-size: var(--font-size-sm);
    padding: 8px 10px;
}

.contact-panel-form textarea.form-control {
    resize: none;
    min-height: 72px;
}

.contact-panel-form .form-card-footer {
    margin: 16px -16px -16px;
    padding: 16px;
    background: transparent;
}

.contact-info-item {
    margin-bottom: 16px;
}

.contact-info-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.contact-info-value {
    font-size: var(--font-size-base);
    color: var(--text-primary);
    font-weight: 500;
}

.contact-panel-body-wrap {
    position: relative;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.contact-panel-body { padding: 16px; flex: 1; }

.contact-panel-accordions {
    margin: 0 -16px;
}

.contact-accordion-item {
    border-top: 1px solid var(--border-color);
}

.contact-accordion-item:last-child {
    border-bottom: 1px solid var(--border-color);
}

.contact-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 16px;
    background: var(--bg-hover);
    border: none;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    transition: var(--transition);
}

.contact-accordion-header:hover {
    background: var(--border-color);
}

.contact-accordion-icon {
    flex-shrink: 0;
    color: var(--primary-color);
}

.contact-accordion-body {
    padding: 16px;
    background: var(--bg-sidebar);
}

.contact-accordion-body[hidden] {
    display: none;
}

.contact-label-section + .contact-label-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.contact-label-title {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.contact-label-wrap {
    position: relative;
}

.btn-add-etiqueta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.1);
    border: none;
    border-radius: var(--radius-md);
    color: var(--primary-color);
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-etiqueta:hover {
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.18);
}

.btn-add-etiqueta svg {
    flex-shrink: 0;
}

.contact-etiquetas-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.contact-etiquetas-list:empty {
    margin-top: 0;
}

.chat-etiqueta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px 6px;
}

.chat-etiqueta-cor {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.chat-etiqueta-item .chat-arquivo-info {
    flex: 1;
    min-width: 0;
}

.chat-etiqueta-item .btn-icon {
    width: 22px;
    height: 22px;
}

.chat-etiqueta-item .btn-ghost:hover {
    background: var(--border-color);
}

/* ---- Top Navigation ---- */
.app-topbar {
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

/* ---- Page Layout (non-chat) ---- */
.page-wrapper {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.page-nav {
    width: 220px;
    min-width: 220px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 1;
}

.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0, 0, 0, 0.45);
}

.nav-overlay[hidden] {
    display: none;
}

.nav-toggle,
.nav-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-toggle:hover,
.nav-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-logo {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-close {
    margin-left: auto;
}

.nav-logo-text {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.nav-menu {
    padding: 8px 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.nav-section-title {
    padding: 12px 16px 4px;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-group + .nav-group {
    margin-top: 4px;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.nav-group-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.nav-group:has(.nav-item.active) > .nav-group-toggle {
    color: var(--primary-color);
}

.nav-group-toggle svg {
    flex-shrink: 0;
}

.nav-group-chevron {
    transition: transform 0.2s ease;
}

.nav-group.is-open > .nav-group-toggle .nav-group-chevron {
    transform: rotate(90deg);
}

.nav-group-items {
    display: none;
}

.nav-group.is-open > .nav-group-items {
    display: block;
}

.nav-group-items .nav-item {
    padding-left: 56px;
}

.nav-subgroup {
    margin: 0;
}

.nav-subgroup > .nav-group-toggle {
    padding-left: 56px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.nav-subgroup:has(.nav-item.active) > .nav-group-toggle {
    color: var(--primary-color);
    font-weight: 600;
}

.nav-subgroup > .nav-group-items .nav-item {
    padding-left: 76px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 0;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
    text-decoration: none;
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
}

.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.nav-badge {
    margin-left: auto;
    background: var(--primary-color);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: 1px 7px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.nav-footer {
    position: relative;
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--nav-user-bg);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: inherit;
}

.nav-user:hover,
.nav-user[aria-expanded="true"] {
    background: var(--bg-active);
}

.nav-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-xs);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.nav-user-info { min-width: 0; flex: 1; }
.nav-user-name { font-size: var(--font-size-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-role { font-size: var(--font-size-xs); color: var(--text-muted); text-transform: capitalize; }

.nav-user-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.nav-user[aria-expanded="true"] .nav-user-chevron {
    transform: rotate(90deg);
}

.nav-user-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: transparent;
}

.nav-user-backdrop:not([hidden]) {
    display: block;
}

.nav-user-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 12px;
    right: 12px;
    z-index: 1050;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: navUserMenuIn 0.15s ease;
}

.nav-user-menu:not([hidden]) {
    display: block;
}

@keyframes navUserMenuIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-user-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: default;
    user-select: none;
}

.nav-user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.nav-user-menu-empresa {
    padding: 10px 14px 12px;
}

.nav-user-menu-empresa-nome {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.nav-user-menu-empresa-cnpj {
    margin-top: 2px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    line-height: 1.3;
}

.nav-user-menu-body,
.nav-user-menu-footer {
    padding: 6px;
}

.nav-user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.nav-user-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-user-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.nav-user-menu-item--theme {
    cursor: default;
}

.nav-user-menu-item--theme:hover {
    background: var(--bg-hover);
}

.nav-user-menu-item--theme > span:not(.nav-user-theme-label-icon) {
    flex: 1;
}

.nav-user-theme-label-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-user-theme-label-icon .theme-icon-svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.nav-user-theme-toggle {
    margin-left: auto;
    flex-shrink: 0;
}

.nav-user-menu-item--logout svg {
    color: var(--text-secondary);
}

/* ---- Page Content ---- */
.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    min-width: 0;
}

.page-topbar {
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    gap: 12px;
}

.page-topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.page-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.page-topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.page-topbar-avatar {
    width: 32px;
    height: 32px;
    cursor: default;
    user-select: none;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.page-topbar-user-name {
    font-size: 13px;
    font-weight: 500;
    cursor: default;
    user-select: none;
    color: var(--text-primary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-body);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* ---- Painel (List View) ---- */
.painel-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    min-width: 0;
}

.painel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.painel-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.painel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.painel-actions .filter-btn {
    text-decoration: none;
}

.painel-search {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.painel-search-wrap {
    position: relative;
    display: inline-block;
    width: 300px;
    max-width: 100%;
}

.painel-search-wrap .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.painel-search input {
    width: 100%;
    padding: 6px 8px 6px 36px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    outline: none;
}

.painel-search input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---- Tabela ---- */
.table-responsive { overflow-x: auto; }

.table-wisers {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table-wisers thead th {
    padding: 12px 16px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}

.table-wisers tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.table-wisers tbody tr:hover { background: var(--bg-hover); }
.table-wisers tbody tr.selected { background: var(--bg-active); }

.table-wisers td {
    padding: 12px 16px;
    color: var(--text-primary);
    vertical-align: middle;
}

/* ---- Form Card ---- */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    max-width: 800px;
}

.form-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.form-card-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.form-card-body { padding: 24px; }

.form-card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-hover);
}

/* ---- Form Controls ---- */
.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control:disabled, .form-select:disabled, .form-textarea:disabled {
    background: var(--bg-input);
    opacity: 1;
    color: var(--text-primary);
}

.form-control-with-btn {
    position: relative;
}

.form-control-with-btn .form-control {
    padding-right: 88px;
}

.form-control-with-btn.chave-api .form-control {
    padding-right: 108px;
    background: var(--bg-input);
    cursor: default;
}

.form-control-with-btn .form-select {
    padding-right: 52px;
}

.form-control-with-btn .btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.45;
    word-break: break-all;
}

.form-hint code {
    font-size: 11px;
    color: var(--text-primary);
}

.form-textarea {
    resize: none;
    min-height: 100px;
}

textarea.form-control {
    resize: none;
}

.form-group { margin-bottom: 20px; }

.form-card-body > .form-group:last-child,
.form-card-body > .form-row:last-child .form-group,
.form-row:last-child > .form-group,
.contact-panel-form > .form-group:has(+ .form-card-footer),
.modal-body > .form-group:last-child {
    margin-bottom: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.table-wisers-selectable tbody tr {
    cursor: pointer;
}

.table-wisers tbody tr.is-selected {
    background: var(--bg-active);
}

.menu-opcoes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-opcao-linha {
    display: grid;
    grid-template-columns: 72px minmax(0, 1.2fr) 160px minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
}

.form-card .nav-group {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.form-card .nav-group-toggle {
    padding: 12px 16px;
}

.form-card .nav-group-items {
    padding: 0 16px 12px;
}

.conexao-usuarios {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
}

.conexao-usuarios-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.conexao-usuarios-item input {
    accent-color: var(--primary-color);
}

@media (max-width: 767.98px) {
    .menu-opcao-linha {
        grid-template-columns: 1fr 1fr;
    }
    .menu-opcao-linha .menu-opcao-remover {
        grid-column: 2;
        justify-self: end;
    }
}

.relatorio-filtros {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
}

.relatorio-filtros-avaliacoes {
    grid-template-columns: minmax(140px, 1.1fr) minmax(140px, 1.1fr) minmax(140px, 1.1fr) minmax(120px, 0.85fr) minmax(120px, 0.85fr) auto;
    gap: 12px;
}

.relatorio-filtros-atendimentos {
    grid-template-columns: minmax(140px, 1.1fr) minmax(140px, 1.1fr) minmax(140px, 1.1fr) minmax(130px, 0.9fr) minmax(120px, 0.85fr) minmax(120px, 0.85fr) auto;
}

.relatorio-filtros-avaliacoes .form-group {
    margin-bottom: 0;
}

.relatorio-filtros-openai {
    grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) auto;
    justify-content: start;
    gap: 12px;
}

.relatorio-filtros-openai .form-group {
    margin-bottom: 0;
}

@media (max-width: 1199.98px) {
    .relatorio-filtros-avaliacoes {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .relatorio-filtros-avaliacoes .relatorio-filtros-acao {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

.relatorio-filtros-acao {
    display: flex;
    align-items: center;
}

.relatorio-filtros-acao .btn {
    white-space: nowrap;
}

#table-avaliacoes td {
    white-space: nowrap;
}

#table-avaliacoes .col-comentario {
    white-space: normal;
    max-width: 280px;
    min-width: 160px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.relatorio-paginacao {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

.relatorio-paginacao-info {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.relatorio-paginacao-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: var(--font-family);
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

a.btn:hover { text-decoration: none; }

.btn-success { background: #198754; color: #fff; border-color: #198754; }
.btn-success:hover:not(:disabled) { background: #157347; }

.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-danger:hover:not(:disabled) { background: #bb2d3b; }

.btn-warning { background: #ffc107; color: #000; border-color: #ffc107; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn-icon-round {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-sm { padding: 5px 12px; font-size: var(--font-size-xs); }
.btn-lg { padding: 12px 24px; font-size: var(--font-size-md); }

.painel-actions .btn {
    width: 85px;
    padding: 8px 12px;
    justify-content: center;
    gap: 4px;
}

.painel-actions .btn i {
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.form-card-footer .btn {
    width: 90px;
    justify-content: center;
    gap: 4px;
}

.form-card-footer .btn-wide {
    width: auto;
    min-width: 90px;
    padding-left: 12px;
    padding-right: 12px;
}

.form-card-footer .btn i {
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary-color); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-secondary { background: var(--bg-hover); color: var(--text-secondary); }

/* ---- Status Badge ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.pendente { background: #fef3c7; color: #92400e; }
.status-badge.pendente::before { background: #d97706; }
.status-badge.ia { background: #ede9fe; color: #5b21b6; }
.status-badge.ia::before { background: #7c3aed; }
.status-badge.atendendo { background: var(--primary-light); color: var(--primary-color); }
.status-badge.atendendo::before { background: var(--primary-color); }
.status-badge.finalizado { background: #d1fae5; color: #065f46; }
.status-badge.finalizado::before { background: #059669; }

/* ---- Cards Dashboard ---- */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    width: 100%;
    height: 100%;
    min-height: 92px;
    box-sizing: border-box;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

a.stat-card,
a.stat-card:hover,
a.stat-card:focus {
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}

a.stat-card:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary-color); }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #ede7f6; color: #7c3aed; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: var(--font-size-sm); color: var(--text-secondary); margin-top: 4px; }

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.stats-grid-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 16px;
}

.content-grid-2,
.theme-option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.chart-mes {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-mes-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 12px;
}

.chart-mes-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.chart-mes-track {
    height: 14px;
    background: var(--bg-hover);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.chart-mes-bar {
    height: 100%;
    border-radius: var(--radius-pill);
    min-width: 0;
}

.chart-mes-bar--pendente { background: #fbbf24; }
.chart-mes-bar--atendendo { background: #7dd3fc; }
.chart-mes-bar--finalizado { background: #6ee7b7; }
.chart-mes-bar--whatsapp { background: #4ade80; }
.chart-mes-bar--wisersapp { background: #7dd3fc; }
.chart-mes-bar--nota1 { background: #f87171; }
.chart-mes-bar--nota2 { background: #fb923c; }
.chart-mes-bar--nota3 { background: #fbbf24; }
.chart-mes-bar--nota4 { background: #86efac; }
.chart-mes-bar--nota5 { background: #34d399; }

.chart-avaliacao {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 32px;
    align-items: center;
}

.chart-avaliacao-score {
    text-align: center;
    padding: 8px 12px;
}

.chart-avaliacao-emoji {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 8px;
}

.chart-avaliacao-media {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.chart-avaliacao-meta {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 8px;
}

.chart-mes-row--nota {
    grid-template-columns: 118px minmax(0, 1fr) 36px;
}

.chart-mes-value {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

/* ---- Alert ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    margin-bottom: 16px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.alert-success { background: #d1fae5; border-color: #a7f3d0; color: #065f46; }
.alert-warning { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--primary-light); border-color: #bfdbfe; color: var(--primary-color); }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.show .modal-box { transform: scale(1); }

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title { font-size: var(--font-size-lg); font-weight: 700; color: var(--text-primary); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

#modal-transferir .modal-body,
#modal-arquivar .modal-body,
#modal-nova-conversa .modal-body {
    padding-top: 10px;
}

#modal-nova-conversa .modal-box {
    max-width: 600px;
}

#modal-filtrar-atendimento .modal-box {
    max-width: 480px;
    overflow: visible;
}

#modal-filtrar-atendimento .modal-body {
    padding-top: 10px;
    overflow: visible;
}

#modal-filtrar-atendimento .nc-conexao-wrap:has(.nc-conexao-list:not([hidden])) {
    z-index: 40;
}

#modal-filtrar-atendimento .nc-conexao-list {
    z-index: 40;
}

#modal-filtrar-atendimento .modal-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 14px;
}

#modal-filtrar-atendimento .form-group {
    margin-bottom: 0;
}

.fa-tipo {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.fa-tipo-btn {
    flex: 1 1 auto;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.fa-tipo-btn:hover,
.fa-tipo-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.fa-opcao-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fa-lista-vazia {
    padding: 12px 14px;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

#modal-transferir .modal-subtitle,
#modal-arquivar .modal-subtitle,
#modal-nova-conversa .modal-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

#modal-transferir .form-group,
#modal-arquivar .form-group,
#modal-nova-conversa .form-group {
    margin-bottom: 0;
}

#modal-transferir #wrap-transferir-usuario,
#modal-transferir #wrap-transferir-departamento {
    margin-top: 10px;
}

#modal-filtro-logs .logs-filtro-periodo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

#modal-filtro-logs .logs-filtro-periodo .form-group {
    margin-bottom: 0;
    min-width: 0;
}

#modal-filtro-logs .modal-body > .logs-filtro-periodo:last-child {
    margin-bottom: 0;
}

#modal-nova-conversa .form-row {
    margin-top: 16px;
    margin-bottom: 16px;
}

#modal-nova-conversa .form-row + .form-group {
    margin-top: 0;
}

#modal-nova-conversa #nc-template-wrap:not([hidden]),
#modal-nova-conversa #nc-mensagem-wrap:not([hidden]) {
    margin-top: 16px;
}

#modal-nova-conversa #nc-template-wrap:not([hidden]) {
    margin-bottom: 16px;
}

#modal-nova-conversa .nc-template-texto {
    margin-top: 8px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    max-height: calc(1.4em * 5 + 22px);
    cursor: default;
}

#modal-nova-conversa .nc-template-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    cursor: pointer;
    position: relative;
    padding-right: 36px;
}

#modal-nova-conversa .nc-template-trigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

#modal-nova-conversa .nc-template-trigger-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#modal-nova-conversa .nc-template-trigger.is-placeholder .nc-template-trigger-text {
    color: var(--text-muted);
}

#modal-nova-conversa .nc-template-combo {
    position: relative;
}

#modal-nova-conversa .nc-template-combo:has(.nc-template-list:not([hidden])) {
    z-index: 20;
}

#modal-nova-conversa .nc-template-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

#modal-nova-conversa .nc-template-list.is-above {
    top: auto;
    bottom: calc(100% + 4px);
}

#modal-nova-conversa .nc-template-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
}

#modal-nova-conversa .nc-template-item:last-child {
    border-bottom: none;
}

#modal-nova-conversa .nc-template-item:hover,
#modal-nova-conversa .nc-template-item:focus-visible,
#modal-nova-conversa .nc-template-item.is-selected {
    background: var(--bg-hover);
    outline: none;
}

.nc-contato-wrap {
    position: relative;
}

.nc-contato-wrap:has(.nc-contato-list:not([hidden])) {
    z-index: 30;
}

.nc-contato-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
}

.nc-contato-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.nc-contato-item:last-child {
    border-bottom: none;
}

.nc-contato-item:hover {
    background: var(--bg-hover);
}

.nc-contato-item-nome {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.nc-contato-item-tel {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.nc-contato-erro {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--danger-color, #dc3545);
}

.nc-departamento-wrap {
    position: relative;
}

.nc-departamento-trigger {
    display: flex;
    align-items: center;
    text-align: left;
    cursor: pointer;
}

.nc-departamento-trigger-text {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nc-departamento-trigger.is-placeholder .nc-departamento-trigger-text {
    color: var(--text-muted);
}

.nc-departamento-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.nc-departamento-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
}

.nc-departamento-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    text-align: left;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.nc-departamento-item:last-child {
    border-bottom: none;
}

.nc-departamento-item:hover,
.nc-departamento-item:focus-visible {
    background: var(--bg-hover);
    outline: none;
}

.nc-departamento-nome {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nc-conexao-wrap {
    position: relative;
}

.nc-conexao-wrap:has(.nc-conexao-list:not([hidden])) {
    z-index: 30;
}

.nc-conexao-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    cursor: pointer;
    position: relative;
    padding-right: 36px;
}

.nc-conexao-trigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.nc-conexao-trigger-text {
    display: block;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nc-conexao-trigger.is-placeholder .nc-conexao-trigger-text {
    color: var(--text-muted);
}

.nc-conexao-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
}

.nc-conexao-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-family);
}

.nc-conexao-item:last-child {
    border-bottom: none;
}

.nc-conexao-item:hover,
.nc-conexao-item:focus-visible,
.nc-conexao-item.is-selected {
    background: var(--bg-hover);
    outline: none;
}

.nc-conexao-item-nome {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.nc-conexao-item-tel {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}


/* ---- Loading ---- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* ---- Toast / Notifications ---- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    color: #fff;
    border: none;
}

#toast-container .toast {
    display: flex;
}

.toast-icon,
.toast-text {
    color: #fff;
}

.toast-text {
    flex: 1;
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-left: auto;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 14px;
    opacity: 0.9;
    transition: var(--transition);
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.warning { background: #d97706; }
.toast.info { background: var(--primary-color); }

@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Theme Switcher ---- */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.theme-toggle {
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: var(--radius-pill);
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    outline: none;
}

.theme-toggle.dark { background: var(--primary-color); }

.theme-toggle::after {
    content: '';
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.theme-toggle.dark::after { transform: translateX(20px); }

.theme-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.theme-icon .theme-icon-svg {
    width: 14px;
    height: 14px;
}

.theme-icon-svg--sun {
    color: orange;
}

.theme-icon-svg--moon {
    color: #fff;
}

.theme-icon-toggle .theme-icon-svg--moon { display: none; }

.theme-icon-toggle.is-dark .theme-icon-svg--sun { display: none; }

.theme-icon-toggle.is-dark .theme-icon-svg--moon { display: block; }

.theme-icon-lg .theme-icon-svg {
    width: 24px;
    height: 24px;
}

/* ---- Digitando indicator ---- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--bg-msg-in);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: var(--shadow-sm);
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: var(--font-size-lg); font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: var(--font-size-sm); }

/* ---- Chat Empty State ---- */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.chat-empty-icon {
    width: 80px;
    height: 70px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.chat-empty-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Emoji Picker ---- */
.chat-emoji-wrap {
    position: relative;
}

.chat-emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 1050;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: navUserMenuIn 0.15s ease;
}

.chat-emoji-picker:not([hidden]) {
    display: flex;
}

.emoji-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.emoji-search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.emoji-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    min-width: 0;
}

.emoji-search-input::placeholder {
    color: var(--text-muted);
}

.emoji-search-clear {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    padding: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.emoji-search-clear:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.emoji-categories {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.emoji-categories::-webkit-scrollbar {
    display: none;
}

.emoji-category-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    font-size: 18px;
    line-height: 1;
    transition: var(--transition);
    opacity: 0.55;
}

.emoji-category-btn:hover {
    background: var(--bg-hover);
    opacity: 1;
}

.emoji-category-btn.active {
    background: var(--primary-light);
    opacity: 1;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
    padding: 6px 8px;
    max-height: 224px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.emoji-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 4px 2px;
    font-size: 20px;
    line-height: 1;
    text-align: center;
    transition: background var(--transition), transform 0.1s ease;
}

.emoji-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* ================================================================
   RESPONSIVE
   Phoenix (navbar-expand-lg): menu administrativo em overlay <992px
   WhatsApp Web: lista + chat lado a lado no tablet; no celular, um painel por vez
   ================================================================ */

@media (min-width: 1400px) {
    :root {
        --sidebar-width: 400px;
        --contact-panel-width: 340px;
    }
}

@media (max-width: 991.98px) {
    /* ---- Shell administrativo (Phoenix overlay) ---- */
    .nav-toggle,
    .nav-close {
        display: inline-flex;
    }

    .page-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 220px;
        min-width: 220px;
        height: 100vh;
        height: 100dvh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
        padding-bottom: env(safe-area-inset-bottom);
    }

    body.nav-open .page-nav {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .page-wrapper,
    .page-content {
        width: 100%;
    }

    .page-topbar {
        padding: 0 16px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .page-body {
        padding: 16px;
    }

    .content-grid,
    .content-grid-2 {
        grid-template-columns: 1fr;
    }

    .chart-avaliacao {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* ---- Atendimento (WhatsApp Web): 2 colunas; contato em overlay ---- */
    .app-sidebar {
        width: var(--sidebar-width);
        min-width: 280px;
        max-width: 420px;
        flex: 0 1 var(--sidebar-width);
    }

    .app-main {
        display: flex;
        position: relative;
        width: auto;
        height: 100%;
        z-index: auto;
    }

    .contact-panel {
        position: fixed;
        top: 0;
        right: 0;
        display: flex;
        width: min(100%, 360px);
        min-width: 0;
        height: 100vh;
        height: 100dvh;
        z-index: 1080;
        transform: translateX(100%);
        border-left: 1px solid var(--border-color);
        box-shadow: none;
        transition: transform 0.25s ease;
    }

    .contact-panel.open {
        width: min(100%, 360px);
        min-width: 0;
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 767.98px) {
    .page-title {
        font-size: var(--font-size-lg);
    }

    .page-topbar-user-name {
        display: none;
    }

    .page-body {
        padding: 12px;
    }

    .stats-grid {
        gap: 12px;
        margin-bottom: 16px;
    }

    .stats-grid-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
        gap: 12px;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    .stat-value {
        font-size: 22px;
    }

    .theme-option-grid {
        grid-template-columns: 1fr;
    }

    .chart-mes-row {
        grid-template-columns: 80px minmax(0, 1fr) 36px;
        gap: 8px;
    }

    .chart-mes-row--nota {
        grid-template-columns: 110px minmax(0, 1fr) 32px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .relatorio-filtros-acao .btn {
        width: 100%;
        justify-content: center;
    }

    .form-card {
        max-width: 100%;
    }

    .form-card-body {
        padding: 16px;
    }

    .form-card-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .form-card-footer .btn {
        flex: 1;
        min-width: 120px;
    }

    .painel-header,
    .painel-actions,
    .painel-search {
        padding-left: 12px;
        padding-right: 12px;
    }

    .painel-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .painel-search-wrap {
        width: 100%;
    }

    .table-wisers thead th,
    .table-wisers td {
        padding: 10px 12px;
    }

    .modal-box {
        width: calc(100% - 24px);
        max-height: calc(100dvh - 24px);
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        align-items: stretch;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }

    /* ---- Atendimento mobile (WhatsApp Web): lista OU conversa ---- */
    .app-wrapper {
        position: relative;
        height: 100vh;
        height: 100dvh;
    }

    .app-sidebar {
        width: 100%;
        min-width: 100%;
        max-width: none;
        flex: none;
        height: 100%;
        position: relative;
        z-index: 2;
        border-right: none;
    }

    .app-main {
        display: none;
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        z-index: 3;
    }

    .app-wrapper:has(#btn-fechar-conversa-voltar:not([hidden])) .app-sidebar {
        display: none;
    }

    .app-wrapper:has(#btn-fechar-conversa-voltar:not([hidden])) .app-main {
        display: flex;
    }

    .contact-panel,
    .contact-panel.open {
        width: 100%;
        min-width: 100%;
    }

    .msg-bubble {
        max-width: 85%;
    }

    .msg-group.out .msg-row {
        max-width: calc(90% + 34px);
    }

    .chat-header {
        padding-right: 8px;
    }

    .chat-header-info {
        gap: 8px;
    }

    .chat-header-info .conversa-avatar {
        width: 40px;
        height: 40px;
        font-size: 13px;
    }

    .chat-header-phone-row {
        gap: 6px;
    }

    .chat-header-info .status-badge {
        padding: 2px 8px;
        gap: 4px;
        font-size: 10px;
        line-height: 1.2;
    }

    .chat-split-btn-main span {
        display: none;
    }

    .chat-split-btn-main {
        padding: 8px 10px;
    }

    .chat-emoji-picker {
        width: min(320px, calc(100vw - 24px));
    }

    .chat-footer {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .chat-input-wrap {
        gap: 6px;
        padding: 4px 8px;
    }

    #chat-arquivo-preview {
        width: auto;
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .stats-grid-row {
        grid-template-columns: 1fr;
    }

    .painel-actions .btn {
        width: auto;
        min-width: 0;
        flex: 1;
    }

    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

.avaliacao-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-body);
}

.avaliacao-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px 24px;
    text-align: center;
}

.avaliacao-brand {
    font-weight: 800;
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.avaliacao-titulo {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.avaliacao-texto {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.avaliacao-erro {
    color: var(--badge-danger, #c92a2a);
    font-size: 13px;
    margin-bottom: 12px;
}

.avaliacao-emojis {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.avaliacao-emoji-btn {
    width: 52px;
    height: 52px;
    border: none;
    background: transparent;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    opacity: 1;
    transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
    border-radius: var(--radius-md);
}

.avaliacao-emojis.has-selection .avaliacao-emoji-btn {
    filter: grayscale(1);
    opacity: 0.45;
}

.avaliacao-emoji-btn:hover {
    transform: scale(1.08);
}

.avaliacao-emojis.has-selection .avaliacao-emoji-btn.is-selected,
.avaliacao-emoji-btn.is-selected {
    filter: none;
    opacity: 1;
    transform: scale(1.15);
}

.avaliacao-feedback {
    text-align: left;
    margin-bottom: 16px;
}

.avaliacao-enviar {
    width: 100%;
    justify-content: center;
}

.avaliacao-enviar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.avaliacao-emoji-grande {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 12px;
}

.avaliacao-page-form {
    align-items: flex-start;
    padding-top: 32px;
    padding-bottom: 40px;
}

.avaliacao-card-form {
    text-align: left;
    max-width: 440px;
}

.avaliacao-card-form .avaliacao-brand,
.avaliacao-card-form .avaliacao-titulo,
.avaliacao-card-form .avaliacao-texto {
    text-align: center;
}

.avaliacao-card-form .form-group {
    margin-bottom: 14px;
}

.avaliacao-card-form .avaliacao-enviar {
    margin-top: 8px;
}
