/* Acompanhamento da Piscicultura
 *
 * Feito para celular, na beira do tanque, no sol:
 *   - fundo claro e texto escuro (tela escura some no sol)
 *   - botões de no mínimo 56px e fonte base de 18px
 *   - cor nunca é a única pista: todo sinal tem palavra junto
 * Paleta da marca (LP Água Sob Controle): #071A21 escuro, #47D0C8 turquesa,
 * #F2B33D amarelo. O turquesa claro não tem contraste sobre branco, então os
 * botões usam o tom escurecido --primaria.
 */

:root {
  color-scheme: light;
  --escuro: #071a21;
  --escuro-2: #0c2a34;
  --turquesa: #47d0c8;
  --primaria: #0b6f69;
  --primaria-escura: #085752;
  --fundo: #eef4f4;
  --superficie: #ffffff;
  --linha: #d3e0e1;
  --texto: #0d1f25;
  --texto-2: #46615f;
  --verde: #1b7f3b;
  --verde-fundo: #e3f3e8;
  --amarelo: #9a6400;
  --amarelo-forte: #f2b33d;
  --amarelo-fundo: #fdf1d8;
  --vermelho: #c0271d;
  --vermelho-fundo: #fbe5e3;
  --cinza: #6b7f84;
  --cinza-fundo: #e7eded;
  --raio: 16px;
  --sombra: 0 1px 2px rgba(7, 26, 33, 0.06), 0 4px 14px rgba(7, 26, 33, 0.06);
  --titulo: 'Bricolage Grotesque', 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --corpo: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --altura-nav: 68px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 18px/1.45 var(--corpo);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--altura-nav) + env(safe-area-inset-bottom));
}

body.sem-nav { padding-bottom: 0; }

h1, h2, h3 { font-family: var(--titulo); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--primaria); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--turquesa); outline-offset: 2px; }

.so-leitor {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── estrutura ───────────────────────────────────────────────────────── */

.topo {
  background: var(--escuro);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 16px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topo-linha { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topo h1 { font-size: 1.3rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.topo .sub { color: #a9c4c8; font-size: 0.9rem; margin-top: 2px; }

.botao-voltar {
  width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: var(--escuro-2); color: #fff; display: grid; place-items: center;
  flex: none; cursor: pointer;
}
.botao-voltar svg { width: 24px; height: 24px; }

.conteudo {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: grid;
  gap: 16px;
}

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--superficie);
  border-top: 1px solid var(--linha);
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  height: var(--altura-nav);
  display: grid; place-items: center; align-content: center; gap: 2px;
  text-decoration: none; color: var(--texto-2); font-size: 0.8rem; font-weight: 600;
}
.nav a svg { width: 26px; height: 26px; }
.nav a[aria-current='page'] { color: var(--primaria); }
.nav a[aria-current='page'] svg { stroke-width: 2.4; }

/* ── selo de sincronização ───────────────────────────────────────────── */

.selo {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: var(--escuro-2); color: #cfe3e5; white-space: nowrap; border: 0;
}
.selo::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--turquesa); }
.selo[data-situacao='sem-internet']::before,
.selo[data-situacao='pendente']::before { background: var(--amarelo-forte); }
.selo[data-situacao='erro']::before { background: #ff6b5f; }
.selo[data-situacao='demonstracao']::before { background: #a9c4c8; }

/* ── cartões ─────────────────────────────────────────────────────────── */

.cartao {
  background: var(--superficie);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 18px;
  display: grid;
  gap: 12px;
}

a.cartao { color: inherit; text-decoration: none; }
a.cartao:active { transform: scale(0.99); }

.cartao-cabeca { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.cartao-cabeca h2 { font-size: 1.35rem; }

.secao-titulo {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--texto-2); margin: 8px 2px -4px;
}

/* ── sinal (semáforo com palavra) ────────────────────────────────────── */

.sinal {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.sinal::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.sinal[data-cor='verde'] { color: var(--verde); background: var(--verde-fundo); }
.sinal[data-cor='amarelo'] { color: var(--amarelo); background: var(--amarelo-fundo); }
.sinal[data-cor='amarelo']::before { background: var(--amarelo-forte); }
.sinal[data-cor='vermelho'] { color: var(--vermelho); background: var(--vermelho-fundo); }
.sinal[data-cor='cinza'] { color: var(--cinza); background: var(--cinza-fundo); }

/* ── destaque: a decisão do dia ──────────────────────────────────────── */

.decisao {
  background: var(--escuro);
  color: #fff;
  border-radius: var(--raio);
  padding: 18px;
  display: grid;
  gap: 6px;
}
.decisao .rotulo { color: var(--turquesa); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.decisao .grande { font-family: var(--titulo); font-size: 2.3rem; font-weight: 700; line-height: 1.05; }
.decisao .detalhe { color: #cfe3e5; }
.decisao .detalhe strong { color: #fff; }
.decisao[data-cor='vermelho'] { background: #5a1410; }
.decisao[data-cor='vermelho'] .rotulo { color: #ffb4ab; }
.decisao[data-cor='amarelo'] { background: #4a3300; }
.decisao[data-cor='amarelo'] .rotulo { color: var(--amarelo-forte); }

/* ── avisos ──────────────────────────────────────────────────────────── */

.aviso {
  border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start;
  background: var(--cinza-fundo); color: var(--texto);
  border-left: 5px solid var(--cinza);
}
.aviso svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.aviso[data-cor='verde'] { background: var(--verde-fundo); border-color: var(--verde); }
.aviso[data-cor='amarelo'] { background: var(--amarelo-fundo); border-color: var(--amarelo-forte); }
.aviso[data-cor='vermelho'] { background: var(--vermelho-fundo); border-color: var(--vermelho); }
.aviso small { display: block; color: var(--texto-2); margin-top: 2px; }

/* ── indicadores ─────────────────────────────────────────────────────── */

.indicadores {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.indicador {
  background: var(--fundo); border-radius: 12px; padding: 10px 12px; min-width: 0;
}
.indicador .valor { font-family: var(--titulo); font-size: 1.35rem; font-weight: 700; overflow-wrap: anywhere; }
.indicador .nome { font-size: 0.8rem; color: var(--texto-2); font-weight: 600; }
.indicador[data-cor='vermelho'] .valor { color: var(--vermelho); }
.indicador[data-cor='amarelo'] .valor { color: var(--amarelo); }
.indicador[data-cor='verde'] .valor { color: var(--verde); }

/* ── lista do dia ────────────────────────────────────────────────────── */

.checklist { display: flex; flex-wrap: wrap; gap: 8px; }
.checklist span {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 600;
  padding: 6px 10px; border-radius: 999px; background: var(--cinza-fundo); color: var(--texto-2);
}
.checklist span svg { width: 16px; height: 16px; }
.checklist span[data-feito='true'] { background: var(--verde-fundo); color: var(--verde); }

/* ── botões ──────────────────────────────────────────────────────────── */

.botao {
  min-height: 56px; border-radius: 14px; border: 2px solid transparent;
  padding: 12px 20px; font-weight: 700; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; cursor: pointer; width: 100%;
  background: var(--primaria); color: #fff;
}
.botao:active { background: var(--primaria-escura); }
.botao svg { width: 22px; height: 22px; }
.botao[disabled] { opacity: 0.5; cursor: not-allowed; }
.botao.secundario { background: var(--superficie); color: var(--primaria); border-color: var(--primaria); }
.botao.discreto { background: transparent; color: var(--primaria); min-height: 48px; }
.botao.perigo { background: var(--superficie); color: var(--vermelho); border-color: var(--vermelho); }

.acoes {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.acao {
  min-height: 96px; border-radius: 16px; border: 2px solid var(--linha);
  background: var(--superficie); color: var(--texto);
  display: grid; place-items: center; align-content: center; gap: 6px; padding: 10px;
  text-decoration: none; font-weight: 700; text-align: center; font-size: 1rem;
}
.acao svg { width: 34px; height: 34px; color: var(--primaria); }
.acao small { font-weight: 600; color: var(--texto-2); font-size: 0.8rem; }
.acao[data-feito='true'] { border-color: var(--verde); background: var(--verde-fundo); }
.acao[data-feito='true'] small { color: var(--verde); }
.acao:active { transform: scale(0.98); }

.rodape-form {
  display: grid; gap: 10px; position: sticky; bottom: calc(var(--altura-nav) + env(safe-area-inset-bottom));
  padding: 12px 0 4px; background: linear-gradient(to top, var(--fundo) 75%, transparent);
}
body.sem-nav .rodape-form { bottom: env(safe-area-inset-bottom); }

/* ── formulários ─────────────────────────────────────────────────────── */

.campo { display: grid; gap: 6px; }
.campo > label, .campo > .rotulo { font-weight: 700; }
.campo .dica { font-size: 0.9rem; color: var(--texto-2); }

.entrada {
  display: flex; align-items: stretch; border: 2px solid var(--linha); border-radius: 14px;
  background: var(--superficie); overflow: hidden;
}
.entrada:focus-within { border-color: var(--primaria); }
.entrada input, .entrada select, .entrada textarea {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 14px 16px;
  font-size: 1.4rem; font-weight: 600; outline: none;
}
.entrada select, .entrada textarea { font-size: 1.1rem; }
.entrada textarea { min-height: 96px; resize: vertical; }
.entrada .unidade {
  display: grid; place-items: center; padding: 0 16px; color: var(--texto-2);
  font-weight: 700; background: var(--fundo); white-space: nowrap;
}
.campo[data-erro] .entrada { border-color: var(--vermelho); }
.campo .erro { color: var(--vermelho); font-weight: 600; font-size: 0.95rem; }
.campo .entendi { font-size: 0.95rem; color: var(--texto-2); min-height: 1.4em; }
.campo .entendi strong { color: var(--texto); }

.contador { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; }
.contador button {
  border-radius: 14px; border: 2px solid var(--linha); background: var(--superficie);
  font-size: 1.8rem; font-weight: 700; color: var(--primaria); cursor: pointer;
}
.contador .entrada input { text-align: center; }

.alternador {
  display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 8px;
  border: 0; padding: 0; margin: 0; min-width: 0;
}
.alternador.quebra { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.alternador legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.alternador label {
  min-height: 56px; border-radius: 14px; border: 2px solid var(--linha); background: var(--superficie);
  display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  font-weight: 700; padding: 8px 10px; cursor: pointer;
}
.alternador label svg { width: 24px; height: 24px; color: var(--primaria); flex: none; }
.alternador input { position: absolute; opacity: 0; pointer-events: none; }
.alternador input:checked + label { border-color: var(--primaria); background: #e0f2f0; color: var(--primaria-escura); }
.alternador input:focus-visible + label { outline: 3px solid var(--turquesa); outline-offset: 2px; }

.caixa {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px;
  border: 2px solid var(--linha); background: var(--superficie); cursor: pointer;
}
.caixa input { width: 26px; height: 26px; flex: none; margin: 0; accent-color: var(--primaria); }
.caixa small { display: block; color: var(--texto-2); font-weight: 400; }

details.mais { border-radius: 14px; background: var(--superficie); border: 2px solid var(--linha); }
details.mais > summary {
  cursor: pointer; padding: 14px 16px; font-weight: 700; color: var(--primaria); list-style: none;
  display: flex; justify-content: space-between; align-items: center; min-height: 56px;
}
details.mais > summary::-webkit-details-marker { display: none; }
details.mais > summary::after { content: '+'; font-size: 1.5rem; line-height: 1; }
details.mais[open] > summary::after { content: '−'; }
details.mais > .dentro { padding: 0 16px 16px; display: grid; gap: 14px; }

/* ── senha de 4 dígitos ──────────────────────────────────────────────── */

.pin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 320px; }
.pin input {
  width: 100%; min-width: 0; /* sem isso cada caixa tem ~170px e as 4 estouram a tela */
  height: 68px; text-align: center; font-size: 2rem; font-weight: 700;
  border: 2px solid var(--linha); border-radius: 14px; background: var(--superficie);
  -webkit-text-security: disc;
}
.pin input:focus { border-color: var(--primaria); outline: none; }

/* ── listas e tabelas ────────────────────────────────────────────────── */

.lista { display: grid; gap: 0; }
.lista > * {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--linha); min-height: 52px;
}
.lista > *:last-child { border-bottom: 0; }
.lista .principal { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lista .secundario { color: var(--texto-2); font-size: 0.9rem; }
.lista .direita { text-align: right; font-weight: 700; white-space: nowrap; }
.lista a { color: inherit; text-decoration: none; }

.tabela-rolagem { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.tabela { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.tabela th { text-align: left; font-size: 0.75rem; color: var(--texto-2); text-transform: uppercase; letter-spacing: 0.03em; padding: 6px 6px; vertical-align: bottom; line-height: 1.2; }
.tabela td { padding: 10px 6px; border-top: 1px solid var(--linha); white-space: nowrap; }
.tabela td.num, .tabela th.num { text-align: right; }

/* conta aberta: de onde vem o número */
.conta { display: grid; gap: 0; font-size: 0.98rem; }
.conta > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--linha); }
.conta > div span:last-child { font-weight: 700; white-space: nowrap; }
.conta > div.total { border-bottom: 0; border-top: 2px solid var(--texto); font-weight: 700; margin-top: 4px; padding-top: 10px; }
.conta > div.sub span:first-child { padding-left: 14px; color: var(--texto-2); }

/* ── avisos soltos ───────────────────────────────────────────────────── */

.faixa-demonstracao {
  background: var(--amarelo-fundo); color: var(--amarelo); font-size: 0.9rem; font-weight: 600;
  padding: 8px 16px; text-align: center; border-bottom: 1px solid #f0d9a6;
}
.faixa-demonstracao button { background: none; border: 0; color: var(--primaria); font-weight: 700; text-decoration: underline; padding: 0 4px; cursor: pointer; }

.vazio { text-align: center; display: grid; gap: 12px; padding: 24px 8px; color: var(--texto-2); }
.vazio svg { width: 56px; height: 56px; margin: 0 auto; color: var(--turquesa); }
.vazio h2 { color: var(--texto); }

.notinha { font-size: 0.85rem; color: var(--texto-2); text-align: center; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--altura-nav) + 16px + env(safe-area-inset-bottom));
  margin: 0 auto; max-width: 480px; z-index: 50;
  background: var(--escuro); color: #fff; border-radius: 14px; padding: 14px 18px;
  font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex; gap: 10px; align-items: center;
  animation: subir 0.2s ease-out;
}
.toast svg { width: 22px; height: 22px; color: var(--turquesa); flex: none; }
body.sem-nav .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
@keyframes subir { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

dialog.confirmar {
  border: 0; border-radius: 20px; padding: 22px; width: min(420px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); color: var(--texto);
}
dialog.confirmar::backdrop { background: rgba(7, 26, 33, 0.55); }
dialog.confirmar .corpo { display: grid; gap: 16px; }

.carregando { display: grid; place-items: center; min-height: 50vh; color: var(--texto-2); }

/* ── telas de entrada ────────────────────────────────────────────────── */

.tela-entrada { min-height: 100vh; min-height: 100dvh; display: grid; align-content: start; background: var(--escuro); }
.tela-entrada .marca { padding: calc(40px + env(safe-area-inset-top)) 16px 28px; color: #fff; text-align: center; display: grid; gap: 10px; justify-items: center; }
.tela-entrada .marca img { width: 72px; height: 72px; border-radius: 18px; }
.tela-entrada .marca p { color: #a9c4c8; }
.tela-entrada .painel {
  background: var(--fundo); border-radius: 24px 24px 0 0; padding: 24px 16px 40px;
  min-height: 60vh;
}
.tela-entrada .painel > div { max-width: 440px; margin: 0 auto; display: grid; gap: 18px; }

/* ── complementos ────────────────────────────────────────────────────── */

a.selo, button.selo { text-decoration: none; cursor: pointer; font-family: inherit; }
.topo-texto { flex: 1; min-width: 0; }
.pilha { display: grid; gap: 16px; }
.indicadores.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.indicadores.tres .valor { font-size: 1.15rem; }
button.acao { font: inherit; font-weight: 700; cursor: pointer; }
.lista svg { width: 20px; height: 20px; flex: none; color: var(--texto-2); }
.lista .botao { width: auto; min-height: 44px; padding: 8px 12px; }
.tabela td[data-cor='vermelho'] { color: var(--vermelho); font-weight: 700; }
.tabela td[data-cor='amarelo'] { color: var(--amarelo); font-weight: 700; }
.tabela td[data-cor='verde'] { color: var(--verde); }
.entrada input.texto { font-size: 1.15rem; font-weight: 500; }
.dica strong { color: var(--texto); }
.cartao-cabeca strong { white-space: nowrap; }
.decisao .detalhe { font-size: 0.95rem; }

@media (min-width: 700px) {
  .acoes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .indicadores { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

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