/* Robô Nexo — cores de tinta de serigrafia (CMYK) sobre papel frio */
:root {
  --papel: #EEF1F5;
  --folha: #FFFFFF;
  --tinta: #172036;
  --tinta-2: #4A5470;
  --linha: #D9DEE7;
  --ciano: #0A97B8;
  --magenta: #D62672;
  --amarelo: #F2B90F;
  --ok: var(--ciano);
  --erro: var(--magenta);
  --espera: var(--amarelo);
  --raio-g: 22px;
  --raio-p: 12px;
  --sombra: 0 1px 0 rgba(23, 32, 54, .06), 0 8px 24px -12px rgba(23, 32, 54, .18);
  --fonte: "Archivo", system-ui, sans-serif;
  --barra: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papel: #0F1524;
    --folha: #182036;
    --tinta: #EEF1F7;
    --tinta-2: #A3ACC4;
    --linha: #283252;
    --ciano: #2BC0E0;
    --magenta: #FF4D97;
    --amarelo: #FFD24A;
    --sombra: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ciano); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* -------- estrutura -------- */
.tela {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--barra) + env(safe-area-inset-bottom) + 24px);
}
.topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 800; font-stretch: 112%; font-size: 17px; letter-spacing: -.01em; }
.marca svg { width: 26px; height: 26px; }
h1 { font-size: 30px; line-height: 1.1; font-weight: 800; font-stretch: 118%; letter-spacing: -.02em; margin: 6px 0 16px; }
h2 { font-size: 18px; font-weight: 750; font-stretch: 108%; margin: 28px 0 10px; }
.sub { color: var(--tinta-2); font-size: 14px; margin: -8px 0 16px; }

/* -------- cartão do robô (o elemento marcante) -------- */
.robo {
  position: relative;
  background: var(--tinta);
  color: #fff;
  border-radius: var(--raio-g);
  padding: 22px 20px 20px;
  overflow: hidden;
}
@media (prefers-color-scheme: dark) { .robo { background: #1F2A47; } }
.robo::before { /* marca de registro da serigrafia */
  content: ""; position: absolute; width: 18px; height: 18px; border: 1.5px solid rgba(255,255,255,.35); border-radius: 50%;
}
.robo::before { top: 12px; right: 12px; }
.robo .estado { display: flex; align-items: center; gap: 10px; font-size: 15px; opacity: .85; }
.pulso { width: 10px; height: 10px; border-radius: 50%; background: var(--amarelo); flex: none; }
.pulso.trabalhando { background: #4FE0FF; animation: pulso 1.6s ease-in-out infinite; }
.pulso.pausado { background: var(--amarelo); }
.pulso.erro { background: var(--magenta); }
@keyframes pulso { 50% { box-shadow: 0 0 0 7px rgba(79, 224, 255, 0); opacity: .55; } }
.robo .agora { font-size: 24px; line-height: 1.2; font-weight: 750; font-stretch: 110%; margin: 10px 0 18px; max-width: 90%; }
.tiras { display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px; margin-bottom: 18px; }
.tiras i { height: 22px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.botao-grande {
  width: 100%; min-height: 54px; border: 0; border-radius: 14px;
  font-weight: 750; font-size: 17px; font-stretch: 105%;
  background: #fff; color: var(--tinta);
}
.botao-grande.retomar { background: #4FE0FF; color: #06243A; }

/* -------- números do dia -------- */
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.num { background: var(--folha); border-radius: var(--raio-p); padding: 12px 10px; box-shadow: var(--sombra); }
.num b { display: block; font-size: 24px; font-weight: 800; font-stretch: 110%; font-variant-numeric: tabular-nums; }
.num span { font-size: 12px; line-height: 1.25; display: block; color: var(--tinta-2); }
.num.erro b { color: var(--erro); }

/* -------- listas -------- */
.lista { background: var(--folha); border-radius: 18px; box-shadow: var(--sombra); overflow: hidden; }
.linha {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; min-height: 60px;
  background: none; border: 0; border-top: 1px solid var(--linha); text-align: left;
}
.linha:first-child { border-top: 0; }
.linha .meio { flex: 1; min-width: 0; }
.linha .nome { font-weight: 650; }
.linha .det { font-size: 13px; color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha .fim { font-size: 13px; color: var(--tinta-2); text-align: right; font-variant-numeric: tabular-nums; }
.seta { width: 8px; height: 8px; border-right: 2px solid var(--tinta-2); border-top: 2px solid var(--tinta-2); transform: rotate(45deg); opacity: .5; flex: none; }
.bola { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bola.ok { background: var(--ok); }
.bola.pendente { background: var(--espera); }
.bola.erro { background: var(--erro); }
.bola.off { background: var(--linha); }
.vazio { padding: 22px 18px; color: var(--tinta-2); font-size: 15px; }

/* grupo na tela de lojas e giro */
.grupo-cab { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 8px; }
.grupo-cab b { font-size: 15px; font-weight: 750; font-stretch: 108%; }
.grupo-cab span { font-size: 13px; color: var(--tinta-2); }
.etiqueta { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--papel); color: var(--tinta-2); }
.etiqueta.agora { background: var(--ciano); color: #fff; }

/* giro */
.giro { display: flex; flex-direction: column; gap: 10px; }
.g { background: var(--folha); border-radius: 18px; padding: 16px; box-shadow: var(--sombra); border: 2px solid transparent; }
.g.atual { border-color: var(--ciano); }
.g .t { display: flex; justify-content: space-between; align-items: center; font-weight: 750; font-stretch: 108%; }
.g .q { font-size: 14px; color: var(--tinta-2); margin-top: 4px; }
.lote { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 12px; }
.lote i { height: 8px; border-radius: 4px; background: var(--linha); }
.lote i.f { background: var(--ciano); }
.mini { border: 1px solid var(--linha); background: none; border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; }

/* formulários */
.campo { display: block; padding: 12px 16px; border-top: 1px solid var(--linha); }
.campo:first-child { border-top: 0; }
.campo span { display: block; font-size: 13px; color: var(--tinta-2); margin-bottom: 4px; }
.campo input, .campo select {
  width: 100%; border: 0; background: none; padding: 4px 0; font-size: 17px; font-weight: 600; outline: none;
}
.campo input::placeholder { color: var(--tinta-2); opacity: .55; font-weight: 400; }
.chave { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--linha); }
.chave:first-child { border-top: 0; }
.chave input { appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--linha); position: relative; flex: none; transition: background .2s; }
.chave input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.chave input:checked { background: var(--ciano); }
.chave input:checked::after { transform: translateX(20px); }
.botao { width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: var(--tinta); color: var(--papel); font-weight: 700; font-size: 16px; margin-top: 14px; }
.botao.sec { background: var(--folha); color: var(--tinta); box-shadow: var(--sombra); }
.botao.perigo { background: none; color: var(--erro); box-shadow: none; }
.botao:disabled { opacity: .5; }

/* folha (bottom sheet) */
.fundo { position: fixed; inset: 0; background: rgba(10, 14, 26, .45); z-index: 30; animation: some .2s reverse; }
.folha {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 92vh; overflow: auto;
  background: var(--papel); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 20px);
  animation: sobe .26s cubic-bezier(.2, .8, .2, 1);
  max-width: 560px; margin: 0 auto;
}
.folha .alca { width: 40px; height: 5px; border-radius: 3px; background: var(--linha); margin: 0 auto 12px; }
@keyframes sobe { from { transform: translateY(40px); opacity: 0; } }
@keyframes some { to { opacity: 0; } }

/* barra de abas */
.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: color-mix(in srgb, var(--folha) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linha);
}
.aba { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--tinta-2); position: relative; }
.aba svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.aba[aria-current="page"] { color: var(--tinta); }
.aba[aria-current="page"]::before { content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--magenta); }
.aba .ponto { position: absolute; top: 4px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--magenta); }

/* entrar */
.entrar { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px; max-width: 420px; margin: 0 auto; }
.entrar h1 { font-size: 40px; }
.entrar .lista { margin-top: 18px; }
.aviso { color: var(--erro); font-size: 14px; margin-top: 10px; min-height: 20px; }

/* tela remota */
.remota { position: fixed; inset: 0; z-index: 40; background: #0B0F1A; display: flex; flex-direction: column; }
.remota header { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; color: #fff; }
.remota header b { flex: 1; font-weight: 700; }
.remota iframe { flex: 1; border: 0; width: 100%; background: #000; }
.remota footer { display: flex; gap: 10px; padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px); }
.remota footer button { flex: 1; min-height: 50px; border-radius: 14px; border: 0; font-weight: 700; }
.remota .ok { background: #4FE0FF; color: #06243A; }
.remota .x { background: #222B44; color: #fff; }
.dica { color: #A3ACC4; font-size: 13px; padding: 0 12px 6px; }

/* erros */
.erro-item { padding: 14px 16px; border-top: 1px solid var(--linha); }
.erro-item:first-child { border-top: 0; }
.erro-item b { display: block; }
.erro-item p { margin: 4px 0 10px; font-size: 14px; color: var(--tinta-2); }
.erro-item img { width: 100%; border-radius: 10px; margin-bottom: 10px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--barra) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 20px);
  background: var(--tinta); color: var(--papel); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.digitar { display: flex; gap: 8px; padding: 0 12px 10px; }
.digitar input { flex: 1; min-width: 0; height: 46px; border-radius: 12px; border: 1px solid #2E3A5E; background: #161E33; color: #fff; padding: 0 14px; font-size: 16px; }
.digitar button { height: 46px; border: 0; border-radius: 12px; padding: 0 16px; font-weight: 700; background: #4FE0FF; color: #06243A; }
.digitar .olho { background: #222B44; color: #fff; padding: 0 12px; }
