/* Layout: ficha de campo em coluna única para celular. Cabeçalho fixo com o pavimento em conferência e a situação,
   abas das partes (Antes, 0, A, B, C, Relatório). Nas partes por apartamento, matriz com Apto 01 a 05 + PAVTO por item.
   Cor: azul-aço como acento; verde, vermelho e cinza só para V, X e NA. */
:root {
  --bg: #e9edf0;
  --surface: #ffffff;
  --surface2: #f2f5f7;
  --ink: #17232d;
  --ink2: #52626e;
  --line: #d3dbe1;
  --accent: #17598c;
  --accent-ink: #ffffff;
  --ok-bg: #d3efdc;
  --ok-ink: #12603a;
  --bad-bg: #fadadd;
  --bad-ink: #9b1c2b;
  --na-bg: #e1e5e8;
  --na-ink: #46535c;
  --warn-bg: #fdf0c9;
  --warn-ink: #6f5105;
  --f-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "IBM Plex Sans", Arial, Helvetica, sans-serif;
  --f-mono: "IBM Plex Mono", "Courier New", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1519; --surface: #182026; --surface2: #1f2a31; --ink: #e6edf1; --ink2: #9fb0bb;
    --line: #2c3a43; --accent: #6bb4e8; --accent-ink: #07202f;
    --ok-bg: #17402b; --ok-ink: #8fe0b0; --bad-bg: #4a1e24; --bad-ink: #ffb0b8;
    --na-bg: #2a343b; --na-ink: #a7b4bd; --warn-bg: #46380c; --warn-ink: #f2d37a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1519; --surface: #182026; --surface2: #1f2a31; --ink: #e6edf1; --ink2: #9fb0bb;
  --line: #2c3a43; --accent: #6bb4e8; --accent-ink: #07202f;
  --ok-bg: #17402b; --ok-ink: #8fe0b0; --bad-bg: #4a1e24; --bad-ink: #ffb0b8;
  --na-bg: #2a343b; --na-ink: #a7b4bd; --warn-bg: #46380c; --warn-ink: #f2d37a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 40px;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
#app { max-width: 640px; margin: 0 auto; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: .01em; margin: 0; text-wrap: balance; }
.mono { font-family: var(--f-mono); font-weight: 500; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* cabeçalho */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px))); padding: 10px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 640px; margin: 0 auto; }
.top h1 { font-size: 26px; line-height: 1.05; }
.top .sub { font-size: 13px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 8px 4px 8px 0; min-height: 40px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.head-row > div { min-width: 0; }
.tabs { display: flex; gap: 0; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; border: 0; background: none; padding: 10px 8px; min-height: 44px; font-weight: 600; color: var(--ink2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; background: var(--line); }
.dot.s-ok { background: var(--ok-ink); } .dot.s-bad { background: var(--bad-ink); } .dot.s-wip { background: var(--warn-ink); }

main { padding-top: 16px; display: flex; flex-direction: column; gap: 14px; }

/* pílulas de situação */
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; letter-spacing: .03em; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill.wip { background: var(--warn-bg); color: var(--warn-ink); }
.pill.idle { background: var(--na-bg); color: var(--na-ink); }

/* blocos */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.card.flat { background: var(--surface2); }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.part-head h2 { font-size: 22px; }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cnt { font-family: var(--f-mono); font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.cnt.v { background: var(--ok-bg); color: var(--ok-ink); } .cnt.x { background: var(--bad-bg); color: var(--bad-ink); }
.cnt.na { background: var(--na-bg); color: var(--na-ink); } .cnt.b { background: var(--warn-bg); color: var(--warn-ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 8px; min-height: 40px; font-weight: 600; color: var(--ink2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* seletor de coluna (modo por apartamento) */
.cols { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.colbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 2px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.colbtn b { font-size: 13px; font-weight: 600; }
.colbtn i { font-style: normal; font-size: 11px; color: var(--ink2); font-family: var(--f-mono); }
.colbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.colbtn[aria-pressed="true"] i { color: var(--accent-ink); }
.colbtn.has-x { box-shadow: inset 0 -3px 0 var(--bad-ink); }
.colbtn[disabled] { opacity: .45; }

/* itens */
.item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.item.is-x { border-color: var(--bad-ink); }
.item-top { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
.num { font-family: var(--f-mono); font-weight: 500; color: var(--ink2); padding-top: 1px; }
.item-text { font-weight: 500; }
.crit { margin-top: 4px; font-size: 13px; color: var(--ink2); }
.crit b { color: var(--ink); font-weight: 600; }
.tag { display: inline-block; font-family: var(--f-mono); font-size: 11px; background: var(--surface2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; margin-left: 4px; color: var(--ink2); }
.vxna { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rb { border: 2px solid var(--line); background: var(--surface); border-radius: 10px; min-height: 48px; font-weight: 600; font-size: 17px; }
.rb[aria-pressed="true"].v { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }
.rb[aria-pressed="true"].x { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-ink); }
.rb[aria-pressed="true"].na { background: var(--na-bg); color: var(--na-ink); border-color: var(--na-ink); }
/* matriz: 6 colunas por item */
.grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.cell { border: 2px solid var(--line); background: var(--surface); border-radius: 8px; min-height: 56px; padding: 4px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.cell small { font-size: 10.5px; color: var(--ink2); font-family: var(--f-mono); }
.cell b { font-size: 18px; font-weight: 600; line-height: 1.1; }
.cell.v { background: var(--ok-bg); border-color: var(--ok-ink); color: var(--ok-ink); }
.cell.x { background: var(--bad-bg); border-color: var(--bad-ink); color: var(--bad-ink); }
.cell.na { background: var(--na-bg); border-color: var(--na-ink); color: var(--na-ink); }
.cell.v small, .cell.x small, .cell.na small { color: inherit; }
.cell.off { opacity: .55; border-style: dashed; }
.cell.pav { border-width: 3px; }
.legend { font-size: 12px; color: var(--ink2); }
textarea, input[type="text"] { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; min-height: 64px; }
textarea.one { min-height: 44px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 6px 0; text-align: left; min-height: 36px; }
.reins { font-size: 13px; color: var(--ok-ink); background: var(--ok-bg); border-radius: 6px; padding: 4px 8px; }

/* botões */
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 10px 16px; min-height: 46px; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: transparent; color: var(--bad-ink); border-color: var(--bad-ink); }
.btn[disabled] { opacity: .5; cursor: default; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow .btn { flex: 1 1 140px; }

/* seleção de obra e pavimento */
.obras { display: flex; gap: 6px; flex-wrap: wrap; }
.obrabtn { border: 2px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 16px; min-height: 46px; font-weight: 600; }
.obrabtn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.pavgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pavbtn { border: 2px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 6px; min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.pavbtn b { font-size: 15px; font-weight: 600; }
.pavbtn span { font-size: 11px; font-family: var(--f-mono); }
.pavbtn.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }
.pavbtn.bad { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-ink); }
.pavbtn.wip { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.pavgroup { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); margin: 6px 0 -2px; }
.ficha-link { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.empty { text-align: center; padding: 28px 16px; }
.empty h2 { font-size: 22px; margin-bottom: 6px; }
.hero { padding: 22px 0 6px; }
.hero h1 { font-size: 34px; line-height: 1.05; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px 6px 8px; min-height: 48px; text-align: left; width: 100%; }
.check .box { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.check[aria-pressed="true"] .box { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }
.nc { border-left: 4px solid var(--bad-ink); background: var(--surface); border-radius: 6px; padding: 10px 12px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.nc.closed { border-left-color: var(--ok-ink); }
pre.rep { white-space: pre-wrap; word-break: break-word; font-family: var(--f-mono); font-size: 12px; background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; user-select: all; }
table.sum { width: 100%; border-collapse: collapse; font-size: 14px; }
table.sum td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.sum td:last-child { text-align: right; }
.sig { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: end; }
.sig .d { font-family: var(--f-mono); font-size: 12px; color: var(--ink2); padding-bottom: 12px; }
details.card > summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
details.card[open] > summary { margin-bottom: 8px; }
dl.regras { margin: 0; display: grid; gap: 8px; }
dl.regras dt { font-weight: 600; font-size: 13px; }
dl.regras dd { margin: 0; font-size: 14px; color: var(--ink2); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.th { position: relative; display: inline-block; }
.th img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.th button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--bad-ink); color: var(--surface); font-weight: 700; line-height: 1; }
.btn.sm { min-height: 34px; padding: 5px 14px; font-size: 13px; border-radius: 8px; }
.notabtns { gap: 8px; }
.notabtns .btn { flex: 0 0 auto; }
.nota { display: flex; flex-direction: column; gap: 8px; }
.nota-t { font-size: 14px; line-height: 1.4; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.dica { font-size: 12px; color: var(--ink2); }
.dica summary { cursor: pointer; padding: 2px 0; }
.fotobtn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; align-self: flex-start; }
.lock { background: var(--bad-bg); color: var(--bad-ink); border: 2px solid var(--bad-ink); border-radius: 10px; padding: 14px; }
.lock h2 { font-size: 22px; margin-bottom: 6px; }
.aptnc { border: 1px solid var(--line); border-left: 4px solid var(--na-ink); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface2); }
.aptnc.bad { border-left-color: var(--bad-ink); }
.aptnc-h { font-weight: 600; font-size: 14px; }
.aptnc.bad .aptnc-h { color: var(--bad-ink); }
.ov { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow: auto; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.ovin { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.pad { width: 100%; height: 160px; background: #fff; border: 2px dashed var(--line); border-radius: 10px; touch-action: none; display: block; }
.libok { background: var(--ok-bg); color: var(--ok-ink); border: 2px solid var(--ok-ink); border-radius: 10px; padding: 14px; }
.libok h2 { font-size: 22px; margin-bottom: 4px; }
.atalhos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0 10px; }
.atalho { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 10px 6px 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; font-size: 12.5px; font-weight: 600; color: var(--ink); min-width: 0; }
.atalho svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.atalho span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atalho i { position: absolute; top: 6px; right: 6px; font-style: normal; font-family: var(--f-mono); font-size: 10.5px; line-height: 16px; min-width: 18px; text-align: center; background: var(--surface2); border: 1px solid var(--line); border-radius: 99px; padding: 0 5px; color: var(--ink2); }
.lemb { border: 1px solid var(--line); border-left: 4px solid var(--warn-ink); background: var(--surface); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.lemb.res { border-left-color: var(--ok-ink); opacity: .85; }
.lemb-t { font-weight: 500; }
.pinlemb { font-size: 10.5px; font-family: var(--f-mono); color: var(--warn-ink); background: var(--warn-bg); border-radius: 99px; padding: 0 6px; margin-top: 2px; }
.pill.warnp { background: var(--warn-bg); color: var(--warn-ink); }
.pill.tp-i { background: var(--accent); color: var(--accent-ink); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.lembfiltro .obrabtn { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.lemb .btnrow { justify-content: flex-end; gap: 8px; margin-top: 2px; }
.lemb .btnrow .btn { flex: 0 0 auto; min-height: 38px; padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.tipos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tipos .obrabtn { padding: 10px 6px; text-align: center; font-size: 14px; }
.tpdica { font-size: 12.5px; color: var(--ink2); margin-top: -4px; }
@media (max-width: 420px) { .atalhos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.atalhos.home { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.atalhos.home .atalho { min-height: 96px; font-size: 15px; gap: 8px; }
.atalhos.home .atalho svg { width: 28px; height: 28px; }
.atalhos.home .atalho.big { grid-column: 1 / -1; min-height: 110px; font-size: 17px; background: var(--accent); color: #fff; border-color: var(--accent); }
.atalhos.home .atalho.big svg { stroke: #fff; width: 32px; height: 32px; }
.atalhos.home .atalho.big i { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.medkpi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.medkpi div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface2); }
.medkpi small { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.medkpi b { font-size: 24px; font-family: var(--f-mono); }
.medrow { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.medrow:first-child { border-top: 0; }
.medrow .pct { font-family: var(--f-mono); font-weight: 700; white-space: nowrap; }
.medrow.auto .pct { color: var(--ok-ink); }
.ovrel { padding: 0; display: flex; flex-direction: column; }
.ovbar { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ovbar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovbar .btn { min-height: 40px; padding: 6px 12px; flex: none; }
.relframe { flex: 1; width: 100%; border: 0; background: #fff; }
.multisel { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-top: 4px; }
.msbtn { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 10px 12px; border: 0; background: none; font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); text-align: left; }
.msbtn i { font-style: normal; font-size: 11px; color: var(--ink2); }
.mslist { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow: auto; }
.f select { font: inherit; font-size: 16px; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); width: 100%; }
.pctcol { text-align: right; white-space: nowrap; padding-left: 10px; }
.pctcol small { display: block; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink2); }
.pctcol b { font-size: 17px; }
.pctcol.med b { color: var(--accent); }
.arq > summary { justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.arqrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.arqinfo { flex: 1; min-width: 0; }
.arqinfo .pill { margin-left: 4px; font-size: 10.5px; padding: 2px 8px; }
.arqbtn { min-height: 40px; padding: 6px 14px; flex: none; }
.rede { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(72px + env(safe-area-inset-bottom, 0px)); text-align: center; z-index: 45; padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.rede.off { background: var(--bad-bg); color: var(--bad-ink); border: 1px solid var(--bad-ink); }
.rede.env { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-ink); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 40; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: no-preference) { .bar > span { transition: width .25s; } }

/* Leitor de PEs (manuais): tela por cima do app, só leitura */
.peov { position: fixed; inset: 0; z-index: 60; overflow: auto; background: #e9ecf0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: contain; }
.pe-aberto, .pe-aberto body { overflow: hidden; }
.pebar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px; background: var(--surface, #fff); border-bottom: 1px solid var(--line, #ddd); }
.petit { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.pemsg { padding: 24px 16px; text-align: center; color: var(--muted, #666); }
.pemsg.erro { color: var(--bad-ink, #a00); }
.pepags { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 6px calc(40px + env(safe-area-inset-bottom, 0px)); transition: filter .15s; }
.pepag { width: 100%; max-width: 900px; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
.pepag canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.peov.pe-borrado .pepags { filter: blur(24px); }
@media print { .peov { display: none !important; } }

/* ---------- Tela inicial (logo, principal e grupos) ---------- */
.home { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; padding: 10px 0 28px; }
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-top img { height: 34px; width: auto; display: block; }
.home .who { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink2); min-width: 0; }
.home .who i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok-ink); flex: none; }
.home .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home .titulo h1 { font-size: 34px; line-height: 1.05; }
.home .titulo p { margin: 6px 0 0; color: var(--ink2); }
.home h2 { font-family: var(--f-body); font-weight: 600; font-size: 12px; line-height: 1; letter-spacing: .09em; text-transform: uppercase; color: var(--ink2); margin: 0 0 10px; }
.home .grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home .item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 96px; padding: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; font: 600 15px/1.2 var(--f-body); text-align: center; cursor: pointer; }
.home .item:active { transform: scale(.98); }
.home .item svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.home .item b { display: block; font-weight: 600; }
.home .item .n { position: absolute; top: 10px; right: 10px; font-family: var(--f-mono); font-size: 11px; line-height: 18px; min-width: 20px; text-align: center; background: var(--surface2); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; color: var(--ink2); }
.home .grade .item:last-child:nth-child(odd) { grid-column: 1 / -1; }
.home .item.principal { width: 100%; min-height: 120px; padding: 18px; font-size: 19px; gap: 12px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.home .item.principal svg { stroke: var(--accent-ink); width: 38px; height: 38px; }
.home .item.principal .n { background: rgba(255,255,255,.2); border-color: transparent; color: var(--accent-ink); }
.home { padding-bottom: 64px; }
.home-rodape { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--ink2); }
.home-rodape button { border: 0; background: none; padding: 8px 4px; min-height: 36px; font: inherit; color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.home-rodape span { font-family: var(--f-mono); opacity: .7; }
.peq { width: 100%; box-sizing: border-box; font-size: 16px; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: inherit; }
.peq:focus { outline: none; border-color: var(--accent, #4aa3ff); }
.pe-res { display: flex; flex-direction: column; gap: 8px; }
.peres { text-align: left; }
.pesnip { font-size: 13px; line-height: 1.4; margin-top: 6px; color: inherit; opacity: .8; font-weight: 400; }
.pesnip mark { background: #ffd600; color: #000; border-radius: 3px; padding: 0 2px; }
.pebar { flex-wrap: wrap; }
.pelupa { border: 1px solid var(--line, #ccc); background: var(--surface, #fff); color: inherit; border-radius: 8px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.pebusca { flex-basis: 100%; display: flex; align-items: center; gap: 6px; padding-top: 6px; }
.pebusca[hidden], .pelupa[hidden] { display: none; }
.pebusca input { flex: 1 1 80px; width: 0; min-width: 0; font-size: 16px; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--line, #ccc); background: #fff; color: #111; -webkit-user-select: text; user-select: text; }
.pebusca button { flex: none; border: 1px solid var(--line, #ccc); background: var(--surface, #fff); color: inherit; border-radius: 8px; width: 36px; height: 38px; font-size: 20px; line-height: 1; }
.pecont { flex: none; font-size: 12px; white-space: nowrap; color: var(--muted, #666); }
.cam-aberto, .cam-aberto body { overflow: hidden; }
.camov { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; flex-direction: column; }
.camvid, .camfoto { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; display: block; }
.camvid[hidden], .camfoto[hidden], .cambar[hidden], .cammsg[hidden] { display: none; }
.cammsg { position: absolute; left: 0; right: 0; top: 40%; text-align: center; color: #fff; font-size: 15px; }
.cambar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px)); background: #000; }
.camvazio { width: 90px; }
.cambtn { min-width: 90px; padding: 12px 14px; border-radius: 10px; border: 1px solid #666; background: #222; color: #fff; font-size: 15px; font-weight: 600; }
.cambtn-ok { background: #1e7d4a; border-color: #1e7d4a; }
.camshot { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: #e53935; box-shadow: 0 0 0 3px #000 inset; }
.camshot:active { transform: scale(.94); }
.lemb-pavs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.lp { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lp-ok { opacity: .65; }
.lp-n { display: flex; flex-direction: column; min-width: 0; }
.lp-b { display: flex; gap: 6px; flex: none; }
.lemb-pavs + .btnrow .btn { width: 100%; }
.envdlg { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.envbox { background: var(--surface, #fff); color: inherit; border-radius: 14px; padding: 18px; max-width: 360px; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.ovbar .btn { flex: none; }
.lfgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lfsel { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink2); min-width: 0; }
.lfsel select { min-height: 40px; font-size: 14px; border-radius: 8px; width: 100%; min-width: 0; }
.lembfiltro .btn.sm { align-self: flex-start; }
.lfrod { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lfrod .btn.sm { flex: none; }
.lembtit { margin: 6px 2px 0; font-size: 18px; }
.ajudabtn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; background: none; color: var(--ink2, #5a6b7b); font: 600 12px/1 inherit; vertical-align: middle; margin-left: 4px; padding: 0; opacity: .75; position: relative; top: -2px; }
.ajudabtn::after { content: ""; position: absolute; inset: -12px; }
.ajudapend { margin-top: 8px; }
.h1ajuda { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.h1ajuda .ajudabtn { margin-left: 0; }

/* Medições de contrato */
.home .duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home .duo .item.principal { min-height: 120px; padding: 14px 10px; font-size: 17px; }
.home .duo .item.principal svg { width: 34px; height: 34px; }
.pill.mcbad { background: var(--bad-bg); color: var(--bad-ink); }
.mck { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mckpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.mckpi small { display: block; font-size: 11px; color: var(--ink2); }
.mckpi b { display: block; font-size: 20px; }
.mckpi i { font-style: normal; font-size: 11px; color: var(--ink2); }
.mch2 { font-size: 16px; margin: 6px 0 0; }
.mcscroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.mct { border-collapse: collapse; width: 100%; min-width: 860px; font-size: 13px; }
.mct th { background: var(--surface2); font-size: 11px; padding: 6px 8px; text-align: right; white-space: nowrap; }
.mct td { padding: 5px 8px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.mct th:first-child, .mct td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.mct tr.mcg td { background: var(--surface2); font-weight: 700; }
.mct td.mcsv { padding-left: 16px; font-weight: 400; }
.mct tr.mct-t td { font-weight: 700; border-top: 2px solid var(--accent); }
.mct tr.mcprop td { background: var(--warn-bg); font-weight: 700; }
.mct .mcneg { color: var(--bad-ink); font-weight: 600; }
.mct .mcsit { text-align: left; }
.mct input { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: #fff; color: var(--ink); }
.mct input.mcmes { width: 64px; text-align: right; }
.mct input.mcobs { width: 150px; }
.mct input:disabled { background: transparent; border-color: transparent; }
.mcmini { margin-left: 6px; min-height: 28px; padding: 2px 10px; }
.mcacoes { display: flex; flex-direction: column; gap: 8px; }
.banner.mcerr { background: var(--bad-bg); color: var(--bad-ink); }
.banner.mcok { background: var(--ok-bg); color: var(--ok-ink); }

/* Medição no computador: a planilha usa a largura da tela (no celular nada muda) */
@media (min-width: 900px) {
  #app.mcw { max-width: min(1500px, 96vw); padding: 0 24px; }
  .mcw .mck { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mcw .mckpi b { font-size: 26px; }
  .mcw .mct { min-width: 0; font-size: 14px; }
  .mcw .mct th { font-size: 12px; padding: 9px 12px; }
  .mcw .mct td { padding: 7px 12px; }
  .mcw .mct td.mcsv { white-space: normal; }
  .mcw .mct th:first-child, .mcw .mct td:first-child { min-width: 240px; }
  .mcw .mct input.mcmes { width: 84px; }
  .mcw .mct input.mcobs { width: 100%; min-width: 220px; }
  .mcw .mcacoes { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .mcw .mcacoes .btn { width: auto; min-width: 200px; }
}
.mct th:first-child { background: var(--surface2); }

/* campo % do mês: símbolo % dentro; preenchido = fundo verde claro e número preto em negrito */
.mct input { color: #111; }
.mct input::placeholder { color: #8a949c; }
.mct input:disabled { color: var(--ink2); }
.mct .mcpc { position: relative; display: inline-block; }
.mct .mcpc.cheio::after { content: "%"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-weight: 700; color: #000; pointer-events: none; }
.mct .mcpc.cheio input { background: #d8f3dc; border-color: #8fcf9b; color: #000; font-weight: 700; padding-right: 24px; }
.mcmodo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.mct .mcpc.q.cheio::after { content: none; }
.mct .mcpc.q.cheio input { padding-right: 9px; }
.mct .mcconv { display: block; font-size: .72em; color: #555; margin-top: 2px; white-space: nowrap; }
/* cabeçalho da tabela de itens fixo: a tabela rola dentro da própria caixa */
.mcscroll.mcitens { max-height: calc(100vh - 120px); overflow: auto; }
.mcitens .mct thead th { position: sticky; top: 0; z-index: 3; background: var(--surface2); box-shadow: 0 1px 0 var(--line); }
.mcitens .mct thead th:first-child { left: 0; z-index: 4; }

/* Medição no celular: cada item vira um cartão (a tabela larga fica só no computador) */
/* pavimentos que abrem e fecham (computador e celular) */
.mcbar .btn { width: auto; flex: none; }
.mcbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mcitens .mct tr.mcoculta { display: none; }
.mcitens .mct tr.mcg td.c-n { cursor: pointer; user-select: none; }
.mcitens .mct tr.mcg td.c-n::before { content: "▾ "; color: var(--ink2); font-weight: 400; }
.mcitens .mct tr.mcg[data-f="1"] td.c-n::before { content: "▸ "; }
@media (max-width: 700px) {
  .mcscroll.mcitens { max-height: none; overflow: visible; border: 0; background: transparent; border-radius: 0; }
  .mcitens .mct { display: block; min-width: 0; font-size: 14px; }
  .mcitens .mct thead { display: none; }
  .mcitens .mct tbody { display: block; }
  .mcitens .mct tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
  .mcitens .mct td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; position: static; background: none; min-width: 0; font-weight: 600; font-size: 15px; }
  .mcitens .mct td::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 400; color: var(--ink2); }
  .mcitens .mct td.c-n { grid-column: 1 / 5; order: 1; font-size: 15px; font-weight: 700; }
  .mcitens .mct td.c-n::before, .mcitens .mct td.c-t::before { content: none; }
  .mcitens .mct td.c-t { grid-column: 5 / 7; order: 2; text-align: right; }
  .mcitens .mct td.c-t .mcmini { margin: 6px 0 0; min-height: 36px; }
  .mcitens .mct td.c-u { grid-column: 1 / 3; order: 3; }
  .mcitens .mct td.c-q { grid-column: 3 / 7; order: 3; }
  .mcitens .mct td.c-s { grid-column: span 2; order: 4; }
  .mcitens .mct td.c-a { grid-column: span 2; order: 5; }
  .mcitens .mct td.c-d { grid-column: span 2; order: 6; }
  .mcitens .mct td.c-m { grid-column: 1 / 7; order: 7; }
  .mcitens .mct td.c-p { grid-column: 1 / 4; order: 8; }
  .mcitens .mct td.c-o { grid-column: 4 / 7; order: 9; }
  .mcitens .mct td.c-b { grid-column: 1 / 7; order: 10; font-weight: 400; }
  .mcitens .mct .mcpc { display: block; }
  .mcitens .mct input.mcmes { width: 100%; box-sizing: border-box; height: 44px; font-size: 18px; text-align: right; border: 1.5px solid var(--accent); margin-top: 2px; }
  .mcitens .mct input.mcmes:disabled { border-color: var(--line); background: var(--surface2); }
  .mcitens .mct input.mcobs { width: 100%; min-width: 0; box-sizing: border-box; height: 40px; font-size: 14px; margin-top: 2px; border: 1px solid var(--line); }
  .mcitens .mct .mcpc.cheio::after { right: 12px; }
  .mcitens .mct .mcconv { font-size: 12px; text-align: right; margin-top: 4px; }
  .mcitens .mct tr.mcg, .mcitens .mct tr.mct-t { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; background: var(--surface2); padding: 10px 12px; margin-bottom: 8px; }
  .mcitens .mct tr.mct-t { background: var(--surface); border: 2px solid var(--accent); }
  .mcitens .mct tr.mcg td, .mcitens .mct tr.mct-t td { display: none; font-size: 13px; font-weight: 600; }
  .mcitens .mct tr.mcg td.c-n, .mcitens .mct tr.mct-t td.c-n { display: block; flex: 1 1 100%; font-size: 14px; font-weight: 700; }
  .mcitens .mct tr.mcg td[data-l]:not(:empty), .mcitens .mct tr.mct-t td[data-l]:not(:empty) { display: inline-block; }
  .mcitens .mct tr.mcg td::before, .mcitens .mct tr.mct-t td::before { display: inline; margin-right: 4px; }
  .mcitens .mct tr.mcg td.c-n, .mcitens .mct tr.mct-t td.c-n { order: 0; }
  .mcitens .mct tr.mci td.c-n { cursor: pointer; }
  .mcitens .mct tr.mci td.c-n::before { content: "▾ "; display: inline; font-size: 13px; font-weight: 400; color: var(--ink2); }
  .mcitens .mct tr.mci[data-a="0"] td.c-n::before { content: "▸ "; }
  .mcitens .mct tr.mci[data-a="0"] { padding: 10px 12px; }
  .mcitens .mct tr.mci[data-a="0"] td:not(.c-n):not(.c-t) { display: none; }
  .mcitens .mct tr.mcg td.c-n { cursor: pointer; }
  .mcitens .mct tr.mcg td.c-n::before { content: "▾ "; display: inline; font-size: 13px; color: var(--ink2); margin: 0; }
  .mcitens .mct tr.mcg[data-f="1"] td.c-n::before { content: "▸ "; }
  .mctm { min-width: 560px; font-size: 12px; }
}
.usmsg { position: sticky; top: 0; z-index: 5; margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; background: var(--surface2, #eef2f6); color: var(--ink, #111); border: 1px solid var(--line, #cfd8e0); }
.usmsg.erro { background: #fde8e8; color: #8a1c1c; border-color: #f2b8b8; }

/* valores em R$ (Gerente) */
.mcrs,.mckpi small.mcrs{display:block;font-size:11px;font-weight:400;color:#4b5968;white-space:nowrap}
.mct-t .mcrs,.mcg .mcrs{color:inherit;opacity:.85}
.mckpi small.mcrs{font-size:12px;margin-top:2px}
.mchead{display:flex;flex-wrap:wrap;gap:4px 18px;margin-top:4px}
.mclg summary{cursor:pointer;list-style:none}.mclg summary::-webkit-details-marker{display:none}.mclg summary::before{content:'▸ ';color:#4b5968}.mclg[open] summary::before{content:'▾ '}.mclgi{margin-top:8px;padding-top:8px;border-top:1px solid #d9e0e7}
.mcsec>summary{cursor:pointer;list-style:none}.mcsec>summary::-webkit-details-marker{display:none}.mcsec>summary::before{content:'▸ ';color:#4b5968}.mcsec[open]>summary::before{content:'▾ '}.mcsec>.stack,.mcsec>.mcscroll{margin-top:8px}
.mcnav{display:flex;flex-wrap:wrap;gap:8px;width:100%}

/* celular: barra de ações fixa no rodapé (só com medição em andamento) e tabela de medições do Sienge em lista */
@media (max-width: 700px) {
  .mcacoes.mcfix { position: sticky; bottom: 0; z-index: 5; background: #e9edf1; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 12px -8px rgba(0,0,0,.35); flex-direction: row; flex-wrap: wrap; }
  .mcacoes.mcfix .btn { flex: 1 1 140px; }
  .mcacoes.mcfix .small { flex: 1 1 100%; }
  .mctm { min-width: 0; }
  .mctm thead { display: none; }
  .mctm tbody tr { display: block; border: 1px solid #d9e0e7; border-radius: 10px; margin-bottom: 8px; padding: 6px 10px; background: #fff; }
  .mctm tbody tr[hidden] { display: none; }
  .mctm td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .mctm td::before { content: attr(data-l); color: #4b5968; text-align: left; }
}
.mcenv{display:flex;gap:12px;align-items:flex-start;cursor:pointer}
.mcenv input{width:22px;height:22px;margin-top:2px;flex:none}
.mcbtns{display:flex;flex-direction:column;gap:10px}
.mcper{display:grid;grid-template-columns:1fr 1fr;gap:10px}
