/* Pedidos (ficha, lista, lote, nova venda), Itens vendidos, Etiquetas e Frete: pedidos.js e envios.js.
   Só variáveis de cor de demo.css, para o tema escuro valer aqui também. Na impressão, preto no branco. */

/* ---------- ficha do pedido ---------- */
.pd-volta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: var(--w-medium); color: var(--ink-2); margin-bottom: 10px; }
.pd-volta svg { width: 16px; height: 16px; }
.pd-volta:hover { color: var(--ink); }
.pd-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pd-cab h2 { font-size: 21px; font-weight: var(--w-display); letter-spacing: -.015em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pd-cab p { font-size: 13px; color: var(--ink-3); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pd-cab .acoes { position: relative; }
.pd-faixa { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 16px; border-radius: var(--r-2); background: var(--warn-bg); color: var(--ink-2); font-size: 13.5px; }
.pd-faixa svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--warn); }
.pd-faixa b { color: var(--ink); font-weight: var(--w-strong); }
.pd-sub { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; line-height: 1.35; margin-top: 1px; }
.pd-acoes-in { margin-top: 12px; }
.pd-itens { display: flex; flex-direction: column; }
.pd-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); }
.pd-item:first-child { border-top: 0; padding-top: 0; }
.pd-item > img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--paper-2); flex: none; }
.pd-item-t { flex: 1; min-width: 0; }
.pd-item-l { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.pd-item-l b { font-weight: var(--w-strong); }
.pd-item-t > small { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.pd-item-t s { color: var(--ink-3); }
.pd-torra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-2); background: var(--paper-2); font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.pd-torra > svg { width: 15px; height: 15px; flex: none; color: var(--accent-ink); }
.pd-torra > span { flex: 1 1 220px; min-width: 0; }
.pd-torra .tag { vertical-align: 1px; }
.pd-torra-sel { max-width: 100%; height: 30px; font-size: 12.5px; }
.pd-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pd-hist li { padding: 9px 0; border-top: 1px solid var(--hair); font-size: 13.5px; }
.pd-hist li:first-child { border-top: 0; padding-top: 0; }
.pd-hist b { font-weight: var(--w-strong); display: block; }
.pd-hist small { display: block; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.pd-parc { margin-top: 12px; }
.pd-parc .tag { margin-left: 4px; }
.pd-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.pd-foto { position: relative; margin: 0; aspect-ratio: 4 / 3; border-radius: var(--r-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--hair-2); background: var(--paper-2); }
.pd-foto img { width: 100%; height: 100%; object-fit: cover; }
.pd-foto-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--hair-2); }
.pd-foto-x svg { width: 14px; height: 14px; }
.pd-arquivo { cursor: pointer; }
.pd-arquivo:focus-within { outline: 2px solid var(--foco); outline-offset: 2px; }
.pd-off { opacity: .45; pointer-events: none; }

/* menu "Mais ações" (details nativo: abre e fecha sem script) */
.pd-mais { position: relative; }
.pd-mais > summary { list-style: none; cursor: pointer; }
.pd-mais > summary::-webkit-details-marker { display: none; }
.pd-mais > summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; margin-right: -4px; transition: transform var(--d-xs) var(--e-ui); }
.pd-mais[open] > summary svg { transform: rotate(180deg); }
.pd-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; width: 290px; max-width: calc(100vw - 32px); max-height: min(70vh, 540px); overflow-y: auto; background: var(--paper); border-radius: var(--r-3); box-shadow: 0 0 0 1px var(--hair-2), 0 24px 60px -18px rgba(0, 0, 0, .35); padding: 6px; }
.pd-mg { font: 500 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 4px; }
.pd-mg:first-child { padding-top: 6px; }
.pd-msep { height: 1px; background: var(--hair); margin: 6px 4px; }
.pd-mi { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-2); font-size: 13.5px; font-weight: var(--w-medium); color: var(--ink); }
.pd-mi svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-2); }
.pd-mi small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); margin-top: 1px; }
.pd-mi:hover { background: var(--paper-2); }
.pd-mi-perigo, .pd-mi-perigo svg { color: var(--neg); }
@media (max-width: 560px) {
  .pd-mais { width: 100%; }
  .pd-mais > summary { width: 100%; }
  .pd-menu { position: static; width: auto; max-width: none; margin-top: 6px; }
}

/* formulários da gaveta */
.pd-cr { display: flex; flex-direction: column; }
.pd-cr-l { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.2fr) 64px 92px; gap: 8px; align-items: end; padding: 10px 0; border-top: 1px solid var(--hair); }
.pd-cr-l:first-child { border-top: 0; padding-top: 0; }
.pd-cr-l .campo > span { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.pd-resumo { border-top: 1px solid var(--hair); padding-top: 12px; }
.pd-aviso { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); background: var(--paper-2); border-radius: var(--r-2); padding: 10px 12px; margin-top: 10px; }
.pd-aviso svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--warn); }
.pd-conta { font-size: 13.5px; color: var(--ink-2); min-height: 1.4em; }
.pd-conta b { color: var(--ink); }
.pd-dev { display: flex; flex-direction: column; }
.pd-dev-l { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 8px 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--hair); }
.pd-dev-l:first-child { border-top: 0; padding-top: 0; }
.pd-dev-l .t b { display: block; font-size: 13.5px; font-weight: var(--w-medium); }
.pd-dev-l .t small { color: var(--ink-3); font-size: 12px; }
.pd-dev-l .campo:nth-child(3) { grid-column: 1 / -1; }
.pd-zap { border-radius: var(--r-2); overflow: hidden; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--hair-2); }
.pd-zap-top { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--paper); border-bottom: 1px solid var(--hair); font-size: 13px; }
.pd-zap-top svg { width: 18px; height: 18px; color: var(--pos); }
.pd-zap-top small { color: var(--ink-3); margin-left: auto; }
.pd-zap-msgs { padding: 14px 12px; display: flex; justify-content: flex-end; }
.pd-bolha { max-width: 86%; background: var(--pos-bg); color: var(--ink); border-radius: 12px 12px 3px 12px; padding: 9px 11px; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .pd-cr-l { grid-template-columns: 1fr 1fr; }
  .pd-cr-l .campo:first-child { grid-column: 1 / -1; }
}

/* DANFE (na gaveta e na impressão) */
.pd-danfe-w { overflow-x: auto; }
.pd-danfe { min-width: 520px; border: 1px solid var(--hair-2); border-radius: var(--r-1); font-size: 12px; background: var(--paper); color: var(--ink); }
.pd-danfe small { display: block; font: 500 9.5px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.pd-danfe > div, .pd-danfe > p { padding: 8px 10px; border-top: 1px solid var(--hair-2); }
.pd-danfe > div:first-child { border-top: 0; }
.pd-danfe-cab { display: flex; justify-content: space-between; gap: 12px; }
.pd-danfe-cab small { text-transform: none; letter-spacing: 0; }
.pd-danfe-n { text-align: right; }
.pd-danfe-ch .mono { display: block; font-size: 11.5px; word-break: break-all; margin: 2px 0 6px; }
.pd-barras { display: block; width: 100%; height: 34px; fill: currentColor; }
.pd-danfe-g { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pd-danfe-tot { grid-template-columns: 1fr 1fr 1fr; }
.pd-danfe-t td, .pd-danfe-t th { font-size: 11.5px; }
.pd-danfe-rod { font-size: 11px; color: var(--ink-3); }

/* ---------- lista de pedidos ---------- */
.pd-sep, .itn-moer { padding: 0; margin-bottom: 16px; }
.pd-sep > summary, .itn-moer > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; border-radius: var(--r-3); }
.pd-sep > summary::-webkit-details-marker, .itn-moer > summary::-webkit-details-marker { display: none; }
.pd-sep > summary b, .itn-moer > summary b { display: block; font-size: 15.5px; font-weight: var(--w-strong); }
.pd-sep > summary small, .itn-moer > summary small { display: block; font-size: 13px; color: var(--ink-3); }
.pd-sep > summary > svg, .itn-moer > summary > svg { width: 18px; height: 18px; color: var(--ink-3); transition: transform var(--d-sm) var(--e-ui); flex: none; }
.pd-sep[open] > summary > svg, .itn-moer[open] > summary > svg { transform: rotate(90deg); }
.pd-sep > :not(summary), .itn-moer > :not(summary) { margin-left: 18px; margin-right: 18px; }
.pd-sep > .tab-w, .itn-moer > .tab-w { margin: 0; }
.pd-sep > :last-child, .itn-moer > :last-child { margin-bottom: 16px; }
.pd-h3 { font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 16px 0 8px; }
.pd-pesa { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pd-pesa div { background: var(--paper-2); border-radius: var(--r-2); padding: 9px 11px; font-size: 13px; }
.pd-pesa b { display: block; font-weight: var(--w-strong); }
.pd-pesa .num { font-size: 17px; font-weight: var(--w-display); }
.pd-pesa small { display: block; color: var(--ink-3); font-size: 12px; }
.pd-lote { position: sticky; top: calc(var(--faixa-h) + 8px); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--r-3); background: var(--ink); color: var(--paper); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .5); }
.pd-lote-t { font-size: 13.5px; }
.pd-lote .btn-sec { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.pd-lote .btn-sec:hover { background: rgba(255, 255, 255, .1); }
.pd-lote .btn-pri { background: var(--accent); color: var(--ink); }
.pd-lote .btn-ghost { color: var(--paper); opacity: .8; }
.pd-lote .btn[disabled] { opacity: .35; }
.pd-c { font: 500 11px/1 var(--mono); opacity: .75; }
.pd-sel-t { margin-left: auto; font-size: 13px; align-items: center; }
.pd-tab .pd-cx { width: 34px; padding-right: 0; }
.pd-tab .pd-cx input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-ink); cursor: pointer; }
.pd-tab tr.pd-marcado td { background: var(--accent-soft); }
@media (max-width: 760px) {
  .pd-tab.cartoes tr { position: relative; }
  .pd-tab.cartoes td.pd-cx { position: absolute; top: 12px; right: 14px; }
  .pd-tab.cartoes td.pri { padding-right: 34px !important; }
  .pd-lote { top: 6px; }
}

/* ---------- nova venda ---------- */
.pd-novo { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: var(--r-2); background: var(--paper-2); }
.pd-desc { display: flex; gap: 8px; align-items: center; }
.pd-desc .inp { flex: 1; }
.pd-desc .seg { flex-wrap: nowrap; }
.pd-fretes { display: flex; flex-direction: column; gap: 6px; }
.pd-fretes label { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-2); box-shadow: inset 0 0 0 1px var(--hair-2); cursor: pointer; }
.pd-fretes input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pd-fretes .n { flex: 1; min-width: 0; font-size: 13.5px; font-weight: var(--w-medium); }
.pd-fretes .n small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.pd-fretes label:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); background: var(--sup-1); }
.pd-fretes label:has(input:focus-visible) { outline: 2px solid var(--foco); outline-offset: 2px; }
.pd-sai { font-size: 12px; color: var(--ink-3); margin: 0 0 8px; }
.pd-pixbox { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.nv-resumo .link[data-acao] { font-size: 12.5px; }
.campo small .link { display: inline-flex; align-items: center; gap: 4px; }
.campo small .link svg { width: 14px; height: 14px; }

/* ---------- itens vendidos ---------- */
.itn-leg { margin: 0 0 10px; }
.itn-mix { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--paper-3); gap: 1px; }
.itn-mix i { display: block; height: 100%; }
.itn-grao { background: var(--accent-ink); }
.itn-media { background: var(--accent); }
.itn-fina { background: var(--verde); }
.itn-espresso { background: var(--info); }
.itn-leg i.itn-grao, .itn-leg i.itn-media, .itn-leg i.itn-fina, .itn-leg i.itn-espresso { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- etiquetas e rótulos ---------- */
.ev-acoes { justify-content: flex-end; flex-wrap: nowrap; }
@media (max-width: 760px) { .ev-acoes { justify-content: flex-start; flex-wrap: wrap; } }
.ev-prev { display: flex; justify-content: center; padding: 14px; border-radius: var(--r-2); background: var(--paper-2); overflow-x: auto; }
.ev-etq { width: 320px; max-width: 100%; flex: none; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 4px; font-size: 12px; line-height: 1.4; }
.ev-etq > div { padding: 8px 10px; border-top: 1.5px solid var(--ink); }
.ev-etq > div:first-child { border-top: 0; }
.ev-etq small { display: block; font: 500 9.5px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ev-etq-top { display: flex; align-items: baseline; gap: 8px; }
.ev-etq-top b { font-size: 15px; font-weight: var(--w-strong); }
.ev-etq-peso { margin-left: auto; font-weight: var(--w-strong); }
.ev-etq-cod { text-align: center; }
.ev-etq-cod .pd-barras { height: 46px; }
.ev-etq-cod .mono { letter-spacing: .12em; font-size: 12.5px; }
.ev-etq-dest { font-size: 13px; }
.ev-etq-dest b { display: block; font-size: 14px; }
.ev-etq-rem { font-size: 11px; color: var(--ink-2); }
.ev-etq-pe { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; font: 500 11px/1.3 var(--mono); }
.ev-rot { width: 340px; max-width: 100%; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--paper); color: var(--ink); border-radius: 6px; box-shadow: 0 0 0 1px var(--hair-2); font-size: 11.5px; line-height: 1.35; }
.ev-rot small { display: block; font: 500 9px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.ev-rot-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5px; color: var(--ink-3); border-bottom: 1px solid var(--hair-2); padding-bottom: 5px; }
.ev-rot-marca { font-family: 'Fraunces', Georgia, serif; font-size: 14px; font-weight: 600; letter-spacing: .08em; color: var(--accent-ink); }
.ev-rot-nome b { display: block; font-family: 'Fraunces', Georgia, serif; font-size: 19px; font-weight: 560; letter-spacing: -.01em; line-height: 1.15; }
.ev-rot-nome span { font-size: 10.5px; color: var(--ink-2); }
.ev-rot-grupo { font-weight: var(--w-strong); font-size: 11.5px; }
.ev-rot-orig { color: var(--ink-2); font-size: 11px; }
.ev-rot-dados { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 6px 0; border-top: 1px solid var(--hair-2); border-bottom: 1px solid var(--hair-2); }
.ev-rot-dados b { display: block; font-size: 11.5px; font-weight: var(--w-strong); }
.ev-rot-dados .mono { font-size: 10.5px; }
.ev-rot-pe { display: flex; gap: 8px; align-items: center; font-size: 10.5px; color: var(--ink-2); }
.ev-rot-pe .pix-qr { width: 58px; height: 58px; padding: 3px; flex: none; border-radius: 4px; }
.ev-rot-pe small { text-transform: none; letter-spacing: 0; margin-top: 2px; }
@media (max-width: 400px) { .ev-rot-dados { grid-template-columns: 1fr 1fr; } }
.ev-decl h1 { font-size: 18px; margin-bottom: 10px; }
.ev-decl-g { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; font-size: 12px; }
.ev-decl-g b { display: block; }
.ev-decl-g small { display: block; font: 500 9.5px/1.3 var(--mono); text-transform: uppercase; color: var(--ink-3); }
.ev-decl p { font-size: 12px; margin-top: 10px; }

/* ---------- frete ---------- */
.fr-meses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.fr-mes { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; min-width: 0; }
.fr-mes b { font-weight: var(--w-strong); margin-top: 6px; }
.fr-mes small { color: var(--ink-3); font-size: 12px; }
.fr-mes small.neg { color: var(--neg); } .fr-mes small.pos { color: var(--pos); }
.fr-col { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.fr-col i { flex: 1; border-radius: 4px 4px 1px 1px; }
i.fr-cob { background: var(--barra, var(--paper-3)); }
i.fr-pag { background: var(--accent); }
.legenda i.fr-cob, .legenda i.fr-pag { width: 9px; height: 9px; border-radius: 3px; }
.fr-meses + .legenda { margin-top: 12px; }
.fr-cot { display: flex; flex-direction: column; gap: 6px; }
.fr-cot > div { display: flex; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: var(--r-2); box-shadow: inset 0 0 0 1px var(--hair-2); flex-wrap: wrap; }
.fr-cot .n { flex: 1 1 160px; min-width: 0; font-size: 13.5px; font-weight: var(--w-medium); }
.fr-cot .n small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.fr-cot .fr-tags { display: flex; gap: 4px; }
.fr-cot b { font-size: 15px; }
.fr-degraus { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; height: 170px; margin-top: 14px; }
.fr-degraus div { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; font-size: 12px; text-align: center; }
.fr-degraus i { display: block; border-radius: 5px 5px 1px 1px; background: var(--paper-3); margin-bottom: 6px; }
.fr-degraus div.on i { background: var(--accent); }
.fr-degraus b { font-weight: var(--w-strong); }
.fr-degraus small { color: var(--ink-3); }
.fr-regras { list-style: none; margin: 0; padding: 0; }
.fr-regras li { padding: 9px 0; border-top: 1px solid var(--hair); font-size: 13.5px; }
.fr-regras li:first-child { border-top: 0; padding-top: 0; }
.fr-regras b { display: block; font-weight: var(--w-strong); }
.fr-regras small { display: block; color: var(--ink-3); font-size: 12.5px; }

/* ---------- impressão: só a folha montada em #pdPrint ---------- */
#pdPrint { display: none; }
@media print {
  html.pd-imprime body { background: white; }
  html.pd-imprime body > *:not(#pdPrint) { display: none !important; }
  html.pd-imprime #pdPrint { display: block; color: black; }
  #pdPrint * { color: black !important; box-shadow: none !important; }
  #pdPrint .pix-qr { background: white; }
  #pdPrint .pix-qr rect { fill: black; }
  #pdPrint .ev-pag10 { width: 100mm; height: 150mm; padding: 4mm; page-break-after: always; break-after: page; overflow: hidden; }
  #pdPrint .ev-pag10:last-child { page-break-after: auto; break-after: auto; }
  #pdPrint .ev-etq { width: 100%; height: 100%; border-color: black; background: white; font-size: 11pt; }
  #pdPrint .ev-etq > div { border-color: black; }
  #pdPrint .ev-folha { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 66mm; gap: 3mm; page-break-after: always; break-after: page; }
  #pdPrint .ev-folha:last-child { page-break-after: auto; break-after: auto; }
  #pdPrint .ev-rot { width: auto; height: 66mm; border: 0.3mm dashed black; border-radius: 0; background: white; overflow: hidden; }
  #pdPrint .pd-danfe { min-width: 0; border-color: black; background: white; }
  #pdPrint .pd-danfe > div, #pdPrint .pd-danfe > p { border-color: black; }
}
@media (prefers-reduced-motion: reduce) { .pd-mais > summary svg, .pd-sep > summary > svg, .itn-moer > summary > svg { transition: none; } }
