:root {
  --ink: #14231f;
  --ink-2: #4e5f58;
  --muted: #7c8a83;
  --paper: #f2f4ef;
  --surface: #ffffff;
  --surface-2: #e8ece2;
  --line: rgba(20, 38, 33, 0.14);
  --teal: #0e6b62;
  --teal-soft: #d9ece8;
  --amber: #b5651d;
  --amber-soft: #f3e3d1;
  --flag: #a83a2a;
  --flag-soft: #f6e2de;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 38, 33, .06), 0 8px 20px -12px rgba(20, 38, 33, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
}

a { color: var(--teal); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nav a { font-size: 13.5px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--teal); }
.nav form { display: inline; }
.nav button.linklike {
  background: none; border: none; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer;
}
.nav button.linklike:hover { color: var(--flag); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 40px 28px 80px; }

h1 { font-size: 28px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 32px 0 14px; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.lede { color: var(--ink-2); max-width: 62ch; margin-bottom: 24px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-family: "Consolas", monospace; font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--ink-2); }
.stat.accent .v { color: var(--teal); }
.stat.warn .v { color: var(--amber); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  background: var(--teal-soft); color: var(--teal);
}
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.flag { background: var(--flag-soft); color: var(--flag); }

form.sim-form { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 26px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.field input {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 14px;
  font-family: "Consolas", monospace; background: var(--surface); color: var(--ink); width: 180px;
}
.field input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
button.btn {
  background: var(--teal); color: #fff; border: none; border-radius: 8px; padding: 10px 20px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
button.btn:hover { background: #0a544d; }

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--line); padding: 8px 12px; background: var(--surface-2);
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
/* `white-space: nowrap` porque "R$ 210.000,00" quebrava entre o R$ e o
   número quando a coluna apertava, e uma coluna de valores com metade
   das linhas em duas alturas fica ilegível. */
td.num, th.num {
  font-family: "Consolas", monospace; text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Seletor de cenário de preço do filé — usado na home e na página de retorno. */
.cenarios { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.cenarios .rotulo { font-size: 12px; font-weight: 600; color: var(--ink-2); }
/* Serve ao <button> da home (troca sem recarregar) e ao <a> da página de
   retorno (recarrega com o preço na URL). */
.cenario-btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); border-radius: 20px; padding: 6px 16px; font: inherit;
  font-size: 13px; font-weight: 600; line-height: 1.4; text-decoration: none;
  cursor: pointer; transition: all .12s ease;
}
.cenario-btn:hover { border-color: var(--teal); color: var(--teal); }
.cenario-btn[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }

/* Linha de total: fecha a tabela e é onde o olho do investidor vai primeiro. */
tbody tr.total td { border-top: 2px solid var(--line); border-bottom: none; background: var(--surface-2); }
/* Marca a linha do cenário que está selecionado no momento. */
tbody tr.destacada td { background: var(--teal-soft); }
tbody tr.destacada td:first-child { box-shadow: inset 3px 0 0 var(--teal); }

/* Unidade ao lado de um valor numérico, e a coluna de procedência. */
.unidade { font-family: "Segoe UI", system-ui, sans-serif; font-size: 11px; color: var(--muted); font-weight: 400; }
td.origem, th.origem { font-size: 12.5px; color: var(--ink-2); max-width: 46ch; }

.alerta { color: var(--flag); }

.riscos { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--ink-2); }
.riscos li { margin-bottom: 10px; }
.riscos li:last-child { margin-bottom: 0; }
.riscos strong { color: var(--ink); }

/* O item de navegação para a página de retorno — é o destino da apresentação. */
.nav a.destaque { color: var(--teal); font-weight: 700; }

/* Compensa a barra de topo fixa (`.topbar` é sticky) para um link com
   âncora (ex.: #transporte, vindo do organograma) não parar coberto por ela. */
.bar-row[id] { scroll-margin-top: 76px; }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar-label { width: 220px; font-size: 13px; color: var(--ink-2); flex: none; }
.bar-track { flex: 1; height: 18px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--teal); border-radius: 4px; }
.bar-value { width: 150px; text-align: right; font-family: "Consolas", monospace; font-size: 12.5px; flex: none; }

.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--teal); background: var(--surface);
  border-radius: 8px; padding: 14px 18px; font-size: 13.5px; color: var(--ink-2); margin: 18px 0;
}
.callout.flag { border-left-color: var(--flag); }
.callout strong { color: var(--ink); }

.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 10px; }
@media (max-width: 800px) { .project-grid { grid-template-columns: 1fr; } }
.project-card {
  display: block; text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow); transition: transform .1s ease, border-color .1s ease;
}
.project-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.project-card h3 { margin: 6px 0 6px; font-size: 17px; color: var(--ink); }
.project-card p { margin: 0; font-size: 13px; color: var(--ink-2); }

.helptext { font-size: 12px; color: var(--muted); }

/* O palco da apresentação em tela cheia — ver o comentário em base.html e
   static/js/tela_cheia.js. Fica sobre tudo e só aparece quando acionado. */
.palco { position: fixed; inset: 0; z-index: 9999; background: var(--paper); }
.palco[hidden] { display: none; }
.palco-tela { display: block; width: 100%; height: 100%; border: 0; }

/* Página de login — um card único, "vidro" sobre um fundo escuro animado,
   em vez do card simples de antes. Sem `.topbar` nesta tela (só aparece
   para `user.is_authenticated`, ver base.html).

   `margin` negativa cancela exatamente o padding do `.wrap` (40 28 80) para
   o fundo poder ir de fronteira a fronteira da tela — sem isso, o fundo
   ficaria com uma moldura da cor `--paper` por causa do padding do `.wrap`.
   As três "orbs" (`::before`/`::after` do shell + `.login-orbe`) são
   `position: fixed`, então ignoram esse recuo e cobrem o viewport inteiro
   de qualquer forma; a margem negativa é só para o `min-height: 100vh`
   comportar-se como esperado. */
.login-shell {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  margin: -40px -28px -80px;
  padding: 40px 28px 80px;
}
.login-shell::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(135deg, #0a2e26 0%, #0e6b62 48%, #123c2f 100%);
}
.login-orbe {
  position: fixed; z-index: -1; border-radius: 50%; filter: blur(70px);
  opacity: .5; pointer-events: none;
}
.login-orbe--1 {
  width: 560px; height: 560px; top: -160px; left: -140px;
  background: radial-gradient(circle, #14a08f 0%, transparent 70%);
  animation: login-deriva-1 24s ease-in-out infinite alternate;
}
.login-orbe--2 {
  width: 460px; height: 460px; bottom: -180px; right: -120px;
  background: radial-gradient(circle, #2f8f45 0%, transparent 70%);
  animation: login-deriva-2 28s ease-in-out infinite alternate;
}
.login-orbe--3 {
  width: 320px; height: 320px; top: 55%; right: 12%; opacity: .28;
  background: radial-gradient(circle, var(--amber) 0%, transparent 70%);
  animation: login-deriva-3 32s ease-in-out infinite alternate;
}
@keyframes login-deriva-1 { from { transform: translate(0, 0); } to { transform: translate(70px, 50px); } }
@keyframes login-deriva-2 { from { transform: translate(0, 0); } to { transform: translate(-60px, -40px); } }
@keyframes login-deriva-3 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-40px, 30px) scale(1.18); } }

.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .6); border-radius: 20px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(20, 38, 33, .03);
  padding: 44px 40px 38px;
  animation: login-entra .55s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes login-entra { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }

.login-marca { text-align: center; margin-bottom: 30px; }
.login-monograma {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 16px;
  background: linear-gradient(155deg, var(--teal) 0%, #0a4038 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -8px rgba(14, 107, 98, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.login-monograma svg { width: 30px; height: 30px; }
.login-marca .kicker {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.login-marca h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; color: var(--ink); }
.login-marca p { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }

.login-card form { display: flex; flex-direction: column; gap: 18px; margin-top: 4px; }
.login-card .field label { font-weight: 600; }
.login-card .field input {
  width: 100%; padding: 12px 14px; font-size: 14.5px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.login-card .field input:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft);
}
.login-card button.btn.btn-block {
  width: 100%; padding: 13px; font-size: 15px; margin-top: 2px; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal) 0%, #0a4038 100%);
  box-shadow: 0 10px 20px -8px rgba(14, 107, 98, .5);
  transition: transform .15s ease, box-shadow .15s ease;
}
.login-card button.btn.btn-block:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -8px rgba(14, 107, 98, .6); }
.login-card button.btn.btn-block:active { transform: translateY(0); box-shadow: 0 6px 14px -6px rgba(14, 107, 98, .5); }
.login-erro {
  background: var(--flag-soft); color: var(--flag); border-radius: 8px; border-left: 3px solid var(--flag);
  padding: 10px 12px; font-size: 13px; font-weight: 600;
}
.login-rodape { margin: 26px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .login-orbe, .login-card { animation: none; }
}
