@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,600;1,9..144,500;1,9..144,600&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #12100c;
  --card-bg: #1c1812;
  --card-border: rgba(245, 238, 222, 0.08);
  --text-primary: #f5efe2;
  --text-muted: #9c9280;
  --text-faint: #6b6455;
  --accent: #ff6a3d;
  --accent-soft: rgba(255, 106, 61, 0.16);
  --accent-2: #e8c468;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Manrope', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  position: relative;
  overflow-x: hidden;
}

/* Atmosfera de fundo: glow radial + textura de grão */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 700px 500px at 18% 8%, rgba(255, 106, 61, 0.16), transparent 60%),
    radial-gradient(ellipse 600px 500px at 88% 92%, rgba(232, 196, 104, 0.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 40px 36px 36px;
  box-shadow:
    0 40px 80px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.2);
  animation: subir 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes subir {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Sistema de telas ---------- */

.tela { display: none; }

.tela.tela-ativa {
  display: block;
  animation: aparecer 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.btn-voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0 0 22px;
  transition: color 0.2s ease;
}

.btn-voltar:hover { color: var(--accent); }

.kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.subtitulo {
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 30px;
  max-width: 36ch;
}

/* ---------- Menu ---------- */

.menu-topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.menu-topo-esquerda {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-saudacao {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 600;
}

.menu-trial-badge {
  display: inline-block;
  width: fit-content;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #e4c98a;
  background: rgba(228, 179, 74, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
}

.menu-sair {
  border: none;
  background: none;
  color: var(--text-faint);
  font-family: 'Manrope', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 0.2s ease;
}

.menu-sair:hover { color: var(--accent); }

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  background: rgba(245, 238, 222, 0.025);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 26px 14px 22px;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  color: var(--text-primary);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.menu-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 106, 61, 0.5);
  background: rgba(245, 238, 222, 0.045);
  box-shadow: 0 16px 30px -14px rgba(255, 106, 61, 0.35);
}

.menu-card:active { transform: translateY(-1px) scale(0.99); }

.menu-card-icone {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.menu-card-titulo {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 19px;
}

.menu-card-desc {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.4;
}

.menu-historico {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 14px 16px;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.menu-historico:hover {
  border-color: rgba(255, 106, 61, 0.4);
  color: var(--text-primary);
  background: rgba(245, 238, 222, 0.03);
}

.menu-historico-icone {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-historico-icone svg { width: 20px; height: 20px; }

.menu-historico-seta {
  margin-left: auto;
  opacity: 0.6;
}

/* ---------- Cartão em destaque (Conciliação) ---------- */

.menu-featured {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 14px;
  padding: 18px 18px;
  background: linear-gradient(135deg, rgba(255, 106, 61, 0.1), rgba(232, 196, 104, 0.06));
  border: 1px solid rgba(255, 106, 61, 0.28);
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.menu-featured:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 106, 61, 0.55);
  box-shadow: 0 16px 30px -16px rgba(255, 106, 61, 0.4);
}

.menu-featured:active { transform: translateY(0); }

.menu-featured-icone {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 106, 61, 0.16);
  color: var(--accent);
}

.menu-featured-icone svg { width: 24px; height: 24px; }

.menu-featured-texto {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.menu-featured-titulo {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 17px;
  color: var(--text-primary);
}

.menu-featured-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.menu-featured-seta {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 18px;
}

/* ---------- Formulários (compartilhado) ---------- */

.campos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.campo { position: relative; }

.campo label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.campo .input-linha {
  display: flex;
  align-items: baseline;
  border-bottom: 1.5px solid rgba(245, 238, 222, 0.14);
  padding-bottom: 8px;
  transition: border-color 0.25s ease;
}

.campo .input-linha:focus-within { border-color: var(--accent); }

.campo input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 500;
  padding: 0;
}

.campo input::placeholder {
  color: var(--text-faint);
  opacity: 0.6;
}

.campo .unidade {
  font-size: 13px;
  color: var(--text-faint);
  font-weight: 600;
  white-space: nowrap;
  margin-left: 6px;
}

.erro-msg {
  color: #e8988a;
  font-size: 13px;
  min-height: 18px;
  margin: -4px 0 14px;
  font-weight: 600;
}

button.btn-calcular {
  width: 100%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #e8543a);
  color: #1a0f0a;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 16px;
  border-radius: 999px;
  box-shadow: 0 12px 28px -10px rgba(255, 106, 61, 0.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

button.btn-calcular:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px -10px rgba(255, 106, 61, 0.7);
}

button.btn-calcular:active { transform: translateY(0px) scale(0.99); }

/* ---------- Resultado (compartilhado) ---------- */

.resultado {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid rgba(245, 238, 222, 0.08);
  display: none;
}

.resultado.visivel {
  display: block;
  animation: aparecer 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.resultado-leitura {
  text-align: center;
  margin-top: 6px;
}

.numero-grande {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 54px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
}

.badge-pill .ponto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge-formula {
  color: var(--accent-2);
  background: rgba(232, 196, 104, 0.14);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 13.5px;
}

.rodape-nota {
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.5;
}

.salvo-nota {
  margin: 16px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.salvo-nota::before {
  content: "✓";
  color: #7CB37A;
  font-weight: 700;
}

/* ---------- Histórico ---------- */

.historico-secao-titulo {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 26px 0 12px;
}

.historico-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.historico-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(245, 238, 222, 0.025);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.historico-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.historico-item-valores {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.historico-item-data {
  font-size: 11px;
  color: var(--text-faint);
}

.historico-item-resultado {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 19px;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.historico-vazio {
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
  padding: 18px 0;
  margin: 0;
}

.btn-limpar {
  width: 100%;
  margin-top: 26px;
  background: none;
  border: 1px solid rgba(245, 238, 222, 0.1);
  color: var(--text-faint);
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-limpar:hover {
  border-color: #C24B3F;
  color: #e8988a;
}

/* ---------- Conciliação: upload ---------- */

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.upload-caixa {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 22px 12px;
  border: 1.5px dashed rgba(245, 238, 222, 0.16);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-caixa:hover {
  border-color: rgba(255, 106, 61, 0.5);
  background: rgba(245, 238, 222, 0.02);
}

.upload-caixa.preenchida {
  border-style: solid;
  border-color: rgba(124, 179, 122, 0.5);
  background: rgba(124, 179, 122, 0.06);
}

.upload-icone {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.upload-titulo {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-primary);
}

.upload-nome {
  font-size: 11px;
  color: var(--text-faint);
  word-break: break-word;
  line-height: 1.4;
}

/* ---------- Conciliação: resultados ---------- */

.conc-resultado-header {
  margin-bottom: 18px;
}

.conc-resultado-titulo {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.conc-resultado-arquivos {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.stat-box {
  background: rgba(245, 238, 222, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
}

.stat-numero {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
}

.stat-label {
  font-size: 9.5px;
  color: var(--text-faint);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.avisos-lista {
  margin: 14px 0 4px;
  padding: 10px 14px;
  background: rgba(228, 179, 74, 0.08);
  border: 1px solid rgba(228, 179, 74, 0.25);
  border-radius: 12px;
  font-size: 11.5px;
  color: #e4c98a;
  line-height: 1.6;
}

.conc-secao { margin-top: 10px; }

.secao-com-ponto {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ponto-secao {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ponto-vermelho { background: #C24B3F; }
.ponto-amarelo { background: #E4B34A; }
.ponto-azul { background: #6FA6D6; }

.secao-contagem {
  color: var(--text-faint);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.tabela-wrap {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: 14px;
}

table.tabela-conciliacao {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 320px;
}

table.tabela-conciliacao thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 12px;
  background: rgba(245, 238, 222, 0.03);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

table.tabela-conciliacao thead th:not(:first-child),
table.tabela-conciliacao tbody td:not(:first-child) {
  text-align: right;
}

table.tabela-conciliacao tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(245, 238, 222, 0.05);
  color: var(--text-muted);
  white-space: nowrap;
}

table.tabela-conciliacao tbody td:first-child {
  color: var(--text-primary);
  font-weight: 700;
}

table.tabela-conciliacao tbody tr:last-child td { border-bottom: none; }

.diff-negativa { color: #e8988a !important; font-weight: 700; }
.diff-positiva { color: #9bcf99 !important; font-weight: 700; }

.tabela-vazia {
  padding: 18px 14px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

.limite-nota {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  padding: 8px 0 2px;
}

/* ---------- Autenticação (login/cadastro) ---------- */

.abas-auth {
  display: flex;
  gap: 6px;
  background: rgba(245, 238, 222, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 26px;
}

.aba-auth {
  flex: 1;
  border: none;
  background: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 999px;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-faint);
  transition: background 0.2s ease, color 0.2s ease;
}

.aba-auth-ativa {
  background: var(--accent);
  color: #1a0f0a;
}

.painel-auth .campo:first-child { margin-top: 0; }

/* ---------- Painel administrativo ---------- */

.card-larga { max-width: 760px; }

.admin-topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.admin-topo .btn-limpar {
  width: auto;
  margin-top: 4px;
  padding: 10px 20px;
}

.badge-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-ok { background: rgba(124, 179, 122, 0.16); color: #9bcf99; }
.badge-pendente { background: rgba(228, 179, 74, 0.16); color: #e4c98a; }
.badge-bloqueado { background: rgba(194, 75, 63, 0.16); color: #e8988a; }

.admin-acoes {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.btn-acao {
  border: 1px solid var(--card-border);
  background: rgba(245, 238, 222, 0.03);
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-acao:hover {
  border-color: rgba(255, 106, 61, 0.5);
  color: var(--text-primary);
}

.btn-acao:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 760px) {
  .card-larga { max-width: 94vw; }
  .admin-acoes { flex-direction: column; }
}

/* ---------- Gauge (tela IMC) ---------- */

.gauge-wrap {
  position: relative;
  width: 260px;
  height: 136px;
  margin: 4px auto 0;
  overflow: hidden;
}

.gauge-dome {
  position: absolute;
  top: 0;
  left: 0;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: conic-gradient(
    from 270deg,
    #6FA6D6 0deg 21deg,
    #7CB37A 21deg 60deg,
    #E4B34A 60deg 90deg,
    #DB7F44 90deg 120deg,
    #C24B3F 120deg 150deg,
    #7A2B2B 150deg 180deg,
    #7A2B2B 180deg 360deg
  );
}

.gauge-cover {
  position: absolute;
  top: 44px;
  left: 44px;
  width: 172px;
  height: 172px;
  border-radius: 50%;
  background: var(--card-bg);
}

.gauge-tick {
  position: absolute;
  bottom: 2px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-faint);
}

.gauge-tick.min { left: 4px; }
.gauge-tick.max { right: 2px; }

.needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 3px;
  height: 96px;
  margin-left: -1.5px;
  background: linear-gradient(to top, var(--text-primary), transparent);
  border-radius: 3px;
  transform-origin: bottom center;
  transform: rotate(-90deg);
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.needle-pivot {
  position: absolute;
  bottom: -9px;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--card-bg), 0 0 18px 2px var(--accent-soft);
}

/* ---------- Triângulo (tela Hipotenusa) ---------- */

.triangulo-wrap {
  width: 100%;
  max-width: 300px;
  margin: 4px auto 0;
}

.triangulo-svg { width: 100%; height: auto; display: block; }

.triangulo-label {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
  fill: var(--text-muted);
}

.triangulo-label-c { fill: var(--accent); }

@media (max-width: 480px) {
  .card { padding: 32px 24px 28px; border-radius: 22px; }
  h1 { font-size: 27px; }
  .menu-card { padding: 22px 10px 18px; }
}
