/* Sidebar retrátil com abas — estilo Visual Studio */
html { height: 100%; }
body { height: 100%; min-height: 100vh; display: flex; flex-direction: column; }
body > .page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.app-body { display: flex; flex: 1; min-height: 0; }
.app-body > main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: auto; }
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow: hidden;
}
.sidebar.retraida { width: 52px; }
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--accent); }
/* Abas no topo da sidebar (estilo VS) */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
}
.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.4rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    min-width: 0;
}
.sidebar-tab:hover { background: var(--bg-overlay); color: var(--text); }
.sidebar-tab.ativo { background: var(--bg-card); color: var(--accent); border-bottom: 2px solid var(--accent); margin-bottom: -1px; }
.sidebar-tab .tab-ico { font-size: 1rem; flex-shrink: 0; }
.sidebar.retraida .sidebar-tabs { flex-direction: column; border-bottom: none; }
.sidebar.retraida .sidebar-tab { flex: none; padding: 0.6rem; justify-content: center; border: none; margin: 0; }
.sidebar.retraida .sidebar-tab .tab-txt { display: none; }
.sidebar.retraida .sidebar-tab.ativo { border-bottom: none; border-left: 2px solid var(--accent); margin-bottom: 0; margin-left: 0; }
/* Painéis de conteúdo */
.sidebar-panes {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}
.sidebar-pane {
    display: none;
    padding: 0.4rem 0;
    flex-direction: column;
    gap: 0.1rem;
}
.sidebar-pane.ativo { display: flex; }
.sidebar.retraida .sidebar-panes { display: none; }
/* Links da navegação (aba Módulos) */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.sidebar-nav a:hover { background: var(--bg-overlay); color: var(--accent); }
.sidebar-nav a.ativo {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    border-left: 3px solid var(--accent);
    margin-left: 0;
    padding-left: calc(1rem - 3px);
}
.sidebar-nav a.ativo:hover { background: var(--accent-soft); color: var(--accent); }
.sidebar-nav a .ico { font-size: 1rem; flex-shrink: 0; width: 1.4em; text-align: center; }
.sidebar-nav a .txt { transition: opacity 0.15s ease; }
/* Ações rápidas (aba Ações) */
.sidebar-acoes { padding: 0.4rem 0; }
.sidebar-acoes a {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}
.sidebar-acoes a:hover:not(.disabled) { background: var(--bg-overlay); color: var(--accent); }
.sidebar-acoes a.ativo { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-acoes a.disabled { opacity: 0.5; cursor: not-allowed; }
.sidebar-acoes a .acao-tit { font-size: 0.85rem; color: inherit; }
.sidebar-acoes a .acao-desc { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-acoes a .ico { font-size: 1rem; margin-right: 0.25rem; flex-shrink: 0; }
.sidebar-acoes a { flex-direction: row; flex-wrap: wrap; align-items: center; }
.sidebar-acoes a .acao-tit { flex: 1; min-width: 0; }
.sidebar-acoes button {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}
.sidebar-acoes button:hover:not(:disabled) { background: var(--bg-overlay); color: var(--accent); }
.sidebar-acoes button:disabled { opacity: 0.6; cursor: wait; }
.sidebar-acoes button .acao-tit { flex: 1; min-width: 0; font-size: 0.85rem; }
.sidebar-acoes button .ico { font-size: 1rem; flex-shrink: 0; }
/* Botão de ação primária (ex.: Rodar Enriquecimento Catta) — destaque visual */
.sidebar-acoes button.btn-acao-primary {
    margin: 0.5rem 1rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    background: var(--accent);
    color: #0c0c10;
    font-weight: 600;
    justify-content: center;
}
.sidebar-acoes button.btn-acao-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    color: #0c0c10;
}
.sidebar-acoes button.btn-acao-primary .acao-tit { color: inherit; }
/* Badge de notificação (ex.: leads em stage) */
.nav-badge-stage { margin-left: 0.35rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: var(--warning-soft); color: var(--warning); }

/* Barra de progresso global (Catta, etc.) */
.catta-progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border);
    z-index: 9999;
    overflow: hidden;
    display: none;
}
.catta-progress-bar.ativo { display: block; }
.catta-progress-bar .fill {
    height: 100%;
    width: 40%;
    background: var(--accent);
    animation: catta-progress 1.5s ease-in-out infinite;
}
@keyframes catta-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
