/* Nuvem: entrada, indicador de sincronização, aviso de conflito */
.nuvem{display:flex; align-items:center; gap:9px; padding:9px 12px; border-radius:10px; background:rgba(255,255,255,.04); font-size:12px; line-height:1.3; color:rgba(240,232,214,.78);}
.nuvem[hidden]{display:none;}
.nuvem-ic{display:flex; flex-shrink:0;}
.nuvem-ic .ic{width:16px; height:16px;}
.nuvem-txt{flex:1; min-width:0;}
.nuvem[data-estado="ok"] .nuvem-ic{color:#7FC79B;}
.nuvem[data-estado="salvando"] .nuvem-ic,.nuvem[data-estado="conectando"] .nuvem-ic,.nuvem[data-estado="offline"] .nuvem-ic,.nuvem[data-estado="local"] .nuvem-ic{color:#D2B074;}
.nuvem[data-estado="salvando"] .nuvem-ic .ic,.nuvem[data-estado="conectando"] .nuvem-ic .ic{animation:nuvem-gira 1.1s linear infinite;}
.nuvem[data-estado="conflito"] .nuvem-ic,.nuvem[data-estado="erro"] .nuvem-ic{color:#F08A80;}
@keyframes nuvem-gira{to{transform:rotate(360deg);}}
.nuvem button{border:0; background:transparent; color:rgba(233,223,201,.6); cursor:pointer; padding:4px; border-radius:7px; display:flex;}
.nuvem button[hidden]{display:none;}
.nuvem button:hover{color:#fff; background:rgba(255,255,255,.08);}
.nuvem button .ic{width:16px; height:16px;}

/* ---------- tela de entrada ---------- */
.gate{
  position:fixed; inset:0; z-index:1000; display:flex; align-items:center; justify-content:center; padding:24px;
  background:var(--espresso);
}
.gate[hidden]{display:none;}
.gate::before{content:""; position:absolute; inset:0; background:radial-gradient(880px 520px at 18% 12%, rgba(176,141,87,.17), transparent 62%), radial-gradient(700px 420px at 92% 96%, rgba(176,141,87,.10), transparent 60%);}
.gate-card{
  position:relative; width:100%; max-width:420px; padding:38px 38px 30px; border-radius:20px; background:#fff;
  box-shadow:0 40px 90px -30px rgba(0,0,0,.7);
}
.gate-logo{display:block; height:74px; width:auto; margin:0 0 26px -4px;}
.gate-card h1{margin:0 0 8px; font-family:var(--font-display); font-weight:500; font-size:32px; line-height:1.1; letter-spacing:-.015em;}
.gate-sub{margin:0 0 24px; color:var(--muted); font-size:14px; line-height:1.55;}
.gate-card .field{margin-bottom:16px;}
.gate-card .field[hidden]{display:none;}
.gate-msg{min-height:20px; margin:-2px 0 12px; font-size:13px; line-height:1.4;}
.gate-msg.erro{color:var(--bad);}
.gate-msg.ok{color:var(--ok);}
.gate-links{display:flex; justify-content:space-between; gap:12px; margin-top:16px;}
.gate-links[hidden]{display:none;}
.gate-links button{border:0; background:transparent; padding:2px 0; color:var(--gold-dark); font:600 13px var(--font-ui); cursor:pointer;}
.gate-links button:hover{text-decoration:underline;}
.gate-links button[hidden]{display:none;}
.gate-foot{display:flex; align-items:center; gap:8px; margin:24px 0 0; padding-top:18px; border-top:1px solid var(--line); color:var(--muted); font-size:12px;}
.gate-foot .ic{width:15px; height:15px;}
body.gate-aberto .app-shell{visibility:hidden;}

.aviso-botoes{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end;}

/* "Salvar agora" e filtro da lista de salvos */
.btn-ghost-dark{background:rgba(255,255,255,.06); color:#F0E8D6; box-shadow:inset 0 0 0 1px rgba(233,223,201,.22);}
.btn-ghost-dark:hover{background:rgba(255,255,255,.11); color:#fff;}
.btn-ghost-dark.ok{color:#9BD8B0; box-shadow:inset 0 0 0 1px rgba(127,199,155,.55);}
.btn-ghost-dark.aviso{color:#F0C27A; box-shadow:inset 0 0 0 1px rgba(210,176,116,.6);}
.vp-toggle{display:block; width:100%; margin-top:6px; padding:9px 8px; border:0; border-top:1px solid var(--line); background:transparent; color:var(--gold-dark); font:600 12.5px var(--font-ui); cursor:pointer;}
.vp-toggle:hover{text-decoration:underline;}
.vp-tags{display:inline-flex; gap:4px; margin-left:4px;}
.vp-tag{padding:1px 7px; border-radius:999px; background:var(--gold-light); color:var(--gold-dark); font-size:10.5px; font-weight:700;}

.btn-ghost-dark.sujo{color:#F6E3B8; box-shadow:inset 0 0 0 1px rgba(210,176,116,.65);}
.btn-ghost-dark.sujo::after{content:""; width:8px; height:8px; margin-left:2px; border-radius:50%; background:#E8B44E; box-shadow:0 0 0 3px rgba(232,180,78,.25);}

/* painel de vistorias salvas — leitura clara e botões alinhados */
.vistorias-panel .vp-footer{margin-top:8px; padding-top:12px; border-top:1px solid var(--line);}
.vp-actions{display:grid; grid-template-columns:1fr 1fr; gap:8px;}
.vp-actions .btn{width:100%; min-height:38px; padding:0 10px; font-size:12.5px; text-align:center; cursor:pointer;}
.vp-actions input[type=file]{display:none;}
.vp-actions .vp-wide{grid-column:1 / -1;}
.vp-note{margin:12px 2px 2px; font-size:12px; line-height:1.5; color:var(--ink-soft);}
.vistorias-panel .vp-sub{color:var(--muted);}

.mg-info{margin:4px 0 12px; padding:10px 12px; border-radius:10px; background:var(--info-bg); border:1px solid var(--line); font-size:12.5px; line-height:1.55; color:var(--ink-soft);}

/* ---------- prévia do PDF (computador: leitor do navegador · celular: leitor próprio) ---------- */
.pdf-modal{max-width:980px; width:min(96vw,980px); height:min(92vh,920px); height:min(92dvh,920px); padding:16px; display:flex; flex-direction:column; overflow:hidden;}
.pdf-modal .modal-head{margin-bottom:10px; flex-shrink:0;}
.pdf-modal .modal-head h2{font-size:21px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0;}
.pdf-stage{flex:1; min-height:0; position:relative; border:1px solid var(--line); border-radius:12px; background:#4a4d52; overflow:hidden;}
.pdf-stage iframe{position:absolute; inset:0; width:100%; height:100%; border:0; background:#525659;}
.pdf-viewer{position:absolute; inset:0; overflow:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; padding:10px; touch-action:pan-x pan-y pinch-zoom;}
.pdf-viewer[hidden], .pdf-stage iframe[hidden], .pdf-bar[hidden], .pdf-loading[hidden], .pdf-erro[hidden], .pdf-dica[hidden]{display:none;}
.pdf-pages{display:flex; flex-direction:column; gap:10px; margin:0 auto;}
.pdf-page{width:100%; background:#fff; box-shadow:0 2px 10px rgba(0,0,0,.35); overflow:hidden;}
.pdf-loading,.pdf-erro{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:24px; text-align:center; color:#E9E4D6; font-size:14px; line-height:1.5;}
.pdf-bar{display:flex; align-items:center; gap:10px; padding:8px 2px 2px; flex-shrink:0; color:var(--ink-soft); font-size:13px;}
.pdf-zoom-btn{width:38px; height:38px; border-radius:10px; border:1px solid var(--line-strong); background:#fff; font:600 20px/1 var(--font-ui); color:var(--ink); cursor:pointer;}
.pdf-pageinfo{margin-left:auto; font-weight:600;}
.pdf-foot{display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; margin-top:10px; flex-shrink:0;}
.pdf-dica{margin:8px 2px 0; font-size:12px; line-height:1.45; color:var(--bad);}
@media (max-width:640px){
  .pdf-modal{width:100vw; height:100vh; height:100dvh; max-width:none; border-radius:0; padding:12px 12px calc(12px + env(safe-area-inset-bottom));}
  .pdf-foot .btn{flex:1 1 calc(50% - 4px); padding:0 10px; min-height:46px;}
  .pdf-foot #btnDownloadPdfPreview{flex-basis:100%; order:-1;}
}

/* ---------- sincronizar ---------- */
.nuvem{flex-direction:column; align-items:stretch; gap:8px;}
.nuvem-linha{display:flex; align-items:center; gap:9px;}
.nuvem-acoes{display:flex; gap:6px;}
.nuvem-acoes[hidden]{display:none;}
.nuvem-sync{flex:1; display:flex; align-items:center; justify-content:center; gap:8px; min-height:34px; padding:0 10px; border:0; border-radius:9px; background:rgba(255,255,255,.07); color:#F0E8D6; font:600 12.5px var(--font-ui); cursor:pointer;}
.nuvem-sync:hover{background:rgba(255,255,255,.13); color:#fff;}
.nuvem-sync .ic{width:16px; height:16px;}
.nuvem[data-estado="sincronizando"] .nuvem-ic{color:#D2B074;}
.nuvem[data-estado="sincronizando"] .nuvem-ic .ic,.nuvem[data-estado="sincronizando"] .nuvem-sync .ic{animation:nuvem-gira 1.1s linear infinite;}
.nuvem-acoes button#btnSair{width:36px; flex:none; min-height:34px; justify-content:center; background:rgba(255,255,255,.05); border-radius:9px;}
.pdf-foot .btn[hidden]{display:none;}

/* ---------- navegação por ambientes ---------- */
.room-nav{display:flex; align-items:center; gap:8px; overflow-x:auto; padding:8px 2px 10px; margin:0 0 20px; position:sticky; top:0; z-index:15; background:linear-gradient(var(--paper) 78%, rgba(244,241,234,0)); scrollbar-width:none;}
.room-nav::-webkit-scrollbar{display:none;}
.room-nav[hidden]{display:none;}
.room-tab{flex:none; display:flex; align-items:center; gap:8px; padding:9px 15px; border-radius:999px; border:1px solid var(--line-strong); background:#fff; color:var(--ink-soft); font:600 13px/1 var(--font-ui); cursor:pointer; white-space:nowrap; transition:background .15s ease, border-color .15s ease;}
.room-tab:hover{border-color:var(--gold);}
.room-tab .ic{width:16px; height:16px;}
.room-tab.active{background:var(--espresso); border-color:var(--espresso); color:#F6ECD3;}
.room-tab.active .ic{color:var(--gold-bright);}
.room-tab .rt-badge{min-width:22px; padding:2px 7px; border-radius:999px; background:var(--gold-light); color:var(--gold-dark); font-size:11px; font-weight:800; text-align:center;}
.room-tab.active .rt-badge{background:rgba(216,185,120,.22); color:var(--gold-bright);}
.room-tab .rt-ok{color:var(--ok);}
.room-tab .rt-bad{width:8px; height:8px; border-radius:50%; background:var(--bad);}
.room-nav-next{flex:none; margin-left:auto; display:flex; align-items:center; gap:7px; padding:9px 14px; border-radius:999px; border:1px solid var(--gold); background:var(--gold-light); color:var(--gold-dark); font:700 12.5px var(--font-ui); cursor:pointer; white-space:nowrap;}
.room-nav-next .ic{width:15px; height:15px;}

.room-overview{margin-bottom:26px;}
.ov-resumo{display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:18px;}
.ov-card{padding:16px 18px; border:1px solid var(--line); border-radius:var(--r-md); background:#fff;}
.ov-card b{display:block; font:500 30px/1.1 var(--font-display); color:var(--ink);}
.ov-card span{font-size:12.5px; color:var(--muted);}
.ov-card.bad b{color:var(--bad);} .ov-card.pend b{color:var(--gold-dark);} .ov-card.ok b{color:var(--ok);}
.ov-lista{border:1px solid var(--line); border-radius:var(--r-lg); background:#fff; overflow:hidden; box-shadow:var(--shadow-sheet);}
.ov-room{padding:18px 22px; border-bottom:1px solid var(--line);}
.ov-room:last-child{border-bottom:0;}
.ov-room-head{display:flex; align-items:center; gap:14px; flex-wrap:wrap;}
.ov-room-head h3{margin:0; font-size:20px; flex:1; min-width:120px;}
.ov-bar{height:8px; border-radius:999px; background:var(--na-bg); overflow:hidden; display:flex; margin:12px 0 8px;}
.ov-bar i{display:block; height:100%;}
.ov-bar .ok{background:var(--ok);} .ov-bar .bad{background:var(--bad);} .ov-bar .reinsp{background:var(--reinsp);} .ov-bar .na{background:#B8B2A3;}
.ov-cont{display:flex; flex-wrap:wrap; gap:6px 16px; font-size:12.5px; color:var(--muted);}
.ov-cont b{color:var(--ink-soft);}
.ov-pend{margin-top:12px; display:flex; flex-direction:column; gap:2px;}
.ov-pend summary{cursor:pointer; font:700 12.5px var(--font-ui); color:var(--gold-dark); padding:4px 0;}
.ov-pend-item{display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:9px; font-size:13.5px;}
.ov-pend-item:hover{background:var(--info-bg);}
.ov-pend-item .cat{color:var(--muted); font-size:12px; margin-left:auto; text-align:right;}
.ov-pend-item button{border:1px solid var(--line-strong); background:#fff; border-radius:8px; padding:4px 10px; font:600 12px var(--font-ui); color:var(--ink-soft); cursor:pointer;}
.ov-tudo{padding:22px; text-align:center; color:var(--ok); font-weight:700;}
.room-progress{display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:12px 0 4px; font-size:13px; color:var(--ink-soft);}
.room-progress .ov-bar{flex:1; min-width:120px; margin:0; max-width:320px;}
.room-progress button{border:1px solid var(--gold); background:var(--gold-light); color:var(--gold-dark); border-radius:999px; padding:6px 14px; font:700 12px var(--font-ui); cursor:pointer;}

/* ---------- item: guia, indicadores e menu de editar/excluir ---------- */
.item-row{flex-wrap:wrap; row-gap:8px;}
.item-main{flex:1 1 260px; min-width:0; display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.item-row .name{flex:0 1 auto; font-size:14px; font-weight:500; line-height:1.4;}
.item-row .info-btn{width:auto; height:auto; border-radius:999px; padding:3px 11px 3px 8px; font-size:11.5px; font-weight:700; display:inline-flex; align-items:center; gap:5px; color:var(--gold-dark); background:var(--gold-light); border-color:transparent;}
.item-row .info-btn.active{background:var(--gold); color:#fff;}
.item-badges{display:inline-flex; gap:5px; flex-wrap:wrap;}
.ibadge{display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:999px; background:var(--info-bg); border:1px solid var(--line); color:var(--ink-soft); font-size:11px; font-weight:700;}
.ibadge .ic{width:12px; height:12px;}
.item-menu-btn,.cat-menu-btn{border:0; background:transparent; color:var(--muted); border-radius:8px; padding:4px 6px; cursor:pointer; display:inline-flex;}
.item-menu-btn:hover,.cat-menu-btn:hover{background:var(--na-bg); color:var(--ink);}
.item-menu-btn .ic,.cat-menu-btn .ic{width:18px; height:18px;}
.cat-break-btn{border:0; background:transparent; color:var(--line-strong); border-radius:8px; padding:4px 6px; cursor:pointer; display:inline-flex;}
.cat-break-btn:hover{background:var(--na-bg); color:var(--muted);}
.cat-break-btn.active{color:var(--gold-dark); background:var(--gold-light);}
.cat-break-btn .ic{width:17px; height:17px;}
.item-nome-edit{flex:1 1 220px; min-width:0; padding:7px 10px; border:1px solid var(--gold); border-radius:9px; font:500 14px var(--font-ui); box-shadow:0 0 0 3px rgba(185,148,90,.2);}
.cat-head{display:flex; align-items:center; gap:10px; border-bottom:1px solid var(--line); margin-bottom:6px;}
.cat-head h4{flex:1; border:0 !important; margin:0 !important; padding:0 0 10px !important;}
.cat-prog{font-size:12px; font-weight:700; color:var(--muted); padding-bottom:8px;}
.cat-prog.ok{color:var(--ok);}
.menu-pop{position:fixed; z-index:400; min-width:190px; padding:6px; border-radius:12px; background:#fff; border:1px solid var(--line-strong); box-shadow:0 18px 40px -12px rgba(18,16,12,.4);}
.menu-pop button{display:flex; align-items:center; gap:10px; width:100%; padding:10px 12px; border:0; border-radius:8px; background:transparent; color:var(--ink); font:600 13.5px var(--font-ui); text-align:left; cursor:pointer;}
.menu-pop button:hover{background:var(--info-bg);}
.menu-pop button.danger{color:var(--bad);}
.menu-pop .ic{width:17px; height:17px;}
@media (max-width:640px){
  .ov-resumo{grid-template-columns:repeat(2,1fr);}
  .ov-pend-item .cat{display:none;}
  .room-nav-next span{display:none;}
  .item-main{flex-basis:100%;}
  .item-row .name{flex:1 1 60%;}
}

.item-menu-btn{margin-left:auto;}
.item-badges:empty{display:none;}

/* ---------- perfil, marca do produto e papel timbrado vazio ---------- */
.side-perfil{display:flex; align-items:center; gap:10px; width:100%; min-height:38px; padding:0 12px; border:0; border-radius:10px; background:rgba(255,255,255,.05); color:#F0E8D6; font:600 12.5px var(--font-ui); cursor:pointer; text-align:left;}
.side-perfil:hover{background:rgba(255,255,255,.1); color:#fff;}
.side-perfil .ic{width:17px; height:17px; flex-shrink:0; color:var(--gold-bright);}
.side-perfil span:last-child{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.gate-marca{display:flex; align-items:center; gap:12px; margin:0 0 26px;}
.gate-marca img{height:41px; width:auto;}
.gate-marca span{font:500 22px var(--font-display); color:var(--ink); letter-spacing:.005em;}
.timbrado-vazio{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; text-align:center; padding:24px; font-size:12.5px; line-height:1.6; color:var(--muted);}
#timbradoPreview{position:relative;}

.side-gerar .btn{width:100%; min-width:0;}
