/* Sistema Imperial: cores da marca (as mesmas do site), claro e escuro. */
:root {
  --fundo: #f6f5f2;
  --superficie: #ffffff;
  --superficie-2: #faf9f6;
  --texto: #17181a;
  --texto-2: #5b5f66;
  --linha: #e8e6e1;
  --linha-forte: #cfccc5;
  --ouro: #c99a30;
  --ouro-hover: #b5891f;
  --ouro-suave: #faf3e2;
  --ouro-texto: #8a6516;
  --grafite: #17181a;
  --ok: #1f7a4d;
  --ok-suave: #e6f4ec;
  --erro: #b42318;
  --erro-suave: #fdecea;
  --aviso: #8a5a00;
  --aviso-suave: #fff4d6;
  --info-suave: #eef2f7;
  --sombra: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --raio: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #0f1012;
    --superficie: #16171a;
    --superficie-2: #1b1c20;
    --texto: #f1efea;
    --texto-2: #a9acb2;
    --linha: #2a2c31;
    --linha-forte: #3a3d43;
    --ouro: #ddb558;
    --ouro-hover: #e8c46f;
    --ouro-suave: #2a2316;
    --ouro-texto: #ddb558;
    --grafite: #0a0a0b;
    --ok: #4cc38a;
    --ok-suave: #12291d;
    --erro: #ff8a7a;
    --erro-suave: #33140f;
    --aviso: #f3c35a;
    --aviso-suave: #2e2410;
    --info-suave: #1b2028;
    --sombra: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Item de grade não cresce além da tela por causa de tabela larga dentro dele. */
.formulario > *, .grade > *, .campos > *, .resumo-lado > * { min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--ouro-texto); }
h1 { font-size: 1.45rem; margin: 0 0 0.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
p { margin: 0.25rem 0 0.75rem; }
.suave { color: var(--texto-2); }
.espaco-topo { margin-top: 0.75rem; }
.texto-ok { color: var(--ok); }
.texto-erro { color: var(--erro); }
details.excluir > summary { list-style: none; cursor: pointer; }
details.excluir > summary::-webkit-details-marker { display: none; }
details.excluir[open] > summary { display: none; }
.pequeno { font-size: 0.85rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.codigo { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* Estrutura */
.topo {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1.25rem; background: var(--grafite); color: #f1efea;
}
.topo a { color: inherit; text-decoration: none; }
.marca { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; letter-spacing: 0.01em; }
.marca img { width: 30px; height: 30px; border-radius: 6px; }
.marca small { color: #ddb558; font-weight: 600; }
.menu { display: flex; gap: 0.15rem; flex-wrap: wrap; flex: 1; }
.menu a { padding: 0.4rem 0.7rem; border-radius: 8px; color: #d9d6cf; font-size: 0.93rem; }
.menu a:hover, .menu a.ativo { background: rgb(255 255 255 / 0.08); color: #fff; }
.menu a.ativo { box-shadow: inset 0 -2px 0 #ddb558; }
.conta { display: flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; color: #bdbab3; }
.conta form { margin: 0; }
.conta button { background: none; border: 1px solid #3a3d43; color: #e8e6e1; padding: 0.3rem 0.65rem; border-radius: 8px; cursor: pointer; }
.faixa-aberto { background: #b42318; color: #fff; text-align: center; font-size: 0.88rem; padding: 0.45rem 1rem; font-weight: 700; }
.faixa-ambiente { background: var(--aviso-suave); color: var(--aviso); text-align: center; font-size: 0.85rem; padding: 0.35rem 1rem; font-weight: 600; }
main.pagina { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.cabecalho-pagina { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.acoes { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Cartões */
.cartao { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1.1rem 1.2rem; box-shadow: var(--sombra); margin-bottom: 1rem; }
.grade { display: grid; gap: 1rem; }
.grade-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grade-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.indicador .rotulo { color: var(--texto-2); font-size: 0.85rem; }
.indicador .valor { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.indicador .detalhe { color: var(--texto-2); font-size: 0.85rem; }
.indicador.alerta .valor { color: var(--erro); }

/* Botões */
.botao, button.botao {
  display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--linha-forte);
  background: var(--superficie); color: var(--texto); padding: 0.5rem 0.9rem; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.botao:hover { border-color: var(--ouro); }
.botao.principal { background: var(--ouro); border-color: var(--ouro); color: #17181a; }
.botao.principal:hover { background: var(--ouro-hover); }
.botao.perigo { color: var(--erro); }
.botao.pequeno { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.botao:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--ouro); outline-offset: 2px;
}

/* Formulários */
form.formulario { display: grid; gap: 0.9rem; }
.campos { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
label .ajuda { font-weight: 400; color: var(--texto-2); font-size: 0.82rem; }
input, select, textarea {
  font: inherit; color: var(--texto); background: var(--superficie-2); border: 1px solid var(--linha-forte);
  border-radius: 8px; padding: 0.5rem 0.65rem; width: 100%; min-width: 0;
}
textarea { min-height: 5rem; resize: vertical; }
input[type="checkbox"] { width: auto; }
.marcar { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.busca { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.busca input, .busca select { max-width: 340px; }

/* Tabelas */
.tabela-rolagem { overflow-x: auto; border: 1px solid var(--linha); border-radius: var(--raio); background: var(--superficie); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texto-2); background: var(--superficie-2); position: sticky; top: 0; }
tbody tr:hover { background: var(--superficie-2); }
tr:last-child td { border-bottom: 0; }
td.vazio { text-align: center; color: var(--texto-2); padding: 2rem; }

/* Etiquetas e avisos */
.etiqueta { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.etiqueta.aberto { background: var(--info-suave); color: var(--texto); }
.etiqueta.aprovado { background: var(--ok-suave); color: var(--ok); }
.etiqueta.perdido { background: var(--erro-suave); color: var(--erro); }
.etiqueta.alerta { background: var(--erro-suave); color: var(--erro); }
.etiqueta.ouro { background: var(--ouro-suave); color: var(--ouro-texto); }
.mensagens { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.mensagem { padding: 0.7rem 0.9rem; border-radius: 8px; border: 1px solid; }
.mensagem.ok { background: var(--ok-suave); border-color: var(--ok); color: var(--ok); }
.mensagem.erro { background: var(--erro-suave); border-color: var(--erro); color: var(--erro); }
.aviso { background: var(--aviso-suave); color: var(--aviso); padding: 0.7rem 0.9rem; border-radius: 8px; }

/* Orçamento */
.itens-orcamento td { vertical-align: middle; }
.itens-orcamento input { padding: 0.4rem 0.5rem; }
.itens-orcamento .col-qtd { width: 110px; }
.itens-orcamento .col-preco { width: 130px; }
.itens-orcamento .col-total { width: 120px; }
.itens-orcamento .col-desc { width: 84px; }
input.invalido { border-color: var(--erro); background: var(--erro-suave); }
button[disabled], .botao[disabled] { opacity: 0.5; cursor: not-allowed; }
h3 { font-size: 1rem; margin: 0 0 0.25rem; }

/* Aprovações de desconto (reunião de 15/10) */
.sino { position: relative; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.55rem; border-radius: 8px; color: #d9d6cf; }
.sino:hover { background: rgb(255 255 255 / 0.08); }
.sino.tem { color: #ddb558; }
.contador { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem; border-radius: 999px; background: #b42318; color: #fff; font-size: 0.75rem; font-weight: 800; }
.destaque-aviso { border-color: var(--ouro); background: var(--ouro-suave); }
.destaque-erro { border-color: var(--erro); background: var(--erro-suave); }
.lista-simples { margin: 0.25rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.3rem; }
.aprovacao .numeros { display: grid; gap: 0.2rem; justify-items: end; text-align: right; }
.preco-alterado input { border-color: var(--ouro); background: var(--ouro-suave); }
.busca-produto { position: relative; }
.sugestoes { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: var(--superficie); border: 1px solid var(--linha-forte); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); max-height: 320px; overflow-y: auto; }
.sugestoes button { display: flex; justify-content: space-between; gap: 0.5rem; width: 100%; padding: 0.5rem 0.65rem; border: 0; border-bottom: 1px solid var(--linha); background: none; color: var(--texto); text-align: left; cursor: pointer; font: inherit; }
.sugestoes button:hover, .sugestoes button[aria-selected="true"] { background: var(--ouro-suave); }
.totais { display: grid; gap: 0.3rem; justify-content: end; text-align: right; }
.totais .total { font-size: 1.35rem; font-weight: 800; }
.resumo-lado { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1.5rem; }

/* Acesso */
.acesso { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--grafite); }
.acesso .cartao { width: 100%; max-width: 400px; }
.acesso .marca { color: var(--texto); margin-bottom: 1rem; }
.qr { background: #fff; padding: 0.5rem; border-radius: 8px; width: fit-content; margin: 0.5rem auto; }
.botao-google { width: 100%; justify-content: center; margin-top: 0.5rem; }
.outro-jeito { margin-top: 1rem; }
.outro-jeito > summary { cursor: pointer; color: var(--texto-2); margin-bottom: 0.75rem; }
.segredo { font-family: ui-monospace, monospace; letter-spacing: 0.08em; word-break: break-all; background: var(--superficie-2); padding: 0.4rem 0.6rem; border-radius: 6px; }

/* Erro */
.erro { max-width: 32rem; margin: 15vh auto; padding: 0 1rem; }
.erro-codigo { color: var(--texto-2); font-size: 0.9rem; letter-spacing: 0.08em; margin: 0; }
.erro h1 { font-size: 1.5rem; margin: 0.25rem 0 1rem; }

.diferencas { font-size: 0.82rem; display: grid; gap: 0.15rem; }
.diferencas .antes { color: var(--erro); text-decoration: line-through; }
.diferencas .depois { color: var(--ok); }
.abas { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--linha); margin-bottom: 1rem; overflow-x: auto; }
.abas a { padding: 0.5rem 0.9rem; text-decoration: none; color: var(--texto-2); font-weight: 600; white-space: nowrap; }

/* Reunião de 15/10: navegação por mês, cartões que levam ao detalhe, fluxo de caixa */
html.js .sem-js { display: none; }
.mes-nav { align-items: center; }
.mes-nav input[type="month"] { max-width: 11rem; }
a.cartao.clicavel { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s; }
a.cartao.clicavel:hover, a.cartao.clicavel:focus-visible { border-color: var(--ouro); }
a.cartao.clicavel .detalhe { color: var(--ouro-texto); }
tr.atual td { background: var(--ouro-suave); }
details.anotar { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; max-width: min(26rem, calc(100vw - 2rem)); }
details.anotar > summary { list-style: none; box-shadow: 0 6px 18px rgb(0 0 0 / 0.18); background: var(--grafite); color: #f1efea; border-color: var(--grafite); }
details.anotar > summary::-webkit-details-marker { display: none; }
details.anotar[open] > summary { margin-left: auto; width: fit-content; }
details.anotar form { margin: 0.5rem 0 0; box-shadow: 0 10px 30px rgb(0 0 0 / 0.2); }
.observacao.aberta { border-left: 4px solid var(--ouro); }
.indice { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin: 0 0 1rem; }
.manual ol, .roteiro { padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.roteiro .marcar { font-weight: 400; align-items: flex-start; }
.observacao .texto-observacao { white-space: pre-wrap; font-size: 1rem; }
.tabela-rolagem.alta { max-height: 28rem; overflow-y: auto; }
.paginacao { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 0.75rem; }
fieldset.obras-escolha { border: 1px solid var(--linha-forte); border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0; display: grid; gap: 0.35rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
fieldset.obras-escolha legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.25rem; }
fieldset.obras-escolha legend .ajuda { display: block; font-weight: 400; color: var(--texto-2); font-size: 0.82rem; }
.grafico-fluxo { width: 100%; height: 150px; display: block; background: var(--superficie-2); border-radius: 8px; }
.grafico-fluxo .linha { fill: none; stroke: var(--ouro); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.grafico-fluxo .zero { stroke: var(--erro); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.abas a.ativo { color: var(--texto); box-shadow: inset 0 -2px 0 var(--ouro); }

@media (max-width: 760px) {
  .topo { flex-wrap: wrap; padding: 0.5rem 1rem; gap: 0.5rem; }
  .marca { order: 1; }
  .conta { order: 2; margin-left: auto; min-width: 0; }
  .conta a { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .conta .perfil { display: none; }
  .menu { order: 3; flex: 1 0 100%; overflow-x: auto; flex-wrap: nowrap; }
  .menu a { white-space: nowrap; }
  main.pagina { padding: 1rem 1rem 3rem; }
  .itens-orcamento .col-qtd, .itens-orcamento .col-preco { width: 90px; }
  .itens-orcamento .col-desc { width: 70px; }
  .sino .rotulo-sino { display: none; }
  .aprovacao .numeros { justify-items: start; text-align: left; }
}
@media print {
  .topo, .faixa-ambiente, .acoes, .busca, details.anotar { display: none; }
  body { background: #fff; }
}
