/* ==========================================================================
   Lead Management System - Apple Premium Design System
   Using Inter font (loaded via Google Fonts in layout templates)
   ========================================================================== */

/* ==========================================================================
   1. CSS Custom Properties / Theming
   ========================================================================== */

:root {
    /* Paleta da marca (cada empresa envia as suas em --brand-*; sem isso
       valem os padrões abaixo). Tudo no sistema usa --primary/--accent, que
       derivam daqui — é o que permite ao tema escuro clarear o tom da marca
       sem trocar a cor por outra. */
    --primary: var(--brand-primary, #0071E3);
    --primary-hover: var(--brand-primary-hover, #0077ED);
    --primary-light: var(--brand-primary-light, rgba(0, 113, 227, 0.10));
    --primary-ring: var(--brand-primary-ring, rgba(0, 113, 227, 0.30));

    --secondary: var(--brand-secondary, #86868B);
    --secondary-hover: var(--brand-secondary-hover, #6E6E73);

    --accent: var(--brand-accent, #FF375F);
    --accent-light: var(--brand-accent-light, rgba(255, 55, 95, 0.10));

    /* Neutrals */
    --white: #FFFFFF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F5F7;
    --bg-tertiary: #FBFBFD;
    /* Fundo sutil de blocos internos (usado por vários construtores). */
    --bg-subtle: #FAFAFA;

    /* Texto de etiquetas/chips sobre fundo tingido — precisa inverter de
       claridade entre os temas (escuro sobre pastel, claro sobre véu escuro). */
    --chip-green: #248A3D;
    --chip-red: #C81E1E;
    --chip-orange: #B45309;
    --chip-purple: #4F46E5;
    --border: #E5E5EA;
    --border-light: #F0F0F2;
    --text-primary: #1D1D1F;
    --text-secondary: #6E6E73;
    --text-tertiary: #86868B;
    --text-placeholder: #AEAEB2;

    /* Semantic colors */
    --success: #30D158;
    --success-bg: rgba(48, 209, 88, 0.10);
    --warning: #FF9F0A;
    --warning-bg: rgba(255, 159, 10, 0.10);
    --danger: #FF3B30;
    --danger-bg: rgba(255, 59, 48, 0.10);
    --info: #0071E3;
    --info-bg: rgba(0, 113, 227, 0.10);

    /* Shadows */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --content-max-width: 1200px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Z-index scale */
    --z-sidebar: 100;
    --z-header: 200;
    --z-modal-backdrop: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    /* Trava o "efeito elástico" (rubber-band) do iOS: sem isto, puxar a tela
       além do topo descola a página inteira e leva junto o cabeçalho fixo e o
       botão flutuante, que voltam fora do lugar. */
    overscroll-behavior-y: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
    /* dvh acompanha a barra do navegador que some/aparece no celular;
       navegador sem suporte fica com o 100vh acima. */
    min-height: 100dvh;
    overscroll-behavior-y: none;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.0625rem;
}

h5 {
    font-size: 0.9375rem;
}

h6 {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.text-sm {
    font-size: 0.8125rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-lg {
    font-size: 1.0625rem;
}

.text-muted {
    color: var(--text-secondary);
}

.text-caption {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
}

/* ==========================================================================
   4. Layout - Sidebar + Main
   ========================================================================== */

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

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-slow);
    overflow-y: auto;
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
}

.sidebar-header img {
    max-height: 72px;
    max-width: 200px;
    width: auto;
    object-fit: contain;
}

.sidebar-header .brand-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
}

.sidebar-nav .nav-section {
    margin-bottom: var(--space-lg);
}

.sidebar-nav .nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    cursor: pointer;
}

.sidebar-nav .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.sidebar-nav .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

.sidebar-nav .nav-link .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-nav .nav-link.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
}

/* Main content area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Item flex: sem isto, conteúdo largo (tabelas) força o min-width:auto e
       estoura a largura da tela no mobile em vez de rolar dentro do bloco. */
    min-width: 0;
}

/* Top header bar */
.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    z-index: var(--z-header);
}

.page-content {
    flex: 1;
    padding: var(--space-xl);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-header h1 {
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--text-primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: calc(var(--z-sidebar) - 1);
    backdrop-filter: blur(4px);
}

/* ==========================================================================
   5. Cards
   ========================================================================== */

.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-glass {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    background: var(--bg-tertiary);
}

/* ==========================================================================
   6. Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}

.btn:focus-visible {
    outline: 3px solid var(--primary-ring);
    outline-offset: 2px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    color: var(--white);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #E0342B;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    color: var(--white);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-icon {
    padding: 10px;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    padding: 6px;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-group {
    display: inline-flex;
    gap: var(--space-sm);
}

/* ==========================================================================
   7. Form Inputs
   ========================================================================== */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    appearance: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--secondary);
}

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

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-placeholder);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: var(--space-xs);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868B' d='M6 8.825a.7.7 0 0 1-.5-.2L1.675 4.8a.7.7 0 0 1 1-1L6 7.125 9.325 3.8a.7.7 0 0 1 1 1L6.5 8.625a.7.7 0 0 1-.5.2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

/* Search input with icon */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input-wrapper .form-input {
    padding-left: 40px;
}

/* Color picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.color-picker-input {
    width: 48px;
    height: 48px;
    padding: 4px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: none;
    transition: border-color var(--transition-base);
}

.color-picker-input:hover {
    border-color: var(--secondary);
}

.color-picker-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.color-preview {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ==========================================================================
   8. Tables
   ========================================================================== */

.table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    overflow-x: auto;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    gap: var(--space-md);
    flex-wrap: wrap;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

tbody td {
    padding: var(--space-md) var(--space-lg);
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-secondary);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr[data-href] {
    cursor: pointer;
}

.table-empty {
    padding: var(--space-3xl) var(--space-lg);
    text-align: center;
    color: var(--text-tertiary);
}

/* ==========================================================================
   9. Badges / Status Pills
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
    line-height: 1.4;
}

.badge-new,
.badge-blue {
    background: var(--info-bg);
    color: var(--info);
}

.badge-contacted,
.badge-orange {
    background: var(--warning-bg);
    color: #CC7F08;
}

.badge-qualified,
.badge-purple {
    background: rgba(175, 82, 222, 0.10);
    color: #AF52DE;
}

.badge-converted,
.badge-green {
    background: var(--success-bg);
    color: #248A3D;
}

.badge-lost,
.badge-red {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-gray {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* ==========================================================================
   10. Dashboard Stat Cards
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    padding: var(--space-lg);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    font-weight: 500;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: var(--space-sm);
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   10b. Impersonation Banner
   ========================================================================== */

/* Discreta de proposito: barra escura fina com um filete laranja, so para
   lembrar que a sessao e espiada. A altura fica em 40px porque o layout
   compensa esse valor na sidebar e no topo. */
.impersonate-banner {
    background: rgba(28, 28, 30, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid #FF9500;
    padding: 0 14px;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

.impersonate-banner + .app-layout {
    margin-top: 40px;
}

.impersonate-banner + .app-layout .sidebar {
    top: 40px;
    height: calc(100vh - 40px);
}

.impersonate-banner + .app-layout .top-header {
    top: 40px;
}

/* No celular nao cabe a explicacao: fica o nome de quem esta sendo espiado
   e os dois botoes. */
/* O seletor de colaborador fica na propria barra: o admin troca de pessoa
   sem sair da visita. */
.impersonate-banner select {
    -webkit-appearance: none;
    appearance: none;
    max-width: 200px;
    text-overflow: ellipsis;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23fff' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 4px 22px 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* A lista aberta e' desenhada pelo sistema operacional: ali o fundo e' claro. */
.impersonate-banner select option {
    color: #1c1c1e;
    background: #fff;
}

@media (max-width: 640px) {
    .impersonate-banner .imp-hint,
    .impersonate-banner svg {
        display: none;
    }
    /* No celular o proprio seletor ja diz quem esta sendo visto. */
    .impersonate-banner .imp-quem {
        display: none;
    }
    .impersonate-banner select {
        max-width: 150px;
    }
}

/* ==========================================================================
   11. Login Page
   ========================================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #E8E8ED 50%, var(--bg-secondary) 100%);
    padding: var(--space-lg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2xl);
    animation: slideUp 0.4s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo img {
    /* Altura livre: o tamanho vem do max-height/max-width no próprio elemento.
       Com `height: 40px` fixo, a logomarca ficava miúda e o max-height era
       ignorado (altura definida vence teto de altura). */
    height: auto;
    max-width: 100%;
    margin: 0 auto;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-xl);
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: var(--space-sm);
}

.login-footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

/* ==========================================================================
   12. Modals
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-lg) 0;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    font-size: 1.125rem;
    line-height: 1;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: 0 var(--space-lg) var(--space-lg);
}

/* ==========================================================================
   13. Toast / Flash Notifications
   ========================================================================== */

.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 300px;
    max-width: 420px;
    pointer-events: auto;
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--info);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast-message {
    flex: 1;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    transition: color var(--transition-base);
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast.dismissing {
    animation: slideOut 0.3s ease forwards;
}

/* Flash messages (inline, page-level) */
.flash-message {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 0.875rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.flash-success {
    background: var(--success-bg);
    color: #248A3D;
    border: 1px solid rgba(48, 209, 88, 0.2);
}

.flash-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.flash-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(0, 113, 227, 0.2);
}

.flash-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 1.125rem;
    transition: opacity var(--transition-base);
}

.flash-dismiss:hover {
    opacity: 1;
}

/* ==========================================================================
   14. Pagination
   ========================================================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-lg) 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-base);
}

.pagination a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.pagination .active {
    background: var(--primary);
    color: var(--white);
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pagination .dots {
    color: var(--text-tertiary);
    pointer-events: none;
}

/* ==========================================================================
   15. File Upload Dropzone
   ========================================================================== */

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-tertiary);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-md);
    color: var(--text-tertiary);
}

.dropzone-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dropzone-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.dropzone-preview {
    margin-top: var(--space-md);
}

.dropzone-preview img {
    max-height: 120px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   16. Avatar / Initials Circle
   ========================================================================== */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--primary-light);
    color: var(--primary);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 0.8125rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1rem;
}

/* ==========================================================================
   17. Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    color: var(--text-tertiary);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    max-width: 360px;
    margin: 0 auto var(--space-lg);
}

/* ==========================================================================
   18. Dropdown
   ========================================================================== */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    padding: var(--space-xs);
    z-index: 50;
    display: none;
    animation: fadeIn 0.15s ease;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    cursor: pointer;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    font-family: inherit;
}

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

.dropdown-item.danger {
    color: var(--danger);
}

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

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-xs) 0;
}

/* ==========================================================================
   19. Utility Classes
   ========================================================================== */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-xs {
    gap: var(--space-xs);
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.w-full {
    width: 100%;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==========================================================================
   20. Scrollbar Styling
   ========================================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ==========================================================================
   21. Animations
   ========================================================================== */

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(24px);
    }
}

/* ==========================================================================
   22. Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .page-content {
        padding: var(--space-lg);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        /* No mobile o menu abre POR CIMA do cabeçalho fixo (senão o header,
           z-header:200, cobre o topo do menu e corta a logo). */
        z-index: calc(var(--z-header) + 50);
        top: 0;
        height: 100vh;
        height: 100dvh;
    }

    .impersonate-banner + .app-layout .sidebar {
        top: 40px;
        height: calc(100vh - 40px);
        height: calc(100dvh - 40px);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }

    .sidebar-overlay.active {
        display: block;
        z-index: calc(var(--z-header) + 40);
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: var(--space-md);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-actions {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .table-container {
        border-radius: var(--radius-md);
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    thead th,
    tbody td {
        padding: var(--space-sm) var(--space-md);
    }

    .toast-container {
        top: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
    }

    .toast {
        min-width: unset;
        width: 100%;
    }

    .modal {
        margin: var(--space-md);
        max-width: calc(100% - var(--space-xl));
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Rede de segurança global: toda tabela rola dentro do próprio bloco em
       vez de estourar a largura da tela (abas sem wrapper próprio incluídas). */
    .page-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .page-content img {
        max-width: 100%;
        height: auto;
    }

    .page-content .card {
        min-width: 0;
    }
}

/* ================= Popups/modais e grids fixos no mobile ================= */
@media (max-width: 640px) {
    /* Grids de colunas fixas (declarados inline nos templates) colapsam
       para 1 coluna — cobre os formulários de 2 colunas dentro dos modais. */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: repeat(2, 1fr)"],
    div[style*="grid-template-columns:repeat(2, 1fr)"],
    div[style*="grid-template-columns: repeat(3, 1fr)"],
    div[style*="grid-template-columns:repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Grids de 2 colunas por classe (Tráfego Pago, storage, templates de email). */
    .tpx-grid,
    .stor-cols,
    .tpl-block-2col {
        grid-template-columns: 1fr !important;
    }

    /* Caixas de modal: nunca maiores que a tela e sempre roláveis. */
    .lead-modal-dialog,
    .cv-modal-box {
        max-width: calc(100vw - 24px) !important;
        max-height: 90vh;
        max-height: 90dvh;
        overflow-y: auto;
        margin-top: 4vh;
    }

    /* Chat embutido (kanban/painel): ocupa quase a tela toda. */
    .wa-chat-box {
        width: calc(100vw - 16px);
        height: 92vh;
        height: 92dvh;
        margin-top: 2vh;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .login-card {
        padding: var(--space-xl);
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   White-label color picker
   ========================================================================== */

.color-picker-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.color-swatch-input {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    cursor: pointer;
    transition: border-color var(--transition-base), transform var(--transition-base);
}

.color-swatch-input:hover {
    border-color: var(--primary);
    transform: scale(1.04);
}

.color-swatch-input::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--radius-md) - 4px);
}

.color-swatch-input::-moz-color-swatch {
    border: none;
    border-radius: calc(var(--radius-md) - 4px);
}

.color-hex-input {
    flex: 1;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    text-transform: lowercase;
}


/* ==========================================================================
   Leads — View Toggle (Lista / Kanban)
   ========================================================================== */
.view-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: calc(var(--radius-md) - 4px);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Leads — Kanban Board
   ========================================================================== */
.kanban-board {
    /* Colunas com largura FIXA (independente da quantidade); só o quadro
       rola para os lados — o restante da página se adapta à tela. */
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 320px;
    justify-content: start;
    gap: var(--space-md);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: var(--space-sm);
    align-items: start;
}

.kanban-col {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 320px;
    max-height: calc(100vh - 240px);
    transition: background 0.15s, box-shadow 0.15s, outline 0.15s;
}

.kanban-col.drop-target {
    outline: 2px dashed var(--col-accent, var(--primary));
    outline-offset: -2px;
    background: var(--white);
}

.kanban-col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
}

.kanban-col-dot {
    width: 9px;
    height: 9px;
    border-radius: var(--radius-full);
    background: var(--col-accent, var(--primary));
    flex-shrink: 0;
}

.kanban-col-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.kanban-col-count {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-tertiary);
}

.kanban-col-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm);
    flex: 1;
    overflow-y: auto;
    min-height: 60px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.kanban-col-empty {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    padding: var(--space-lg) var(--space-sm);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-md);
}

.kanban-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px 12px 10px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.05s, opacity 0.15s;
}

.kanban-card:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
}

.kanban-card.saving {
    opacity: 0.6;
    pointer-events: none;
}

.kanban-card.flash {
    animation: kanbanFlash 0.6s ease;
}

@keyframes kanbanFlash {
    0%   { box-shadow: 0 0 0 2px var(--primary-ring); }
    100% { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
}

.kanban-card-grip {
    position: absolute;
    left: 6px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: var(--radius-full);
    background: var(--col-accent, var(--border));
    opacity: 0.6;
}

.kanban-card-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-card-name:hover {
    color: var(--primary);
}

.kanban-card-line {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.kanban-card-platform {
    font-size: 0.6875rem;
    font-weight: 600;
}

.kanban-card-date {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

/* Toast */
.kanban-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 20px);
    background: var(--text-primary);
    color: var(--white);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1000;
}

.kanban-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.kanban-toast.error {
    background: var(--danger);
}

@media (max-width: 768px) {
    .kanban-board {
        grid-auto-columns: 80vw;
    }
}



/* =====================================================================
   Layout fluido (v3.7.0)
   Ajustes que fazem a interface acompanhar QUALQUER largura e nível de
   zoom, em vez de saltar só nos pontos de quebra. Zoom do navegador
   encolhe a viewport em CSS px, então as regras abaixo valem para os
   dois casos (tela pequena e zoom alto) sem duplicação.
   ===================================================================== */

/* 1. Nada estoura a largura da tela --------------------------------- */

/* NÃO incluir `svg` aqui: os ícones ficam dentro de botões que se medem
   pelo próprio conteúdo, então `max-width: 100%` resolve para zero e o
   ícone (e o botão inteiro, quando é só ícone) some da tela. */
img,
video,
canvas,
iframe {
    max-width: 100%;
}

/* Emails, URLs e nomes longos quebram em vez de alargar o bloco. */
.card,
.card-body,
tbody td,
.form-group {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Itens de grid/flex encolhem abaixo do conteúdo (senão empurram a página). */
.main-content,
.page-content,
.card,
.stat-card {
    min-width: 0;
}

/* 2. Tipografia fluida ---------------------------------------------- */
/* Escala junto com a viewport entre os limites — sem degraus. */

h1 {
    font-size: clamp(1.375rem, 1.05rem + 1.1vw, 1.875rem);
}

h2 {
    font-size: clamp(1.175rem, 0.98rem + 0.7vw, 1.5rem);
}

.stat-value {
    font-size: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
}

/* 3. Grades que se adaptam sozinhas ---------------------------------- */
/* auto-fit + minmax acompanha cada pixel de largura; as regras antigas
   fixavam 2 colunas no tablet e criavam sobras/apertos no meio. */

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

.form-row {
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* 4. Menu lateral: vira gaveta já no tablet (e em zoom alto) --------- */
/* Antes só a partir de 768px; entre 769 e 1024 a barra de 260px comia a
   área útil — que é exatamente onde cai um monitor 1280 com 125% de zoom. */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: calc(var(--z-header) + 50);
        top: 0;
        height: 100vh;
        height: 100dvh;
    }

    .impersonate-banner + .app-layout .sidebar {
        top: 40px;
        height: calc(100vh - 40px);
        height: calc(100dvh - 40px);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }

    .sidebar-overlay.active {
        display: block;
        z-index: calc(var(--z-header) + 40);
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    /* Tabela larga rola dentro do próprio bloco (mesma rede do mobile). */
    .page-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 5. Popups nunca maiores que a tela -------------------------------- */
/* A largura de cada modal continua sendo a do seu próprio desenho; aqui
   só garantimos a folga lateral (o filho é flexível e encolhe junto) e um
   teto de altura — com zoom alto o rodapé com os botões saía da tela. */

.modal-backdrop,
.bd-modal-overlay,
.ld-modal-overlay,
.hist-rem-overlay {
    padding: max(12px, var(--space-md));
}

.modal,
.bd-modal,
.ld-modal,
.hist-rem-box,
.cv-modal-box {
    max-height: 92dvh;
    overflow-y: auto;
}

.lead-modal-dialog {
    max-height: 88dvh;
}

.wa-chat-box {
    max-width: calc(100vw - 16px);
    max-height: 94dvh;
}

/* 6. Kanban: colunas encolhem quando a tela é estreita --------------- */

.kanban-board {
    grid-auto-columns: min(320px, 85vw);
}

/* 7. Grades declaradas nos templates com largura mínima fixa --------- */
/* `minmax(300px, 1fr)` não encolhe abaixo de 300px: em telas estreitas (ou
   zoom alto) a coluna fica maior que o espaço e empurra a página. Abaixo
   desse ponto elas já seriam de uma coluna só, então colapsamos. */

@media (max-width: 700px) {
    div[style*="minmax(280px"],
    div[style*="minmax(300px"],
    div[style*="minmax(320px"],
    div[style*="minmax(330px"],
    div[style*="minmax(340px"],
    div[style*="minmax(360px"],
    div[style*="minmax(380px"],
    div[style*="minmax(400px"] {
        grid-template-columns: 1fr !important;
    }
}

/* 8. Cabeçalho fixo em telas estreitas ------------------------------ */
/* O nome do usuário (nowrap) somado ao caminho de navegação empurrava a
   página para a direita. Em tela pequena fica só o avatar — o nome segue
   no menu que abre ao clicar nele. */

.top-header > div,
.top-header nav {
    min-width: 0;
}

@media (max-width: 600px) {
    .top-header {
        padding: 0 var(--space-md);
    }

    .top-header .dropdown > .btn > span {
        display: none;
    }

    .top-header nav[aria-label="Breadcrumb"] {
        overflow: hidden;
    }
}

/* 9. Barras de ação e filtros quebram linha em vez de transbordar ---- */

.page-header,
.page-header-actions,
.table-toolbar,
.btn-group {
    flex-wrap: wrap;
}











/* =====================================================================
   Tema escuro (v3.10.0)
   Ativado por `data-theme="dark"` no <html> (o script no <head> de cada
   layout aplica antes da primeira pintura, então não há "flash" branco).
   Quase tudo sai de graça porque o sistema já usa variáveis: aqui só
   redefinimos a paleta e ajustamos os poucos pontos com cor fixa.
   ===================================================================== */

:root[data-theme="dark"] {
    /* Aceso pelo navegador: campos de data, selects, barras de rolagem e
       autofill nascem escuros junto com a interface. */
    color-scheme: dark;

    /* NÃO mexemos em --primary/--secondary/--accent: são a marca de cada
       empresa (tenant_css_vars) e devem ser as mesmas nos dois temas. Este
       seletor tem especificidade maior que o `:root` da marca, então
       sobrescrever aqui apagaria a identidade do cliente. Ajustamos só os
       tons de apoio, que no claro somem sobre o fundo escuro. */
    --primary-light: rgba(10, 132, 255, 0.16);
    --primary-ring: rgba(10, 132, 255, 0.38);
    --accent-light: rgba(255, 74, 110, 0.16);

    /* Superfícies: fundo quase preto, cartões um degrau acima — a hierarquia
       no escuro se faz com luz, não com sombra. */
    --white: #1A1A1C;          /* usado como "fundo de cartão/modal" em ~120 lugares */
    --bg-primary: #1A1A1C;
    --bg-secondary: #0E0E10;
    --bg-tertiary: #232326;
    --bg-subtle: #202024;

    /* Texto de chips: inverte a claridade (no claro é tom escuro sobre pastel). */
    --chip-green: #4ADE80;
    --chip-red: #FF7A70;
    --chip-orange: #FFB84D;
    --chip-purple: #A5A0FF;
    --border: #313135;
    --border-light: #272729;

    --text-primary: #F5F5F7;
    --text-secondary: #A9A9AE;
    --text-tertiary: #8A8A8F;
    --text-placeholder: #6A6A6F;

    --success: #32D74B;
    --success-bg: rgba(50, 215, 75, 0.16);
    --warning: #FFA00A;
    --warning-bg: rgba(255, 160, 10, 0.16);
    --danger: #FF453A;
    --danger-bg: rgba(255, 69, 58, 0.16);
    --info: #0A84FF;
    --info-bg: rgba(10, 132, 255, 0.16);

    /* Sombras precisam ser bem mais densas para existirem sobre preto. */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.40);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 2px 12px rgba(0, 0, 0, 0.50);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.55);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.65);
}

/* A marca clareia no escuro (mesmo tom, mais luz): um azul pensado para
   fundo branco fica apagado sobre preto. Vale a pena porque a marca aparece
   como TEXTO em ~114 lugares e como FUNDO em apenas dois — e esses dois
   (botão primário e página ativa) recebem a cor cheia logo abaixo, para o
   texto branco continuar legível. Sem color-mix, tudo fica como no claro. */
@supports (color: color-mix(in srgb, red 50%, white)) {
    :root[data-theme="dark"] {
        --primary: color-mix(in srgb, var(--brand-primary, #0071E3) 68%, white);
        --primary-hover: color-mix(in srgb, var(--brand-primary, #0071E3) 56%, white);
        --secondary: color-mix(in srgb, var(--brand-secondary, #86868B) 72%, white);
        --accent: color-mix(in srgb, var(--brand-accent, #FF375F) 76%, white);
    }
}

:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .pagination .active,
:root[data-theme="dark"] .tenant-own-tag,
:root[data-theme="dark"] .tenant-view-btn.active {
    background: var(--brand-primary, #0071E3);
    border-color: var(--brand-primary, #0071E3);
    color: #FFFFFF;
}

:root[data-theme="dark"] .btn-primary:hover {
    background: var(--brand-primary-hover, #0077ED);
    color: #FFFFFF;
}

/* --white virou a cor das superfícies no escuro; onde ele era usado como
   TEXTO (sempre sobre um fundo saturado), tem que continuar branco puro. */
:root[data-theme="dark"] .btn-danger,
:root[data-theme="dark"] .btn-danger:hover {
    color: #FFFFFF;
}

/* O aviso do kanban usava `background: var(--text-primary)` — no escuro isso
   vira quase branco e o texto branco sumia. Fixamos uma superfície escura. */
:root[data-theme="dark"] .kanban-toast {
    background: #35353A;
    color: #FFFFFF;
    border: 1px solid var(--border);
}

/* ---- Pontos que tinham cor fixa no tema claro ---------------------- */

/* Cabeçalho e cartões de vidro (eram branco translúcido). */
:root[data-theme="dark"] .top-header {
    background: rgba(26, 26, 28, 0.82);
    border-bottom-color: var(--border-light);
}

:root[data-theme="dark"] .glass,
:root[data-theme="dark"] .login-card {
    background: rgba(26, 26, 28, 0.86);
    border-color: var(--border);
}

/* Texto das etiquetas coloridas: no escuro o tom escuro some no fundo. */
:root[data-theme="dark"] .badge-green,
:root[data-theme="dark"] .badge-converted,
:root[data-theme="dark"] .badge-success {
    color: #4ADE80;
}

:root[data-theme="dark"] .badge-blue,
:root[data-theme="dark"] .badge-new {
    color: #5AB0FF;
}

:root[data-theme="dark"] .badge-red,
:root[data-theme="dark"] .badge-lost {
    color: #FF7A70;
}

:root[data-theme="dark"] .badge-orange,
:root[data-theme="dark"] .badge-contacted {
    color: #FFB84D;
}

:root[data-theme="dark"] .badge-warning {
    color: #FBBF24;
}

:root[data-theme="dark"] .badge-purple {
    color: #C77DFF;
}

/* Carregamento (skeleton): o brilho tem que ser mais claro que o fundo. */
:root[data-theme="dark"] .skeleton {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, #34343A 50%, var(--bg-tertiary) 100%);
}

/* Barra de rolagem discreta (WebKit) — a padrão fica clara demais. */
:root[data-theme="dark"] ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

:root[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3A3A3F;
    border: 3px solid var(--bg-secondary);
    border-radius: var(--radius-full);
}

:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #4A4A50;
}

/* Chips com a cor da plataforma (Meta, Google...): a cor da marca é escura
   demais sobre o fundo escuro. Um leve realce mantém a identidade e devolve
   a legibilidade — o fundo é translúcido, então continua discreto. */
:root[data-theme="dark"] .trk-chip {
    filter: brightness(1.35);
}

/* Imagens/ilustrações com fundo branco embutido (QR code, preview de
   e-mail): mantêm o branco de propósito, mas sem "brilhar" na tela. */
:root[data-theme="dark"] .conn-qr-box,
:root[data-theme="dark"] #leadEmailPreview {
    filter: brightness(0.92);
}

/* Identificação do usuário no cabeçalho: é informação, não botão — nada de
   cursor de clique nem aparência de menu (o menu antigo nunca abria porque
   o clique era cancelado pelo fechador global de dropdowns do app.js). */
.user-chip {
    padding: 6px 8px;
    color: var(--text-secondary);
    cursor: default;
    user-select: none;
}

/* Logomarca por tema: quando existe uma versão para o escuro, as duas vão
   para o HTML e o CSS mostra a certa — a troca acontece junto com o botão,
   sem recarregar a página. */
.brand-logo-dark {
    display: none;
}

:root[data-theme="dark"] .brand-logo-light {
    display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
    display: block;
}

/* Botão de alternar tema (fica no cabeçalho de todos os painéis). */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border);
}

.theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

/* A troca de tema não deve "animar" a página inteira. */
.theme-switching,
.theme-switching * {
    transition: none !important;
}

/* ---------------------------------------------------------------------
   Balões das conversas no escuro.

   O verde do balão enviado (#d9fdd3) é fixo no <style> de cada tela de
   conversas, mas o texto vem de --text-primary — que no escuro é quase
   branco. Resultado: mensagem branca sobre verde claro, ilegível. Aqui os
   dois balões ganham fundo escuro, como o próprio WhatsApp faz no tema
   escuro. Especificidade maior que `.chat-msg.out`, então vence o <style>
   inline mesmo vindo antes no documento.
   --------------------------------------------------------------------- */

:root[data-theme="dark"] .chat-msg.out {
    background: #0A4F42;
    color: #EDEDEF;
}

:root[data-theme="dark"] .chat-msg.in {
    background: #232326;
    color: #EDEDEF;
}

/* A hora e os "vistos" ficam discretos, mas ainda legíveis sobre o balão. */
:root[data-theme="dark"] .chat-msg .chat-msg-time {
    color: rgba(237, 237, 239, 0.74);
}

/* Citação e anexo usavam véus pretos: sobre fundo escuro, sumiam. */
:root[data-theme="dark"] .chat-msg .chat-quote,
:root[data-theme="dark"] .chat-msg.in .chat-quote {
    background: rgba(255, 255, 255, 0.10);
    border-left-color: rgba(255, 255, 255, 0.45);
}

:root[data-theme="dark"] .chat-msg .chat-msg-media {
    background: rgba(255, 255, 255, 0.09);
}

:root[data-theme="dark"] .chat-msg .chat-msg-media:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* ---------------------------------------------------------------------
   Transicao de tema: o tema novo entra num circulo que nasce no botao
   e consome a tela (View Transitions API). Sem a animacao padrao de
   cross-fade; navegador sem suporte troca instantaneo via JS.
--------------------------------------------------------------------- */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 2;
}

/* ---------------------------------------------------------------------
   Botão flutuante de atalhos (FAB) — só existe no responsivo (<=1024px),
   painel do cliente. Aparece com menu de atalhos e uma "gaveta" que sobe
   com os leads do dia.
--------------------------------------------------------------------- */
.fab-wrap,
.fab-sheet-overlay {
    display: none;
}

@media (max-width: 1024px) {
    .fab-wrap {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
        position: fixed;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        z-index: 1200;
    }

    .fab-main {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        border: none;
        background: var(--primary);
        color: #fff;
        font-size: 30px;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
        transition: transform 0.25s;
    }

    .fab-main.open {
        transform: rotate(45deg);
    }

    .fab-menu {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    .fab-menu[hidden] {
        display: none;
    }

    .fab-ico {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    .fab-item {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--white);
        color: var(--text-primary);
        border: 1px solid var(--border-light);
        border-radius: 999px;
        padding: 10px 16px;
        font-size: 0.9rem;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    }

    .fab-sheet-overlay {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 1300;
        background: rgba(0, 0, 0, 0.45);
        align-items: flex-end;
    }

    .fab-sheet-overlay[hidden] {
        display: none;
    }

    .fab-sheet {
        background: var(--white);
        width: 100%;
        max-height: 75vh;
        border-radius: 16px 16px 0 0;
        display: flex;
        flex-direction: column;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .fab-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 18px;
        border-bottom: 1px solid var(--border-light);
        color: var(--text-primary);
    }

    .fab-sheet-close {
        background: none;
        border: none;
        font-size: 26px;
        color: var(--text-secondary);
        cursor: pointer;
        line-height: 1;
    }

    .fab-sheet-body {
        overflow-y: auto;
        padding: 8px 0;
    }

    .fab-sheet-empty {
        padding: 28px 18px;
        text-align: center;
        color: var(--text-secondary);
    }

    .fab-lead {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 18px;
        border-bottom: 1px solid var(--border-light);
    }

    .fab-lead-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        text-decoration: none;
    }

    .fab-lead-name {
        color: var(--text-primary);
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fab-lead-meta {
        color: var(--text-secondary);
        font-size: 0.8rem;
    }

    .fab-orc {
        padding: 12px 18px;
        border-bottom: 1px solid var(--border-light);
    }

    .fab-orc-top {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
    }

    .fab-orc-plat {
        color: #fff;
        font-size: 0.68rem;
        font-weight: 700;
        border-radius: 6px;
        padding: 2px 8px;
        flex-shrink: 0;
    }

    .fab-orc-bal {
        margin-left: auto;
        font-weight: 700;
        color: var(--text-primary);
        flex-shrink: 0;
    }

    .fab-orc-val-big {
        font-size: 1.5rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        margin-top: 6px;
    }

    .fab-orc-bar {
        height: 6px;
        border-radius: 999px;
        background: var(--bg-secondary);
        overflow: hidden;
        margin-top: 6px;
    }

    .fab-orc-bar > div {
        height: 100%;
        border-radius: 999px;
        transition: width 0.4s;
    }

    .fab-orc-meta {
        font-size: 0.75rem;
        color: var(--text-secondary);
        margin-top: 6px;
    }

    .fab-orc-row {
        display: flex;
        gap: 8px;
        margin-top: 10px;
    }

    .fab-orc-val {
        flex: 1;
        min-width: 0;
        border: 1px solid var(--border-light);
        border-radius: 10px;
        padding: 9px 12px;
        background: var(--white);
        color: var(--text-primary);
        font-size: 0.95rem;
    }

    .fab-orc-add {
        background: var(--primary);
        color: #fff;
        border: none;
        border-radius: 10px;
        padding: 9px 16px;
        font-weight: 700;
        cursor: pointer;
        flex-shrink: 0;
    }

    /* Editor do saldo na Carteira (limite de alerta + avisos) */
    .fab-orc-cfg {
        background: var(--bg-secondary);
        color: var(--text-secondary);
        border: none;
        border-radius: 10px;
        padding: 9px 12px;
        font-size: 0.95rem;
        cursor: pointer;
        flex-shrink: 0;
    }

    .fab-orc-cfg:hover {
        color: var(--primary);
    }

    .fab-orc-form {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 10px;
        border-top: 1px solid var(--border-light);
        padding-top: 10px;
    }

    .fab-orc-form[hidden] {
        display: none;
    }

    .fab-orc-form label {
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-secondary);
    }

    .fab-orc-form input,
    .fab-orc-form textarea {
        border: 1px solid var(--border-light);
        border-radius: 10px;
        padding: 8px 10px;
        background: var(--white);
        color: var(--text-primary);
        font-size: 0.9rem;
        font-family: inherit;
    }

    .fab-orc-save {
        background: var(--primary);
        color: #fff;
        border: none;
        border-radius: 10px;
        padding: 9px 16px;
        font-weight: 700;
        cursor: pointer;
        align-self: flex-end;
    }

    /* Últimas recargas dentro do cartão da Carteira (com desfazer) */
    .fab-orc-hist {
        margin-top: 10px;
        border-top: 1px solid var(--border-light);
        padding-top: 8px;
    }

    .fab-orc-hist-tt {
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-secondary);
        margin-bottom: 4px;
    }

    .fab-orc-hist-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 4px 0;
        font-size: 0.85rem;
        color: var(--text-secondary);
    }

    .fab-orc-hist-row strong {
        margin-left: auto;
        color: var(--text-primary);
    }

    .fab-orc-del {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: none;
        background: var(--bg-secondary);
        color: var(--text-secondary);
        font-size: 1rem;
        line-height: 1;
        cursor: pointer;
        flex-shrink: 0;
    }

    .fab-orc-del:hover {
        background: #FEE2E2;
        color: #DC2626;
    }

    .fab-lead-wa {
        background: #25d366;
        color: #fff;
        border-radius: 999px;
        padding: 8px 14px;
        font-size: 0.82rem;
        font-weight: 700;
        text-decoration: none;
        flex-shrink: 0;
    }
}

/* O atributo [hidden] precisa vencer o display:flex do .nav-link — senão o
   item "Ativar notificações" apareceria mesmo escondido. */
.nav-link[hidden] {
    display: none !important;
}

/* ---------------------------------------------------------------------
   Painel de notificações no celular.

   O painel é ancorado com `right: 0` no sino. No desktop o sino fica na
   borda direita, então funciona; no celular ele tem o tema e o usuário à
   direita, e o painel (340px) saía ~200px para fora da tela à esquerda.

   Correção: em telas estreitas, tirar o posicionamento de .notif-wrap e
   .header-actions faz o painel se ancorar no próprio cabeçalho (sticky),
   que ocupa a largura toda — sem número mágico de altura, e continua
   certo mesmo com a faixa de impersonação empurrando o cabeçalho.

   ⚠️ Precisa de especificidade maior que `.notif-panel`: o <style> dos
   layouts vem DEPOIS do app.css no documento e venceria no empate.
--------------------------------------------------------------------- */
@media (max-width: 640px) {
    .top-header .header-actions,
    .top-header .notif-wrap {
        position: static;
    }

    .top-header .notif-panel {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }

    .top-header .notif-list {
        max-height: min(60vh, 420px);
    }
}

/* Seletor de grupo do WhatsApp nos campos de aviso. */
.wa-grp-wrap { position: relative; margin-top: 4px; }

.wa-grp-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.wa-grp-btn:hover { background: var(--white); color: var(--text-primary); }

.wa-grp-pop {
    /* fixed: o .card do sistema tem overflow:hidden e cortaria a lista */
    position: fixed;
    z-index: 1400;
    width: min(320px, 90vw);
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.16);
    padding: 8px;
}

.wa-grp-busca {
    width: 100%;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.8rem;
    background: var(--white);
    color: var(--text-primary);
    margin-bottom: 6px;
}

.wa-grp-lista { max-height: 240px; overflow-y: auto; }

.wa-grp-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: pointer;
}

.wa-grp-item:hover { background: var(--bg-secondary); }

.wa-grp-load { padding: 10px; font-size: 0.8rem; color: var(--text-secondary); }

/* Linha "Conversar com <número>" na busca de conversas. */
.chat-newnum {
    background: var(--primary-light, rgba(0, 113, 227, 0.06));
    border-left: 3px solid var(--primary);
    cursor: pointer;
}

.chat-newnum .chat-conv-name { color: var(--primary); }

/* Barra do arquivo escolhido, acima do campo de mensagem. */
.chat-attach-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.chat-attach-bar[hidden] { display: none; }

/* Miniatura do anexo (imagem escolhida ou print colado com Ctrl+V) */
.chat-attach-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-light); background: var(--white); flex-shrink: 0; }
.chat-attach-thumb[hidden] { display: none; }

.chat-attach-nome {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.chat-attach-x {
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.chat-attach-x:hover { color: var(--danger, #FF3B30); }

/* Conta de anúncios no cartão do relatório agendado. */
.badge.rpt-acc {
    background: rgba(0, 113, 227, 0.10);
    color: var(--primary);
    font-weight: 600;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Chave liga/desliga das automações (relatórios, alertas de saldo). */
.auto-switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.auto-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.auto-slider {
    width: 38px;
    height: 21px;
    border-radius: 999px;
    background: var(--border-light);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.auto-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.auto-switch input:checked + .auto-slider { background: var(--success, #30D158); }
.auto-switch input:checked + .auto-slider::after { transform: translateX(17px); }
.auto-switch input:disabled + .auto-slider { opacity: .6; }

/* Carteira na barra de tráfego pago: abre/fecha o saldo das contas. */
.tpx-wallet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    /* A barra usa space-between: sem isto o ícone ficaria solto no meio.
       Com margem automática à direita ele encosta nas abas e empurra os
       filtros para a ponta. */
    margin-right: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tpx-wallet:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tpx-wallet.is-on {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Popup de saldo/recarga do Tráfego Pago (abre pela carteira). */
.tpx-bmodal {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.45);
}

.tpx-bmodal[hidden] { display: none; }

.tpx-bmodal-box {
    background: var(--white);
    border-radius: 16px;
    width: min(680px, 100%);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

.tpx-bmodal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.tpx-bmodal-x {
    border: none;
    background: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-tertiary);
    cursor: pointer;
}

.tpx-bmodal-x:hover { color: var(--text-primary); }

.tpx-bmodal-body {
    padding: 16px 18px 20px;
    overflow-y: auto;
}

/* Dentro do popup os cartões ocupam a largura toda. */
.tpx-bmodal-body .tpx-budgets { margin-bottom: 0; }

/* ---------------------------------------------------------------------
   Tabela em formato de cartão no celular (≤640px).
   Cada linha vira um bloco e cada célula mostra "rótulo: valor", em vez de
   espremer 6 colunas numa tela de 375px.
--------------------------------------------------------------------- */
@media (max-width: 640px) {
    table.tbl-cartoes,
    table.tbl-cartoes tbody,
    table.tbl-cartoes tr,
    table.tbl-cartoes td {
        display: block;
        width: auto;
    }

    table.tbl-cartoes thead {
        /* Escondido sem sumir para leitores de tela. */
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* Cada lead é uma CAIXA separada: espaço entre elas e sombra leve, para
       não confundir onde termina um registro e começa o outro. */
    table.tbl-cartoes tr {
        border: 1px solid var(--border-light);
        border-radius: 14px;
        padding: 6px 2px;
        margin-bottom: 16px;
        background: var(--white);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    }

    table.tbl-cartoes tr:last-child { margin-bottom: 4px; }

    /* Campo longo (nome, campanha) ocupa a LARGURA TODA: rótulo em cima,
       valor embaixo, em vez de dividir a linha e espremer os dois. */
    table.tbl-cartoes td.celula-larga {
        display: block;
        text-align: left;
    }

    table.tbl-cartoes td.celula-larga::before {
        display: block;
        margin-bottom: 3px;
        padding-top: 0;
    }

    table.tbl-cartoes td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 7px 12px;
        border: none;
        text-align: right;
        /* Nome comprido quebra em vez de ser cortado. */
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        min-height: 0;
    }

    table.tbl-cartoes td + td {
        border-top: 1px solid var(--border-light);
    }

    table.tbl-cartoes td::before {
        content: attr(data-rotulo);
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-tertiary);
        text-align: left;
        flex-shrink: 0;
        padding-top: 2px;
    }

    /* Célula sem rótulo (ex.: coluna de ações) ocupa a linha toda. */
    table.tbl-cartoes td:not([data-rotulo])::before { content: none; }

    /* O texto do valor quebra em vez de ser cortado.
       ⚠️ !important porque os templates trazem `max-width:200px;
       overflow:hidden; text-overflow:ellipsis` em ESTILO INLINE, que vence
       qualquer regra de classe. Só vale dentro do celular. */
    table.tbl-cartoes td,
    table.tbl-cartoes td * {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-width: 100% !important;
        overflow-wrap: anywhere;
    }

    /* A caixa de rolagem deixa de ser necessária. */
    table.tbl-cartoes { min-width: 0 !important; }
}


/* ---------------------------------------------------------------------
   Fundo das conversas com rabiscos + visual WhatsApp Web.

   O tile e um SVG proprio (desenhado a mao, nao e a arte da Meta):
   rabiscos grandes e densos de objetos do dia a dia, quase encostando,
   sobre o bege classico (#efeae2) — e no escuro sobre o #0b141a, como o
   proprio WhatsApp. Junto vem o restante do visual do WhatsApp Web:
   cabecalho e barra de digitacao cinza (#f0f2f5 / #202c33), campo de
   texto em pilula sem borda, botao de enviar verde (#00a884), baloes
   com raio 7.5px e sombra rasa, verde #d9fdd3 / #005c4b no enviado.
   `.chat .chat-messages` ganha do `.chat-messages` do <style> de cada
   tela de conversas por especificidade, mesmo vindo antes.
   --------------------------------------------------------------------- */

.chat .chat-messages {
    background-color: #efeae2;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='424' height='424' viewBox='0 0 424 424'%3E%3Cg fill='none' stroke='%237f7259' stroke-opacity='.13' stroke-width='.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(1 5) scale(2) rotate(-13 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(60 0) scale(2) rotate(7 9 9)'%3E%3Cpath d='M10 1l2.3 5.3 5.7.5-4.3 3.8 1.3 5.6-5-3-5 3 1.3-5.6L2 6.8l5.7-.5z'/%3E%3C/g%3E%3Cg transform='translate(105 7) scale(2) rotate(-3 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(159 5) scale(2) rotate(10 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(214 0) scale(2) rotate(11 9 9)'%3E%3Crect x='2' y='6' width='11' height='9' rx='2'/%3E%3Cpath d='M13 8h2a2.5 2.5 0 0 1 0 5h-2M5.5 3.5q.9-1.4 0-2.8M9 3.5q.9-1.4 0-2.8'/%3E%3C/g%3E%3Cg transform='translate(265 2) scale(2) rotate(-13 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(323 -1) scale(2) rotate(-2 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(378 1) scale(2) rotate(2 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(1 60) scale(2) rotate(-9 9 9)'%3E%3Cpath d='M1 10a8.8 8.8 0 0 1 17.6 0zM9.8 10v6.5a2 2 0 0 1-4 0M9.8 10V1.5'/%3E%3C/g%3E%3Cg transform='translate(56 60) scale(2) rotate(-5 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(108 57) scale(2) rotate(-10 9 9)'%3E%3Crect x='2' y='6' width='11' height='9' rx='2'/%3E%3Cpath d='M13 8h2a2.5 2.5 0 0 1 0 5h-2M5.5 3.5q.9-1.4 0-2.8M9 3.5q.9-1.4 0-2.8'/%3E%3C/g%3E%3Cg transform='translate(159 52) scale(2) rotate(-3 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(219 58) scale(2) rotate(4 9 9)'%3E%3Cpath d='M1 9q5-5.5 10-5.5T18 9q-2 5.5-7 5.5T1 9z'/%3E%3Cpath d='M17 9l4.5-4.5v9zM5.5 7.5v.3'/%3E%3C/g%3E%3Cg transform='translate(271 57) scale(2) rotate(3 9 9)'%3E%3Cpath d='M10 20L2 3.5a18 18 0 0 1 16 0z'/%3E%3Cpath d='M6.5 8.5v.3M12 8.5v.3M9.3 13v.3'/%3E%3C/g%3E%3Cg transform='translate(319 55) scale(2) rotate(-11 9 9)'%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Ccircle cx='9' cy='3.8' r='2.6'/%3E%3Ccircle cx='9' cy='14.2' r='2.6'/%3E%3Ccircle cx='3.8' cy='9' r='2.6'/%3E%3Ccircle cx='14.2' cy='9' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(374 60) scale(2) rotate(15 9 9)'%3E%3Cpath d='M1.5 5a10.5 10.5 0 0 0 18 0z'/%3E%3Cpath d='M3.8 6a8 8 0 0 0 13.4 0'/%3E%3Cpath d='M7.5 8.2v.3M12.5 8.2v.3M10 10.8v.3'/%3E%3C/g%3E%3Cg transform='translate(4 112) scale(2) rotate(2 9 9)'%3E%3Cpath d='M4.5 8.5a4.5 4.5 0 0 1 9 0z'/%3E%3Cpath d='M5 8.5L9 19l4-10.5'/%3E%3Cpath d='M9 4a2.6 2.6 0 0 1 2.6-2.6'/%3E%3C/g%3E%3Cg transform='translate(53 106) scale(2) rotate(16 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(107 110) scale(2) rotate(-7 9 9)'%3E%3Cpath d='M5 15a4 4 0 0 1 0-8 5.8 5.8 0 0 1 11-1.4A4.2 4.2 0 0 1 15.5 15z'/%3E%3C/g%3E%3Cg transform='translate(165 111) scale(2) rotate(-14 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(212 113) scale(2) rotate(4 9 9)'%3E%3Cpath d='M3.5 11h12l-1.4 7.5H4.9zM3.5 11c-1.8-5 2.4-7 3.6-4.4C8 3 12 3 12.8 6.6c2.6-1.6 4.4 2.4 1.7 4.4'/%3E%3Cpath d='M6.8 11l.9 7.5M9.5 11v7.5M12.2 11l-.9 7.5'/%3E%3C/g%3E%3Cg transform='translate(269 112) scale(2) rotate(13 9 9)'%3E%3Cpath d='M2 17C2 8 8.5 2 17 2c0 9-6.5 15-15 15z'/%3E%3Cpath d='M4.5 14.5C7.5 10 11 6.5 14.5 4.5'/%3E%3C/g%3E%3Cg transform='translate(318 109) scale(2) rotate(14 9 9)'%3E%3Cpath d='M10 1l2.3 5.3 5.7.5-4.3 3.8 1.3 5.6-5-3-5 3 1.3-5.6L2 6.8l5.7-.5z'/%3E%3C/g%3E%3Cg transform='translate(371 105) scale(2) rotate(3 9 9)'%3E%3Cpath d='M2 13a8 8 0 0 1 16 0'/%3E%3Crect x='1.6' y='12' width='3.4' height='5.6' rx='1.6'/%3E%3Crect x='15' y='12' width='3.4' height='5.6' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(6 162) scale(2) rotate(8 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(57 158) scale(2) rotate(13 9 9)'%3E%3Ccircle cx='9' cy='9' r='7.5'/%3E%3Cpath d='M9 5.2l3.6 2.6-1.4 4.2H6.8L5.4 7.8z'/%3E%3Cpath d='M9 1.5v3.7M16.2 6.5l-3.6 1.3M13.6 16l-2.4-4M4.4 16l2.4-4M1.8 6.5l3.6 1.3'/%3E%3C/g%3E%3Cg transform='translate(107 159) scale(2) rotate(15 9 9)'%3E%3Crect x='1' y='7' width='16' height='11' rx='1'/%3E%3Cpath d='M9 7v11M1 11h16M9 7C6.5 7 4.5 5.8 4.5 4.2S7.5 1.6 9 4c1.5-2.4 4.5-1.4 4.5.2S11.5 7 9 7z'/%3E%3C/g%3E%3Cg transform='translate(161 162) scale(2) rotate(-8 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(214 164) scale(2) rotate(9 9 9)'%3E%3Cpath d='M5.5 12.5a5.8 5.8 0 1 1 7 0c-.9.8-1.3 1.7-1.3 2.7H6.8c0-1-.4-1.9-1.3-2.7z'/%3E%3Cpath d='M7.5 17.8h3'/%3E%3C/g%3E%3Cg transform='translate(271 159) scale(2) rotate(-6 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(323 166) scale(2) rotate(1 9 9)'%3E%3Cpath d='M10 20L2 3.5a18 18 0 0 1 16 0z'/%3E%3Cpath d='M6.5 8.5v.3M12 8.5v.3M9.3 13v.3'/%3E%3C/g%3E%3Cg transform='translate(372 164) scale(2) rotate(1 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(5 216) scale(2) rotate(8 9 9)'%3E%3Ccircle cx='4.8' cy='12' r='3.6'/%3E%3Ccircle cx='15.2' cy='12' r='3.6'/%3E%3Cpath d='M8.4 11.4q1.6-1.6 3.2 0M1.4 10.5L2.6 7M18.6 10.5L17.4 7'/%3E%3C/g%3E%3Cg transform='translate(54 212) scale(2) rotate(-5 9 9)'%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Ccircle cx='9' cy='3.8' r='2.6'/%3E%3Ccircle cx='9' cy='14.2' r='2.6'/%3E%3Ccircle cx='3.8' cy='9' r='2.6'/%3E%3Ccircle cx='14.2' cy='9' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(108 214) scale(2) rotate(-16 9 9)'%3E%3Cpath d='M6 14V3.5L14 1.5V12'/%3E%3Ccircle cx='3.8' cy='14' r='2.2'/%3E%3Ccircle cx='11.8' cy='12' r='2.2'/%3E%3C/g%3E%3Cg transform='translate(160 215) scale(2) rotate(2 9 9)'%3E%3Cpath d='M10 4.5C13 2.8 16.5 4.6 16.5 9c0 4.5-2.8 8.5-6.5 8.5S3.5 13.5 3.5 9c0-4.4 3.5-6.2 6.5-4.5z'/%3E%3Cpath d='M10 4.5V1.8M10 3q2.8-1.8 4.5 0'/%3E%3C/g%3E%3Cg transform='translate(213 217) scale(2) rotate(7 9 9)'%3E%3Cpath d='M2 2h14a2.5 2.5 0 0 1 2.5 2.5v6A2.5 2.5 0 0 1 16 13h-6l-5 4v-4H2A2.5 2.5 0 0 1-.5 10.5v-6z' transform='translate(1 1)'/%3E%3C/g%3E%3Cg transform='translate(269 213) scale(2) rotate(16 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(317 218) scale(2) rotate(9 9 9)'%3E%3Cpath d='M1.5 5a10.5 10.5 0 0 0 18 0z'/%3E%3Cpath d='M3.8 6a8 8 0 0 0 13.4 0'/%3E%3Cpath d='M7.5 8.2v.3M12.5 8.2v.3M10 10.8v.3'/%3E%3C/g%3E%3Cg transform='translate(376 217) scale(2) rotate(-10 9 9)'%3E%3Cellipse cx='9' cy='6.5' rx='5' ry='6.5'/%3E%3Cpath d='M9 13l-1.3 1.8h2.6zM9 14.8q-1.8 2.6 0 5.2'/%3E%3C/g%3E%3Cg transform='translate(5 264) scale(2) rotate(-4 9 9)'%3E%3Cpath d='M10 20L2 3.5a18 18 0 0 1 16 0z'/%3E%3Cpath d='M6.5 8.5v.3M12 8.5v.3M9.3 13v.3'/%3E%3C/g%3E%3Cg transform='translate(55 271) scale(2) rotate(-6 9 9)'%3E%3Cpath d='M10 1l2.3 5.3 5.7.5-4.3 3.8 1.3 5.6-5-3-5 3 1.3-5.6L2 6.8l5.7-.5z'/%3E%3C/g%3E%3Cg transform='translate(110 264) scale(2) rotate(-10 9 9)'%3E%3Cpath d='M2 9L18 2l-5.5 15-3.5-6zM9 11l9-9'/%3E%3C/g%3E%3Cg transform='translate(160 272) scale(2) rotate(-10 9 9)'%3E%3Cpath d='M2 2h14a2.5 2.5 0 0 1 2.5 2.5v6A2.5 2.5 0 0 1 16 13h-6l-5 4v-4H2A2.5 2.5 0 0 1-.5 10.5v-6z' transform='translate(1 1)'/%3E%3C/g%3E%3Cg transform='translate(216 264) scale(2) rotate(-12 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(267 270) scale(2) rotate(-7 9 9)'%3E%3Ccircle cx='9' cy='9' r='7.5'/%3E%3Cpath d='M9 1.5v15M1.5 9h15M3.5 4.5q5.5 3 11 0M3.5 13.5q5.5-3 11 0'/%3E%3Cellipse cx='9' cy='9' rx='3.6' ry='7.5'/%3E%3C/g%3E%3Cg transform='translate(321 269) scale(2) rotate(7 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(371 265) scale(2) rotate(15 9 9)'%3E%3Cpath d='M10 4.5C13 2.8 16.5 4.6 16.5 9c0 4.5-2.8 8.5-6.5 8.5S3.5 13.5 3.5 9c0-4.4 3.5-6.2 6.5-4.5z'/%3E%3Cpath d='M10 4.5V1.8M10 3q2.8-1.8 4.5 0'/%3E%3C/g%3E%3Cg transform='translate(6 324) scale(2) rotate(3 9 9)'%3E%3Cpath d='M5 15a4 4 0 0 1 0-8 5.8 5.8 0 0 1 11-1.4A4.2 4.2 0 0 1 15.5 15z'/%3E%3C/g%3E%3Cg transform='translate(54 318) scale(2) rotate(5 9 9)'%3E%3Crect x='2' y='6' width='11' height='9' rx='2'/%3E%3Cpath d='M13 8h2a2.5 2.5 0 0 1 0 5h-2M5.5 3.5q.9-1.4 0-2.8M9 3.5q.9-1.4 0-2.8'/%3E%3C/g%3E%3Cg transform='translate(109 324) scale(2) rotate(-6 9 9)'%3E%3Cpath d='M5.5 12.5a5.8 5.8 0 1 1 7 0c-.9.8-1.3 1.7-1.3 2.7H6.8c0-1-.4-1.9-1.3-2.7z'/%3E%3Cpath d='M7.5 17.8h3'/%3E%3C/g%3E%3Cg transform='translate(158 320) scale(2) rotate(7 9 9)'%3E%3Cpath d='M10 4.5C13 2.8 16.5 4.6 16.5 9c0 4.5-2.8 8.5-6.5 8.5S3.5 13.5 3.5 9c0-4.4 3.5-6.2 6.5-4.5z'/%3E%3Cpath d='M10 4.5V1.8M10 3q2.8-1.8 4.5 0'/%3E%3C/g%3E%3Cg transform='translate(219 317) scale(2) rotate(3 9 9)'%3E%3Cpath d='M6 14V3.5L14 1.5V12'/%3E%3Ccircle cx='3.8' cy='14' r='2.2'/%3E%3Ccircle cx='11.8' cy='12' r='2.2'/%3E%3C/g%3E%3Cg transform='translate(265 321) scale(2) rotate(7 9 9)'%3E%3Cpath d='M1.5 5a10.5 10.5 0 0 0 18 0z'/%3E%3Cpath d='M3.8 6a8 8 0 0 0 13.4 0'/%3E%3Cpath d='M7.5 8.2v.3M12.5 8.2v.3M10 10.8v.3'/%3E%3C/g%3E%3Cg transform='translate(319 322) scale(2) rotate(-2 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(378 325) scale(2) rotate(5 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(2 373) scale(2) rotate(-1 9 9)'%3E%3Cpath d='M3.5 11h12l-1.4 7.5H4.9zM3.5 11c-1.8-5 2.4-7 3.6-4.4C8 3 12 3 12.8 6.6c2.6-1.6 4.4 2.4 1.7 4.4'/%3E%3Cpath d='M6.8 11l.9 7.5M9.5 11v7.5M12.2 11l-.9 7.5'/%3E%3C/g%3E%3Cg transform='translate(58 373) scale(2) rotate(-4 9 9)'%3E%3Cpath d='M4.5 8.5a4.5 4.5 0 0 1 9 0z'/%3E%3Cpath d='M5 8.5L9 19l4-10.5'/%3E%3Cpath d='M9 4a2.6 2.6 0 0 1 2.6-2.6'/%3E%3C/g%3E%3Cg transform='translate(112 375) scale(2) rotate(-15 9 9)'%3E%3Cpath d='M1 9q5-5.5 10-5.5T18 9q-2 5.5-7 5.5T1 9z'/%3E%3Cpath d='M17 9l4.5-4.5v9zM5.5 7.5v.3'/%3E%3C/g%3E%3Cg transform='translate(162 377) scale(2) rotate(0 9 9)'%3E%3Cpath d='M2 2h14a2.5 2.5 0 0 1 2.5 2.5v6A2.5 2.5 0 0 1 16 13h-6l-5 4v-4H2A2.5 2.5 0 0 1-.5 10.5v-6z' transform='translate(1 1)'/%3E%3C/g%3E%3Cg transform='translate(216 377) scale(2) rotate(6 9 9)'%3E%3Ccircle cx='9' cy='9' r='7.5'/%3E%3Cpath d='M9 4.8V9l3 1.8'/%3E%3C/g%3E%3Cg transform='translate(265 373) scale(2) rotate(-10 9 9)'%3E%3Cpath d='M1 10a8.8 8.8 0 0 1 17.6 0zM9.8 10v6.5a2 2 0 0 1-4 0M9.8 10V1.5'/%3E%3C/g%3E%3Cg transform='translate(324 373) scale(2) rotate(5 9 9)'%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Ccircle cx='9' cy='3.8' r='2.6'/%3E%3Ccircle cx='9' cy='14.2' r='2.6'/%3E%3Ccircle cx='3.8' cy='9' r='2.6'/%3E%3Ccircle cx='14.2' cy='9' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(377 370) scale(2) rotate(14 9 9)'%3E%3Ccircle cx='9' cy='9' r='3.8'/%3E%3Cpath d='M9 1v2.2M9 14.8V17M1 9h2.2M14.8 9H17M3.3 3.3l1.6 1.6M13.1 13.1l1.6 1.6M14.7 3.3l-1.6 1.6M4.9 13.1l-1.6 1.6'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-size: 424px 424px;
    padding: 16px clamp(16px, 5%, 64px);
}

:root[data-theme="dark"] .chat .chat-messages {
    background-color: #0b141a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='424' height='424' viewBox='0 0 424 424'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.03' stroke-width='.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(1 5) scale(2) rotate(-13 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(60 0) scale(2) rotate(7 9 9)'%3E%3Cpath d='M10 1l2.3 5.3 5.7.5-4.3 3.8 1.3 5.6-5-3-5 3 1.3-5.6L2 6.8l5.7-.5z'/%3E%3C/g%3E%3Cg transform='translate(105 7) scale(2) rotate(-3 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(159 5) scale(2) rotate(10 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(214 0) scale(2) rotate(11 9 9)'%3E%3Crect x='2' y='6' width='11' height='9' rx='2'/%3E%3Cpath d='M13 8h2a2.5 2.5 0 0 1 0 5h-2M5.5 3.5q.9-1.4 0-2.8M9 3.5q.9-1.4 0-2.8'/%3E%3C/g%3E%3Cg transform='translate(265 2) scale(2) rotate(-13 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(323 -1) scale(2) rotate(-2 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(378 1) scale(2) rotate(2 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(1 60) scale(2) rotate(-9 9 9)'%3E%3Cpath d='M1 10a8.8 8.8 0 0 1 17.6 0zM9.8 10v6.5a2 2 0 0 1-4 0M9.8 10V1.5'/%3E%3C/g%3E%3Cg transform='translate(56 60) scale(2) rotate(-5 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(108 57) scale(2) rotate(-10 9 9)'%3E%3Crect x='2' y='6' width='11' height='9' rx='2'/%3E%3Cpath d='M13 8h2a2.5 2.5 0 0 1 0 5h-2M5.5 3.5q.9-1.4 0-2.8M9 3.5q.9-1.4 0-2.8'/%3E%3C/g%3E%3Cg transform='translate(159 52) scale(2) rotate(-3 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(219 58) scale(2) rotate(4 9 9)'%3E%3Cpath d='M1 9q5-5.5 10-5.5T18 9q-2 5.5-7 5.5T1 9z'/%3E%3Cpath d='M17 9l4.5-4.5v9zM5.5 7.5v.3'/%3E%3C/g%3E%3Cg transform='translate(271 57) scale(2) rotate(3 9 9)'%3E%3Cpath d='M10 20L2 3.5a18 18 0 0 1 16 0z'/%3E%3Cpath d='M6.5 8.5v.3M12 8.5v.3M9.3 13v.3'/%3E%3C/g%3E%3Cg transform='translate(319 55) scale(2) rotate(-11 9 9)'%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Ccircle cx='9' cy='3.8' r='2.6'/%3E%3Ccircle cx='9' cy='14.2' r='2.6'/%3E%3Ccircle cx='3.8' cy='9' r='2.6'/%3E%3Ccircle cx='14.2' cy='9' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(374 60) scale(2) rotate(15 9 9)'%3E%3Cpath d='M1.5 5a10.5 10.5 0 0 0 18 0z'/%3E%3Cpath d='M3.8 6a8 8 0 0 0 13.4 0'/%3E%3Cpath d='M7.5 8.2v.3M12.5 8.2v.3M10 10.8v.3'/%3E%3C/g%3E%3Cg transform='translate(4 112) scale(2) rotate(2 9 9)'%3E%3Cpath d='M4.5 8.5a4.5 4.5 0 0 1 9 0z'/%3E%3Cpath d='M5 8.5L9 19l4-10.5'/%3E%3Cpath d='M9 4a2.6 2.6 0 0 1 2.6-2.6'/%3E%3C/g%3E%3Cg transform='translate(53 106) scale(2) rotate(16 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(107 110) scale(2) rotate(-7 9 9)'%3E%3Cpath d='M5 15a4 4 0 0 1 0-8 5.8 5.8 0 0 1 11-1.4A4.2 4.2 0 0 1 15.5 15z'/%3E%3C/g%3E%3Cg transform='translate(165 111) scale(2) rotate(-14 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(212 113) scale(2) rotate(4 9 9)'%3E%3Cpath d='M3.5 11h12l-1.4 7.5H4.9zM3.5 11c-1.8-5 2.4-7 3.6-4.4C8 3 12 3 12.8 6.6c2.6-1.6 4.4 2.4 1.7 4.4'/%3E%3Cpath d='M6.8 11l.9 7.5M9.5 11v7.5M12.2 11l-.9 7.5'/%3E%3C/g%3E%3Cg transform='translate(269 112) scale(2) rotate(13 9 9)'%3E%3Cpath d='M2 17C2 8 8.5 2 17 2c0 9-6.5 15-15 15z'/%3E%3Cpath d='M4.5 14.5C7.5 10 11 6.5 14.5 4.5'/%3E%3C/g%3E%3Cg transform='translate(318 109) scale(2) rotate(14 9 9)'%3E%3Cpath d='M10 1l2.3 5.3 5.7.5-4.3 3.8 1.3 5.6-5-3-5 3 1.3-5.6L2 6.8l5.7-.5z'/%3E%3C/g%3E%3Cg transform='translate(371 105) scale(2) rotate(3 9 9)'%3E%3Cpath d='M2 13a8 8 0 0 1 16 0'/%3E%3Crect x='1.6' y='12' width='3.4' height='5.6' rx='1.6'/%3E%3Crect x='15' y='12' width='3.4' height='5.6' rx='1.6'/%3E%3C/g%3E%3Cg transform='translate(6 162) scale(2) rotate(8 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(57 158) scale(2) rotate(13 9 9)'%3E%3Ccircle cx='9' cy='9' r='7.5'/%3E%3Cpath d='M9 5.2l3.6 2.6-1.4 4.2H6.8L5.4 7.8z'/%3E%3Cpath d='M9 1.5v3.7M16.2 6.5l-3.6 1.3M13.6 16l-2.4-4M4.4 16l2.4-4M1.8 6.5l3.6 1.3'/%3E%3C/g%3E%3Cg transform='translate(107 159) scale(2) rotate(15 9 9)'%3E%3Crect x='1' y='7' width='16' height='11' rx='1'/%3E%3Cpath d='M9 7v11M1 11h16M9 7C6.5 7 4.5 5.8 4.5 4.2S7.5 1.6 9 4c1.5-2.4 4.5-1.4 4.5.2S11.5 7 9 7z'/%3E%3C/g%3E%3Cg transform='translate(161 162) scale(2) rotate(-8 9 9)'%3E%3Cpath d='M10 17C5 13 2.5 9.5 4.5 6.8 6.2 4.6 9.2 5.3 10 7.5c.8-2.2 3.8-2.9 5.5-.7C17.5 9.5 15 13 10 17z'/%3E%3C/g%3E%3Cg transform='translate(214 164) scale(2) rotate(9 9 9)'%3E%3Cpath d='M5.5 12.5a5.8 5.8 0 1 1 7 0c-.9.8-1.3 1.7-1.3 2.7H6.8c0-1-.4-1.9-1.3-2.7z'/%3E%3Cpath d='M7.5 17.8h3'/%3E%3C/g%3E%3Cg transform='translate(271 159) scale(2) rotate(-6 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(323 166) scale(2) rotate(1 9 9)'%3E%3Cpath d='M10 20L2 3.5a18 18 0 0 1 16 0z'/%3E%3Cpath d='M6.5 8.5v.3M12 8.5v.3M9.3 13v.3'/%3E%3C/g%3E%3Cg transform='translate(372 164) scale(2) rotate(1 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(5 216) scale(2) rotate(8 9 9)'%3E%3Ccircle cx='4.8' cy='12' r='3.6'/%3E%3Ccircle cx='15.2' cy='12' r='3.6'/%3E%3Cpath d='M8.4 11.4q1.6-1.6 3.2 0M1.4 10.5L2.6 7M18.6 10.5L17.4 7'/%3E%3C/g%3E%3Cg transform='translate(54 212) scale(2) rotate(-5 9 9)'%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Ccircle cx='9' cy='3.8' r='2.6'/%3E%3Ccircle cx='9' cy='14.2' r='2.6'/%3E%3Ccircle cx='3.8' cy='9' r='2.6'/%3E%3Ccircle cx='14.2' cy='9' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(108 214) scale(2) rotate(-16 9 9)'%3E%3Cpath d='M6 14V3.5L14 1.5V12'/%3E%3Ccircle cx='3.8' cy='14' r='2.2'/%3E%3Ccircle cx='11.8' cy='12' r='2.2'/%3E%3C/g%3E%3Cg transform='translate(160 215) scale(2) rotate(2 9 9)'%3E%3Cpath d='M10 4.5C13 2.8 16.5 4.6 16.5 9c0 4.5-2.8 8.5-6.5 8.5S3.5 13.5 3.5 9c0-4.4 3.5-6.2 6.5-4.5z'/%3E%3Cpath d='M10 4.5V1.8M10 3q2.8-1.8 4.5 0'/%3E%3C/g%3E%3Cg transform='translate(213 217) scale(2) rotate(7 9 9)'%3E%3Cpath d='M2 2h14a2.5 2.5 0 0 1 2.5 2.5v6A2.5 2.5 0 0 1 16 13h-6l-5 4v-4H2A2.5 2.5 0 0 1-.5 10.5v-6z' transform='translate(1 1)'/%3E%3C/g%3E%3Cg transform='translate(269 213) scale(2) rotate(16 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(317 218) scale(2) rotate(9 9 9)'%3E%3Cpath d='M1.5 5a10.5 10.5 0 0 0 18 0z'/%3E%3Cpath d='M3.8 6a8 8 0 0 0 13.4 0'/%3E%3Cpath d='M7.5 8.2v.3M12.5 8.2v.3M10 10.8v.3'/%3E%3C/g%3E%3Cg transform='translate(376 217) scale(2) rotate(-10 9 9)'%3E%3Cellipse cx='9' cy='6.5' rx='5' ry='6.5'/%3E%3Cpath d='M9 13l-1.3 1.8h2.6zM9 14.8q-1.8 2.6 0 5.2'/%3E%3C/g%3E%3Cg transform='translate(5 264) scale(2) rotate(-4 9 9)'%3E%3Cpath d='M10 20L2 3.5a18 18 0 0 1 16 0z'/%3E%3Cpath d='M6.5 8.5v.3M12 8.5v.3M9.3 13v.3'/%3E%3C/g%3E%3Cg transform='translate(55 271) scale(2) rotate(-6 9 9)'%3E%3Cpath d='M10 1l2.3 5.3 5.7.5-4.3 3.8 1.3 5.6-5-3-5 3 1.3-5.6L2 6.8l5.7-.5z'/%3E%3C/g%3E%3Cg transform='translate(110 264) scale(2) rotate(-10 9 9)'%3E%3Cpath d='M2 9L18 2l-5.5 15-3.5-6zM9 11l9-9'/%3E%3C/g%3E%3Cg transform='translate(160 272) scale(2) rotate(-10 9 9)'%3E%3Cpath d='M2 2h14a2.5 2.5 0 0 1 2.5 2.5v6A2.5 2.5 0 0 1 16 13h-6l-5 4v-4H2A2.5 2.5 0 0 1-.5 10.5v-6z' transform='translate(1 1)'/%3E%3C/g%3E%3Cg transform='translate(216 264) scale(2) rotate(-12 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(267 270) scale(2) rotate(-7 9 9)'%3E%3Ccircle cx='9' cy='9' r='7.5'/%3E%3Cpath d='M9 1.5v15M1.5 9h15M3.5 4.5q5.5 3 11 0M3.5 13.5q5.5-3 11 0'/%3E%3Cellipse cx='9' cy='9' rx='3.6' ry='7.5'/%3E%3C/g%3E%3Cg transform='translate(321 269) scale(2) rotate(7 9 9)'%3E%3Ccircle cx='9' cy='3.6' r='2.2'/%3E%3Cpath d='M9 5.8V17M9 17c-3.8 0-7-2.8-7-6.2M9 17c3.8 0 7-2.8 7-6.2M5.5 8.5h7'/%3E%3C/g%3E%3Cg transform='translate(371 265) scale(2) rotate(15 9 9)'%3E%3Cpath d='M10 4.5C13 2.8 16.5 4.6 16.5 9c0 4.5-2.8 8.5-6.5 8.5S3.5 13.5 3.5 9c0-4.4 3.5-6.2 6.5-4.5z'/%3E%3Cpath d='M10 4.5V1.8M10 3q2.8-1.8 4.5 0'/%3E%3C/g%3E%3Cg transform='translate(6 324) scale(2) rotate(3 9 9)'%3E%3Cpath d='M5 15a4 4 0 0 1 0-8 5.8 5.8 0 0 1 11-1.4A4.2 4.2 0 0 1 15.5 15z'/%3E%3C/g%3E%3Cg transform='translate(54 318) scale(2) rotate(5 9 9)'%3E%3Crect x='2' y='6' width='11' height='9' rx='2'/%3E%3Cpath d='M13 8h2a2.5 2.5 0 0 1 0 5h-2M5.5 3.5q.9-1.4 0-2.8M9 3.5q.9-1.4 0-2.8'/%3E%3C/g%3E%3Cg transform='translate(109 324) scale(2) rotate(-6 9 9)'%3E%3Cpath d='M5.5 12.5a5.8 5.8 0 1 1 7 0c-.9.8-1.3 1.7-1.3 2.7H6.8c0-1-.4-1.9-1.3-2.7z'/%3E%3Cpath d='M7.5 17.8h3'/%3E%3C/g%3E%3Cg transform='translate(158 320) scale(2) rotate(7 9 9)'%3E%3Cpath d='M10 4.5C13 2.8 16.5 4.6 16.5 9c0 4.5-2.8 8.5-6.5 8.5S3.5 13.5 3.5 9c0-4.4 3.5-6.2 6.5-4.5z'/%3E%3Cpath d='M10 4.5V1.8M10 3q2.8-1.8 4.5 0'/%3E%3C/g%3E%3Cg transform='translate(219 317) scale(2) rotate(3 9 9)'%3E%3Cpath d='M6 14V3.5L14 1.5V12'/%3E%3Ccircle cx='3.8' cy='14' r='2.2'/%3E%3Ccircle cx='11.8' cy='12' r='2.2'/%3E%3C/g%3E%3Cg transform='translate(265 321) scale(2) rotate(7 9 9)'%3E%3Cpath d='M1.5 5a10.5 10.5 0 0 0 18 0z'/%3E%3Cpath d='M3.8 6a8 8 0 0 0 13.4 0'/%3E%3Cpath d='M7.5 8.2v.3M12.5 8.2v.3M10 10.8v.3'/%3E%3C/g%3E%3Cg transform='translate(319 322) scale(2) rotate(-2 9 9)'%3E%3Crect x='1' y='5' width='18' height='12' rx='2.2'/%3E%3Ccircle cx='10' cy='11' r='3.6'/%3E%3Cpath d='M6.5 5l1.8-2.6h3.4L13.5 5'/%3E%3C/g%3E%3Cg transform='translate(378 325) scale(2) rotate(5 9 9)'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3Cpath d='M7.8 7.8L17 17M17 17l1.8-1.8M13.8 13.8l1.8-1.8'/%3E%3C/g%3E%3Cg transform='translate(2 373) scale(2) rotate(-1 9 9)'%3E%3Cpath d='M3.5 11h12l-1.4 7.5H4.9zM3.5 11c-1.8-5 2.4-7 3.6-4.4C8 3 12 3 12.8 6.6c2.6-1.6 4.4 2.4 1.7 4.4'/%3E%3Cpath d='M6.8 11l.9 7.5M9.5 11v7.5M12.2 11l-.9 7.5'/%3E%3C/g%3E%3Cg transform='translate(58 373) scale(2) rotate(-4 9 9)'%3E%3Cpath d='M4.5 8.5a4.5 4.5 0 0 1 9 0z'/%3E%3Cpath d='M5 8.5L9 19l4-10.5'/%3E%3Cpath d='M9 4a2.6 2.6 0 0 1 2.6-2.6'/%3E%3C/g%3E%3Cg transform='translate(112 375) scale(2) rotate(-15 9 9)'%3E%3Cpath d='M1 9q5-5.5 10-5.5T18 9q-2 5.5-7 5.5T1 9z'/%3E%3Cpath d='M17 9l4.5-4.5v9zM5.5 7.5v.3'/%3E%3C/g%3E%3Cg transform='translate(162 377) scale(2) rotate(0 9 9)'%3E%3Cpath d='M2 2h14a2.5 2.5 0 0 1 2.5 2.5v6A2.5 2.5 0 0 1 16 13h-6l-5 4v-4H2A2.5 2.5 0 0 1-.5 10.5v-6z' transform='translate(1 1)'/%3E%3C/g%3E%3Cg transform='translate(216 377) scale(2) rotate(6 9 9)'%3E%3Ccircle cx='9' cy='9' r='7.5'/%3E%3Cpath d='M9 4.8V9l3 1.8'/%3E%3C/g%3E%3Cg transform='translate(265 373) scale(2) rotate(-10 9 9)'%3E%3Cpath d='M1 10a8.8 8.8 0 0 1 17.6 0zM9.8 10v6.5a2 2 0 0 1-4 0M9.8 10V1.5'/%3E%3C/g%3E%3Cg transform='translate(324 373) scale(2) rotate(5 9 9)'%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Ccircle cx='9' cy='3.8' r='2.6'/%3E%3Ccircle cx='9' cy='14.2' r='2.6'/%3E%3Ccircle cx='3.8' cy='9' r='2.6'/%3E%3Ccircle cx='14.2' cy='9' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(377 370) scale(2) rotate(14 9 9)'%3E%3Ccircle cx='9' cy='9' r='3.8'/%3E%3Cpath d='M9 1v2.2M9 14.8V17M1 9h2.2M14.8 9H17M3.3 3.3l1.6 1.6M13.1 13.1l1.6 1.6M14.7 3.3l-1.6 1.6M4.9 13.1l-1.6 1.6'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Baloes: raio 7.5px e sombra rasa, como no WhatsApp Web. */
.chat .chat-msg {
    border-radius: 7.5px;
    box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
    font-size: 0.875rem;
}

.chat .chat-msg-time { font-size: 0.6875rem; color: #667781; margin-top: 2px; }

:root[data-theme="dark"] .chat .chat-msg.out { background: #005c4b; }
:root[data-theme="dark"] .chat .chat-msg.in { background: #202c33; }
:root[data-theme="dark"] .chat .chat-msg-time { color: rgba(255, 255, 255, .55); }

/* Cabecalho da conversa e barra de digitacao no cinza do WhatsApp Web. */
.chat .chat-thread-head { background: #f0f2f5; border-bottom: none; }

.chat .chat-composer { background: #f0f2f5; border-top: none; padding: 8px 16px; align-items: center; }

.chat .chat-composer textarea {
    background: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 0.9375rem;
}

.chat .chat-composer textarea:focus { outline: none; }

.chat .chat-send { background: #00a884; }
.chat .chat-send:hover { background: #008f72; }

:root[data-theme="dark"] .chat .chat-thread-head,
:root[data-theme="dark"] .chat .chat-composer { background: #202c33; }

:root[data-theme="dark"] .chat .chat-composer textarea { background: #2a3942; color: #d1d7db; }

/* Avatares nos grupos (iniciais coloridas ao lado do balao recebido, so
   no primeiro da sequencia), como no WhatsApp Web. O JS das telas de
   conversas monta .chat-row e marca .rep nos repetidos. */
.chat .chat-row { display: flex; align-items: flex-start; gap: 8px; align-self: flex-start; max-width: 75%; }
.chat .chat-row .chat-msg { max-width: 100%; align-self: auto; }
.chat .chat-msg-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 0.6875rem; font-weight: 700; color: #fff; margin-top: 2px; user-select: none; }
.chat .chat-row.rep .chat-msg-avatar { visibility: hidden; }

/* Etiquetas na lista de conversas: em vez de bolinhas, ETIQUETINHAS de
   verdade (ponta + furinho), uma sobrepondo a outra conforme acumulam.
   O HTML continua o mesmo (.cv-dot) — a forma é toda daqui. */
.chat .cv-dots { gap: 0; }

.chat .cv-dots .cv-dot {
    width: 18px;
    height: 11px;
    border-radius: 0 4px 4px 0;
    clip-path: polygon(0 50%, 27% 0, 100% 0, 100% 100%, 27% 100%);
    box-shadow: none;
    position: relative;
    filter: drop-shadow(-1.5px 0 0 var(--white, #fff));
}

.chat .cv-dots .cv-dot::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    width: 3px;
    height: 3px;
    margin-top: -1.5px;
    border-radius: 50%;
    background: var(--white, #fff);
}

.chat .cv-dots .cv-dot + .cv-dot { margin-left: -7px; }

.chat .cv-dots .cv-dot-more { margin-left: 3px; }

/* Links dentro dos balões, no azul do WhatsApp. */
.chat .chat-msg a.chat-link { color: #027eb5; text-decoration: underline; word-break: break-all; }

:root[data-theme="dark"] .chat .chat-msg a.chat-link { color: #53bdeb; }

/* ---------------------------------------------------------------------
   Listas de Leads e Contatos (v3.120.3)
   Cada registro: NOME à esquerda com o STATUS no canto oposto (direita),
   e embaixo a PLATAFORMA e a DATA empilhadas, uma por linha. Nada quebra
   no meio e nada disputa espaço — sem rolagem lateral. As tabelas levam
   `sem-cartoes`: este layout já funciona no celular.
--------------------------------------------------------------------- */
table.tbl-lista td.cel-registro { width: 100%; }

table.tbl-lista .reg-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

table.tbl-lista .reg-nome {
    font-weight: 600;
    color: var(--text-primary);
}

table.tbl-lista .reg-badges {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

table.tbl-lista .reg-topo .badge { white-space: nowrap; }

table.tbl-lista .reg-meta {
    /* Plataforma à esquerda (sob o nome) e data à direita (sob o status). */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

table.tbl-lista .reg-plataforma {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

table.tbl-lista .reg-data {
    white-space: nowrap;
    color: var(--text-tertiary);
}

table.tbl-lista .reg-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

table.tbl-lista td.cel-acoes { white-space: nowrap; }
