/* Sistema Adentro — a oficina: grafite de lápis de carpinteiro, cinza de obra, azul-petróleo de planta
   e o amarelo da trena, usado só para marcar onde o trabalho está (etapas, atual, portões). */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fontes/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../fontes/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../fontes/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("../fontes/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("../fontes/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("../fontes/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }
:root {
  --bg: #eceeec;
  --surface: #ffffff;
  --surface-2: #e3e6e4;
  --fg: #23282b;
  --muted: #5b6469;
  --line: #d2d7d5;
  --accent: #1d5266;
  --accent-forte: #143d4c;
  --accent-soft: #dce9ee;
  --trena: #f2c230;
  --trena-escura: #b98d0c;
  --trena-tinta: #2b2300;
  --ok: #2d7a4e;
  --ok-soft: #dff0e5;
  --warn: #965808;
  --warn-soft: #f8ebd3;
  --bad: #b42318;
  --bad-soft: #f7e0dd;
  --radius: 10px;
  --menu-l: 232px;
  --abas-h: 0px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --cond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) and (min-width: 1000px) {
  :root {
    --bg: #15191b; --surface: #1d2326; --surface-2: #262d31; --fg: #e6eaeb; --muted: #9ba7ac; --line: #343d42;
    --accent: #84bdd2; --accent-forte: #a7d2e2; --accent-soft: #1b3440; --ok: #6cc596; --ok-soft: #173326;
    --warn: #e6a95a; --warn-soft: #3a2a14; --bad: #f08a80; --bad-soft: #3d1c19; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.marcar { display: flex; gap: 10px; align-items: flex-start; color: var(--fg); font-size: 16px; margin: 8px 0; }
.marcar input { margin-top: 4px; flex: none; width: 20px; height: 20px; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font); -webkit-text-size-adjust: 100%;
  font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-underline-offset: 2px; }
h1 { font: 700 27px/1.15 var(--cond); margin: 0 0 6px; text-wrap: balance; letter-spacing: -.005em; }
h2 { font: 600 19px/1.25 var(--cond); margin: 26px 0 10px; }
h3 { font: 600 16px/1.3 var(--font); margin: 16px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- menu: barra lateral no computador, barra de cima no tablet, abas embaixo no celular ---------- */
.topo { position: sticky; top: 0; z-index: 20; background: var(--fg); color: #eef1f1;
  padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) and (min-width: 1000px) { .topo { background: #0f1213; border-bottom: 1px solid var(--line); } }
.marca { display: inline-flex; align-items: center; gap: 10px; font: 700 20px/1 var(--cond); letter-spacing: .01em;
  color: #fff; text-decoration: none; }
.marca-sinal { width: 22px; height: 22px; border-radius: 4px; background:
  linear-gradient(90deg, var(--trena-tinta) 1.5px, transparent 1.5px) 3px 0 / 6px 7px repeat-x,
  linear-gradient(90deg, var(--trena-tinta) 1.5px, transparent 1.5px) 3px 0 / 12px 11px repeat-x, var(--trena); }
.menu { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a { display: inline-flex; align-items: center; gap: 8px; color: #c9d0d3; text-decoration: none; padding: 7px 10px;
  border-radius: 8px; font-size: 15px; font-weight: 500; white-space: nowrap; }
.menu a:hover { color: #fff; background: rgba(255,255,255,.08); }
.menu a.ativo { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset 3px 0 0 var(--trena); }
.menu svg, .barra-abas svg, .mais-lista svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topo form.busca { display: flex; }
.topo form.busca input { width: 220px; background: rgba(255,255,255,.1); border: 1px solid transparent; color: #fff; }
.topo form.busca input:focus { border-color: var(--trena); }
.topo form.busca input::placeholder { color: rgba(255,255,255,.55); }
.topo form.sair button { background: transparent; color: #dfe4e6; border-color: rgba(255,255,255,.28); min-height: 36px; padding: 4px 12px; }
.barra-abas { display: none; }

@media (min-width: 1000px) {
  body.com-menu { padding-left: var(--menu-l); }
  .topo { position: fixed; left: 0; top: 0; bottom: 0; width: var(--menu-l); flex-direction: column; align-items: stretch;
    flex-wrap: nowrap; gap: 14px; padding: 20px 14px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .marca { padding: 0 6px 6px; }
  .topo form.busca input { width: 100%; }
  .menu { flex-direction: column; flex: 1; overflow: visible; gap: 2px; }
  .menu a { padding: 9px 10px; }
  .topo form.sair button { width: 100%; justify-content: center; }
  .sync { left: var(--menu-l) !important; }
}
@media (min-width: 760px) and (max-width: 999px) {
  .menu { -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
  .menu svg { display: none; }
  .topo form.sair { order: 3; }
  .topo form.busca { order: 4; width: 100%; } .topo form.busca input { width: 100%; }
}
@media (max-width: 759px) {
  :root { --abas-h: calc(62px + env(safe-area-inset-bottom)); }
  .topo { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 10px; }
  .menu { display: none; }
  .marca { flex: 1; }
  .topo form.busca { order: 3; width: 100%; } .topo form.busca input { width: 100%; }
  body.com-menu .barra-abas { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--abas-h);
    padding: 0 max(4px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-right));
    background: var(--surface); border-top: 1px solid var(--line); }
  .barra-abas > a, .barra-abas summary { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--muted); text-decoration: none; font: 600 12.5px/1 var(--cond); position: relative; min-width: 0;
    list-style: none; cursor: pointer; height: 62px; }
  .barra-abas summary::-webkit-details-marker { display: none; }
  .barra-abas svg { width: 24px; height: 24px; }
  .barra-abas > a.ativo, .mais[open] summary { color: var(--fg); }
  .barra-abas > a.ativo::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--trena); }
  .mais { flex: 1; display: flex; }
  .mais summary { width: 100%; }
  .mais-lista { position: fixed; left: 8px; right: 8px; bottom: calc(var(--abas-h) + 8px); background: var(--surface);
    border: 1px solid var(--line); border-radius: 14px; padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
    box-shadow: 0 12px 32px rgba(20, 25, 27, .22); }
  .mais-lista a { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; color: var(--fg);
    text-decoration: none; font-weight: 600; min-height: 48px; }
  .mais-lista a.ativo { background: var(--accent-soft); color: var(--accent); }
  body.com-menu main { padding-bottom: calc(var(--abas-h) + 32px); }
  body.com-menu .sync { bottom: var(--abas-h); }
}

main { max-width: 1240px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-right)) 96px max(16px, env(safe-area-inset-left)); }
@media (min-width: 1000px) { main { padding: 28px 32px 96px; } }

/* blocos */
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.grade { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.linha { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.entre { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pilha > * + * { margin-top: 12px; }
.cabecalho { margin-bottom: 16px; }
.cabecalho .linha { margin-top: 8px; }

/* números do painel */
.indicadores { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.indicador { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: inherit; }
.indicador b { display: block; font: 700 32px/1.1 var(--cond); }
.indicador span { color: var(--muted); font-size: 14px; }
a.indicador:hover { border-color: var(--accent); }

/* etiquetas de estado */
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.aviso { background: var(--warn-soft); color: var(--warn); }
.chip.ruim { background: var(--bad-soft); color: var(--bad); }
.chip.azul { background: var(--accent-soft); color: var(--accent); }

/* formulários e botões */
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; max-width: 100%; min-height: 44px; }
textarea { min-height: 88px; }
textarea { width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; }
label { font-size: 14px; color: var(--muted); display: block; margin-bottom: 3px; font-weight: 500; }
.campo { margin-bottom: 12px; }
.campo input:not([type=checkbox]), .campo select { width: 100%; }
.campo .ajuda { font-size: 12px; color: var(--muted); }
.campo .erro, .erros { color: var(--bad); font-size: 13px; }
.form-grade { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
button, .botao { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface);
  color: var(--fg); border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; min-height: 40px; }
.botao.principal, button.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.botao.principal:hover, button.principal:hover { background: var(--accent-forte); border-color: var(--accent-forte); }
button:not(.principal):not(:disabled):hover, .botao:not(.principal):hover { border-color: var(--muted); }
.botao.perigo, button.perigo { color: var(--bad); border-color: var(--bad); }
.botao.grande, button.grande { min-height: 64px; font-size: 18px; padding: 12px 20px; border-radius: 12px; justify-content: center; }
button:disabled { opacity: .45; cursor: not-allowed; }
form.inline { display: inline; }

/* tabelas */
.tabela-rolagem { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 14px/1.3 var(--cond); color: var(--muted); }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
td.num, th.num { text-align: right; }

/* mensagens */
.mensagens { list-style: none; padding: 0; margin: 0 0 12px; }
.mensagens li { padding: 10px 14px; border-radius: 8px; margin-bottom: 6px; background: var(--accent-soft); }
.mensagens li.success { background: var(--ok-soft); color: var(--ok); }
.mensagens li.error { background: var(--bad-soft); color: var(--bad); }
.mensagens li.warning { background: var(--warn-soft); color: var(--warn); }

/* quadro de arrastar */
.quadro { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.coluna { background: var(--surface-2); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.coluna.portao { box-shadow: inset 0 4px 0 var(--accent); }
.coluna > header { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 8px; font: 600 16px/1.2 var(--cond); }
.coluna.solta { outline: 2px dashed var(--accent); }
.coluna > header span:first-child { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; font-size: 13px; }
label.botao:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff !important; }
label.botao input[type=radio] { accent-color: #fff; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px;
  text-decoration: none; color: inherit; }
.card:hover { border-color: var(--accent); }
.card .titulo { font-weight: 600; }
.card[draggable=true] { cursor: grab; }

/* etapas do ambiente: uma trena. Amarelo = já medido até aqui; o cursor grafite é onde o ambiente está;
   cinza = fita ainda dentro da caixa. Portão = marca azul embaixo. */
.etapas { display: grid; grid-template-columns: repeat(10, 1fr); gap: 0; margin: 14px 0 18px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--trena-escura); }
.etapa { font: 600 12.5px/1.2 var(--cond); text-align: center; padding: 16px 4px 8px; color: var(--muted); position: relative;
  background:
    linear-gradient(90deg, rgba(43,35,0,.45) 1px, transparent 1px) 0 0 / 8px 6px repeat-x,
    linear-gradient(90deg, rgba(43,35,0,.65) 1px, transparent 1px) 0 0 / 40px 11px repeat-x,
    var(--surface-2);
  border-right: 1px solid rgba(43,35,0,.25); }
.etapa:last-child { border-right: 0; }
.etapa.feita { background:
    linear-gradient(90deg, rgba(43,35,0,.45) 1px, transparent 1px) 0 0 / 8px 6px repeat-x,
    linear-gradient(90deg, rgba(43,35,0,.7) 1px, transparent 1px) 0 0 / 40px 11px repeat-x, var(--trena); color: var(--trena-tinta); }
.etapa.atual { background:
    linear-gradient(90deg, rgba(242,194,48,.55) 1px, transparent 1px) 0 0 / 8px 6px repeat-x, var(--fg); color: var(--trena); font-weight: 700; }
.etapa.portao::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }
.etapa.atual.portao::after { background: var(--trena); }
@media (prefers-color-scheme: dark) and (min-width: 1000px) { .etapa.atual { background: #f2f4f4; color: #15191b; } }

/* ---------- agenda ---------- */
.agenda-item { display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: start; text-decoration: none; color: inherit; }
.agenda-item .hora { font: 700 24px/1.1 var(--cond); }
.agenda-item { border-left: 4px solid var(--line); }
.agenda-item:has(.tipo-medicao) { border-left-color: var(--ok); }
.agenda-item:has(.tipo-reuniao) { border-left-color: var(--accent); }
.agenda-item:has(.tipo-visita), .agenda-item:has(.tipo-montagem) { border-left-color: var(--warn); }
.agenda-item.feito { opacity: .6; }
.chip.tipo-medicao { background: var(--ok-soft); color: var(--ok); }
.chip.tipo-reuniao { background: var(--accent-soft); color: var(--accent); }
.chip.tipo-montagem, .chip.tipo-visita { background: var(--warn-soft); color: var(--warn); }

/* ---------- medição no celular ---------- */
.med-secao { margin-bottom: 12px; }
.med-secao h2 { margin-top: 0; }
.med-apto { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.med-apto > span { flex: 1 1 180px; }
.segmentos { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmentos label { margin: 0; padding: 10px 14px; min-width: 56px; text-align: center; color: var(--fg); font-size: 15px; font-weight: 600; cursor: pointer; border-left: 1px solid var(--line); }
.segmentos label:first-child { border-left: 0; }
.segmentos input { position: absolute; opacity: 0; pointer-events: none; }
.segmentos label:has(input[value=sim]:checked) { background: var(--ok); color: #fff; }
.segmentos label:has(input[value=nao]:checked) { background: var(--bad); color: #fff; }
.segmentos label:has(input[value=na]:checked) { background: var(--muted); color: #fff; }
.segmentos label:has(input[value=ok]:checked) { background: var(--ok); color: #fff; }
.segmentos label:has(input[value=problema]:checked) { background: var(--bad); color: #fff; }
.segmentos label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.med-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.med-item select { min-height: 44px; }
.med-nome { font-weight: 700; font-size: 18px; width: 120px; }
.med-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 10px; margin-top: 8px; }
.med-grade .campo { margin-bottom: 8px; }
.med-grade input { width: 100%; font-size: 18px; min-height: 44px; }
.med-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.med-foto { margin: 0; }
.med-foto img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: var(--surface-2); }
.med-foto input { width: 100%; margin: 6px 0; }
.med-rodape { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); z-index: 5; }
.editor { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.editor[hidden] { display: none; }
.editor canvas { touch-action: none; max-width: 100%; }
.editor-topo, .editor-base { width: 100%; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px max(8px, env(safe-area-inset-left)); color: #fff; background: #111; }
.editor-base { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.editor-base input { flex: 1; min-width: 0; font-size: 20px; min-height: 48px; }
.editor button { min-height: 48px; }

.fotos-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.fotos-item { margin: 0; text-align: center; }
.fotos-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.fotos-item button { margin-top: 4px; min-height: 36px; }

/* ---------- lista de entrega ---------- */
.entrega-grupo { margin-bottom: 12px; }
.entrega-grupo h2 { margin-top: 0; }
.entrega-grupo.aviso { border-color: var(--warn); background: var(--warn-soft); }
.entrega-linha { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.entrega-linha:first-of-type { border-top: 0; }
.entrega-linha .qtd { font: 700 24px/1.1 var(--cond); text-align: right; }
.entrega-linha.separado .desc > div:first-child { color: var(--muted); }
.entrega-linha .marcas { display: flex; flex-direction: column; gap: 6px; }
button.marca { min-height: 44px; min-width: 96px; }
button.marca.feito { background: var(--ok); border-color: var(--ok); color: #fff; }
@media (max-width: 520px) { .entrega-linha { grid-template-columns: 48px 1fr; } .entrega-linha .marcas { grid-column: 2; flex-direction: row; } }

@media (max-width: 700px) { .etapas { grid-template-columns: repeat(5, 1fr); } }
.falta li { color: var(--warn); }

/* plano da chapa */
.plano { width: 100%; max-height: 72vh; background: var(--surface); border-radius: var(--radius); }
.plano-chapa { fill: var(--surface-2); stroke: var(--muted); stroke-width: 4; }
.plano-zero { fill: var(--bad); }
.plano-zero-txt { fill: var(--bad); font-size: 48px; font-weight: 700; }
.plano-peca rect { fill: var(--surface); stroke: var(--fg); stroke-width: 5; }
.plano-peca text { fill: var(--fg); font-weight: 700; }
.plano-peca.colada rect { fill: var(--ok-soft); stroke: var(--ok); }
.plano-peca.proxima rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 10; }
.plano-peca { cursor: pointer; }

/* módulo explodido */
.explodido { width: 100%; max-height: 60vh; }
.exp-peca polygon { stroke: var(--muted); stroke-width: 2; vector-effect: non-scaling-stroke; }
.exp-peca .f0 { fill: var(--surface); } .exp-peca .f1 { fill: var(--surface-2); } .exp-peca .f2 { fill: var(--line); }
.exp-peca { opacity: .55; }
.exp-peca.acesa { opacity: 1; }
.exp-peca.acesa polygon { stroke: var(--accent); stroke-width: 3; }
.exp-peca.acesa .f0 { fill: #9cc0f5; } .exp-peca.acesa .f1 { fill: #5f95e6; } .exp-peca.acesa .f2 { fill: #3b78d6; }

/* abas do QR */
.abas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.abas a { text-align: center; padding: 12px 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: var(--fg); font-weight: 600; font-size: 14px; }
.abas a.ativa { background: var(--accent); color: #fff; border-color: var(--accent); }

/* app do montador e tablet: botões de polegar */
.acoes-grandes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sync { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px max(16px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom));
  background: var(--fg); color: var(--bg); font-size: 14px; display: none; z-index: 30; }
.sync.mostrar { display: block; }
.assinatura { width: 100%; height: 180px; background: #fff; border: 1px solid var(--line); border-radius: 8px; touch-action: none; }
.leitor video { width: 100%; max-height: 50vh; border-radius: var(--radius); background: #000; }
.resultado { font-size: 18px; font-weight: 600; padding: 14px; border-radius: var(--radius); margin-top: 10px; }
.resultado.ok { background: var(--ok-soft); color: var(--ok); }
.resultado.ruim { background: var(--bad-soft); color: var(--bad); }
.tablet .botao, .tablet button { min-height: 52px; font-size: 16px; }
.miniatura { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; }

/* barra de "esperando sinal" não cobre o botão de concluir */
body.com-menu .med-rodape { bottom: var(--abas-h); }
body.com-sync .med-rodape { bottom: calc(var(--abas-h) + 44px); }
body.com-sync main { padding-bottom: 140px; }
.erro-envio { padding: 10px 14px; border-radius: 8px; margin-bottom: 6px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
#rascunho.erro { color: var(--bad); font-weight: 600; }
/* alvo de toque: dedo com luva na obra e na oficina */
button, .botao { min-height: 44px; }
.fotos-item button { min-height: 44px; }
.small button, button.small { min-height: 44px; }

/* Tema escuro: texto escuro sobre os fundos claros (contraste ≥ 4,5:1) */
@media (prefers-color-scheme: dark) and (min-width: 1000px) {
  .botao.principal, button.principal, .etapa.atual, button.marca.feito, .abas a.ativa,
  .segmentos label:has(input:checked), label.botao:has(input:checked), .fotos-botao { color: #0b0c0e !important; }
}

@media (max-width: 700px) { h1 { font-size: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .topo, .nao-imprimir, .sync { display: none !important; } body { background: #fff; } main { padding: 0; } }
.etapa b { display: block; font: 700 20px/1 var(--cond); margin-bottom: 2px; }
.etapa span { display: block; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .etapas { grid-template-columns: repeat(5, 1fr); } .etapa:nth-child(5) { border-right: 0; }
  .etapa:nth-child(-n+5) { border-bottom: 1px solid rgba(43,35,0,.25); } }

/* ===================== regra de cor (pesquisa "Telas dos sistemas de marcenaria") =====================
   Amarelo-trena: só progresso (fita das etapas, aba ativa). Atenção: âmbar + triângulo + palavra.
   Erro: vermelho + ícone. Feito: cinza com ✓ (cor só para o que está fora do normal — ISA-101). */
:root { --warn: #b0560a; --warn-soft: #fdeedd; }
.chip.ok { background: var(--surface-2); color: var(--fg); }
.chip.ok::before { content: "✓ "; font-weight: 700; }
.chip.aviso::before, .falta li::marker { content: "⚠ "; }
.chip.ruim::before { content: "✕ "; }
.entrega-grupo.aviso { background: var(--warn-soft); border-color: var(--warn); }
.entrega-grupo.aviso h2::before { content: "⚠ "; color: var(--warn); }
.mensagens li.success { background: var(--surface-2); color: var(--fg); }
.mensagens li.success::before { content: "✓ "; font-weight: 700; }
.mensagens li.warning::before { content: "⚠ "; }
.mensagens li.error::before { content: "✕ "; font-weight: 700; }
button.marca.feito { background: var(--fg); border-color: var(--fg); color: var(--surface); }
button.marca.feito::before { content: "✓ "; }
.resultado.ok { background: var(--surface-2); color: var(--fg); }
.resultado.ok::before { content: "✓ "; }
.segmentos label:has(input[value=sim]:checked), .segmentos label:has(input[value=ok]:checked) { background: var(--fg); color: var(--surface); }
.segmentos label:has(input[value=sim]:checked)::before, .segmentos label:has(input[value=ok]:checked)::before { content: "✓ "; }
.segmentos label:has(input[value=nao]:checked)::before, .segmentos label:has(input[value=problema]:checked)::before { content: "✕ "; }
.plano-peca.colada rect { fill: var(--surface-2); stroke: var(--muted); }

/* medição: Sim/Não/N.A. ocupam a largura, alvo ≥ 48 px */
.segmentos { display: flex; width: 100%; }
.segmentos label { flex: 1; min-height: 52px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.med-apto > span { flex-basis: 100%; }

/* ---------- painel: radar em três faixas + fita-resumo ---------- */
.radar { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.radar-faixa { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.radar-faixa h2 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.radar-qtd { margin-left: auto; font: 700 20px/1 var(--cond); }
.radar-icone { width: 12px; height: 12px; border-radius: 3px; background: var(--muted); }
.radar-atrasado { border-top: 4px solid var(--bad); }
.radar-atrasado .radar-icone { background: var(--bad); transform: rotate(45deg); }
.radar-hoje { border-top: 4px solid var(--warn); }
.radar-hoje .radar-icone { background: var(--warn); border-radius: 50%; }
.radar-cinco { border-top: 4px solid var(--line); }
.radar-item { display: block; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--fg); }
.radar-item:first-of-type { border-top: 0; }
.radar-item b { display: block; font-weight: 600; }
.radar-item span { color: var(--muted); font-size: 14px; }
.radar-item:hover b { color: var(--accent); }
.fita-resumo { display: grid; grid-template-columns: repeat(9, 1fr); border: 1px solid var(--trena-escura); border-radius: 6px; overflow: hidden; }
.fita-resumo a { padding: 14px 6px 8px; text-align: center; text-decoration: none; color: var(--trena-tinta); position: relative;
  background: linear-gradient(90deg, rgba(43,35,0,.45) 1px, transparent 1px) 0 0 / 8px 6px repeat-x, var(--trena);
  border-right: 1px solid rgba(43,35,0,.25); }
.fita-resumo a:last-child { border-right: 0; }
.fita-resumo a b { display: block; font: 700 24px/1 var(--cond); }
.fita-resumo a span { display: block; font: 600 12px/1.2 var(--cond); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fita-resumo a.vazio { background: linear-gradient(90deg, rgba(43,35,0,.3) 1px, transparent 1px) 0 0 / 8px 6px repeat-x, var(--surface-2); color: var(--muted); }
.fita-resumo a.vazio b { opacity: .45; }
.fita-resumo a.portao::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }
@media (max-width: 759px) { .fita-resumo { grid-template-columns: repeat(3, 1fr); } .fita-resumo a { border-bottom: 1px solid rgba(43,35,0,.25); } }
.contadores { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.contadores a { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; text-decoration: none; color: var(--muted); font-size: 14px; }
.contadores a b { color: var(--fg); font: 700 16px/1 var(--cond); margin-right: 2px; }
.contadores a:hover { border-color: var(--accent); }

/* ---------- menu agrupado; Sair no "Mais" do celular ---------- */
.menu-sep { display: block; height: 1px; background: rgba(255,255,255,.12); margin: 6px 10px; flex: none; }
@media (max-width: 999px) { .menu-sep { width: 1px; height: auto; margin: 6px 4px; } }
.sair-mais { grid-column: 1 / -1; margin-top: 4px; }
.sair-mais button { width: 100%; justify-content: center; color: var(--bad); border-color: var(--line); min-height: 48px; }
@media (max-width: 759px) { .topo form.sair:not(.sair-mais) { display: none; } }
@media (min-width: 760px) { .sair-mais { display: none; } }

/* ---------- tablet da router em modo terminal: sem menu do escritório, ações grandes embaixo ---------- */
body.terminal { padding-left: 0 !important; }
body.terminal .topo, body.terminal .barra-abas { display: none !important; }
body.terminal main { max-width: none; padding-bottom: 140px; }
.barra-terminal { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: flex; gap: 12px; justify-content: flex-end;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(20,25,27,.08); }
.barra-terminal form { flex: 1; max-width: 360px; }
.barra-terminal button { width: 100%; min-height: 80px; font-size: 22px; border-radius: 12px; justify-content: center; }
body.terminal.com-sync .barra-terminal { bottom: 44px; }

/* aviso de sinal: neutro, com ícone (sem sinal não é erro) */
.sync { background: var(--accent-soft); color: var(--fg); border-top: 1px solid var(--line); font-weight: 600; }
.sync::before { content: ""; display: inline-block; width: 18px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-radius: 8px 8px 4px 4px; opacity: .7; }

/* botão de arquivo comum em português (o navegador em inglês mostraria "Choose File") */
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--fg); border-radius: 8px; padding: 8px 12px; margin-right: 10px; min-height: 44px; cursor: pointer; }

/* agenda: visão semana (segunda a domingo); feito fica riscado */
.visao { margin: 4px 0 14px; }
.visao .botao.ativo { background: var(--fg); color: var(--surface); border-color: var(--fg); }
.semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.semana-dia { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 160px; }
.semana-dia h3 { margin: 0 0 6px; font: 600 15px/1.2 var(--cond); text-transform: capitalize; }
.semana-dia.hoje { box-shadow: inset 0 4px 0 var(--trena); }
.semana-item { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 6px 8px; margin-bottom: 6px; border-radius: 6px;
  background: var(--bg); text-decoration: none; color: var(--fg); font-size: 14px; }
.semana-item .hora { font: 700 16px/1 var(--cond); }
.agenda-item.feito { opacity: .65; text-decoration: line-through; }
@media (max-width: 899px) { .semana { grid-template-columns: 1fr; } .semana-dia { min-height: 0; } }
body.terminal .plano { max-height: calc(100vh - 140px); }
.plano-peca text { paint-order: stroke; stroke: var(--surface); stroke-width: 10px; stroke-linejoin: round; }
.novidades { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 14px; font-size: 15px; }
.novidades ul { margin: 6px 0 8px; padding-left: 20px; }
.etapa.portao b::after { content: " 🔒"; font-size: 12px; vertical-align: 3px; }

/* Lista de caixas (responsáveis, ambientes) */
.multipla label { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--fg); font-weight: 400; }
.multipla input { width: 20px; height: 20px; }
/* Recados */
a.recado-item { display: block; text-decoration: none; color: inherit; margin-bottom: 10px; }
a.recado-item:hover { border-color: var(--accent); }
.recado-item > div + div { margin-top: 4px; }
.tarefa.atrasada b { color: var(--warn); }
.multipla div { margin: 0; padding: 0; gap: 0; }

/* campo de senha com o botão Mostrar/Esconder */
.caixa-senha { display: flex; gap: 6px; align-items: stretch; width: 100%; }
.caixa-senha input { flex: 1; min-width: 0; }
.olho-senha { flex: none; padding: 0 12px; font-size: 14px; }

/* Digital e senha: no computador ficam na barra do lado; no celular e tablet estão no "Mais". */
.topo .link-conta { display: none; }
@media (min-width: 1000px) { .topo .link-conta { display: block; text-align: center; margin: 6px 0; color: #cfe3ea; } }
