* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.4 system-ui, Segoe UI, Roboto, sans-serif;
  background: #0f1115; color: #e6e8ec;
}
.oculto { display: none !important; }

/* login */
.login { height: 100%; display: grid; place-items: center; }
.cartao {
  background: #171a21; border: 1px solid #262a33; border-radius: 12px;
  padding: 28px; width: 300px; display: flex; flex-direction: column; gap: 12px;
}
.cartao h1 { margin: 0 0 8px; font-size: 22px; text-align: center; }
.cartao input, .cartao button {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #2d323c;
  background: #0f1115; color: #e6e8ec; font-size: 14px;
}
.cartao button { background: #2f6feb; border-color: #2f6feb; cursor: pointer; font-weight: 600; }
.cartao button:hover { background: #3b78f0; }
.erro { color: #ff6b6b; min-height: 16px; margin: 0; font-size: 13px; text-align: center; }

/* app */
.app { height: 100%; display: grid; grid-template-columns: 240px 1fr; }
.lateral { background: #141720; border-right: 1px solid #262a33; display: flex; flex-direction: column; }
.topo { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #262a33; }
.linkbtn { background: none; border: none; color: #8b93a7; cursor: pointer; font-size: 13px; }
.linkbtn:hover { color: #e6e8ec; }
.maquinas { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.maquinas li { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.maquinas li:hover { background: #1b1f2a; }
.maquinas li.ativa { background: #233049; }
.maquinas li.off { opacity: .45; cursor: default; }
.bolinha { width: 9px; height: 9px; border-radius: 50%; background: #3a3f4b; flex: none; }
.bolinha.on { background: #39d98a; }
.mnome { font-weight: 600; }
.musuario { color: #8b93a7; font-size: 12px; }
.status { padding: 10px 16px; border-top: 1px solid #262a33; color: #8b93a7; font-size: 12px; }

.palco { display: flex; flex-direction: column; min-width: 0; }
.barra { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid #262a33; background: #141720; }
.espaco { flex: 1; }
.barra .mon { color: #8b93a7; font-size: 13px; }
.barra select { background: #0f1115; color: #e6e8ec; border: 1px solid #2d323c; border-radius: 6px; padding: 4px 6px; }
.toggle { background: #1b4; border: none; color: #04120a; font-weight: 700; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.toggle.off { background: #444a57; color: #c9cdd6; }
.fps { color: #8b93a7; font-size: 12px; min-width: 62px; text-align: right; }

.acao { background: #273043; color: #cdd3df; border: 1px solid #333b4d; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.acao:hover:not(:disabled) { background: #313c53; }
.acao:disabled { opacity: .4; cursor: default; }
.acao.rec { background: #c0392b; border-color: #c0392b; color: #fff; font-weight: 700; }

.tela { flex: 1; position: relative; display: grid; place-items: center; background: #05060a; overflow: hidden; }
#canvas { max-width: 100%; max-height: 100%; outline: none; cursor: crosshair; image-rendering: auto; touch-action: none; }
.tecladomovel { position: fixed; bottom: 0; left: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; z-index: -1; }
#canvas.sem { display: none; }
.semtela { position: absolute; color: #5a6274; }

/* painéis flutuantes */
.painel { position: fixed; right: 16px; top: 60px; bottom: 16px; width: 520px; max-width: calc(100vw - 32px);
  background: #141720; border: 1px solid #2d323c; border-radius: 10px; display: flex; flex-direction: column;
  box-shadow: 0 10px 40px #0008; z-index: 20; }
.painelcab { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #262a33; flex-wrap: wrap; }
.mini { background: #273043; color: #cdd3df; border: 1px solid #333b4d; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 13px; }
.mini:hover { background: #313c53; }
.caminho { flex: 1; min-width: 160px; background: #0f1115; color: #e6e8ec; border: 1px solid #2d323c; border-radius: 6px; padding: 5px 8px; }
.num { width: 64px; background: #0f1115; color: #e6e8ec; border: 1px solid #2d323c; border-radius: 6px; padding: 4px 6px; }
.listaarq { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.listaarq li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.listaarq li:hover { background: #1b1f2a; }
.listaarq .ic { width: 18px; text-align: center; }
.listaarq .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listaarq .tm { color: #8b93a7; font-size: 12px; }
.arqstatus { padding: 8px 12px; border-top: 1px solid #262a33; color: #8b93a7; font-size: 12px; min-height: 14px; }

.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 10px; overflow-y: auto; }
.galeria figure { margin: 0; cursor: pointer; }
.galeria img { width: 100%; border-radius: 6px; border: 1px solid #2d323c; display: block; }
.galeria figcaption { color: #8b93a7; font-size: 11px; text-align: center; margin-top: 2px; }

.visor { position: fixed; inset: 0; background: #000d; display: grid; place-items: center; z-index: 40; cursor: zoom-out; }
.visor img { max-width: 94vw; max-height: 88vh; border-radius: 6px; }
.fechavisor { position: fixed; bottom: 16px; color: #aab; font-size: 13px; }

/* celular */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lateral { max-height: 32vh; }
  .maquinas li { padding: 12px; }
  .barra { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; }
  #tituloMaquina { width: 100%; font-size: 13px; }
  .barra .espaco { display: none; }
  .acao, .toggle, .barra select { padding: 9px 12px; font-size: 14px; }
  .painel { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; height: 72vh; }
  .galeria { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
