/* usinagem-editor.css — U4 (17/11/26): a folha de usinagem por cima do 3D. Só tema escuro. Medidas do docs/OFICINA-NO-3D.md seção 3 e 7.
   Camadas: folha 70 · moldura da janelinha 71 · #cena3d (quando é a janelinha) 72 · barra da janelinha 73. */
#useFolha, #useJan, #useJanBarra, #useCol { display: none }
body.use-aberto #useFolha { display: flex }
body.use-aberto #useCol { display: flex }
body.use-aberto #useJan { display: block }
body.use-aberto #useJanBarra { display: flex }
body.use-aberto.use-jan-off #useJan, body.use-aberto.use-jan-off #useJanBarra { display: none }

/* a página não rola por baixo da folha */
html:has(body.use-aberto), body.use-aberto { overflow: hidden !important }

/* o que flutua sobre o 3D e não faz sentido com a folha no ar (devolvido sozinho ao tirar a classe) */
body.use-aberto .vmode, body.use-aberto #mpAlca { display: none !important }
/* a coluna do MÓDULO fica escondida (não some do DOM) enquanto a coluna da folha está no ar */
body.use-aberto #rightcol { visibility: hidden !important }

#useFolha {
  position: fixed; z-index: 70; flex-direction: column; overflow: hidden;
  background: #14171c; color: var(--txt, #e6e9ee); border-radius: 14px; box-shadow: 0 18px 60px rgba(0, 0, 0, .65);
  font: 13px/1.35 var(--f-ui, system-ui, sans-serif);
}
#useFolha button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0 }
#useFolha kbd, #useJanBarra kbd { font: 600 10px/1 ui-monospace, monospace; color: #8b93a1; background: #232932; border-radius: 4px; padding: 2px 4px; margin-left: 6px }
.use-cab { height: 44px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: #1a1e25; position: relative }
.use-bt { height: 30px; padding: 0 10px; border-radius: 8px; background: #232932 !important; font-weight: 600; white-space: nowrap }
.use-bt.on { background: #343c48 !important }
.use-nome { display: flex; align-items: baseline; gap: 6px; min-width: 0; padding: 4px 6px; border-radius: 8px }
.use-nome b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.use-nome small { color: #8b93a1; white-space: nowrap }
.use-nome i { color: #8b93a1; font-style: normal }
.use-seg { display: flex; gap: 2px; background: #232932; border-radius: 8px; padding: 2px; flex: none }
#useFolha .use-seg button { height: 26px; padding: 0 10px; border-radius: 6px; color: #8b93a1; font-weight: 600; white-space: nowrap }
#useFolha .use-seg button.on { background: #343c48; color: #e6e9ee }
.use-esp { flex: 1 }
.use-pronto { height: 32px; padding: 0 18px !important; border-radius: 9px; background: var(--acc, #f5b324) !important; color: #1a1300 !important; font-weight: 800 }
.use-meio { flex: 1; display: flex; min-height: 0; position: relative }
#useFerr { width: 46px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; background: #1a1e25; overflow-y: auto; scrollbar-width: none }
#useFerr button { width: 40px; height: 42px; flex: none; border-radius: 8px; color: #8b93a1; font-size: 9.5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px }
#useFerr button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6 }
#useFerr button.on { background: #343c48; color: #e6e9ee; box-shadow: inset 2px 0 0 var(--acc, #f5b324) }
#useDes { flex: 1; position: relative; min-width: 0; overflow: hidden; touch-action: none; cursor: default }
#useSvg { position: absolute; inset: 0; display: block; user-select: none; -webkit-user-select: none }
.use-pe { height: 60px; flex: none; background: #1a1e25; padding: 6px 12px; display: flex; flex-direction: column; justify-content: center; gap: 5px; min-width: 0 }
#useOps { display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap }
#useOps b { color: #8b93a1; font-weight: 600; margin-right: 2px }
.use-op { height: 22px; padding: 0 8px; border-radius: 11px; background: #232932 !important; color: #8b93a1; font-size: 12px; display: inline-flex; align-items: center; flex: none }
.use-op.on { background: rgba(47, 143, 255, .2) !important; color: #9cc8ff }
.use-op.outra { border: 1px dashed #6d5bb5 }
.use-op.auto { border: 1px dashed #4a5361; background: none !important }
.use-vazio { color: #8b93a1; font-size: 12px }
#useDica { color: #8b93a1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.use-gota { position: absolute; left: 70px; top: 42px; width: 248px; max-height: 60%; overflow: auto; background: #1a1e25; border-radius: 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, .6); padding: 6px; z-index: 9 }
.use-gota[hidden] { display: none }
#useFolha .use-gota button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px }
#useFolha .use-gota button.on { background: #343c48 }
.use-gota small { display: block; color: #8b93a1; font-size: 11px }

/* desenho (SVG) */
.use-peca { fill: #1d2229; stroke: #5b6676; stroke-width: 1.5 }
.use-grade { stroke: #2a313b; stroke-width: 1; fill: none }
.use-med, .use-cz { fill: #8b93a1; font-size: 11px }
.use-cb { fill: #e6e9ee; font-size: 12px; font-weight: 700 }
.use-cota { stroke: #5b6676; stroke-width: 1; stroke-dasharray: 3 3; fill: none }
.use-it { cursor: pointer }
.use-az { fill: rgba(47, 143, 255, .28); stroke: #2f8fff; stroke-width: 1.5 }
.use-az.sel { fill: #2f8fff; fill-opacity: .75 }
.use-az.use-vaza { fill: #0b0e12; fill-opacity: 1 }
.use-az.use-vaza.sel { fill: #0b0e12; stroke-width: 3 }
.use-outra { fill: none; stroke: #a78bfa; stroke-width: 1.3; stroke-dasharray: 5 4; pointer-events: none }
.use-it.use-outra { pointer-events: all }
.use-auto { fill: none; stroke: #8b93a1; stroke-width: 1.3; stroke-dasharray: 4 3 }
.use-auto.use-outra { stroke: #a78bfa }
.use-pil rect { fill: #0b0e12; stroke: #2f8fff; stroke-width: 1 }
.use-pil text { fill: #9cc8ff; font-size: 10.5px; font-weight: 700 }
.use-pil.sel rect { fill: #2f8fff }
.use-pil.sel text { fill: #fff }
.use-trena line { stroke: #34d399; stroke-width: 1.5 }
.use-trena circle { fill: #34d399 }
.use-trena text { fill: #34d399; font-size: 12px; font-weight: 700 }

/* janelinha do 3D: moldura (fica sob o #cena3d) e barra (arrastar / trocar / esconder) */
#useJan { position: fixed; z-index: 71; left: var(--use-jx, 20px); top: var(--use-jy, 20px); width: var(--use-jw, 300px); height: var(--use-jh, 200px); border-radius: 10px; overflow: hidden; background: #14171c; box-shadow: 0 8px 26px rgba(0, 0, 0, .6), 0 0 0 1px #2a313b }
#useJan #useSvg { position: absolute; inset: 0 }
body.use-aberto:not(.use-3d-grande) #cena3d {
  position: fixed !important; z-index: 72 !important; left: var(--use-jx) !important; top: var(--use-jy) !important;
  width: var(--use-jw) !important; height: var(--use-jh) !important; min-height: 0 !important; border-radius: 10px; overflow: hidden;
}
body.use-aberto.use-jan-off:not(.use-3d-grande) #cena3d { visibility: hidden; pointer-events: none }
#useJanBarra { position: fixed; z-index: 73; left: var(--use-jx, 20px); top: var(--use-jy, 20px); width: var(--use-jw, 300px); height: 28px; align-items: center; gap: 4px; padding: 0 4px 0 8px;
  background: linear-gradient(rgba(13, 16, 20, .85), rgba(13, 16, 20, 0)); border-radius: 10px 10px 0 0; touch-action: none; font: 600 11px/1 var(--f-ui, system-ui, sans-serif); color: #c9d1dc }
.use-grip { flex: 1; cursor: grab; height: 100%; display: flex; align-items: center; user-select: none }
#useJanBarra button { height: 22px; padding: 0 7px; border-radius: 7px; background: rgba(35, 41, 50, .92); color: #e6e9ee; border: 0; font: inherit; cursor: pointer }
/* 3D grande: o miolo da folha fica vazado (o #cena3d volta ao tamanho cheio por baixo) e só cabeçalho, ferramentas e pé pegam o mouse */
body.use-3d-grande #useFolha { background: none; box-shadow: none; pointer-events: none }
body.use-3d-grande .use-cab, body.use-3d-grande .use-pe, body.use-3d-grande #useFerr, body.use-3d-grande .use-gota { pointer-events: auto }
body.use-3d-grande #useDes { background: none }
body.use-3d-grande .use-pe { border-radius: 0 0 14px 14px }

/* celular: a folha é a tela inteira */
@media (max-width: 600px) {
  /* o cabeçalho do app no celular tem z-index 90: a folha passa por cima */
  #useFolha { z-index: 95 } #useJan { z-index: 96 } #useJanBarra { z-index: 98 }
  body.use-aberto:not(.use-3d-grande) #cena3d { z-index: 97 !important }
  #useFolha { border-radius: 0 }
  .use-cab { height: 48px; gap: 6px; padding: 0 6px }
  .use-bt { height: 40px; padding: 0 8px }
  .use-bt kbd, #useJanBarra kbd { display: none }
  .use-nome small { display: none }
  #useFolha .use-seg button { height: 34px; padding: 0 8px }
  .use-pronto { height: 40px; padding: 0 12px !important }
  .use-meio { flex: none; height: 44% }
  #useFerr { position: absolute; left: 8px; top: 8px; width: auto; flex-direction: row; background: rgba(26, 30, 37, .92); border-radius: 10px; padding: 3px; z-index: 2; gap: 0 }
  #useFerr button { width: 44px; height: 44px }
  #useFerr button span { display: none }
  #useFerr button.on { box-shadow: inset 0 -2px 0 var(--acc, #f5b324) }
  .use-pe { flex: 1; height: auto; justify-content: flex-start; padding-top: 10px }
  #useOps { flex-wrap: wrap; white-space: normal; row-gap: 6px }
  .use-op { height: 30px }
  #useJanBarra { height: var(--use-jh); background: none; padding: 0 }
  #useJanBarra > * { display: none }
  #useJanBarra .use-grip { display: flex; position: absolute; inset: 0; height: auto }
  #useJanBarra .use-grip > * { display: none }
  #useJanBtn { display: none }
}

/* U5: a coluna da folha (#useCol) — por cima do #rightcol */
#useCol { position: fixed; z-index: 70; flex-direction: column; overflow-y: auto; box-sizing: border-box; padding: 12px 14px 0; gap: 10px; background: #14171c; color: var(--txt, #e6e9ee); border-radius: 14px; box-shadow: 0 18px 60px rgba(0, 0, 0, .65); font: 13px/1.35 var(--f-ui, system-ui, sans-serif); pointer-events: auto }
#useCol button { font: inherit; color: inherit; border: 0; cursor: pointer }
.uc-sec #useOps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; overflow: visible; white-space: normal }
#useCol .use-op { height: 28px }
.uc-frase { font-weight: 700; font-size: 14px }
.uc-dica, .uc-sobra, .uc-fresa, .uc-vira { color: #8b93a1; font-size: 12px }
.uc-vira { color: #9cc8ff }
.uc-lin { display: flex; gap: 8px }
.uc-f { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; position: relative }
.uc-f span { color: #8b93a1; font-size: 11px }
.uc-f input[type=text] { width: 100%; box-sizing: border-box; height: 34px; border: 0; border-radius: 8px; background: #232932; color: inherit; font: inherit; padding: 0 30px 0 10px; font-variant-numeric: tabular-nums }
.uc-f input[type=text]:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--acc, #f5b324); background: #2a313b }
.uc-f input.erro { box-shadow: inset 0 0 0 1.5px #ef4444 !important }
.uc-f i { position: absolute; right: 8px; bottom: 9px; font-style: normal; color: #6b7482; font-size: 11px }
.uc-prof { display: flex; gap: 10px; align-items: flex-end }
.uc-prof .uc-f input[type=text] { height: 44px; font-size: 20px; font-weight: 700 }
.uc-prof .uc-f { flex: 1 1 auto }
.uc-chk { flex: none; display: flex; gap: 6px; align-items: center; height: 44px; white-space: nowrap; color: #c9d1dc }
.uc-seg { display: flex; gap: 2px; background: #232932; border-radius: 8px; padding: 2px }
.uc-seg button { flex: 1; height: 30px; border-radius: 6px; background: none; color: #8b93a1; font-weight: 600 }
.uc-seg button.on { background: #343c48; color: #e6e9ee }
#useConfere { padding: 8px 10px; border-radius: 8px; background: #1a1e25; color: #9fdcb5; font-size: 12px }
#useConfere.ruim { color: #fca5a5; background: rgba(239, 68, 68, .12) }
.uc-pe { margin-top: auto; display: flex; gap: 8px; position: sticky; bottom: 0; background: #14171c; padding: 8px 0 12px }
.uc-bt { flex: 1; height: 36px; border-radius: 9px; background: #232932; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 10px }
.uc-bt:disabled { opacity: .4; cursor: default }
.use-prev { fill: rgba(47, 143, 255, .12); stroke: #2f8fff; stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none }
.use-ima { stroke: #34d399; stroke-width: 1; pointer-events: none }
@media (max-width: 600px) {
  #useFerr { max-width: calc(100vw - 16px); overflow-x: auto; overflow-y: hidden }
  #useFerr button { flex: none }
  .use-pe { display: none }
  #useCol { z-index: 96; border-radius: 16px 16px 0 0 }
  .uc-bt { height: 44px }
  .uc-seg button { height: 40px }
}
body.use-3d-grande #useCol { pointer-events: auto }
