/* Estados de carregamento, vazio e erro (OG.estado) — 12/10/2026.
   Cores só por variáveis do tema. Os tons do esqueleto ficam em --og-sk-a/--og-sk-b e trocam no modo escuro. */

:root {
  --og-sk-a: #dde7e1;
  --og-sk-b: #eef4f0;
  --og-esp-fundo: var(--og-sk-a);   /* esqueleto-espelho: caixas coloridas viram cinza neutro */
  --og-esp-borda: rgba(120, 140, 130, 0.22);
}
:root[data-theme="dark"] {
  --og-sk-a: rgba(255, 255, 255, 0.06);
  --og-sk-b: rgba(255, 255, 255, 0.11);
  --og-esp-borda: rgba(255, 255, 255, 0.10);
}

/* texto só para leitor de tela */
.og-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.og-estado { box-sizing: border-box; width: 100%; grid-column: 1 / -1; } /* dentro de uma grade, ocupa a linha toda */

/* ---------- esqueleto ---------- */
.og-sk {
  display: block;
  height: 12px;
  border-radius: 6px;
  background-color: var(--og-sk-a);
  background-image: linear-gradient(90deg, var(--og-sk-a) 0%, var(--og-sk-b) 45%, var(--og-sk-a) 90%);
  background-size: 300% 100%;
  animation: og-sk-brilho 1.6s ease-in-out infinite;
}
@keyframes og-sk-brilho {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}
.og-sk-fina   { height: 9px; }
.og-sk-grossa { height: 16px; }
.og-sk-valor  { height: 26px; margin: 10px 0; border-radius: 8px; }
.og-sk-titulo { height: 20px; border-radius: 8px; }
.og-sk-circulo { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; }
.og-sk-pill { width: 64px; height: 22px; border-radius: 999px; flex: 0 0 auto; }
.og-sk-img { width: 100%; aspect-ratio: 4 / 3; height: auto; border-radius: 0; }
.og-sk-bloco { width: 100%; height: 96px; border-radius: 10px; margin-top: 18px; }

/* lista com avatar */
.og-sk-lista { display: flex; flex-direction: column; }
.og-sk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.og-sk-item:last-child { border-bottom: 0; }
.og-sk-item-meio { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

/* tabela (em div) */
.og-sk-tabela { display: flex; flex-direction: column; }
.og-sk-linha-tab {
  display: grid;
  grid-template-columns: repeat(var(--og-cols, 5), minmax(0, 1fr));
  gap: 18px;
  align-items: center;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
}
.og-sk-linha-tab.og-sk-cab { padding-top: 10px; padding-bottom: 10px; border-bottom-color: var(--line-strong); }

/* tabela real (tbody) */
.og-sk-tr td { padding: 14px 10px; border-bottom: 1px solid var(--line); }

/* grade de cartões */
.og-sk-cartoes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.og-sk-cartao {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.og-sk-cartao-corpo { padding: 12px; display: flex; flex-direction: column; gap: 9px; }

/* KPIs */
.og-sk-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.og-sk-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* quadro (kanban): imita o quadro real (.kn-board: linha com gap 16px, colunas de 264 a 310 px, cabeçalho em cartão) */
.og-sk-kanban {
  display: flex; gap: 16px; align-items: flex-start;
  overflow-x: hidden; padding-bottom: 8px;
}
.og-sk-kcol {
  flex: 1 1 0; min-width: 264px; max-width: 310px;
  display: flex; flex-direction: column; gap: 10px;
}
.og-sk-khead {
  padding: 13px 14px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.og-sk-khead-topo { display: flex; align-items: center; gap: 8px; }
.og-sk-espaco { flex: 1 1 auto; }
.og-sk-ponto { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.og-sk-pill--p { width: 30px; height: 18px; border-radius: 8px; }
.og-sk-barra { height: 4px; border-radius: 4px; margin-top: 12px; }
.og-sk-kcard {
  display: flex; flex-direction: column; gap: 9px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.og-sk-kcard-topo { display: flex; align-items: center; gap: 9px; }
.og-sk-kcard-meio { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.og-sk-kcard-pe { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.og-sk-kquad { width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto; }
/* celular: colunas de ~86vw com encaixe, como o quadro real (responsivo-mobile.css) */
@media (max-width: 768px) {
  .og-sk-kanban { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scroll-padding-left: 12px; }
  .og-sk-kcol { flex: 0 0 min(86vw, 320px); min-width: 0; max-width: none; scroll-snap-align: start; }
}

/* página inteira (genérico): título + botões, faixa de KPIs e tabela */
.og-sk-pagina { display: flex; flex-direction: column; gap: 18px; padding: 2px 0; }
.og-sk-pagina-topo { display: flex; align-items: center; gap: 10px; }
.og-sk-pagina-topo .og-sk-pill { width: 96px; height: 32px; border-radius: var(--radius-sm, 8px); }
.og-sk-pagina .og-sk-tabela {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

/* painel: título + subtítulo + bloco */
.og-sk-painel { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.og-sk-painel .og-sk-bloco { margin-top: 6px; }

/* placeholder anônimo trocado em silêncio por esqueleto: tira o padding/centralização do texto original enquanto o esqueleto estiver dentro */
[data-og-esq-auto]:has(> .og-estado--carregando) { padding: 0 !important; text-align: left !important; }

/* detalhe */
.og-sk-detalhe { padding: 4px 2px; }
.og-sk-detalhe-grade {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
  margin-top: 20px;
}

/* ---------- carregando só com texto ---------- */
.og-estado--texto {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 13px;
}
.og-spin,
.og-estado-auto::before {
  box-sizing: border-box;
  width: 16px; height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: og-estado-giro 0.8s linear infinite;
}
.og-spin { display: inline-block; flex: 0 0 auto; }
@keyframes og-estado-giro { to { transform: rotate(360deg); } }

/* ---------- upgrade global: texto "Carregando…" solto ---------- */
.og-estado-auto { animation: og-estado-pulso 1.8s ease-in-out infinite; }
.og-estado-auto::before {
  content: '';
  display: inline-block;
  margin-right: 8px;
  vertical-align: -3px;
}
@keyframes og-estado-pulso {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

/* ---------- vazio e erro ---------- */
.og-estado--vazio,
.og-estado--erro {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 44px 24px;
  color: var(--muted);
  animation: og-estado-entra 0.2s ease-out;
}
@keyframes og-estado-entra {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.og-estado-icone {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
}
.og-estado--erro .og-estado-icone { background: var(--red-soft); color: var(--red); }
.og-estado-titulo {
  font-size: 15px; font-weight: 600;
  color: var(--ink);
  max-width: 460px;
}
.og-estado-texto {
  margin-top: 6px;
  font-size: 13px; line-height: 1.5;
  max-width: 440px;
  color: var(--muted);
}
.og-estado-detalhe { font-size: 11.5px; word-break: break-word; }
.og-estado-btn {
  margin-top: 16px;
  min-height: 36px;
  padding: 8px 18px;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.og-estado-btn:hover { background: var(--accent); color: var(--on-accent, #fff); }
@media (max-width: 768px) { .og-estado-btn { min-height: 44px; } }
.og-estado-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  .og-sk,
  .og-estado-auto,
  .og-estado--vazio,
  .og-estado--erro { animation: none; }
  .og-spin,
  .og-estado-auto::before { animation: none; border-top-color: var(--accent); border-right-color: var(--accent); }
  .og-estado-btn { transition: none; }
}

@media (max-width: 640px) {
  .og-sk-pagina-topo .og-sk-pill:last-child { display: none; }
  .og-sk-detalhe-grade { grid-template-columns: 1fr; }
  .og-sk-linha-tab { gap: 10px; }
}

/* ---------- esqueleto-espelho (OG.espelho): desenho real da tela em cinza ---------- */
.og-estado--espelho { padding: 0 !important; margin: 0; border: 0; background: none; min-height: 0; }
.og-espelho { pointer-events: none; user-select: none; -webkit-user-select: none; }
/* o desenho copia as classes da tela real (ex.: kn-card--sla-red), e o CSS daquela tela pintaria borda, anel (::after), sombra e fundo
   em cor. No esqueleto tudo é cinza: a borda é sempre a mesma, sem anel, sem sombra, sem degradê, sem enfeite de pseudo-elemento. */
.og-espelho *:not(.og-sk) { border-color: var(--og-esp-borda) !important; box-shadow: none !important; outline: 0 !important; background-image: none !important; animation: none !important; }
.og-espelho *::before, .og-espelho *::after { display: none !important; }
.og-espelho .og-esp-b { flex: 0 0 auto; }
.og-espelho { animation: og-esp-pulso 1.6s ease-in-out infinite; }   /* um único pulso no desenho todo (barato), no lugar do brilho em cada barra */
.og-espelho .og-sk { animation: none; background-image: none; }
@keyframes og-esp-pulso { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .og-espelho { animation: none; } }
