/* ============================================================
   FacilitaPJ — Diagnóstico de CNPJ (versão DASHBOARD)
   Usa as variáveis globais do style.css (--navy, --blue, etc.)
   Prefixo .diag para não colidir com estilos existentes.
   ============================================================ */

.diag { max-width: 940px; margin: 0 auto; }

/* ── Caixa de busca ───────────────────────────────────────── */
.diag__search {
  background: var(--white);
  border: 1px solid var(--gray-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
}
.diag__search-row { display: flex; gap: 12px; flex-wrap: wrap; }
.diag__input {
  flex: 1; min-width: 220px; padding: 14px 18px;
  border: 1.5px solid var(--gray-line); border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-size: 1rem; color: var(--text);
  background: var(--white); letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; -webkit-appearance: none;
}
.diag__input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,111,212,.1); }
.diag__btn { justify-content: center; min-width: 160px; }

/* ── Estados ──────────────────────────────────────────────── */
.diag__state {
  text-align: center; padding: 44px 24px; background: var(--white);
  border: 1px solid var(--gray-line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); margin-top: 24px;
}
.diag__state p { color: var(--text-soft); }
.diag__error { border-color: #F5C6C6; background: #FEF2F2; }
.diag__error p { color: #B91C1C; font-weight: 500; }
.diag__spinner {
  width: 42px; height: 42px; border: 4px solid var(--blue-pale);
  border-top-color: var(--blue); border-radius: 50%;
  margin: 0 auto 16px; animation: diagspin .8s linear infinite;
}
@keyframes diagspin { to { transform: rotate(360deg); } }
.diag__hidden { display: none; }

/* ── Resultado ────────────────────────────────────────────── */
#diagResult { animation: diagfade .4s ease; margin-top: 24px; }
@keyframes diagfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.diag__card {
  background: var(--white); border: 1px solid var(--gray-line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  padding: 26px; margin-top: 18px;
}

/* ── Cabeçalho da empresa ─────────────────────────────────── */
.diag__hero {
  display: flex; align-items: center; gap: 18px;
  padding: 24px 26px; border-radius: var(--radius-md);
  border: 1px solid var(--gray-line); margin-top: 0;
}
.diag__hero--ok     { background: linear-gradient(135deg, #F0FDF4 0%, #FFFFFF 70%); border-color: #BBF7D0; }
.diag__hero--warn   { background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 70%); border-color: #FDE68A; }
.diag__hero--danger { background: linear-gradient(135deg, #FEF2F2 0%, #FFFFFF 70%); border-color: #FCA5A5; }
.diag__hero-avatar {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: .9rem;
  background: var(--white); border: 1px solid var(--gray-line); color: var(--navy);
}
.diag__hero-body { flex: 1; min-width: 0; }
.diag__hero-body h3 { font-family: 'Sora', sans-serif; color: var(--navy); font-size: 1.25rem; line-height: 1.3; margin-bottom: 3px; }
.diag__hero-meta { font-size: .9rem; color: var(--gray-mid); }
.diag__hero-meta strong { color: var(--blue); font-weight: 600; letter-spacing: .3px; }

.diag__badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  border-radius: 100px; font-size: .82rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap; color: #fff;
}
.diag__badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .9; }
.diag__badge--ok     { background: #16A34A; }
.diag__badge--warn   { background: #D97706; }
.diag__badge--danger { background: #DC2626; }

/* ── KPIs ─────────────────────────────────────────────────── */
.diag__kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.diag__kpi {
  background: var(--white); border: 1px solid var(--gray-line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.diag__kpi::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--blue); }
.diag__kpi--ok::before     { background: #16A34A; }
.diag__kpi--warn::before   { background: #D97706; }
.diag__kpi--danger::before { background: #DC2626; }
.diag__kpi-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--blue-pale); display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.diag__kpi-value { font-family: 'Sora', sans-serif; font-size: 1.45rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.diag__kpi-label { font-size: .72rem; color: var(--gray-mid); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* ── Painel 2 colunas ─────────────────────────────────────── */
.diag__panel { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.diag__panel > .diag__card { margin-top: 0; }

.diag__sec-title {
  font-family: 'Inter', sans-serif; font-size: .72rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--blue);
  margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
}
.diag__sec-title::after { content: ''; flex: 1; height: 1px; background: var(--gray-line); }

/* ── Panorama ─────────────────────────────────────────────── */
.diag__panorama { display: flex; flex-direction: column; gap: 10px; }
.diag__pan-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); font-size: .9rem; line-height: 1.55; }
.diag__pan-item .ico { font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.diag__pan-item strong { color: var(--navy); }
.diag__pan-item--ok     { background: #F0FDF4; }
.diag__pan-item--warn   { background: #FFFBEB; }
.diag__pan-item--danger { background: #FEF2F2; }
.diag__pan-item--info   { background: var(--blue-pale); }

/* ── Donut ────────────────────────────────────────────────── */
.diag__donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.diag__donut { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.diag__donut svg { transform: rotate(-90deg); }
.diag__donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.diag__donut-center .num { font-family: 'Sora', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--navy); line-height: 1; }
.diag__donut-center .lbl { font-size: .68rem; color: var(--gray-mid); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.diag__legend { display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
.diag__legend-item { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.diag__legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.diag__legend-name { color: var(--navy); font-weight: 500; }
.diag__legend-role { color: var(--gray-mid); font-size: .78rem; }

/* ── Timeline ─────────────────────────────────────────────── */
.diag__timeline { position: relative; padding-left: 8px; }
.diag__tl-item { position: relative; padding: 0 0 22px 26px; }
.diag__tl-item:last-child { padding-bottom: 0; }
.diag__tl-item::before { content: ''; position: absolute; left: 5px; top: 20px; bottom: -4px; width: 2px; background: var(--gray-line); }
.diag__tl-item:last-child::before { display: none; }
.diag__tl-dot { position: absolute; left: 0; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 3px solid var(--white); box-shadow: 0 0 0 2px var(--blue); }
.diag__tl-dot--muted { background: var(--gray-mid); box-shadow: 0 0 0 2px var(--gray-line); }
.diag__tl-date { font-family: 'Sora', sans-serif; font-weight: 600; color: var(--navy); font-size: .95rem; }
.diag__tl-label { font-size: .72rem; color: var(--gray-mid); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.diag__tl-sub { font-size: .82rem; color: var(--text-soft); margin-top: 2px; }

/* ── Grid / listas ────────────────────────────────────────── */
.diag__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.diag__item .rot { font-size: .72rem; color: var(--gray-mid); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; font-weight: 600; }
.diag__item .val { font-size: .98rem; font-weight: 500; color: var(--navy); word-break: break-word; }
.diag__list { display: flex; flex-direction: column; gap: 10px; }
.diag__list-item { padding: 14px 16px; background: var(--gray-bg); border: 1px solid var(--gray-line); border-radius: var(--radius-sm); }
.diag__list-item .principal { font-weight: 600; color: var(--navy); font-size: .95rem; }
.diag__list-item .sub { font-size: .85rem; color: var(--gray-mid); margin-top: 3px; }
.diag__cnae-cod { font-family: 'Sora', sans-serif; font-size: .85rem; color: var(--blue); font-weight: 600; }
.diag__tag { display: inline-block; font-size: .68rem; font-weight: 600; letter-spacing: .06em; color: var(--blue); background: var(--blue-pale); padding: 2px 9px; border-radius: 100px; margin-left: 8px; text-transform: uppercase; }
.diag__chip { display: inline-block; padding: 3px 12px; border-radius: 100px; font-size: .78rem; font-weight: 600; }
.diag__chip--ok { color: #15803D; background: #F0FDF4; }
.diag__chip--off { color: #B91C1C; background: #FEF2F2; }
.diag__chip--neutral { color: var(--gray-mid); background: var(--gray-bg); }

/* ── CTA de lead ──────────────────────────────────────────── */
.diag__cta { background: linear-gradient(135deg, var(--navy) 0%, #14294d 100%); border-radius: var(--radius-md); padding: 30px; margin-top: 18px; color: #fff; position: relative; overflow: hidden; }
.diag__cta::before { content: ''; position: absolute; top: -80px; right: -60px; width: 300px; height: 300px; background: linear-gradient(135deg, var(--blue) 0%, transparent 65%); opacity: .25; border-radius: 50%; pointer-events: none; }
.diag__cta-content { position: relative; z-index: 1; }
.diag__cta h3 { font-family: 'Sora', sans-serif; color: #fff; font-size: 1.25rem; margin-bottom: 8px; }
.diag__cta p { color: rgba(255,255,255,.75); font-size: .95rem; margin-bottom: 20px; max-width: 520px; }
.diag__cta-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.diag__footnote { text-align: center; font-size: .8rem; color: var(--gray-mid); margin-top: 16px; }

/* ── Responsivo ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .diag__kpis { grid-template-columns: repeat(2, 1fr); }
  .diag__panel { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .diag__hero { flex-direction: column; text-align: center; }
  .diag__card { padding: 20px; }
  .diag__kpis { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .diag__search, .diag__cta-actions, .header, .footer, .whatsapp-float { display: none !important; }
  .diag__card, .diag__kpi, .diag__hero { box-shadow: none; break-inside: avoid; }
}

/* ── Endereço em destaque ─────────────────────────────────── */
.diag__address { display: flex; gap: 14px; align-items: flex-start; }
.diag__address-icon {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius-sm);
  background: var(--blue-pale); display: flex; align-items: center;
  justify-content: center; font-size: 1.1rem;
}
.diag__address-main { flex: 1; min-width: 0; }
.diag__address-street {
  font-family: 'Sora', sans-serif; font-weight: 600; color: var(--navy);
  font-size: 1.02rem; line-height: 1.4; margin-bottom: 4px;
}
.diag__address-line { font-size: .92rem; color: var(--text-soft); line-height: 1.5; }
.diag__address-zip {
  display: inline-block; margin-top: 8px; font-size: .82rem; font-weight: 600;
  color: var(--blue); background: var(--blue-pale); padding: 3px 12px;
  border-radius: 100px; letter-spacing: .3px;
}
