:root {
  --azul: #1b2a41;
  --azul-2: #2c4266;
  --amarelo: #f5a400;
  --fundo: #f2f4f7;
  --card: #ffffff;
  --texto: #1d2433;
  --suave: #667085;
  --borda: #d9dee7;
  --verde: #12a150;
  --vermelho: #d92d20;
  --whats: #25d366;
  --raio: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo); color: var(--texto); font-size: 16px;
  padding-bottom: calc(70px + var(--safe-b));
}
body.editor { padding-bottom: calc(150px + var(--safe-b)); }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  background: var(--azul); color: #fff; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.topbar h1 { font-size: 19px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1::before { content: "⚡"; color: var(--amarelo); margin-right: 6px; }
.spacer { flex: 1; }
.icon-btn {
  background: transparent; border: 0; color: inherit; font-size: 22px; min-width: 40px; height: 40px;
  border-radius: 10px; cursor: pointer;
}
.topbar .icon-btn:active { background: rgba(255,255,255,.15); }
.topbar #btnAcaoTopo { font-size: 15px; font-weight: 600; background: var(--amarelo); color: var(--azul); padding: 0 14px; }

main { max-width: 760px; margin: 0 auto; padding: 16px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: #fff;
  border-top: 1px solid var(--borda); padding-bottom: var(--safe-b);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 10px; color: var(--suave); text-decoration: none; font-size: 12px; font-weight: 600;
}
.tabbar a span { display: block; font-size: 20px; line-height: 26px; filter: grayscale(1); opacity: .7; }
.tabbar a.ativo { color: var(--azul); }
.tabbar a.ativo span { filter: none; opacity: 1; }
body.editor .tabbar { display: none; }

.card { background: var(--card); border-radius: var(--raio); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.card h3 { margin: 0 0 10px; font-size: 15px; color: var(--azul-2); text-transform: uppercase; letter-spacing: .03em; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--suave); margin: 10px 0 4px; }
label:first-child { margin-top: 0; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--borda);
  border-radius: 10px; background: #fff; color: var(--texto);
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amarelo); border-color: transparent; }
.linha { display: flex; gap: 10px; }
.linha > * { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700;
  font-size: 15px; padding: 12px 16px; border-radius: 10px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--azul); color: #fff;
}
.btn:active { transform: scale(.98); }
.btn.sec { background: #e7ebf2; color: var(--azul); }
.btn.amarelo { background: var(--amarelo); color: var(--azul); }
.btn.whats { background: var(--whats); color: #073b1c; }
.btn.perigo { background: #fde8e7; color: var(--vermelho); }
.btn.bloco { width: 100%; }
.btn.peq { padding: 8px 12px; font-size: 14px; }
.botoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.botoes .btn { flex: 1; }

.busca { margin-bottom: 12px; }
.filtros { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.filtros button {
  border: 1px solid var(--borda); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px;
  white-space: nowrap; color: var(--suave);
}
.filtros button.ativo { background: var(--azul); color: #fff; border-color: var(--azul); }

.lista-item {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--raio); padding: 12px 14px;
  margin-bottom: 8px; box-shadow: 0 1px 2px rgba(16,24,40,.06); cursor: pointer; text-decoration: none; color: inherit;
}
.lista-item .info { flex: 1; min-width: 0; }
.lista-item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-item .s { font-size: 13px; color: var(--suave); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-item .v { font-weight: 800; color: var(--azul); white-space: nowrap; text-align: right; }

.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; margin-top: 4px; }
.chip.rascunho { background: #eef0f4; color: #475467; }
.chip.enviado { background: #e0edff; color: #1d4ed8; }
.chip.aprovado { background: #dcfae6; color: #067647; }
.chip.recusado { background: #fee4e2; color: #b42318; }

.vazio { text-align: center; color: var(--suave); padding: 40px 16px; }
.vazio b { display: block; font-size: 40px; margin-bottom: 8px; }

.resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.resumo div { background: var(--card); border-radius: var(--raio); padding: 10px; text-align: center; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.resumo small { display: block; color: var(--suave); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.resumo strong { font-size: 15px; color: var(--azul); }

.fab {
  position: fixed; right: 16px; bottom: calc(80px + var(--safe-b)); z-index: 11; width: 58px; height: 58px; border-radius: 50%;
  background: var(--amarelo); color: var(--azul); border: 0; font-size: 32px; font-weight: 700; box-shadow: 0 6px 16px rgba(0,0,0,.25); cursor: pointer;
}

/* Itens do orçamento */
.item {
  border: 1px solid var(--borda); border-radius: 10px; padding: 10px; margin-bottom: 10px; position: relative;
  border-left: 4px solid var(--azul-2);
}
.item.material { border-left-color: var(--amarelo); }
.item .tag { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--suave); }
.item input { padding: 9px 10px; }
.item .linha { margin-top: 8px; }
.item .sub { text-align: right; font-weight: 700; color: var(--azul); margin-top: 6px; font-size: 14px; }
.item .linha .qtd { flex: .7; }
.item .linha .un { flex: .6; }

.totais { font-size: 15px; }
.totais div { display: flex; justify-content: space-between; padding: 4px 0; }
.totais .total { font-size: 20px; font-weight: 800; color: var(--azul); border-top: 1px solid var(--borda); margin-top: 6px; padding-top: 10px; }

.barra-acoes {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 12; background: #fff; border-top: 1px solid var(--borda);
  padding: 10px 16px calc(10px + var(--safe-b));
}
.barra-acoes .tot { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.barra-acoes .tot strong { font-size: 22px; color: var(--azul); }
.barra-acoes .botoes { margin-top: 0; max-width: 760px; margin: 0 auto; }
.barra-acoes .tot { max-width: 760px; margin: 0 auto 8px; }

.seg { display: flex; background: #e7ebf2; border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 14px; padding: 9px; border-radius: 8px; color: var(--suave); }
.seg button.ativo { background: #fff; color: var(--azul); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

.logo-prev { display: flex; align-items: center; gap: 12px; }
.logo-prev img { max-width: 120px; max-height: 70px; border: 1px solid var(--borda); border-radius: 8px; padding: 4px; background: #fff; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-card { background: var(--fundo); width: 100%; max-width: 760px; max-height: 88vh; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--borda); }
.modal-head h2 { flex: 1; margin: 0; font-size: 17px; }
.modal-body { overflow-y: auto; padding: 14px 16px calc(16px + var(--safe-b)); }
@media (min-width: 700px) { .modal { align-items: center; } .modal-card { border-radius: 16px; } }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: var(--azul); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90vw; pointer-events: none; box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.ajuda { font-size: 13px; color: var(--suave); margin: 6px 0 0; }
.num-badge { font-size: 12px; color: var(--suave); font-weight: 700; }

/* ---------- v2: marca, boas-vindas, itens ---------- */
.logo-topo { height: 32px; max-width: 90px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 4px; }
.topbar h1.com-logo::before { content: none; }
body.boasvindas .tabbar { display: none; }
body.boasvindas { padding-bottom: 24px; }

.boas-vindas { text-align: center; padding: 8px 8px 16px; }
.boas-vindas .bv-icone { font-size: 44px; width: 72px; height: 72px; line-height: 72px; margin: 0 auto 8px; border-radius: 20px; background: var(--azul); color: var(--amarelo); }
.boas-vindas h2 { margin: 0 0 8px; font-size: 21px; color: var(--azul); }
.boas-vindas p { margin: 0; color: var(--suave); }

.logo-zona {
  border: 2px dashed #b8c2d3; border-radius: 14px; min-height: 130px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; padding: 14px; cursor: pointer; background: #fafbfd; text-align: center;
}
.logo-zona:active { background: #f1f4f9; }
.logo-zona img { max-width: 100%; max-height: 120px; object-fit: contain; }
.logo-zona img.clara { background: var(--azul); padding: 8px; border-radius: 8px; }
.logo-zona .logo-mais { font-size: 34px; color: var(--amarelo); line-height: 1; }
.logo-zona b { color: var(--azul); }
.logo-zona small { color: var(--suave); }

.campo-ig { display: flex; align-items: center; border: 1px solid var(--borda); border-radius: 10px; background: #fff; overflow: hidden; }
.campo-ig span { padding: 0 4px 0 12px; color: var(--suave); font-weight: 700; }
.campo-ig input { border: 0; padding-left: 2px; }
.campo-ig:focus-within { outline: 2px solid var(--amarelo); }
.campo-ig input:focus { outline: none; }

.cores { display: flex; flex-wrap: wrap; gap: 10px; }
.cor { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--borda); cursor: pointer; padding: 0; }
.cor.ativa { box-shadow: 0 0 0 3px var(--amarelo); }
.cor.outra { display: flex; align-items: center; justify-content: center; background: #fff; margin: 0; font-size: 18px; position: relative; overflow: hidden; }
.cor.outra input { position: absolute; inset: 0; opacity: 0; cursor: pointer; padding: 0; }

.previa { display: flex; align-items: center; gap: 10px; color: #fff; padding: 10px; border-radius: 10px; min-height: 76px; }
.previa-logo { flex: 0 0 auto; background: #fff; border-radius: 6px; padding: 4px; display: flex; align-items: center; justify-content: center; height: 58px; max-width: 96px; }
.previa-logo.clara { background: transparent; }
.previa-logo img { max-height: 50px; max-width: 88px; object-fit: contain; }
.previa-logo.vazia { width: 58px; color: #98a2b3; font-size: 10px; font-weight: 800; text-align: center; line-height: 1.2; }
.previa-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 11px; line-height: 1.45; }
.previa-txt b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.previa-txt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .92; }
.previa-num { text-align: right; flex: 0 0 auto; }
.previa-num small { display: block; font-size: 9px; font-weight: 700; }
.previa-num b { font-size: 15px; }

.item-topo { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.mini { border: 1px solid var(--borda); background: #fff; border-radius: 8px; min-width: 32px; height: 30px; font-size: 15px; color: var(--azul); cursor: pointer; }
.mini:disabled { opacity: .35; }
.mini.rm { color: var(--vermelho); }
.item textarea { min-height: 0; padding: 9px 10px; resize: none; overflow: hidden; line-height: 1.35; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--texto); font-weight: 600; margin-top: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: 0 0 auto; margin: 0; accent-color: var(--azul); }
.check small { display: block; font-weight: 400; color: var(--suave); }
.chip.aguardando { background: #fff4e0; color: #b54708; text-transform: none; }
.dica { border-left: 4px solid var(--amarelo); }
