/* ==========================================================================
   Primasole — CSS das telas.

   Último arquivo da cadeia (ps-core → ps-features → ps-components → este).
   Contém só o que é específico das páginas: grelhas da visão geral e a
   apresentação do design system. Tudo em tokens --ds-*, sem cor fixa.
   ========================================================================== */

/* ---- Grelhas de conteúdo ---- */
.ds-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--ds-space-200);
  margin-bottom: var(--ds-space-200);
}
.ds-card__title {
  margin: 0 0 var(--ds-space-150);
  font-size: 13px;
  font-weight: var(--ds-font-weight-semibold);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ds-text-subtlest);
}
.ds-label {
  display: block;
  margin-bottom: var(--ds-space-050);
  font-size: 12px;
  font-weight: var(--ds-font-weight-semibold);
  color: var(--ds-text-subtle);
}

/* ==========================================================================
   Design system — guia vivo
   ========================================================================== */
.ds-design { display: grid; gap: var(--ds-space-200); }

.ds-sec { padding: var(--ds-space-250); }
.ds-sec__hd { margin-bottom: var(--ds-space-200); }
.ds-sec__hd h2 {
  margin: 0; font-size: 16px; font-weight: var(--ds-font-weight-semibold);
  color: var(--ds-text);
}
.ds-sec__hd p { margin: 4px 0 0; font-size: 13px; color: var(--ds-text-subtlest); }
.ds-sec__sub {
  margin: var(--ds-space-250) 0 var(--ds-space-100);
  font-size: 11px; font-weight: var(--ds-font-weight-bold);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ds-text-subtlest);
}
.ds-sec__body > .ds-sec__sub:first-child { margin-top: 0; }

/* Linha de exemplos (botões, selos) */
.ds-demo-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--ds-space-100);
  margin-bottom: var(--ds-space-150);
}
.ds-demo-row:last-child { margin-bottom: 0; }

/* Grelha de formulário de exemplo */
.ds-demo-form {
  display: grid; gap: var(--ds-space-150);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.ds-demo-form .ds-field--full { grid-column: 1 / -1; }

/* Cartões lado a lado (gráficos, estados) */
.ds-demo-cards {
  display: grid; gap: var(--ds-space-200);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Amostras de cor */
.ds-sw-grid {
  display: grid; gap: var(--ds-space-150);
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.ds-sw-grid--chart { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.ds-sw {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px var(--ds-space-100);
  padding: var(--ds-space-100);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-medium);
  background: var(--ds-surface);
  min-width: 0;
}
.ds-sw__chip {
  grid-row: span 2;
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: var(--ds-radius-small);
  border: 1px solid var(--ds-border);
}
.ds-sw__name {
  font-size: 12px; font-weight: var(--ds-font-weight-medium);
  color: var(--ds-text); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ds-sw code {
  font-family: var(--ds-font-family-code); font-size: 10px;
  color: var(--ds-text-subtlest);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ds-sw--chart {
  grid-template-columns: 1fr; justify-items: center; gap: 6px;
}
.ds-sw--chart .ds-sw__chip { grid-row: auto; }

/* Escala tipográfica */
.ds-type { display: grid; gap: var(--ds-space-150); }
.ds-type p { margin: 0; color: var(--ds-text); }
.ds-type__h1 { font-size: 28px; font-weight: var(--ds-font-weight-bold); letter-spacing: -.02em; }
.ds-type__h2 { font-size: 20px; font-weight: var(--ds-font-weight-semibold); letter-spacing: -.01em; }
.ds-type__body { font-size: 14px; line-height: 1.6; color: var(--ds-text-subtle); }
.ds-type__small { font-size: 12px; color: var(--ds-text-subtlest); }
.ds-type__code code {
  font-family: var(--ds-font-family-code); font-size: 12px;
  padding: 3px 8px; border-radius: var(--ds-radius-small);
  background: var(--ds-background-neutral); color: var(--ds-text);
}

/* Observação em destaque */
.ds-note {
  display: flex; align-items: flex-start; gap: var(--ds-space-100);
  margin: var(--ds-space-200) 0 0;
  padding: var(--ds-space-150);
  border-radius: var(--ds-radius-medium);
  background: var(--ds-background-selected);
  color: var(--ds-text-subtle);
  font-size: 12.5px; line-height: 1.55;
}
.ds-note i { color: var(--ds-icon-brand); margin-top: 2px; }

@media (max-width: 640px) {
  .ds-sec { padding: var(--ds-space-200); }
  .ds-demo-row .ds-button { flex: 1 1 auto; justify-content: center; }
}

/* ==========================================================================
   Controle de Produção WF
   ========================================================================== */

/* ---- Quadro kanban ---- */
.wf-board { display: grid; gap: var(--ds-space-300); }
.wf-board__meta {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: var(--ds-space-100); color: var(--ds-text-subtle); font-size: 12px;
}
.wf-board__jph { font-size: 13px; color: var(--ds-text); }
.wf-board__jph b { font-size: 15px; }
.wf-board__legenda { display: flex; gap: var(--ds-space-200); flex-wrap: wrap; font-size: 12px; color: var(--ds-text-subtle); }
.wf-leg { display: inline-flex; align-items: center; gap: 6px; }
.wf-leg__dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--ds-border); }

.wf-board__grupo {
  background: var(--ds-surface-raised); border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-large, 10px); padding: var(--ds-space-200);
}
.wf-board__modelo {
  font-weight: var(--ds-font-weight-semibold); margin-bottom: var(--ds-space-150);
  font-size: 15px;
}
.wf-board__scroll { overflow-x: auto; }
.wf-board__tab { border-collapse: collapse; width: 100%; min-width: 640px; }
.wf-board__tab th, .wf-board__tab td { border: 1px solid var(--ds-border); }
.wf-board__cor {
  padding: 6px 8px; font-size: 11px; font-weight: var(--ds-font-weight-semibold);
  text-transform: uppercase; letter-spacing: .02em; color: var(--ds-text-subtle);
  text-align: center; min-width: 74px; background: var(--ds-surface-sunken);
}
.wf-board__cor span { display: block; }
.wf-chip {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  border: 1px solid var(--ds-border-bold); vertical-align: -1px; margin-right: 4px;
}
.wf-board__peca-th { background: var(--ds-surface-sunken); }
.wf-board__peca {
  padding: 6px 10px; text-align: left; font-size: 12px; white-space: nowrap;
  color: var(--ds-text-subtle); font-weight: var(--ds-font-weight-regular);
  background: var(--ds-surface-sunken); position: sticky; left: 0;
}
.wf-board__peca b { color: var(--ds-text-brand); margin-right: 2px; }

.wf-cell { padding: 4px 6px; text-align: center; min-width: 64px; }
.wf-cell__dias { display: block; font-size: 14px; font-weight: var(--ds-font-weight-semibold); }
.wf-cell__qtd { display: block; font-size: 10px; color: var(--ds-text-subtle); }
.wf-cell--void { background: var(--ds-surface-sunken); }
.wf-cell--none { color: var(--ds-text-subtlest); }
.wf-cell--red { background: var(--ds-background-accent-red-subtlest); }
.wf-cell--red .wf-cell__dias { color: var(--ds-text-danger); }
.wf-cell--yellow { background: var(--ds-background-accent-yellow-subtlest); }
.wf-cell--yellow .wf-cell__dias { color: var(--ds-text-warning); }
.wf-cell--green { background: var(--ds-background-accent-green-subtlest); }
.wf-cell--green .wf-cell__dias { color: var(--ds-text-success); }
.wf-cell--blue { background: var(--ds-background-accent-blue-subtlest); }
.wf-cell--blue .wf-cell__dias { color: var(--ds-text-brand); }

.wf-board__kpis {
  display: flex; gap: var(--ds-space-300); flex-wrap: wrap;
  margin-top: var(--ds-space-200); padding-top: var(--ds-space-150);
  border-top: 1px solid var(--ds-border);
}
.wf-kpi { display: flex; flex-direction: column; }
.wf-kpi__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ds-text-subtlest); font-weight: var(--ds-font-weight-semibold);
}
.wf-kpi__valor { font-size: 18px; font-weight: var(--ds-font-weight-semibold); }
.wf-kpi__valor small { font-size: 11px; color: var(--ds-text-subtle); font-weight: var(--ds-font-weight-regular); }

/* Modo TV: só o quadro, tela cheia, tipografia maior. */
body.wf-tv .ds-topnav, body.wf-tv .ds-sidebar { display: none; }
body.wf-tv .ds-main { margin: 0; }
body.wf-tv .ds-content { max-width: none; }
body.wf-tv .wf-cell__dias { font-size: 18px; }
body.wf-tv .wf-cell__qtd { font-size: 12px; }
body.wf-tv .wf-board__cor { font-size: 12px; }
body.wf-tv .wf-board__peca { font-size: 13px; }

/* ---- Importar bases ---- */
.wf-imp-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--ds-space-200); margin-bottom: var(--ds-space-300);
}
.wf-imp-card {
  background: var(--ds-surface-raised); border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-large, 10px); padding: var(--ds-space-250);
  display: flex; flex-direction: column; gap: var(--ds-space-100);
}
.wf-imp-card__ico { font-size: 20px; color: var(--ds-text-brand); }
.wf-imp-card__txt { font-size: 12px; color: var(--ds-text-subtle); flex: 1; }
.wf-imp-card__arquivo { font-size: 12px; color: var(--ds-text); min-height: 16px; word-break: break-all; }
.wf-imp-card__acoes { display: flex; gap: var(--ds-space-100); flex-wrap: wrap; }

.wf-sec-titulo {
  margin: var(--ds-space-300) 0 var(--ds-space-150);
  font-size: 15px; font-weight: var(--ds-font-weight-semibold);
}

/* ---- Tabela simples (histórico, cores, peças) ---- */
.wf-tabela { overflow-x: auto; background: var(--ds-surface-raised); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-large, 10px); }
.wf-tabela table { border-collapse: collapse; width: 100%; font-size: 13px; }
.wf-tabela th {
  text-align: left; padding: 8px 12px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .02em; color: var(--ds-text-subtlest); border-bottom: 1px solid var(--ds-border);
}
.wf-tabela td { padding: 7px 12px; border-bottom: 1px solid var(--ds-border); }
.wf-tabela tr:last-child td { border-bottom: 0; }

/* ---- Abas e filtros dos cadastros ---- */
.wf-abas { display: flex; gap: var(--ds-space-050); margin-bottom: var(--ds-space-200); flex-wrap: wrap; }
.wf-aba {
  border: 1px solid var(--ds-border); background: var(--ds-surface-raised);
  color: var(--ds-text-subtle); padding: 7px 14px; border-radius: 999px;
  font-size: 13px; cursor: pointer;
}
.wf-aba:hover { background: var(--ds-surface-hovered); }
.wf-aba.is-ativa {
  background: var(--ds-background-brand-bold); color: var(--ds-text-inverse);
  border-color: var(--ds-background-brand-bold);
}
.wf-filtro-pend {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--ds-text-subtle); margin-bottom: var(--ds-space-150); cursor: pointer;
}

/* ---- Parâmetros ---- */
.wf-config {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--ds-space-200); margin-bottom: var(--ds-space-200); max-width: 760px;
}

/* ---- Romaneios (envio / recebimento por bipagem) ---- */
.wf-rom__scan {
  display: flex; align-items: center; gap: var(--ds-space-150);
  background: var(--ds-surface-raised); border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-large, 10px); padding: var(--ds-space-200);
  margin-bottom: var(--ds-space-200);
}
.wf-rom__scan > i { font-size: 22px; color: var(--ds-text-brand); }
.wf-rom__scan .ds-input { max-width: 420px; font-size: 15px; }
.wf-rom__aviso { font-size: 12px; color: var(--ds-text-danger); }

.wf-rom__lista { margin-bottom: var(--ds-space-200); }
.wf-rom__cod { font-weight: var(--ds-font-weight-semibold); white-space: nowrap; }
.wf-rom__qtd-in { width: 90px; text-align: right; }
.wf-rom__vazio { padding: var(--ds-space-300); text-align: center; color: var(--ds-text-subtlest); font-size: 13px; }

.wf-rom__acoes {
  display: flex; align-items: center; gap: var(--ds-space-150); flex-wrap: wrap;
  margin-bottom: var(--ds-space-300);
}
.wf-rom__acoes .ds-input { max-width: 340px; }
.wf-rom__resumo { font-size: 13px; color: var(--ds-text-subtle); min-width: 130px; }

/* ---- Cartões de operação (qualidade / montagem) ---- */
.wf-qua-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--ds-space-200); margin-bottom: var(--ds-space-300); align-items: start;
}
.wf-qua-card {
  background: var(--ds-surface-raised); border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-large, 10px); padding: var(--ds-space-250);
  display: flex; flex-direction: column; gap: var(--ds-space-150);
}
.wf-qua-card > b { font-size: 14px; }
.wf-qua-card > b i { color: var(--ds-text-brand); margin-right: 6px; }
.wf-qua-card__txt { font-size: 12px; color: var(--ds-text-subtle); }
.wf-qua-card .ds-button { align-self: flex-start; }

.wf-mon__acoes { white-space: nowrap; }

/* ---- Logo oficial P.S.C. no topo (mais largo que o monograma antigo) ---- */
.ds-topnav__logo .ds-logo { height: 26px; }

/* ---- Fase 5: visão geral, relatórios e scanner ---- */
.wf-ov__valor--ruim { color: var(--ds-text-danger); }
.wf-ov__valor--bom { color: var(--ds-text-success); }
.wf-ov__foot { font-size: 12px; color: var(--ds-text-subtlest); }

.wf-rel__filtro { margin-bottom: var(--ds-space-200); }
.wf-rel__rows { max-height: 420px; overflow-y: auto; }
.wf-rel__desc { font-size: 11px; color: var(--ds-text-subtlest); }

.wf-campo-scan { display: flex; gap: var(--ds-space-050); }
.wf-campo-scan .ds-input { flex: 1; }

/* Overlay do scanner pela câmera */
.wf-scan {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(12, 10, 9, .78);
}
.wf-scan__box {
  position: relative; width: min(560px, 94vw);
  background: var(--ds-surface-raised); border-radius: var(--ds-radius-large, 12px);
  padding: var(--ds-space-150); display: grid; gap: var(--ds-space-100);
}
.wf-scan__video { width: 100%; border-radius: var(--ds-radius-medium); background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.wf-scan__mira {
  position: absolute; top: calc(50% - 60px); left: 50%; transform: translateX(-50%);
  width: 70%; height: 120px; border: 2px solid var(--ds-background-brand-bold);
  border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .12);
}
.wf-scan__hint { text-align: center; font-size: 12px; color: var(--ds-text-subtle); }
.wf-scan__ultimo {
  text-align: center; font-size: 13px; font-weight: var(--ds-font-weight-semibold);
  color: var(--ds-text-success);
}
.wf-scan__fechar { justify-self: center; }

/* ---- Visão geral: cartões de mesma altura e lista com rolagem própria ---- */
.ds-grid-2 > .ds-card { display: flex; flex-direction: column; }
.ds-grid-2 > .ds-card > div:not(.ds-card__title) { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.wf-ov__chart { min-height: 210px; }
.wf-ov__lista { max-height: 260px; overflow-y: auto; justify-content: flex-start !important; }

/* O primeiro indicador é o que exige ação: ganha a borda da marca. */
.wf-ov__destaque { box-shadow: inset 3px 0 0 var(--ds-background-brand-bold), var(--ds-shadow-raised); }

/* ---- Fila de pintura (o que mandar pintar primeiro) ---- */
.wf-fila__lead { margin: 0 0 var(--ds-space-150); font-size: 12.5px; color: var(--ds-text-subtle); }
.wf-tabela__int { border-collapse: collapse; width: 100%; font-size: 13px; }
.wf-tabela__int th {
  text-align: left; padding: 8px 10px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ds-text-subtlest); border-bottom: 1px solid var(--ds-border);
  white-space: nowrap;
}
.wf-tabela__int td { padding: 8px 10px; border-bottom: 1px solid var(--ds-border); }
.wf-tabela__int tr:last-child td { border-bottom: 0; }
.wf-fila__num { text-align: right; white-space: nowrap; }
.wf-fila__pos { font-weight: var(--ds-font-weight-semibold); color: var(--ds-text-subtlest); width: 34px; }
.wf-fila__sug { font-weight: var(--ds-font-weight-semibold); color: var(--ds-text-brand); }
.wf-tabela__int tr.is-critico td { background: var(--ds-background-accent-red-subtlest); }
.wf-tabela__int tr.is-critico .wf-fila__pos { color: var(--ds-text-danger); }

/* ---- Aviso de estado dos dados (ELOG vencido, sem dados) ---- */
.wf-aviso {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--ds-radius-medium);
  background: var(--ds-background-selected); color: var(--ds-text-subtle);
  font-size: 13px; line-height: 1.5;
}
.wf-aviso i { margin-top: 2px; color: var(--ds-text-brand); }
.wf-aviso--alerta {
  background: var(--ds-background-accent-yellow-subtlest); color: var(--ds-text);
}
.wf-aviso--alerta i { color: var(--ds-text-warning); }

/* ---- Gargalo do carset e composição ---- */
.wf-kpi__gargalo { font-size: 14px; color: var(--ds-text-warning); }
.wf-cad__lead { margin: 0 0 var(--ds-space-150); font-size: 12.5px; color: var(--ds-text-subtle); }

/* ---- Indicadores do cliente: barra de aderência ---- */
.wf-stl__cel { min-width: 190px; }
.wf-stl__barra {
  display: inline-block; width: 110px; height: 8px; border-radius: 99px;
  background: var(--ds-background-neutral); overflow: hidden; vertical-align: middle; margin-right: 8px;
}
.wf-stl__barra i { display: block; height: 100%; border-radius: 99px; }
.wf-stl__barra--ok { background: var(--ds-background-success-bold); }
.wf-stl__barra--atencao { background: var(--ds-text-warning); }
.wf-stl__barra--ruim { background: var(--ds-background-danger-bold); }
.wf-stl__pct { font-size: 12.5px; font-weight: var(--ds-font-weight-semibold); }
.wf-stl__pct--ok { color: var(--ds-text-success); }
.wf-stl__pct--atencao { color: var(--ds-text-warning); }
.wf-stl__pct--ruim { color: var(--ds-text-danger); }
.wf-stl__na { color: var(--ds-text-subtlest); }

/* ---- Ajuste de inventário ---- */
.wf-inv__comparativo {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--ds-space-100);
  padding: var(--ds-space-150); border-radius: var(--ds-radius-medium);
  background: var(--ds-surface-sunken); border: 1px solid var(--ds-border);
}
.wf-inv__comparativo > div { display: flex; flex-direction: column; }
.wf-inv__comparativo span {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ds-text-subtlest);
}
.wf-inv__comparativo b { font-size: 17px; font-weight: var(--ds-font-weight-semibold); }
.wf-inv__delta.is-sobra b { color: var(--ds-text-success); }
.wf-inv__delta.is-falta b { color: var(--ds-text-danger); }
.wf-inv__aviso {
  grid-column: 1 / -1; margin: 4px 0 0; font-size: 12px; color: var(--ds-text-warning);
}
.wf-inv__sobra { color: var(--ds-text-success); }
.wf-inv__falta { color: var(--ds-text-danger); }
/* O formulário de contagem é um ato deliberado: largura de leitura, não a tela toda. */
.wf-inv-form { max-width: 560px; }
.wf-ov__avisos { display: grid; gap: var(--ds-space-100); margin-bottom: var(--ds-space-100); }

/* ---- Evidência fotográfica do refugo ---- */
.wf-foto__link { color: var(--ds-text-brand); text-decoration: none; }
.wf-foto__link:hover { text-decoration: underline; }
