/* Protect Life — tema escuro com amarelo, pensado para celular */
:root {
  --bg: #0d0d0d;
  --bg2: #151515;
  --card: #1b1b1b;
  --card2: #232323;
  --linha: #2e2e2e;
  --texto: #f3f3f3;
  --muted: #9c9c9c;
  --amarelo: #F5C400;
  --amarelo-esc: #d9ad00;
  --preto: #0d0d0d;
  --verde: #2ecc71;
  --vermelho: #ff5a5a;
  --azul: #4aa3ff;
  --roxo: #b388ff;
  --raio: 14px;
  --nav-h: 64px;
  --largura: 680px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--texto);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
}
body.com-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
a { color: var(--amarelo); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.peq { font-size: .85rem; }
.amarelo { color: var(--amarelo); }
.direita { text-align: right; }
.centro { text-align: center; }
.nowrap { white-space: nowrap; }
[x-cloak] { display: none !important; }

.ic { width: 22px; height: 22px; flex: none; }

/* ---------- topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: rgba(13,13,13,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linha);
}
.topo h1 { flex: 1; font-size: 1.15rem; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-btn, .topo-acao a, .topo-acao button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; color: var(--texto);
  background: none; border: 0; cursor: pointer;
}
.topo-acao { min-width: 40px; display: flex; justify-content: flex-end; }
.topo-acao a.add, .topo-acao button.add { background: var(--amarelo); color: var(--preto); }
.topo-logo { display: flex; width: 92px; }
.logo { display: block; width: 100%; height: auto; }
.logo-pequeno { width: 92px; }

.conteudo { max-width: var(--largura); margin: 0 auto; padding: 14px 14px 0; }

/* ---------- navegação inferior ---------- */
.nav-inferior {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #111; border-top: 1px solid var(--linha);
}
.nav-inferior a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .72rem; position: relative;
}
.nav-inferior a.ativo { color: var(--amarelo); }
.nav-inferior a.ativo::before {
  content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--amarelo);
}

/* ---------- cards e listas ---------- */
.card {
  background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 14px; margin-bottom: 12px;
}
.card-titulo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-titulo .ic { color: var(--amarelo); }

.lista { list-style: none; margin: 0 0 12px; padding: 0; border-radius: var(--raio); overflow: hidden; border: 1px solid var(--linha); background: var(--card); }
.lista > li + li { border-top: 1px solid var(--linha); }
.lista a.linha, .lista .linha {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--texto);
}
.lista a.linha:active { background: var(--card2); }
.linha .info { flex: 1; min-width: 0; }
.linha .info strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.linha .info small { display: block; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha .seta { color: var(--muted); }
.linha .valor { font-weight: 600; white-space: nowrap; text-align: right; }
.inativo { opacity: .45; }

.letra {
  background: var(--amarelo); color: var(--preto); font-weight: 700;
  padding: 3px 14px; border-radius: 6px; margin: 14px 0 6px; font-size: .9rem;
}
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #d8d8d8; color: #fff; font-weight: 700; font-size: 1.1rem;
  background: linear-gradient(145deg, #e3e3e3, #b9b9b9); color: #fff;
}

.vazio { text-align: center; color: var(--muted); padding: 30px 10px; }
.vazio .ic { width: 42px; height: 42px; color: var(--linha); margin-bottom: 8px; }

/* ---------- início ---------- */
.saudacao { margin: 6px 0 16px; }
.saudacao .ola { font-size: 1.4rem; color: var(--muted); }
.saudacao .nome { font-size: 1.9rem; font-weight: 700; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.atalho {
  display: flex; align-items: center; gap: 10px; min-height: 84px;
  padding: 12px; border-radius: var(--raio); border: 1px solid var(--linha);
  background: var(--card); color: var(--texto);
}
.atalho .ic { width: 30px; height: 30px; color: var(--amarelo); }
.atalho strong { display: block; font-size: .95rem; font-weight: 600; }
.atalho small { display: block; color: var(--muted); font-size: .75rem; }
.atalho.destaque { background: var(--amarelo); border-color: var(--amarelo); color: var(--preto); }
.atalho.destaque .ic, .atalho.destaque small { color: var(--preto); }
.numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.numeros a { background: var(--card); border: 1px solid var(--linha); border-radius: 12px; padding: 10px; color: var(--texto); text-align: center; }
.numeros strong { display: block; font-size: 1.4rem; color: var(--amarelo); }
.numeros span { font-size: .75rem; color: var(--muted); }
.secao-titulo { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 8px; }
.secao-titulo h2 { font-size: 1.05rem; }

/* ---------- formulários ---------- */
label.campo, .campo { display: block; margin-bottom: 12px; }
.campo > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px evita zoom no iPhone */
  color: var(--texto); background: var(--bg2);
  border: 1px solid var(--linha); border-radius: 10px;
  padding: 11px 12px; min-height: 46px; outline: none;
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239c9c9c' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--amarelo); }
input[type=date], input[type=time] { color-scheme: dark; }
.lin2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lin3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.lin-cep { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.erro { color: var(--vermelho); font-size: .85rem; }
pre.erro { white-space: pre-wrap; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.check input { width: 22px; height: 22px; accent-color: var(--amarelo); }

.busca { position: relative; margin-bottom: 12px; }
.busca .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.busca input { padding-left: 42px; background: #f1f1f1; color: #111; border-color: #f1f1f1; }

.seg { display: inline-flex; border: 1px solid var(--linha); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { font: inherit; background: var(--bg2); color: var(--muted); border: 0; padding: 0 12px; min-height: 44px; cursor: pointer; }
.seg button.on { background: var(--amarelo); color: var(--preto); font-weight: 600; }
.com-seg { display: flex; gap: 6px; }
.com-seg input { flex: 1; min-width: 0; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  min-height: 46px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--linha); background: var(--card2); color: var(--texto);
}
.btn.primario { background: var(--amarelo); border-color: var(--amarelo); color: var(--preto); }
.btn.perigo { color: var(--vermelho); border-color: #4a2626; background: #221616; }
.btn.verde { color: #fff; background: #1e7d47; border-color: #1e7d47; }
.btn.bloco { display: flex; width: 100%; }
.btn.peq { min-height: 36px; padding: 6px 10px; font-size: .85rem; border-radius: 9px; }
.btn:disabled { opacity: .5; }
.botoes { display: flex; gap: 10px; margin: 16px 0; }
.botoes > * { flex: 1; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; padding: 7px 13px; border-radius: 20px; border: 1px solid var(--linha); color: var(--muted); font-size: .85rem; background: var(--card); }
.chips a.on { background: var(--amarelo); border-color: var(--amarelo); color: var(--preto); font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.cinza { background: #333; color: #ccc; }
.badge.azul { background: #13304d; color: var(--azul); }
.badge.verde { background: #133d26; color: var(--verde); }
.badge.amarelo { background: #3d3410; color: var(--amarelo); }
.badge.vermelho { background: #401818; color: var(--vermelho); }
.badge.roxo { background: #2d2145; color: var(--roxo); }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 500; }
.flash.ok { background: #133d26; color: #9ff0c0; }
.flash.erro { background: #401818; color: #ffb3b3; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.login .logo { max-width: 280px; margin: 0 auto 6px; }
.login .slogan { text-align: center; color: var(--amarelo); margin-bottom: 28px; }

/* ---------- modal (folha inferior) ---------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  width: 100%; max-width: var(--largura); max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border-radius: 18px 18px 0 0; border-top: 1px solid var(--linha);
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
}
.modal-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-cab button { background: none; border: 0; color: var(--texto); padding: 6px; cursor: pointer; }
.opcoes { list-style: none; margin: 0; padding: 0; }
.opcoes li button {
  display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  font: inherit; color: var(--texto); background: none; border: 0; border-bottom: 1px solid var(--linha);
  padding: 13px 4px; cursor: pointer;
}
.opcoes li button small { color: var(--muted); }

/* ---------- orçamento ---------- */
.comodo-grupo { border: 1px solid var(--linha); border-radius: var(--raio); margin-bottom: 14px; overflow: hidden; background: var(--card); }
.comodo-cab { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--amarelo); color: var(--preto); }
.comodo-cab h3 { flex: 1; font-size: 1rem; }
.comodo-cab .tot { font-weight: 700; white-space: nowrap; }
.aprov-bar { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--linha); background: var(--card2); align-items: center; flex-wrap: wrap; }
.aprov-bar .rot { font-size: .8rem; color: var(--muted); margin-right: auto; }
.local { padding: 12px; border-top: 1px solid var(--linha); }
.local:first-of-type { border-top: 0; }
.local-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.local-cab h4 { flex: 1; margin: 0; font-size: .98rem; }
.local.reprovado { opacity: .55; }
.local.reprovado .local-cab h4 { text-decoration: line-through; }
.aprov { display: inline-flex; border-radius: 9px; overflow: hidden; border: 1px solid var(--linha); }
.aprov button { font: inherit; font-size: .78rem; border: 0; background: var(--bg2); color: var(--muted); padding: 6px 9px; cursor: pointer; min-height: 32px; }
.aprov button.on.a { background: #1e7d47; color: #fff; }
.aprov button.on.r { background: #9b2c2c; color: #fff; }
.aprov button.on.p { background: #444; color: #fff; }
.item { background: var(--bg2); border: 1px solid var(--linha); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.item-cab { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.item-cab strong { flex: 1; font-size: .92rem; font-weight: 600; }
.item-cab button { background: none; border: 0; color: var(--muted); padding: 2px; cursor: pointer; }
.item .campo { margin-bottom: 8px; }
.item .campo > span { font-size: .75rem; margin-bottom: 3px; }
.item input, .item select { min-height: 42px; padding: 8px 10px; }
.item-total { display: flex; justify-content: space-between; font-size: .9rem; padding-top: 6px; border-top: 1px dashed var(--linha); }
.item-total strong { color: var(--amarelo); }

/* orçamento compacto: cômodo > local > itens em linha */
.comodo-cab { padding: 8px 10px 8px 12px; }
.comodo-cab h3 { font-size: .98rem; }
.aprov-ic { display: inline-flex; gap: 4px; flex: none; }
.aprov-ic button {
  width: 32px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--linha); background: var(--bg2); color: var(--muted); cursor: pointer; padding: 0;
}
.aprov-ic .ic { width: 17px; height: 17px; }
.aprov-ic button.on.p { background: #555; color: #fff; border-color: #555; }
.aprov-ic button.on.a { background: #1e7d47; color: #fff; border-color: #1e7d47; }
.aprov-ic button.on.r { background: #9b2c2c; color: #fff; border-color: #9b2c2c; }
.aprov-ic.escuro button { background: rgba(0,0,0,.82); border-color: transparent; }
.aprov-ic.escuro button.a { color: #5fe39a; }
.aprov-ic.escuro button.r { color: #ff8a8a; }
.local { padding: 10px 12px; }
.local-cab { margin-bottom: 4px; }
.local-cab h4 { font-size: .95rem; }
.local-tot { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.local-acoes { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.aprov-txt { font-size: .78rem; color: var(--muted); margin-right: auto; }
.local-acoes > .mini:first-of-type { margin-left: auto; }
.local.aprovado .aprov-txt { color: var(--verde); }
.local.reprovado .aprov-txt { color: var(--vermelho); }
.mini {
  display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: .8rem;
  min-height: 30px; padding: 0 9px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--linha); background: var(--bg2); color: var(--muted);
}
.mini .ic { width: 15px; height: 15px; }
.mini.perigo { color: var(--vermelho); }
.mini.ok { background: var(--amarelo); border-color: var(--amarelo); color: var(--preto); font-weight: 600; }
.obs-input { margin-bottom: 8px; min-height: 38px !important; padding: 7px 10px !important; font-size: 15px !important; }
.itens-lista { border: 1px solid var(--linha); border-radius: 10px; overflow: hidden; background: var(--bg2); }
.itens-lista:empty { display: none; }
.item-linha + .item-linha { border-top: 1px solid var(--linha); }
.item-resumo {
  display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; width: 100%; text-align: left;
  font: inherit; color: var(--texto); background: none; border: 0; padding: 8px 10px; cursor: pointer;
}
.item-resumo .nome { font-size: .88rem; font-weight: 500; line-height: 1.25; }
.item-resumo .tot { font-size: .88rem; font-weight: 600; color: var(--amarelo); white-space: nowrap; }
.item-resumo .det { grid-column: 1 / -1; font-size: .76rem; color: var(--muted); }
.item-linha.aberto { background: var(--card2); }
.item-linha.aberto .item-resumo .nome { color: var(--amarelo); }
.item-edit { padding: 2px 10px 10px; }
.item-linha:not(.aberto) .item-edit { display: none; }
.grade-edit { display: grid; gap: 6px; }
.grade-edit.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade-edit.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-edit input { min-width: 0; }
.grade-edit .seg { flex: none; }
.grade-edit.g3 > label:nth-of-type(5) { grid-column: span 2; }
.grade-edit .com-seg { display: flex; gap: 6px; }
.grade-edit label > span:first-child { display: block; font-size: .7rem; color: var(--muted); margin-bottom: 2px; }
.grade-edit input { min-height: 38px !important; padding: 6px 8px !important; font-size: 16px; }
.grade-edit .seg button { min-height: 38px; padding: 0 9px; }
.grade-edit .acoes-item { grid-column: 1 / -1; display: flex; justify-content: space-between; margin-top: 2px; }
.add-linha {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 8px;
  font: inherit; font-size: .85rem; min-height: 36px; border-radius: 10px; cursor: pointer;
  border: 1px dashed #4a4a4a; background: none; color: var(--amarelo);
}
.add-linha .ic { width: 17px; height: 17px; }

.resumo .lin { display: flex; justify-content: space-between; padding: 5px 0; }
.resumo .lin.total { font-size: 1.15rem; font-weight: 700; border-top: 1px solid var(--linha); margin-top: 6px; padding-top: 10px; }
.resumo .lin.total span:last-child { color: var(--amarelo); }
.resumo .lin.aprov { color: var(--verde); font-weight: 600; }

.barra-fixa {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #111; border-top: 1px solid var(--linha);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.barra-fixa .dentro { max-width: var(--largura); margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.barra-fixa .tot { flex: 1; line-height: 1.15; }
.barra-fixa .tot small { display: block; color: var(--muted); font-size: .75rem; }
.barra-fixa .tot strong { font-size: 1.2rem; color: var(--amarelo); }
.barra-fixa .tot .ap { color: var(--verde); font-size: .8rem; }
body.com-barra { padding-bottom: 100px; }

.passos { display: flex; gap: 6px; margin-bottom: 14px; }
.passos button { flex: 1; font: inherit; font-size: .8rem; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--linha); background: var(--card); color: var(--muted); cursor: pointer; }
.passos button.on { border-color: var(--amarelo); color: var(--amarelo); font-weight: 600; }

/* ---------- agenda ---------- */
.dia { margin: 14px 0 6px; font-weight: 600; color: var(--amarelo); text-transform: capitalize; }
.dia.hoje::after { content: ' • hoje'; color: var(--muted); font-weight: 400; }
.hora { width: 52px; flex: none; font-weight: 700; text-align: center; }
.hora small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.tipo-barra { width: 4px; align-self: stretch; border-radius: 3px; flex: none; }
.tipo-medicao { background: var(--azul); }
.tipo-instalacao { background: var(--amarelo); }
.tipo-manutencao { background: var(--roxo); }
.tipo-outro { background: #777; }
.cancelado .info strong { text-decoration: line-through; }
.semana-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.semana-nav span { font-weight: 600; }

/* ---------- autocomplete ---------- */
.auto { position: relative; }
.auto-lista {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 15; margin-top: 4px;
  background: var(--card2); border: 1px solid var(--linha); border-radius: 10px; max-height: 260px; overflow-y: auto;
  list-style: none; padding: 0;
}
.auto-lista li { padding: 11px 12px; border-bottom: 1px solid var(--linha); cursor: pointer; }
.auto-lista li small { display: block; color: var(--muted); }
.escolhido { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--amarelo); }
.escolhido .info { flex: 1; min-width: 0; }
.escolhido .info strong, .escolhido .info small { display: block; }
.escolhido button { background: none; border: 0; color: var(--muted); cursor: pointer; }

@media (min-width: 700px) {
  .conteudo { padding-top: 20px; }
  .grade { grid-template-columns: repeat(3, 1fr); }
}
