/* ==========================================================================
   JURISCONTROL - DESIGN SYSTEM & STYLING
   Tema: Azul Profissional de Confiança
   ========================================================================== */

/* 1. VARIÁVEIS E TOKENS DE DESIGN */
:root {
    /* Paleta Azul de Confiança */
    --primary-950: #061122;
    --primary-900: #091a33;
    --primary-800: #0f2b54;
    --primary-700: #153c74;
    --primary-600: #1c529e;
    --primary-500: #256ad4;
    --primary-400: #4e8cf5;
    --primary-200: #a2c6fd;
    --primary-100: #d6e6fe;
    --primary-50: #f0f6ff;

    /* Cores de Destaque e Status */
    --accent: #0284c7; /* Azul Céu Vibrante */
    --success: #10b981; /* Verde Sucesso */
    --success-light: #d1fae5;
    --warning: #f59e0b; /* Laranja Alerta (Publicações não lidas) */
    --warning-light: #fef3c7;
    --danger: #ef4444; /* Vermelho Urgente (Prazos/Prioridade Alta) */
    --danger-light: #fee2e2;
    --info: #6366f1; /* Índigo */
    --info-light: #e0e7ff;
    
    /* Cores Neutras */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --surface-card: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Efeitos e Tipografia */
    --font-title: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(9, 26, 51, 0.06), 0 2px 4px -1px rgba(9, 26, 51, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(9, 26, 51, 0.08), 0 4px 6px -2px rgba(9, 26, 51, 0.04);
    --shadow-focus: 0 0 0 4px rgba(37, 106, 212, 0.15);
    
    /* Transições */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. RESET E ESTILOS GLOBAIS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout Geral - Grid */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    height: 100dvh;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

/* 3. BARRA LATERAL (SIDEBAR) */
.sidebar {
    background: linear-gradient(180deg, var(--primary-950) 0%, var(--primary-900) 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    height: 100vh;
    height: 100dvh;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--primary-200);
}

.logo-img {
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.logo-text {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
}

.logo-text span {
    color: var(--primary-400);
}

/* Navegação da Sidebar */
.sidebar-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    transition: var(--transition);
}

.nav-item:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item:hover svg {
    transform: translateX(2px);
    color: var(--primary-200);
}

.nav-item.active {
    color: #ffffff;
    background-color: var(--primary-700);
    box-shadow: 0 4px 12px rgba(6, 17, 34, 0.15);
}

.nav-item.active svg {
    color: var(--primary-200);
}

.nav-item .badge {
    position: absolute;
    right: 0.75rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* Footer da Sidebar */
.sidebar-footer {
    padding: 1.25rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0, 0, 0, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-400) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-title);
    color: #ffffff;
    margin-right: 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* 4. CABEÇALHO (TOPBAR) */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden; /* scroll ocorre por seção, não no container global */
}

.topbar {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-title-section h1 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-900);
}

.current-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Caixa de Busca Global */
.search-box {
    position: relative;
    width: 280px;
    transition: var(--transition);
}

.search-box:focus-within {
    width: 340px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-light);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--primary-50);
    font-size: 0.9rem;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    background-color: #ffffff;
    border-color: var(--primary-400);
    box-shadow: var(--shadow-focus);
}

/* Ícone de Notificações com Dropdown */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    transition: var(--transition);
}

.notification-bell:hover {
    background-color: var(--primary-50);
    color: var(--primary-600);
}

.notification-bell svg {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

/* Dropdown de Notificações */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 120;
}

.notification-dropdown.active {
    display: flex;
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary-50);
}

.dropdown-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-900);
}

.dropdown-list {
    max-height: 280px;
    overflow-y: auto;
}

.notification-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    transition: var(--transition);
}

.notification-item:hover {
    background-color: #f8fafc;
}

.notification-item.unread {
    background-color: var(--primary-50);
}

.notification-item-text {
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.notification-item-time {
    color: var(--text-light);
    font-size: 0.75rem;
}

.empty-state-text {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* 5. SEÇÕES DINÂMICAS (TABS) E ESTRUTURA GERAL */
.content-body {
    padding: 2rem;
    flex: 1;
    min-height: 0;        /* permite encolher dentro do flex pai */
    overflow-y: auto;     /* scroll normal para todas as abas */
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.35s ease;
}

.tab-panel.active {
    display: block;
}

/* A aba de chat precisa de display flex para o layout de coluna funcionar */
#tab-chat.active {
    display: flex !important;
}

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

/* 6. COMPONENTES VISUAIS COMUNS */
/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--primary-600);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-700);
    box-shadow: 0 4px 12px rgba(28, 82, 158, 0.2);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-info {
    background-color: var(--info);
    color: #ffffff;
}

.btn-info:hover {
    background-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-600);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem;
    transition: var(--transition);
}

.btn-text:hover {
    color: var(--primary-800);
    text-decoration: underline;
}

.btn-icon-only {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.btn-icon-only:hover {
    background-color: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-600);
}

/* Badges (Crachás de Status) */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-info { background-color: var(--info-light); color: var(--info); }
.badge-muted { background-color: #f1f5f9; color: var(--text-muted); }

/* Containers de Cards */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
}

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

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

.card-header h2 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-900);
}

.card-body {
    padding: 1.5rem;
}

/* Ações de Seção (Barra de Filtros) */
.section-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    flex-grow: 1;
    align-items: center;
    flex-wrap: wrap;
}

.select-filter {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    background-color: #ffffff;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.select-filter:focus {
    border-color: var(--primary-400);
    box-shadow: var(--shadow-focus);
}

/* 7. DETALHES DE ABA: DASHBOARD */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.card-unread::before { background-color: var(--warning); }
.card-tasks::before { background-color: var(--info); }
.card-contracts::before { background-color: var(--success); }
.card-clients::before { background-color: var(--primary-500); }
.card-processes::before { background-color: var(--warning); }
.card-revenue::before { background-color: #10b981; }

.metric-content {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value {
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-900);
    margin: 0.25rem 0;
}

.metric-desc {
    font-size: 0.75rem;
    color: var(--text-light);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background-color: var(--primary-50);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-600);
}

.card-unread .metric-icon { background-color: var(--warning-light); color: var(--warning); }
.card-tasks .metric-icon { background-color: var(--info-light); color: var(--info); }
.card-contracts .metric-icon { background-color: var(--success-light); color: var(--success); }

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

.quick-actions-bar {
    background-color: var(--primary-900);
    color: #ffffff;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow-md);
}

.quick-actions-bar h3 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Listagem de itens no Dashboard */
.recent-publications-list,
.recent-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recent-pub-item {
    border-left: 3px solid var(--warning);
    background-color: var(--primary-50);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    transition: var(--transition);
}

.recent-pub-item:hover {
    background-color: var(--primary-100);
}

.recent-pub-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.recent-pub-process {
    color: var(--primary-800);
}

.recent-pub-date {
    color: var(--text-muted);
}

.recent-pub-content {
    font-size: 0.85rem;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-task-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.recent-task-item:last-child {
    border-bottom: none;
}

.recent-task-item.completed span {
    text-decoration: line-through;
    color: var(--text-light);
}

.recent-task-check {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.recent-task-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.recent-task-title {
    font-size: 0.85rem;
    font-weight: 600;
}

.recent-task-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
}

.recent-task-priority {
    font-weight: 700;
}

.priority-Alta { color: var(--danger); }
.priority-Média { color: var(--warning); }
.priority-Baixa { color: var(--success); }

/* 8. TABELAS DE DADOS (CLIENTES) */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background-color: var(--primary-50);
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-900);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: var(--primary-50)/30;
}

.client-name-cell {
    font-weight: 600;
    color: var(--primary-900);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    gap: 1rem;
}

.empty-state p {
    font-size: 1rem;
}

/* 9. PROCESSO E PUBLICAÇÕES (TELAS DE CARD) */
.publications-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pub-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-400);
    overflow: hidden;
    transition: var(--transition);
}

.pub-card.unread-pub {
    border-left-color: var(--warning);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.08);
}

.pub-card.read-pub {
    border-left-color: var(--primary-200);
    opacity: 0.9;
}

.pub-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    background-color: #fafbfc;
}

.pub-meta-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pub-process-num {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-900);
    text-decoration: none;
}

.pub-process-num:hover {
    color: var(--primary-600);
}

.pub-oab-resp {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pub-oab-resp strong {
    color: var(--text-main);
}

.pub-client-name {
    font-size: 0.85rem;
    color: var(--primary-700);
    font-weight: 600;
}

.pub-meta-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pub-tag-court {
    background-color: var(--primary-100);
    color: var(--primary-800);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

.pub-card-body {
    padding: 1.5rem;
}

.pub-body-text {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.6;
    margin-bottom: 1rem;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pub-body-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.pub-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: #fafbfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pub-status-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.pub-status-selector select {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

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

/* 10. TELA DE AGENDA (COMPROMISSOS & NOTAS) */
.agenda-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 800px) {
    .agenda-layout {
        grid-template-columns: 1fr;
    }
}

.agenda-sidebar {
    min-height: 520px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.agenda-stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.agenda-stat-item {
    background-color: var(--primary-50);
    border-left: 4px solid var(--primary-500);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
}

.agenda-stat-item.urgent {
    background-color: var(--danger-light);
    border-left: 4px solid var(--danger);
}

.agenda-stat-item.meetings {
    background-color: var(--warning-light);
    border-left: 4px solid var(--warning);
}

.agenda-stat-item .stat-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agenda-stat-item .stat-title {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
}

.agenda-stat-item .stat-count {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-900);
}

.agenda-stat-item.urgent .stat-count {
    color: var(--danger);
}

.agenda-stat-item.meetings .stat-count {
    color: var(--warning);
}

.agenda-upcoming-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agenda-upcoming-section .section-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-950);
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

#agenda-upcoming-list {
    overflow-y: auto;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 4px;
}

#agenda-upcoming-list::-webkit-scrollbar {
    width: 4px;
}
#agenda-upcoming-list::-webkit-scrollbar-track {
    background: transparent;
}
#agenda-upcoming-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.upcoming-item {
    transition: var(--transition);
}

.upcoming-item:hover {
    transform: translateX(3px);
    box-shadow: var(--shadow-sm);
}

.agenda-main {
    min-height: 520px;
}

.agenda-planner {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

@media (max-width: 1150px) {
    .agenda-planner {
        grid-template-columns: 1fr;
    }
}

/* Calendário Customizado por JS */
.mini-calendar {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    background-color: #ffffff;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-header h3 {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.calendar-grid-header {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    padding: 4px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    font-weight: 500;
}

.calendar-day:hover {
    background-color: var(--primary-50);
    color: var(--primary-700);
}

.calendar-day.inactive {
    color: var(--text-light);
    opacity: 0.4;
}

.calendar-day.today {
    border: 2px solid var(--primary-500);
    color: var(--primary-700);
    font-weight: 700;
}

.calendar-day.selected {
    background-color: var(--primary-600) !important;
    color: #ffffff !important;
    font-weight: 700;
}

.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background-color: var(--danger);
    border-radius: 50%;
}

.calendar-day {
    position: relative;
}

.day-schedule {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.schedule-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-900);
    border-bottom: 2px solid var(--primary-100);
    padding-bottom: 0.5rem;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 340px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    gap: 1rem;
    transition: var(--transition);
}

.event-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-200);
}

.event-marker {
    width: 4px;
    height: 32px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.category-blue { background-color: var(--primary-500); }
.category-red { background-color: var(--danger); }
.category-orange { background-color: var(--warning); }
.category-green { background-color: var(--success); }

.event-time {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-900);
    white-space: nowrap;
}

.event-details {
    flex-grow: 1;
}

.event-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.event-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 11. TELA DE CONTRATOS */
.contracts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.contract-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.contract-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.contract-title {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-900);
    margin-bottom: 0.25rem;
}

.contract-client {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.contract-client strong {
    color: var(--primary-700);
}

.contract-body {
    margin-bottom: 1.25rem;
}

.contract-value {
    font-family: var(--font-title);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-900);
    margin-bottom: 0.5rem;
}

.contract-dates {
    font-size: 0.75rem;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.contract-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 12. TELA DE TAREFAS (QUADRO KANBAN) */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    height: calc(100vh - 240px);
    min-height: 480px;
}

@media (max-width: 950px) {
    .kanban-board {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.kanban-column {
    background-color: #f1f5f9;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-height: 100%;
}

.column-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.25rem 0.5rem;
}

.column-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.dot-pending { background-color: var(--warning); }
.dot-progress { background-color: var(--info); }
.dot-done { background-color: var(--success); }

.column-header h2 {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-900);
    flex-grow: 1;
}

.column-count {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
    padding: 0.25rem;
}

/* Cards Kanban */
.task-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    cursor: grab;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    height: max-content;
    flex-shrink: 0;
    height: max-content;
}

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

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.task-priority-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.priority-Alta-bg { background-color: var(--danger-light); color: var(--danger); }
.priority-Média-bg { background-color: var(--warning-light); color: var(--warning); }
.priority-Baixa-bg { background-color: var(--success-light); color: var(--success); }

.task-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-900);
    line-height: 1.4;
}

.task-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.5rem;
    font-size: 0.75rem;
}

.task-due-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
}

.task-due-date.overdue {
    color: var(--danger);
    font-weight: 600;
}

.task-due-date svg {
    width: 12px;
    height: 12px;
}

.task-assignee-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary-100);
    color: var(--primary-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    border: 1px solid var(--primary-200);
}

.task-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
}

/* Estilo para o Seletor de Status e Timer de Desfazer */
.task-status-select {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.task-status-select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 2px rgba(37, 106, 212, 0.1);
}

.task-timer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 26, 51, 0.65); /* primary-900 com opacidade menor */
    backdrop-filter: blur(6px); /* desfoque por cima do card da tarefa */
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    z-index: 10;
    color: #ffffff;
    box-sizing: border-box;
    animation: taskOverlayFadeIn 0.2s ease-out;
}

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

.task-timer-overlay .timer-text {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: #ffffff;
}

.task-timer-overlay .timer-text strong {
    color: var(--primary-200);
}

.task-timer-overlay .btn-undo {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.task-timer-overlay .btn-undo:hover {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    border-color: #ffffff;
    transform: translateY(-1px);
}

.task-timer-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background-color: var(--accent);
    transition: width 1s linear;
}

/* 13. ESTILO DE FORMULÁRIOS & CAMPOS */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.span-full {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .span-full {
        grid-column: span 1;
    }
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: #ffffff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-focus);
}

textarea.form-control {
    font-family: inherit;
    resize: vertical;
}

/* 14. ESTRUTURA DOS MODAIS (OVERLAY) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 17, 34, 0.45);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    overflow-y: auto;
}

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

.modal-card {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-large {
    max-width: 760px;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-card form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: var(--bg-main);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Modal Detalhes Publicações */
.pub-details-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.pub-detail-item {
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
}

.pub-detail-item strong {
    color: var(--text-muted);
}

.pub-detail-item span {
    color: var(--text-main);
    font-weight: 600;
}

.modal-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 1.25rem 0;
}

.pub-details-content h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-900);
    margin-bottom: 0.75rem;
}

.pub-content-box {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
    white-space: pre-line;
    color: var(--text-main);
    font-family: var(--font-body);
}

/* 15. COMPONENTE DE TOASTS */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    background-color: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-500);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.3s 3s forwards;
}

.toast-success { border-left-color: var(--success); }
.toast-danger { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(4px); pointer-events: none; }
}

/* ==========================================================================
   GEVER - NOVOS REQUISITOS (PERFIS, HIERARQUIA E ADAPTAÇÕES MOBILE)
   ========================================================================== */

/* 1. OVERLAY E MENU DRAWER (MOBILE) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(6, 17, 34, 0.45);
    backdrop-filter: blur(4px);
    z-index: 95;
    display: none;
    transition: var(--transition);
}

.sidebar-overlay.active {
    display: block;
}

.btn-hamburger {
    background: none;
    border: none;
    color: var(--primary-900);
    cursor: pointer;
    display: none;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.btn-hamburger:hover {
    background-color: var(--primary-50);
}

.btn-hamburger svg {
    width: 24px;
    height: 24px;
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.75rem;
    cursor: pointer;
    display: none;
    margin-left: auto;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    transition: var(--transition);
}

.btn-close-sidebar:hover {
    color: var(--danger);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100vh;
        width: 260px;
        z-index: 100;
        transition: var(--transition);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.active {
        left: 0;
    }
    .sidebar .logo-text, 
    .sidebar .nav-item span, 
    .sidebar .user-info {
        display: block !important;
    }
    .sidebar .user-avatar {
        margin-right: 0.75rem !important;
    }
    .sidebar .logo {
        justify-content: flex-start !important;
    }
    .sidebar-header {
        padding: 1.75rem 1.5rem !important;
        display: flex;
        align-items: center;
    }
    .sidebar-nav {
        padding: 1.5rem 1rem !important;
    }
    .nav-item {
        justify-content: flex-start !important;
        padding: 0.75rem 1rem !important;
    }
    .nav-item svg {
        margin-right: 0.75rem !important;
    }
    .sidebar-footer {
        padding: 1.25rem 1rem !important;
        justify-content: flex-start !important;
    }
    .btn-hamburger {
        display: block;
    }
    .btn-close-sidebar {
        display: block;
    }
}

/* 2. SELETOR DE SESSÃO ATIVA (USER SWITCHER) */
.session-selector-container {
    position: relative;
    width: 100%;
}

.chevron-up {
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: rgba(255, 255, 255, 0.4);
    transition: var(--transition);
}

.session-selector-container.active .chevron-up {
    transform: rotate(180deg);
}

.session-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 100%;
    background-color: var(--primary-900);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 -10px 25px rgba(6, 17, 34, 0.35);
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 110;
}

.session-dropdown.active {
    display: flex;
    animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.dropdown-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    padding: 0.25rem 0.5rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0.25rem;
}

.session-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.session-option:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.avatar-sm {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
}

.session-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
}

.session-role {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
}

/* 3. UPLOAD DE FOTOS (BASE64) */
.photo-upload-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0 1rem 0;
}

.photo-preview-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--primary-100);
    background-color: var(--primary-50);
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: var(--transition);
}

.photo-preview-circle:hover {
    border-color: var(--primary-400);
    transform: scale(1.02);
}

.upload-icon-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 17, 34, 0.4);
    color: #ffffff;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.photo-preview-circle:hover .upload-icon-overlay {
    opacity: 1;
}

/* 4. VISTA DE PERFIL DE CLIENTE (DADOS COMPLETOS E HISTÓRICO) */
.client-profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.client-profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--primary-100);
    border: 2px solid var(--primary-400);
}

.client-profile-identity h2 {
    font-family: var(--font-title);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-900);
    margin-bottom: 0.25rem;
}

.client-profile-identity p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding-bottom: 2px;
    overflow-x: auto;
}

.profile-tab-btn {
    background: none;
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
}

.profile-tab-btn:hover {
    color: var(--primary-600);
}

.profile-tab-btn.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

.profile-tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

.profile-tab-content.active {
    display: block;
}

.profile-val {
    background-color: var(--bg-main);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-main);
    min-height: 40px;
}

.profile-val.block-val {
    white-space: pre-wrap;
    min-height: 80px;
}

.span-full-header {
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.35rem;
    margin-top: 0.75rem;
}

.span-full-header h3 {
    font-family: var(--font-title);
    font-size: 0.95rem;
    color: var(--primary-800);
    font-weight: 600;
}

.list-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compact-item {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compact-item-title {
    font-weight: 600;
    color: var(--primary-900);
}

.compact-item-meta {
    color: var(--text-muted);
}

/* 5. QUADRO KANBAN ADAPTADO (MOBILE TABS) */
.kanban-mobile-tabs {
    display: none;
    background-color: #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.25rem;
    margin-bottom: 1rem;
    gap: 0.25rem;
}

.k-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    text-align: center;
}

.k-tab.active {
    background-color: #ffffff;
    color: var(--primary-800);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 950px) {
    .kanban-mobile-tabs {
        display: flex;
    }
    .kanban-board {
        display: block;
        height: auto;
    }
    .kanban-column {
        display: none;
        max-height: calc(100vh - 280px);
    }
    .kanban-column.active-mobile-col {
        display: flex;
    }
}

/* 6. LISTA DE CLIENTES RESPONSIVA (MOBILE CARDS) */
.mobile-cards-list {
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.mobile-card-item {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--primary-100);
    border: 1px solid var(--primary-300);
}

.mobile-card-title {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-900);
}

.mobile-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.5rem;
}

.mobile-card-meta strong {
    color: var(--text-main);
}

.mobile-card-actions {
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.75rem;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .data-table {
        display: none;
    }
    .mobile-cards-list {
        display: flex;
    }
}

/* 7. HIERARQUIA, RESTRICÕES E MATRIZ DE CONFIGURAÇÃO */
.masked-financial {
    font-family: monospace;
    font-weight: bold;
    letter-spacing: 0.05em;
    color: var(--text-muted) !important;
}

.locked-overlay {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
    background-color: #f8fafc;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    width: 100%;
}

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

/* Grade de Cards de Membros de Equipe (Configurações) */
.team-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.team-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: var(--transition);
}

.team-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-200);
}

.team-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--primary-100);
    margin-bottom: 0.75rem;
    border: 2px solid var(--primary-300);
}

.team-card-name {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-900);
    margin-bottom: 0.15rem;
}

.team-card-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.team-card-details {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 100%;
    border-top: 1px dashed var(--border-color);
    padding-top: 0.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.team-card-actions {
    display: flex;
    gap: 0.35rem;
}

/* 8. ALVOS DE TOQUE DE 44PX (MOBILE ACCESSIBILITY) */
@media (max-width: 768px) {
    .btn, .form-control, .select-filter, .nav-item, .profile-tab-btn, .k-tab {
        min-height: 44px;
    }
    .actions-cell .btn-icon-only, .mobile-card-actions .btn-icon-only {
        width: 44px;
        height: 44px;
    }
}

/* 9. MELHORIAS EXCLUSIVAS DE LAYOUT E DESIGN MÓVEL (NATIVE APP FEEL) */

/* Grelha de métricas 2x2 compacta no mobile */
@media (max-width: 550px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1.25rem !important;
    }
    .metric-card {
        padding: 1rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        border-radius: var(--radius-md) !important;
    }
    .metric-icon {
        width: 36px !important;
        height: 36px !important;
        order: -1 !important;
        margin-bottom: 0.25rem !important;
    }
    .metric-icon svg {
        width: 18px !important;
        height: 18px !important;
    }
    .metric-value {
        font-size: 1.5rem !important;
        margin: 0 !important;
    }
    .metric-desc {
        font-size: 0.65rem !important;
    }
}

/* Ajustes finos do Cabeçalho e Espaçamentos no Mobile */
@media (max-width: 768px) {
    .topbar {
        padding: 0.75rem 1rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    .topbar-left {
        width: 100% !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    .topbar-actions {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 0.75rem !important;
    }
    .notification-dropdown {
        position: fixed !important;
        top: calc(100% + 5px) !important;
        right: 15px !important;
        left: 15px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 1000 !important;
    }
    .search-box {
        width: 100% !important;
        max-width: 100% !important;
        flex-grow: 1 !important;
    }
    .content-body {
        padding: 1rem !important;
    }
}

/* Modais estilo Bottom Sheet no Mobile (Deslizam de baixo) */
@media (max-width: 600px) {
    .modal-backdrop {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .modal-card {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
        max-height: 92vh !important;
        margin: 0 !important;
        box-shadow: 0 -10px 25px rgba(6, 17, 34, 0.15) !important;
        animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
    @keyframes modalSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .modal-body {
        padding: 1.25rem !important;
    }
    .modal-footer {
        padding: 1rem 1.25rem !important;
        border-radius: 0 !important;
        flex-direction: column-reverse !important;
        gap: 0.5rem !important;
    }
    .modal-footer .btn {
        width: 100% !important;
    }
}

/* Ficha do Cliente centralizada no Mobile */
@media (max-width: 600px) {
    .client-profile-header {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }
}

/* ==========================================================================
   PAINEL FINANCEIRO MODERNO (RECEITAS, DESPESAS E GRÁFICOS)
   ========================================================================== */

.sidebar-group-title {
    font-size: 0.625rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    padding: 1.15rem 1rem 0.25rem 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    pointer-events: none;
    user-select: none;
}

.finance-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 1rem;
    align-items: end;
}

.monthly-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.monthly-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
}

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

.monthly-card h4 {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-900);
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.4rem;
    margin-bottom: 0.25rem;
    text-transform: capitalize;
}

.monthly-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.monthly-row .label {
    color: var(--text-muted);
}

.monthly-row .val-in {
    color: var(--success);
    font-weight: 600;
}

.monthly-row .val-out {
    color: var(--danger);
    font-weight: 600;
}

.monthly-row.total-row {
    border-top: 1px solid var(--border-color);
    padding-top: 0.4rem;
    margin-top: 0.25rem;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Margem especial para a data padrão no mobile filter */
@media (max-width: 768px) {
    .finance-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   TELA DE LOGIN PREMIUM (GLASSMORPHISM & DARK DEEP BLUE)
   ========================================================================== */

.login-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #091a33 0%, #061122 100%);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}

.login-screen-overlay.active {
    display: flex;
}

.login-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: loginFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 150px;
    height: 150px;
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    object-fit: cover;
    margin-bottom: 1.25rem;
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-title {
    font-family: var(--font-title);
    font-size: 2.25rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--primary-200);
    opacity: 0.9;
}

.login-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    margin-bottom: 1.5rem;
}

.login-card .form-group label {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.login-card .form-control {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.login-card .form-control:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(78, 140, 245, 0.25);
}

.login-card .form-control option {
    background-color: var(--primary-900);
    color: #ffffff;
}

.login-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-btn {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent) 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(37, 106, 212, 0.3);
    color: #ffffff;
}

.login-btn:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-400) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 106, 212, 0.4);
}

.login-footer {
    text-align: center;
    color: var(--primary-200);
    opacity: 0.7;
    font-size: 0.8rem;
    line-height: 1.4;
}

.btn-toggle-pwd svg {
    color: rgba(255, 255, 255, 0.5);
    transition: var(--transition);
}

.btn-toggle-pwd:hover svg {
    color: #ffffff;
}

/* Efeito de Blur para Tarefas Não Visualizadas */
.task-card-blurred-wrapper {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease;
}

.task-card-blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: auto; /* Garante que o botão seja clicável */
    border-radius: var(--radius-md);
}

.blur-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    padding: 1rem;
}

.blur-lock-icon-container {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    padding: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    animation: float-lock 3s ease-in-out infinite;
}

@keyframes float-lock {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.blur-overlay-content .btn {
    box-shadow: 0 4px 12px rgba(28, 82, 158, 0.3);
}

/* Sub-abas Financeiras */
.finance-subtabs-bar {
    display: flex;
    gap: 0.5rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.35rem;
    margin-bottom: 1.5rem;
    align-self: flex-start;
    box-shadow: var(--shadow-sm);
}

.finance-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.finance-subtab-btn:hover {
    color: var(--primary-800);
    background-color: var(--primary-50);
}

.finance-subtab-btn.active {
    color: #ffffff;
    background-color: var(--primary-600);
    box-shadow: 0 4px 10px rgba(28, 82, 158, 0.25);
}

/* Painéis de Sub-abas */
.finance-subpanel {
    display: none;
}

.finance-subpanel.active {
    display: block;
    animation: fadeInTab 0.3s ease;
}

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

/* ==========================================================================
   MELHORIA DA SIDEBAR COLAPSÁVEL (GEMINI STYLE)
   ========================================================================== */

/* Transição do grid de colunas principal */
.app-container {
    transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar {
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease;
}

/* Ajuste do Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.25rem;
}

/* Botão de colapso no header */
.btn-toggle-sidebar {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-toggle-sidebar:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-toggle-sidebar svg {
    width: 20px;
    height: 20px;
}

/* Ocultar botão de colapso no mobile */
@media (max-width: 1024px) {
    .btn-toggle-sidebar {
        display: none !important;
    }
}

/* Footer layout */
.footer-layout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.user-profile {
    flex-grow: 1;
}

/* Botão de configurações com engrenagem */
.sidebar-settings-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}

.sidebar-settings-btn:hover,
.sidebar-settings-btn.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-settings-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.4s ease;
}

.sidebar-settings-btn:hover svg,
.sidebar-settings-btn.active svg {
    transform: rotate(45deg);
}

/* Ponto azul indicador visual */
.settings-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background-color: #3b82f6; /* Azul Gemini */
    border-radius: 50%;
    border: 1px solid var(--primary-900);
}

/* ==========================================================================
   ESTADO COLAPSADO - DESKTOP APENAS (>= 1025px)
   ========================================================================== */
@media (min-width: 1025px) {
    .app-container.sidebar-collapsed {
        grid-template-columns: 70px 1fr;
    }
    
    .app-container.sidebar-collapsed .sidebar {
        width: 70px;
    }
    
    /* Ocultar elementos textuais e chevrons */
    .app-container.sidebar-collapsed .logo-text,
    .app-container.sidebar-collapsed .sidebar-nav .nav-item span,
    .app-container.sidebar-collapsed .sidebar-nav .sidebar-group-title,
    .app-container.sidebar-collapsed .user-info,
    .app-container.sidebar-collapsed .chevron-up,
    .app-container.sidebar-collapsed .nav-item .badge {
        display: none !important;
    }
    
    /* Centralizar conteúdo do header */
    .app-container.sidebar-collapsed .sidebar-header {
        justify-content: center;
        padding: 1.5rem 0.5rem;
    }
    
    .app-container.sidebar-collapsed .logo {
        display: none;
    }
    
    /* Centralizar itens do menu */
    .app-container.sidebar-collapsed .sidebar-nav {
        padding: 1.5rem 0.5rem;
        align-items: center;
    }
    
    .app-container.sidebar-collapsed .nav-item {
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: var(--radius-md);
    }
    
    .app-container.sidebar-collapsed .nav-item svg {
        margin-right: 0;
    }
    
    /* Reorganizar footer verticalmente */
    .app-container.sidebar-collapsed .footer-layout-row {
        flex-direction: column-reverse;
        gap: 1rem;
        align-items: center;
        justify-content: center;
    }
    
    .app-container.sidebar-collapsed .user-avatar {
        margin-right: 0;
    }
    
    .app-container.sidebar-collapsed .sidebar-footer {
        padding: 1.25rem 0.5rem;
    }
    
    /* Flutuar dropdown de sessões à direita */
    .app-container.sidebar-collapsed .session-dropdown {
        width: 220px;
        left: 78px;
        bottom: 8px;
        box-shadow: 5px 5px 25px rgba(6, 17, 34, 0.35);
    }
}

/* ==========================================================================
   INTERRUPTOR DESLIZANTE (TOGGLE SWITCH) & PREFERÊNCIAS DO SISTEMA
   ========================================================================== */

.config-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.config-option-row:last-child {
    border-bottom: none;
}

.config-option-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 2rem;
}

.config-option-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* Switch Container */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s ease;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s ease;
}

input:checked + .slider {
    background-color: var(--primary-600);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-600);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Animação para piscar/pulsar apenas o número de contagem */
.task-timer-seconds {
    display: inline-block;
    color: var(--primary-200);
    animation: timerSecondsPulse 1s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes timerSecondsPulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.35;
        transform: scale(1.2);
    }
}

/* Customização de Cores e Temas */
.color-picker-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 44px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-picker-input:hover {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-picker-input::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Botão Compacto de Engrenagem Única nas tabelas e cards */
.btn-gear-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-gear-action:hover {
    background-color: var(--primary-100);
    color: var(--primary-900);
    transform: rotate(45deg);
}

/* Botão de Exclusão no Rodapé do Modal */
.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-modal-delete {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #ffffff !important;
    transition: background-color 0.2s ease, opacity 0.2s;
}

.btn-modal-delete:hover {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
    opacity: 0.9;
}

/* Sub-abas de Configurações */
.config-subtabs-bar {
    display: flex;
    gap: 0.75rem;
    background-color: var(--primary-50);
    padding: 0.4rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    width: fit-content;
    box-shadow: var(--shadow-sm);
}

.config-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.config-subtab-btn:hover {
    color: var(--primary-800);
    background-color: rgba(28, 82, 158, 0.08);
}

.config-subtab-btn.active {
    color: #ffffff;
    background-color: var(--primary-600);
    box-shadow: 0 4px 10px rgba(28, 82, 158, 0.25);
}

.config-subpanel {
    display: none;
    animation: fadeInTab 0.3s ease;
}

.config-subpanel.active {
    display: block;
}

/* Próximos Compromissos (Dashboard) */
.upcoming-events-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upcoming-event-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--primary-50);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-500);
    transition: var(--transition);
}

.upcoming-event-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background-color: var(--primary-100);
}

.event-date-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 46px;
    background-color: rgba(28, 82, 158, 0.08);
    border-radius: var(--radius-md);
    padding: 0.2rem;
    text-align: center;
}

.event-date-month {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-700);
    line-height: 1;
}

.event-date-day {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-900);
    line-height: 1.1;
    margin-top: 1px;
}

/* Progresso de Tarefas (Dashboard) */
.task-progress-container {
    background-color: var(--primary-50);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: inset var(--shadow-sm);
}

.task-progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--primary-100);
    border-radius: 4px;
    overflow: hidden;
}

.task-progress-bar-fill {
    height: 100%;
    background-color: var(--primary-600);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Bloqueio Financeiro no Dashboard (Restrição) */
.finance-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    text-align: center;
    padding: 1.5rem;
    box-sizing: border-box;
    z-index: 10;
}

.finance-lock-icon {
    background-color: var(--primary-100);
    color: var(--primary-800);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
}

/* Badges de Status de Processos */
.badge-processo-andamento {
    background-color: var(--primary-100);
    color: var(--primary-800);
}

.badge-processo-julgado {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-processo-suspenso {
    background-color: var(--warning-light);
    color: var(--warning);
}

.badge-processo-arquivado {
    background-color: var(--primary-50);
    color: var(--text-muted);
}

/* Mural de Anotações (Estilo Google Keep) */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.note-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    min-height: 160px;
    transition: var(--transition);
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.note-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-950);
    margin: 0;
    line-height: 1.3;
}

.note-card-category {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
}

.note-card-body {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-main);
    flex: 1;
    white-space: pre-line;
    margin-bottom: 0.75rem;
}

.note-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 0.5rem;
}

.note-card-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-card:hover .note-card-actions {
    opacity: 1;
}







/* ==========================================================================
   MÓDULO: CHAT (WhatsApp + Chat Interno)
   Modelo: layout flex full-height sem scroll externo.
   Scroll APENAS na lista de contatos e na área de mensagens.
   Input sempre visível no rodapé.
   ========================================================================== */

/* ── Aba Chat ocupa toda a área disponível sem scroll externo ── */
#tab-chat {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}
#tab-chat.active { display: flex; }

/* Quando o chat está ativo, o content-body não deve adicionar padding nem scroll */
.content-body:has(#tab-chat.active) {
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Barra de sub-abas — altura fixa, nunca encolhe */
.chat-subtabs-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
}
.chat-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.chat-subtab-btn:hover  { background: var(--primary-100); color: var(--primary-800); }
.chat-subtab-btn.active { background: var(--primary-600); color: #fff; }

/* Sub-painéis — cada um ocupa o espaço restante após a barra de abas */
.chat-subpanel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;   /* ← permite encolher corretamente no flex */
    overflow: hidden;
}
.chat-subpanel.active { display: flex; }

/* Banner conexão WA — altura fixa */
.wa-connection-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.wa-connection-banner.wa-connected    { background: #dcfce7; color: #166534; border-bottom: 1px solid #86efac; }
.wa-connection-banner.wa-disconnected { background: #fef3c7; color: #92400e; border-bottom: 1px solid #fcd34d; }
.wa-status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

/* ── Layout de dois painéis lado a lado ── */
.chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    flex: 1;
    min-height: 0;      /* ← crucial para não crescer além do container */
    overflow: hidden;
}

/* Painel esquerdo: lista de contatos com scroll próprio */
.chat-list-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: var(--surface-card);
    overflow: hidden;   /* barra de scroll interna apenas em .chat-list-items */
    min-width: 0;
}
.chat-list-header {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}
.chat-list-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    flex-shrink: 0;
}
.chat-list-search input {
    border: none; background: transparent; outline: none;
    color: var(--text-main); font-size: 0.85rem; width: 100%;
}
/* ÚNICO SCROLL do painel esquerdo */
.chat-list-items {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Item da lista */
.chat-list-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}
.chat-list-item:hover  { background: var(--primary-50); }
.chat-list-item.active { background: var(--primary-100); }

/* Avatar */
.chat-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary-200);
    color: var(--primary-800);
    font-weight: 700; font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; text-transform: uppercase;
}
.chat-avatar-whatsapp { background: #dcfce7; color: #16a34a; }
.chat-avatar-interno  { background: var(--primary-100); color: var(--primary-700); }

.chat-list-item-info    { flex: 1; min-width: 0; }
.chat-list-item-name    { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.chat-list-item-preview { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.chat-list-item-meta    { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex-shrink: 0; }
.chat-list-item-time    { font-size: 0.68rem; color: var(--text-muted); }
.chat-unread-badge      { background: #25d366; color: white; font-size: 0.65rem; font-weight: 700; border-radius: 999px; padding: 0.1rem 0.4rem; min-width: 18px; text-align: center; }

/* Status badges */
.chat-status-badge          { display: inline-flex; align-items: center; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.chat-status-aguardando     { background: #fef3c7; color: #92400e; }
.chat-status-em_atendimento { background: #dbeafe; color: #1e3a8a; }
.chat-status-encaminhado    { background: #ede9fe; color: #5b21b6; }
.chat-status-finalizado     { background: #f3f4f6; color: #6b7280; }

/* ── Painel direito: conversa ── */
.chat-conversation-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;      /* ← permite a área de msg encolher */
    overflow: hidden;
    background: var(--bg-main);
}

/* Estado vazio */
.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    overflow: hidden;
}

/* Cabeçalho da conversa — altura fixa */
.chat-conv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.chat-conv-contact { display: flex; align-items: center; gap: 0.65rem; }
.chat-conv-name    { font-size: 0.9rem; font-weight: 700; color: var(--text-main); }
.chat-conv-number  { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }

/* Área de mensagens — ÚNICO SCROLL do painel direito */
.chat-messages-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-image: radial-gradient(circle, var(--primary-100) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* Bolhas de mensagem */
.msg-bubble-wrapper { display: flex; flex-direction: column; max-width: 72%; }
.msg-bubble-wrapper.contato { align-self: flex-start; align-items: flex-start; }
.msg-bubble-wrapper.equipe  { align-self: flex-end;   align-items: flex-end; }

.msg-bubble {
    padding: 0.55rem 0.85rem;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
}
.msg-bubble.contato { background: var(--surface-card); color: var(--text-main); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.msg-bubble.equipe  { background: var(--primary-600); color: white; border-bottom-right-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.msg-meta { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; padding: 0 2px; }

/* Separador de data */
.chat-date-separator {
    display: flex; align-items: center; gap: 0.5rem;
    color: var(--text-muted); font-size: 0.7rem; font-weight: 600;
    text-align: center; margin: 0.25rem 0;
}
.chat-date-separator::before,
.chat-date-separator::after { content: ""; flex: 1; height: 1px; background: var(--border-color); }

/* ── Barra de input — SEMPRE visível no rodapé, nunca rola ── */
.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: var(--surface-card);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;     /* ← garante que NUNCA encolhe ou some */
}
.chat-reply-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    background: var(--bg-main);
    color: var(--text-main);
    resize: none;
    max-height: 120px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    line-height: 1.4;
}
.chat-reply-input:focus { border-color: var(--primary-400); }

.chat-send-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary-600);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover  { background: var(--primary-700); transform: scale(1.05); }
.chat-send-btn:active { transform: scale(0.95); }

/* ── Responsividade Mobile ── */
@media (max-width: 768px) {
    /* No mobile: painel único, alternando entre lista e conversa */
    .chat-layout {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        flex: 1 !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    /* Se não houver conversa aberta, exibe a lista e esconde o painel de conversa */
    .chat-layout:not(.active-chat-open) .chat-list-panel {
        display: flex !important;
        flex: 1 !important;
        max-height: none !important;
        width: 100% !important;
        height: 100% !important;
    }
    .chat-layout:not(.active-chat-open) .chat-conversation-panel {
        display: none !important;
    }

    /* Se houver conversa aberta, esconde a lista e exibe o painel de conversa */
    .chat-layout.active-chat-open .chat-list-panel {
        display: none !important;
    }
    .chat-layout.active-chat-open .chat-conversation-panel {
        display: flex !important;
        flex: 1 !important;
        width: 100% !important;
        height: 100% !important;
    }

    .chat-back-btn {
        display: inline-flex !important;
    }

    .chat-subtab-btn { font-size: 0.78rem; padding: 0.4rem 0.7rem; }

    /* Cabeçalho da conversa: botões empilham */
    .chat-conv-header { 
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem !important;
    }
    .chat-conv-header > div:last-child {
        width: auto !important;
        justify-content: flex-end !important;
        gap: 0.25rem !important;
    }

    /* Input ocupa largura total */
    .chat-input-bar { padding: 0.5rem; }
    .chat-reply-input { font-size: 0.82rem; }

    /* Botão de Mensagens Rápidas do perfil no mobile: encolhe para um avatar circular limpo */
    .chat-mq-profile-btn {
        padding: 0.25rem !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 50% !important;
        justify-content: center !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }
    .chat-mq-profile-info,
    .chat-mq-profile-btn svg {
        display: none !important;
    }
    .chat-mq-profile-avatar {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.65rem !important;
        margin: 0 !important;
    }

    /* Ocultar barra superior e abas ao abrir conversa no mobile */
    .main-content:has(.chat-layout.active-chat-open) .topbar {
        display: none !important;
    }
    #tab-chat:has(.chat-layout.active-chat-open) .chat-subtabs-bar {
        display: none !important;
    }

    /* Posição segura para notches (iOS/Android) e home indicator no mobile */
    .chat-layout.active-chat-open .chat-conv-header {
        padding-top: calc(0.55rem + env(safe-area-inset-top, 0px)) !important;
    }
    .chat-layout.active-chat-open .chat-input-bar {
        padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Modal de Mensagens Rápidas no Mobile: Column Stack Layout */
    #modal-mensagens-rapidas .modal-body {
        display: flex !important;
        flex-direction: column !important;
        min-height: auto !important;
        max-height: calc(92vh - 110px) !important;
    }
    #modal-mensagens-rapidas .modal-body > div:first-child {
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        height: 180px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    #modal-mensagens-rapidas .modal-body > div:last-child {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
    }

    /* Garantir botões de ação de categoria visíveis no toque mobile */
    .mq-cat-actions {
        opacity: 1 !important;
    }

    /* Ajustes compactos do cabeçalho de perfil do modal no mobile */
    #mq-profile-card {
        padding: 0.5rem 0.75rem !important;
        gap: 0.5rem !important;
    }
    #mq-profile-card-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.85rem !important;
    }
    #mq-profile-card-nome {
        font-size: 0.85rem !important;
    }
    #mq-profile-card-cargo {
        font-size: 0.7rem !important;
    }
}

/* Fim do bloco duplicado removido */

@media (max-width: 480px) {
    .chat-list-panel { max-height: 35vh; }
    .msg-bubble-wrapper { max-width: 88%; }
}

/* ==========================================================================
   MÓDULO: MENSAGENS RÁPIDAS (Quick Messages)
   ========================================================================== */

/* Botão ⚡ no input do chat */
.chat-qm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--primary-50);
    color: var(--primary-600);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.chat-qm-btn:hover {
    background: var(--primary-600);
    color: #fff;
    border-color: var(--primary-600);
    transform: scale(1.05);
}

/* Botao de perfil na barra do chat (Minhas Mensagens Rapidas) */
.chat-mq-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.65rem 0.3rem 0.4rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--surface-card);
    cursor: pointer;
    transition: all 0.15s ease;
    max-width: 200px;
}
.chat-mq-profile-btn:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.chat-mq-profile-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-200);
    color: var(--primary-800);
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}
.chat-mq-profile-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left;
}
.chat-mq-profile-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}
.chat-mq-profile-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Popup principal — fixed, posicionado via JS acima do input */
.qm-popup {
    position: fixed;
    z-index: 1200;
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    max-height: 380px;
    overflow: hidden;
    animation: qmSlideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 320px;
}

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

.qm-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-800);
    background: var(--primary-50);
    flex-shrink: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.qm-filter-label {
    background: var(--primary-600);
    color: #fff;
    font-size: 0.68rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.qm-manage-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-700);
    background: var(--primary-100);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.55rem;
    cursor: pointer;
    transition: background 0.15s;
}
.qm-manage-btn:hover { background: var(--primary-200); }

.qm-popup-body {
    overflow-y: auto;
    flex: 1;
}

/* Categoria no popup */
.qm-cat-group { }
.qm-cat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--surface-card);
    z-index: 1;
}
.qm-cat-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Item de mensagem no popup */
.qm-item {
    display: flex;
    flex-direction: column;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s ease;
    gap: 0.15rem;
}
.qm-item:last-child { border-bottom: none; }
.qm-item:hover,
.qm-item.qm-selected {
    background: var(--primary-100);
}
.qm-item.qm-selected { background: var(--primary-100); border-left: 3px solid var(--primary-600); padding-left: calc(0.9rem - 3px); }
.qm-item-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-800);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.qm-item-shortcut {
    font-size: 0.68rem;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
    font-family: monospace;
    font-weight: 700;
}
.qm-item-preview {
    font-size: 0.77rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.qm-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.83rem;
}

/* ── Modal Gerenciar Mensagens Rápidas ── */
.mq-cat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s;
}
.mq-cat-item:hover  { background: var(--primary-50); }
.mq-cat-item.active { background: var(--primary-100); border-right: 3px solid var(--primary-600); }
.mq-cat-dot-sm {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mq-cat-name {
    flex: 1;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mq-cat-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}
.mq-cat-item:hover .mq-cat-actions { opacity: 1; }
.mq-icon-btn {
    width: 26px; height: 26px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    transition: background 0.12s;
    flex-shrink: 0;
}
.mq-icon-btn-edit   { background: var(--primary-100); color: var(--primary-700); }
.mq-icon-btn-delete { background: #fee2e2; color: #dc2626; }
.mq-icon-btn:hover  { filter: brightness(0.9); }

.mq-msg-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: var(--surface-card);
    transition: box-shadow 0.15s;
}
.mq-msg-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.mq-msg-content { flex: 1; min-width: 0; }
.mq-msg-titulo {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}
.mq-msg-texto {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}
.mq-msg-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .qm-popup { min-width: 280px; max-height: 280px; }
    .qm-popup-header { font-size: 0.75rem; }
    .qm-popup-header > div:last-child > span { display: none; }
}

/* ==========================================================================
   CHAT: Grupos de Status na Lista de Contatos
   ========================================================================== */

/* Grupo de status (container de cada secao) */
.wa-status-group {
    border-bottom: 2px solid var(--border-color);
}
.wa-status-group:last-child { border-bottom: none; }

/* Cabecalho do grupo */
.wa-status-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.85rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: sticky;
    top: 0;
    z-index: 2;
    cursor: pointer;
    user-select: none;
    transition: filter 0.12s ease;
}
.wa-status-group-header:hover {
    filter: brightness(0.96);
}

/* Cores por status — header */
.chat-status-aguardando-header     { background: #fef3c7; color: #92400e; border-bottom: 1px solid #fcd34d; }
.chat-status-em_atendimento-header { background: #dbeafe; color: #1e3a8a; border-bottom: 1px solid #93c5fd; }
.chat-status-encaminhado-header    { background: #ede9fe; color: #5b21b6; border-bottom: 1px solid #c4b5fd; }
.chat-status-finalizado-header     { background: #f3f4f6; color: #6b7280; border-bottom: 1px solid #e5e7eb; }

.wa-group-count {
    background: rgba(0,0,0,0.12);
    color: inherit;
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.68rem;
    font-weight: 800;
}

/* Item finalizado — tom mais apagado */
.chat-item-finalizado {
    opacity: 0.75;
}
.chat-item-finalizado:hover { opacity: 1; }

/* Botao Reabrir */
.btn-reabrir {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid #86efac;
    background: #dcfce7;
    color: #166534;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    line-height: 1.4;
}
.btn-reabrir:hover {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
}



/* ==========================================================================
   AUTOCOMPLETE SEARCHABLE DROPDOWNS (COMISSÕES DINÂMICAS)
   ========================================================================== */
.searchable-dropdown-options {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 180px;
    overflow-y: auto;
}
.search-opt {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}
.search-opt:hover {
    background-color: var(--primary-50) !important;
}
.search-opt:last-child {
    border-bottom: none;
}
.comm-row {
    animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   CONTRATOS QUADRO E COLUNAS ESTÁTICAS (NÃO CLICÁVEIS E EMPILHADOS NO MOBILE)
   ========================================================================== */
.contracts-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    height: calc(100vh - 240px);
    min-height: 480px;
}
.contracts-column {
    background-color: #f1f5f9;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-height: 100%;
}
@media (max-width: 950px) {
    .contracts-board {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        height: auto;
    }
    .contracts-column {
        max-height: none;
    }
}

/* ==========================================================================
   APAGAR E ENCAMINHAR MENSAGENS NO CHAT (WHATSAPP)
   ========================================================================== */
.msg-bubble-wrapper:hover .msg-delete-btn,
.msg-bubble-wrapper:hover .msg-forward-btn {
    opacity: 0.65 !important;
}
.msg-delete-btn:hover {
    opacity: 1 !important;
    color: var(--danger) !important;
    background-color: var(--primary-50) !important;
    border-radius: 50%;
}
.msg-forward-btn:hover {
    opacity: 1 !important;
    color: var(--primary-600) !important;
    background-color: var(--primary-50) !important;
    border-radius: 50%;
}

/* ==========================================================================
   GRAVAÇÃO DE ÁUDIO (MICROFONE)
   ========================================================================== */
.mic-recording {
    color: #ef4444 !important;
    background-color: #fee2e2 !important;
}
@keyframes recordPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0.4; }
}
.record-pulse {
    animation: recordPulse 0.8s infinite alternate;
}

/* ==========================================================================
   MODAL DE ENCAMINHAMENTO DE MENSAGENS
   ========================================================================== */
.forward-contact-item {
    user-select: none;
}
.forward-contact-item:hover {
    background-color: var(--primary-50) !important;
}

/* ==========================================================================
   CUSTOM AUDIO PLAYER FOR CHAT BUBBLES
   ========================================================================== */
.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.75rem;
    border-radius: 24px;
    width: 100%;
    min-width: 250px;
    user-select: none;
    box-sizing: border-box;
}

/* Sent / Equipe side (blue bubble) */
.custom-audio-player.equipe {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.custom-audio-player.equipe .audio-play-btn {
    background: white;
    color: var(--primary-600);
}

.custom-audio-player.equipe .audio-progress-bar {
    background: rgba(255, 255, 255, 0.35);
}

.custom-audio-player.equipe .audio-progress-fill {
    background: white;
}

.custom-audio-player.equipe .audio-time {
    color: rgba(255, 255, 255, 0.95);
}

/* Received / Contato side (white/light-grey bubble) */
.custom-audio-player.contato {
    background: var(--primary-50);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.custom-audio-player.contato .audio-play-btn {
    background: var(--primary-600);
    color: white;
}

.custom-audio-player.contato .audio-progress-bar {
    background: var(--primary-100);
}

.custom-audio-player.contato .audio-progress-fill {
    background: var(--primary-600);
}

.custom-audio-player.contato .audio-time {
    color: var(--text-muted);
}

/* Play/Pause Button */
.audio-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    outline: none;
    transition: transform 0.1s ease, background 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.audio-play-btn:active {
    transform: scale(0.95);
}

.audio-play-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Progress Slider Container */
.audio-progress-container {
    flex: 1;
    height: 14px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.audio-progress-bar {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    position: relative;
}

.audio-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    position: absolute;
    left: 0;
    top: 0;
}


/* Time Indicator */
.audio-time {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: monospace;
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────────────────
   8. NOVO PAINEL FINANCEIRO (DASHBOARD & CONTROLES)
   ────────────────────────────────────────────────────────────────────────── */
.finance-dashboard-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
    .finance-dashboard-split {
        grid-template-columns: 1fr;
    }
}

/* Enfatizações de saldo */
.card-positive::before {
    background-color: var(--success) !important;
}
.card-negative::before {
    background-color: var(--danger) !important;
}

/* Barra de Progresso do Parcelamento */
.progress-bar-container {
    width: 100%;
    background-color: var(--primary-100);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
    position: relative;
    margin-top: 0.35rem;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-600);
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.progress-bar-fill.success {
    background-color: var(--success);
}

.progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Badges de tempo de vencimento */
.badge-due {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}
.badge-due.today {
    background-color: #fef3c7;
    color: #d97706;
}
.badge-due.overdue {
    background-color: #fee2e2;
    color: #ef4444;
}
.badge-due.future {
    background-color: #dbeafe;
    color: #2563eb;
}

/* Botões rápidos em tabelas */
.btn-quick-action {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    transition: var(--transition);
}

.btn-quick-action.success {
    color: var(--success);
    background-color: #ecfdf5;
}
.btn-quick-action.success:hover {
    background-color: #d1fae5;
}

.btn-quick-action.danger {
    color: var(--danger);
    background-color: #fef2f2;
}
.btn-quick-action.danger:hover {
    background-color: #fee2e2;
}

.btn-quick-action.secondary {
    color: var(--text-muted);
    background-color: var(--primary-100);
}
.btn-quick-action.secondary:hover {
    background-color: var(--primary-200);
}

/* ==========================================================================
   CONTEXT MENU: DELEÇÃO DE MENSAGENS DO WHATSAPP
   ========================================================================== */
.wa-msg-context-menu {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 210px;
    z-index: 99999;
    overflow: hidden;
    animation: ctxMenuIn 0.12s ease;
}
@keyframes ctxMenuIn {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}
.wa-ctx-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.82rem;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.12s ease;
    user-select: none;
}
.wa-ctx-item:hover {
    background: var(--primary-100);
}
.wa-ctx-danger {
    color: var(--danger);
}
.wa-ctx-danger:hover {
    background: var(--danger-light);
}
.wa-ctx-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* CSS Maximizar Coluna Kanban */
.btn-expand-col {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s, color 0.15s;
}
.btn-expand-col:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--primary-600);
}

.kanban-board.has-maximized-col {
    display: block; 
}
.kanban-board.has-maximized-col .kanban-column:not(.maximized) {
    display: none;
}
.kanban-column.maximized {
    height: 100%;
}
.kanban-column.maximized .kanban-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem;
    align-items: stretch;
    align-content: start;
    grid-auto-rows: max-content;
    overflow-y: auto;
    overflow-x: hidden;
}
.kanban-column.maximized .kanban-cards .task-card {
    margin-bottom: 0;
}



.contracts-board.has-maximized-col {
    display: block; 
}
.contracts-board.has-maximized-col .contracts-column:not(.maximized) {
    display: none;
}
.contracts-column.maximized {
    height: 100%;
}
.contracts-column.maximized .kanban-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem;
    align-items: stretch;
    align-content: start;
    grid-auto-rows: max-content;
    overflow-y: auto;
    overflow-x: hidden;
}
.contracts-column.maximized .kanban-cards .contract-card {
    margin-bottom: 0;
}
