/* Fritech · Fotos — mesmo navy/laranja da página pública /os/ (KAPI2_NUVEM §9.4).
   Fontes servidas daqui (CSP font-src 'self'); sem elas, cai na fonte do sistema. */
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap;
  src: url("/static/fonts/barlow-condensed-700.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 400; font-display: swap;
  src: url("/static/fonts/dm-sans-400.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-display: swap;
  src: url("/static/fonts/dm-sans-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-500.woff2") format("woff2"); }

:root {
  --fundo: #08152B; --barra: #0C1C33; --card: #10243F; --borda: #1E3A5F; --borda2: #2A4468;
  --txt: #EEF2F8; --txt2: #D5DEEA; --apagado: #9DB0CA; --legenda: #8FA3BF;
  --laranja: #f78320; --sobre-laranja: #1A0E02; --ok: #4FCB8C; --erro: #FF9A8A; --erro-borda: #7A3B34;
  --f-entrada: #6FA8FF; --f-diagnostico: #F2C14E; --f-reparo: #f78320; --f-finalizado: #4FCB8C;
  --titulo: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --corpo: "DM Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fundo); color: var(--txt); font-family: var(--corpo);
  font-size: 16px; min-height: 100%; }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--laranja); }
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.carregando { padding: 48px 24px; color: var(--apagado); }

/* barras */
.topo { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  min-height: 60px; padding: env(safe-area-inset-top) 8px 0; background: var(--barra);
  border-bottom: 1px solid var(--borda); }
.topo .meio { flex: 1; display: flex; flex-direction: column; min-width: 0; padding-left: 8px; }
.topo .os { font-family: var(--mono); font-size: 15px; color: var(--laranja); }
.topo .sub { font-size: 13px; color: var(--apagado); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca { font-family: var(--titulo); font-weight: 700; font-size: 22px; letter-spacing: .5px; padding-left: 8px; }
.marca b { color: var(--laranja); }
.marca span { color: var(--apagado); font-size: 18px; margin-left: 8px; }
.icone-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--txt); border-radius: 22px; cursor: pointer; flex-shrink: 0; }
.icone-btn svg { width: 22px; height: 22px; }
.link-btn { border: 0; background: transparent; color: var(--laranja); padding: 12px; cursor: pointer; font-size: 14px; }

.corpo { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 22px 20px 28px; }
h1 { margin: 0; font-family: var(--titulo); font-weight: 700; font-size: 32px; line-height: 1.05; }
.dica { font-size: 14px; color: var(--apagado); margin: 6px 0 0; }
.rotulo { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; color: var(--legenda); text-transform: uppercase; }
.espaco { flex: 1; }

/* botões */
.btn { min-height: 54px; border-radius: 12px; border: 0; background: var(--laranja); color: var(--sobre-laranja);
  font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; cursor: pointer; padding: 0 16px; text-decoration: none; }
.btn svg { width: 22px; height: 22px; }
.btn.grande { min-height: 76px; font-size: 19px; border-radius: 16px; }
.btn.sec { background: transparent; color: var(--txt); border: 1px solid var(--borda2); font-weight: 500; font-size: 16px; }
.btn.perigo { background: transparent; color: var(--erro); border: 1px solid var(--erro-borda); }
.btn[disabled] { opacity: .5; cursor: default; }

/* campos */
label.campo { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 500; color: var(--apagado); }
input[type=text], select { height: 50px; border-radius: 10px; border: 1px solid var(--borda2); background: var(--barra);
  padding: 0 14px; font-size: 16px; width: 100%; color: var(--txt); }
.numero-os { display: flex; height: 68px; border-radius: 14px; border: 2px solid var(--laranja); background: var(--barra); overflow: hidden; }
.numero-os span { width: 58px; display: flex; align-items: center; justify-content: center; background: var(--card);
  border-right: 1px solid var(--borda2); font-family: var(--mono); font-size: 28px; color: var(--laranja); }
.numero-os input { flex: 1; min-width: 0; border: 0; height: 100%; background: transparent; font-family: var(--mono);
  font-size: 32px; letter-spacing: 3px; border-radius: 0; }
.numero-os input:focus { outline: none; }
.codigo { font-family: var(--mono); font-size: 24px; letter-spacing: 3px; text-align: center; text-transform: uppercase; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--laranja); margin: 0; }

/* cartões */
.card { background: var(--card); border: 1px solid var(--borda); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.linha-os { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--borda); color: var(--txt); text-decoration: none; width: 100%; text-align: left; cursor: pointer; }
.linha-os .num { font-family: var(--mono); font-size: 17px; color: var(--laranja); width: 66px; flex-shrink: 0; }
.linha-os .txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.linha-os .txt b { font-weight: 500; font-size: 15px; }
.linha-os .txt small { font-size: 13px; color: var(--apagado); }
.pilula { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--borda2); font-size: 13px; font-weight: 500; }
.ponto { width: 9px; height: 9px; border-radius: 5px; flex-shrink: 0; display: inline-block; }
.grade2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.par { display: flex; flex-direction: column; gap: 3px; }
.par small { font-size: 12px; color: var(--legenda); }
.par span { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.caixa { padding: 12px 14px; border-radius: 10px; background: var(--barra); font-size: 15px; line-height: 1.45; }
.aviso { padding: 12px 14px; border-radius: 12px; border: 1px solid #8a6a1c; background: #2A2312; color: #F6DA8E; font-size: 14px; line-height: 1.45; }
.equip { font-family: var(--titulo); font-weight: 700; font-size: 28px; line-height: 1.05; }

/* fases */
.fases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fase { min-height: 92px; border-radius: 14px; border: 1px solid var(--borda2); background: var(--card); display: flex;
  flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; padding: 0 16px; cursor: pointer; text-align: left; }
.fase b { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.fase small { font-size: 13px; color: var(--apagado); }
.fase.sel { border-width: 2px; background: #1f2a2a; }

/* revisão / envio */
.item { display: flex; gap: 12px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--borda); align-items: flex-start; }
.item.oculta { border-style: dashed; background: var(--barra); }
.item.falhou { border-color: var(--erro-borda); }
.mini { width: 88px; height: 88px; border-radius: 10px; object-fit: cover; background: #16304F; flex-shrink: 0; }
.mini.p { width: 56px; height: 56px; }
.item .meio { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.item input[type=text] { height: 40px; font-size: 14px; }
.barra { height: 8px; border-radius: 4px; background: var(--borda); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--laranja); width: 0; transition: width .2s; }
.st-ok { color: var(--ok); font-size: 13px; }
.st-erro { color: var(--erro); font-size: 13px; }
.st { color: var(--apagado); font-size: 13px; }
.rodape { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  background: var(--barra); border-top: 1px solid var(--borda); }
.rodape small { text-align: center; color: var(--legenda); font-size: 12px; }

/* galeria */
.grupo { display: flex; flex-direction: column; gap: 10px; }
.grupo h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.grupo h2 small { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--legenda); }
.grade3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 0; padding: 0; background: #16304F; cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.oculta { outline: 2px dashed #5A7090; outline-offset: -2px; }
.tile.oculta img { opacity: .45; }
.tile .selo { position: absolute; right: 6px; bottom: 6px; background: rgba(4,10,20,.8); border-radius: 6px; padding: 2px 6px; font-size: 11px; color: var(--txt2); }

/* folha (detalhe da foto) */
.folha-fundo { position: fixed; inset: 0; background: rgba(2,6,14,.85); z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; }
.folha { max-width: 520px; width: 100%; margin: 0 auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 16px 20px calc(22px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; max-height: 92vh; overflow-y: auto; }
.folha img { width: 100%; max-height: 50vh; object-fit: contain; background: #040A14; border-radius: 10px; }
.acoes3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.acoes3 .btn { min-height: 60px; font-size: 13px; flex-direction: column; gap: 4px; }

#toast { position: fixed; left: 50%; top: calc(70px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 40;
  background: #EEF2F8; color: #08152B; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  max-width: 90vw; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.on { opacity: 1; }
#toast.erro { background: #FFD9D2; color: #5A1208; }
.esconder { display: none !important; }
