/* ============================================
   TEMA, LAYOUT E CORES - Arquivo centralizado
   ============================================ 
   
   Este arquivo contém toda a configuração de:
   - Paleta de cores (variáveis CSS)
   - Temas (dark, light-soft, modus)
   - Layout (sidebar, navbar, main content)
   - Componentes de UI (kanban, modais, formulários)
   
   Última atualização: 5 de maio de 2026
*/

/* ============================================
   VARIÁVEIS CSS GLOBAIS - Cores da marca
   ============================================ */
:root {
    /* Cor primária da marca (usada em botões, links ativos) */
    --brand-primary: #FBB03B;
    --brand-primary-dark: #e09a2f;
    --brand-primary-text: #1A1A1A;

    /* Cor secundária da marca */
    --brand-secondary: #FFEECB;
    --brand-secondary-dark: #FBB03B;

    /* Premium Dark Mode — superfícies */
    --premium-bg: #1A1A1A;
    --premium-sidebar: #111315;
    --premium-surface: #212529;
    --premium-surface-hover: #2D3238;
    --premium-border-subtle: rgba(255, 255, 255, 0.05);
    --premium-text-muted: #9ca3af;

    /* Kanban — acentos por etapa (sem hex no template) */
    --kanban-accent-0: var(--brand-primary);
    --kanban-accent-1: #3B82F6;
    --kanban-accent-2: #22C55E;
    --kanban-accent-3: #8B5CF6;
    --kanban-accent-4: #EC4899;
    --kanban-accent-5: #6B7280;

    /* Cores neutras */
    --brand-dark: #1A1A1A;
    --brand-light: #ffffff;
    --brand-gray: #6c757d;
    --brand-gray-light: #eef1f5;

    /* Variáveis para tema Abelha (Bee) */
    --bee-yellow: #FFD700;
    --bee-orange: #FFA500;
    --bee-black: #1a1a2e;
    --bee-light: #FFF8DC;
}

/* Tema Abelha (fundo da página de login) */
[data-theme="bee"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
    overflow: hidden;
}

[data-theme="bee"] .bee {
    position: absolute;
    font-size: 2rem;
    animation: beeFly linear infinite;
    opacity: 0.6;
}
[data-theme="bee"] .bee-1 { left: 10%; animation-duration: 8s; animation-delay: 0s; }
[data-theme="bee"] .bee-2 { left: 30%; animation-duration: 10s; animation-delay: 2s; font-size: 1.5rem; }
[data-theme="bee"] .bee-3 { left: 55%; animation-duration: 7s; animation-delay: 4s; }
[data-theme="bee"] .bee-4 { left: 80%; animation-duration: 9s; animation-delay: 1s; font-size: 1.8rem; }

@keyframes beeFly {
    0%   { bottom: -60px; transform: rotate(-45deg) translateX(0); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { bottom: 110vh; transform: rotate(-45deg) translateX(80px); opacity: 0; }
}

/* ============================================
   ESTILOS DE LAYOUT GLOBAL
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body, html {
    height: 100%;
    margin: 0;
    font-family: 'Inter', 'Roboto', system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

/* Premium Dark (tema escuro padrão, sem data-theme) */
html[data-bs-theme="dark"]:not([data-theme]) body,
html[data-bs-theme="dark"]:not([data-theme]) main {
    background-color: var(--premium-bg) !important;
    color: #e5e7eb;
}

html[data-bs-theme="dark"]:not([data-theme]) .sidebar {
    background-color: var(--premium-sidebar) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .navbar.app-navbar {
    background-color: var(--premium-bg) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .border-end,
html[data-bs-theme="dark"]:not([data-theme]) .border-bottom,
html[data-bs-theme="dark"]:not([data-theme]) .sidebar-footer.border-top {
    border-color: var(--premium-border-subtle) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .sidebar .nav-link.active {
    background-color: rgba(251, 176, 59, 0.1) !important;
    color: var(--brand-primary) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .form-control,
html[data-bs-theme="dark"]:not([data-theme]) .form-select {
    background-color: var(--premium-surface) !important;
    border: 1px solid var(--premium-border-subtle) !important;
    border-radius: 8px !important;
    color: #e5e7eb;
}

html[data-bs-theme="dark"]:not([data-theme]) .search-bar .form-control {
    border-radius: 8px !important;
    height: 44px;
}

html[data-bs-theme="dark"]:not([data-theme]) .search-bar .form-control::placeholder {
    color: var(--premium-text-muted) !important;
}

/* Variáveis globais de componentes (listas, modais, chat) */
html[data-bs-theme="dark"]:not([data-theme]) {
    --card-bg: var(--premium-surface);
    --text-primary: #e5e7eb;
    --text-secondary: var(--premium-text-muted);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-yellow: var(--brand-primary);
    --chat-layout-root-bg: var(--premium-bg);
    --chat-sidebar-bg: var(--premium-sidebar);
    --chat-layout-border: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"]:not([data-theme]) .bg-dark {
    background-color: var(--premium-sidebar) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .bg-dark-subtle {
    background-color: var(--premium-surface) !important;
    color: var(--text-primary) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .text-light,
html[data-bs-theme="dark"]:not([data-theme]) .modal-title {
    color: #e5e7eb !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .text-secondary {
    color: var(--premium-text-muted) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .border-secondary,
html[data-bs-theme="dark"]:not([data-theme]) .border-bottom.border-secondary,
html[data-bs-theme="dark"]:not([data-theme]) .modal-header.border-secondary,
html[data-bs-theme="dark"]:not([data-theme]) .modal-footer.border-secondary {
    border-color: var(--premium-border-subtle) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

html[data-bs-theme="dark"]:not([data-theme]) .section-header .text-secondary {
    font-size: 14px;
}

html[data-bs-theme="dark"]:not([data-theme]) .card {
    background-color: var(--premium-surface);
    border: 1px solid var(--premium-border-subtle);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

html[data-bs-theme="dark"]:not([data-theme]) .card .form-control {
    background-color: rgba(0, 0, 0, 0.2) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .table {
    --bs-table-bg: transparent;
    --bs-table-color: #e5e7eb;
    --bs-table-border-color: var(--premium-border-subtle);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
    --bs-table-hover-color: #fff;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
}

html[data-bs-theme="dark"]:not([data-theme]) .table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--premium-text-muted);
    border-bottom-color: var(--premium-border-subtle);
    background: transparent;
}

html[data-bs-theme="dark"]:not([data-theme]) .table td {
    border-color: var(--premium-border-subtle);
    vertical-align: middle;
}

html[data-bs-theme="dark"]:not([data-theme]) .modal-content {
    background-color: var(--premium-surface) !important;
    border: 1px solid var(--premium-border-subtle);
    border-radius: 12px;
    color: #e5e7eb;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

html[data-bs-theme="dark"]:not([data-theme]) .modal-header,
html[data-bs-theme="dark"]:not([data-theme]) .modal-footer {
    border-color: var(--premium-border-subtle) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .dropdown-menu,
html[data-bs-theme="dark"]:not([data-theme]) .dropdown-menu-dark {
    background-color: var(--premium-surface) !important;
    border: 1px solid var(--premium-border-subtle);
    border-radius: 8px;
}

html[data-bs-theme="dark"]:not([data-theme]) .dropdown-item {
    color: #e5e7eb;
    border-radius: 6px;
}

html[data-bs-theme="dark"]:not([data-theme]) .dropdown-item:hover,
html[data-bs-theme="dark"]:not([data-theme]) .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

html[data-bs-theme="dark"]:not([data-theme]) .btn-warning {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary-text) !important;
    border-radius: 8px;
    font-weight: 600;
}

html[data-bs-theme="dark"]:not([data-theme]) .btn-warning:hover {
    background-color: var(--brand-primary-dark) !important;
    border-color: var(--brand-primary-dark) !important;
    color: var(--brand-primary-text) !important;
}

html[data-bs-theme="dark"]:not([data-theme]) .btn-outline-warning {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    border-radius: 8px;
}

html[data-bs-theme="dark"]:not([data-theme]) .btn-outline-warning:hover {
    background-color: rgba(251, 176, 59, 0.12);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

html[data-bs-theme="dark"]:not([data-theme]) .btn-outline-light {
    border-radius: 8px;
    border-color: var(--premium-border-subtle);
    color: #e5e7eb;
}

html[data-bs-theme="dark"]:not([data-theme]) .page-link {
    background-color: var(--premium-surface);
    border-color: var(--premium-border-subtle);
    color: #e5e7eb;
    border-radius: 8px;
}

html[data-bs-theme="dark"]:not([data-theme]) .page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--brand-primary-text);
}

html[data-bs-theme="dark"]:not([data-theme]) .page-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

html[data-bs-theme="dark"]:not([data-theme]) .nav-tabs-dark .nav-link,
html[data-bs-theme="dark"]:not([data-theme]) .nav-tabs .nav-link {
    color: var(--premium-text-muted);
    border-radius: 8px 8px 0 0;
}

html[data-bs-theme="dark"]:not([data-theme]) .nav-tabs .nav-link.active {
    background-color: var(--premium-surface);
    border-color: var(--premium-border-subtle);
    color: var(--brand-primary);
}

html[data-bs-theme="dark"]:not([data-theme]) .list-group-item {
    background-color: var(--premium-surface);
    border-color: var(--premium-border-subtle);
    color: #e5e7eb;
}

html[data-bs-theme="dark"]:not([data-theme]) .list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

html[data-bs-theme="dark"]:not([data-theme]) .toast {
    background-color: var(--premium-surface) !important;
    border: 1px solid var(--premium-border-subtle) !important;
    color: #e5e7eb !important;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

html[data-bs-theme="dark"]:not([data-theme]) pre.bg-dark,
html[data-bs-theme="dark"]:not([data-theme]) pre {
    background-color: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid var(--premium-border-subtle);
    border-radius: 8px;
    color: #e5e7eb;
}

html[data-bs-theme="dark"]:not([data-theme]) .form-label {
    font-size: 0.875rem;
    color: var(--premium-text-muted);
}

body,
.navbar,
.sidebar,
main {
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

/* ============================================
   SIDEBAR - Premium Dark
   Escala tipográfica (UX — sidebar denso):
   - Marca: 14px bold uppercase
   - Navegação: 14px (text-sm)
   - Usuário: 12px semibold (text-xs)
   - Cargo/meta: 10px (suporte visual)
   ============================================ */

.sidebar {
    /* px explícitos — evita 16px do Bootstrap (--bs-nav-link-font-size: 1rem) */
    --sidebar-text-brand: 14px;
    --sidebar-text-nav: 14px;
    --sidebar-text-user: 12px;
    --sidebar-text-meta: 10px;

    width: 240px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    font-size: 14px;
    background-color: var(--premium-sidebar, #111315);
    border-right: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.05));
    color: var(--premium-text-muted, #9ca3af);
}

.sidebar > hr,
.sidebar hr {
    border: 0;
    border-top: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.05));
    margin: 0;
    opacity: 1;
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    text-align: left;
}

.sidebar-header .logo-placeholder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-start;
    font-size: 14px;
}

.sidebar-header .logo-placeholder a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
}

.sidebar-header .logo-placeholder img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* Marca — 14px + bold + uppercase */
.sidebar-brand-label {
    display: block;
    font-size: 14px !important;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.25;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 1rem 1rem;
    font-size: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sidebar-nav.nav {
    --bs-nav-link-font-size: 14px;
    --bs-nav-link-padding-y: 0.625rem;
    --bs-nav-link-padding-x: 0.875rem;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

/* Navegação — 14px (sobrescreve Bootstrap .nav-link = 1rem) */
.sidebar .nav-link,
.sidebar-footer .nav-link,
.sidebar-footer .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    font-size: 14px !important;
    font-weight: 500;
    line-height: 1.25;
    color: var(--premium-text-muted, #9ca3af) !important;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    margin-bottom: 0.125rem;
    border: none;
    background: transparent;
}

.sidebar .nav-link > span,
.sidebar-footer .nav-link > span:not(.sidebar-user-meta):not(.badge) {
    font-size: 14px !important;
}

.sidebar .nav-link > i.bi:first-of-type,
.sidebar-footer .nav-link > i.bi:first-of-type:not(.ms-auto) {
    width: 1.125rem;
    flex-shrink: 0;
    text-align: center;
    font-size: 14px !important;
    opacity: 0.9;
}

.sidebar .nav-link > i.bi.ms-auto,
.sidebar .nav-link .flex-shrink-0 > i.bi {
    font-size: 0.75rem;
    opacity: 0.7;
}

.sidebar .nav-link:hover:not(.active),
.sidebar-footer .nav-link:hover:not(.active),
.sidebar-footer .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
}

.sidebar .nav-link.active,
.sidebar-footer .nav-link.active {
    background-color: rgba(251, 176, 59, 0.1) !important;
    color: var(--brand-primary) !important;
    font-weight: 600; /* semibold no item ativo */
}

.sidebar .nav-link.active > i.bi:first-of-type {
    color: var(--brand-primary);
}

/* (Cadastros: ver bloco .sidebar-cadastros-* abaixo, espelhando Funil) */

/* ============================================
   SIDEBAR — bloco Funil (árvore com guia âmbar)
   ============================================ */
.sidebar-funil-block {
    margin-bottom: 0.25rem;
}

.sidebar-funil-root-row,
.sidebar-grupo-funil-row {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Funil pai — expandido: pill âmbar + texto/ícone/chevron dourados */
.sidebar-funil-root-row.is-expanded {
    background-color: rgba(251, 176, 59, 0.12) !important;
    color: var(--brand-primary) !important;
    font-weight: 600;
}

.sidebar-funil-root-row.is-expanded > i.bi:first-of-type {
    color: var(--brand-primary) !important;
    opacity: 1;
}

.sidebar-funil-root-chevron-btn,
.sidebar-grupo-chevron-btn {
    color: var(--premium-text-muted, #9ca3af);
    line-height: 1;
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-funil-root-row.is-expanded .sidebar-funil-root-chevron-btn,
.sidebar-funil-root-row.is-expanded .sidebar-funil-root-chevron {
    color: var(--brand-primary) !important;
}

.sidebar-funil-root-chevron-btn:hover,
.sidebar-grupo-chevron-btn:hover {
    color: var(--brand-primary) !important;
}

.sidebar-grupo-chevron,
.sidebar-funil-root-chevron {
    transition: transform 0.2s ease, color 0.2s ease;
    font-size: 14px;
}

.sidebar-grupo-chevron-btn[aria-expanded="true"] .sidebar-grupo-chevron,
.sidebar-funil-root-chevron-btn[aria-expanded="true"] .sidebar-funil-root-chevron {
    transform: rotate(180deg);
}

/* Painéis: toggle CSS (sem collapse aninhado do Bootstrap) */
.sidebar-funil-panel,
.sidebar-grupo-panel {
    display: none;
}

.sidebar-funil-panel.is-open,
.sidebar-grupo-panel.is-open {
    display: block;
}

/* Árvore com linha vertical âmbar */
.sidebar-funil-panel.is-open {
    margin-top: 0.125rem;
    padding: 0.125rem 0 0.25rem 0.75rem;
    margin-left: 0.625rem;
    border-left: 2px solid var(--brand-primary);
}

.sidebar-funil-tree {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* Grupo (ex.: Comercial) */
.sidebar-grupo-funil-row {
    padding: 0.5rem 0.75rem !important;
    margin-bottom: 0 !important;
}

.sidebar-grupo-funil-row.active {
    background-color: rgba(251, 176, 59, 0.14) !important;
    color: var(--brand-primary) !important;
    font-weight: 600;
}

.sidebar-grupo-funil-row.active .sidebar-grupo-icon,
.sidebar-grupo-funil-row.active .text-truncate {
    color: var(--brand-primary) !important;
}

.sidebar-grupo-funil-row.active .sidebar-grupo-chevron-btn,
.sidebar-grupo-funil-row.active .sidebar-grupo-chevron {
    color: var(--brand-primary) !important;
}

.sidebar-grupo-icon {
    width: 1.125rem;
    flex-shrink: 0;
    text-align: center;
    font-size: 14px !important;
}

/* Funis dentro do grupo */
.sidebar-grupo-panel {
    padding: 0.125rem 0 0.25rem 0.5rem;
    margin-left: 0.375rem;
}

.sidebar-funil-link {
    padding: 0.45rem 0.75rem !important;
    font-size: 14px !important;
    margin-bottom: 0 !important;
}

.sidebar-funil-link span {
    font-size: 14px !important;
}

.sidebar-funil-add-link {
    color: var(--premium-text-muted, #9ca3af) !important;
    opacity: 0.85;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.sidebar-funil-add-link:hover,
.sidebar-funil-add-link:focus-visible {
    color: var(--brand-primary) !important;
    opacity: 1;
}

.sidebar-funil-add-link--grupo {
    margin-top: 0.25rem;
    font-weight: 500;
}

.sidebar-funil-add-link i {
    font-size: 14px !important;
}

.sidebar .funil-grupo-item,
.sidebar .funil-item {
    margin-bottom: 0.0625rem;
}

.sidebar-funil-block .funil-config-btn {
    color: var(--premium-text-muted, #9ca3af) !important;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.sidebar-funil-block .funil-grupo-item:hover .funil-config-btn,
.sidebar-funil-block .funil-item:hover .funil-config-btn,
.sidebar-funil-block .funil-config-btn:focus-visible {
    opacity: 0.7;
}

.sidebar-funil-block .funil-config-btn:hover {
    opacity: 1 !important;
    color: var(--brand-primary) !important;
}

.sidebar-grupo-funil-row.active .funil-config-btn {
    color: var(--brand-primary) !important;
}

/* ============================================
   SIDEBAR — bloco Cadastros (mesmo padrão do Funil)
   ============================================ */
.sidebar-cadastros-block {
    margin-bottom: 0.25rem;
}

.sidebar-cadastros-root-row {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-cadastros-root-row.is-expanded {
    background-color: rgba(251, 176, 59, 0.12) !important;
    color: var(--brand-primary) !important;
    font-weight: 600;
}

.sidebar-cadastros-root-row.is-expanded > i.bi:first-of-type {
    color: var(--brand-primary) !important;
    opacity: 1;
}

.sidebar-cadastros-chevron-btn {
    color: var(--premium-text-muted, #9ca3af);
    line-height: 1;
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-cadastros-root-row.is-expanded .sidebar-cadastros-chevron-btn,
.sidebar-cadastros-root-row.is-expanded .sidebar-cadastros-chevron {
    color: var(--brand-primary) !important;
}

.sidebar-cadastros-chevron-btn:hover {
    color: var(--brand-primary) !important;
}

.sidebar-cadastros-chevron {
    transition: transform 0.2s ease, color 0.2s ease;
    font-size: 14px;
}

.sidebar-cadastros-chevron-btn[aria-expanded="true"] .sidebar-cadastros-chevron {
    transform: rotate(180deg);
}

.sidebar-cadastros-panel {
    display: none;
}

.sidebar-cadastros-panel.is-open {
    display: block;
    margin-top: 0.125rem;
    padding: 0.125rem 0 0.25rem 0.75rem;
    margin-left: 0.625rem;
    border-left: 2px solid var(--brand-primary);
}

.sidebar-cadastros-tree {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-cadastros-link {
    padding: 0.5rem 0.75rem !important;
    font-size: 14px !important;
    margin-bottom: 0 !important;
}

.sidebar-cadastros-link span {
    font-size: 14px !important;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.05)) !important;
    gap: 0.25rem;
    font-size: 14px;
}

.sidebar-footer .nav-link {
    padding: 0.625rem 0.75rem;
}

.sidebar-user-trigger {
    gap: 0.75rem !important;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--brand-primary-text, #1a1a1a);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
}

.sidebar-user-meta {
    min-width: 0;
    line-height: 1.3;
}

/* Rodapé — nome: 12px semibold */
.sidebar-user-name {
    font-size: 12px !important;
    font-weight: 600;
    color: #fff;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
}

/* Rodapé — cargo: 10px, informação de suporte */
.sidebar-user-role {
    font-size: 10px !important;
    font-weight: 400;
    color: var(--premium-text-muted, #6b7280);
    display: block;
    line-height: 1.2;
    margin-top: 0.125rem;
}

.sidebar-footer .dropdown-menu {
    background-color: var(--premium-surface, #212529);
    border: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
}

.sidebar-footer #notificacao-count {
    font-size: 10px !important;
    font-weight: 600;
}

/* Fallback global (fora da sidebar também) */
.nav-link {
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* ============================================
   BRANDING - Logo e identidade visual
   ============================================ */

.logo-placeholder {
    font-size: 1.2rem;
    letter-spacing: 1px;
}

/* Sidebar: não herdar 1.2rem do logo-placeholder global */
.sidebar .logo-placeholder {
    font-size: 14px;
}

.right {
    text-align: right;
}

/* Deixa o logo branco (tema escuro) */
.logo-placeholder img {
    filter: brightness(0) invert(1);
}

/* Deixa o logo preto (tema claro) */
[data-theme="light-soft"] .logo-placeholder img {
    filter: brightness(0);
}

/* Deixa o logo com tom âmbar/dourado (tema Modus) */
[data-theme="modus"] .logo-placeholder img {
    filter: brightness(0) saturate(100%) invert(60%) sepia(80%) saturate(500%) hue-rotate(10deg);
}

/* ============================================
   BARRA DE BUSCA
   ============================================ */

.search-bar input {
    max-width: 1000px;
    height: 50px;
    color: #ccc;
}

.search-bar input::placeholder {
    color: #6c757d;
}

/* ============================================
   NAVBAR — controles com altura e tipografia uniformes
   ============================================ */
.app-navbar {
    --app-navbar-control-h: 40px;
}

.app-navbar .search-bar .form-control {
    height: var(--app-navbar-control-h);
    min-height: var(--app-navbar-control-h);
    padding: 0 1rem;
    font-size: 14px;
    line-height: 1.25;
    border-radius: 8px;
}

.app-navbar .app-navbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-sizing: border-box;
    min-height: var(--app-navbar-control-h);
    height: var(--app-navbar-control-h);
    padding: 0 1rem;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: none;
    border-radius: 8px;
    flex-shrink: 0;
}

.app-navbar .app-navbar-btn--icon {
    width: var(--app-navbar-control-h);
    min-width: var(--app-navbar-control-h);
    padding: 0;
}

.app-navbar .app-navbar-btn > i.bi {
    font-size: 1.125rem;
    line-height: 1;
}

.app-navbar .kanban-navbar-actions,
.app-navbar .kanban-navbar-filter {
    align-items: center;
}

.app-navbar .kanban-filter-actions .btn-novo-contato {
    height: auto;
    min-height: 38px;
    width: auto;
    min-width: 0;
}

/* ============================================
   TEMA CLARO SUAVIZADO
   ============================================ */

[data-theme="light-soft"] {
    --soft-bg: #dde1e7;
    --soft-surface: var(--brand-gray-light);
    --soft-input: #d2d8e0;
    --soft-border: #b7c0cc;
    /* Texto escuro para superfícies claras (kanban, listas, main) */
    --soft-text: #1a2332;
    --soft-text-muted: #5a6578;
    --soft-accent: var(--brand-primary);
    --soft-accent-text: #1a2332;
    /* Variáveis para modais e kanban */
    --accent-yellow: var(--brand-primary);
    --border-color: var(--soft-border);
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
}

[data-theme="light-soft"] .form-control::placeholder,
[data-theme="light-soft"] .form-select::placeholder {
    color: var(--soft-text-muted) !important;
}

[data-theme="light-soft"] body,
[data-theme="light-soft"] .navbar,
[data-theme="light-soft"] .sidebar,
[data-theme="light-soft"] main {
    background-color: var(--soft-bg) !important;
    color: var(--soft-text) !important;
}

[data-theme="light-soft"] .sidebar,
[data-theme="light-soft"] .navbar,
[data-theme="light-soft"] .dropdown-menu {
    background-color: var(--soft-surface) !important;
}

[data-theme="light-soft"] .border-end,
[data-theme="light-soft"] .border-bottom,
[data-theme="light-soft"] .border-top,
[data-theme="light-soft"] hr,
[data-theme="light-soft"] .dropdown-menu {
    border-color: var(--soft-border) !important;
}

[data-theme="light-soft"] .nav-link,
[data-theme="light-soft"] .fw-bold,
[data-theme="light-soft"] h1,
[data-theme="light-soft"] h2,
[data-theme="light-soft"] h3,
[data-theme="light-soft"] .dropdown-item {
    color: var(--soft-text) !important;
}

[data-theme="light-soft"] .text-secondary,
[data-theme="light-soft"] .text-light-emphasis,
[data-theme="light-soft"] small,
[data-theme="light-soft"] p {
    color: var(--soft-text-muted) !important;
}

[data-theme="light-soft"] .form-control {
    background-color: var(--soft-input) !important;
    color: var(--soft-text) !important;
    border-color: var(--soft-border) !important;
}

[data-theme="light-soft"] .form-control::placeholder {
    color: var(--soft-text-muted) !important;
}

[data-theme="light-soft"] .form-select {
    background-color: var(--soft-input) !important;
    color: var(--soft-text) !important;
    border-color: var(--soft-border) !important;
}

[data-theme="light-soft"] .avatar,
[data-theme="light-soft"] .nav-link.active {
    background-color: var(--soft-accent) !important;
    color: var(--soft-accent-text) !important;
}

/* Sidebar: sem bloco de fundo no item ativo (resto da app mantém a regra acima — abas/modais) */
[data-theme="light-soft"] .sidebar .nav-link.active {
    background-color: transparent !important;
    color: var(--soft-accent) !important;
}

/* Kanban ainda usa classes “escuras” no HTML — texto claro sobre fundo claro quebra legibilidade */
[data-theme="light-soft"] .kanban-viewport .text-light {
    color: var(--soft-text) !important;
}

[data-theme="light-soft"] .dropdown-item:hover {
    background-color: #dfe5ec !important;
    color: var(--soft-text) !important;
}

[data-theme="light-soft"] .dropdown-item.active-theme {
    background-color: #cfd7e2 !important;
    color: var(--soft-text) !important;
}

[data-theme="light-soft"] .vr {
    background-color: var(--soft-border) !important;
    opacity: 1 !important;
}

[data-theme="light-soft"] .bg-dark,
[data-theme="light-soft"] .bg-dark-subtle {
    background-color: var(--soft-surface) !important;
}

[data-theme="light-soft"] .text-white,
[data-theme="light-soft"] .text-dark {
    color: var(--soft-text) !important;
}

/* ============================================
   TEMA MODUS - Creme & Âmbar
   ============================================ */

[data-theme="modus"] {
    --modus-bg: #FFEECB;
    --modus-surface: #FFF4DA;
    --modus-input: #ffe4b0;
    --modus-border: #e8d4a8;
    --modus-text: #3a2a00;
    --modus-text-muted: #7a5c20;
    --modus-font: var(--brand-secondary);
    --modus-accent: var(--brand-secondary-dark);
    --modus-accent-dark: #a87c08;
}

[data-theme="modus"] body,
[data-theme="modus"] .navbar,
[data-theme="modus"] .sidebar,
[data-theme="modus"] main {
    background-color: var(--modus-bg) !important;
    color: var(--modus-text) !important;
}

[data-theme="modus"] .sidebar,
[data-theme="modus"] .navbar,
[data-theme="modus"] .dropdown-menu {
    background-color: var(--modus-surface) !important;
}

[data-theme="modus"] .border-end,
[data-theme="modus"] .border-bottom,
[data-theme="modus"] .border-top,
[data-theme="modus"] hr,
[data-theme="modus"] .dropdown-menu {
    border-color: var(--modus-border) !important;
}

[data-theme="modus"] .nav-link,
[data-theme="modus"] .fw-bold,
[data-theme="modus"] h1,
[data-theme="modus"] h2,
[data-theme="modus"] h3,
[data-theme="modus"] .dropdown-item {
    color: var(--modus-text) !important;
}

[data-theme="modus"] .text-secondary,
[data-theme="modus"] .text-light-emphasis,
[data-theme="modus"] small,
[data-theme="modus"] p {
    color: var(--modus-text-muted) !important;
}

[data-theme="modus"] .form-control {
    background-color: var(--modus-input) !important;
    color: var(--modus-text) !important;
    border-color: var(--modus-border) !important;
}

[data-theme="modus"] .form-control::placeholder {
    color: var(--modus-text-muted) !important;
}

[data-theme="modus"] .form-select {
    background-color: var(--modus-input) !important;
    color: var(--modus-text) !important;
    border-color: var(--modus-border) !important;
}

[data-theme="modus"] .avatar,
[data-theme="modus"] .nav-link.active {
    background-color: var(--modus-accent) !important;
    color: var(--modus-font) !important;
}

[data-theme="modus"] .sidebar .nav-link.active {
    background-color: transparent !important;
    color: var(--modus-accent-dark) !important;
}

[data-theme="modus"] .kanban-viewport .text-light {
    color: var(--modus-text) !important;
}

[data-theme="modus"] .dropdown-item:hover {
    background-color: var(--modus-accent) !important;
    color: var(--modus-font) !important;
}

[data-theme="modus"] .dropdown-item.active-theme {
    background-color: var(--modus-accent-dark) !important;
    color: var(--modus-font) !important;
}

[data-theme="modus"] .vr {
    background-color: var(--modus-border) !important;
    opacity: 1 !important;
}

[data-theme="modus"] .bg-dark,
[data-theme="modus"] .bg-dark-subtle {
    background-color: var(--modus-surface) !important;
}

[data-theme="modus"] .text-white,
[data-theme="modus"] .text-dark {
    color: var(--modus-text) !important;
}

/* Indicador visual do tema ativo */
.dropdown-item.active-theme::after {
    content: " ✓";
    font-weight: 700;
    margin-left: auto;
}

/* ============================================
   SEÇÃO HEADERS E BOTÕES
   ============================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.btn-novo-contato {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
}

[data-bs-theme="dark"] .section-title {
    color: #f8f9fa;
}

[data-bs-theme="dark"] .btn-novo-contato.bg-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .btn-novo-contato {
    background-color: var(--brand-primary);
    color: var(--brand-primary-text);
}

[data-bs-theme="dark"] .btn-novo-contato:hover {
    background-color: var(--brand-primary-dark);
}

[data-theme="light-soft"] .section-title {
    color: var(--soft-text);
}

[data-theme="light-soft"] .btn-novo-contato {
    background-color: var(--brand-primary);
    color: var(--brand-light);
}

[data-theme="light-soft"] .btn-novo-contato:hover {
    background-color: var(--brand-primary-dark);
}

[data-theme="modus"] .section-title {
    color: #2a1e00;
}

[data-theme="modus"] .btn-novo-contato {
    background-color: var(--brand-secondary-dark);
    color: var(--brand-secondary);
}

[data-theme="modus"] .btn-novo-contato:hover {
    background-color: #a87c08;
}

/* ============================================
   CHAT — lista + sala (chat/templates/chat/*.html)
   Layout em duas colunas + mensagens com scroll interno
   ============================================ */

.chat-page-fill {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--chat-layout-border, #343a40);
    border-radius: 8px;
    background: var(--chat-layout-root-bg, #1a1d23);
}

.chat-sidebar {
    width: 300px;
    min-width: 240px;
    max-width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--chat-sidebar-bg, #1a1d23);
    border-right: 1px solid var(--chat-layout-border, #343a40);
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--chat-layout-border, #343a40);
    flex-shrink: 0;
}

.chat-sidebar-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #e9ecef;
}

/* WhatsApp — ao lado dos botões de novo chat/grupo; verde oficial */
.chat-btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #25d366;
    color: #fff !important;
    text-decoration: none !important;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.chat-btn-whatsapp:hover {
    background: #1ebe57;
    color: #fff !important;
    transform: scale(1.04);
}

.chat-btn-whatsapp:focus-visible {
    outline: 2px solid #25d366;
    outline-offset: 2px;
}

.chat-btn-whatsapp i {
    font-size: 1.2rem;
    line-height: 1;
}

.chat-sidebar-header-actions {
    flex-shrink: 0;
}

.chat-sidebar-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--chat-layout-border, #343a40);
    flex-shrink: 0;
}

.chat-sidebar-search input {
    width: 100%;
    border-radius: 6px;
    border: 1px solid #495057;
    background: #212529;
    color: #e9ecef;
    padding: 8px 10px;
    font-size: 0.9rem;
}

.chat-sidebar-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-sidebar-tabs-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-sidebar-tabs {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid var(--chat-layout-border, #343a40);
    background: rgba(0, 0, 0, 0.12);
}

.chat-sidebar-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    color: var(--premium-text-muted, #868e96);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.chat-sidebar-tab i {
    font-size: 0.95rem;
}

.chat-sidebar-tab:hover {
    color: #ced4da;
    background: rgba(255, 255, 255, 0.04);
}

.chat-sidebar-tab.active {
    color: #e9ecef;
    background: rgba(255, 255, 255, 0.06);
}

.chat-sidebar-tab--internal.active {
    border-bottom-color: #fbb03b;
}

.chat-sidebar-tab--external.active {
    border-bottom-color: #25d366;
}

.chat-sidebar-tab--external.active i {
    color: #25d366;
}

.chat-sidebar-tab-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 1px 6px;
    min-width: 1.25rem;
    text-align: center;
}

.chat-sidebar-tab.active .chat-sidebar-tab-count {
    color: #adb5bd;
}

.chat-sidebar-tab-panels {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-sidebar-tab-panel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-sidebar-tab-panel.active {
    display: flex;
    flex-direction: column;
}

.chat-room-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    text-decoration: none;
    color: #adb5bd;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.15s ease;
}

.chat-room-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e9ecef;
}

.chat-room-item.active {
    background: rgba(251, 176, 59, 0.14);
    color: #e9ecef;
}

.chat-room-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
}

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

.chat-room-avatar--grupo,
.chat-wa-avatar--grupo,
.chat-header-avatar--grupo {
    box-shadow: 0 0 0 2.5px #25d366;
}

.chat-room-item--grupo .chat-room-name {
    color: #e9ecef;
}

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

.chat-room-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-last {
    font-size: 0.78rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    font-size: 0.72rem;
}

.chat-room-time {
    color: #6c757d;
}

.chat-room-badge {
    font-size: 0.7rem;
}

.chat-sidebar-section-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    text-align: center;
    font-size: 0.78rem;
    color: #6c757d;
}

.chat-sidebar-section-empty i {
    font-size: 1.25rem;
    opacity: 0.35;
}

.chat-room-item--external {
    border-left: 3px solid transparent;
}

.chat-room-item--external:hover,
.chat-room-item--external.active {
    border-left-color: #25d366;
}

.chat-room-avatar--wa {
    background: rgba(37, 211, 102, 0.18);
    color: #25d366;
}

.chat-sidebar-wa-tag {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #25d366;
    background: rgba(37, 211, 102, 0.12);
    border-radius: 4px;
    padding: 1px 5px;
}

.chat-room-item--clickable {
    cursor: pointer;
}

.chat-wa-sidebar-head--nested {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

[data-theme="light-soft"] .chat-sidebar-tabs {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light-soft"] .chat-sidebar-tab {
    color: #6c757d;
}

[data-theme="light-soft"] .chat-sidebar-tab.active {
    color: var(--brand-primary-text, #212529);
}

[data-theme="modus"] .chat-sidebar-tabs {
    background: rgba(42, 30, 0, 0.05);
}

[data-theme="modus"] .chat-sidebar-tab.active {
    color: #2a1e00;
}

/* Modais chat — Nova conversa / Novo grupo (avatar pequeno + nome ao lado) */
.chat-modal-user-list {
    max-height: min(52vh, 380px);
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.04);
}

[data-bs-theme="dark"] .chat-modal-user-list {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.25);
}

.chat-modal-user-list--tight {
    padding: 4px;
}

.user-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    min-height: 40px;
}

.user-list-item--select {
    cursor: default;
}

#newIndividualModal .user-list-item {
    cursor: pointer;
}

#newIndividualModal .user-list-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] #newIndividualModal .user-list-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-list-item--select:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-bs-theme="dark"] .user-list-item--select:hover {
    background: rgba(255, 255, 255, 0.04);
}

.user-list-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-list-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-list-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-list-item--select .user-list-name {
    cursor: pointer;
}

.user-list-check {
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 0.5rem;
}

.user-list-check .form-check-input {
    margin-top: 0;
}

.chat-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #212529;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--chat-layout-border, #343a40);
    flex-shrink: 0;
    background: var(--chat-sidebar-bg, #1a1d23);
}

.chat-header-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 600;
    color: #fff;
}

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

.chat-header-info h5 {
    margin: 0;
    font-size: 1rem;
    color: #e9ecef;
}

.chat-header-info small {
    color: #adb5bd;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

.message-item {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.message-item.mine {
    flex-direction: row-reverse;
}

.message-item.mine > div:last-child {
    text-align: right;
}

/* Bolhas: recebida (outrem) vs enviada (eu) — cores distintas */
.message-item > .message-avatar + div {
    max-width: min(78%, 560px);
    min-width: 0;
    padding: 10px 14px 12px;
    border-radius: 14px;
    border: 1px solid transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.message-item:not(.mine) > .message-avatar + div {
    background: #343a40;
    border-color: #495057;
}

.message-item.mine > .message-avatar + div {
    background: rgba(251, 176, 59, 0.22);
    border-color: rgba(251, 176, 59, 0.42);
}

.message-item .message-header strong {
    color: #f8f9fa;
    font-size: 0.85rem;
}

.message-item:not(.mine) .message-content a {
    color: #9ec5fe;
}

.message-item.mine .message-content a {
    color: #cfe2ff;
}

.message-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    overflow: hidden;
}

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

.message-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 4px;
}

.message-header span {
    font-size: 0.75rem;
    color: #adb5bd;
}

.message-content {
    color: #e9ecef;
    word-break: break-word;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.message-actions button,
.message-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #adb5bd;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

.message-actions button i,
.message-action-btn i {
    font-size: 1rem;
    line-height: 1;
}

.message-actions button:hover,
.message-action-btn:hover {
    color: #fbb03b;
    background: rgba(251, 176, 59, 0.12);
}

.message-actions button[title='Excluir mensagem']:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
}

.message-content .chat-reply-quote {
    display: block;
    margin: 0 0 0.5rem;
    padding: 0;
    max-width: 100%;
    background: transparent;
    border: none;
}

.chat-reply-quote-inner {
    padding: 0.5rem 0.625rem;
    border-left: 4px solid rgba(26, 26, 26, 0.45);
    border-radius: 8px;
    background: rgba(26, 26, 26, 0.14);
}

.message-item.mine .chat-reply-quote-inner {
    border-left-color: rgba(26, 26, 26, 0.5);
    background: rgba(26, 26, 26, 0.16);
}

.message-item:not(.mine) .chat-reply-quote-inner {
    border-left-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.22);
}

.chat-reply-quote-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    line-height: 1.2;
}

.chat-reply-quote-head i {
    font-size: 0.8rem;
    line-height: 1;
}

.chat-reply-quote-author,
.chat-reply-quote-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1a1a1a;
}

.message-item:not(.mine) .chat-reply-quote-author,
.message-item:not(.mine) .chat-reply-quote-label {
    color: #e5e7eb;
}

.chat-reply-quote-snippet,
.chat-reply-quote-text {
    margin: 0.3rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: rgba(26, 26, 26, 0.62);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.message-item:not(.mine) .chat-reply-quote-snippet,
.message-item:not(.mine) .chat-reply-quote-text {
    color: rgba(229, 231, 235, 0.65);
}

.message-item.mine .chat-reply-quote .small.text-secondary {
    color: rgba(26, 26, 26, 0.7) !important;
}

.message-item.mine .chat-reply-quote .small:not(.text-secondary) {
    color: rgba(26, 26, 26, 0.62);
}

.message-content .chat-forward-quote {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    max-width: 100%;
}

.chat-forward-quote-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    color: rgba(26, 26, 26, 0.72);
}

.chat-forward-quote-head i {
    font-size: 0.85rem;
    line-height: 1;
}

.chat-forward-quote-body {
    margin: 0;
    padding: 0.5rem 0 0;
    border-top: 1px solid rgba(26, 26, 26, 0.22);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    color: #1a1a1a;
    word-break: break-word;
}

.message-item:not(.mine) .chat-forward-quote-head {
    color: rgba(229, 231, 235, 0.72);
}

.message-item:not(.mine) .chat-forward-quote-body {
    border-top-color: rgba(255, 255, 255, 0.14);
    color: #e5e7eb;
}

.empty-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6c757d;
    padding: 48px 24px;
}

.empty-messages i {
    font-size: 3rem;
    opacity: 0.35;
    margin-bottom: 12px;
}

/* Barra de cadastros acima do composer (fora de .chat-input-area = igual estrutura ao Kanban) */
.chat-main > .chat-cadastro-toolbar {
    flex-shrink: 0;
    padding: 12px 16px 10px;
    border-top: 1px solid var(--chat-layout-border, #343a40);
    background: var(--chat-sidebar-bg, #1a1d23);
}

.chat-main > .chat-input-area,
.chat-wa-main > .chat-input-area {
    flex-shrink: 0;
    padding: 0 16px 16px;
    background: transparent;
    border-top: none;
}

.chat-cadastro-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mic-btn {
    color: #adb5bd;
}

.mic-btn:hover {
    color: #e9ecef;
}

.chat-main.chat-main-empty {
    justify-content: center;
    align-items: center;
}

.chat-empty {
    text-align: center;
    color: #adb5bd;
    padding: 48px 24px;
    max-width: 420px;
}

.chat-empty i {
    font-size: 4rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 16px;
}

.chat-empty h4 {
    color: #e9ecef;
    font-size: 1.15rem;
}

/* Variáveis por tema Claro / Modus — mantém hierarquia do chat legível */
[data-theme="light-soft"] {
    --chat-layout-root-bg: var(--soft-bg);
    --chat-sidebar-bg: var(--soft-surface);
    --chat-layout-border: var(--soft-border);
}

[data-theme="light-soft"] .chat-container,
[data-theme="light-soft"] .chat-sidebar,
[data-theme="light-soft"] .chat-header,
[data-theme="light-soft"] .chat-main > .chat-input-area,
[data-theme="light-soft"] .chat-wa-main > .chat-input-area,
[data-theme="light-soft"] .chat-main > .chat-cadastro-toolbar {
    color: var(--soft-text);
}

[data-theme="light-soft"] .chat-sidebar-header h5,
[data-theme="light-soft"] .chat-header-info h5,
[data-theme="light-soft"] .chat-empty h4 {
    color: var(--soft-text);
}

[data-theme="light-soft"] .chat-main {
    background: var(--soft-bg);
}

[data-theme="light-soft"] .chat-sidebar-search input {
    background: var(--soft-input);
    color: var(--soft-text);
    border-color: var(--soft-border);
}

[data-theme="light-soft"] .chat-room-item {
    color: var(--soft-text-muted);
}

[data-theme="light-soft"] .chat-room-item:hover,
[data-theme="light-soft"] .chat-room-item.active {
    color: var(--soft-text);
}

[data-theme="light-soft"] .chat-modal-user-list {
    border-color: var(--soft-border);
    background: #ffffff;
}

[data-theme="light-soft"] .user-list-name {
    color: var(--soft-text);
}

[data-theme="light-soft"] .message-content {
    color: var(--soft-text);
}

[data-theme="light-soft"] .message-item:not(.mine) > .message-avatar + div {
    background: #e4e9f0;
    border-color: #b8c2cf;
    box-shadow: 0 1px 2px rgba(26, 35, 50, 0.08);
}

[data-theme="light-soft"] .message-item.mine > .message-avatar + div {
    background: rgba(251, 176, 59, 0.28);
    border-color: rgba(251, 176, 59, 0.55);
}

[data-theme="light-soft"] .message-item .message-header strong {
    color: var(--soft-text);
}

[data-theme="light-soft"] .chat-input-area .editor-toolbar,
[data-theme="light-soft"] .nota-inline-chat-wrap .editor-toolbar,
[data-theme="light-soft"] .chat-wa-main .chat-input-area .editor-toolbar {
    background-color: var(--soft-input);
    border-color: var(--soft-border);
}

[data-theme="light-soft"] .chat-input-area .chat-editor,
[data-theme="light-soft"] .nota-inline-chat-wrap .chat-editor,
[data-theme="light-soft"] .chat-wa-main .chat-input-area .chat-editor {
    background-color: var(--soft-input);
    color: var(--soft-text);
    border-color: var(--soft-border);
}

[data-theme="light-soft"] .chat-input-area .chat-editor:focus,
[data-theme="light-soft"] .nota-inline-chat-wrap .chat-editor:focus,
[data-theme="light-soft"] .chat-wa-main .chat-input-area .chat-editor:focus {
    border-color: var(--brand-primary, #fbb03b);
}

[data-theme="light-soft"] .chat-input-area .editor-toolbar button:hover,
[data-theme="light-soft"] .nota-inline-chat-wrap .editor-toolbar button:hover,
[data-theme="light-soft"] .chat-wa-main .chat-input-area .editor-toolbar button:hover {
    background-color: #dfe5ec !important;
    color: var(--soft-text) !important;
}

[data-theme="light-soft"] .chat-input-area .editor-toolbar button.active,
[data-theme="light-soft"] .nota-inline-chat-wrap .editor-toolbar button.active,
[data-theme="light-soft"] .chat-wa-main .chat-input-area .editor-toolbar button.active {
    background-color: #0d6efd !important;
    color: #fff !important;
}

[data-theme="light-soft"] .chat-input-area .editor-send-btn,
[data-theme="light-soft"] .nota-inline-chat-wrap .editor-send-btn,
[data-theme="light-soft"] .chat-wa-main .chat-input-area .editor-send-btn {
    background-color: var(--brand-primary, #fbb03b) !important;
    color: var(--brand-light, #ffffff) !important;
}

[data-theme="light-soft"] .chat-input-area .editor-send-btn:hover,
[data-theme="light-soft"] .nota-inline-chat-wrap .editor-send-btn:hover,
[data-theme="light-soft"] .chat-wa-main .chat-input-area .editor-send-btn:hover {
    background-color: var(--brand-primary-dark, #f39a0b) !important;
    color: var(--brand-light, #ffffff) !important;
}

[data-theme="modus"] {
    --chat-layout-root-bg: var(--modus-bg);
    --chat-sidebar-bg: var(--modus-surface);
    --chat-layout-border: var(--modus-border);
}

[data-theme="modus"] .chat-main {
    background: var(--modus-bg);
}

[data-theme="modus"] .chat-sidebar-search input {
    background: var(--modus-input);
    color: var(--modus-text);
    border-color: var(--modus-border);
}

[data-theme="modus"] .chat-room-item {
    color: var(--modus-text-muted);
}

[data-theme="modus"] .chat-room-item:hover,
[data-theme="modus"] .chat-room-item.active {
    color: var(--modus-text);
}

[data-theme="modus"] .chat-modal-user-list {
    border-color: var(--modus-border);
    background: rgba(255, 255, 255, 0.55);
}

[data-theme="modus"] .user-list-name {
    color: var(--modus-text);
}

[data-theme="modus"] .message-content {
    color: var(--modus-text);
}

[data-theme="modus"] .message-item:not(.mine) > .message-avatar + div {
    background: #fff8e8;
    border-color: #e8d4a8;
    box-shadow: 0 1px 2px rgba(58, 42, 0, 0.08);
}

[data-theme="modus"] .message-item.mine > .message-avatar + div {
    background: rgba(251, 176, 59, 0.32);
    border-color: rgba(216, 162, 11, 0.65);
}

[data-theme="modus"] .message-item .message-header strong {
    color: var(--modus-text);
}

[data-theme="modus"] .chat-input-area .editor-toolbar,
[data-theme="modus"] .nota-inline-chat-wrap .editor-toolbar,
[data-theme="modus"] .chat-wa-main .chat-input-area .editor-toolbar {
    background-color: var(--modus-input);
    border-color: var(--modus-border);
}

[data-theme="modus"] .chat-input-area .chat-editor,
[data-theme="modus"] .nota-inline-chat-wrap .chat-editor,
[data-theme="modus"] .chat-wa-main .chat-input-area .chat-editor {
    background-color: var(--modus-input);
    color: var(--modus-text);
    border-color: var(--modus-border);
}

[data-theme="modus"] .chat-input-area .chat-editor:focus,
[data-theme="modus"] .nota-inline-chat-wrap .chat-editor:focus,
[data-theme="modus"] .chat-wa-main .chat-input-area .chat-editor:focus {
    border-color: var(--modus-accent-dark, #a87c08);
}

[data-theme="modus"] .chat-input-area .editor-toolbar button:hover,
[data-theme="modus"] .nota-inline-chat-wrap .editor-toolbar button:hover,
[data-theme="modus"] .chat-wa-main .chat-input-area .editor-toolbar button:hover {
    background-color: rgba(251, 176, 59, 0.22) !important;
    color: var(--modus-text) !important;
}

[data-theme="modus"] .chat-input-area .editor-toolbar button.active,
[data-theme="modus"] .nota-inline-chat-wrap .editor-toolbar button.active,
[data-theme="modus"] .chat-wa-main .chat-input-area .editor-toolbar button.active {
    background-color: #0d6efd !important;
    color: #fff !important;
}

[data-theme="modus"] .chat-input-area .editor-send-btn,
[data-theme="modus"] .nota-inline-chat-wrap .editor-send-btn,
[data-theme="modus"] .chat-wa-main .chat-input-area .editor-send-btn {
    background-color: var(--brand-secondary-dark, #fbb03b) !important;
    color: var(--brand-secondary, #ffebcf) !important;
}

[data-theme="modus"] .chat-input-area .editor-send-btn:hover,
[data-theme="modus"] .nota-inline-chat-wrap .editor-send-btn:hover,
[data-theme="modus"] .chat-wa-main .chat-input-area .editor-send-btn:hover {
    background-color: #a87c08 !important;
    color: var(--brand-secondary, #ffebcf) !important;
}

[data-theme="modus"] .chat-sidebar-header h5,
[data-theme="modus"] .chat-header-info h5,
[data-theme="modus"] .chat-empty h4 {
    color: var(--modus-text);
}

/* ============================================
   KANBAN - Layout e componentes (Premium Dark)
   ============================================ */

/* Encadeia com main > .flex-grow-1 (base.html): altura útil sem depender de % caprichoso */
.kanban-viewport {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', 'Roboto', system-ui, sans-serif;
}

.kanban-wrapper {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.kanban-board {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0.5rem 1rem;
    flex: 1;
    align-items: stretch;
    min-width: 0;
    width: 100%;
    scroll-behavior: smooth;
    cursor: grab;
    scrollbar-width: thin;
    scrollbar-color: rgba(251, 176, 59, 0.45) rgba(255, 255, 255, 0.06);
}

.kanban-board::-webkit-scrollbar {
    height: 8px;
}

.kanban-board::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    margin: 0 0.5rem;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: rgba(251, 176, 59, 0.45);
    border-radius: 4px;
}

.kanban-board::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 176, 59, 0.65);
}

.kanban-board.kanban-board--panning {
    cursor: grabbing;
    scroll-behavior: auto;
    user-select: none;
}

.kanban-board.kanban-board--panning .kanban-card {
    pointer-events: none;
}

.kanban-column {
    min-width: 320px;
    max-width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 12px;
    background: rgba(33, 37, 41, 0.45);
    border: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.05));
}

.kanban-column.kanban-stage-0 { --kanban-stage-accent: var(--kanban-accent-0); }
.kanban-column.kanban-stage-1 { --kanban-stage-accent: var(--kanban-accent-1); }
.kanban-column.kanban-stage-2 { --kanban-stage-accent: var(--kanban-accent-2); }
.kanban-column.kanban-stage-3 { --kanban-stage-accent: var(--kanban-accent-3); }
.kanban-column.kanban-stage-4 { --kanban-stage-accent: var(--kanban-accent-4); }
.kanban-column.kanban-stage-5 { --kanban-stage-accent: var(--kanban-accent-5); }

.kanban-column-body > .kanban-card:first-child {
    margin-top: 5px;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 1rem;
}

.kanban-column-title-group {
    min-width: 0;
}

.kanban-column-header .etapa-nome {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    min-width: 0;
}

.kanban-column-title-group .etapa-nome-edit {
    flex: 1 1 auto;
    min-width: 3rem;
}

.kanban-stage-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--kanban-stage-accent, var(--brand-primary));
}

.kanban-etapa-count {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
}

.kanban-etapa-nova-op {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.05));
}

.kanban-etapa-nova-op .btn-nova-op-etapa {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--brand-primary);
    text-decoration: none;
    border: none;
    background: transparent;
    padding: 0;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.kanban-etapa-nova-op .btn-nova-op-etapa:hover {
    color: var(--brand-secondary);
    opacity: 0.9;
}

.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    position: relative;
    padding: 0 0.75rem 1rem;
    -ms-overflow-style: none;
    scrollbar-width: thin;
}

.kanban-column-body::-webkit-scrollbar {
    width: 4px;
}

.kanban-column-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.sticky-top-link {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 4px 0;
}

.kanban-card {
    position: relative;
    cursor: grab;
    background-color: var(--premium-surface, #212529);
    border: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.05));
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: var(--kanban-stage-accent, var(--brand-primary));
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.35), 0 4px 6px -4px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    background-color: var(--premium-surface-hover, #2D3238);
    box-shadow: 0 14px 20px -4px rgba(0, 0, 0, 0.45);
}

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

.kanban-card.selected {
    box-shadow: 0 0 0 2px var(--brand-primary), 0 10px 15px -3px rgba(0, 0, 0, 0.35);
}

.kanban-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.35;
}

.kanban-card-meta {
    font-size: 0.875rem;
    color: var(--premium-text-muted, #9ca3af);
    line-height: 1.45;
}

.kanban-card-meta i {
    opacity: 0.85;
    margin-right: 0.25rem;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--premium-border-subtle, rgba(255, 255, 255, 0.05));
}

.kanban-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-card-actions .kanban-action-wa {
    color: #25d366;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.kanban-card-actions .kanban-action-wa:hover {
    transform: scale(1.1);
}

.kanban-card-actions .kanban-action-email {
    color: rgba(255, 238, 203, 0.55);
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
}

.kanban-card-actions .kanban-action-email:hover {
    color: var(--brand-secondary);
    transform: scale(1.1);
}

.kanban-card-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
}

.kanban-etiqueta-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    margin: 0 0.25rem 0.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--etiqueta-color, var(--brand-primary));
    background-color: color-mix(in srgb, var(--etiqueta-color, var(--brand-primary)) 10%, transparent);
}

.kanban-valor-faixa {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    background: rgba(251, 176, 59, 0.1);
    color: var(--brand-primary);
}

.kanban-column-body.drag-over {
    outline: 2px dashed rgba(251, 176, 59, 0.45);
    outline-offset: -4px;
    border-radius: 8px;
}

/* Navbar Kanban — dropdown Ordenação e filtro */
.app-navbar .kanban-filter-dropdown-panel {
    min-width: min(100vw - 2rem, 320px);
    max-width: 380px;
    padding: 14px 16px;
    background-color: #212529;
}

.app-navbar .kanban-filter-dropdown-head {
    margin-bottom: 10px;
}

.app-navbar .kanban-filter-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.app-navbar .kanban-filter-divider {
    margin: 12px 0;
    opacity: 1;
}

.app-navbar .kanban-filter-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.app-navbar .kanban-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.app-navbar .kanban-filter-actions .btn-novo-contato {
    min-width: 0;
}

/*
 * Filtro Kanban: mesmo fundo dos campos (.bg-dark-subtle ≈ #212529), Claro/Modus inclusos.
 */
[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel {
    background-color: #212529 !important;
    border: 1px solid #495057 !important;
    color: #e9ecef !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-dropdown-head,
[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-section-title {
    color: #adb5bd !important;
}

[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-label {
    color: #e9ecef !important;
}

[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-field,
[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .form-select,
[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .form-control {
    background-color: #212529 !important;
    color: #e9ecef !important;
    border-color: #495057 !important;
}

[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-field:focus,
[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .form-select:focus,
[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .form-control:focus {
    border-color: var(--brand-primary, #fbb03b) !important;
    box-shadow: 0 0 0 0.2rem rgba(251, 176, 59, 0.25);
}

[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel hr,
[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-divider {
    border-color: #495057 !important;
    opacity: 1;
}

[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-action-secondary {
    background-color: transparent !important;
    color: #e9ecef !important;
    border: 1px solid #6c757d !important;
}

[data-theme="light-soft"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-action-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel {
    background-color: #212529 !important;
    border: 1px solid #495057 !important;
    color: #e9ecef !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-dropdown-head,
[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-section-title {
    color: #adb5bd !important;
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-label {
    color: #e9ecef !important;
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-field,
[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .form-select,
[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .form-control {
    background-color: #212529 !important;
    color: #e9ecef !important;
    border-color: #495057 !important;
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-field:focus,
[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .form-select:focus,
[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .form-control:focus {
    border-color: var(--brand-primary, #fbb03b) !important;
    box-shadow: 0 0 0 0.2rem rgba(251, 176, 59, 0.25);
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel hr,
[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-divider {
    border-color: #495057 !important;
    opacity: 1;
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-action-secondary {
    background-color: transparent !important;
    color: #e9ecef !important;
    border: 1px solid #6c757d !important;
}

[data-theme="modus"] .app-navbar .kanban-filter-dropdown-panel .kanban-filter-action-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Coluna de nova etapa */
.add-etapa-column {
    min-width: 320px;
    max-width: 360px;
    flex-shrink: 0;
    border: 2px dashed var(--premium-border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    background: transparent;
}

.add-etapa-column h6 {
    color: var(--premium-text-muted, #6b7280);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.add-etapa-column .form-control,
.add-etapa-column .form-select {
    border-radius: 8px !important;
}

/* Etapa nome editável */
.etapa-nome {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}

.etapa-nome:hover {
    background: rgba(255, 255, 255, 0.1);
}

.etapa-nome-edit {
    display: none;
    padding: 2px 4px;
    font-size: inherit;
    font-weight: bold;
}

/* ============================================
   COMPOSER RICO — mesmo bloco visual no chat e na aba Notas (Kanban)
   #notaComposerMount usa .chat-input-area; edição inline usa .nota-inline-chat-wrap
   ============================================ */

.chat-input-area {
    width: 100%;
    box-sizing: border-box;
}

.chat-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.chat-input-wrapper .file-name {
    width: 100%;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Toolbar + área editável: um único “cartão” escuro (#212529)
   Estilo dos botões alinhado ao chat interno (notes-tabs.css também reforça fora da inbox). */
.chat-input-area .editor-toolbar,
.nota-inline-chat-wrap .editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    align-items: center;
    flex-wrap: wrap;
    background-color: #212529;
    border: 1px solid #495057;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.chat-input-area .editor-toolbar button,
.nota-inline-chat-wrap .editor-toolbar button {
    background: none;
    border: none;
    color: #adb5bd;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1;
    transition: background-color 0.15s, color 0.15s;
}

.chat-input-area .editor-toolbar button:hover,
.nota-inline-chat-wrap .editor-toolbar button:hover {
    background-color: #495057 !important;
    color: #e9ecef !important;
    box-shadow: none !important;
}

.chat-input-area .editor-toolbar button.active,
.nota-inline-chat-wrap .editor-toolbar button.active {
    background-color: #0d6efd !important;
    color: #fff !important;
    box-shadow: none !important;
}

.chat-input-area .editor-toolbar button.active:hover,
.nota-inline-chat-wrap .editor-toolbar button.active:hover {
    background-color: #0b5ed7 !important;
    color: #fff !important;
}

.chat-input-area .chat-editor,
.nota-inline-chat-wrap .chat-editor {
    width: 100%;
    box-sizing: border-box;
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 48px 10px 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid #495057;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background-color: #212529;
    color: #e9ecef;
}

.chat-input-area textarea.chat-editor {
    display: block;
    resize: vertical;
    font-family: inherit;
}

.nota-inline-chat-wrap .chat-editor {
    min-height: 120px;
    max-height: 260px;
}

.chat-input-area .chat-editor:focus,
.nota-inline-chat-wrap .chat-editor:focus {
    outline: none;
    border-color: #0d6efd;
}

.chat-input-area div[style*="position:relative"],
.nota-inline-chat-wrap div[style*="position:relative"] {
    position: relative;
}

.chat-compose-shell {
    position: relative;
}

/* Prévia de resposta (estilo WhatsApp) — acima do campo no mesmo cartão */
.chat-reply-compose {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 6px 10px 4px;
    background: rgba(15, 20, 25, 0.92);
    border: 1px solid #495057;
    border-top: none;
    border-bottom: none;
    border-radius: 0;
}

.chat-reply-compose-accent {
    width: 4px;
    flex-shrink: 0;
    border-radius: 2px;
    background: #53bdeb;
}

.chat-reply-compose-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.chat-reply-compose-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: #53bdeb;
    line-height: 1.2;
}

.chat-reply-compose-text {
    font-size: 0.85rem;
    color: rgba(233, 236, 239, 0.78);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.chat-reply-compose-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 6px;
    object-fit: cover;
    background: #2a2f36;
}

.chat-reply-compose-thumb--icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 1.35rem;
}

.chat-reply-compose-close {
    align-self: center;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #adb5bd;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
}

.chat-reply-compose-close:hover {
    color: #fff;
}

.chat-compose-shell.has-reply .chat-editor,
.chat-compose-shell.has-reply .wa-compose-textarea {
    border-top: none;
}

.editor-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
}

/* Layout legado (WhatsApp / Kanban): botão absoluto no canto do compose */
.chat-compose-shell:not(:has(.chat-editor-row)) .editor-send-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
}

/* Chat interno premium: botão na mesma linha do campo (sem duplicar ícone) */
.chat-editor-row > .editor-send-btn {
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    z-index: auto !important;
}

.chat-input-area .editor-send-btn,
.nota-inline-chat-wrap .editor-send-btn {
    width: 40px !important;
    height: 40px !important;
    background-color: var(--brand-primary, #fbb03b) !important;
    color: var(--brand-dark, #1a1a2e) !important;
    opacity: 1 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.chat-input-area .editor-send-btn:hover,
.nota-inline-chat-wrap .editor-send-btn:hover {
    background-color: var(--brand-primary-dark, #f39a0b) !important;
    color: var(--brand-dark, #1a1a2e) !important;
    opacity: 1 !important;
}

.recording-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid #495057;
}

.chat-input-area .recording-indicator,
.nota-inline-chat-wrap .recording-indicator {
    background: rgba(52, 58, 64, 0.96);
    color: #e9ecef;
}

.recording-indicator.active {
    display: flex;
}

.chat-compose-shell.recording-active .chat-editor,
.chat-compose-shell.recording-active .editor-send-btn {
    opacity: 0;
    pointer-events: none;
}

.recording-indicator--inline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    min-height: 100%;
    border-radius: 0 0 8px 8px;
    justify-content: flex-end;
    padding: 10px 12px;
    z-index: 3;
    border-top: none;
}

.recording-indicator--inline .recording-time {
    margin-right: auto;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.recording-action {
    border: none;
    border-radius: 999px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.recording-action-stop {
    background: rgba(108, 117, 125, 0.25);
    color: #e9ecef;
}

.recording-action-stop:hover {
    background: rgba(108, 117, 125, 0.4);
}

.recording-action-send {
    background: #25d366;
    color: #102316;
}

.recording-action-send:hover {
    background: #1fbc5a;
}

.recording-action i {
    font-size: 0.95rem;
}

.recording-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    animation: chat-recording-pulse 1s ease infinite;
}

@keyframes chat-recording-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.chat-toolbar-sep {
    display: inline-block;
    width: 1px;
    align-self: stretch;
    min-height: 20px;
    margin: 0 4px;
    border-left: 1px solid var(--border-color, rgba(255, 255, 255, 0.22));
    background: transparent;
}

.nota-inline-chat-wrap {
    width: 100%;
}

/* Botão clip + input file: overlay invisível (evita quebra por input{width:100%} global) */
.file-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    opacity: 0;
    cursor: pointer;
    font-size: 0 !important;
    line-height: 0 !important;
    z-index: 2;
}

.file-input-wrapper button {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

/* ============================================
   MODAIS
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1060;
}

.modal-container {
    background: var(--card-bg);
    width: 600px;
    padding: 24px;
    border-radius: 8px;
    border-left: 6px solid var(--accent-yellow, #fbc02d);
    color: var(--text-primary);
    font-family: sans-serif;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.modal-header-custom h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
}

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

/* ============================================
   STEPPER
   ============================================ */

.stepper {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.step span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-secondary);
}

.step.active span {
    background: var(--step-color, var(--accent-yellow));
    border-color: var(--step-color, var(--accent-yellow));
    color: #000;
}

.step p {
    margin: 0;
    font-size: 0.75rem;
}

.step.active {
    color: var(--step-color, var(--accent-yellow));
}

/* Etapa atual badge no modal */
.etapa-atual-info {
    margin: 10px 0;
}

.etapa-atual-badge {
    transition: all 0.3s ease;
    background: var(--card-bg, rgba(0, 0, 0, 0.2));
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.modal-form h3 {
    font-size: 1rem;
    margin: 15px 0 10px;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 15px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-row {
    display: flex;
    gap: 15px;
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-icon input {
    padding-left: 35px;
}

/*
 * Campos de texto/número/data etc. — não aplicar a checkbox, radio, range, botões:
 * o seletor antigo input:not([type=file]) pegava .form-check-input e esticava
 * / embaciava os checks (Bootstrap 5).
 */
input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="hidden"]):not([type="image"]):not([type="color"]),
select,
textarea {
    width: 100%;
    padding: 10px;
    background: var(--card-bg, #2d2d2d);
    border: 1px solid var(--border-color, #444);
    border-radius: 8px;
    color: var(--text-primary, #ffffff);
    margin-top: 5px;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: 8px !important;
}

input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="hidden"]):not([type="image"]):not([type="color"]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-yellow);
}

/*
 * Mesma “caixa” que o Bootstrap usa para .form-control / .form-select:
 * a regra genérica acima usa padding:10px e pode destoar altura do select vs input.
 */
input.form-control:not(textarea):not(.form-control-sm):not(.form-control-lg),
select.form-select:not(.form-select-sm):not(.form-select-lg) {
    box-sizing: border-box;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding-top: 0.375rem !important;
    padding-bottom: 0.375rem !important;
    padding-left: 0.75rem !important;
    line-height: 1.5;
}

input.form-control:not(textarea):not(.form-control-sm):not(.form-control-lg) {
    padding-right: 0.75rem !important;
}

select.form-select:not(.form-select-sm):not(.form-select-lg) {
    padding-right: 2.25rem !important;
}

input.form-control.form-control-sm:not(textarea),
select.form-select.form-select-sm {
    box-sizing: border-box;
    min-height: calc(1.5em + 0.5rem + 2px);
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    padding-left: 0.5rem !important;
    line-height: 1.5;
}

input.form-control.form-control-sm:not(textarea) {
    padding-right: 0.5rem !important;
}

select.form-select.form-select-sm {
    padding-right: 2rem !important;
}

input.form-control.form-control-lg:not(textarea),
select.form-select.form-select-lg {
    box-sizing: border-box;
    min-height: calc(1.5em + 1rem + 2px);
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 1rem !important;
    line-height: 1.5;
}

input.form-control.form-control-lg:not(textarea) {
    padding-right: 1rem !important;
}

select.form-select.form-select-lg {
    padding-right: 3rem !important;
}

/* Tamanho explícito — não aplicar em .form-switch (Bootstrap usa ~2em de largura) */
.form-check:not(.form-switch) .form-check-input {
    width: 1em;
    max-width: 1em;
    height: 1em;
    margin-top: 0.25em;
    flex-shrink: 0;
    vertical-align: top;
}
