/* Final override to garantir bloco inteiro branco (caso estilos antigos ainda existam abaixo) */
.report-modal-content{background:#ffffff !important;}
.report-modal-content .modal-header,.report-modal-content .modal-footer{background:transparent !important;}
/* Reset e estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* View tabs theme variables */
    --view-tab-bg: #6d28d9;
    --view-tab-bg-inactive: linear-gradient(135deg,#7c3aed,#6d28d9 60%,#5b21b6);
    --view-tab-bg-active: linear-gradient(135deg,#5b21b6,#6d28d9 70%,#7c3aed);
    --view-tab-bg-hover: linear-gradient(135deg,#7532d4,#6122c0 65%,#531b9f);
    --view-tab-bg-active-hover: linear-gradient(135deg,#5320a3,#6023bf 65%,#6d28d9);
    --view-tab-border: #5b21b6;
    --view-tab-color: #fff;
    --view-tab-shadow: 0 2px 4px rgba(0,0,0,0.08);
    --view-tab-shadow-active: 0 3px 8px -2px rgba(109,40,217,0.5);
    --view-tab-radius: 6px;
    --view-tab-padding-y: 0.55rem;
    --view-tab-padding-x: 1.1rem;
    --view-tab-font-size: 0.85rem;
    --view-tab-gap: .4rem;
    /* Cores principais - esquema moderno e profissional */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Cores de fundo */
    --background: #f8fafc;
    --card-bg: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    
    /* Cores de texto */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;
    
    /* Cores de borda */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Bordas */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Layout tokens (16px = 1rem) */
    --sidebar-width: 16.25rem; /* 260px */
    --kanban-col-wide: 22rem; /* 352px */
    --kanban-col-medium: 20rem; /* 320px */
    --kanban-col-compact: 18rem; /* 288px */
    --container-max: 87.5rem; /* 1400px */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--text-inverse);
    z-index: 1300; /* acima de header e dropdowns */
    transition: transform 0.3s ease;
    overflow-y: auto; /* Ensure the entire sidebar is scrollable */
    max-height: 100vh; /* Prevent the sidebar from exceeding the viewport height */
    display: flex;
    flex-direction: column;
}

/* Header da sidebar / logo */
.sidebar-header {
    padding: 1.3rem 1.25rem 1.1rem 1.25rem; /* top/right/bottom/left */
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .logo {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    line-height: 1;
    width: 100%;
    text-align: center;
    color: var(--text-inverse);
    padding: 0.15rem 0; /* pequeno respiro vertical */
    user-select: none;
}

/* Ajuste em telas muito estreitas */
@media (max-width: 640px) {
  .sidebar-header { padding: 1rem 1rem 0.9rem 1rem; }
  .sidebar-header .logo { font-size: 1.25rem; }
}

.sidebar-nav {
    flex: 1;
    overflow-y: scroll; /* Ensure scrolling is functional */
    padding: 1rem 0;
    max-height: 100vh; /* Limit height to viewport */
    position: relative; /* Ensure proper scrolling context */
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-title {
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-inverse);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
}

.nav-item.active {
    background-color: var(--primary-color);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary-light);
}

.nav-item i {
    width: 1.25rem;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: 0;
}

/* Header */
.header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 2rem 1rem 5rem; /* Aumentar padding esquerdo para o botão */
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

/* Mobile top menu (desativado após introdução do botão global de sidebar) */
.mobile-top-menu{display:none !important}
.mobile-menu-dropdown{display:none !important}

@media (max-width: 45rem){
    /* Exibir sempre o container das pipelines com scroll horizontal */
    .pipeline-menu{display:block; overflow:hidden}
}

/* Mobile safety and centered dropdown adjustments */
@media (max-width: 45rem) {
    /* Ensure page content has safe side padding to avoid clipping */
    .container { padding: 0 16px; }

    /* Header positioning so mobile button can be absolutely positioned on the right */
    .header { position: relative; }

    /* Position the mobile menu button at the right edge of the header */
    .mobile-top-menu { display:block; position:absolute; right:16px; top:50%; transform:translateY(-50%); z-index:1200; }

    /* Center the dropdown horizontally and limit its width to avoid side clipping */
    .mobile-menu-dropdown {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -6px) !important;
        top: 64px !important;
        width: calc(100% - 48px) !important;
        max-width: 420px !important;
        box-sizing: border-box;
        max-height: calc(100vh - 120px);
        overflow: auto;
        z-index: 2000;
    }
    /* Debug: make open dropdown very visible temporarily to help diagnose clipping/visibility */
    .mobile-menu-dropdown.open {
        border: 2px dashed rgba(0,150,255,0.9) !important;
        background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,250,255,0.98)) !important;
        box-shadow: 0 12px 40px rgba(0,0,0,0.25) !important;
    }

    .mobile-menu-dropdown.open { transform: translate(-50%, 0) !important; }
}

.header-content {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Botões */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--background);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.813rem;
}

/* Container principal */
.container {
    max-width: var(--container-max);
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
}

/* Main Tabs */
.main-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.main-tab {
    padding: 1rem 2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 1rem;
}

.main-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.main-tab:hover {
    color: var(--text-primary);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pipeline Selector */
.pipeline-selector {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pipeline-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.pipeline-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}

.pipeline-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pipeline-tab:hover:not(.active) {
    background-color: var(--background);
}

/* Tabs de visualização */
/* Abas de visualização (Kanban / Lista) - versão roxa fixa */
.view-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border: none;
    justify-content: flex-start;
    align-items: center;
}

.tab {
    padding: 0.55rem 1.1rem;
    background: #6d28d9; /* Roxo base */
    border: 1px solid #5b21b6;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    color: #fff;
    letter-spacing: .3px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background .18s, box-shadow .18s, transform .18s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    position: relative;
}

.tab:not(.active) {
    background: linear-gradient(135deg,#7c3aed,#6d28d9 60%,#5b21b6);
}

.tab.active {
    background: linear-gradient(135deg,#5b21b6,#6d28d9 70%,#7c3aed);
    box-shadow: 0 3px 8px -2px rgba(109,40,217,0.5);
}

.tab:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 2px;
}

.tab:hover {
    background: linear-gradient(135deg,#7532d4,#6122c0 65%,#531b9f);
}

.tab.active:hover {
    background: linear-gradient(135deg,#5320a3,#6023bf 65%,#6d28d9);
}

.tab:active {
    transform: translateY(1px);
}

/* Variante pill opcional */
body.tabs-variant-pill .view-tabs { gap:0.25rem; }
body.tabs-variant-pill .tab {
    border-radius: 999px;
    padding: calc(var(--view-tab-padding-y) - 0.1rem) calc(var(--view-tab-padding-x) - 0.2rem);
    font-size: 0.8rem;
    box-shadow: none;
}
body.tabs-variant-pill .tab.active { box-shadow: 0 0 0 2px rgba(255,255,255,0.25) inset; }
body.tabs-variant-pill .tab:not(.active) { opacity:.85; }
body.tabs-variant-pill .tab:not(.active):hover { opacity:1; }

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    position: relative;
    justify-content: flex-start;
}

/* Wrapper para controles de navegação do Kanban */
.kanban-wrapper { position: relative; }
.kanban-nav-btn {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1500;
        background: rgba(30,41,59,0.85);
        color:#fff;
        border:none;
        width:38px; height:38px;
        border-radius:50%;
        display:flex; align-items:center; justify-content:center;
        cursor:pointer;
        box-shadow:0 4px 12px rgba(0,0,0,0.25);
        opacity:0; pointer-events:none;
        transition:opacity .25s ease, background .2s;
}
.kanban-nav-btn:hover { background: rgba(30,41,59,0.95); }
.kanban-nav-btn.left { left: calc(var(--sidebar-width) + 8px); }
.kanban-nav-btn.right { right: 8px; }
.kanban-wrapper.has-overflow .kanban-nav-btn { opacity:1; pointer-events:auto; }
@media (max-width: 48rem){
    .kanban-nav-btn { width:34px; height:34px; }
    .kanban-nav-btn.left { left:8px; }
    .kanban-nav-btn.right { right:8px; }
}

/* Largura adaptativa das colunas */
.kanban-board.compact .kanban-column { min-width:var(--kanban-col-medium); flex:0 0 var(--kanban-col-medium); }
.kanban-board.few-columns .kanban-column { flex:1 1 auto; min-width:var(--kanban-col-compact); }
.kanban-board.ultra-compact .kanban-column { min-width:var(--kanban-col-compact); flex:0 0 var(--kanban-col-compact); }

/* Colunas ocultas (vazias) */
.kanban-column.hidden-empty { display:none !important; }

/* Indicador de posição */
#kanbanPositionIndicator { user-select:none; }

.kanban-column {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow);
    min-width: var(--kanban-col-wide);
    flex: 0 0 var(--kanban-col-wide);
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.column-title {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.column-count {
    background-color: var(--background);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.kanban-cards {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: move;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: var(--shadow);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.card-checkbox {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.card:hover .card-checkbox,
.card.selected .card-checkbox {
    opacity: 1;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.card-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.625rem;
}

/* Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.tag {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
}

/* Tabela de visualização em lista */
.list-view {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

/* Escala tipográfica reduzida específica da visão lista (2ª redução) */
.list-view, .list-view *:not(i):not(svg) {
    font-size: 0.78rem; /* antes 0.82rem */
    line-height: 1.15;
}

/* Ajustes mais finos para cabeçalho da tabela e células */
.list-view thead th {
    font-size: 0.68rem; /* antes 0.72rem */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.list-view tbody td {
    font-size: 0.72rem; /* antes 0.78rem */
    vertical-align: middle;
}

/* Botões dentro da list-view menores porém consistentes */
.list-view .btn {
    font-size: 0.68rem; /* antes 0.72rem */
    padding: 0.35rem 0.55rem;
    line-height: 1.1;
}

/* Inputs e selects acompanhando escala */
.list-view input, .list-view select, .list-view textarea {
    font-size: 0.74rem; /* antes 0.78rem */
    padding: 0.4rem 0.5rem;
}

/* Tags e badges */
.list-view .tag, .list-view .status-badge, .list-view .badge {
    font-size: 0.55rem; /* antes 0.6rem */
    padding: 0.15rem 0.4rem;
}

/* Organização de tags na list view */
.list-view .tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-height: 3.2rem; /* ~4 linhas compactas */
    overflow: hidden;
    position: relative;
}

.list-view .tag {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-view .more-tags-indicator {
    background: var(--secondary-color);
    color: #fff;
    border-radius: 9999px;
    padding: 0.15rem 0.45rem;
    font-size: 0.55rem;
    font-weight: 600;
    cursor: default;
}

/* Avatar de usuário reduzido ligeiramente para harmonizar */
.list-view .user-avatar {
    width: 18px; /* antes 20px */
    height: 18px;
    font-size: 0.5rem; /* antes 0.55rem */
}

/* Evitar que ícones FontAwesome herdem redução excessiva */
.list-view i.fa, .list-view i.fas, .list-view i.far, .list-view i.fab {
    font-size: 0.85rem; /* levemente maior que texto para legibilidade (ajustado) */
}

/* Ajuste de densidade da tabela */
.list-view table tr td, .list-view table tr th {
    padding: 0.4rem 0.5rem;
}

/* Badge de etapa na list-view sem quebra */
.list-view .stage-badge {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: .3px;
}

@media (max-width: 640px) {
    .list-view .stage-badge { max-width: 90px; font-size: 0.65rem; }
}

/* Melhor espaçamento em ações em massa */
.list-view .bulk-actions .btn {
    padding: 0.3rem 0.5rem;
}

/* Responsividade: em telas muito pequenas não reduzir tanto */
@media (max-width: 480px) {
    .list-view, .list-view *:not(i):not(svg) { font-size: 0.83rem; }
    .list-view thead th { font-size: 0.72rem; }
    .list-view tbody td { font-size: 0.76rem; }
}

.list-controls {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.bulk-actions {
    display: none;
    align-items: center;
    gap: 1rem;
}

.bulk-actions.active {
    display: flex;
}

.search-filter {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 0.6rem; /* levemente menor para acomodar padding maior */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input,
.filter-select,
.filter-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.search-input {
    padding-left: 2.2rem; /* antes 2.5rem mas fonte menor -> ajustado; se ícone sobrepor, aumentar para 2.4rem */
    width: 250px;
    line-height: 1.2;
}

/* Ajuste específico quando densidade reduzida (list-view) para garantir espaçamento */
.list-view .search-input {
    padding-left: 2.4rem; /* mais espaço porque fonte e altura menores */
}

/* Caso existam inputs menores em telas estreitas */
@media (max-width: 600px) {
    .search-input { width: 180px; }
    .list-view .search-input { width: 170px; }
}

.filter-select {
    background-color: white;
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: var(--background);
    border-radius: var(--radius);
}

.date-filter span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.table-container {
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Zebra striping apenas para a list-view */
.list-view tbody tr:nth-child(odd) td {
    background: #ffffff;
}
.list-view tbody tr:nth-child(even) td {
    background: #f5f6f7; /* cinza clarinho */
}

/* Manter destaque ao passar o mouse sem perder contraste */
.list-view tbody tr:hover td {
    background: #e8ebee;
}

/* Se a linha estiver selecionada (caso haja classe futura), usar cor distinta */
.list-view tbody tr.selected td {
    background: #dbe7ff !important;
}

th {
    background-color: var(--background);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 2;
}

tr:hover {
    background-color: var(--background);
}

/* Indicador visual de overflow horizontal na list view */
.table-container::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 22px;
    pointer-events: none;
    background: linear-gradient(270deg, rgba(0,0,0,0.08), rgba(0,0,0,0));
    opacity: 0;
    transition: opacity .25s ease;
}
.table-container.overflowing::after { opacity: 1; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Raised so modals appear above the dashboard iframe (iframe uses z-index: 4000) */
    z-index: 6000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.close-btn:hover {
    background-color: var(--background);
}

/* Formulários */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Drag and drop visual feedback */
.kanban-column.drag-over {
    background-color: rgba(99, 102, 241, 0.05);
    border: 2px dashed var(--primary-color);
}

/* Drag and drop para reordenar colunas */
.kanban-column[draggable="true"] {
    transition: opacity 0.2s ease;
}

.kanban-column.drag-over-column {
    background-color: rgba(99, 102, 241, 0.1);
    border: 2px solid var(--primary-color);
    transform: scale(1.02);
}

.drag-handle-column {
    font-size: 1.2rem;
    opacity: 0.4;
    user-select: none;
    transition: all 0.2s;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drag-handle-column:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
    cursor: grab;
}

.drag-handle-column:active {
    cursor: grabbing;
    background-color: rgba(0, 0, 0, 0.1);
}

.column-header:hover .drag-handle-column {
    opacity: 0.7;
}

/* Botão de exclusão no card */
.card-delete-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 1rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.card:hover .card-delete-btn {
    opacity: 1;
}

.card-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Steps list */
.steps-list {
    margin-top: 1rem;
}

.step-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.step-name {
    font-weight: 500;
}

/* Tags list */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: white;
}

.tag-delete {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.tag-delete:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Documentation */
.documentation-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.documentation-container h1 {
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.documentation-container h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.documentation-container h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.documentation-container p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.documentation-container ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.documentation-container code {
    background-color: var(--background);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.875rem;
}

.documentation-container pre {
    background-color: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* IDs Container */
.ids-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.ids-container h1 {
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.ids-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.ids-section {
    background-color: var(--background);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.ids-section h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.id-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.id-item:last-child {
    border-bottom: none;
}

.id-name {
    font-weight: 500;
}

.id-value {
    font-family: monospace;
    background-color: var(--card-bg);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--primary-color);
}

/* Webhook item */
.webhook-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.webhook-url {
    font-family: monospace;
    word-break: break-all;
    font-size: 0.875rem;
}

.webhook-events {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.webhook-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Dashboard */
.dashboard-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.dashboard-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 200px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-secondary);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background-color: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.stat-content h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    margin-top: 0;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

/* Botão fixo para controlar o menu lateral */
.sidebar-toggle-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background-color: var(--primary-hover);
}

.sidebar-toggle-btn.sidebar-open {
    left: 270px;
}

/* Ajustes para o menu lateral quando o botão está visível */
.sidebar {
    transition: transform 0.3s ease;
}

/* Ajustes para o conteúdo principal quando o menu está aberto/fechado */
.main-content {
    transition: margin-left 0.3s ease;
}

/* Responsividade para o botão do menu lateral */
@media (max-width: 48rem) {
    .sidebar-toggle-btn {
        left: 0.75rem;
        top: 0.75rem;
    }
    
    .sidebar-toggle-btn.sidebar-open {
        left: 0.75rem;
    }
}

/* Adicionar estilos para o indicador de filtro */
.filter-indicator {
    display: flex;
    align-items: center;
    background-color: rgba(99, 102, 241, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.filter-indicator button {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    margin-left: 0.5rem;
    padding: 0;
    font-size: 0.875rem;
}

.filter-indicator button:hover {
    color: var(--danger-color-dark);
}

/* Estilos para o controle de visualização e filtro principal */
.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.main-filter {
    display: flex;
    align-items: center;
}

#mainUserFilterBtn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

#mainUserFilterBtn.active {
    background-color: var(--primary-color);
    color: white;
}

#mainUserFilterBtn:not(.active):hover {
    background-color: rgba(99, 102, 241, 0.1);
}

/* Responsividade para dispositivos móveis */
@media (max-width: 48rem) {
    .view-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-tabs { width:100%; justify-content:flex-start !important; gap:.5rem; }
    
    .main-filter {
        justify-content: center;
        margin-top: 0.5rem;
    }
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: var(--background);
    color: var(--danger-color);
}

.logout-btn i {
    margin-right: 0.5rem;
}

/* Responsividade */
@media (max-width: 48rem) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 0 0 0 100vmax rgba(0,0,0,0); /* placeholder */
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-only {
        display: block;
    }

    .container { padding: 0.75rem 0.75rem; }

    /* Manter colunas lado a lado com scroll horizontal */
    .kanban-board { flex-direction: row; gap: 0.75rem; padding: 0 0 0.75rem 0; scroll-snap-type: x proximity; }
    /* Removido mask e gradient para evitar aparência de corte */
    .kanban-board:after { display:none; }
    .kanban-column { min-width: 260px; flex:0 0 260px; scroll-snap-align: start; }

    .pipeline-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .pipeline-tabs {
        overflow-x: auto;
        margin-bottom: 0.5rem;
    }

    .view-tabs { flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; }

    .tab { white-space:nowrap; padding:0.55rem 1rem; }

    .list-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-filter {
        flex-direction: column;
        width: 100%;
    }

    .search-input,
    .filter-select,
    .filter-input {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
        max-height: calc(100vh - 2rem);
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Ajustes para tabela em mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Em mobile a tabela agora se adapta: sem min-width fixa */
    table { min-width: 100%; }
    th, td { padding: 0.5rem; font-size: 0.8rem; }
    td:nth-child(5), th:nth-child(5) { /* Descrição */ max-width: 160px; }
    td:nth-child(2), th:nth-child(2) { max-width: 140px; }
    td:nth-child(3), th:nth-child(3) { max-width: 120px; }
    td:nth-child(4), th:nth-child(4) { max-width: 140px; }
    td:nth-child(8), th:nth-child(8) { max-width: 140px; }
    /* Converter ações em bloco empilhado se necessário */
    td:last-child { white-space: nowrap; }

    th, td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    /* Ajustes para cards em mobile */
    .card {
        padding: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .card-description {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }

    .card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    /* Ajustes para modais em mobile */
    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    /* Ajustes para campos UTM em mobile */
    .form-group[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Ajustes para IDs em mobile */
    .ids-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Ajustes para dashboard em mobile */
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }
}

/* Centralização de blocos principais (desktop) */
@media (min-width: 1025px){
    .tab-content > .kanban-board,
    .tab-content > .list-view,
    .tab-content > .list-view .table-container,
    .tab-content > .view-controls { margin-left:auto; margin-right:auto; max-width:var(--container-max); }
}

/* Melhorar alinhamento interno em telas grandes com muito espaço */
.kanban-board { padding-left: 0.25rem; padding-right: 0.25rem; }

@media (min-width: 87.5rem) {
    .kanban-board { justify-content: flex-start; }
}

/* Pipeline tabs centralizadas e com espaçamento lateral seguro */
.pipeline-tabs { padding: 0.25rem 0.25rem; }
@media (max-width: 48rem){
    .pipeline-tabs { padding: 0.25rem 0.25rem; }
    .view-tabs { overflow-x:auto; -webkit-overflow-scrolling:touch; gap:.5rem; padding:0 .25rem; }
    .view-tabs .tab { white-space:nowrap; flex:0 0 auto; }
    .kanban-board { padding-left:4px; padding-right:4px; }
    .kanban-board { padding-left:4px; padding-right:4px; }
    #kanbanPositionIndicator { display:none; }
    .container { padding:0.5rem 0.4rem; }
}

/* Lista centralizada com largura fluida */
.list-view { max-width: var(--container-max); margin-left:auto; margin-right:auto; }

@media (max-width: 30rem) {
    .header-content {
        padding: 0.75rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .modal-content {
        padding: 1rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }

    .form-input,
    .form-textarea,
    .form-select {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}
/* Estilos para o Dashboard */
.dashboard-container {
    padding: 20px;
}

.dashboard-filters {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    border-bottom: 1px solid var(--border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-weight: 500;
    color: var(--muted-foreground);
    font-size: 14px;
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.metrics-section {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
}

.metrics-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.metric-item {
    text-align: center;
}

.metric-item-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.metric-item-label {
    font-size: 12px;
    color: var(--muted-foreground);
}

.metrics-secondary {
    position: relative;
}

.metrics-secondary .dropdown-toggle {
    display: flex;
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.metrics-secondary .dropdown-toggle i {
    transition: transform 0.3s;
}

.metrics-secondary .dropdown-toggle.active i {
    transform: rotate(180deg);
}

.metrics-secondary .metrics-content {
    transition: max-height 0.3s ease-out, overflow 0.3s;
    overflow: hidden;
    max-height: 500px;
}

.metrics-secondary.collapsed .metrics-content {
    max-height: 0;
    margin-top: 0;
}

.funnel-container {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--card-shadow);
    margin: 16px 0;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.funnel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 600px;
    margin: 16px auto;
    position: relative;
}

.funnel-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: white;
    position: relative;
    margin: 0 auto;
    text-align: center;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s;
    height: 70px;
}

.funnel-step::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid;
    z-index: 1;
}

.funnel-step:last-child::after {
    display: none;
}

.funnel-step:nth-child(1) {
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    width: 100%;
}

.funnel-step:nth-child(2) {
    background: linear-gradient(135deg, #6366f1, #a5b4fc);
    width: 90%;
}

.funnel-step:nth-child(3) {
    background: linear-gradient(135deg, #8b5cf6, #c4b5fd);
    width: 80%;
}

.funnel-step:nth-child(4) {
    background: linear-gradient(135deg, #ec4899, #f9a8d4);
    width: 70%;
}

.funnel-step:nth-child(5) {
    background: linear-gradient(135deg, #10b981, #6ee7b7);
    width: 60%;
}

.funnel-step:nth-child(6) {
    background: linear-gradient(135deg, #059669, #34d399);
    width: 50%;
}

.funnel-label {
    font-weight: 500;
    font-size: 16px;
    margin-top: 50px;
    margin-bottom: -5px;
    letter-spacing: 0.5px;
}

.funnel-value {
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.funnel-percentage {
    font-size: 14px;
    opacity: 0.9;
    margin-top: -5px;
    margin-bottom: 50px;
    letter-spacing: 0.5px;
}

.chart-container {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.crm-section {
    position: relative;
}

.crm-section .dropdown-toggle {
    display: flex;
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.crm-section .dropdown-toggle i {
    transition: transform 0.3s;
}

.crm-section .dropdown-toggle.active i {
    transform: rotate(180deg);
}

.crm-section .crm-content {
    transition: max-height 0.3s ease-out, overflow 0.3s;
    overflow: hidden;
    max-height: 1000px;
}

.crm-section.collapsed .crm-content {
    max-height: 0;
    margin-top: 0;
}

.stages-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stages-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    max-width: 900px;
}

.stage-card {
    background: var(--muted);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
    flex: 1;
    max-width: 280px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stage-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.stage-card.mql {
    border-color: var(--secondary);
}

.stage-card.agendou {
    border-color: var(--warning);
}

.stage-card.realizada {
    border-color: var(--success);
}

.stage-card.negociacao {
    border-color: #f97316;
}

.stage-card.venda-realizada {
    border-color: #059669;
}

.stage-card.no-show {
    border-color: var(--danger);
}

.stage-card.negocio-perdido {
    border-color: #dc2626;
}

.stage-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stage-card.mql .stage-value {
    color: var(--secondary);
}

.stage-card.agendou .stage-value {
    color: var(--warning);
}

.stage-card.realizada .stage-value {
    color: var(--success);
}

.stage-card.negociacao .stage-value {
    color: #f97316;
}

.stage-card.venda-realizada .stage-value {
    color: #059669;
}

.stage-card.no-show .stage-value {
    color: var(--danger);
}

.stage-card.negocio-perdido .stage-value {
    color: #dc2626;
}

.stage-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 4px;
    line-height: 1.2;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stage-percentage {
    font-size: 12px;
    color: var(--muted-foreground);
    margin-top: 4px;
}

.tab-container {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--muted-foreground);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background-color: var(--muted);
    font-weight: 600;
    color: var(--dark);
}

.data-table tr:hover {
    background-color: var(--muted);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.sortable {
    cursor: pointer;
    position: relative;
}

.sortable:hover {
    background-color: var(--muted);
}

.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    opacity: 0.5;
}

.sortable.asc::after {
    content: '\f0de';
    opacity: 1;
}

.sortable.desc::after {
    content: '\f0dd';
    opacity: 1;
}

.utm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
    overflow: hidden;
}

.utm-card {
    background: var(--muted);
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid var(--secondary);
    overflow: hidden;
}

.utm-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
    font-size: 14px;
}

.utm-list {
    max-height: 200px;
    overflow-y: auto;
}

.utm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.utm-item:last-child {
    border-bottom: none;
}

.utm-name {
    font-weight: 500;
    color: var(--dark);
    flex: 1;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.utm-count {
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}

.table-container {
    overflow-x: auto;
}

.creative-ranking {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.creative-card {
    background: var(--muted);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.creative-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.creative-image-container {
    position: relative;
    height: 200px;
    overflow: hidden;
    cursor: pointer;
}

.creative-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.creative-image-container:hover .creative-image {
    transform: scale(1.05);
}

.creative-info {
    padding: 16px;
}

.creative-name {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
    font-size: 16px;
}

.creative-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.creative-metrics-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.creative-metric {
    text-align: center;
    flex: 1;
    background: var(--card);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid var(--border);
}

.creative-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.creative-metric-label {
    font-size: 12px;
    color: var(--muted-foreground);
    margin-top: 4px;
}


.pie-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.pie-chart-container {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pie-chart-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark);
    text-align: center;
}

.pie-chart-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.pie-chart-canvas {
    max-width: 100%;
    max-height: 250px;
}

.pie-chart-legend {
    margin-top: 16px;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    margin: 4px;
    padding: 4px 8px;
    background-color: var(--muted);
    border-radius: 4px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 6px;
}

.legend-label {
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-stats {
    margin-left: 6px;
    font-weight: 600;
    color: var(--primary);
}

.report-section {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    margin-bottom: 30px;
}

.report-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--card-shadow);
}

.report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.report-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.report-modal-content {
    background: var(--card);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
}

.report-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.report-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.2s;
}

.report-modal-close:hover {
    color: var(--dark);
}

.report-content {
    background: var(--muted);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark);
    white-space: pre-wrap;
    border: 1px solid var(--border);
}

.report-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
             align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    border-left: 4px solid var(--success);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.error {
    border-left-color: var(--danger);
}

/* Estilos responsivos */
@media (max-width: 48rem) {
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-item {
        border: 1px solid var(--purple);
        border-radius: 8px;
        padding: 12px;
        text-align: center;
    }

    .metric-item-value {
        font-size: 20px;
    }

    .stages-container {
        width: 100%;
    }

    .stages-row {
        flex-direction: column;
        gap: 12px;
        margin-top: 12px;
        width: 100%;
        max-width: 100%;
    }

    .stage-card {
        width: 100%;
        max-width: 100%;
        min-height: 100px;
        padding: 14px;
        border-radius: 8px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .stage-value {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .stage-label {
        font-size: 13px;
        line-height: 1.3;
        min-height: auto;
    }

    .stage-percentage {
        font-size: 11px;
        margin-top: 3px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        border-bottom: 1px solid var(--border);
        border-right: none;
    }

    .tab.active {
        border-bottom: 2px solid var(--primary);
    }

    .creative-ranking {
        grid-template-columns: 1fr;
    }

    .utm-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .utm-card {
        width: 100%;
        overflow: hidden;
    }

    .utm-list {
        max-height: 150px;
    }

    .table-container {
        overflow-x: scroll;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .funnel {
        max-width: 100%;
        padding: 0 10px;
        margin: 12px auto;
    }

    .funnel-step {
        padding: 20px;
        height: 60px;
    }

    .funnel-label {
        font-size: 12px;
    }

    .funnel-value {
        font-size: 16px;
    }

    .funnel-percentage {
        font-size: 10px;
    }

    .funnel-container {
        padding: 12px;
        margin: 12px 0;
    }

    .funnel-container h2 {
        margin-bottom: 10px;
        font-size: 16px;
    }

    .pie-charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .pie-chart-canvas {
        max-height: 200px;
    }

    .legend-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 6px 4px;
        min-width: 80px;
    }

    .legend-color {
        margin-right: 0;
        margin-bottom: 4px;
    }

    .legend-label {
        max-width: none;
        white-space: normal;
        text-align: center;
    }

    .creative-name {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .creative-metric-value {
        font-size: 12px;
    }

    .creative-metric-label {
        font-size: 9px;
        margin-top: 2px;
    }

    .creative-metrics {
        gap: 8px;
    }

    .creative-metrics-row {
        gap: 8px;
    }

    .creative-metric {
        padding: 8px 4px;
    }

    .report-modal-content {
        padding: 20px;
        max-width: 95%;
    }

    .report-modal-title {
        font-size: 18px;
    }

    .report-content {
        font-size: 12px;
        padding: 15px;
    }

    .report-actions {
        flex-direction: column;
        gap: 10px;
    }

    .report-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Backdrop quando menu está aberto em mobile */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
    z-index: 1200;
}
.sidebar-backdrop.active { opacity: 1; pointer-events: auto; }

/* Impedir scroll do body quando menu aberto */
body.menu-open { overflow: hidden; }

/* Ajustes extras para o dropdown mobile não ficar por trás do sidebar */
.mobile-menu-dropdown { z-index: 1400; }

/* Garantir que o header fique abaixo do menu lateral em mobile, mas acima do conteúdo */
.header { z-index: 900; }

/* ==== Overrides finais para abas de visualização (Kanban / Lista) ==== */
.view-tabs > .tab {
    background: var(--view-tab-bg-inactive) !important;
    border: 1px solid var(--view-tab-border) !important;
    color: var(--view-tab-color) !important;
    border-bottom: none !important;
}
.view-tabs > .tab.active {
    background: var(--view-tab-bg-active) !important;
    box-shadow: var(--view-tab-shadow-active) !important;
}
.view-tabs > .tab:hover:not(.active) {
    background: var(--view-tab-bg-hover) !important;
}
.view-tabs > .tab:focus-visible { outline:2px solid #c4b5fd; outline-offset:2px; }