/* Sistema de Ponto — mobile-first */
:root {
  --azul: #2563eb;
  --azul-escuro: #1d4ed8;
  --fundo: #eef2f7;
  --texto: #0f172a;
  --mudo: #64748b;
  --borda: #d8dee9;
  --ok: #16a34a;
  --aviso: #d97706;
  --erro: #dc2626;
  --card: #ffffff;
  --raio: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  line-height: 1.45;
}

h1 { font-size: 1.35rem; margin: 0 0 .35rem; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: .95rem; margin: 1rem 0 .3rem; }
h2.inline { display: inline; }
p { margin: .4rem 0; }
a { color: var(--azul); text-decoration: none; }
.mudo { color: var(--mudo); }
.pequeno { font-size: .82rem; }
.dir { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: .8rem; }

/* topo */
.topo {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--borda);
}
.topo-in {
  max-width: 1080px; margin: 0 auto; padding: .65rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.marca { font-weight: 700; color: var(--texto); font-size: 1rem; }
.nav { display: flex; gap: 1rem; align-items: center; }
.nav a { font-weight: 600; font-size: .92rem; }
.nav .sair { color: var(--mudo); }

/* layout */
.container { max-width: 1080px; margin: 0 auto; padding: 1rem; }
.container.estreito { max-width: 560px; }
.container.largo { max-width: 1080px; }

.card {
  background: var(--card);
  border-radius: var(--raio);
  padding: 1rem;
  margin-bottom: .9rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .4rem; }

.banner {
  background: #dcfce7; color: #14532d;
  border-radius: 10px; padding: .7rem .9rem; margin-bottom: .9rem;
  font-size: .92rem;
}
.banner.erro { background: #fee2e2; color: #7f1d1d; }

/* formulários */
label { display: block; margin: .55rem 0; font-size: .9rem; font-weight: 600; }
input, select {
  width: 100%; margin-top: .25rem;
  padding: .7rem .8rem;
  border: 1px solid var(--borda); border-radius: 10px;
  font-size: 1rem; /* 16px: evita zoom do iOS */
  background: #fff; color: var(--texto);
}
input:focus, select:focus { outline: 2px solid var(--azul); border-color: transparent; }
input[disabled] { background: #f1f5f9; color: var(--mudo); }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.check input { width: auto; margin: 0; min-height: 22px; min-width: 22px; }
.duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.btn {
  display: inline-block;
  background: var(--azul); color: #fff;
  border: 0; border-radius: 10px;
  padding: .75rem 1.1rem;
  font-size: .95rem; font-weight: 700;
  cursor: pointer; text-align: center;
  min-height: 44px;
}
.btn:active { background: var(--azul-escuro); }
.btn.sec { background: #e2e8f0; color: var(--texto); }
.btn.ok { background: var(--ok); }
.btn.perigo { background: var(--erro); }
.btn.mini { padding: .4rem .7rem; min-height: 0; font-size: .82rem; }
.btn-bloco { display: block; width: 100%; margin-top: .6rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.acoes-linha { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* login */
.login-logo { text-align: center; font-size: 3rem; margin-top: 1.5rem; }
.login-titulo { text-align: center; margin: .2rem 0 0; }
.login-sub { text-align: center; color: var(--mudo); margin: 0 0 1rem; }

/* chips de batida */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0; min-height: 2.2rem; }
.chip {
  padding: .45rem .8rem; border-radius: 999px;
  font-weight: 700; font-size: .92rem;
  background: #e2e8f0;
}
.chip.entrada { background: #dcfce7; color: #14532d; }
.chip.saida { background: #ffedd5; color: #7c2d12; }
.linha-total { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; flex-wrap: wrap; }

/* tabelas */
.tabela-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--mudo); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: .55rem .5rem; border-bottom: 1px solid #eef1f6; vertical-align: top; }
tfoot td { border-bottom: 0; }
tr.anulada td { opacity: .45; text-decoration: line-through; }
tr.anulada td .tag { text-decoration: none; }

.tag {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; background: #e2e8f0; color: var(--texto);
  margin-left: .3rem; text-decoration: none;
}
.tag.ok { background: #dcfce7; color: #14532d; }
.tag.aviso { background: #fef3c7; color: #78350f; }
.tag.erro { background: #fee2e2; color: #7f1d1d; }
.tag.dp { background: #dbeafe; color: #1e3a8a; }

/* subnav admin */
.subnav {
  display: flex; gap: .3rem; margin-bottom: 1rem;
  overflow-x: auto; padding-bottom: .2rem;
}
.subnav a {
  padding: .5rem .9rem; border-radius: 999px;
  font-weight: 600; font-size: .9rem; color: var(--texto);
  background: #e2e8f0; white-space: nowrap;
}
.subnav a.ativo { background: var(--azul); color: #fff; }

/* stats do painel */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: .8rem 0; }
.stat { background: var(--card); border-radius: var(--raio); padding: .8rem; text-align: center; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--azul); }
.stat-rot { font-size: .78rem; color: var(--mudo); }
.grade-2 { display: grid; grid-template-columns: 1fr; gap: 0; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: .45rem 0; border-bottom: 1px solid #eef1f6; font-size: .92rem; }

/* lista de funcionários */
.lista-funcs .func { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.func.inativo { opacity: .6; }
.func-foto {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  background: #e2e8f0; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; flex-shrink: 0;
}
.func-foto img { width: 100%; height: 100%; object-fit: cover; }
.func-info { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 180px; }
.func-info .tags { margin-top: .15rem; }
.func-info .tag { margin-left: 0; margin-right: .3rem; }
.func-acoes { display: flex; gap: .4rem; flex-wrap: wrap; }

/* filtros */
.filtros { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.filtros label { flex: 1 1 150px; margin: 0; }
.filtros .crescer { flex: 2 1 220px; }
.filtros .btn { flex: 0 0 auto; }
.form-mes input { margin-top: 0; }
details.anular summary { list-style: none; }
form.inline { display: inline-block; margin-left: .3rem; }
.form-anular { display: flex; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }
.form-anular input { width: auto; flex: 1; min-width: 140px; margin: 0; }

/* config */
.caixa-copia {
  display: flex; gap: .5rem; align-items: center;
  background: #f1f5f9; border-radius: 10px; padding: .6rem .8rem;
  overflow-x: auto;
}
.caixa-copia code { font-size: .85rem; word-break: break-all; }
.lista-simples { margin: .4rem 0; padding-left: 1.2rem; }
.lista-simples li { margin: .3rem 0; }
.lista-links { display: flex; flex-direction: column; gap: .4rem; }

/* área vínculo telegram */
.area-vinculo {
  margin-top: .8rem; padding: .8rem; border-radius: 10px;
  background: #f1f5f9; text-align: center;
}
.area-vinculo .codigo {
  font-size: 1.8rem; font-weight: 800; letter-spacing: .3rem;
  font-family: ui-monospace, Consolas, monospace;
}

/* captura de rosto */
.dica-captura { text-align: center; font-weight: 700; min-height: 1.4rem; }
.thumbs { display: flex; gap: .4rem; justify-content: center; min-height: 52px; flex-wrap: wrap; }
.thumbs img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; border: 2px solid var(--ok); }

/* ================= KIOSK ================= */
body.kiosk {
  background: #0b1220; color: #e2e8f0;
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .6rem;
  padding: 1rem; text-align: center;
}
.k-topo { margin-bottom: .3rem; }
.k-relogio { font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.k-data { color: #94a3b8; font-size: clamp(1rem, 3vw, 1.3rem); text-transform: capitalize; }
.k-video-wrap {
  position: relative;
  /* dimensões com fallback universal: aspect-ratio/min()/inset não existem em
     navegador de tablet antigo (Chrome/WebView < 88) e a caixa colapsava pra
     altura 0 — o vídeo "sumia", sobrando só relógio e status */
  width: 92vw; max-width: 540px;
  height: 69vw; max-height: 405px; /* 4:3 do width */
  border-radius: 24px; overflow: hidden;
  background: #000;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
}
.k-video-wrap.pequeno { width: 88vw; max-width: 380px; height: 66vw; max-height: 285px;
  border-radius: 16px; box-shadow: none; margin: 0 auto; }
@supports (aspect-ratio: 4 / 3) {
  .k-video-wrap, .k-video-wrap.pequeno { height: auto; max-height: none; aspect-ratio: 4 / 3; }
}
.k-video-wrap video, .k-video-wrap canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* espelho: mais natural pra quem se olha */
}
.k-status { font-size: clamp(1.05rem, 3.5vw, 1.4rem); font-weight: 600; min-height: 1.6em; }
.k-status.erro { color: #fca5a5; }
.k-marca { color: #475569; font-size: .8rem; }

.k-resultado {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.k-resultado.ok { background: linear-gradient(160deg, #14532d, #16a34a); }
.k-resultado.aviso { background: linear-gradient(160deg, #78350f, #d97706); }
.k-resultado.erro { background: linear-gradient(160deg, #7f1d1d, #dc2626); }
.k-res-box { text-align: center; color: #fff; }
.k-res-icone { font-size: clamp(4rem, 16vw, 7rem); }
.k-res-titulo { font-size: clamp(1.8rem, 7vw, 3rem); font-weight: 800; margin: .3rem 0; }
.k-res-detalhe { font-size: clamp(1.1rem, 4vw, 1.6rem); opacity: .95; }

/* cadastro pelo tablet */
.k-btn-cadastro {
  position: fixed; right: .8rem; bottom: .8rem; z-index: 40;
  background: rgba(148, 163, 184, .12); color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, .25); border-radius: 10px;
  padding: .5rem .8rem; font-size: .85rem; cursor: pointer;
}
.k-btn-full {
  position: fixed; left: .8rem; bottom: .8rem; z-index: 40;
  background: rgba(148, 163, 184, .12); color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, .25); border-radius: 10px;
  padding: .5rem .8rem; font-size: .85rem; cursor: pointer;
}
.k-cad-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(2, 6, 23, .85);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.k-cad-box {
  background: #fff; color: var(--texto);
  border-radius: 16px; padding: 1rem 1.1rem;
  width: min(94vw, 440px); max-height: 92vh; overflow-y: auto;
  text-align: left;
}
.k-cad-cabeca { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.k-cad-x { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--mudo); padding: .2rem .5rem; }
.k-cad-dica { font-size: .88rem; color: var(--mudo); margin: .2rem 0 .5rem; }
.k-cad-video {
  /* padding-bottom no lugar de aspect-ratio: funciona em qualquer navegador */
  position: relative; width: 100%; height: 0; padding-bottom: 75%;
  border-radius: 12px; overflow: hidden; background: #000;
}
.k-cad-video video { position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.k-cad-dica-captura { text-align: center; font-weight: 700; min-height: 1.4rem; margin: .5rem 0 .3rem; }
.k-cad-senha-temp { font-family: ui-monospace, Consolas, monospace; font-size: 1.7rem;
  font-weight: 800; text-align: center; letter-spacing: .18em;
  background: #f1f5f9; border: 1px dashed #94a3b8; border-radius: 10px;
  padding: .55rem .4rem; margin: .2rem 0 .5rem; user-select: all; }
.k-cad-thumbs { display: flex; gap: .4rem; justify-content: center; min-height: 44px; flex-wrap: wrap; margin-bottom: .3rem; }
.k-cad-thumbs img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 2px solid var(--ok); }

/* ================= ESPELHO / IMPRESSÃO ================= */
.espelho-acoes { display: flex; gap: .8rem; align-items: center; margin-bottom: .8rem; flex-wrap: wrap; }
.espelho-cab { margin-bottom: .8rem; }
.tabela-espelho td, .tabela-espelho th { padding: .35rem .5rem; font-size: .85rem; }
.tabela-espelho tr.fds td { background: #f8fafc; color: var(--mudo); }
.tabela-espelho tr.feriado td { background: #fef9c3; }
.aceite-ok { color: #14532d; font-weight: 600; }
.assinaturas { display: flex; gap: 2rem; margin-top: 3rem; text-align: center; font-size: .85rem; }
.assinaturas > div { flex: 1; }
.linha-assinatura { border-bottom: 1px solid var(--texto); margin-bottom: .4rem; height: 2.2rem; }

@media print {
  .topo, .nao-imprimir, .banner { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; padding: 0; }
  .tabela-espelho td, .tabela-espelho th { border: 1px solid #cbd5e1; }
  a { color: inherit; }
}

/* ================= telas maiores ================= */
@media (min-width: 760px) {
  h1 { font-size: 1.6rem; }
  .grade-2 { grid-template-columns: 1.2fr 1fr; gap: .9rem; }
  .btn-bloco { width: auto; display: inline-block; }
  .lista-links { flex-direction: row; flex-wrap: wrap; gap: .6rem 1.4rem; }
}
