/* =========================================================
   Gestão da Manutenção — estilos
   ========================================================= */
:root {
  --fundo: #f4f5f7;
  --superficie: #ffffff;
  --texto: #1f2933;
  --texto-suave: #616e7c;
  --borda: #d9dee4;
  --escuro: #1f2933;
  --destaque: #f5a623;       /* amarelo segurança */
  --primario: #1f5fbf;
  --primario-escuro: #174a96;
  --perigo: #c62828;
  --sucesso: #2e7d32;
  --alerta: #b26a00;
  --raio: 10px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--primario); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.oculto { display: none !important; }
.suave { color: var(--texto-suave); }
.pequeno { font-size: .85rem; }
.direita { text-align: right; }

/* ---------- topo e menu ---------- */
.topo { background: var(--escuro); color: #fff; position: sticky; top: 0; z-index: 20; }
.topo-linha { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; max-width: 1280px; margin: 0 auto; }
.marca { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.marca-icone { color: var(--destaque); }
.usuario { display: flex; align-items: center; gap: .6rem; font-size: .9rem; min-width: 0; }
.usuario span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { display: flex; gap: .25rem; overflow-x: auto; padding: 0 .75rem; max-width: 1280px; margin: 0 auto;
  scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a { color: #cbd2d9; text-decoration: none; padding: .6rem .8rem; white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 500; }
.menu a.ativo { color: #fff; border-bottom-color: var(--destaque); }
.menu a:hover { color: #fff; }

.conteudo { max-width: 1280px; margin: 0 auto; padding: 1rem; }
.carregando { padding: 3rem; text-align: center; color: var(--texto-suave); }

.cabecalho { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem; }
.acoes { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- cartões ---------- */
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
  box-shadow: var(--sombra); padding: 1rem; margin-bottom: 1rem; }
.grade { display: grid; gap: 1rem; }
.grade-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grade-cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.numeros { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1rem; }
.numero { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: .9rem 1rem; }
.numero b { display: block; font-size: 1.8rem; line-height: 1.1; }
.numero span { color: var(--texto-suave); font-size: .85rem; }
.numero.alerta b { color: var(--perigo); }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--borda);
  background: var(--superficie); color: var(--texto); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; }
.btn:hover { background: #eef1f4; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--primario); border-color: var(--primario); color: #fff; }
.btn-primario:hover { background: var(--primario-escuro); }
.btn-sucesso { background: var(--sucesso); border-color: var(--sucesso); color: #fff; }
.btn-sucesso:hover { background: #256628; }
.btn-perigo { background: #fff; border-color: var(--perigo); color: var(--perigo); }
.btn-perigo:hover { background: #fdecea; }
.btn-alerta { background: var(--destaque); border-color: var(--destaque); color: #1f2933; }
.btn-fantasma { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn-fantasma:hover { background: rgba(255,255,255,.1); }
.btn-pequeno { min-height: 34px; padding: .3rem .7rem; font-size: .88rem; }
.btn-grande { min-height: 56px; font-size: 1.1rem; width: 100%; }

/* ---------- formulários ---------- */
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.campo > label, .rotulo { font-weight: 600; font-size: .92rem; }
.campo small { color: var(--texto-suave); }
input, select, textarea { font: inherit; color: inherit; width: 100%; min-height: 44px;
  padding: .55rem .7rem; border: 1px solid #c3cad3; border-radius: 8px; background: #fff; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31,95,191,.25); border-color: var(--primario); }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; }
.linha-campos { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.dica-ok { color: var(--sucesso); font-weight: 600; }
.dica-erro { color: var(--perigo); font-weight: 600; }

/* opções em "pílulas" (radio) */
.opcoes { display: flex; flex-wrap: wrap; gap: .5rem; }
.opcoes label { position: relative; }
.opcoes input { position: absolute; opacity: 0; pointer-events: none; }
.opcoes span { display: inline-flex; align-items: center; min-height: 44px; padding: .45rem .9rem;
  border: 2px solid var(--borda); border-radius: 999px; background: #fff; cursor: pointer; font-weight: 500; }
.opcoes input:checked + span { border-color: var(--primario); background: #e8f0fc; color: var(--primario-escuro); font-weight: 700; }
.opcoes input:focus-visible + span { outline: 3px solid rgba(31,95,191,.35); }
.opcoes.sim-nao span { min-width: 110px; justify-content: center; font-size: 1.05rem; }
.opcoes.sim-nao input[value=sim]:checked + span { border-color: var(--perigo); background: #fdecea; color: var(--perigo); }

/* ---------- filtros ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filtros select, .filtros input { width: auto; min-width: 160px; flex: 1 1 160px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--borda); background: #fff; border-radius: 999px; padding: .4rem .85rem;
  font: inherit; font-size: .9rem; cursor: pointer; min-height: 38px; }
.chip.ativo { background: var(--escuro); border-color: var(--escuro); color: #fff; }
.chip .qtd { display: inline-block; min-width: 1.4em; margin-left: .3rem; padding: 0 .35rem; border-radius: 999px;
  background: rgba(0,0,0,.08); font-size: .8rem; text-align: center; }
.chip.ativo .qtd { background: rgba(255,255,255,.2); }

/* ---------- etiquetas (badges) ---------- */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem;
  font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.st-aberta          { background: #e3ecfb; color: #174a96; }
.st-atribuida       { background: #ede7f6; color: #4a2a8a; }
.st-em_execucao     { background: #fff3d6; color: #8a5300; }
.st-aguardando_peca { background: #fde7d8; color: #a14400; }
.st-concluida       { background: #def3e0; color: #1d5e21; }
.st-validada        { background: #e6e9ed; color: #3e4c59; }
.st-cancelada       { background: #f3f4f6; color: #7b8794; text-decoration: line-through; }
.pr-1 { background: var(--perigo); color: #fff; }
.pr-2 { background: #ffe1d6; color: #a12a00; }
.pr-3 { background: #eef1f4; color: #3e4c59; }
.pr-4 { background: #f7f8fa; color: #7b8794; }
.parada { background: var(--perigo); color: #fff; }
.crit-A { background: #fdecea; color: var(--perigo); border-color: #f5c2bd; }
.crit-B { background: #fff3d6; color: #8a5300; border-color: #f3dca0; }
.crit-C { background: #eef1f4; color: #3e4c59; border-color: #d9dee4; }

/* ---------- cartão de OS ---------- */
.os-card { display: block; color: inherit; text-decoration: none; background: #fff; border: 1px solid var(--borda);
  border-left: 6px solid #c3cad3; border-radius: var(--raio); padding: .8rem .9rem; box-shadow: var(--sombra); }
.os-card:hover { border-color: #aab4c0; }
.os-card.p1 { border-left-color: var(--perigo); }
.os-card.p2 { border-left-color: #f0743e; }
.os-card.p3 { border-left-color: var(--primario); }
.os-card .topo-os { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.os-card .num { font-weight: 800; }
.os-card .equip { font-weight: 600; margin: .3rem 0 .15rem; }
.os-card .desc { color: #3e4c59; font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.os-card .rodape { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: .5rem; font-size: .82rem; color: var(--texto-suave); }
.etiquetas { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ---------- tabelas ---------- */
.tabela-rolagem { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; background: #fff; font-size: .93rem; }
.tabela th, .tabela td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid #eceff2; vertical-align: middle; }
.tabela th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-suave); background: #f9fafb; }
.tabela tr.clicavel { cursor: pointer; }
.tabela tr.clicavel:hover td { background: #f5f8fc; }
.tabela td input, .tabela td select { min-height: 36px; padding: .3rem .5rem; }
.grupo-titulo td { background: #eef1f4; font-weight: 700; }

/* ---------- detalhes ---------- */
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem 1.25rem; }
.info div > span { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-suave); }
.info div > b { font-weight: 600; }
.texto-longo { white-space: pre-wrap; }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.fotos a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #eef1f4; position: relative; }
.fotos img { width: 100%; height: 100%; object-fit: cover; }
.fotos .legenda { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff;
  font-size: .72rem; padding: .15rem .4rem; }
.linha-tempo { list-style: none; margin: 0; padding: 0; }
.linha-tempo li { padding: .55rem 0 .55rem 1rem; border-left: 2px solid var(--borda); position: relative; }
.linha-tempo li::before { content: ""; position: absolute; left: -6px; top: .9rem; width: 10px; height: 10px;
  border-radius: 50%; background: #9aa5b1; }
.linha-tempo li.comentario::before { background: var(--primario); }
.linha-tempo .quando { font-size: .8rem; color: var(--texto-suave); }

.aviso { border-radius: var(--raio); padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.aviso-info { background: #e8f0fc; border-color: #bcd0f2; }
.aviso-alerta { background: #fff6e0; border-color: #f3dca0; }
.aviso-sucesso { background: #e7f5e8; border-color: #b9e0bc; }
.vazio { text-align: center; color: var(--texto-suave); padding: 2.5rem 1rem; }

/* ---------- login ---------- */
.login { max-width: 400px; margin: 8vh auto; }
.login .marca-login { text-align: center; margin-bottom: 1.25rem; }
.login .marca-login .marca-icone { font-size: 2.4rem; display: block; }

/* ---------- sucesso nova solicitação ---------- */
.sucesso-ss { text-align: center; padding: 2rem 1rem; }
.sucesso-ss .grande { font-size: 3rem; font-weight: 800; color: var(--sucesso); }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: 1rem;
  display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 460px); }
.toast { background: var(--escuro); color: #fff; padding: .8rem 1rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.erro { background: var(--perigo); }
.toast.ok { background: var(--sucesso); }

/* ---------- etiquetas QR ---------- */
.etiquetas-qr { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.etiqueta-qr { border: 1px dashed #9aa5b1; border-radius: 8px; padding: 10px; text-align: center; background: #fff;
  break-inside: avoid; page-break-inside: avoid; }
.etiqueta-qr svg { width: 150px; height: 150px; display: block; margin: 4px auto; }
.etiqueta-qr .cod { font-size: 1.3rem; font-weight: 800; letter-spacing: .03em; }
.etiqueta-qr .nome { font-size: .85rem; font-weight: 600; }
.etiqueta-qr .instr { font-size: .72rem; color: #3e4c59; margin-top: 4px; }

/* ---------- responsivo ---------- */
@media (max-width: 640px) {
  .conteudo { padding: .75rem; }
  h1 { font-size: 1.25rem; }
  .usuario #usuario-nome { max-width: 40vw; }
  .card { padding: .85rem; }
  .esconder-celular { display: none; }
}

/* ---------- impressão ---------- */
@media print {
  .topo, .nao-imprimir, .toasts { display: none !important; }
  body { background: #fff; }
  .conteudo { padding: 0; max-width: none; }
  .etiquetas-qr { grid-template-columns: repeat(3, 1fr); }
}

/* ajustes */
.os-card .num { white-space: nowrap; }
.campo small.dica-ok { color: var(--sucesso); }
.campo small.dica-erro { color: var(--perigo); }
.filtros input[type=checkbox] { flex: none; min-width: 0; width: 20px; }
