/* Análise de crédito · Minha Cirurgia
   Mesma família visual do IndicaCRM (wwwroot/css/admin.css): paleta da marca, menu lateral claro,
   barra no topo, cartões brancos sobre fundo quente, e os mesmos 70 desenhos de traço como ícones.
   Aqui o que manda é ler número rápido: tabular-nums em todo valor, e a CONTA à vista em todo
   resultado (renda − dívidas = renda livre, contra 3× a parcela). */

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --sidebar-bg: #fbfaf7;
  --border: #eceae4;
  --border-strong: #dcd9d0;
  --text: #2b2b2b;
  --text-muted: #8a887f;
  --primary: #221C59;         /* azul-marinho da marca */
  --primary-soft: #ecebf4;
  --accent-orange: #EC8A2E;   /* laranja da marca */
  --accent-purple: #8E2C6E;   /* roxo da marca */
  --danger: #c0492f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.03);

  /* Resultados: cada um com cor E desenho E palavra (nunca só a cor). */
  --ok-bg: #e7f4ec;   --ok-fg: #1f6b3d;  --ok-bd: #bfe3cd;
  --av-bg: #e4f1f1;   --av-fg: #175c5a;  --av-bd: #b9dcda;
  --ex-bg: #fdf0e3;   --ex-fg: #8a4610;  --ex-bd: #f2d2ae;
  --pe-bg: #ecebf4;   --pe-fg: #221C59;  --pe-bd: #d9d7ea;
  --er-bg: #f9ecea;   --er-fg: #8f3434;  --er-bd: #ecd1d1;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--primary); }
.num, .tab { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Casca ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; align-items: center; justify-content: center; padding: 4px 8px 18px; }
.brand img { max-width: 168px; height: auto; display: block; }
.brand-sub { font-size: 11.5px; color: var(--text-muted); text-align: center; margin: -10px 0 16px; letter-spacing: .02em; }

.nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 13.5px;
}
.nav a:hover { background: #f0eee8; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav .ico { width: 18px; height: 18px; opacity: .75; }
.nav a.active .ico { opacity: 1; }
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }
.nav-titulo { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 4px 11px; font-weight: 600; }
.sidebar-rodape { margin-top: auto; font-size: 11px; color: var(--text-muted); padding: 12px 11px 0; line-height: 1.5; }

.ico { width: 1em; height: 1em; vertical-align: -.14em; flex-shrink: 0; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 5;
}
.topbar .ticker { color: var(--text-muted); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.topbar .user strong { font-weight: 600; }
.topbar .user .papel { color: var(--text-muted); font-size: 12px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-orange); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.topbar-sair { background: none; border: 1.5px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; color: var(--text); cursor: pointer; font-family: inherit; }
.topbar-sair:hover { background: #f4f2ec; }

.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; margin-inline: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-sub { color: var(--text-muted); margin: 3px 0 0; }
.voltar { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); text-decoration: none; margin-bottom: 8px; }
.voltar:hover { color: var(--primary); }
.voltar .ico { transform: rotate(90deg); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600; font-family: inherit;
  text-decoration: none; cursor: pointer; border: 1px solid transparent; line-height: 1.2; white-space: nowrap;
}
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-laranja { background: var(--accent-orange); color: #fff; }
.btn-laranja:hover { filter: brightness(1.06); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #f4f2ec; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-link { background: none; border: none; color: var(--primary); padding: 4px 6px; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 14.5px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }
.btn-icone { background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px; cursor: pointer; color: var(--text-muted); display: inline-grid; place-items: center; }
.btn-icone:hover { background: #f0eee8; color: var(--text); }
.btn-icone .ico { width: 16px; height: 16px; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--primary); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-title .ico { width: 18px; height: 18px; color: var(--accent-orange); }
.card-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }

/* ---------- Tabelas ---------- */
table.table { width: 100%; border-collapse: collapse; }
table.table th, table.table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
table.table th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
table.table td.num, table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table .sub { color: var(--text-muted); font-size: 11.5px; }
table.table tr:last-child td { border-bottom: none; }
table.table tbody tr.clicavel { cursor: pointer; }
table.table select { min-width: 150px; padding: 6px 8px; font-size: 12.5px; }
table.table th { white-space: nowrap; }
table.table tbody tr.clicavel:hover td { background: #faf9f6; }
.tabela-rolagem { overflow-x: auto; }
.empty { color: var(--text-muted); text-align: center; padding: 34px 0; }
.empty .ico { width: 34px; height: 34px; display: block; margin: 0 auto 8px; opacity: .6; }

/* ---------- Selos ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border: 1px solid var(--border); white-space: nowrap; }
.chip .ico { width: 13px; height: 13px; }
.chip-APROVADO { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.chip-APROVADO_COM_AVALISTA { background: var(--av-bg); color: var(--av-fg); border-color: var(--av-bd); }
.chip-EXIGE_AVALISTA { background: var(--ex-bg); color: var(--ex-fg); border-color: var(--ex-bd); }
.chip-PENDENTE { background: var(--pe-bg); color: var(--pe-fg); border-color: var(--pe-bd); }
.chip-erro { background: var(--er-bg); color: var(--er-fg); border-color: var(--er-bd); }
.chip-neutro { background: #f3f1ec; color: #6d6b63; }
.chip-com-avalista { background: var(--av-bg); color: var(--av-fg); border-color: var(--av-bd); }
.chip-desatualizada { background: #fff7e0; color: #7a5d10; border-color: #f0e2b6; }

/* ---------- Indicadores da fila ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px;
  text-align: left; cursor: pointer; font-family: inherit; color: inherit; box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--border-strong); }
.tile.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tile-lbl { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.tile-lbl .bolinha { width: 8px; height: 8px; border-radius: 50%; }
.tile-val { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.tiles.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile.estatico { cursor: default; }
.tile.estatico:hover { border-color: var(--border); }
.filtros-consumo { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filtros-consumo .campo { min-width: 200px; }

/* Consumo: gasto por dia (uma barra por dia do mês) */
.grafico-dias svg { display: block; max-width: 100%; height: auto; }
.grafico-dias .grade { stroke: var(--border); stroke-width: 1; }
.grafico-dias .eixo { fill: var(--text-muted); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
.grafico-dias .eixo.hoje { fill: var(--accent-orange); font-weight: 700; }
.grafico-dias .barra { fill: var(--primary); }
.grafico-dias .barra.hoje { fill: var(--accent-orange); }
.grafico-dias .barra:hover { opacity: .8; }
.grafico-vazio { color: var(--text-muted); text-align: center; padding: 28px 0; margin: 0; }
.dias-tabela { margin-top: 12px; }
.dias-tabela summary { cursor: pointer; color: var(--text-muted); font-size: 12.5px; }

/* Consumo: ranking de quem mais usa */
.ranking .pos { width: 64px; color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.parte { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.parte-fundo { flex: 1; height: 8px; border-radius: 4px; background: var(--primary-soft); overflow: hidden; }
.parte-cheia { height: 100%; border-radius: 4px; background: var(--primary); }
.parte span { width: 38px; text-align: right; color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.table tbody tr.selecionado td { background: var(--primary-soft); }
.nota-consumo { margin-top: 14px; line-height: 1.55; max-width: 92ch; }

.filtros { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.busca { position: relative; flex: 1; min-width: 240px; max-width: 420px; }
.busca .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; }
.busca input { padding-left: 34px !important; width: 100%; }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > label, .campo > .rotulo { font-size: 12.5px; font-weight: 600; color: var(--text); }
.campo .ajuda { font-size: 11.5px; color: var(--text-muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: 9px; padding: 9px 11px; width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[readonly] { background: #f7f6f2; color: var(--text-muted); }
.grade { display: grid; gap: 14px; }
.grade.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.escolha { align-self: flex-start; display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.escolha label { display: inline-flex; align-items: center; padding: 8px 14px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--border); user-select: none; }
.escolha label:last-child { border-right: none; }
.escolha input { position: absolute; opacity: 0; pointer-events: none; }
.escolha label:has(input:checked) { background: var(--primary); color: #fff; font-weight: 600; }
.escolha label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.acoes { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.salvo { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }
.salvo .ico { color: var(--ok-fg); }

/* ---------- Mensagens ---------- */
.aviso { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 11px 13px; font-size: 13px; border: 1px solid; }
.aviso .ico { width: 18px; height: 18px; margin-top: 1px; }
.aviso + .aviso { margin-top: 8px; }
.aviso-info { background: var(--pe-bg); color: var(--pe-fg); border-color: var(--pe-bd); }
.aviso-atencao { background: #fff7e0; color: #6b5310; border-color: #f0e2b6; }
.aviso-erro { background: var(--er-bg); color: var(--er-fg); border-color: var(--er-bd); }
.aviso-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }

.toast-area { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: #2b2b2b; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: 380px; animation: entra .18s ease-out; }
.toast.erro { background: var(--danger); }
@keyframes entra { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Área de trabalho da análise ---------- */
.trabalho { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.painel-resultado { position: sticky; top: 76px; }
.secao-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; }

.pessoa-cab { display: flex; align-items: center; gap: 10px; }
.pessoa-cab .avatar { background: var(--primary); width: 34px; height: 34px; font-size: 13px; }
.pessoa-cab .avatar.avalista { background: var(--accent-purple); }
.pessoa-nome { font-weight: 700; font-size: 15px; }
.pessoa-papel { font-size: 12px; color: var(--text-muted); }

.docs { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.doc {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) 230px auto; gap: 10px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fcfbf8;
}
.doc .ico { width: 18px; height: 18px; color: var(--text-muted); }
.doc-nome { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-nome a { color: var(--text); text-decoration: none; }
.doc-nome a:hover { text-decoration: underline; }
.doc-meta { font-size: 11.5px; color: var(--text-muted); }
.doc select { padding: 6px 8px; font-size: 12.5px; }

.soltar {
  margin-top: 12px; border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 16px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: #fdfcfa;
}
.soltar.arrastando { border-color: var(--primary); background: var(--primary-soft); }
.soltar .ico-grande { width: 30px; height: 30px; color: var(--primary); }
.soltar strong { display: block; font-size: 13.5px; }
.soltar span { font-size: 12px; color: var(--text-muted); }
.soltar .btn { color: var(--text); font-size: 12.5px; }
/* Escondido só para os olhos: display:none impede a janela de arquivos em alguns navegadores. */
.soltar input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.soltar { position: relative; cursor: pointer; }
.fila-envio { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fila-envio li { display: grid; grid-template-columns: minmax(0, 1fr) 240px auto; gap: 10px; align-items: center; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: #fff7e0; border: 1px solid #f0e2b6; }

/* Veredito */
.veredito { border-radius: 12px; padding: 16px; border: 1px solid; display: flex; gap: 12px; align-items: flex-start; }
.veredito .ico { width: 26px; height: 26px; margin-top: 1px; }
.veredito-titulo { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.veredito-texto { font-size: 13px; margin-top: 3px; }
.v-APROVADO { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.v-APROVADO_COM_AVALISTA { background: var(--av-bg); color: var(--av-fg); border-color: var(--av-bd); }
.v-EXIGE_AVALISTA { background: var(--ex-bg); color: var(--ex-fg); border-color: var(--ex-bd); }
.v-PENDENTE { background: var(--pe-bg); color: var(--pe-fg); border-color: var(--pe-bd); }
.v-erro { background: var(--er-bg); color: var(--er-fg); border-color: var(--er-bd); }
.v-vazio { background: #faf9f6; color: var(--text-muted); border-color: var(--border); border-style: dashed; }

/* A CONTA: o número por trás do veredito */
.conta { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.conta-linha { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 13px; font-size: 13px; border-bottom: 1px solid var(--border); }
.conta-linha:last-child { border-bottom: none; }
.conta-linha .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.conta-linha .op { color: var(--text-muted); width: 14px; display: inline-block; }
.conta-linha.total { background: #faf9f6; font-weight: 700; }
.conta-linha.total .v { font-size: 15px; }
.conta-linha.regua { background: var(--primary-soft); color: var(--primary); }
.conta-linha.folga .v { color: var(--ok-fg); }
.conta-linha.falta .v { color: var(--ex-fg); }
/* Linhas da conta que abrem ao clicar: de onde veio cada número. */
.conta-det > summary { list-style: none; cursor: pointer; }
.conta-det > summary::-webkit-details-marker { display: none; }
.conta-det > summary:hover { background: #faf9f6; }
.conta-det > summary:focus-visible { outline-offset: -2px; }
.conta-det .abre { display: inline-flex; margin-left: 6px; color: var(--text-muted); vertical-align: -1px; transition: transform .15s; }
.conta-det .abre .ico { width: 11px; height: 11px; }
.conta-det[open] .abre { transform: rotate(180deg); }
.conta-abre { padding: 9px 13px 11px 27px; background: #fcfbf8; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.conta-itens { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.conta-itens li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.conta-itens small { display: block; color: var(--text-muted); font-size: 11.5px; margin-top: 1px; }
.conta-itens .v { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.conta-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; margin: 11px 0 6px; }
.conta-nota { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.conta-nota strong { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .conta-det .abre { transition: none; } }
.conta-titulo { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; padding: 9px 13px 0; }

.lista-passos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lista-passos li { display: flex; gap: 9px; font-size: 13px; align-items: flex-start; }
.lista-passos li .ico { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }
.bloco-titulo { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; margin: 16px 0 8px; }

.regras { list-style: none; margin: 0; padding: 0; }
.regras li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.regras li:last-child { border-bottom: none; }
.regras .ico { width: 16px; height: 16px; margin-top: 1px; }
.regras .passa .ico { color: var(--ok-fg); }
.regras .falha .ico { color: var(--ex-fg); }
.regras .pendente .ico { color: var(--primary); }
.regras code { font-family: Consolas, monospace; font-size: 11px; color: var(--text-muted); }

.progresso { display: flex; align-items: center; gap: 12px; }
.girando { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--pe-bd); border-top-color: var(--primary); animation: gira .9s linear infinite; flex-shrink: 0; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .girando { animation-duration: 2.4s; } .toast { animation: none; } }

/* ---------- Relatório ---------- */
.relatorio { max-width: 920px; margin-inline: auto; }
.rel-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid var(--primary); margin-bottom: 18px; }
.rel-cab img { height: 34px; }
.rel-meta { text-align: right; font-size: 12px; color: var(--text-muted); }
.rel-secao { margin-top: 22px; }
.rel-secao h2 { font-size: 15px; color: var(--primary); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.rel-secao h2 .ico { color: var(--accent-orange); width: 18px; height: 18px; }
.narrativa p { margin: 0 0 10px; font-size: 13.5px; }
.score-final { margin-top: 26px; border: 2px solid var(--primary); border-radius: 12px; padding: 16px 18px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.score-final .rot { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.score-final .val { font-size: clamp(24px, 7vw, 34px); font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Fim do relatório: score do SPC e risco real da operação, um embaixo do outro. */
.fechamento { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 26px; }
.fechamento .score-final { margin-top: 0; }

/* Risco real no painel da análise */
.risco { margin-top: 14px; border: 1.5px solid var(--primary); border-radius: 12px; padding: 12px 14px; }
.risco-linha { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.risco-rot { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--text-muted); }
.risco-val { font-size: 21px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.risco-conta { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Janela ---------- */
dialog { border: none; border-radius: var(--radius); padding: 0; box-shadow: 0 20px 60px rgba(10,8,40,.3); max-width: 480px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(20, 16, 50, .45); }
.dlg-corpo { padding: 22px 22px 8px; }
.dlg-corpo h2 { margin: 0 0 8px; font-size: 17px; color: var(--primary); }
.dlg-acoes { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 20px; }
.senha-mostrada { font-family: Consolas, monospace; font-size: 20px; letter-spacing: .06em; background: #f7f6f2; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px; text-align: center; margin: 12px 0; user-select: all; }

/* ---------- Entrar ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #221C59 0%, #2e2775 55%, #453a9e 100%); padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 36px 32px; box-shadow: 0 18px 50px rgba(10, 8, 40, .35); }
.auth-logo { display: block; height: 44px; margin: 0 auto 14px; }
.auth-title { font-size: 20px; font-weight: 800; color: var(--primary); margin: 0 0 4px; text-align: center; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 22px; text-align: center; }
.auth-card .campo + .campo { margin-top: 12px; }
.auth-btn { width: 100%; margin-top: 20px; padding: 12px; font-size: 14.5px; }
.auth-regras { font-size: 12px; color: var(--text-muted); margin: 14px 0 0; padding-left: 18px; }
.auth-regras li + li { margin-top: 3px; }

/* ---------- Telas menores (notebook pequeno) ---------- */
@media (max-width: 1180px) {
  .trabalho { grid-template-columns: minmax(0, 1fr); }
  .painel-resultado { position: static; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 18px 16px 40px; }
  .grade.c2, .grade.c3, .grade.c4 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .doc { grid-template-columns: 20px minmax(0, 1fr); }
  .doc select, .doc .doc-acoes { grid-column: 2; }
  .fila-envio li { grid-template-columns: minmax(0, 1fr); }
  .soltar { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .soltar .ico-grande { margin: 0 auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .ticker { display: none; }
}

/* ---------- Impressão do relatório ---------- */
@media print {
  .sidebar, .topbar, .nao-imprimir, .toast-area { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
