:root {
  --fundo: #1e1e1e;      /* área de trabalho */
  --painel: #252526;     /* barras e painéis */
  --campo: #2d2d30;      /* controles */
  --campo2: #37373d;     /* hover */
  --borda: #3c3c3c;
  --texto: #e4e4e4;
  --texto2: #9d9d9d;
  --acento: #2f9bff;
  --acento-escuro: #1a7fdb;
  --acento-fundo: rgba(47, 155, 255, .14);
  --perigo: #f2555a;
  --aviso: #e0a841;
  --raio: 8px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--fundo); color: var(--texto);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13.5px; line-height: 1.45; font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--acento); outline-offset: 1px; }
b { font-weight: 600; }

.app { display: flex; flex-direction: column; height: 100%; }

/* topo */
.topo {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 9px 16px;
  background: var(--painel); border-bottom: 1px solid #191919;
}
.marca { display: flex; align-items: center; gap: 10px; }
.marca img { display: block; }
.marca h1 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.marca p { font-size: 12px; color: var(--texto2); }
.resumo { margin-left: auto; font-size: 12px; color: var(--texto2); font-variant-numeric: tabular-nums; }

.corpo { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px 1fr; }
.painel {
  overflow-y: auto; background: var(--painel); border-right: 1px solid #191919;
  display: flex; flex-direction: column;
}
.previa { overflow-y: auto; padding: 16px 24px 28px; background: var(--fundo); }

/* seções do painel */
.passo { padding: 14px 16px 16px; border-bottom: 1px solid #1c1c1c; }
.passo h2, .passo > summary {
  display: flex; align-items: center; gap: 9px; font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--texto2); margin-bottom: 11px;
}
.num {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px;
  background: var(--campo2); color: var(--texto); font-size: 11px; font-weight: 700; flex: none; letter-spacing: 0;
}
details.passo > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
details.passo > summary::-webkit-details-marker { display: none; }
details.passo > summary::after { content: '›'; margin-left: auto; font-size: 16px; transition: transform .15s; }
details.passo[open] > summary { margin-bottom: 11px; }
details.passo[open] > summary::after { transform: rotate(90deg); }
details.passo > summary:hover { color: var(--texto); }

.dica { color: var(--texto2); font-size: 12px; margin-top: 7px; }
.link { background: none; border: 0; color: var(--acento); font-size: 12px; padding: 0; }
.link:hover { text-decoration: underline; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--campo); border: 1px solid var(--borda);
  border-radius: 6px; padding: 5px 10px; min-height: 30px; font-size: 12.5px; font-weight: 500;
  transition: background .1s, border-color .1s;
}
.chip:hover { background: var(--campo2); }
.chip.on { background: var(--acento-fundo); border-color: var(--acento); color: #fff; }
.chip .mini { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .7; flex: none; }
.mais-tamanhos { margin-top: 10px; }
.mais-tamanhos > summary { cursor: pointer; color: var(--acento); font-size: 12.5px; list-style: none; margin-bottom: 8px; }
.mais-tamanhos > summary::-webkit-details-marker { display: none; }

/* entradas */
input[type=text] {
  background: var(--campo); border: 1px solid var(--borda); border-radius: 6px;
  padding: 5px 6px; min-height: 30px; outline: none; text-align: center; font-variant-numeric: tabular-nums;
}
input[type=text]:focus { border-color: var(--acento); }
.linha { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.linha.custom input { width: 72px; }
.un { color: var(--texto2); font-size: 12px; }

.seg { display: flex; background: var(--campo); border: 1px solid var(--borda); border-radius: 6px; padding: 2px; margin-top: 10px; gap: 2px; }
.seg button {
  flex: 1; background: transparent; border: 0; border-radius: 4px; padding: 5px 6px; min-height: 28px;
  display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12.5px; color: var(--texto2);
}
.seg button:hover { color: var(--texto); }
.seg button.on { background: var(--campo2); color: #fff; box-shadow: inset 0 0 0 1px #4a4a50; }
.ico-folha { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.ico-folha.pe { width: 9px; height: 12px; }
.ico-folha.deitado { width: 12px; height: 9px; }

/* botões */
.btn {
  background: var(--campo); border: 1px solid var(--borda); border-radius: 6px; padding: 6px 14px; min-height: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 500;
  transition: background .1s, border-color .1s;
}
.btn:hover { background: var(--campo2); }
.btn.primario { background: var(--acento); border-color: var(--acento); color: #fff; font-weight: 600; }
.btn.primario:hover { background: #47a7ff; }
.btn.pequeno { padding: 4px 10px; min-height: 28px; font-size: 12.5px; }
.btn.icone { width: 28px; min-height: 28px; padding: 0; }
.btn.fantasma { background: transparent; color: var(--texto2); margin-top: 14px; }
.btn.fantasma:hover { color: var(--texto); }
.btn:disabled { opacity: .4; cursor: default; }

/* tamanhos */
.grupo {
  border: 1px solid var(--borda); border-radius: var(--raio); padding: 10px; margin-bottom: 7px; cursor: pointer;
  background: #1f1f20;
}
.grupo.ativo { border-color: var(--acento); box-shadow: 0 0 0 1px var(--acento) inset; }
.grupo .g1 { display: flex; align-items: center; gap: 5px; }
.grupo .g1 input { width: 52px; }
.grupo .g1 .x { color: var(--texto2); }
.grupo .g1 .un { margin-right: auto; }
.grupo .forma { width: 24px; height: 28px; display: grid; place-items: center; flex: none; }
.grupo .forma i { display: block; border: 1.5px solid var(--acento); border-radius: 2px; background: var(--acento-fundo); transform: scale(.8); }
.grupo .g2 { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.grupo .g2 .primario { margin-left: auto; }
.qtd { display: inline-flex; align-items: center; background: var(--campo); border: 1px solid var(--borda); border-radius: 6px; }
.qtd button { background: transparent; border: 0; width: 28px; height: 28px; font-size: 15px; }
.qtd button:hover { background: var(--campo2); }
.qtd span { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.grupo .info { color: var(--texto2); font-size: 12px; margin-top: 8px; }
.grupo .info b { color: var(--texto); }
.grupo .aviso { color: var(--perigo); }

/* faixas */
.faixa { display: flex; align-items: center; gap: 10px; }
input[type=range] { accent-color: var(--acento); height: 22px; }
.faixa input[type=range] { flex: 1; }
.faixa .val, .ed-faixa .val {
  min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; font-size: 12.5px;
  background: var(--campo); border: 1px solid var(--borda); border-radius: 5px; padding: 3px 6px;
}
.rotulo { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 3px; font-size: 12.5px; }
.rotulo:first-of-type { margin-top: 0; }

.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 11px; cursor: pointer; font-size: 12.5px; }
.check input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--acento); flex: none; }
.check small { display: block; color: var(--texto2); font-size: 11.5px; }

/* prévia */
.barra-previa { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.avisos { max-width: 620px; margin: 0 auto 12px; display: flex; flex-direction: column; gap: 5px; }
.avisos div {
  background: var(--painel); border: 1px solid var(--borda); border-radius: 6px; padding: 7px 12px;
  font-size: 12.5px; color: var(--texto2); text-align: center;
}
.avisos div.alerta { border-color: rgba(224, 168, 65, .5); color: var(--aviso); }
.folhas { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.folha-wrap { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.folha-wrap .rot { color: var(--texto2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.folha-wrap canvas { display: block; background: #fff; touch-action: manipulation; cursor: pointer; box-shadow: 0 0 0 1px #000, 0 10px 30px rgba(0, 0, 0, .55); }
.folha-wrap canvas.arrastando { cursor: grabbing; }
body.soltando .folhas canvas { outline: 2px dashed var(--acento); outline-offset: 6px; }
body.soltando .soltar { border-color: var(--acento); background: var(--acento-fundo); }

/* rodapé */
.acoes {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 16px;
  background: var(--painel); border-top: 1px solid #191919;
  padding-bottom: max(9px, env(safe-area-inset-bottom));
}
.acoes .dica { margin: 0 0 0 auto; max-width: 420px; text-align: right; }

/* editor */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.editor {
  background: var(--painel); border: 1px solid var(--borda); border-radius: 10px; width: min(680px, 100%); max-height: 100%;
  overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 11px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.ed-topo { display: flex; align-items: center; gap: 10px; }
.ed-topo b { font-size: 14px; }
.ed-topo span { color: var(--texto2); margin-right: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
#edCanvas { width: 100%; height: 400px; border-radius: 6px; background: #161616; touch-action: none; cursor: move; display: block; }
#edCanvas.girar {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 15a7.5 7.5 0 0 0 13.4 3.2M20 11A7.5 7.5 0 0 0 6.6 7.8' stroke='%23000' stroke-width='4.5'/%3E%3Cpath d='M6 15a7.5 7.5 0 0 0 13.4 3.2M20 11A7.5 7.5 0 0 0 6.6 7.8' stroke='%23fff' stroke-width='2'/%3E%3Cpath d='M17 18.5h3v3M9 7.5H6v-3' stroke='%23000' stroke-width='4.5'/%3E%3Cpath d='M17 18.5h3v3M9 7.5H6v-3' stroke='%23fff' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E") 13 13, alias;
}
.ed-faixas { display: flex; flex-direction: column; gap: 6px; }
.ed-faixa { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; color: var(--texto2); }
.ed-faixa input { width: 100%; }
.ed-faixa:first-child { grid-template-columns: 44px 1fr; }
.ed-botoes { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-botoes .perigo { color: var(--perigo); }
.ed-fim { display: flex; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); background: #3a3a3e; color: #fff;
  border: 1px solid #4a4a50; padding: 8px 14px; border-radius: 6px; font-size: 12.5px; z-index: 60;
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); opacity: 0; transition: opacity .15s; pointer-events: none;
}
.toast.on { opacity: 1; }
.ocupado { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 70; display: flex; align-items: center; justify-content: center; }
.caixinha { background: var(--painel); border: 1px solid var(--borda); border-radius: 8px; padding: 12px 18px; display: flex; gap: 10px; align-items: center; }
.giro { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--campo2); border-top-color: var(--acento); animation: giro .7s linear infinite; }
@keyframes giro { to { transform: rotate(360deg) } }

#impressao { display: none; }
.so-toque { display: none; }
@media (pointer: coarse) { .so-toque { display: block; } .so-mouse { display: none; } }

@media (max-width: 860px) {
  body { font-size: 14.5px; }
  .app { height: auto; min-height: 100%; }
  .resumo { display: none; }
  .corpo { display: flex; flex-direction: column; }
  .previa { order: -1; padding: 12px 12px 18px; overflow: visible; }
  .painel { overflow: visible; border-right: 0; border-top: 1px solid #191919; }
  .acoes { position: sticky; bottom: 0; z-index: 10; padding: 8px 12px; }
  .acoes .dica { display: none; }
  .acoes .btn { flex: 1; min-height: 42px; }
  .so-largo { display: none; }
  .chip, .btn.pequeno, .seg button { min-height: 36px; }
  .qtd button { width: 36px; height: 36px; }
  input[type=text] { min-height: 36px; font-size: 16px; }
  input[type=range] { height: 32px; }
  #edCanvas { height: min(48vh, 420px); }
  .modal { padding: 0; align-items: flex-end; }
  .editor { border-radius: 12px 12px 0 0; width: 100%; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}


/* etapas: o assistente ocupa a tela até a prancha existir */
body:not([data-etapa=prancha]) .corpo, body:not([data-etapa=prancha]) .acoes, body:not([data-etapa=prancha]) .resumo { display: none; }
body[data-etapa=prancha] .assistente { display: none; }
.assistente { flex: 1; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; padding: 6vh 16px 40px; }
.wz-cartao {
  width: min(560px, 100%); background: var(--painel); border: 1px solid var(--borda); border-radius: 12px;
  padding: 22px 24px 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.wz-trilha { list-style: none; display: flex; gap: 6px; margin-bottom: 22px; }
.wz-trilha li {
  flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--texto2);
  padding-bottom: 9px; border-bottom: 2px solid var(--borda);
}
.wz-trilha li span {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--campo2); font-size: 11px; font-weight: 700; color: var(--texto);
}
.wz-trilha li.agora { color: var(--texto); border-color: var(--acento); }
.wz-trilha li.agora span { background: var(--acento); color: #fff; }
.wz-trilha li.feito { border-color: rgba(47, 155, 255, .45); }
.wz-trilha li.feito span { background: var(--acento-fundo); color: var(--acento); }
.assistente h2 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; margin-bottom: 16px; }
.soltar {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 38px 16px;
  background: #1f1f20; border: 1.5px dashed #55555c; border-radius: 10px; transition: border-color .12s, background .12s;
}
.soltar:hover { border-color: var(--acento); background: var(--acento-fundo); }
.soltar-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--acento); color: #fff; font-size: 26px; margin-bottom: 4px; }
.soltar b { font-size: 16px; font-weight: 600; }
.soltar small { color: var(--texto2); font-size: 12.5px; }
.wz-rotulo { display: block; font-size: 12px; font-weight: 600; color: var(--texto2); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 7px; }
.wz-medida { display: flex; align-items: center; gap: 8px; }
.wz-medida input { width: 84px; font-size: 18px; font-weight: 600; min-height: 42px; }
.wz-copias { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qtd.grande button { width: 40px; height: 40px; font-size: 18px; }
.qtd.grande span { min-width: 40px; font-size: 16px; }
.check.em-linha { margin-top: 0; align-items: center; font-size: 13.5px; }
.wz-papel { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wz-papel select { flex: 1; min-width: 180px; }
.wz-papel .seg { margin-top: 0; }
.wz-conta { margin-top: 20px; padding: 10px 12px; background: #1f1f20; border: 1px solid var(--borda); border-radius: 8px; color: var(--texto2); font-size: 13px; }
.wz-conta b { color: var(--texto); }
.wz-conta .aviso { color: var(--perigo); }
.wz-botoes { display: flex; gap: 8px; margin-top: 16px; }
.wz-botoes .grande { flex: 1; min-height: 42px; font-size: 14.5px; }
.wz-cancelar { display: block; margin: 16px auto 0; }

/* miniaturas */
.wz-thumbs, .thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumb {
  position: relative; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; flex: none; padding: 0;
  background: #1a1a1a; border: 1px solid var(--borda);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .7); color: #fff; font-size: 11px; display: grid; place-items: center;
}
.thumb.mais { display: grid; place-items: center; font-size: 22px; color: var(--texto2); border-style: dashed; cursor: pointer; }
.thumb.mais:hover { color: var(--acento); border-color: var(--acento); }
.thumbs { margin-top: 10px; }
.thumbs .thumb { width: 46px; height: 46px; cursor: pointer; }
.thumbs .thumb.sel { box-shadow: 0 0 0 2px var(--acento); }
.grupo .g2 .rot-qtd { font-size: 12.5px; color: var(--texto2); }
.grupo .g2 .btn { margin-left: auto; }
.btn.largo { width: 100%; margin-top: 2px; border-style: dashed; color: var(--texto2); }
.btn.largo:hover { color: var(--texto); border-color: var(--acento); }

select {
  width: 100%; background: var(--campo); border: 1px solid var(--borda); border-radius: 6px; color: var(--texto);
  padding: 6px 8px; min-height: 34px; outline: none;
}
select:focus { border-color: var(--acento); }
details.ajustes > summary { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--texto); }

@media (max-width: 860px) {
  .assistente { padding: 14px 12px 32px; }
  .wz-cartao { padding: 18px 16px 20px; border-radius: 12px; }
  .assistente h2 { font-size: 19px; }
  .soltar { padding: 48px 16px; }
  .wz-medida input { width: 76px; }
  .wz-botoes { position: sticky; bottom: 0; background: var(--painel); padding: 10px 0 max(4px, env(safe-area-inset-bottom)); margin-top: 10px; }
  .thumbs .thumb { width: 52px; height: 52px; }
}

@media print {
  body { background: #fff !important; }
  body > *:not(#impressao) { display: none !important; }
  #impressao { display: block !important; }
  #impressao img { display: block; break-after: page; page-break-after: always; }
  #impressao img:last-child { break-after: auto; page-break-after: auto; }
}
.grupo .g2 { flex-wrap: nowrap; white-space: nowrap; }

/* ---- versão limpa ---- */
.marca h1 { font-size: 14.5px; }
.papeis { display: flex; flex-wrap: wrap; gap: 4px; align-items: stretch; }
.papel {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px;
  width: 52px; height: 58px; padding: 5px 2px 6px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--texto2); font-size: 11px;
}
.papel i { display: block; border: 1.5px solid currentColor; border-radius: 2px; background: rgba(255, 255, 255, .04); }
.papel i.livre { border-style: dashed; }
.papel:hover { background: var(--campo); color: var(--texto); }
.papel.on { background: var(--acento-fundo); border-color: var(--acento); color: #fff; }
.papel.on i { border-color: var(--acento); background: rgba(47, 155, 255, .18); }
.orient { display: inline-flex; flex-direction: column; gap: 4px; margin-left: auto; }
.orient button {
  width: 34px; flex: 1; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--borda);
  background: var(--campo); color: var(--texto2);
}
.orient button:hover { color: var(--texto); }
.orient button.on { border-color: var(--acento); color: #fff; background: var(--acento-fundo); }
.previa { position: relative; }
.vazio {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 34px;
  background: rgba(37, 37, 38, .92); border: 1.5px dashed #55555c; border-radius: 12px; color: var(--texto);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
}
.vazio:hover, body.soltando .vazio { border-color: var(--acento); }
.vazio b { font-size: 15px; font-weight: 600; }
.vazio small { color: var(--texto2); font-size: 12px; }
.wz-trilha li { height: 3px; padding: 0; border: 0; background: var(--borda); border-radius: 2px; }
.wz-trilha li.feito { background: var(--acento); }
.wz-trilha { margin-bottom: 20px; }
.assistente h2 { margin-bottom: 14px; }
.ed-topo b { margin-right: auto; font-variant-numeric: tabular-nums; }
.ed-botoes #edPronto { margin-left: auto; }
.grupo .info.aviso { color: var(--perigo); }
@media (max-width: 860px) {
  .papel { width: calc((100% - 50px) / 4 - 3px); }
  .orient { flex-direction: row; width: 100%; margin: 4px 0 0; }
  .orient button { height: 36px; }
  .vazio { display: none !important; }
}

.papeis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.papel { width: auto; }
.orient { grid-column: 1 / -1; flex-direction: row; width: 100%; margin: 4px 0 0; }
.orient button { height: 30px; }
@media (max-width: 860px) { .papel { width: auto; } .orient button { height: 36px; } }

.papeis { grid-template-columns: repeat(6, 1fr); gap: 3px; }
.papel { height: 52px; padding: 4px 0 5px; font-size: 10.5px; }

.rotulo.sep { margin-top: 16px; }
