/* UtraCampo — app do técnico (mobile first) */
:root {
    /* Paleta UTRATECH: azul-marinho (base) + laranja (destaque) */
    --azul: #0B1B55;
    --azul-esc: #07123D;
    --azul-leve: #E9EDF8;
    --laranja: #F28C1B;
    --laranja-esc: #D9760A;
    --laranja-leve: #FFF3E3;
    --laranja-texto: #9A4F04;
    --ok: #16A34A;
    --perigo: #DC2626;
    --aviso: #D97706;
    --fundo: #F1F4F9;
    --superficie: #fff;
    --borda: #E2E8F0;
    --texto: #0F172A;
    --cinza: #64748B;
    --r: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { background: var(--fundo); }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px; color: var(--texto); line-height: 1.45;
    padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; cursor: pointer; }
a { color: var(--azul); font-weight: 600; }
input, select, textarea { font: inherit; color: inherit; }
.cinza { color: var(--cinza); }
.pequeno { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; }

/* ---------- Barra superior ---------- */
.barra {
    position: sticky; top: 0; z-index: 20;
    background: var(--azul); color: #fff; border-bottom: 3px solid var(--laranja);
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.barra-titulo { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.barra-titulo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voltar { background: none; border: 0; color: #fff; font-size: 24px; line-height: 1; padding: 0 4px 0 0; }
.barra-status { font-size: 12px; display: flex; align-items: center; gap: 6px; white-space: nowrap; color: #CBD3EE; }
.ponto { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.ponto.off { background: #F59E0B; }

main { max-width: 720px; margin: 0 auto; padding: 14px 14px 110px; }
.carregando { text-align: center; color: var(--cinza); padding: 60px 0; }

/* ---------- Login: visual em ../assets/css/login.css (compartilhado com o painel) ---------- */
body.tela-login .barra { display: none; }

/* ---------- Componentes ---------- */
.cartao {
    background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--r);
    padding: 14px 16px; margin-bottom: 10px; display: block; width: 100%; text-align: left; color: inherit;
}
button.cartao:active { background: #F8FAFC; }
.cartao-topo { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cartao h3 { font-size: 16px; }
.tipo { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.tipo::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--cor, var(--azul)); }
.selo { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; background: #F1F5F9; color: #475569; }
.selo.fila { background: #FEF3C7; color: #B45309; }
.selo.erro { background: #FEE2E2; color: #B91C1C; }
.selo.rascunho { background: var(--laranja-leve); color: var(--laranja-texto); }
.selo.ok { background: #DCFCE7; color: #15803D; }
.aviso-reprov { background: #FEE2E2; color: #991B1B; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 14px; }

.abas { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.aba {
    flex: 1; border: 1px solid var(--borda); background: #fff; border-radius: 999px;
    padding: 8px 12px; font-size: 14px; font-weight: 600; color: var(--cinza); white-space: nowrap;
}
.aba.ativa { background: var(--azul); border-color: var(--azul); color: #fff; }
.aba .n { opacity: .8; font-weight: 500; }

.vazio { text-align: center; color: var(--cinza); padding: 40px 10px; }
.titulo-secao { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--cinza); margin: 18px 2px 8px; }

.btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    border: 0; border-radius: var(--r); padding: 14px 16px; font-weight: 700; font-size: 16px;
    background: var(--laranja); color: var(--azul);
}
.btn:active { filter: brightness(.92); }
.btn:disabled { opacity: .6; }
.btn-sec { background: #fff; color: var(--texto); border: 1px solid var(--borda); }
.btn-ok { background: var(--ok); }
.btn-perigo { background: #fff; color: var(--perigo); border: 1px solid #FCA5A5; }
.btn-peq { padding: 9px 12px; font-size: 14px; width: auto; }

.rodape-fixo {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(241,244,249,.96); border-top: 1px solid var(--borda);
}
.rodape-fixo > div { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; }

.grade-tipos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-tipo {
    background: #fff; border: 1px solid var(--borda); border-left: 5px solid var(--cor);
    border-radius: var(--r); padding: 18px 12px; font-weight: 700; text-align: left; min-height: 74px;
}
.btn-tipo:active { background: #F8FAFC; }

.busca { position: sticky; top: 58px; z-index: 5; background: var(--fundo); padding-bottom: 10px; }

/* ---------- Formulário ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .rotulo { font-weight: 600; font-size: 15px; }
.obrig { color: var(--perigo); }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
    width: 100%; padding: 12px 13px; border: 1px solid #CBD5E1; border-radius: 10px; background: #fff; font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--laranja-leve); border-color: var(--laranja); }

.bloco {
    background: #fff; border: 1px solid var(--borda); border-radius: var(--r);
    padding: 14px; margin-bottom: 10px;
}
.bloco.invalido { border-color: var(--perigo); box-shadow: 0 0 0 2px #FECACA; }
.bloco.invalido .rotulo::after, .bloco.invalido > label::after { content: ' · obrigatório'; color: var(--perigo); font-weight: 500; font-size: 13px; }

.escolhas { display: flex; gap: 8px; flex-wrap: wrap; }
.escolha {
    flex: 1 1 auto; min-width: 90px; padding: 11px 12px; border-radius: 10px;
    border: 1px solid #CBD5E1; background: #fff; font-weight: 600;
}
.escolha.marcada { background: var(--azul); border-color: var(--azul); color: #fff; }

.foto-campo { display: flex; gap: 12px; align-items: center; }
.foto-miniatura {
    width: 92px; height: 70px; border-radius: 8px; object-fit: cover; background: #E2E8F0; flex-shrink: 0;
    border: 1px solid var(--borda);
}
.foto-miniatura.assin { object-fit: contain; background: #fff; }
.foto-acoes { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.btn-foto {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    border: 2px dashed #F5B066; background: var(--laranja-leve); color: var(--laranja-texto);
    border-radius: 10px; padding: 14px; font-weight: 700; width: 100%;
}
.btn-foto.feita { border-style: solid; border-color: #86EFAC; background: #F0FDF4; color: var(--ok); }
.btn-foto input { display: none; }
.foto-botoes { display: flex; flex-wrap: wrap; gap: 6px; }
.foto-botoes .btn-foto { flex: 1 1 140px; }
.foto-botoes .btn-galeria { flex: 1 1 100px; }
.btn-galeria {
    display: flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0;
    border: 2px solid var(--borda); background: var(--superficie); color: var(--azul);
    border-radius: 10px; padding: 14px 12px; font-weight: 700; white-space: nowrap;
}
.btn-galeria input { display: none; }
.link-usar { background: none; border: 0; padding: 0; color: var(--laranja-esc); font-weight: 700; text-decoration: underline; font-size: inherit; }
.link-remover { background: none; border: 0; color: var(--perigo); font-size: 14px; padding: 2px; text-align: left; }

.info-os { background: var(--azul-leve); border-left: 4px solid var(--laranja); border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; font-size: 15px; }
.info-os strong { display: block; }

/* ---------- Assinatura ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.6); display: flex; align-items: flex-end; }
.modal-caixa { background: #fff; width: 100%; border-radius: 16px 16px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
.modal-caixa h3 { margin-bottom: 10px; }
.assinatura-canvas { width: 100%; height: 240px; border: 1px dashed #94A3B8; border-radius: 10px; touch-action: none; background: #fff; display: block; }
.modal-botoes { display: flex; gap: 8px; margin-top: 12px; }

.toast {
    position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    background: #0F172A; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60;
    font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.progresso { font-size: 13px; color: var(--cinza); margin-top: 6px; }

@media (min-width: 600px) { .grade-tipos { grid-template-columns: 1fr 1fr 1fr; } }
