/* Faturas — ecrã escuro, botões grandes, pensado para uma mão e luz de loja */
:root {
  --fundo: #111111;
  --painel: #1c1c1e;
  --linha: #2c2c2e;
  --texto: #f2f2f2;
  --texto-2: #a1a1a6;
  --atividade: #0d7a64;
  --atividade-forte: #12a585;
  --pessoal: #4f4fc9;
  --pessoal-forte: #6c6cf0;
  --aviso: #f5a524;
  --erro: #e5484d;
  --ok: #30a46c;
  --raio: 16px;
  --topo: env(safe-area-inset-top, 0px);
  --baixo: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--fundo); color: var(--texto);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; }

.ecra { position: fixed; inset: 0; display: flex; flex-direction: column; }
.ecra-centro { align-items: center; justify-content: center; gap: 16px; padding: calc(24px + var(--topo)) 24px calc(24px + var(--baixo)); text-align: center; }
.logo { width: 88px; height: 88px; border-radius: 20px; }
h1 { margin: 0; font-size: 28px; }
h2 { margin: 0; font-size: 20px; }
.sub { margin: 0 0 12px; color: var(--texto-2); }
.msg { min-height: 1.4em; color: var(--texto-2); margin: 4px 0; }
.msg.erro { color: var(--erro); }

.btn-google { display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px; border-radius: 999px; border: 0;
  background: #fff; color: #1f1f1f; font-weight: 600; font-size: 17px; }
.btn-google svg { width: 22px; height: 22px; }

/* ---------- Câmara ---------- */
#ecra-camara { background: #000; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.moldura { position: absolute; left: 8%; right: 8%; top: calc(14% + var(--topo)); bottom: calc(22% + var(--baixo));
  border: 2px solid rgba(255,255,255,.55); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); pointer-events: none; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.flash.ativo { opacity: .85; transition: none; }
.barra-topo { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--topo)) 12px 10px; }
.btn-icone { position: relative; margin-left: auto; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn-icone svg { width: 24px; height: 24px; }
.btn-icone.escuro { background: var(--painel); font-size: 18px; margin-left: 0; }
.badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--aviso); color: #111; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.fila, .substituir { padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.55); font-size: 14px; }
.substituir { background: var(--aviso); color: #111; font-weight: 600; }
.substituir button { border: 0; background: none; font-weight: 700; padding: 0 0 0 6px; }
.barra-baixo { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 12px 16px calc(22px + var(--baixo)); }
.dica { margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(0,0,0,.5); font-size: 15px; }
.dica-ios { margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(0,0,0,.7); font-size: 13px; color: var(--texto-2); text-align: center; }
.dica-ios button { border: 0; background: none; padding: 0 0 0 6px; }
.disparo { width: 74px; height: 74px; border-radius: 50%; border: 5px solid rgba(255,255,255,.9); background: rgba(255,255,255,.25);
  opacity: 0; pointer-events: none; transform: scale(.8); transition: opacity .3s, transform .3s; }
.disparo.visivel { opacity: 1; pointer-events: auto; transform: none; }
.disparo:active { background: rgba(255,255,255,.7); }
.camara-erro { position: absolute; z-index: 2; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; text-align: center; background: var(--fundo); }

/* ---------- Decisão ---------- */
.ecra-decisao { padding: calc(14px + var(--topo)) 14px calc(14px + var(--baixo)); gap: 14px; background: var(--fundo); }
.topo-decisao { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.mini { width: 64px; height: 84px; object-fit: cover; border-radius: 8px; background: #333; flex: none; }
.ecra-centro .mini { width: 140px; height: 190px; }
.info { margin: 0; flex: 1; font-size: 15px; color: var(--texto-2); overflow-wrap: anywhere; }
.info b { color: var(--texto); font-weight: 600; }
.escolha { flex: 1; display: grid; grid-template-rows: 1fr 1fr; gap: 14px; }
.btn-grande { position: relative; border: 0; border-radius: var(--raio); font-size: 28px; font-weight: 700; color: #fff;
  min-height: 64px; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.btn-grande:active { filter: brightness(1.15); transform: scale(.99); }
.atividade { background: var(--atividade); }
.pessoal { background: var(--pessoal); }
.btn-grande .sugerido { display: none; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.22); }
.btn-grande.destaque { box-shadow: 0 0 0 4px #fff inset; }
.btn-grande.destaque .sugerido { display: inline-block; }
.btn-claro { background: #f2f2f2; color: #111; font-size: 19px; width: 100%; max-width: 420px; }
.btn-link { border: 0; background: none; color: var(--texto-2); padding: 8px; text-decoration: underline; text-underline-offset: 3px; }
.btn-sec { display: inline-flex; align-items: center; justify-content: center; padding: 12px 18px; border-radius: 12px;
  border: 1px solid var(--linha); background: var(--painel); color: var(--texto); text-decoration: none; cursor: pointer; }
.aviso-grande { font-size: 19px; margin: 6px 0 10px; max-width: 360px; }

.grelha-casas { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 12px; }
.grelha-casas .btn-grande { font-size: 21px; background: var(--atividade); }
.grelha-casas .btn-grande.geral { grid-column: 1 / -1; background: #3a3a3c; }

.confirmacao { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; background: rgba(17,17,17,.94); font-size: 18px; text-align: center; padding: 24px; }
.visto { width: 96px; height: 96px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; font-size: 56px; color: #fff; }

/* ---------- Avisos ---------- */
.avisos { position: fixed; z-index: 30; left: 12px; right: 12px; top: calc(66px + var(--topo)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.aviso { pointer-events: auto; padding: 10px 14px; border-radius: 12px; background: rgba(28,28,30,.96); border-left: 4px solid var(--texto-2);
  font-size: 15px; box-shadow: 0 4px 18px rgba(0,0,0,.4); }
.aviso.ok { border-color: var(--ok); }
.aviso.aviso-amarelo { border-color: var(--aviso); }
.aviso.erro { border-color: var(--erro); }

/* ---------- Rever ---------- */
.ecra-lista { background: var(--fundo); }
.cab-lista { display: flex; align-items: center; gap: 10px; padding: calc(12px + var(--topo)) 14px 12px; border-bottom: 1px solid var(--linha); }
.cab-lista h2 { flex: 1; }
.lista, .detalhe { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 14px calc(20px + var(--baixo)); }
.seccao h3 { margin: 18px 0 8px; font-size: 14px; letter-spacing: .05em; text-transform: uppercase; color: var(--texto-2); }
.vazio { color: var(--texto-2); margin: 6px 0; font-size: 15px; }
.cartao { background: var(--painel); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.cartao .linha1 { display: flex; gap: 8px; align-items: baseline; }
.cartao .forn { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.cartao .total { font-variant-numeric: tabular-nums; font-weight: 600; }
.cartao .linha2 { color: var(--texto-2); font-size: 14px; margin-top: 2px; }
.cartao .nota { color: var(--texto-2); font-size: 13px; margin-top: 4px; }
.cartao .acoes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cartao .acoes button { flex: 1; min-width: 110px; padding: 12px 8px; border-radius: 10px; border: 0; font-weight: 700; color: #fff; }
.cartao .acoes .a { background: var(--atividade); }
.cartao .acoes .p { background: var(--pessoal); }
.cartao .acoes .c { background: var(--atividade); flex: 1 1 40%; font-weight: 600; }
.cartao .acoes .c.sug, .cartao .acoes .a.sug, .cartao .acoes .p.sug { box-shadow: 0 0 0 3px #fff inset; }
.cartao .acoes .g { background: #3a3a3c; flex: 1 1 100%; font-weight: 600; }
.etiqueta { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #3a3a3c; margin-right: 4px; }
.etiqueta.atv { background: var(--atividade); }
.etiqueta.pes { background: var(--pessoal); }
.etiqueta.amarela { background: var(--aviso); color: #111; }
.rodape-lista { margin: 0; padding: 10px 14px calc(12px + var(--baixo)); color: var(--texto-2); font-size: 13px; border-top: 1px solid var(--linha); }

/* ---------- Detalhe ---------- */
.detalhe { display: flex; flex-direction: column; gap: 12px; }
.det-origem { margin: 4px 0 0; color: var(--texto-2); font-size: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo.check { flex-direction: row; align-items: center; gap: 10px; }
.campo.check input { width: 22px; height: 22px; }
.rotulo { font-size: 13px; color: var(--texto-2); }
.campo input, .campo textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--linha); background: var(--painel); color: var(--texto); }
.campo input[type=date] { min-height: 46px; }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button, .chips button { padding: 12px 8px; border-radius: 10px; border: 1px solid var(--linha); background: var(--painel); font-weight: 600; }
.seg button.on[data-v=Atividade] { background: var(--atividade); border-color: var(--atividade); }
.seg button.on[data-v=Pessoal] { background: var(--pessoal); border-color: var(--pessoal); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { flex: 1 1 40%; }
.chips button.on { background: var(--atividade); border-color: var(--atividade); }

/* ---------- Resumo ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.kpi { background: var(--painel); border-radius: 14px; padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--texto-2); font-size: 13px; margin-top: 2px; }
.kpi.atv { border-left: 4px solid var(--atividade-forte); }
.kpi.pes { border-left: 4px solid var(--pessoal-forte); }
.tabela { width: 100%; border-collapse: collapse; background: var(--painel); border-radius: 14px; overflow: hidden; font-size: 15px; }
.tabela th, .tabela td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--linha); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela th { color: var(--texto-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tabela th:first-child, .tabela td:first-child { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela td.atv { color: var(--atividade-forte); }
.tabela td.pes { color: var(--pessoal-forte); }
.tabela td.fraco { color: var(--texto-2); }
