/* Horus — estilo mobile-first, alto contraste, alvos de toque grandes (spec §5) */
:root {
  --bg: #0f172a; --bg-card: #1e293b; --bg-elevado: #334155;
  --texto: #f8fafc; --texto-sub: #94a3b8;
  --primario: #22c55e; --primario-escuro: #16a34a;
  --alerta: #ef4444; --aviso: #f59e0b; --azul: #3b82f6;
  --borda: #334155;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; -webkit-user-select: none; user-select: none;
}
.hidden { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; }

/* Botões grandes — regra de ouro: nada obrigatório digitado se puder ser toque */
.btn { min-height: 48px; padding: 12px 20px; border-radius: var(--radius); border: none; font-size: 16px; font-weight: 600; }
.btn-grande { min-height: 64px; font-size: 20px; width: 100%; }
.btn-primario { background: var(--primario); color: #fff; }
.btn-primario:active { background: var(--primario-escuro); }
.btn-perigo { background: var(--alerta); color: #fff; }
.btn-link { background: transparent; color: var(--azul); text-decoration: underline; min-height: 44px; }
.btn-secundario { background: var(--bg-elevado); color: var(--texto); }

/* Login por PIN */
#tela-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { text-align: center; width: 100%; max-width: 360px; padding: 24px; }
.login-box h1 { font-size: 40px; margin: 0 0 4px; }
.sub { color: var(--texto-sub); margin: 0 0 20px; }
.pin-display { display: flex; justify-content: center; gap: 12px; height: 24px; margin-bottom: 16px; }
.pin-display span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--texto-sub); }
.pin-display span.preenchido { background: var(--primario); border-color: var(--primario); }
.erro { color: var(--alerta); margin-bottom: 12px; font-weight: 600; }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tecla { min-height: 68px; font-size: 26px; border-radius: var(--radius); border: none; background: var(--bg-card); color: var(--texto); }
.tecla:active { background: var(--bg-elevado); }
.tecla-ok { background: var(--primario); color: #fff; }
.tecla-apagar { background: var(--bg-card); color: var(--texto-sub); font-size: 20px; }

/* App shell */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--bg-card); border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.topbar-esq { display: flex; align-items: center; gap: 8px; }
.badge { background: var(--azul); padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.nav-abas { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.nav-abas button { background: transparent; border: none; padding: 10px 14px; border-radius: 10px; color: var(--texto-sub); font-weight: 600; white-space: nowrap; }
.nav-abas button.ativo { background: var(--bg-elevado); color: var(--texto); }
#conteudo { flex: 1; padding: 12px; overflow-y: auto; }

.banner { padding: 10px 16px; text-align: center; font-weight: 600; }
.banner-offline { background: var(--alerta); color: #fff; }
.banner-pending { background: var(--aviso); color: #1a1a1a; }

/* Kanban — nenhuma tela de operação com rolagem vertical de página (spec §1) */
.kanban-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.kanban-toolbar .btn-grande { width: auto; flex: 0 0 auto; }
.filtros { display: flex; gap: 8px; overflow-x: auto; }
.chip { background: var(--bg-card); border: 1px solid var(--borda); border-radius: 999px; padding: 8px 16px; color: var(--texto-sub); white-space: nowrap; }
.chip.ativo { background: var(--azul); color: #fff; border-color: var(--azul); }
.kanban-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .kanban-board { grid-template-columns: 1fr; } }
.coluna { background: var(--bg-card); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.coluna h2 { font-size: 15px; text-transform: uppercase; color: var(--texto-sub); margin: 4px 6px 10px; }
.cards { display: flex; flex-direction: column; gap: 10px; }

.card-os { background: var(--bg-elevado); border-radius: 12px; padding: 12px; border-left: 6px solid var(--primario); }
.card-os.timer-amarelo { border-left-color: var(--aviso); }
.card-os.timer-vermelho { border-left-color: var(--alerta); }
.card-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.card-placa { font-size: 20px; letter-spacing: 1px; }
.card-veiculo, .card-servico { color: var(--texto-sub); font-size: 14px; }
.card-timer { font-weight: 700; margin: 6px 0; }
.card-executores { font-size: 13px; color: var(--texto-sub); margin-bottom: 8px; }
.card-os .btn { margin-top: 6px; }

/* Check-in móvel — retrato, uma mão, câmera prioritária */
.checkin-passo { display: flex; flex-direction: column; gap: 14px; max-width: 480px; margin: 0 auto; }
.checkin-header { display: flex; justify-content: space-between; align-items: center; }
.checkin-camera-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3/4; }
.checkin-camera-wrap video, .checkin-camera-wrap img { width: 100%; height: 100%; object-fit: cover; }
.checkin-camera-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.checkin-moldura { border: 3px dashed rgba(255,255,255,.7); width: 78%; height: 34%; border-radius: 10px; }
.checkin-shutter { display: flex; justify-content: center; }
.btn-shutter { width: 76px; height: 76px; border-radius: 50%; background: #fff; border: 6px solid var(--bg-elevado); }
.btn-shutter.gravando { background: var(--alerta); }
.placa-lida { text-align: center; font-size: 32px; letter-spacing: 3px; background: var(--bg-card); padding: 14px; border-radius: var(--radius); }
.dado-cliente { background: var(--bg-card); border-radius: var(--radius); padding: 14px; }
.dado-cliente .linha { display: flex; justify-content: space-between; padding: 4px 0; color: var(--texto-sub); }
.dado-cliente .destaque { color: var(--aviso); font-weight: 700; }
.grid-botoes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid-botoes button { min-height: 60px; border-radius: var(--radius); border: 2px solid var(--borda); background: var(--bg-card); color: var(--texto); font-size: 17px; font-weight: 700; }
.grid-botoes button.selecionado { border-color: var(--primario); background: rgba(34,197,94,.15); }
.contador-video { text-align: center; font-size: 44px; font-weight: 800; }

/* Caixa / formulários */
.form-linha { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-linha label { color: var(--texto-sub); font-size: 14px; }
.form-linha input, .form-linha select, .form-linha textarea {
  min-height: 52px; font-size: 20px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--borda);
  background: var(--bg-card); color: var(--texto);
}
.cartao { background: var(--bg-card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 10px; }
.stat { background: var(--bg-card); border-radius: var(--radius); padding: 14px; }
.stat .valor { font-size: 26px; font-weight: 800; }
.stat .rotulo { color: var(--texto-sub); font-size: 13px; }

/* Modal simples */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal-caixa { background: var(--bg-card); border-radius: 20px 20px 0 0; padding: 20px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
