@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;1,9..144,300&family=Instrument+Sans:wght@400;500&display=swap');/* Preview do chat de IA: placeholder do input -30% (10.5px -> 7.35px) sem mexer no texto digitado */
.chat-preview-input::placeholder {
  font-size: 7.35px;
}

/* Reset fundamental para ocupar 100% da tela.
   html ancora na viewport (100vw/100vh); body e #root preenchem via 100% (do pai),
   para que a compensação do zoom (abaixo) valha para toda a cadeia sem sobra. */
html {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#root {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* Garantia de que containers Tailwind que usem h-screen ou h-full funcionem (base/mobile) */
.h-screen {
  height: 100vh !important;
}

/* Celular (Safari iOS): 100vh é a tela com as barras do navegador RECOLHIDAS, maior que a área
   visível. Com html/body em 100vh e o app em 100dvh, o Safari rolava o documento pela diferença:
   o conteúdo subia por baixo do cabeçalho fixo e sobrava a mesma faixa embaixo. No celular tudo
   usa a altura VISÍVEL (dvh). Navegador sem dvh descarta a declaração e mantém o 100vh acima. */
@media (max-width: 899px) {
  html,
  body {
    height: 100dvh;
    overscroll-behavior: none;
  }

  .h-screen {
    height: 100dvh !important;
  }
}

.h-full {
  height: 100% !important;
}

/* Escala global do app em 90% no DESKTOP (como o zoom 90% do navegador) — preferência do Joao.
   Escalamos o #root por 0.9 a partir do canto superior-esquerdo e o dimensionamos a 111,11%
   (=100/0.9) para, DEPOIS da escala, preencher a tela INTEIRA — largura E altura — sem faixa
   branca. Como o #root fica com largura EXPLÍCITA de 111,11%, o conteúdo interno (width:auto)
   ocupa toda a largura (o zoom no html deixava isso resolver como 100vw → sobra à direita).
   O container raiz (.h-screen) passa a 100% para preencher o #root. O body (100vw, overflow
   hidden) recorta a sobra de layout; o visual escalado fica dentro. Mobile (<900px) fica 100%
   (melhor para toque). Vem DEPOIS do .h-screen base para sobrescrevê-lo. */
@media (min-width: 900px) {
  #root {
    transform: scale(0.9);
    transform-origin: top left;
    width: 111.112vw;
    height: 111.112vh;
  }

  .h-screen {
    height: 100% !important;
  }
}

/* Altura de referência para áreas que preenchem a viewport (tabelas/painéis com calc(100vh - N)).
   Como no desktop o #root é um canvas de 111,11% escalado a 0.9, um "100vh" ali dentro fica ~11%
   curto (sobra espaço vazio abaixo). Essas áreas usam var(--app-vh): 111,112vh no desktop (chega
   até o fim) e 100vh no mobile (sem zoom). */
:root {
  --app-vh: 100vh;
}

@media (min-width: 900px) {
  :root {
    --app-vh: 111.112vh;
  }
}

/* Scrollbars elegantes para não quebrar o layout */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Redução de escala para área de conteúdo - BLOCO 3 */
.content-area-scale {
  /* Redução global de escala de 20% para visual mais denso e profissional */
  transform: scale(0.9);
  transform-origin: top left;
  width: 111.11%;
  /* Compensa o scale(0.9) para preencher a largura total: 1 / 0.9 */
  height: 111.11%;
  /* Compensa o scale(0.9) para preencher a altura total */

  /* Reduções específicas de tipografia e espaçamento para maior precisão visual */
  font-size: 0.8rem;
  line-height: 1.25;
}

.content-area-scale h1 {
  font-size: 1.25rem !important;
  /* text-xl eq */
  letter-spacing: -0.025em;
}

.content-area-scale h2 {
  font-size: 1.125rem !important;
  /* text-lg eq */
}

.content-area-scale h3 {
  font-size: 0.9rem !important;
}

/* Redução de paddings internos via variável CSS para afetar componentes filhos se necessário */
.content-area-scale .p-8 {
  padding: 1rem !important;
}

.content-area-scale .p-6 {
  padding: 1rem !important;
}

.content-area-scale .p-4 {
  padding: 0.75rem !important;
}

.content-area-scale .gap-8 {
  gap: 1rem !important;
}

.content-area-scale .gap-6 {
  gap: 0.75rem !important;
}

.content-area-scale .gap-4 {
  gap: 0.5rem !important;
}

.content-area-scale .grid-cols-3 {
  gap: 0.75rem !important;
}

.content-area-scale .grid-cols-4 {
  gap: 0.75rem !important;
}

/* Ajuste fino para stat cards */
.content-area-scale .stat-card-value {
  font-size: 1.5rem !important;
  letter-spacing: -0.05em;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Remove scrollbars intrusivos na área skalada para não duplicar */
.content-area-scale::-webkit-scrollbar {
  display: none;
}

.content-area-scale {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ========================================
   GLASSMORPHISM PREMIUM - Dashboard
   ======================================== */

/* Glass Card Base */
.glass-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 1.5rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 20px 40px rgba(59, 130, 246, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  transform: translateY(-2px);
}

/* Glass Card Variants */
.glass-card-blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(99, 102, 241, 0.05));
  border-color: rgba(59, 130, 246, 0.2);
}

.glass-card-emerald {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(20, 184, 166, 0.05));
  border-color: rgba(16, 185, 129, 0.2);
}

.glass-card-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(234, 88, 12, 0.05));
  border-color: rgba(245, 158, 11, 0.2);
}

.glass-card-purple {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(168, 85, 247, 0.05));
  border-color: rgba(139, 92, 246, 0.2);
}

/* Staggered Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Stagger delays */
.stagger-1 { animation-delay: 0.05s; opacity: 0; }
.stagger-2 { animation-delay: 0.1s; opacity: 0; }
.stagger-3 { animation-delay: 0.15s; opacity: 0; }
.stagger-4 { animation-delay: 0.2s; opacity: 0; }
.stagger-5 { animation-delay: 0.25s; opacity: 0; }
.stagger-6 { animation-delay: 0.3s; opacity: 0; }
.stagger-7 { animation-delay: 0.35s; opacity: 0; }
.stagger-8 { animation-delay: 0.4s; opacity: 0; }

/* Dashboard Background Gradient */
.dashboard-gradient {
  background: linear-gradient(135deg,
    #f8fafc 0%,
    rgba(239, 246, 255, 0.6) 25%,
    rgba(238, 242, 255, 0.4) 50%,
    rgba(250, 245, 255, 0.3) 75%,
    #f8fafc 100%
  );
}

/* Stat value styling */
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* Trend indicator */
.trend-positive {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.trend-negative {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ========================================
   CHAT CONTENT - Formatação Markdown
   ======================================== */

.chat-content {
  font-size: 0.75rem;
  line-height: 1.5;
}

.chat-content p {
  margin: 0.5em 0;
}

.chat-content p:first-child {
  margin-top: 0;
}

.chat-content p:last-child {
  margin-bottom: 0;
}

.chat-content strong {
  font-weight: 700;
}

.chat-content em {
  font-style: italic;
}

.chat-content ul,
.chat-content ol {
  margin: 0.5em 0;
  padding-left: 1.25em;
}

.chat-content li {
  margin: 0.25em 0;
}

.chat-content ul {
  list-style-type: disc;
}

.chat-content ol {
  list-style-type: decimal;
}

.chat-content h1,
.chat-content h2,
.chat-content h3,
.chat-content h4,
.chat-content h5,
.chat-content h6 {
  font-weight: 700;
  margin: 0.75em 0 0.25em 0;
  line-height: 1.3;
}

.chat-content h1 { font-size: 1.1em; }
.chat-content h2 { font-size: 1em; }
.chat-content h3 { font-size: 0.95em; }

.chat-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 0.125em 0.375em;
  border-radius: 0.25em;
  font-family: monospace;
  font-size: 0.9em;
}

.chat-content blockquote {
  border-left: 3px solid currentColor;
  opacity: 0.8;
  padding-left: 0.75em;
  margin: 0.5em 0;
  font-style: italic;
}

.chat-content hr {
  border: none;
  border-top: 1px solid currentColor;
  opacity: 0.2;
  margin: 0.75em 0;
}
/* Entendimento na abertura (chat): brilho discreto que percorre o preenchimento do trilho de progresso. */
.intake-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 30%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.45) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-120%);
  animation: intakeShine 2.4s ease-in-out infinite;
}
@keyframes intakeShine {
  to { transform: translateX(420%); }
}
@media (prefers-reduced-motion: reduce) {
  .intake-shine::after { animation: none; }
}

/* ─────────────────────────────────────────────────────────────────────────────────────────────────
 * Tipografia de documento (.prose). O Tailwind vem pela CDN SEM o plugin de tipografia, então as classes
 * `prose`/`prose-sm` não faziam nada: pareceres, pacote da esteira e respostas da IA apareciam com títulos e
 * parágrafos colados. Estilo próprio, sóbrio, de peça jurídica; cores herdadas (funciona em claro e escuro).
 * ───────────────────────────────────────────────────────────────────────────────────────────────── */
.prose { font-size: 15px; line-height: 1.75; color: inherit; overflow-wrap: break-word; }
.prose.prose-sm { font-size: 14px; line-height: 1.7; }
.prose > :first-child, .prose .ProseMirror > :first-child { margin-top: 0 !important; }
.prose > :last-child, .prose .ProseMirror > :last-child { margin-bottom: 0 !important; }
.prose p { margin: 0 0 0.9em; }
.prose .ProseMirror p { text-align: justify; hyphens: auto; }
.prose h1 { font-size: 1.6em; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; margin: 1.6em 0 0.6em; }
.prose h2 { font-size: 1.28em; line-height: 1.3; font-weight: 700; margin: 1.7em 0 0.55em; padding-bottom: 0.3em; border-bottom: 1px solid rgba(148, 163, 184, 0.35); }
.prose h3 { font-size: 1.08em; line-height: 1.4; font-weight: 600; margin: 1.4em 0 0.45em; }
.prose h4 { font-size: 1em; font-weight: 600; margin: 1.2em 0 0.4em; }
.prose strong, .prose b { font-weight: 600; }
.prose ul, .prose ol { margin: 0.4em 0 1em; padding-left: 1.6em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 0.3em 0; padding-left: 0.2em; }
.prose li > p { margin: 0.2em 0; }
.prose li::marker { color: rgba(100, 116, 139, 0.9); }
.prose blockquote { margin: 1.2em 0; padding: 0.4em 0 0.4em 1em; border-left: 3px solid rgba(16, 185, 129, 0.55); font-style: italic; opacity: 0.92; }
.prose hr { margin: 1.8em 0; border: 0; border-top: 1px solid rgba(148, 163, 184, 0.4); }
.prose a { color: #047857; text-decoration: underline; text-underline-offset: 2px; }
.prose code { font-size: 0.9em; padding: 0.1em 0.35em; border-radius: 4px; background: rgba(148, 163, 184, 0.18); }
.prose table { width: 100%; margin: 1.2em 0; border-collapse: collapse; font-size: 0.95em; }
.prose th, .prose td { padding: 0.5em 0.7em; border: 1px solid rgba(148, 163, 184, 0.45); vertical-align: top; text-align: left; }
.prose th { font-weight: 600; background: rgba(148, 163, 184, 0.12); }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
.prose [style*="text-align: center"] { text-align: center; }
.prose [style*="text-align: right"] { text-align: right; }


/* Login mobile — editorial, marfim, balança de vidro ao fundo. Tudo sob .lg-m. */

.lg-m {
  --ivory: #f6f3ee; --ink: #16161a; --stone: #6f6a63; --faint: #a39d94;
  --line: rgba(22, 22, 26, .18); --gold: #c9a172; --graphite: #2b2b2e; --clay: #b0543f;
  --pad: 28px;
  position: fixed; inset: 0; overflow-x: hidden; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) var(--pad) calc(env(safe-area-inset-bottom, 0px) + 20px);
  color: var(--ink); font-family: 'Instrument Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  background: #fbf8f6; /* = tom do pé da imagem, para ela continuar sem emenda */
}

.lg-m *, .lg-m *::before, .lg-m *::after { box-sizing: border-box; }

.lg-m button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Imagem de fundo: nunca cortada — escala inteira (largura da tela, ou menor em tela baixa
   para caber a balança acima do título), ancorada no canto superior direito. A borda
   esquerda se funde no marfim, que é o mesmo tom do fundo da própria imagem. */

.lg-m-bg {
  position: fixed; top: 0; right: 0; width: min(100%, 54vh); aspect-ratio: 853 / 1844; z-index: 0; pointer-events: none;
  background: url('/login-bg-mobile.webp') top center / 100% auto no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%); mask-image: linear-gradient(90deg, transparent, #000 14%);
  animation: lgm-bg-in 1.1s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes lgm-bg-in { from { opacity: 0; transform: translateY(-10px) scale(1.02); } to { opacity: 1; transform: none; } }

.lg-m-top, .lg-m-body, .lg-m-foot { position: relative; z-index: 1; }

/* logo Verus tingido de champanhe: o PNG vira máscara (tem fundo transparente) */

.lg-m-logo {
  display: block; height: 44px; aspect-ratio: 2797 / 744;
  background: linear-gradient(120deg, #a88256 0%, #cdb08a 45%, #e3cfae 60%, #b08b5e 100%);
  -webkit-mask: url('/logo-verus.png') no-repeat left center / contain; mask: url('/logo-verus.png') no-repeat left center / contain;
}

.lg-m-body { margin-top: auto; padding-top: 16vh; width: 100%; max-width: 440px; }

.lg-m-title { margin: 0; font-family: 'Fraunces', Georgia, serif; font-weight: 300; font-variation-settings: 'opsz' 144; letter-spacing: -.035em; line-height: .98; font-size: clamp(46px, 14.5vw, 64px); color: var(--ink); }

.lg-m-title span { display: block; font-weight: 400; }

.lg-m-title em { display: block; font-style: italic; font-weight: 300; letter-spacing: -.015em; word-spacing: .06em; }

.lg-m-title i { font-style: normal; color: var(--gold); }

.lg-m-sub { margin: 14px 0 0; font-size: 17px; line-height: 1.45; color: var(--stone); letter-spacing: .005em; }

.lg-m-form { margin-top: 40px; display: flex; flex-direction: column; gap: 26px; }

.lg-m-field { position: relative; display: block; }

.lg-m-field > span { display: block; font-size: 13px; letter-spacing: .02em; color: var(--stone); margin-bottom: 6px; }

.lg-m-field input {
  display: block; width: 100%; border: 0; border-radius: 0; outline: none; background: transparent;
  padding: 8px 40px 12px 0; font: 400 18px/1.3 'Instrument Sans', system-ui, sans-serif; color: var(--ink);
  border-bottom: 1px solid var(--line);
  -webkit-appearance: none; appearance: none;
}

.lg-m-field input[type=password]:not(:placeholder-shown) { font-family: Verdana, system-ui, sans-serif; letter-spacing: .14em; font-size: 18px; }

.lg-m-field input::placeholder { color: var(--faint); }

.lg-m-field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--ivory) inset; -webkit-text-fill-color: var(--ink); }

/* linha que se preenche da esquerda no foco */

.lg-m-field::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}

.lg-m-field:focus-within::after { transform: scaleX(1); }

.lg-m-eye { position: absolute; right: 0; bottom: 6px; width: 40px; height: 40px; display: grid; place-items: center; color: #4a4741; }

.lg-m-row { display: flex; justify-content: flex-end; margin-top: -12px; }

.lg-m-link { font-size: 14px; color: #4a4741; letter-spacing: .01em; padding: 6px 0 !important; }

.lg-m-link:active { opacity: .6; }

.lg-m-error { margin: -6px 0 0; font-size: 14px; color: var(--clay); }

.lg-m-ok { margin: 16px 0 0; font-size: 14px; color: #3f5b45; }

.lg-m-go {
  margin-top: 10px; width: 100%; height: 60px; border-radius: 14px !important;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px 0 26px !important;
  background: linear-gradient(180deg, #333336, var(--graphite)) !important; color: #f6f3ee !important;
  font-size: 18px; font-weight: 500; letter-spacing: .01em;
  box-shadow: 0 18px 36px -14px rgba(22, 22, 26, .45), 0 2px 4px rgba(22, 22, 26, .12), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}

.lg-m-go:active { transform: scale(.98); box-shadow: 0 10px 22px -12px rgba(22, 22, 26, .45); }

.lg-m-go:disabled { opacity: .82; cursor: default; }

.lg-m-go svg { transition: transform .25s ease; }

.lg-m-go:active svg { transform: translateX(4px); }

.lg-m-spin { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid rgba(246, 243, 238, .3); border-top-color: #f6f3ee; animation: lgm-spin .8s linear infinite; }

@keyframes lgm-spin { to { transform: rotate(360deg); } }

.lg-m-foot { margin-top: 36px; text-align: center; font-size: 13px; letter-spacing: .08em; color: var(--faint); }

/* entrada escalonada */

.lg-m-top, .lg-m-title, .lg-m-body > .lg-m-sub, .lg-m-form > *, .lg-m-foot { animation: lgm-rise .7s cubic-bezier(.2, .7, .2, 1) both; }

.lg-m-top { animation-delay: .15s; }

.lg-m-title { animation-delay: .25s; }

.lg-m-body > .lg-m-sub { animation-delay: .33s; }

.lg-m-form > :nth-child(1) { animation-delay: .41s; }

.lg-m-form > :nth-child(2) { animation-delay: .49s; }

.lg-m-form > :nth-child(3) { animation-delay: .57s; }

.lg-m-form > :nth-child(n+4) { animation-delay: .65s; }

.lg-m-foot { animation-delay: .75s; }

@keyframes lgm-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* recuperação de senha: folha que sobe */

.lg-m-sheet-bg { position: fixed; inset: 0; z-index: 10; background: rgba(22, 22, 26, .28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; animation: lgm-fade .25s ease both; }

.lg-m-sheet {
  position: relative; width: 100%; background: var(--ivory); border-radius: 26px 26px 0 0;
  padding: 14px var(--pad) calc(env(safe-area-inset-bottom, 0px) + 28px);
  box-shadow: 0 -20px 50px -20px rgba(22, 22, 26, .3);
  animation: lgm-up .42s cubic-bezier(.2, .8, .2, 1) both;
}

.lg-m-grab { width: 40px; height: 4px; border-radius: 4px; background: rgba(22, 22, 26, .15); margin: 0 auto 18px; }

.lg-m-close { position: absolute; top: 14px; right: 16px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--stone); }

.lg-m-sheet h2 { margin: 8px 0 0; font-family: 'Fraunces', Georgia, serif; font-weight: 400; font-size: 34px; letter-spacing: -.03em; line-height: 1.05; }

.lg-m-sheet h2 em { font-style: italic; font-weight: 300; }

.lg-m-sheet .lg-m-form { margin-top: 26px; }

@keyframes lgm-up { from { transform: translateY(100%); } to { transform: none; } }

@keyframes lgm-fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-height: 620px) { .lg-m-bg { width: min(100%, 46vh); } }

@media (max-height: 700px) { .lg-m-body { padding-top: 10vh; } .lg-m-title { font-size: 44px; } .lg-m-foot { margin-top: 20px; } .lg-m-form { margin-top: 28px; gap: 20px; } }

@media (prefers-reduced-motion: reduce) {
  .lg-m *, .lg-m-bg { animation: none !important; transition: none !important; }
}
