/* ============================================================
   ANÁLISE PROFUNDA — card nas fases PESTEL e Porter
   Relatório de consultoria com dados oficiais (Sabiá 4 + Data Ocean)
   ============================================================ */

.ap-card { border-left: 3px solid #2563eb; }

.ap-topo {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}
.ap-topo h2 { margin: 0 0 6px; }
.ap-sub { margin: 0; color: var(--text-secondary, #475569); font-size: .9rem; max-width: 640px; }

.ap-acao { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.ap-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 20px;
    background: #0b1220; color: #e8eefc;
    border: 0; border-radius: 10px;
    font-family: inherit; font-size: .92rem; font-weight: 700;
    cursor: pointer;
    transition: background .15s ease;
}
.ap-btn:hover:not(:disabled) { background: #18233a; }
.ap-btn:disabled { opacity: .6; cursor: wait; }
.ap-custo { color: var(--text-muted, #64748b); font-size: .76rem; }
.ap-custo i { color: #d97706; }

/* ---------- progresso em etapas (padrao "pesquisa aprofundada") ----------
   As etapas descrevem o pipeline real; a barra e' estimada e so' fecha
   com a resposta. Recibo de esforco real vem nos .ap-chip ao final. */
.ap-espera-painel {
    margin-top: 16px; padding: 16px 18px 14px;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px;
}
.ap-progresso-topo {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 10px;
}
.ap-progresso-topo strong { color: #1e40af; font-size: .95rem; }
.ap-progresso-timer {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: .8rem; color: #1e3a8a; font-weight: 700;
}
.ap-progresso-barra {
    height: 6px; background: #dbeafe; border-radius: 99px; overflow: hidden;
}
.ap-progresso-preenchido {
    height: 100%; width: 0%;
    background: #2563eb; border-radius: 99px;
    transition: width .9s ease;
}
.ap-etapas {
    list-style: none; margin: 12px 0 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: 6px 22px;
}
.ap-etapas li {
    display: flex; flex-direction: column; gap: 1px;
    font-size: .82rem; color: #94a3b8;
    position: relative; padding-left: 18px;
}
.ap-etapas li::before {
    content: ""; position: absolute; left: 0; top: 4px;
    width: 9px; height: 9px; border-radius: 50%;
    background: #cbd5e1;
}
.ap-etapas li.atual { color: #1e40af; }
.ap-etapas li.atual::before { background: #2563eb; animation: ap-pulsa 1.2s ease-in-out infinite; }
.ap-etapas li.feita { color: #166534; }
.ap-etapas li.feita::before { background: #16a34a; }
.ap-etapas .ap-etapa-nome { font-weight: 700; }
.ap-etapas li.atual .ap-etapa-desc { display: block; }
.ap-etapas .ap-etapa-desc { font-size: .74rem; display: none; }
.ap-etapas li.feita .ap-etapa-desc { display: none; }
@keyframes ap-pulsa {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); }
    50%      { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0); }
}
.ap-progresso-nota { margin: 10px 0 0; color: #1e3a8a; font-size: .8rem; }
#ap-timer { font-weight: 700; }

/* recibo de esforco no cabecalho do resultado */
.ap-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ap-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px;
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 99px;
    font-size: .74rem; font-weight: 600; color: #334155;
}
.ap-chip i { color: #2563eb; font-size: .7rem; }

/* ---------- o relatorio ---------- */
.ap-relatorio-cabeca {
    margin-top: 16px; padding: 10px 14px;
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px;
    font-size: .85rem; color: #166534;
}
.ap-relatorio {
    margin-top: 12px; padding: 18px 20px;
    background: var(--bg-surface-alt, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    font-size: .9rem; line-height: 1.65;
    color: var(--text-secondary, #334155);
}
.ap-relatorio h3 { margin: 18px 0 8px; font-size: 1.02rem; color: var(--text-primary, #0f172a); }
.ap-relatorio h3:first-child { margin-top: 0; }
.ap-relatorio h4 { margin: 14px 0 6px; font-size: .92rem; color: var(--text-primary, #0f172a); }
.ap-relatorio hr { border: 0; border-top: 1px solid var(--border-color, #e2e8f0); margin: 14px 0; }
.ap-relatorio a { color: #2563eb; }
.ap-relatorio ul { margin: 6px 0; padding-left: 20px; }

.ap-tabela-wrap { overflow-x: auto; margin: 10px 0; }
.ap-relatorio table { border-collapse: collapse; width: 100%; font-size: .84rem; }
.ap-relatorio th, .ap-relatorio td {
    border: 1px solid var(--border-color, #e2e8f0);
    padding: 7px 10px; text-align: left; vertical-align: top;
}
.ap-relatorio th { background: #eef2f7; color: var(--text-primary, #0f172a); }

/* ---------- historico ---------- */
.ap-historico { margin-top: 18px; }
.ap-historico h4 {
    font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted, #64748b); margin: 0 0 8px;
}
.ap-hist-item {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px; margin-bottom: 8px;
    padding: 0 14px;
}
.ap-hist-item summary {
    cursor: pointer; padding: 11px 0;
    font-size: .88rem; font-weight: 600; color: var(--text-primary, #0f172a);
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.ap-hist-cred { font-size: .76rem; font-weight: 600; color: var(--text-muted, #64748b); }
.ap-hist-cred i { color: #d97706; }
.ap-hist-item .ap-relatorio { margin: 0 0 12px; }

@media (max-width: 720px) {
    .ap-acao { align-items: stretch; width: 100%; }
    .ap-btn { justify-content: center; }
}

/* Análise atual aberta + botão secundário quando já existe relatório (2026-09-11) */
.ap-btn.ap-btn-sec { background: #fff; color: #0f172a; border: 1px solid var(--border-color, #cbd5e1); }
.ap-btn.ap-btn-sec:hover { background: #f8fafc; }
.ap-atual { margin-top: 16px; }
.ap-atual-cabeca { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 8px;
                   font-size: .84rem; color: var(--text-muted, #64748b); }
.ap-atual-cabeca strong { color: var(--text-primary, #0f172a); font-size: .9rem; }
.ap-validade { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
               background: #ecfdf5; color: #047857; font-size: .76rem; font-weight: 600; }
.ap-validade.vencida { background: #fff7ed; color: #c2410c; }
.ap-hist-atual { border-color: #bfdbfe; background: #f8fbff; }
.ap-relatorio.ap-recolhido { max-height: 460px; overflow: hidden; position: relative; }
.ap-relatorio.ap-recolhido::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px;
    background: linear-gradient(rgba(248,251,255,0), #f8fbff); pointer-events: none; }
.ap-expandir { display: inline-flex; align-items: center; margin: 0 0 14px; padding: 8px 14px; font: inherit; font-size: .84rem;
    font-weight: 600; color: #1d4ed8; background: #fff; border: 1px solid #bfdbfe; border-radius: 8px; cursor: pointer; }
.ap-expandir:hover { background: #eff6ff; }
/* Painel de estado da análise (2026-09-11) */
.ap-estado { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
             margin-top: 16px; padding: 14px 18px; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 12px; }
.ap-estado.vencida { border-color: #fed7aa; background: #fff7ed; }
.ap-estado-texto { display: flex; flex-direction: column; gap: 4px; flex: 1 1 240px; min-width: 0; }
.ap-estado-texto strong { font-size: .95rem; color: #14532d; }
.ap-estado-texto strong i { margin-right: 7px; color: #16a34a; }
.ap-estado.vencida .ap-estado-texto strong { color: #7c2d12; }
.ap-estado.vencida .ap-estado-texto strong i { color: #ea580c; }
.ap-estado-texto span { font-size: .88rem; color: var(--text-secondary, #475569); line-height: 1.5; }
.ap-estado .ap-acao { align-items: flex-end; flex: 0 1 250px; }
.ap-estado .ap-custo { font-size: .78rem; white-space: normal; text-align: right; max-width: 250px; line-height: 1.4; }
.ap-btn.ap-btn-sec { background: #fff; color: #0f172a; border: 1px solid #94a3b8; }
@media (max-width: 720px) { .ap-estado .ap-acao { width: 100%; align-items: stretch; } }
