:root {
  --azul: #1f3a5f; --azul-2: #2c5282; --azul-claro: #e8eef6;
  --fundo: #f5f6f8; --cartao: #fff; --texto: #1d232b; --suave: #5d6875; --linha: #e3e6ea;
  --verde: #1f7a4d; --verde-f: #e3f3ea; --vermelho: #b42318; --vermelho-f: #fdecea;
  --laranja: #b54708; --laranja-f: #fef0e1; --roxo: #6941c6; --roxo-f: #f1ecfb; --cinza-f: #eef0f2;
  --raio: 10px; --sombra: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--texto); background: var(--fundo); font-size: 15px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--azul-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; color: var(--suave); text-transform: uppercase; letter-spacing: .03em; }
button, input, select, textarea { font: inherit; color: inherit; }
.carregando { padding: 4rem 1rem; text-align: center; color: var(--suave); }

/* topo */
.topo { background: var(--azul); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.topo-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; }
.marca { display: flex; align-items: center; gap: .5rem; font-weight: 650; color: #fff; white-space: nowrap; }
.marca:hover { text-decoration: none; }
.marca img { width: 26px; height: 26px; border-radius: 6px; }
.nav { display: flex; gap: .15rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: #d6e2f0; padding: .4rem .7rem; border-radius: 8px; white-space: nowrap; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.nav a.ativo { background: rgba(255,255,255,.18); color: #fff; }
.usuario { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: #d6e2f0; white-space: nowrap; }
.usuario img { width: 28px; height: 28px; border-radius: 50%; }
.usuario button { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 7px; padding: .2rem .55rem; cursor: pointer; }
@media (max-width: 760px) {
  .topo-in { flex-wrap: wrap; gap: .4rem; }
  .nav { order: 3; flex-basis: 100%; }
  .usuario .email { display: none; }
}

main { max-width: 1280px; margin: 0 auto; padding: 1.1rem 1rem 4rem; }
.cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cab .sub { color: var(--suave); }
.acoes { display: flex; gap: .5rem; flex-wrap: wrap; }
.voltar { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }

/* botões */
.btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--linha); background: #fff; border-radius: 8px; padding: .45rem .85rem; cursor: pointer; font-size: .92rem; color: var(--texto); }
.btn:hover { background: #f8f9fb; text-decoration: none; }
.btn.prim { background: var(--azul-2); border-color: var(--azul-2); color: #fff; }
.btn.prim:hover { background: var(--azul); }
.btn.perigo { color: var(--vermelho); border-color: #f3c3bd; }
.btn.peq { padding: .25rem .6rem; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; color: var(--azul-2); cursor: pointer; padding: 0; }

/* cartões */
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grade { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); padding: .8rem 1rem; box-shadow: var(--sombra); }
.kpi .r { color: var(--suave); font-size: .82rem; }
.kpi .v { font-size: 1.3rem; font-weight: 650; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.kpi .d { color: var(--suave); font-size: .78rem; }

/* filtros */
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.filtros input[type=search] { flex: 1 1 260px; min-width: 200px; }
.campo, .filtros input, .filtros select, .form input, .form select, .form textarea {
  border: 1px solid #cfd5dc; border-radius: 8px; padding: .45rem .65rem; background: #fff; min-height: 38px;
}
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { border: 1px solid #cfd5dc; background: #fff; border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; cursor: pointer; }
.chip.on { background: var(--azul-2); border-color: var(--azul-2); color: #fff; }

/* etiquetas */
.tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .74rem; padding: .1rem .5rem; border-radius: 999px; background: var(--cinza-f); color: #344054; white-space: nowrap; font-weight: 550; }
.tag.vermelho { background: var(--vermelho-f); color: var(--vermelho); }
.tag.laranja { background: var(--laranja-f); color: var(--laranja); }
.tag.verde { background: var(--verde-f); color: var(--verde); }
.tag.azul { background: var(--azul-claro); color: var(--azul-2); }
.tag.roxo { background: var(--roxo-f); color: var(--roxo); }

/* tabelas */
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--suave); font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; padding: .5rem .55rem; border-bottom: 1px solid var(--linha); white-space: nowrap; cursor: default; }
th.ord { cursor: pointer; }
th.ord:hover { color: var(--texto); }
td { padding: .55rem; border-bottom: 1px solid #eef0f2; vertical-align: top; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: #f8fafc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cod { font-weight: 650; color: var(--azul-2); white-space: nowrap; }
.mudo { color: var(--suave); }
.peq { font-size: .84rem; }
.vazio { color: var(--suave); padding: 1rem 0; }

/* ficha */
.dl { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: .35rem .9rem; margin: 0; }
.dl dt { color: var(--suave); font-size: .86rem; }
.dl dd { margin: 0; word-break: break-word; }
.texto-longo { white-space: pre-wrap; font-size: .9rem; color: #2a313a; }
.alerta { background: var(--laranja-f); border: 1px solid #f9d6b0; color: #7a2e0e; border-radius: var(--raio); padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem; white-space: pre-wrap; }
.secao-titulo { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.secao-titulo h2 { margin: 0; }
.lista-docs { list-style: none; margin: 0; padding: 0; }
.lista-docs li { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 0; border-bottom: 1px solid #f0f2f4; }
.lista-docs li:last-child { border-bottom: 0; }
.ico-doc { flex: none; width: 30px; height: 36px; border-radius: 5px; background: #fdecea; color: #b42318; font-size: .62rem; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; }
.ico-doc.outro { background: var(--azul-claro); color: var(--azul-2); }
.ico-doc.sem { background: var(--cinza-f); color: var(--suave); }
.lista-docs .meta { color: var(--suave); font-size: .8rem; }
.lista-docs .tit { font-size: .9rem; word-break: break-word; }
.grupo-docs + .grupo-docs { margin-top: .4rem; }
details.grupo-docs > summary { cursor: pointer; font-weight: 600; font-size: .9rem; padding: .35rem 0; color: #344054; }

/* gráfico */
.grafico { max-width: 900px; }
.grafico svg { width: 100%; height: auto; max-height: 280px; display: block; }
.legenda { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--suave); margin-top: .3rem; }
.legenda span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; background: var(--c); vertical-align: -1px; }

/* visualizador */
.visor { position: fixed; inset: 0; background: #2b2f36; z-index: 50; display: flex; flex-direction: column; }
.visor-barra { display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem; background: #1d2026; color: #e6e9ee; flex-wrap: wrap; }
.visor-barra .titulo { flex: 1; min-width: 180px; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor-barra button, .visor-barra a { background: #383d46; color: #fff; border: 0; border-radius: 7px; padding: .35rem .7rem; cursor: pointer; font-size: .86rem; }
.visor-barra a:hover { text-decoration: none; background: #4a505b; }
.visor-paginas { flex: 1; overflow: auto; padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.visor-paginas canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); max-width: 100%; height: auto !important; }
.visor-paginas img { max-width: 100%; background: #fff; }
.visor-msg { color: #e6e9ee; padding: 2rem; text-align: center; }

/* modal */
.fundo-modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--linha); }
.modal header h2 { margin: 0; }
.modal .corpo { padding: 1rem 1.1rem; }
.modal footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--linha); }
.fechar { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--suave); line-height: 1; }
.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem .9rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .84rem; color: var(--suave); }
.form label.inteiro { grid-column: 1 / -1; }
.form label.check { flex-direction: row; align-items: center; gap: .45rem; color: var(--texto); }
.form textarea { min-height: 80px; resize: vertical; }
@media (max-width: 640px) { .form { grid-template-columns: 1fr; } .dl { grid-template-columns: 1fr; } .dl dt { margin-top: .4rem; } }
.linha-tit { display: grid; grid-template-columns: 2fr .7fr 1.3fr auto; gap: .4rem; margin-bottom: .6rem; }
.linha-tit .tobs { grid-column: 1 / -1; }
@media (max-width: 640px) { .linha-tit { grid-template-columns: 1fr 1fr; } }
.zona-envio { border: 2px dashed #cfd5dc; border-radius: 10px; padding: 1.2rem; text-align: center; color: var(--suave); cursor: pointer; }
.zona-envio.sobre { border-color: var(--azul-2); background: var(--azul-claro); }
.progresso { height: 6px; background: var(--cinza-f); border-radius: 999px; overflow: hidden; margin-top: .5rem; }
.progresso div { height: 100%; background: var(--azul-2); width: 0; transition: width .2s; }

/* login */
.login { max-width: 420px; margin: 12vh auto; text-align: center; }
.login .cartao { padding: 2rem 1.5rem; }
.login img { width: 56px; height: 56px; border-radius: 12px; }
.login p { color: var(--suave); }
#botao-google { display: flex; justify-content: center; margin: 1.2rem 0 .5rem; min-height: 44px; }
.erro { color: var(--vermelho); background: var(--vermelho-f); border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; }

.aviso { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #1d2026; color: #fff; padding: .6rem 1rem; border-radius: 9px; z-index: 80; box-shadow: 0 6px 18px rgba(0,0,0,.25); font-size: .9rem; max-width: 90vw; }
.aviso.erro-aviso { background: var(--vermelho); }
.rodape { color: var(--suave); font-size: .78rem; text-align: center; margin-top: 2rem; }
.cartao-imovel { display: block; color: inherit; }
.lista-cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }
.lista-cartoes .cartao { margin: 0; transition: border-color .15s; }
.lista-cartoes a:hover { text-decoration: none; }
.lista-cartoes a:hover .cartao { border-color: #9fb3cc; }
.ci-topo { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.ci-end { font-weight: 600; margin: .15rem 0 .35rem; }
.ci-val { display: flex; gap: 1rem; font-size: .84rem; color: var(--suave); margin-top: .45rem; flex-wrap: wrap; }
.ci-val b { color: var(--texto); font-variant-numeric: tabular-nums; }
.alternar { display: inline-flex; border: 1px solid #cfd5dc; border-radius: 8px; overflow: hidden; }
.alternar button { border: 0; background: #fff; padding: .4rem .7rem; cursor: pointer; font-size: .86rem; }
.alternar button.on { background: var(--azul-2); color: #fff; }
@media print { .topo, .acoes, .filtros { display: none !important; } main { padding: 0; } .cartao { box-shadow: none; break-inside: avoid; } }

.ci-uni { font-weight: 500; color: #344054; font-size: .92rem; }

.ci-foto { display: block; width: calc(100% + 2.2rem); margin: -1rem -1.1rem .7rem; height: 150px; object-fit: cover; border-radius: var(--raio) var(--raio) 0 0; background: var(--cinza-f); }
.foto-ficha { display: block; position: relative; margin-bottom: 1rem; border-radius: var(--raio); overflow: hidden; border: 1px solid var(--linha); background: var(--cinza-f); }
.foto-ficha img { display: block; width: 100%; height: 280px; object-fit: cover; }
.foto-ficha span { position: absolute; right: .5rem; bottom: .5rem; background: rgba(0,0,0,.55); color: #fff; font-size: .74rem; padding: .15rem .5rem; border-radius: 6px; }
@media (max-width: 640px) { .foto-ficha img { height: 190px; } }
