/* Gestor — Planejamento de Demandas (réplica operacional Flask) */
.pd-hub { display: flex; flex-direction: column; gap: 12px; }
.pd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pd-head h2 { margin: 0; font-size: 1.15rem; color: #0f172a; }
.pd-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.pd-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #475569; }
.pd-field input, .pd-field select, .pd-field textarea {
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 7px 10px; min-width: 140px; background: #fff;
}
.pd-btn {
  border: 0; border-radius: 8px; background: #0f172a; color: #fff; padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.pd-btn.secondary { background: #fff; color: #0f172a; border: 1px solid #cbd5e1; }
.pd-btn.danger { background: #b91c1c; color: #fff; }
.pd-btn:hover { filter: brightness(1.05); }
.pd-btn:disabled,
.pd-btn.is-loading {
  opacity: 0.55;
  cursor: wait;
  filter: none;
  pointer-events: none;
}
.pd-status { font-size: 12px; color: #64748b; min-height: 1.2em; }
.pd-status.is-error { color: #b91c1c; }
.pd-muted { color: #94a3b8; font-size: 12px; }

/* Overlay Robozinho AI */
.pd-sku-view { position: relative; min-height: 240px; }
.pd-ia-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 10px;
  padding: 24px;
}
.pd-ia-overlay.hidden { display: none !important; }
.pd-ia-overlay__card {
  background: #fff; border-radius: 12px; padding: 28px 32px; max-width: 360px;
  text-align: center; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.pd-ia-overlay__card strong { font-size: 1.05rem; color: #0f172a; }
.pd-ia-overlay__card p { margin: 0; font-size: 13px; color: #475569; line-height: 1.45; }
.pd-ia-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid #e2e8f0; border-top-color: #0f172a;
  animation: pd-ia-spin 0.8s linear infinite;
}
@keyframes pd-ia-spin {
  to { transform: rotate(360deg); }
}

/* Cards resumo ruptura */
.pd-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.pd-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; text-align: center;
}
.pd-card span { display: block; font-size: 11px; color: #64748b; }
.pd-card strong { font-size: 1.3rem; color: #0f172a; }

/* Legenda cobertura (Flask) */
.pd-legenda {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 16px; font-size: 13px;
}
.pd-legenda h3 { margin: 0 0 8px; font-size: 14px; color: #0f172a; }
.pd-legenda p { margin: 0; color: #475569; line-height: 1.5; }

/* Tabelas */
.pd-table-wrap { overflow: auto; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; max-height: 70vh; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pd-table--ruptura thead th,
.pd-table--mrp thead th {
  position: sticky; top: 0; background: #212529; color: #fff; text-align: left; padding: 8px 10px;
  border-bottom: 1px solid #334155; white-space: nowrap; z-index: 2;
}
.pd-table th {
  position: sticky; top: 0; background: #f8fafc; text-align: left; padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0; color: #334155; white-space: nowrap; z-index: 1;
}
.pd-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; color: #0f172a; white-space: nowrap; }
.pd-table tr:hover td { background: inherit; }
.pd-table tr.is-clickable { cursor: pointer; }

/* Cores de linha Flask */
.pd-row--ruptura td { background: #D41159 !important; color: #fff !important; }
.pd-row--risco td { background: #C8A500 !important; color: #fff !important; }
.pd-row--ok td { background: #009E73 !important; color: #fff !important; }
.pd-row--excesso td { background: #0072B2 !important; color: #fff !important; }
.pd-row--ruptura a, .pd-row--risco a, .pd-row--ok a, .pd-row--excesso a { color: #fff; text-decoration: none; }

.pd-table input.pd-cell {
  width: 72px; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 6px; text-align: right; font-size: 12px;
}
.pd-table input.pd-cell--readonly { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.pd-table input.pd-cell--low { background: #fee2e2; color: #b91c1c; }
.pd-table input.pd-cell--ok { background: #dcfce7; color: #15803d; }
.pd-cell-wrap { display: flex; align-items: center; gap: 4px; }
.pd-table input.pd-cell--ajuste {
  background: #fff7ed; color: #9a3412; border-color: #fdba74;
}
.pd-ajuste-btn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 4px;
  background: #ea580c;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 6px;
  cursor: pointer;
  line-height: 1.2;
}
.pd-ajuste-btn:hover { filter: brightness(1.08); }

/* Matriz MRP transposta */
.pd-mrp-wrap { overflow: auto; max-height: 65vh; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.pd-table--mrp .pd-mrp-fix { position: sticky; left: 0; z-index: 3; background: #f8fafc; font-weight: 600; min-width: 140px; }
.pd-table--mrp thead .pd-mrp-fix { background: #212529; color: #fff; z-index: 4; }
.pd-mrp-grupo td { background: #e2e8f0; font-weight: 700; color: #334155; font-size: 12px; }

/* Card produto SKU */
.pd-sku-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
}
.pd-sku-card h3 { margin: 0 0 8px; font-size: 1rem; color: #0f172a; }
.pd-sku-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; font-size: 12px; }
.pd-sku-card-grid dt { color: #64748b; }
.pd-sku-card-grid dd { margin: 0 0 6px; font-weight: 600; color: #0f172a; }
.pd-vendas-mini { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.pd-vendas-mini th, .pd-vendas-mini td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: center; }

.pd-grid-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.pd-kpi { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; }
.pd-kpi span { display: block; font-size: 11px; color: #64748b; }
.pd-kpi strong { font-size: 1.05rem; color: #0f172a; }

.pd-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.pd-chart {
  width: 100%; height: 220px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px;
}
.pd-chart h4 { margin: 0 0 4px; font-size: 12px; color: #475569; text-align: center; }

.pd-pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 8px 0; font-size: 13px; }
.pd-subtotal { font-size: 13px; color: #334155; margin: 4px 0 8px; font-weight: 600; }

.pd-upload { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 16px; text-align: center; margin-bottom: 10px; }
.pd-upload input[type=file] { font-size: 12px; }

/* Relatórios de projeção (SKU / Família) */
.pd-relatorios-wrap { max-height: 72vh; }
.pd-table--relatorios { min-width: max-content; }
.pd-table--relatorios thead th {
  position: sticky; top: 0; background: #212529; color: #fff; z-index: 2;
  text-align: right; padding: 8px 10px; border-bottom: 1px solid #334155;
}
.pd-table--relatorios thead th.pd-relatorios-sticky,
.pd-table--relatorios thead th.pd-relatorios-sticky--2 { text-align: left; }
.pd-table--relatorios td { text-align: right; }
.pd-table--relatorios td.pd-relatorios-sticky,
.pd-table--relatorios td.pd-relatorios-sticky--2 { text-align: left; }
.pd-table--relatorios .pd-num { font-variant-numeric: tabular-nums; }
.pd-relatorios-sticky {
  position: sticky; left: 0; z-index: 3; background: #fff; font-weight: 600;
  min-width: 140px; max-width: 220px; box-shadow: 1px 0 0 #e2e8f0;
  overflow: hidden; text-overflow: ellipsis;
}
.pd-relatorios-sticky--2 {
  left: 140px; min-width: 120px; max-width: 140px; font-weight: 500; color: #475569;
}
.pd-table--relatorios thead .pd-relatorios-sticky {
  background: #212529; color: #fff; z-index: 5;
}
.pd-table--relatorios thead .pd-relatorios-sticky--2 {
  background: #212529; color: #fff; z-index: 5;
}
.pd-relatorios-row--est .pd-relatorios-sticky { background: #f8fafc; }
.pd-relatorios-row--sug .pd-relatorios-sticky,
.pd-relatorios-row--sug .pd-relatorios-sticky--2 { background: #f1f5f9; }
.pd-relatorios-row--sug td { color: #334155; }
.pd-relatorios-row--est:hover td,
.pd-relatorios-row--sug:hover td { filter: brightness(0.98); }
