/* ==========================================================================
   Painel Unificado de Vendas - Mercado Livre
   Tema escuro, pensado para ficar aberto o dia inteiro em uma tela.
   ========================================================================== */

:root {
  --fundo: #0b0e14;
  --fundo-2: #11151f;
  --fundo-3: #161b27;
  --borda: #232936;
  --borda-clara: #2f3745;
  --texto: #e8edf5;
  --texto-2: #98a2b3;
  --texto-3: #6b7686;
  --acento: #ffd400;
  --acento-escuro: #b39400;
  --verde: #2ea043;
  --verde-claro: #4ade80;
  --vermelho: #f04438;
  --azul: #3b82f6;
  --laranja: #f79009;
  --raio: 10px;
  --sombra: 0 8px 28px rgba(0, 0, 0, 0.45);
  --fonte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--fonte);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--fundo);
}
::-webkit-scrollbar-thumb {
  background: #2b3242;
  border-radius: 6px;
  border: 2px solid var(--fundo);
}
::-webkit-scrollbar-thumb:hover {
  background: #3a4356;
}

/* ------------------------------- cabecalho ------------------------------- */

.topo {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borda);
}

.topo-linha {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.marca-icone {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--acento), #ffb800);
  display: grid;
  place-items: center;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 900;
}

.ao-vivo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--texto-3);
  padding: 4px 10px;
  border: 1px solid var(--borda);
  border-radius: 999px;
  white-space: nowrap;
}

.ponto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--texto-3);
  flex: none;
}

.ao-vivo.online {
  color: var(--verde-claro);
  border-color: rgba(46, 160, 67, 0.4);
}
.ao-vivo.online .ponto {
  background: var(--verde-claro);
  animation: pulsar 2s ease-in-out infinite;
}
.ao-vivo.offline {
  color: var(--vermelho);
  border-color: rgba(240, 68, 56, 0.4);
}
.ao-vivo.offline .ponto {
  background: var(--vermelho);
}

@keyframes pulsar {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

.indicadores {
  display: flex;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.indicador {
  background: var(--fundo-2);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 7px 14px;
  min-width: 108px;
}

.indicador .rotulo {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--texto-3);
  font-weight: 600;
}

.indicador .valor {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

.indicador .valor small {
  font-size: 11px;
  color: var(--texto-2);
  font-weight: 500;
  margin-left: 4px;
}

.indicador.destaque .valor {
  color: var(--acento);
}

/* --------------------------------- acoes --------------------------------- */

.acoes {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 12px;
  flex-wrap: wrap;
}

.campo-busca {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}

.campo-busca input {
  width: 100%;
  background: var(--fundo-2);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  color: var(--texto);
  padding: 9px 12px 9px 34px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.campo-busca input:focus {
  border-color: var(--acento-escuro);
}

.campo-busca svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--texto-3);
}

.botao {
  background: var(--fundo-2);
  border: 1px solid var(--borda);
  color: var(--texto-2);
  border-radius: var(--raio);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.botao:hover {
  background: var(--fundo-3);
  color: var(--texto);
  border-color: var(--borda-clara);
}

.botao.ativo {
  background: rgba(255, 212, 0, 0.12);
  border-color: rgba(255, 212, 0, 0.45);
  color: var(--acento);
}

.botao.primario {
  background: var(--acento);
  border-color: var(--acento);
  color: #1a1a1a;
  font-weight: 600;
}
.botao.primario:hover {
  background: #ffdf3d;
  color: #1a1a1a;
}

.botao.perigo {
  color: #ff8b82;
  border-color: rgba(240, 68, 56, 0.35);
}
.botao.perigo:hover {
  background: rgba(240, 68, 56, 0.12);
  color: #ff8b82;
}

.botao:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.grupo-abas {
  display: flex;
  background: var(--fundo-2);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 3px;
  gap: 2px;
}

.grupo-abas button {
  background: none;
  border: none;
  color: var(--texto-3);
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.12s;
}

.grupo-abas button.ativo {
  background: var(--fundo-3);
  color: var(--texto);
}

/* --------------------------------- lista --------------------------------- */

.conteudo {
  padding: 16px 20px 60px;
  max-width: 1600px;
  margin: 0 auto;
}

.lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.venda {
  display: grid;
  grid-template-columns: 78px minmax(180px, 1.3fr) minmax(200px, 1.6fr) minmax(130px, 0.9fr) 128px 108px;
  gap: 14px;
  align-items: center;
  background: var(--fundo-2);
  border: 1px solid var(--borda);
  border-left: 3px solid transparent;
  border-radius: var(--raio);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.venda:hover {
  background: var(--fundo-3);
  border-color: var(--borda-clara);
}

.venda.nova {
  border-left-color: var(--acento);
  animation: entrar 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.venda.destacada {
  animation: entrar 0.45s cubic-bezier(0.16, 1, 0.3, 1), brilho 2.8s ease-out;
}

.venda.teste {
  border-left-color: var(--azul);
}

.venda.cancelada {
  opacity: 0.45;
}
.venda.cancelada .venda-valor {
  text-decoration: line-through;
}

@keyframes entrar {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes brilho {
  0% { background: rgba(255, 212, 0, 0.16); }
  100% { background: var(--fundo-2); }
}

.venda-hora {
  font-size: 12px;
  color: var(--texto-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.venda-hora .relativo {
  display: block;
  font-size: 10px;
  color: var(--texto-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.venda-cliente {
  min-width: 0;
}

.venda-cliente .nome {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.venda-cliente .doc {
  font-size: 11px;
  color: var(--texto-3);
  font-family: var(--mono);
}

.venda-itens {
  min-width: 0;
}

.venda-itens .descricao {
  font-size: 13px;
  color: var(--texto);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.venda-itens .pedido {
  font-size: 11px;
  color: var(--texto-3);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.venda-local {
  font-size: 13px;
  color: var(--texto-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.venda-valor {
  font-size: 16px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.venda-situacao {
  text-align: right;
}

.etiqueta {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--fundo-3);
  color: var(--texto-2);
  border: 1px solid var(--borda-clara);
  white-space: nowrap;
}

.etiqueta.aguardando {
  background: rgba(247, 144, 9, 0.14);
  color: #fdb022;
  border-color: rgba(247, 144, 9, 0.3);
}
.etiqueta.ok {
  background: rgba(46, 160, 67, 0.14);
  color: var(--verde-claro);
  border-color: rgba(46, 160, 67, 0.3);
}
.etiqueta.ruim {
  background: rgba(240, 68, 56, 0.14);
  color: #ff8b82;
  border-color: rgba(240, 68, 56, 0.3);
}
.etiqueta.info {
  background: rgba(59, 130, 246, 0.14);
  color: #7dabff;
  border-color: rgba(59, 130, 246, 0.3);
}

.carregando-linha {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--acento), transparent);
  background-size: 40% 100%;
  animation: varrer 1.1s linear infinite;
  border-radius: 2px;
  margin: 10px 0;
}

@keyframes varrer {
  0% { background-position: -40% 0; }
  100% { background-position: 140% 0; }
}

.vazio {
  text-align: center;
  padding: 90px 20px;
  color: var(--texto-3);
}

.vazio .emoji {
  font-size: 40px;
  margin-bottom: 14px;
  opacity: 0.5;
}

.vazio h3 {
  margin: 0 0 6px;
  color: var(--texto-2);
  font-size: 16px;
  font-weight: 600;
}

.vazio p {
  margin: 0;
  font-size: 13px;
  max-width: 420px;
  margin-inline: auto;
  line-height: 1.7;
}

/* -------------------------------- gaveta --------------------------------- */

.fundo-escuro {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.fundo-escuro.aberto {
  opacity: 1;
  pointer-events: auto;
}

.gaveta {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100%);
  background: var(--fundo-2);
  border-left: 1px solid var(--borda);
  z-index: 70;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  box-shadow: var(--sombra);
}

.gaveta.aberta {
  transform: none;
}

.gaveta-topo {
  position: sticky;
  top: 0;
  background: var(--fundo-2);
  border-bottom: 1px solid var(--borda);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
}

.gaveta-topo h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.gaveta-topo .sub {
  font-size: 12px;
  color: var(--texto-3);
  font-family: var(--mono);
  margin-top: 2px;
}

.fechar {
  background: none;
  border: none;
  color: var(--texto-3);
  font-size: 22px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.fechar:hover {
  background: var(--fundo-3);
  color: var(--texto);
}

.secao {
  padding: 16px 20px;
  border-bottom: 1px solid var(--borda);
}

.secao h3 {
  margin: 0 0 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--texto-3);
  font-weight: 700;
}

.dado {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  font-size: 13px;
}

.dado .chave {
  color: var(--texto-3);
  flex: none;
}

.dado .valor {
  text-align: right;
  word-break: break-word;
}

.dado .valor.copiavel {
  cursor: pointer;
  border-bottom: 1px dashed var(--borda-clara);
}
.dado .valor.copiavel:hover {
  color: var(--acento);
}

.item-produto {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--borda);
  font-size: 13px;
}
.item-produto:last-child {
  border-bottom: none;
}

.item-produto .qtd {
  color: var(--acento);
  font-weight: 700;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.item-produto .cod {
  font-size: 11px;
  color: var(--texto-3);
  font-family: var(--mono);
}

.total-linha {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--borda-clara);
}

/* --------------------------------- aviso --------------------------------- */

.avisos {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.aviso {
  background: var(--fundo-3);
  border: 1px solid var(--borda-clara);
  border-radius: var(--raio);
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: var(--sombra);
  animation: subir 0.25s ease-out;
}

.aviso.erro {
  border-color: rgba(240, 68, 56, 0.4);
  color: #ff8b82;
}
.aviso.ok {
  border-color: rgba(46, 160, 67, 0.4);
  color: var(--verde-claro);
}

@keyframes subir {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------ responsivo ------------------------------- */

@media (max-width: 1100px) {
  .venda {
    grid-template-columns: 70px minmax(140px, 1fr) minmax(160px, 1.4fr) 110px 90px;
  }
  .venda-situacao {
    display: none;
  }
}

@media (max-width: 760px) {
  .topo-linha {
    padding: 10px 14px;
    gap: 12px;
  }
  .indicadores {
    width: 100%;
    margin-left: 0;
  }
  .indicador {
    flex: 1;
    min-width: 0;
  }
  .conteudo {
    padding: 12px 14px 50px;
  }
  .acoes {
    padding: 0 14px 10px;
  }
  .venda {
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 12px 14px;
  }
  .venda-hora {
    grid-column: 1;
    order: 1;
  }
  .venda-valor {
    grid-column: 2;
    order: 2;
  }
  .venda-cliente {
    grid-column: 1 / -1;
    order: 3;
  }
  .venda-itens {
    grid-column: 1 / -1;
    order: 4;
  }
  .venda-local {
    grid-column: 1 / -1;
    order: 5;
  }
  .venda-situacao {
    display: none;
  }
}
