/* Painel da geladeira do CA. Celular primeiro (375-400 px); no computador vira uma coluna centralizada. */

:root {
  color-scheme: light dark;
  --fundo: #f4f6f8;
  --superficie: #ffffff;
  --superficie-2: #e9eef3;
  --borda: #d3dbe3;
  --texto: #1b2530;
  --texto-suave: #4f5d6b;
  --acento: #1f6fa8;
  --acento-forte: #185a89;
  --acento-fundo: #e2f0fa;
  --sobre-acento: #ffffff;
  --ok: #1b7444;
  --ok-fundo: #e1f4e9;
  --aviso: #7d5200;
  --aviso-fundo: #fdf0cf;
  --problema: #b3261e;
  --problema-fundo: #fde7e5;
  --raio: 12px;
  --coluna: 640px;
  --altura-barra: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #12171d;
    --superficie: #1b232c;
    --superficie-2: #252f3a;
    --borda: #33404d;
    --texto: #e7edf3;
    --texto-suave: #a3b2c1;
    --acento: #7bbcec;
    --acento-forte: #a1d0f3;
    --acento-fundo: #17303f;
    --sobre-acento: #08202f;
    --ok: #62d08f;
    --ok-fundo: #12301f;
    --aviso: #f0c261;
    --aviso-fundo: #392c0d;
    --problema: #ff938a;
    --problema-fundo: #3d1a18;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#app {
  max-width: var(--coluna);
  margin: 0 auto;
  padding: 20px 16px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  outline: none;
}

/* abre espaço para a barra inferior fixa */
body:not(.sem-barra) #app {
  padding-bottom: calc(var(--altura-barra) + env(safe-area-inset-bottom, 0px) + 24px);
}

h1 { margin: 4px 0 8px; font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.01em; }
/* o foco vai para o título ao trocar de tela (leitor de tela), mas sem desenhar o aro */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }
h2 { margin: 0 0 10px; font-size: 1.05rem; line-height: 1.3; }

a { color: var(--acento); }

:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 6px; }

.instrucao { margin: 0 0 20px; color: var(--texto-suave); }

.marca {
  display: flex; align-items: center; gap: 10px;
  margin: 24px 0 28px; color: var(--acento); font-weight: 650; font-size: 1.1rem;
}

.carregando, .vazio { color: var(--texto-suave); }

/* input.so-leitor[type] (0,2,1) vence input[type="text"] (0,1,1), que vem depois no arquivo */
input.so-leitor[type], .so-leitor {
  position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Blocos e listas */
.secao { margin-top: 28px; }
.pilha { display: grid; gap: 10px; }
.lista-simples { margin: 8px 0; padding-left: 20px; }

.cartao {
  display: grid; gap: 4px;
  min-height: 44px; padding: 14px 16px;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
  color: var(--texto); text-decoration: none;
}
.cartao-link:active { background: var(--superficie-2); }
.cartao-titulo { font-weight: 650; }
.cartao-nota { color: var(--texto-suave); font-size: 0.95rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cartao-linha { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; color: var(--texto-suave); font-size: 0.95rem; }

/* Botões */
.botao {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 18px; width: 100%;
  border: 1.5px solid transparent; border-radius: var(--raio);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  touch-action: manipulation;
}
.botao-grande { min-height: 56px; font-size: 1.1rem; }
.botao-primario { background: var(--acento); color: var(--sobre-acento); }
.botao-primario:active { background: var(--acento-forte); }
.botao-secundario { background: transparent; color: var(--acento); border-color: var(--acento); }
.botao-perigo { background: transparent; color: var(--problema); border-color: var(--problema); }
.botao:disabled { opacity: 0.6; cursor: progress; }

/* Formulários */
.formulario { display: grid; gap: 16px; }
.campo { display: grid; gap: 6px; }
.campo label { font-weight: 600; }
.dica { margin: 0; color: var(--texto-suave); font-size: 0.9rem; }

input[type="text"], input[type="password"], input[type="email"], input[type="datetime-local"], textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  background: var(--superficie); color: var(--texto);
  border: 1.5px solid var(--borda); border-radius: 10px;
  font: inherit;
}
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--acento); outline-offset: 1px; }

/* Mensagens: a barra lateral e o texto carregam o significado, não só a cor */
.caixa {
  display: block; margin: 0 0 14px; padding: 12px 14px;
  border-left: 5px solid var(--acento); border-radius: 8px;
  background: var(--acento-fundo); color: var(--texto);
}
.caixa ul, .caixa a { margin-top: 6px; }
.caixa a { display: inline-block; min-height: 44px; padding-top: 10px; color: inherit; font-weight: 650; }
.caixa-ok { border-color: var(--ok); background: var(--ok-fundo); }
.caixa-aviso { border-color: var(--aviso); background: var(--aviso-fundo); }
.caixa-problema { border-color: var(--problema); background: var(--problema-fundo); }
.caixa-info { border-color: var(--acento); background: var(--acento-fundo); }

.selo {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 650; line-height: 1.5;
}
.selo-ok { color: var(--ok); background: var(--ok-fundo); }
.selo-aviso { color: var(--aviso); background: var(--aviso-fundo); }
.selo-problema { color: var(--problema); background: var(--problema-fundo); }

/* Barra inferior */
#barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--superficie); border-top: 1px solid var(--borda);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#barra[hidden] { display: none; }
#barra ul {
  display: flex; max-width: var(--coluna); margin: 0 auto; padding: 0; list-style: none;
}
#barra li { flex: 1; min-width: 0; }
#barra a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--altura-barra); padding: 6px 2px;
  color: var(--texto-suave); font-size: 0.72rem; font-weight: 600; text-decoration: none;
  border-top: 3px solid transparent;
}
#barra a[aria-current="page"] { color: var(--acento); border-top-color: var(--acento); }

/* ---------- Conferência, abertura e casos ---------- */
.selo-neutro { color: var(--texto-suave); background: var(--superficie-2); }
.pilha-larga { gap: 0; }
.periodo { margin: 0 0 12px; color: var(--texto-suave); }
h3 { margin: 18px 0 8px; font-size: 0.95rem; line-height: 1.3; color: var(--texto-suave); }

textarea { min-height: 96px; resize: vertical; font: inherit; line-height: 1.4; }
.grupo { margin: 0; padding: 0; border: 0; min-width: 0; }
.grupo legend { padding: 0; font-weight: 600; margin-bottom: 4px; }
.opcao {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px;
  background: var(--superficie); border: 1.5px solid var(--borda); border-radius: 10px; font-weight: 500;
}
.opcao + .opcao { margin-top: 8px; }
.opcao input { width: 24px; height: 24px; flex: none; accent-color: var(--acento); }
.acoes { display: grid; gap: 10px; }
.formulario-nota { padding: 14px; background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); }
.erro-inline {
  margin: 0; padding: 8px 12px; border-left: 4px solid var(--problema); border-radius: 6px;
  background: var(--problema-fundo); color: var(--texto); font-size: 0.95rem;
}
.aviso-linha { margin: 0; padding: 6px 10px; border-left: 4px solid var(--aviso); border-radius: 6px; background: var(--aviso-fundo); color: var(--texto); font-size: 0.9rem; }

/* contadores no topo da conferência */
.resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.contador {
  display: grid; justify-items: center; gap: 0; padding: 10px 4px;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); text-align: center;
}
.contador strong { font-size: 1.7rem; line-height: 1.2; }
.contador span { font-size: 0.85rem; color: var(--texto-suave); }
.contador-ok strong { color: var(--ok); }
.contador-aviso { border-color: var(--aviso); background: var(--aviso-fundo); }
.contador-aviso strong { color: var(--aviso); }
.barra-filtro { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.barra-filtro .botao[aria-pressed="true"] { background: var(--acento); color: var(--sobre-acento); }
.barra-filtro + .erro-inline { margin-bottom: 14px; }

/* lista de aberturas */
.lista-aberturas { display: grid; gap: 12px; }
.separador-dia { margin: 10px 0 0; text-transform: capitalize; }
.abertura {
  display: grid; gap: 10px; padding: 12px;
  background: var(--superficie); border: 1px solid var(--borda); border-left: 5px solid var(--aviso); border-radius: var(--raio);
}
.abertura-explicada { border-left-color: var(--ok); }
.abertura-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.abertura-hora { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.abertura-pix { color: var(--texto-suave); font-size: 0.95rem; }
.linha-info {
  margin: 0; padding: 8px 12px; border-radius: 8px;
  background: var(--superficie-2); color: var(--texto-suave); font-size: 0.92rem;
}
.linha-info-aviso { background: var(--aviso-fundo); color: var(--texto); }

/* fotos: caixas de proporção fixa, a lista não pula quando a imagem chega */
.foto { position: relative; overflow: hidden; background: var(--superficie-2); border-radius: 8px; }
.foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* a câmera do rosto está montada de cabeça para baixo: o painel gira a foto (o arquivo guardado fica como veio) */
.foto img.foto-girada { transform: rotate(180deg); }
.foto-rotulo {
  position: absolute; left: 4px; bottom: 4px; padding: 0 6px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.75rem; line-height: 1.5;
}
.foto-vazia {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 6px;
  color: var(--texto-suave); font-size: 0.8rem; text-align: center;
}
.fotos-linha { display: grid; grid-template-columns: 3fr 2fr; grid-template-rows: auto auto; gap: 6px; color: inherit; }
.fotos-linha .foto-rosto { grid-row: span 2; min-height: 120px; }
.fotos-linha .foto-lado { aspect-ratio: 4 / 3; }
.fotos-linha .foto-sem-slave { grid-row: span 2; align-self: center; }
.foto-grande { aspect-ratio: 4 / 3; }
.foto-miniatura { width: 88px; aspect-ratio: 1 / 1; flex: none; }

.carrossel {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px;
  margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-padding: 0 16px;
}
.carrossel-item { flex: 0 0 84%; max-width: 440px; scroll-snap-align: start; }
.carrossel-item .foto { width: 100%; }

/* marcações */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--acento-fundo); color: var(--texto); font-size: 0.85rem; font-weight: 600; }
.chip-reposicao { background: var(--superficie-2); }
.chip-nada_saiu { background: var(--ok-fundo); }
.marcar { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
.marcar-1 { grid-template-columns: 1fr; }
.botao-marcar {
  min-height: 56px; padding: 8px 6px; background: var(--superficie); color: var(--acento);
  border-color: var(--acento); font-size: 1rem; text-align: center;
}
.botao-marcar[aria-pressed="true"] { background: var(--acento); color: var(--sobre-acento); }
.botao-marcar[aria-pressed="true"]::before { content: "\2713\00a0"; }

/* participantes, histórico, confirmações */
.participantes, .historico { margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.participantes li, .historico li {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px;
  padding: 10px 12px; background: var(--superficie); border: 1px solid var(--borda); border-radius: 10px;
}
.historico li { display: grid; justify-content: stretch; }
.texto-riscado { text-decoration: line-through; color: var(--texto-suave); }
.nota-historico { white-space: pre-wrap; overflow-wrap: anywhere; }
.confirmacao { margin-top: 14px; }
.confirmacao p { margin: 0 0 10px; }
.secao > .botao { margin-top: 10px; }
.secao > .pilha > .botao { margin-top: 0; }
.cartao-resumo { gap: 6px; margin-bottom: 4px; }

/* casos */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filtro {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--borda); background: var(--superficie); color: var(--texto); font-weight: 600; text-decoration: none;
}
.filtro[aria-current="page"] { background: var(--acento); border-color: var(--acento); color: var(--sobre-acento); }
.cartao-caso { display: flex; align-items: center; gap: 12px; }
.cartao-corpo { display: grid; gap: 4px; min-width: 0; }

/* diretoria */
.dados { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 6px 0 0; font-size: 0.95rem; }
.dados dt { color: var(--texto-suave); }
.dados dd { margin: 0; overflow-wrap: anywhere; }
.cartao-alerta { gap: 8px; }
.usuarios { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.usuario { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); }
.usuario-linha {
  display: grid; gap: 4px; width: 100%; min-height: 56px; padding: 12px 14px; text-align: left;
  background: transparent; border: 0; border-radius: var(--raio); color: var(--texto); font: inherit; cursor: pointer;
  touch-action: manipulation;
}
.usuario-linha[aria-expanded="true"] { background: var(--superficie-2); }
.usuario-nome { font-weight: 650; overflow-wrap: anywhere; }
.usuario-email { color: var(--texto-suave); font-size: 0.92rem; overflow-wrap: anywhere; }
.usuario-inativo .usuario-nome, .usuario-inativo .usuario-email { color: var(--texto-suave); }
.usuario-inativo .usuario-nome { font-weight: 500; }
.painel-edicao { display: grid; gap: 16px; padding: 14px; border-top: 1px solid var(--borda); }
/* Wi-Fi da geladeira (Configurações): redes salvas e fixas */
.redes { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rede { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.rede-nome { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.aviso-wifi { scroll-margin-bottom: calc(var(--altura-barra) + 16px); }
.rede .botao { width: auto; min-height: 44px; flex: none; }

.separador { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--borda); }

@media (min-width: 700px) {
  #app { padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* geladeira: porta em destaque e grade de fotos */
.porta {
  display: grid; gap: 2px; justify-items: center; text-align: center; padding: 18px 16px;
  border: 1px solid var(--borda); border-left-width: 6px; border-radius: var(--raio); background: var(--superficie);
}
.porta-estado { font-size: 2.2rem; font-weight: 800; line-height: 1.15; letter-spacing: 0.02em; }
.porta-sem-dado .porta-estado { font-size: 1.3rem; font-weight: 700; color: var(--texto-suave); }
.porta-rotulo { color: var(--texto-suave); font-size: 0.9rem; }
.porta-tempo { font-size: 1.1rem; font-weight: 650; }
.porta-aberta { border-color: var(--aviso); background: var(--aviso-fundo); }
.porta-aberta .porta-estado { color: var(--aviso); }
.porta-fechada { border-color: var(--ok); background: var(--ok-fundo); }
.porta-fechada .porta-estado { color: var(--ok); }
.abertura-fotos { gap: 10px; }
.abertura-fotos-topo { justify-content: space-between; }
.grade-fotos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.grade-fotos .foto-terco { grid-column: span 2; }
.grade-fotos .foto-metade { grid-column: span 3; }
.grade-fotos .dica { grid-column: span 6; }
.foto-grade { aspect-ratio: 4 / 3; }
