:root {
  --fundo: #f3f4f1;
  --papel: #ffffff;
  --tinta: #17212e;
  --tinta-2: #5b6675;
  --linha: #dfe2dc;
  --marinho: #10233c;
  --marinho-2: #1a3355;
  --sol: #f2a51a;
  --azul: #1757a6;
  --azul-escuro: #114483;
  --ok: #1d7a4a;
  --ok-fundo: #e3f3ea;
  --alerta: #8a5a00;
  --alerta-fundo: #fdf0d2;
  --erro: #b3261e;
  --erro-fundo: #fbe6e4;
  --raio: 8px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.01em; }
h2 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--tinta-2); margin: 1.6rem 0 0.8rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--linha);
}
.cartao > h2:first-child, form.cartao > input[type=hidden] + h2 { margin-top: 0; }
[hidden] { display: none !important; }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.lateral {
  background: var(--marinho); color: #d6deea;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
main { padding: 1.6rem 2rem 4rem; min-width: 0; }

.marca { display: flex; align-items: center; gap: 0.7rem; padding: 1.2rem 1.1rem; color: #fff; }
.marca:hover { text-decoration: none; }
.marca strong { display: block; font-size: 1rem; line-height: 1.15; }
.marca small { display: block; color: var(--sol); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
.marca.escura { color: var(--tinta); padding: 0 0 1.2rem; }
.marca-sol {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 50%, var(--sol) 0 42%, transparent 44%),
              repeating-conic-gradient(var(--sol) 0 9deg, transparent 9deg 30deg);
}

.lateral nav { flex: 1; padding: 0.4rem 0; }
.lateral details { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.lateral summary {
  list-style: none; cursor: pointer; padding: 0.75rem 1.1rem;
  font-weight: 600; color: #fff; display: flex; justify-content: space-between; align-items: center;
}
.lateral summary::-webkit-details-marker { display: none; }
.lateral summary::after {
  content: ""; width: 7px; height: 7px; border-right: 2px solid #8fa1ba; border-bottom: 2px solid #8fa1ba;
  transform: rotate(-45deg); transition: transform 0.15s;
}
.lateral details[open] > summary::after { transform: rotate(45deg); }
.lateral nav a {
  display: block; padding: 0.5rem 1.1rem 0.5rem 1.6rem; color: #c3cedd;
  border-left: 3px solid transparent;
}
.lateral nav a:hover { background: var(--marinho-2); text-decoration: none; color: #fff; }
.lateral nav a.ativo { background: var(--marinho-2); color: #fff; border-left-color: var(--sol); }
.lateral details > a:last-child { margin-bottom: 0.5rem; }
.conta { padding: 1rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.9rem; }
.conta-nome { color: #fff; font-weight: 600; margin-bottom: 0.3rem; overflow-wrap: anywhere; }
.conta a, .conta .link { color: #a9b8cc; display: inline-block; margin-right: 0.9rem; }
.conta form { display: inline; }

/* ---------- blocos ---------- */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.sub { color: var(--tinta-2); margin: 0.2rem 0 0; font-size: 0.9rem; }
.cartao {
  background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 1.3rem 1.4rem; margin-bottom: 1.2rem;
}
.cartao.estreito { max-width: 520px; }
.cartao.vazio { text-align: center; padding: 2.6rem 1rem; color: var(--tinta-2); }
.cartao.pendencias { background: var(--alerta-fundo); border-color: #f0d9a3; color: #5c3d00; padding: 0.8rem 1.1rem; }
.duas-colunas { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 1.2rem; align-items: start; }

/* ---------- formulários ---------- */
label, fieldset { display: block; margin: 0 0 0.95rem; }
label > span:first-child, legend { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 0.3rem; padding: 0; }
label em { font-weight: 400; color: var(--tinta-2); font-style: normal; }
fieldset { border: 0; padding: 0; min-width: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid #c3c8c0; border-radius: 6px; padding: 0.5rem 0.6rem; min-height: 2.45rem;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--azul); outline-offset: 1px;
}
.lateral a:focus-visible, .lateral summary:focus-visible, .lateral button:focus-visible { outline-color: var(--sol); }
label small, li small { display: block; color: var(--tinta-2); font-size: 0.82rem; margin-top: 0.3rem; }
small.erro { color: var(--erro); font-weight: 600; }
.com-erro input, .com-erro select { border-color: var(--erro); background: #fffafa; }
.obrig { color: var(--erro); }
.marcar { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; margin-bottom: 0.4rem; cursor: pointer; }
.marcar input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--azul); }
fieldset.horizontal { display: flex; gap: 1.4rem; flex-wrap: wrap; }
fieldset.horizontal legend { float: left; width: 100%; }
fieldset.horizontal .marcar { margin: 0; }
.grade { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.grade > * { min-width: 0; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: 1 / -1; }
.par { display: grid; grid-template-columns: minmax(0, 1fr) 4.6rem; gap: 0.4rem; }
.resumo { margin: 0 0 0.95rem; padding: 0.6rem 0.8rem; background: var(--fundo); border-radius: 6px; font-size: 0.92rem; }
.acoes { display: flex; gap: 0.6rem; margin-top: 0.6rem; flex-wrap: wrap; }
.filtros { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filtros input { flex: 1 1 260px; }
.filtros select { flex: 0 1 240px; }

.botao {
  display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600;
  padding: 0.5rem 1rem; min-height: 2.45rem; border-radius: 6px; cursor: pointer;
  border: 1px solid #c3c8c0; background: #fff; color: var(--tinta); white-space: nowrap;
}
.botao:hover { background: #f1f2ee; text-decoration: none; }
.botao.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.botao.primario:hover { background: var(--azul-escuro); }
.botao.largo { width: 100%; }
.botao.pequeno { min-height: 0; padding: 0.25rem 0.65rem; font-size: 0.86rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--azul); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.perigo { color: var(--erro); }
.em-linha { display: inline; margin-left: 0.8rem; }

/* ---------- tabelas ---------- */
.tabela-rolavel { overflow-x: auto; }
.cartao.tabela-rolavel { padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tinta-2); background: #fafaf8; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafaf8; }
table.compacta th, table.compacta td { padding: 0.5rem 0.7rem; }
.direita { text-align: right; }
.nowrap { white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }

.selo { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 99px; white-space: nowrap; }
.selo.ok { background: var(--ok-fundo); color: var(--ok); }
.selo.alerta { background: var(--alerta-fundo); color: var(--alerta); }
.selo.neutro { background: #e9ebe6; color: var(--tinta-2); }
.selo.grande { font-size: 0.9rem; padding: 0.3rem 0.8rem; }

.aviso { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; }
.aviso-ok { background: var(--ok-fundo); border-color: #b9dfc8; color: #135834; }
.aviso-erro { background: var(--erro-fundo); border-color: #f0c2be; color: #8c1d18; }
.aviso-aviso { background: var(--alerta-fundo); border-color: #f0d9a3; color: #5c3d00; }

/* ---------- documentos ---------- */
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { padding: 0.85rem 0; border-bottom: 1px solid var(--linha); }
.docs li:last-child { border-bottom: 0; }
.doc-titulo { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.4rem; }
.doc-titulo strong { flex: 1; }
.marca-doc {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700; border: 2px solid #c3c8c0; color: #fff;
}
.feito .marca-doc { background: var(--ok); border-color: var(--ok); }
.arq { margin: 0 0 0.45rem 1.8rem; font-size: 0.92rem; overflow-wrap: anywhere; }
.arq small { display: inline; margin-left: 0.4rem; }
.docs form:not(.em-linha) { margin-left: 1.8rem; }
.docs li > small { margin-left: 1.8rem; }
.enviar { display: inline-block; margin: 0; position: relative; }
.enviar input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.enviar span {
  display: inline-block; font-size: 0.86rem; font-weight: 600; color: var(--azul);
  border: 1px dashed #9db4d3; border-radius: 6px; padding: 0.3rem 0.7rem; margin: 0;
}
.enviar:hover span, .enviar:focus-within span { background: #eef4fb; border-style: solid; }
.zona-perigo { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--linha); text-align: right; }

/* ---------- login ---------- */
.tela-login { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: var(--marinho); }
.login { width: 100%; max-width: 360px; padding: 1.8rem; margin: 0; }

/* ---------- telas menores ---------- */
@media (max-width: 1080px) {
  .duas-colunas { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { position: static; height: auto; }
  main { padding: 1rem 1rem 3rem; }
  .grade { grid-template-columns: minmax(0, 1fr); }
  .col-2, .col-3 { grid-column: auto; }
}

label > span[data-pessoa] { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 0.3rem; }
fieldset.horizontal legend { margin-bottom: 0.5rem; }

/* ---------- documentos do inversor / painel ---------- */
.docs-cadastro { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 0.4rem; }
.doc-cad { border: 1px solid var(--linha); border-radius: 6px; padding: 0.8rem 0.9rem; }
.doc-cad .arq { margin-left: 0; }
.doc-cad .arq .link { margin-left: 0.6rem; }
.doc-cad .arq-novo { margin: 0.5rem 0 0; }
.marca-doc.cheia { background: var(--ok); border-color: var(--ok); }
input[type=file] { max-width: 100%; font: inherit; font-size: 0.88rem; }
@media (max-width: 760px) { .docs-cadastro { grid-template-columns: minmax(0, 1fr); } }
.dica-leitura { margin: 0 0 0.95rem; max-width: 75ch; }
.acoes + h2 { margin-top: 1.8rem; }
h3 { font-size: 0.92rem; margin: 0.6rem 0 0.7rem; color: var(--tinta); }
.grade > h3:first-child { margin-top: 0; }
.versao { font-size: 0.75rem; color: #7f90a8; margin-bottom: 0.5rem; }
.escolha-pessoa { margin-bottom: 1.2rem; padding: 0.8rem 1rem; background: var(--fundo); border-radius: 6px; }
.botao.perigo { color: var(--erro); border-color: #e5b5b1; }
.botao.perigo:hover { background: var(--erro-fundo); }
.botao.empurra { margin-left: auto; }
