/* Central de Precificação (aba Precificação). Usa somente as variáveis de app.css (identidade escura e compacta).
   O botão “Marketplaces” é o componente compartilhado filterMenu (estilos em app.css — não redefinidos aqui). */

/* a tabela larga aproveita a largura da tela */
#app:has(> .pricing) { width: min(1680px, 100% - 32px); padding-bottom: 40px; }

.pricing { --pr-prod-w: 260px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* barra superior: somente busca + Marketplaces */
.pr-top { display: flex; gap: 8px; align-items: center; }
.pr-top .pr-search { flex: 0 1 360px; min-width: 0; min-height: var(--control-h-sm); font-size: .9rem; }

/* indicadores: uma linha discreta, cada item filtra a tabela */
.pr-ind { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 32px; }
.pr-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text-2); font: inherit; font-size: .8rem; cursor: pointer; transition: background var(--t), border-color var(--t); white-space: nowrap; }
.pr-chip .n { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.pr-chip.warn .n { color: var(--warn); }
.pr-chip.err .n { color: var(--err); }
.pr-chip:hover { background: var(--surface-2); border-color: var(--line-strong); }
.pr-chip.on { border-color: rgba(34, 211, 238, .55); background: var(--primary-soft); color: var(--text); }
.pr-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pr-ver { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.pr-more { width: 34px; height: 34px; }

.pr-hint { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--text-2); }
.pr-hint[hidden] { display: none; }

/* tabela: rolagem própria (cabeçalho e coluna do produto fixos) */
.pr-table-wrap { position: relative; overflow: auto; max-height: calc(100dvh - 60px - 150px); min-height: 280px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overscroll-behavior: contain; }
.pr-table-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pr-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.pr-table th, .pr-table td { padding: 5px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.pr-table thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); color: var(--muted); font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; height: 28px; }
.pr-table thead tr.h2 th { top: 28px; text-transform: none; letter-spacing: 0; font-size: .72rem; color: var(--text-2); }
.pr-table thead th.grp { text-align: left; color: var(--text); border-left: 1px solid var(--line-strong); }
/* nome do canal acompanha a rolagem lateral (fica visível enquanto houver colunas do canal na tela) */
.pr-table thead th.grp .grp-label { position: sticky; left: calc(var(--pr-prod-w) + 10px); }
.pr-table .gs { border-left: 1px solid var(--line-strong); }
.pr-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pr-table th.c-prod { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; font-weight: 400; text-transform: none; letter-spacing: 0; width: var(--pr-prod-w); min-width: var(--pr-prod-w); max-width: var(--pr-prod-w); box-sizing: border-box; border-right: 1px solid var(--line-strong); box-shadow: 6px 0 10px -8px rgba(0, 0, 0, .6); }
.pr-table thead th.c-prod { z-index: 4; background: var(--surface-2); text-transform: uppercase; font-size: .7rem; font-weight: 650; letter-spacing: .04em; color: var(--muted); }
.pr-table .c-prod .pr-sku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.pr-table .c-prod .pr-desc { color: var(--text); overflow: hidden; text-overflow: ellipsis; max-width: calc(var(--pr-prod-w) - 18px); }
.pr-table .c-prod .flag { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; font-size: .62rem; font-weight: 800; color: var(--bg); background: var(--warn); font-family: var(--font); }
.pr-table .fam-tag { font-family: var(--font); font-size: .64rem; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 6px; }
.pr-table tbody tr { cursor: pointer; }
.pr-table tbody tr:hover td, .pr-table tbody tr:hover th.c-prod { background: var(--surface-2); }
.pr-table tbody tr:focus-visible { outline: none; }
.pr-table tbody tr:focus-visible th.c-prod { box-shadow: inset 3px 0 0 var(--primary), 6px 0 10px -8px rgba(0, 0, 0, .6); }
.pr-table td.below { color: var(--warn); }
.pr-table td.neg { color: var(--err); }
.pr-table td.best { font-weight: 700; color: var(--text); }
.pr-table td.best.neg { color: var(--err); }
.pr-best { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: middle; }
.pr-diff { display: inline-block; margin-left: 4px; font-size: .7rem; font-weight: 700; color: var(--warn); cursor: help; }
.pr-dot { margin-left: 3px; font-weight: 700; cursor: help; }
.pr-dot.rec { color: var(--primary); }
.pr-dot.stale { color: var(--warn); }
.pr-sub { margin-left: 4px; font-size: .66rem; color: var(--muted); }
.pr-pending { color: var(--muted); font-style: italic; text-align: center; }
.pr-table tr.fam th.c-prod .pr-desc { color: var(--text-2); }
.pr-empty { padding: 28px 20px; text-align: center; }
.pr-empty p { margin: 0 0 8px; }

/* painel do produto (mesma gaveta das Tarefas: .drawer / .drawer-bg de app.css) */
.pr-drawer .pr-dh { min-width: 0; flex: 1; }
.pr-drawer .pr-dh .pr-sku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; color: var(--text-2); }
.pr-drawer .pr-dh h2 { margin: 2px 0 0; font-size: 1.02rem; font-weight: 650; overflow-wrap: anywhere; }
.pr-body section { padding: 12px 0; }
.pr-kvs { display: grid; gap: 6px; }
.pr-kv { display: grid; grid-template-columns: 130px 1fr auto; gap: 2px 10px; align-items: baseline; font-size: .86rem; }
.pr-kv .k { color: var(--muted); }
.pr-kv .v { color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pr-kv .s { justify-self: end; }
.pr-kv .n { grid-column: 2 / -1; font-size: .74rem; color: var(--muted); }
.pr-kv code, .pr-body code { font-size: .8rem; color: var(--text); }
.pr-st { display: inline-block; font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); white-space: nowrap; }
.pr-st.st-imp { color: var(--text-2); }
.pr-st.st-rec { color: var(--primary); border-color: rgba(34, 211, 238, .4); }
.pr-st.st-nv, .pr-st.val-pendente { color: var(--muted); border-style: dashed; }
.pr-st.st-warn, .pr-st.val-a_confirmar { color: var(--warn); border-color: rgba(251, 191, 36, .45); }
.pr-st.val-comprovado { color: var(--ok); border-color: rgba(52, 211, 153, .4); }
.pr-st.val-definido_admin, .pr-st.val-inicial { color: var(--primary); border-color: rgba(34, 211, 238, .4); }
.pr-flags { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--text-2); }
.pr-flags li::before { content: "• "; color: var(--muted); }
.pr-flags li.warn { color: #fde7a7; }
.pr-flags li.warn::before { color: var(--warn); }
.pr-mini { width: 100%; border-collapse: collapse; font-size: .82rem; }
.pr-mini th, .pr-mini td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.pr-mini thead th { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.pr-mini tbody th { font-weight: 500; color: var(--text-2); text-transform: none; letter-spacing: 0; font-size: inherit; }
.pr-mini .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-mini .neg, .pr-kv .neg { color: var(--err); }
.pr-mini .below { color: var(--warn); }
.pr-mini tr.tot th, .pr-mini tr.tot td { font-weight: 700; color: var(--text); }
.pr-mini tr.best th, .pr-mini tr.best td { color: var(--text); font-weight: 650; }
.pr-diffv { color: var(--warn); font-weight: 650; }
.pr-note { margin: 8px 0 0; font-size: .78rem; color: var(--muted); line-height: 1.45; }
.pr-note b { color: var(--text-2); font-weight: 600; }
.pr-note.warn { color: #fde7a7; }
.pr-tkopts { gap: 8px 18px; margin-bottom: 10px; }
.pr-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.pr-inline select { width: auto; min-height: var(--control-h-sm); font-size: .82rem; }
.pr-seg { display: grid; grid-auto-flow: column; width: 100%; margin-bottom: 10px; }
.pr-seg button { padding: 7px 8px; font-size: .82rem; }
.pr-simin { display: grid; gap: 10px; }
.pr-simout { margin-top: 10px; }
.pr-simout .row { margin-top: 10px; }
.pr-hist { margin: 0; padding: 0; list-style: none; font-size: .8rem; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }

/* janelas (parâmetros, colunas, fretes, importação) */
.pr-h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 0; font-weight: 650; }
.pr-colgrp { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 2px 16px; }
.pr-colgrp legend { font-size: .8rem; font-weight: 650; color: var(--text-2); padding: 0 4px; }
.pr-pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pr-scroll { overflow: auto; max-height: min(60vh, 520px); }
.pr-freight th, .pr-freight td { white-space: nowrap; }
.pr-freight tbody th { position: sticky; left: 0; background: var(--surface); }
.pr-det { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font-size: .84rem; }
.pr-det > summary { cursor: pointer; color: var(--text-2); font-weight: 600; padding: 4px 0; }
.pr-det ul { margin: 6px 0; padding-left: 18px; color: var(--text-2); }
.pr-det li { margin: 2px 0; overflow-wrap: anywhere; }
.pr-preview .notice ul { margin-top: 4px; }
.pr-file { color: var(--text-2); font: inherit; font-size: .86rem; max-width: 100%; }
.pr-file::file-selector-button { margin-right: 10px; min-height: var(--control-h-sm); padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.pr-file::file-selector-button:hover { background: var(--surface-3); }

@media (max-width: 760px) {
  #app:has(> .pricing) { width: calc(100% - 24px); }
  .pr-top .pr-search { flex: 1 1 auto; }
  .pr-ind { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .pr-ind::-webkit-scrollbar { display: none; }
  .pr-ver { display: none; }
  .pr-table-wrap { max-height: calc(100dvh - 54px - 72px - 150px); }
  .pricing { --pr-prod-w: 142px; }
  .pr-table .c-prod .pr-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .78rem; line-height: 1.25; }
  .pr-table .c-prod .fam-tag { display: none; }
  .pr-kv { grid-template-columns: 92px 1fr auto; }
  .pr-mini .pr-st { white-space: normal; line-height: 1.25; padding: 2px 7px; border-radius: 7px; }
  .pr-mini th, .pr-mini td { padding: 5px 4px; }
  .pr-seg { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
}
