/* ==========================================================================
   Time TI&Cia — organograma (static/js/time-ticia.js)
   Cards do modelo do organograma (faixa branca + corpo preto de cantos pixelados).
   O card cresce com o conteúdo: nomes quebram linha e os grupos descem quando não cabem.
   Computador: árvore + seções com cards. Celular (≤ 760px): lista por seção com setores recolhíveis.
   ========================================================================== */

.tt {
    --tt-card: #000;
    --tt-card-texto: #fff;
    --tt-card-suave: rgba(255, 255, 255, .62);
    --tt-divisor: rgba(255, 255, 255, .35);
    --tt-faixa: #fff;
    --tt-faixa-texto: #050505;
    --tt-linha: #1e293b;
    --tt-destaque: #F3BD48;
    --tt-curva: cubic-bezier(.22, .61, .36, 1);
}

.tt-intro { color: #555; font-size: 14px; margin: 0 0 16px; }
/* Aviso no topo da tela (organograma em organização) */
.tt-aviso { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 11px 14px; border-radius: 8px;
    background: #EFF6FF; border: 1px solid #BFDBFE; border-left: 4px solid #245A91; color: #1e3a5f; font-size: 13.5px; line-height: 1.45; }
.tt-aviso svg { flex-shrink: 0; color: #245A91; margin-top: 1px; }

/* ── Busca ───────────────────────────────────────────────────────────────── */
.tt-busca { position: relative; max-width: 420px; margin-bottom: 20px; }
.tt-busca svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.tt-busca input {
    width: 100%; box-sizing: border-box; padding: 10px 36px 10px 36px; font: inherit; font-size: 14px;
    border: 1.5px solid #e2e8f0; border-radius: 10px; background: #fff; transition: border-color .2s, box-shadow .2s;
}
.tt-busca input:hover { border-color: #cbd5e1; }
.tt-busca input:focus { outline: none; border-color: #245A91; box-shadow: 0 0 0 3px rgba(36, 90, 145, .15); }
.tt-busca-limpar {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
    color: #64748b; cursor: pointer; width: 26px; height: 26px; border-radius: 6px; font-size: 16px; line-height: 1;
}
.tt-busca-limpar:hover { background: #f1f5f9; color: #0f172a; }

.tt-resultados { display: grid; gap: 6px; margin-bottom: 24px; }
.tt-resultado {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; cursor: pointer;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; transition: border-color .15s, background .15s;
}
.tt-resultado:hover { border-color: #245A91; background: #f8fafc; }
.tt-resultado strong { display: block; font-size: 14px; color: #0f172a; }
.tt-resultado span { display: block; font-size: 12px; color: #64748b; }
.tt-vazio { color: #64748b; font-size: 14px; padding: 8px 2px; }

/* ── Tela (fundo pontilhado do modelo) ───────────────────────────────────── */
.tt-quadro {
    background-color: #f8f9fa;
    background-image: radial-gradient(#d1d5db 1.2px, transparent 1.2px);
    background-size: 18px 18px;
    border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 28px 20px 36px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.tt-card {
    display: inline-flex; flex-direction: column; align-items: center;
    width: max-content; min-width: 170px; max-width: min(100%, 560px);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .22));
    transition: transform .2s var(--tt-curva), filter .2s var(--tt-curva);
}
.tt-card:hover { transform: translateY(-2px); filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .32)); }

.tt-card-faixa {
    background: var(--tt-faixa); color: var(--tt-faixa-texto); border: 1px solid #111;
    font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: center;
    padding: 4px 14px; min-width: 120px; max-width: 92%; box-sizing: border-box; margin-bottom: -1px;
    position: relative; z-index: 1; overflow-wrap: anywhere;
}

.tt-card-corpo {
    background: var(--tt-card); color: var(--tt-card-texto);
    width: 100%; box-sizing: border-box; padding: 14px 20px 16px;
    clip-path: polygon(
        10px 0, calc(100% - 10px) 0, calc(100% - 10px) 4px, calc(100% - 5px) 4px, calc(100% - 5px) 8px, 100% 8px,
        100% calc(100% - 8px), calc(100% - 5px) calc(100% - 8px), calc(100% - 5px) calc(100% - 4px), calc(100% - 10px) calc(100% - 4px),
        calc(100% - 10px) 100%, 10px 100%, 10px calc(100% - 4px), 5px calc(100% - 4px), 5px calc(100% - 8px), 0 calc(100% - 8px),
        0 8px, 5px 8px, 5px 4px, 10px 4px
    );
}

/* Líderes do setor: "Função | Nome", com divisória embaixo */
.tt-lideres { text-align: center; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--tt-divisor); }
.tt-lideres:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.tt-lider { font-size: 12.5px; font-weight: 700; line-height: 1.5; }
.tt-lider-rotulo { font-weight: 600; color: var(--tt-card-suave); }
.tt-sep { margin: 0 6px; opacity: .6; }

/* Grupos por função: lado a lado enquanto cabem, depois descem */
.tt-grupos { display: flex; flex-wrap: wrap; gap: 12px 26px; }
.tt-grupo { flex: 1 1 130px; min-width: 0; }
.tt-grupo-titulo {
    font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    color: var(--tt-card-suave); margin-bottom: 5px; overflow-wrap: anywhere;
}
.tt-nomes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

/* Nome clicável (abre os contatos) */
.tt-pessoa {
    font: inherit; font-size: 12.5px; font-weight: 600; color: inherit; background: none; border: 0; padding: 1px 0;
    cursor: pointer; text-align: left; line-height: 1.35; overflow-wrap: anywhere;
    text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
    transition: color .15s, text-decoration-color .15s;
}
.tt-pessoa:hover, .tt-pessoa:focus-visible { color: var(--tt-destaque); text-decoration-color: currentColor; outline: none; }
.tt-lider .tt-pessoa { font-weight: 700; }

/* ── Topo: diretoria → coordenação → seções ─────────────────────────────── */
.tt-arvore { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.tt-linha-v { width: 2px; height: 22px; background: var(--tt-linha); }
.tt-seta { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--tt-linha); }

.tt-ramos { display: flex; justify-content: center; flex-wrap: nowrap; }
.tt-ramo { position: relative; padding: 22px 18px 0; display: flex; justify-content: center; }
.tt-ramo::before, .tt-ramo::after { content: ''; position: absolute; top: 0; width: 50%; height: 22px; border-top: 2px solid var(--tt-linha); }
.tt-ramo::before { right: 50%; }
.tt-ramo::after { left: 50%; border-left: 2px solid var(--tt-linha); margin-left: -1px; }
.tt-ramo:first-child::before, .tt-ramo:last-child::after { border-top: 0; }
.tt-ramo:last-child::before { border-right: 2px solid var(--tt-linha); margin-right: -1px; }
.tt-ramo:only-child::before { border-right: 0; }
.tt-ramo:only-child::after { border-top: 0; }

/* ── Seções ─────────────────────────────────────────────────────────────── */
.tt-secao { margin-top: 30px; }
.tt-secao-titulo {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 15px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: #0f172a;
    margin: 0 0 18px; text-align: center;
}
.tt-secao-titulo::before, .tt-secao-titulo::after { content: ''; height: 3px; width: 28px; border-radius: 2px; background: var(--tt-cor-secao, #94a3b8); }
.tt-cards { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 26px 22px; }

/* ── Quadro do computador: seções lado a lado, arrastar e zoom (ttPrepararPalco) ── */
.tt-palco {
    position: relative; overflow: hidden; padding: 0;
    height: clamp(460px, calc(100vh - 290px), 980px);
    cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.tt-palco:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(36, 90, 145, .25); }
.tt-palco.arrastando { cursor: grabbing; }
.tt-palco.arrastando .tt-card { transition: none; }
.tt-mundo { position: absolute; left: 0; top: 0; transform-origin: 0 0; width: max-content; padding: 36px 48px 56px; will-change: transform; }
.tt-mundo.suave { transition: transform .28s var(--tt-curva); }
.tt-mundo .tt-card { max-width: 460px; }
.tt-secoes { display: flex; flex-wrap: nowrap; justify-content: center; align-items: flex-start; gap: 72px; }
.tt-secoes .tt-secao { margin-top: 26px; }
.tt-secoes .tt-cards { display: grid; grid-template-columns: repeat(var(--tt-colunas, 2), max-content); justify-content: center; align-items: start; justify-items: center; }

.tt-controles {
    position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 4px; padding: 4px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 4px 14px rgba(15, 23, 42, .12); cursor: default;
}
.tt-controles button {
    min-width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: #0f172a;
    font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s;
}
.tt-controles button:hover { background: #EFF6FF; color: #245A91; }
.tt-controles button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(36, 90, 145, .25); }
.tt-controles .tt-ver-tudo { font-size: 12.5px; font-weight: 700; padding: 0 10px; border-left: 1px solid #e2e8f0; border-radius: 0 7px 7px 0; }
#ttZoomValor { min-width: 44px; text-align: center; font-size: 12.5px; font-weight: 700; color: #475569; font-variant-numeric: tabular-nums; }
.tt-dica { position: absolute; left: 14px; bottom: 14px; font-size: 12px; color: #64748b; background: rgba(255, 255, 255, .85);
    border-radius: 8px; padding: 6px 10px; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .tt-mundo.suave { transition: none; } }

.tt-cor-azul  { --tt-cor-secao: #3b82f6; }
.tt-cor-verde { --tt-cor-secao: #10b981; }
.tt-cor-roxo  { --tt-cor-secao: #8b5cf6; }
.tt-cor-ambar { --tt-cor-secao: #f59e0b; }
.tt-cor-rosa  { --tt-cor-secao: #ec4899; }
.tt-cor-ciano { --tt-cor-secao: #06b6d4; }

/* ── Celular ─────────────────────────────────────────────────────────────── */
.tt-celular { display: none; }

.tt-m-topo { background: #000; color: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.tt-m-topo-titulo { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .6); margin-bottom: 4px; }
.tt-m-topo + .tt-m-topo { margin-top: -6px; }
.tt-m-topo .tt-pessoa { font-size: 14px; padding: 4px 0; }
.tt-m-coord { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; border-top: 1px solid rgba(255, 255, 255, .18); padding-top: 8px; margin-top: 8px; }
.tt-m-coord:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.tt-m-coord small { color: rgba(255, 255, 255, .6); font-size: 11.5px; text-align: right; }

.tt-m-secao { margin-top: 20px; }
.tt-m-secao-titulo {
    font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #334155;
    display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
}
.tt-m-secao-titulo::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--tt-cor-secao, #94a3b8); }

.tt-m-setor { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.tt-m-setor-topo {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: none; border: 0;
    font: inherit; text-align: left; cursor: pointer; transition: background .15s;
}
.tt-m-setor-topo:hover { background: #f8fafc; }
.tt-m-setor-nome { flex: 1; font-weight: 700; font-size: 14.5px; color: #0f172a; }
.tt-m-setor-qtd { font-size: 12px; color: #64748b; background: #f1f5f9; border-radius: 999px; padding: 2px 9px; }
.tt-m-seta { color: #64748b; transition: transform .35s var(--tt-curva); }
.tt-m-setor.aberto .tt-m-seta { transform: rotate(90deg); }

/* Recolher suave: grid 0fr ↔ 1fr + opacidade, na mesma curva da seta */
.tt-m-setor-corpo { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s var(--tt-curva), opacity .35s var(--tt-curva); }
.tt-m-setor.aberto .tt-m-setor-corpo { grid-template-rows: 1fr; opacity: 1; }
.tt-m-setor-corpo > div { overflow: hidden; }
.tt-m-setor-conteudo { padding: 0 16px 12px; }

.tt-m-grupo-titulo { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #64748b; margin: 10px 0 2px; }
.tt-m-linha {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    background: none; border: 0; border-bottom: 1px solid #f1f5f9; padding: 11px 2px; font: inherit; text-align: left; cursor: pointer;
}
.tt-m-linha:last-child { border-bottom: 0; }
.tt-m-linha:hover { background: #f8fafc; }
.tt-m-linha strong { font-size: 14.5px; color: #0f172a; font-weight: 600; overflow-wrap: anywhere; }
.tt-m-linha small { display: block; font-size: 12px; color: #64748b; font-weight: 500; }
.tt-m-linha svg { color: #94a3b8; flex-shrink: 0; }

@media (max-width: 760px) {
    .tt-computador { display: none; }
    .tt-celular { display: block; }
    .tt-busca { max-width: none; }
}

/* ── Contatos (ao clicar no nome) ───────────────────────────────────────── */
.tt-contato {
    position: fixed; inset: 0; z-index: 9500; /* acima do botão de bug (9001) */ display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .2s var(--tt-curva);
}
.tt-contato.aberto { opacity: 1; pointer-events: auto; }
.tt-contato-caixa {
    background: #fff; border-radius: 16px; width: 100%; max-width: 380px; box-shadow: 0 25px 50px rgba(0, 0, 0, .2);
    overflow: hidden; transform: translateY(10px) scale(.98); transition: transform .25s var(--tt-curva);
}
.tt-contato.aberto .tt-contato-caixa { transform: none; }
.tt-contato-topo { background: #000; color: #fff; padding: 20px 20px 18px; position: relative; display: flex; gap: 14px; align-items: center; }
.tt-avatar {
    width: 48px; height: 48px; border-radius: 12px; background: #F3BD48; color: #000; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
}
.tt-contato-topo h3 { margin: 0; font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.tt-contato-topo p { margin: 2px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .7); }
.tt-contato-fechar {
    position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 8px; border: 0;
    background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; transition: background .15s;
}
.tt-contato-fechar:hover { background: rgba(255, 255, 255, .25); }
.tt-contato-corpo { padding: 14px 20px 20px; display: grid; gap: 10px; }
.tt-canal { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; }
.tt-canal-rotulo { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.tt-canal-valor { font-size: 14.5px; font-weight: 600; color: #0f172a; margin: 2px 0 8px; overflow-wrap: anywhere; }
.tt-canal-valor.vazio { color: #94a3b8; font-weight: 500; font-style: italic; margin-bottom: 0; }
.tt-acoes { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-acao {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600;
    text-decoration: none; cursor: pointer; border: 1.5px solid #e2e8f0; background: #fff; color: #0f172a; transition: background .15s, border-color .15s, color .15s;
}
.tt-acao:hover { border-color: #245A91; color: #245A91; background: #f8fafc; }
.tt-acao.principal { background: #245A91; border-color: #245A91; color: #fff; }
.tt-acao.principal:hover { background: #1b4772; border-color: #1b4772; color: #fff; }
.tt-acao.whats { background: #128C4B; border-color: #128C4B; color: #fff; }
.tt-acao.whats:hover { background: #0e723d; border-color: #0e723d; color: #fff; }

@media (max-width: 760px) {
    .tt-contato { align-items: flex-end; padding: 0; }
    .tt-contato-caixa { max-width: none; border-radius: 18px 18px 0 0; transform: translateY(100%); padding-bottom: env(safe-area-inset-bottom); }
    .tt-acao { flex: 1 1 auto; justify-content: center; padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .tt-card, .tt-m-seta, .tt-m-setor-corpo, .tt-contato, .tt-contato-caixa { transition: none; }
}
