/* App da equipe (/app): celular primeiro (360–430 px), funciona no computador. Tokens de /shared/tokens.css.
   Regras de "parecer instalado": áreas seguras (viewport-fit=cover + env()), campos com 16 px (sem zoom no iPhone),
   toque rápido (touch-action: manipulation, :active na hora), sem destaque cinza no toque, sem puxar para atualizar,
   texto de botão não selecionável, hover só com mouse. Movimento: só transform/opacity, curtas, com prefers-reduced-motion. */
:root {
  --toque: 48px;
  --barra: 64px;
  --topo: 56px;
  --largura: 560px;
}
html { overscroll-behavior: none; }
body { font-size: var(--t-md); min-height: 100dvh; }
input, select, textarea { font-size: 16px; }
button, a, [role="button"], label.chip { touch-action: manipulation; -webkit-touch-callout: none; }
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.carregando { padding: var(--e-8) var(--e-4); text-align: center; color: var(--texto-3); }

/* ---------- Topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--e-2);
  min-height: calc(var(--topo) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) var(--e-3) 0;
  padding-left: max(var(--e-3), env(safe-area-inset-left, 0px)); padding-right: max(var(--e-3), env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--superficie) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--linha);
}
.topo h1 { flex: 1; margin: 0; font-size: var(--t-lg); font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo .voltar { margin-left: calc(var(--e-2) * -1); }
.etiqueta {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 5px; background: var(--superficie-3); border: 1px solid var(--linha-forte);
  font: 600 var(--t-xs) / 1.4 var(--fonte-mono); color: var(--texto-2); letter-spacing: 0.04em;
}
.etiqueta.marca { background: var(--destaque-suave); border-color: var(--destaque-linha); color: var(--destaque); }
.tarja { background: var(--alerta-fundo); color: var(--alerta); font-size: var(--t-xs); text-align: center; padding: 3px var(--e-3); font-weight: 600; }

/* ---------- Conteúdo ---------- */
.conteudo {
  flex: 1; width: 100%; max-width: var(--largura); margin: 0 auto;
  padding: var(--e-4) max(var(--e-4), env(safe-area-inset-right, 0px)) calc(var(--barra) + var(--e-6) + env(safe-area-inset-bottom, 0px)) max(var(--e-4), env(safe-area-inset-left, 0px));
}
.conteudo.sem-barra { padding-bottom: calc(var(--e-8) + env(safe-area-inset-bottom, 0px)); }
.pilha { display: flex; flex-direction: column; gap: var(--e-3); }
.linha { display: flex; align-items: center; gap: var(--e-2); }
.linha.entre { justify-content: space-between; }
.linha.quebra { flex-wrap: wrap; }
.muted { color: var(--texto-3); }
.peq { font-size: var(--t-sm); }
.mono { font-family: var(--fonte-mono); }
.num { font-variant-numeric: tabular-nums; }
h2 { font-size: var(--t-md); margin: var(--e-2) 0 0; color: var(--texto-2); font-weight: 650; }
.saudacao { margin: 0; font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.02em; }

.cartao { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--r-3); padding: var(--e-4); box-shadow: var(--sombra-1); }
.cartao.plano { box-shadow: none; }

/* Atalhos da tela inicial: blocos grandes de toque. */
.tarefas { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-3); }
.tarefa {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--e-2); min-height: 112px; padding: var(--e-4);
  background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--r-3); box-shadow: var(--sombra-1);
  color: var(--texto); text-decoration: none; text-align: left; font: inherit; cursor: pointer;
  transition: transform var(--d-pressao) var(--ease-out);
  -webkit-user-select: none; user-select: none;
}
.tarefa:active { transform: scale(0.97); }
.tarefa .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--destaque-suave); color: var(--destaque); }
.tarefa b { font-size: var(--t-md); }
.tarefa small { color: var(--texto-3); font-size: var(--t-sm); }
.tarefa .conta { margin-left: auto; }
.tarefa.larga { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; }

/* Lista de itens tocáveis */
.lista { display: flex; flex-direction: column; background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--r-3); overflow: hidden; }
.item {
  display: flex; align-items: center; gap: var(--e-3); min-height: 64px; padding: var(--e-3) var(--e-4); border: 0; border-top: 1px solid var(--linha);
  background: none; color: inherit; font: inherit; text-align: left; width: 100%; text-decoration: none; cursor: pointer;
  -webkit-user-select: none; user-select: none; transition: background-color var(--d-pressao) ease;
}
.item:first-child { border-top: 0; }
.item:active { background: var(--superficie-3); }
.item .corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .corpo b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item .corpo small { color: var(--texto-3); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; }
.item .lado { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.item.feito .corpo b { color: var(--texto-3); }
div.item { cursor: default; }
.seta { color: var(--texto-3); flex-shrink: 0; }

/* Selos */
.selo { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-pilula); font-size: var(--t-xs); font-weight: 600; background: var(--superficie-3); color: var(--texto-2); white-space: nowrap; }
.selo.ok { background: var(--ok-fundo); color: var(--ok); }
.selo.alerta { background: var(--alerta-fundo); color: var(--alerta); }
.selo.perigo { background: var(--perigo-fundo); color: var(--perigo); }
.selo.info { background: var(--info-fundo); color: var(--info); }
.selo.marca { background: var(--destaque-suave); color: var(--destaque); }
.bolinha { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--preenchimento); color: var(--tinta); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2); min-height: var(--toque); padding: 0 var(--e-4);
  border-radius: var(--r-2); border: 1px solid var(--linha-forte); background: var(--superficie); color: var(--texto);
  font: 600 var(--t-md) / 1 var(--fonte); text-decoration: none; cursor: pointer; -webkit-user-select: none; user-select: none;
  transition: transform var(--d-pressao) var(--ease-out), background-color var(--d-pressao) ease;
}
.btn:active { transform: scale(0.97); }
.btn.primario { background: var(--preenchimento); border-color: transparent; color: var(--tinta); }
.btn.perigo { color: var(--perigo); border-color: color-mix(in srgb, var(--perigo) 40%, var(--linha)); }
.btn.fantasma { background: transparent; border-color: transparent; color: var(--destaque); }
.btn.peq { min-height: 40px; padding: 0 var(--e-3); font-size: var(--t-sm); }
.btn.todo { width: 100%; }
.btn.icone-so { width: var(--toque); padding: 0; }
.btn:disabled { opacity: 0.55; pointer-events: none; }
.btn.ocupado { pointer-events: none; opacity: 0.8; }
.btn svg, .tarefa svg, .item svg, .navbar svg { width: 22px; height: 22px; flex-shrink: 0; }
.acoes { display: flex; gap: var(--e-2); flex-wrap: wrap; }
.acoes .btn { flex: 1 1 140px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--superficie-3); }
  .btn.primario:hover { background: var(--preenchimento-forte); }
  .item:hover { background: var(--superficie-2); }
  .tarefa:hover { border-color: var(--linha-forte); }
}

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > span { font-size: var(--t-sm); font-weight: 600; color: var(--texto-2); }
.campo input, .campo select, .campo textarea, input.grande {
  min-height: var(--toque); padding: 10px 12px; border: 1px solid var(--linha-forte); border-radius: var(--r-2);
  background: var(--superficie); color: var(--texto); width: 100%;
}
.campo textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.campo input:focus, .campo select:focus, .campo textarea:focus, input.grande:focus { outline: none; border-color: var(--destaque); box-shadow: 0 0 0 3px color-mix(in srgb, var(--destaque) 22%, transparent); }
input.grande { font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 650; }
.busca { position: relative; }
.busca input { padding-left: 40px; }
.busca svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--texto-3); pointer-events: none; }
.contador { display: grid; grid-template-columns: var(--toque) 1fr var(--toque); gap: var(--e-2); align-items: center; }
.contador .btn { font-size: 24px; }

.chips { display: flex; gap: var(--e-2); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--e-4); border-radius: var(--r-pilula); border: 1px solid var(--linha-forte);
  background: var(--superficie); font-weight: 600; font-size: var(--t-sm); cursor: pointer; -webkit-user-select: none; user-select: none;
  transition: transform var(--d-pressao) var(--ease-out);
}
.chip:active { transform: scale(0.97); }
.chip:has(input:checked), .chip[aria-pressed="true"] { background: var(--destaque-suave); border-color: var(--destaque); color: var(--destaque); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

.segmento { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 3px; background: var(--superficie-3); border-radius: var(--r-2); }
.segmento button { min-height: 40px; border: 0; border-radius: calc(var(--r-2) - 3px); background: transparent; font: 600 var(--t-sm) var(--fonte); color: var(--texto-2); cursor: pointer; }
.segmento button[aria-selected="true"] { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra-1); }

/* Fotos */
.fotos { display: flex; gap: var(--e-2); flex-wrap: wrap; }
.fotos img, .fotos .nova {
  width: 84px; height: 84px; border-radius: var(--r-2); object-fit: cover; background: var(--superficie-3); border: 1px solid var(--linha);
}
.fotos .nova { display: grid; place-items: center; color: var(--destaque); border-style: dashed; border-color: var(--destaque-linha); cursor: pointer; padding: 0; transition: transform var(--d-pressao) var(--ease-out); }
.fotos .nova:active { transform: scale(0.95); }
.fotos .miniatura { position: relative; }
.fotos .miniatura button { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 14px; border: 0; background: var(--texto); color: var(--fundo); font-size: 16px; line-height: 1; cursor: pointer; }
.fotos img.zoom { cursor: zoom-in; }
.foto-grande { width: 100%; border-radius: var(--r-2); }

.erro-caixa { background: var(--perigo-fundo); color: var(--perigo); padding: var(--e-3); border-radius: var(--r-2); font-size: var(--t-sm); margin: 0; }
.dica { background: var(--info-fundo); color: var(--texto-2); padding: var(--e-3); border-radius: var(--r-2); font-size: var(--t-sm); margin: 0; }
.vazio { text-align: center; padding: var(--e-7) var(--e-4); color: var(--texto-3); }
.vazio svg { width: 40px; height: 40px; opacity: 0.6; }
.esqueleto { display: flex; flex-direction: column; gap: var(--e-3); }
.esqueleto span { height: 64px; border-radius: var(--r-3); background: var(--superficie-3); animation: piscar 1.2s ease-in-out infinite; }
@keyframes piscar { 50% { opacity: 0.55; } }

/* ---------- Barra inferior ---------- */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--barra) + env(safe-area-inset-bottom, 0px)); padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: color-mix(in srgb, var(--superficie) 94%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-top: 1px solid var(--linha);
}
.navbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--texto-3);
  font-size: 11px; font-weight: 600; text-decoration: none; -webkit-user-select: none; user-select: none;
}
.navbar a[aria-current="page"] { color: var(--destaque); }
.navbar a .bolinha { position: absolute; top: 6px; left: calc(50% + 6px); height: 18px; min-width: 18px; font-size: 11px; }
.navbar a.camera span.ic {
  width: 52px; height: 52px; margin-top: -18px; border-radius: 26px; display: grid; place-items: center; background: var(--preenchimento); color: var(--tinta);
  box-shadow: var(--sombra-2); transition: transform var(--d-pressao) var(--ease-out);
}
.navbar a.camera:active span.ic { transform: scale(0.94); }
.navbar a:active svg { transform: scale(0.92); }
.navbar svg { transition: transform var(--d-pressao) var(--ease-out); }

/* ---------- Folha que sobe de baixo (formulários curtos) ---------- */
.veu { position: fixed; inset: 0; z-index: 40; background: var(--veu); opacity: 0; transition: opacity var(--d-rapida) ease; }
.veu.aberto { opacity: 1; }
.folha {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px); display: flex; flex-direction: column;
  max-width: var(--largura); margin: 0 auto; background: var(--superficie); border-radius: var(--r-3) var(--r-3) 0 0; box-shadow: var(--sombra-3);
  transform: translateY(100%); transition: transform var(--d-gaveta) var(--ease-gaveta);
}
.folha.aberta { transform: translateY(0); }
.folha.saindo { transition-duration: var(--d-saida); }
.folha .alca { width: 40px; height: 5px; border-radius: 3px; background: var(--linha-forte); margin: 8px auto 0; flex-shrink: 0; }
.folha header { display: flex; align-items: center; gap: var(--e-2); padding: var(--e-2) var(--e-4) 0; }
.folha header h2 { flex: 1; margin: 0; font-size: var(--t-lg); color: var(--texto); }
.folha .corpo-folha { overflow-y: auto; overscroll-behavior: contain; padding: var(--e-3) var(--e-4) calc(var(--e-4) + env(safe-area-inset-bottom, 0px)); }
.folha video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-2); background: #000; }

/* ---------- Avisos (toast) ---------- */
.avisos {
  position: fixed; left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: var(--e-2); pointer-events: none;
  bottom: calc(var(--barra) + var(--e-3) + env(safe-area-inset-bottom, 0px)); padding: 0 var(--e-4);
}
.aviso {
  max-width: 440px; width: 100%; padding: var(--e-3) var(--e-4); border-radius: var(--r-2); background: var(--texto); color: var(--fundo);
  font-weight: 550; box-shadow: var(--sombra-2); opacity: 0; transform: translateY(12px);
  transition: opacity var(--d-media) var(--ease-out), transform var(--d-media) var(--ease-out);
}
.aviso.visivel { opacity: 1; transform: translateY(0); }
.aviso.ok { background: var(--ok); color: #fff; }
.aviso.perigo { background: var(--perigo); color: #fff; }
.aviso.alerta { background: var(--alerta-fundo); color: var(--alerta); border: 1px solid var(--alerta); }

/* Troca de tela: só opacidade, curta (é ação de muitas vezes por dia). */
.conteudo.entrando { animation: aparecer var(--d-rapida) var(--ease-out); }
@keyframes aparecer { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .folha { transition: opacity var(--d-rapida) ease; transform: none; opacity: 0; }
  .folha.aberta { opacity: 1; }
  .aviso { transform: none; }
  .btn:active, .tarefa:active, .chip:active { transform: none; }
  .esqueleto span { animation: none; }
}

/* ---------- Login (public/shared/login.js) ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: max(var(--e-4), env(safe-area-inset-top, 0px)) var(--e-4) max(var(--e-4), env(safe-area-inset-bottom, 0px)); }
.login .cartao { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--e-4); padding: var(--e-6) var(--e-5); }
.login h1 { margin: 0; font-size: var(--t-xl); }
.login p { margin: 0; }
.login .campo span { font-size: var(--t-sm); font-weight: 600; color: var(--texto-2); }
.login .btn { width: 100%; }
.login .login-erro { background: var(--perigo-fundo); color: var(--perigo); padding: var(--e-3); border-radius: var(--r-2); font-size: var(--t-sm); }
.login .demo { font-size: var(--t-sm); color: var(--texto-3); border-top: 1px solid var(--linha); padding-top: var(--e-3); }
.login .demo code { font-size: var(--t-xs); }
.login-logo { width: 56px; height: 56px; border-radius: 16px; }

@media (min-width: 720px) {
  .tarefas { grid-template-columns: repeat(3, 1fr); }
}
