*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --nx-accent: #7C3AED;
  --nx-accent-escuro: #6D28D9;
  --nx-accent-lt: #EDE9FE;
  --green: #22C55E;
  --green-lt: #F0FDF4;
  --green-escuro: #15803D;
  --red: #EF4444;
  --red-lt: #FEF2F2;
  --yellow-lt: #FFFBEB;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --fundo: #F6F6F6;
  --raio: 14px;
  --toque: 48px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--fundo);
  color: var(--gray-900);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }

.tela { display: none; min-height: 100vh; min-height: 100dvh; }
.tela.ativa { display: flex; flex-direction: column; }
.tela-centro.ativa { align-items: center; justify-content: center; padding: 24px 16px; }

.card {
  position: relative;
  z-index: 0;
  border-radius: var(--raio);
  background: #F6F6F6;
  box-shadow: 0 0 0 1px var(--gray-200);
  padding: calc(24px + 3px);
}
.card::after {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: -1;
  background: #fff;
  border-radius: 15px;
  box-shadow: inset 0 0 0 1px var(--gray-200);
}

.cartao-estreito { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; }

.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--gray-900); }
.marca-logo {
  width: 34px; height: 34px; padding: 6px; border-radius: 10px;
  background: var(--gray-100); object-fit: contain;
}

.titulo { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.subtitulo { font-size: 16px; font-weight: 700; }
.texto-apoio { font-size: 14px; color: var(--gray-500); line-height: 1.5; }
.rotulo { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.mensagem-erro { min-height: 20px; font-size: 14px; font-weight: 500; color: var(--red); }
.vazio { padding: 40px 16px; text-align: center; font-size: 15px; color: var(--gray-500); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; transition: background .15s, box-shadow .15s, border-color .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--nx-accent); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--nx-accent-escuro); box-shadow: 0 4px 12px rgba(124,58,237,.35); }
.btn-secundario { background: #fff; color: var(--gray-700); border-color: var(--gray-200); }
.btn-secundario:hover { background: var(--gray-50); }
.btn-largo { width: 100%; min-height: var(--toque); font-size: 15px; }

.input-codigo {
  width: 100%; min-height: 60px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--gray-200); background: var(--gray-50);
  font-size: 26px; font-weight: 700; letter-spacing: .18em; text-align: center; text-transform: uppercase;
}
.input-codigo:focus { outline: none; border-color: var(--nx-accent); box-shadow: 0 0 0 3px var(--nx-accent-lt); background: #fff; }

.carregando { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--gray-500); font-size: 15px; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--gray-200); border-top-color: var(--nx-accent);
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.barra {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 20;
}
.barra-centro { flex: 1; min-width: 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--gray-500); }
.barra-data::first-letter { text-transform: uppercase; }
.barra-tablet { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-relogio { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.barra-operador { display: flex; align-items: center; gap: 10px; }
.barra-operador-texto { display: flex; flex-direction: column; min-width: 0; }
.barra-operador-nome { font-size: 14px; font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-operador-sessao { font-size: 12px; color: var(--gray-400); }

.conteudo { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }

.cabecalho-secao { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.busca {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; color: var(--gray-400);
  min-width: 240px;
}
.busca input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-size: 15px; color: var(--gray-900); }
.busca:focus-within { border-color: var(--nx-accent); box-shadow: 0 0 0 3px var(--nx-accent-lt); }

.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--nx-accent-lt); color: var(--nx-accent); font-weight: 700; font-size: 13px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-medio { width: 48px; height: 48px; border-radius: 12px; font-size: 16px; }
.avatar-grande { width: 88px; height: 88px; border-radius: 22px; font-size: 30px; }

.grade-operadores { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.operador {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  min-height: 150px; padding: 20px 12px; border-radius: var(--raio);
  background: #fff; border: 1px solid var(--gray-200);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.operador:hover { border-color: var(--nx-accent); box-shadow: 0 6px 18px rgba(124,58,237,.12); }
.operador:active { transform: scale(.98); }
.operador .avatar-medio { width: 64px; height: 64px; border-radius: 16px; font-size: 20px; }
.operador-nome { font-size: 15px; font-weight: 600; line-height: 1.3; }
.operador-recente { font-size: 11px; font-weight: 600; color: var(--nx-accent); background: var(--nx-accent-lt); padding: 2px 8px; border-radius: 999px; }

.cartao-pin { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.cartao-pin.tremer { animation: tremer .4s; }
@keyframes tremer {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.btn-voltar {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
  min-height: 40px; padding: 0 10px 0 4px; border: none; background: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--gray-500);
}
.btn-voltar:hover { background: var(--gray-100); color: var(--gray-900); }
.pin-operador { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.pin-pontos { display: flex; gap: 14px; }
.pin-pontos span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gray-300); transition: background .1s, border-color .1s; }
.pin-pontos span.preenchido { background: var(--nx-accent); border-color: var(--nx-accent); }

.teclado { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.teclado button {
  min-height: 68px; border-radius: 14px; border: 1px solid var(--gray-200); background: #fff;
  font-size: 26px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  transition: background .1s, transform .05s;
  user-select: none; -webkit-user-select: none;
}
.teclado button:active { background: var(--nx-accent-lt); transform: scale(.97); }
.teclado .tecla-secundaria { font-size: 15px; color: var(--gray-500); background: var(--gray-50); }
.teclado.desativado { opacity: .5; pointer-events: none; }

.conteudo-marcacoes { gap: 14px; }

.chips-rolagem { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips-rolagem::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--gray-200); background: #fff; font-size: 14px; font-weight: 600; color: var(--gray-700);
  white-space: nowrap;
}
.chip.ativo { background: var(--nx-accent); border-color: var(--nx-accent); color: #fff; }

.abas {
  display: flex; gap: 4px; padding: 4px; overflow-x: auto;
  background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; scrollbar-width: none;
}
.abas::-webkit-scrollbar { display: none; }
.abas button {
  flex: 1 0 auto; min-height: 44px; padding: 0 16px; border: none; border-radius: 9px;
  background: none; font-size: 14px; font-weight: 600; color: var(--gray-500); white-space: nowrap;
}
.abas button.ativa { background: var(--nx-accent-lt); color: var(--nx-accent); }

.cartao-lista { padding: calc(8px + 3px); }
.lista-cabecalho {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px 14px; border-bottom: 1px solid var(--gray-100);
}
.lista-filtros { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.aluno {
  display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; align-items: center;
  padding: 14px; border-bottom: 1px solid var(--gray-100);
}
.aluno:last-child { border-bottom: none; }
.aluno-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.aluno-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.aluno-nome { font-size: 15px; font-weight: 600; line-height: 1.3; }
.aluno-sub { font-size: 12px; color: var(--gray-400); }
.aluno-check { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--gray-200); }
.aluno-feito .aluno-check {
  border-color: var(--green); background: var(--green)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")
    center / 13px no-repeat;
}
.aluno-controles { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-width: 0; }

.opcoes { display: flex; flex-wrap: wrap; gap: 8px; }
.opcao {
  min-height: var(--toque); padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--gray-200); background: #fff; font-size: 14px; font-weight: 600; color: var(--gray-700);
  transition: background .1s, border-color .1s;
}
.opcao:active { transform: scale(.98); }
.opcao.ativa { background: var(--nx-accent); border-color: var(--nx-accent); color: #fff; }
.opcao-adicionar { color: var(--nx-accent); border-color: #DDD6FE; background: #FAF8FF; }

.reg { flex-basis: 100%; font-size: 12px; color: var(--gray-400); }

.periodo { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--gray-50); border: 1px solid var(--gray-100); }
.periodo-rotulo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-400); }
.periodo-campos { display: flex; flex-wrap: wrap; gap: 12px; }
.hora-campo { display: flex; flex-direction: column; gap: 4px; }
.hora-rotulo { font-size: 12px; font-weight: 600; color: var(--gray-500); }
.hora-linha { display: flex; align-items: center; gap: 6px; }
.input-hora {
  min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--gray-200); background: #fff;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.input-hora:focus { outline: none; border-color: var(--nx-accent); box-shadow: 0 0 0 3px var(--nx-accent-lt); }
.input-hora:disabled { background: var(--gray-100); color: var(--gray-500); }
.btn-agora { min-height: 44px; padding: 0 14px; background: var(--nx-accent-lt); color: var(--nx-accent); }
.btn-agora:hover { background: #DDD6FE; }
.periodo .reg { flex-basis: auto; }
.hora-extra { font-size: 13px; color: var(--gray-500); padding: 6px 12px; border-radius: 999px; background: var(--gray-100); }
.hora-extra-ativa { background: var(--yellow-lt); color: #92400E; }

.registros-log { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.registro-log {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px 0 12px;
  border-radius: 999px; background: var(--gray-100); font-size: 13px; font-weight: 500;
}
.registro-log em { font-style: normal; color: var(--gray-400); font-size: 12px; }
.registro-log-x {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: none;
  font-size: 18px; line-height: 1; color: var(--gray-400);
}
.registro-log-x:hover { background: var(--red-lt); color: var(--red); }

.aviso-bloqueio {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 18px;
  background: var(--gray-900); color: #fff; border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.25);
  font-size: 14px; font-weight: 600; visibility: hidden; opacity: 0;
  transition: transform .25s ease, opacity .25s ease, visibility .25s;
}
.aviso-bloqueio.visivel { transform: translate(-50%, 0); visibility: visible; opacity: 1; }

.toast {
  position: fixed; left: 50%; top: 20px; transform: translate(-50%, -160%); z-index: 70;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--gray-900); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 12px 32px rgba(0,0,0,.2); visibility: hidden; opacity: 0;
  transition: transform .25s ease, opacity .25s ease, visibility .25s;
}
.toast.visivel { transform: translate(-50%, 0); visibility: visible; opacity: 1; }
.toast-erro { background: #B91C1C; }

.noscript { padding: 24px; text-align: center; }

@media (max-width: 900px) {
  .aluno { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 640px) {
  .barra { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
  .barra-centro { order: 3; flex-basis: 100%; text-align: left; }
  .barra-operador { margin-left: auto; }
  .barra-operador .btn span { display: none; }
  .barra-operador-nome { max-width: 140px; }
  .conteudo { padding: 16px; }
  .busca { min-width: 0; flex: 1; }
  .grade-operadores { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .operador { min-height: 130px; }
  .card { padding: calc(18px + 3px); }
  .cartao-lista { padding: calc(4px + 3px); }
  .marca span { display: none; }
}
