/* Painel Black & Vintage: barra lateral escura com perfil e menu; área de trabalho clara */
:root {
  --bg: #f2f1ee; --surface: #ffffff; --surface-2: #f7f6f3; --ink: #18181a; --muted: #67655f; --line: #dedbd4;
  --accent: #94661c; --accent-ink: #ffffff; --accent-soft: #f2e7d3;
  --ok: #2c7a4d; --ok-soft: #dcefe3; --warn: #865700; --warn-soft: #fbecc9; --bad: #a3301f; --bad-soft: #f8dfda;
  --side: #19191c; --side-ink: #ebe9e4; --side-muted: #9d9a93; --side-line: #2e2e33; --side-active: #2a2a2f;
  --f-head: "Archivo", "Segoe UI", system-ui, sans-serif;
  --f-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #121214; --surface: #1b1b1f; --surface-2: #222227; --ink: #ecebe7; --muted: #9e9b94; --line: #2f2f35;
  --accent: #d6a44e; --accent-ink: #1a1408; --accent-soft: #3a2f1b;
  --ok: #6fcb96; --ok-soft: #1c3326; --warn: #e8b85c; --warn-soft: #3a2f16; --bad: #f08c7c; --bad-soft: #3e201b;
  --side: #0b0b0d; --side-active: #1f1f24; --side-line: #24242a;
  color-scheme: dark; } }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); }
h1, h2, h3 { font-family: var(--f-head); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.carregando { padding: 40px; color: var(--muted); }

/* telas de entrada */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.cartao { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.marca { display: flex; gap: 10px; align-items: center; }
.selo-marca { width: 40px; height: 40px; border-radius: 9px; background: var(--side); color: var(--side-ink); display: grid; place-items: center; font: 800 12px var(--f-head); flex: none; }
.marca b { font: 700 16px var(--f-head); display: block; }
.marca small { color: var(--muted); font-size: 13px; }

.campo { display: flex; flex-direction: column; gap: 5px; }
.campo label { font: 600 11.5px var(--f-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.campo input, .campo select { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--surface); width: 100%; }
.btn { border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--accent); color: var(--accent-ink); }
.btn.claro { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: 14px; align-self: flex-start; }
.aviso { border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.aviso.erro { background: var(--bad-soft); color: var(--bad); }
.aviso.ok { background: var(--ok-soft); color: var(--ok); }

/* painel */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.lado { background: var(--side); color: var(--side-ink); padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lado .marca small { color: var(--side-muted); }
.lado .selo-marca { border: 1.5px solid var(--side-ink); }
.quem { border-top: 1px solid var(--side-line); border-bottom: 1px solid var(--side-line); padding: 12px 0; display: flex; flex-direction: column; gap: 2px; }
.quem b { font-weight: 600; }
.quem span { color: var(--side-muted); font-size: 13px; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a { padding: 9px 11px; border-radius: 8px; color: var(--side-muted); text-decoration: none; font-weight: 500; font-size: 14.5px; }
.menu a:hover { color: var(--side-ink); background: var(--side-active); }
.menu a[aria-current="page"] { color: var(--side-ink); background: var(--side-active); box-shadow: inset 3px 0 0 var(--accent); }
.sair { margin-top: auto; background: none; border: 1px solid var(--side-line); color: var(--side-ink); border-radius: 8px; padding: 8px 12px; cursor: pointer; }

.conteudo { padding: 28px; display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: 1180px; }
.topo .sub { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.bloco { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.numeros { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.numero { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.numero span { font: 600 11.5px var(--f-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.numero b { font: 700 26px var(--f-head); font-variant-numeric: tabular-nums; }
.linha { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.tabela { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 600 11.5px var(--f-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.selo-papel { font: 600 12px var(--f-body); padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

/* comuns */
.entre { justify-content: space-between; align-items: center; }
.topo.linha { align-items: flex-end; }
.btn.mini { padding: 6px 10px; font-size: 13px; }
.acoes { gap: 6px; flex-wrap: nowrap; }
tr.apagado td { opacity: .55; }
tr.erro td { color: var(--bad); }
.bloco.destaque { border: 2px solid var(--accent); }
.credenciais { font: 500 13px/1.6 var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; white-space: pre-wrap; }
.rodape-lado { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.rodape-lado .sair { margin-top: 0; }
a.numero { color: inherit; text-decoration: none; }
a.numero:hover { border-color: var(--accent); }
input[type="search"], .filtros select, td select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.marcar { display: flex; gap: 8px; align-items: center; font-size: 14px; }

/* catálogo */
.filtros { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.segmentos { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.segmentos button { border: 0; background: none; padding: 6px 11px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.segmentos button span { font: 500 12px var(--f-mono); opacity: .8; }
.segmentos button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.produto { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.produto.apagado { opacity: .6; }
.produto .foto { aspect-ratio: 1 / 1; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 13px; }
.produto .foto img { width: 100%; height: 100%; object-fit: contain; }
.produto .info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.produto .info b { font-weight: 600; font-size: 14px; line-height: 1.3; }
.produto .info .mono { word-break: break-all; }
.produto .formato { font-size: 13px; }
.produto .btn { margin-top: auto; align-self: flex-start; }
.selos { display: flex; flex-wrap: wrap; gap: 4px; }
.selo { font: 600 11.5px var(--f-body); padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.selo.aviso { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.selo.erro { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.selo.destaque { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* painel lateral de edição */
.sobreposicao { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; justify-content: flex-end; z-index: 20; }
.lateral { width: min(520px, 100%); height: 100%; overflow-y: auto; background: var(--surface); padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.grade2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.previa { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.previa b { word-break: break-all; }
.foto-atual { width: 160px; aspect-ratio: 1 / 1; object-fit: contain; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--line); }

/* novo pedido */
.pequeno { font-size: 12.5px; }
.aviso.alerta { background: var(--warn-soft); color: var(--warn); display: flex; flex-direction: column; gap: 4px; }
.selo.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.soltar { border: 2px dashed var(--line); border-radius: 12px; background: var(--surface); padding: 28px 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; cursor: pointer; }
.soltar.ativo { border-color: var(--accent); }
.soltar strong { font: 700 17px var(--f-head); }
table.conferir td { vertical-align: top; }
table.conferir td.etq { min-width: 200px; max-width: 300px; }
tr.caixa-nova td { border-top: 2px solid var(--line); }
tr.sub-linha td { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cel-produto { display: flex; gap: 10px; align-items: center; min-width: 220px; }
.cel-produto img, .cel-produto .sem-foto { width: 52px; height: 52px; object-fit: contain; border-radius: 6px; background: var(--surface-2); flex: none; border: 1px solid var(--line); }
.resolver { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.resolver p { color: var(--warn); font-size: 14px; }

/* meus pedidos */
.lista-pedidos { display: flex; flex-direction: column; gap: 10px; }
details.pedido { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
details.pedido summary { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; cursor: pointer; list-style: none; }
details.pedido summary::-webkit-details-marker { display: none; }
details.pedido[open] summary { margin-bottom: 12px; }
.etapas { display: inline-flex; gap: 3px; align-items: center; }
.etapas i { width: 18px; height: 6px; border-radius: 3px; background: var(--line); }
.etapas i.on { background: var(--accent); }
.etapas em { font-style: normal; font-size: 13px; margin-left: 6px; }
.riscado { text-decoration: line-through; color: var(--muted); }
.forte { color: var(--accent); font-weight: 600; }

/* produção */
.lote { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.grupo-lote { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.grupo-lote h3 { font-size: 14px; }
.grupo-lote ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.grupo-lote li { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.grupo-lote .mono { word-break: break-all; }
.quadro-etapas { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.coluna { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 140px; }
.coluna h3 { font-size: 14px; display: flex; gap: 6px; align-items: center; }
.ordem { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.miniaturas { display: flex; flex-wrap: wrap; gap: 4px; }
.miniaturas img, .miniaturas .sem-foto { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }

/* folha de conferência (papel: sempre branco com texto preto) */
.folha { background: #fff; color: #151515; border: 1px solid var(--line); border-radius: 6px; padding: 22px; display: flex; flex-direction: column; gap: 12px; max-width: 900px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.folha .mono { color: #333; }
.folha .link { color: #151515; }
.folha-topo { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #151515; padding-bottom: 12px; flex-wrap: wrap; }
.folha-dados { display: flex; flex-direction: column; gap: 6px; }
.folha-marca { font: 700 12px var(--f-body); letter-spacing: .12em; }
.folha-topo h2 { font-size: 20px; }
.folha-meta { display: grid; grid-template-columns: auto auto; gap: 2px 14px; font-size: 14px; }
.folha-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; }
.folha-qr .qr { width: 96px; height: 96px; }
.folha-qr .qr svg { width: 100%; height: 100%; }
.folha-caixa { font: 600 12px var(--f-body); text-transform: uppercase; letter-spacing: .06em; background: #151515; color: #fff; padding: 6px 10px; border-radius: 4px; }
.folha-item { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 16px; align-items: center; border-bottom: 1px solid #cfcac0; padding-bottom: 12px; break-inside: avoid; }
.folha-foto { width: 140px; aspect-ratio: 1 / 1; border: 1px solid #cfcac0; border-radius: 4px; display: grid; place-items: center; overflow: hidden; color: #888; font-size: 12px; background: #fafafa; }
.folha-foto img { width: 100%; height: 100%; object-fit: contain; }
.folha-info { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; min-width: 0; }
.folha-nome { font: 700 18px var(--f-head); }
.folha-qtd { font: 800 30px var(--f-head); }
.folha-checks { display: grid; grid-template-columns: repeat(3, 76px); gap: 6px; }
.check { border: 2px solid #151515; background: #fff; color: #151515; border-radius: 6px; height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 10.5px var(--f-body); text-transform: uppercase; letter-spacing: .04em; cursor: pointer; }
.check:disabled { cursor: default; }
.check .caixinha { font: 800 18px var(--f-head); line-height: 1; min-height: 18px; }
.check.ok { background: #151515; color: #fff; }
.folha-rodape { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; border-top: 2px solid #151515; padding-top: 12px; }
@media (max-width: 820px) {
  .folha-item { grid-template-columns: 96px minmax(0, 1fr); }
  .folha-foto { width: 96px; }
  .folha-checks { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
}
@page { size: A4; margin: 10mm; }
@media print {
  body { background: #fff; }
  .lado, .nao-imprimir { display: none !important; }
  .app { display: block; }
  .conteudo { padding: 0; max-width: none; }
  .folha { border: 0; box-shadow: none; padding: 0; max-width: none; }
}

/* preços */
table.precos input.num, .campo input.num { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
table.precos input.num { border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; background: var(--surface); }
td.dir, th.dir { text-align: right; }
tr.grupo td { background: var(--surface-2); font: 600 12px var(--f-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lado { position: static; height: auto; gap: 12px; }
  .menu { flex-direction: row; overflow-x: auto; }
  .menu a { white-space: nowrap; }
  .menu a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); }
  .sair { margin-top: 0; align-self: flex-start; }
  .conteudo { padding: 20px 16px; }
}
