@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;500;600;700;800&family=Inter:wght@400;500;600;700;800&family=Fira+Code:wght@400;500;600&display=swap');

:root {
  --font-heading: 'Source Serif 4', 'Merriweather', Georgia, serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Fira Code', 'Fira Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;

  /* Premium Dark Theme */
  --bg-primary: #0C0C0D;     /* Deep charcoal black */
  --bg-secondary: #151517;   /* Dark card grey */
  --bg-tertiary: #1E1E20;    /* Lighter input / active gray */
  --border-color: #2A2A2D;   /* Precise dark borders */
  --border-focus: #35745F;   /* Indigo focus */
  
  /* Glowing Neon Accents */
  --accent-purple: #35745F;
  --accent-emerald: #4E9270;
  --accent-cyan: #4C8A93;
  --accent-gradient: linear-gradient(135deg, #4C8A93 0%, #4E9270 100%);
  --accent-glow: rgba(53, 116, 95, 0.16);
  
  /* Text colors */
  --text-primary: #EDECE8;
  --text-secondary: #9C9A93;
  --text-muted: #67655F;
  
  /* UI parameters */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Light Theme overrides */
[data-theme="light"] {
  --bg-primary: #F6F5F2;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #EFEDE7;
  --border-color: #E2DFD7;
  --text-primary: #171613;
  --text-secondary: #5A584F;
  --text-muted: #8F8C81;
  --accent-glow: rgba(53, 116, 95, 0.09);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Source Serif 4 possui ótima legibilidade com pesos variados. */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  height: 100vh;
  height: 100dvh; /* respeita a barra de endereço dinâmica no mobile (Safari/Chrome) */
  overflow: hidden;
  line-height: 1.6;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Utility Classes */
.accent-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Page Structures */
.mobile-line-break,
#btn-toggle-header-options {
  display: none;
}

.page {
  display: none;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow-x: hidden;
}

.page.active {
  display: flex;
}

/* ==========================================================================
   1. LANDING PAGE STYLE
   ========================================================================== */
#landing-page {
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  align-items: center;
  padding: 2rem 1.5rem 6rem;
  background: var(--bg-primary);
  width: 100%;
}

header {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 5rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 32px;
  height: 32px;
}

/* A logo é um SVG de tinta escura carregado via <img>, portanto não herda
   currentColor. No tema escuro, invertemos para que fique legível. */
[data-theme="dark"] .logo-icon,
[data-theme="dark"] .logo-wordmark,
[data-theme="dark"] .welcome-logo,
[data-theme="dark"] .message-avatar img {
  filter: invert(1) brightness(1.8);
}

.logo-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(53, 116, 95, 0.15);
  border: 1px solid rgba(53, 116, 95, 0.3);
  color: var(--accent-purple);
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(53, 116, 95, 0.22);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

/* Hero Section — duas colunas: copy à esquerda, constelação à direita */
.hero {
  width: 100%;
  max-width: 1200px;
  margin-bottom: 6rem;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 3rem;
  text-align: left;
}

.hero-copy {
  max-width: 560px;
}

.hero-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 460px;
}

.hero-visual canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-visual-caption {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
  pointer-events: none;
}

.hv-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-purple);
}

.hv-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--accent-emerald);
  padding: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8rem;
  margin-bottom: 1.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-tag::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent-emerald);
  opacity: 0.6;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 5.5vw, 4.1rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.12rem;
  max-width: 540px;
  margin: 0 0 2.5rem;
  font-weight: 400;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
}

/* Features Grid */
.features-container {
  width: 100%;
  max-width: 1100px;
  margin-bottom: 6rem;
}

.features-title {
  text-align: center;
  font-family: var(--font-heading);
  font-size: clamp(1.7rem, 3.5vw, 2.25rem);
  font-weight: 400;
  margin-bottom: 3rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--text-muted);
  box-shadow: var(--shadow);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(53, 116, 95, 0.1);
  border: 1px solid rgba(53, 116, 95, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-purple);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.feature-card h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Target Section */
.targets-section {
  width: 100%;
  max-width: 1100px;
  text-align: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
}

.targets-section h2 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  margin-bottom: 1rem;
}

.targets-section p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 3rem;
}

.targets-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.target-badge {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition);
}

.target-badge:hover {
  border-color: var(--accent-purple);
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(53, 116, 95, 0.1);
}

.target-badge i {
  color: var(--accent-cyan);
}

/* ==========================================================================
   2. APP DASHBOARD COMMON STYLE (SIDEBAR)
   ========================================================================== */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
}

.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  position: relative;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header .logo-container {
  font-size: 1.25rem;
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(53, 116, 95, 0.1);
  color: var(--text-primary);
  border-left: 3px solid var(--accent-purple);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 1rem 0;
}

.sidebar-title {
  padding: 0 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title .btn-add-doc {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-title .btn-add-doc:hover {
  color: var(--text-primary);
}

.sidebar-docs-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.doc-sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-sidebar-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.doc-sidebar-item.selected {
  background: rgba(76, 138, 147, 0.08);
  color: var(--accent-cyan);
  border-left: 2px solid var(--accent-cyan);
}

.doc-item-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.doc-item-left i {
  flex-shrink: 0;
}

.doc-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 0.9rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--accent-emerald);
  font-weight: 500;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   3. CONVERSATION VIEW STYLE (CLAUDE-LIKE ACCENTED)
   ========================================================================== */
.chat-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  height: 100%;
  position: relative;
}

.chat-header {
  min-height: 64px;
  height: auto;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chat-header-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.model-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  background: rgba(53, 116, 95, 0.1);
  border: 1px solid rgba(53, 116, 95, 0.25);
  color: var(--accent-purple);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chat-header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Atalho do teste grátis no topo (canto superior direito do chat).
   Escondido por padrão; o JS liga .on só para Free + elegível, e ele só
   existe no MOBILE — no desktop a barra lateral já tem o "Utilize de graça". */
#btn-trial-topo {
  display: none;
  align-items: center;
  gap: 0.3rem;
  height: 26px;
  padding: 0.25rem 0.7rem;
  border: 1px solid rgba(78, 146, 112, 0.45);
  border-radius: 20px;
  background: rgba(78, 146, 112, 0.12);
  color: var(--accent-emerald);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
#btn-trial-topo i { font-size: 0.8rem; }
#btn-trial-topo:active { transform: scale(0.97); }
@media (max-width: 900px) {
  #btn-trial-topo.on { display: inline-flex; }
}

/* Contador "restam N" do Free — mesma família visual da pill do teste, mas
   neutro: ele informa; quem vende é a pill do lado. Esquenta nas 2 últimas. */
#contador-msgs {
  display: none;
  align-items: center;
  gap: 0.3rem;
  height: 26px;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
#contador-msgs.aviso {
  border-color: rgba(178, 91, 91, 0.55);
  color: #C9847F;
  background: rgba(178, 91, 91, 0.08);
}
/* Em TODAS as larguras: no PC a cota morava escondida num popover da lateral
   — escassez invisível não aperta. A pill do teste continua só no mobile
   (no desktop a lateral já tem o "Utilize de graça" sempre à vista). */
#contador-msgs.on { display: inline-flex; }

/* Welcome Overlay */
.welcome-overlay {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  overflow-y: auto;
}

.welcome-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 1.5rem;
}

.welcome-overlay h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.7rem, 4vw, 2.25rem);
  font-weight: 400;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.welcome-overlay p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin-bottom: 2rem;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 600px;
}

.welcome-suggestion {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.welcome-suggestion:hover {
  border-color: var(--accent-purple);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
}

.welcome-suggestion h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.welcome-suggestion p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

/* Chat Messages Area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
}

.chat-message-wrapper {
  display: flex;
  width: 100%;
}

.chat-message-wrapper.user {
  justify-content: flex-end;
}

.chat-message-wrapper.assistant {
  justify-content: flex-start;
}

.chat-message {
  max-width: 85%;
  width: auto;
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.chat-message.user {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md) var(--radius-md) 0 var(--radius-md);
}

.chat-message.assistant {
  background-color: transparent;
  border-left: 3px solid var(--accent-purple);
  padding-left: 1.5rem;
  max-width: 95%;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.chat-message.user .message-avatar {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.chat-message.assistant .message-avatar {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 5px;
}

.message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.message-sender {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chat-message.assistant .message-sender {
  color: var(--accent-purple);
}

.message-text {
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.message-text a {
  word-break: break-all;
  overflow-wrap: break-word;
}

.chat-message.assistant .message-text {
  white-space: normal;
  word-spacing: 0.11em;
  letter-spacing: 0.015em;
  word-break: break-word;
  overflow-wrap: break-word;
}

.message-text p {
  margin-bottom: 1.25rem;
}

.message-text p:last-child {
  margin-bottom: 0;
}

/* Cool links in chat */
.chat-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: var(--transition);
  padding: 0 0.15rem;
  display: inline-block;
}

.chat-link::after {
  content: '';
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--accent-cyan);
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}

.chat-link:hover {
  color: var(--accent-purple);
  text-shadow: 0 0 8px rgba(53, 116, 95, 0.4);
}

.chat-link:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
  background-color: var(--accent-purple);
}

/* Citations inside the text */
.citation {
  display: inline-flex;
  align-items: center;
  background: rgba(76, 138, 147, 0.15);
  border: 1px solid rgba(76, 138, 147, 0.3);
  color: var(--accent-cyan);
  padding: 0.05rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 4px;
  font-weight: 600;
  margin: 0 0.15rem;
  cursor: pointer;
  transition: var(--transition);
  vertical-align: middle;
}

.citation:hover {
  background: rgba(76, 138, 147, 0.3);
  color: white;
  transform: scale(1.05);
}

/* Cosine Scanner Animation Panel */
.scan-indicator-panel {
  border: 1px dashed var(--accent-cyan);
  background: rgba(76, 138, 147, 0.03);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-weight: 700;
}

.scan-progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.scan-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
  border-radius: 10px;
  animation: scan-progress 1.5s ease-out forwards;
}

.scan-details {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

@keyframes scan-progress {
  0% { width: 0%; }
  30% { width: 45%; }
  60% { width: 80%; }
  100% { width: 100%; }
}

/* Chat Input Area (Claude-like Card) */
.chat-input-wrapper {
  padding: 1.5rem;
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.chat-input-card {
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  position: relative;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.chat-input-card:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 25px rgba(53, 116, 95, 0.15);
}

/* Attachment preview inside text box */
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.attachment-pill i {
  color: var(--accent-cyan);
}

.attachment-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.attachment-remove:hover {
  color: #EF4444;
}

textarea.chat-input-textarea {
  width: 100%;
  min-height: 56px;
  max-height: 200px;
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.5rem;
  line-height: 1.5;
}

textarea.chat-input-textarea::placeholder {
  color: var(--text-muted);
}

.chat-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.chat-input-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.input-action-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.input-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chat-submit-btn {
  background: var(--accent-purple);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(53, 116, 95, 0.3);
}

.chat-submit-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(53, 116, 95, 0.28);
}

.chat-submit-btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* Botão "Utilize de graça" (Free) na base da sidebar — sóbrio, sem brilho. */
#btn-redeem-offer:hover {
  background: rgba(78, 146, 112, 0.18) !important;
  border-color: var(--accent-emerald) !important;
}

/* Enquanto uma resposta é produzida: botão travado com um "respiro" pulsante,
   pra ler como "ocupado" e não como "campo vazio". */
.chat-submit-btn.is-generating {
  animation: sendBusyPulse 1.2s ease-in-out infinite;
}
@keyframes sendBusyPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-submit-btn.is-generating { animation: none; }
}

.chat-input-footer-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
}

.chat-input-footer-hint span {
  color: var(--accent-emerald);
  font-weight: 600;
}

/* ==========================================================================
   4. PRECISION DRAWER (SOURCE CITATIONS VIEW)
   ========================================================================== */
.precision-drawer {
  position: absolute;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.precision-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-cyan);
}

.btn-close-drawer {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
}

.btn-close-drawer:hover {
  color: var(--text-primary);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.source-stat-box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.cosseno {
  color: var(--accent-emerald);
}

.source-doc-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.source-doc-icon {
  font-size: 1.5rem;
  color: var(--accent-cyan);
}

.source-doc-details {
  overflow: hidden;
}

.source-doc-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-doc-pages {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.source-text-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.source-text-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.source-text-body {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-primary);
  max-height: 250px;
  overflow-y: auto;
  border-left: 3px solid var(--accent-cyan);
}

.source-chunk-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  background: rgba(76, 138, 147, 0.1);
  border: 1px solid rgba(76, 138, 147, 0.2);
  color: var(--accent-cyan);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

/* ==========================================================================
   5. DOCUMENTS MANAGER PAGE
   ========================================================================== */
.docs-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  height: 100%;
}

.docs-header {
  min-height: 64px;
  height: auto;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.docs-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 400;
}

.docs-content {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
}

.upload-zone-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  margin-bottom: 3rem;
}

.upload-dropzone {
  border: 2px dashed var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-dropzone:hover {
  border-color: var(--accent-purple);
  background: rgba(53, 116, 95, 0.02);
}

.upload-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-purple);
  font-size: 2rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.upload-dropzone:hover .upload-icon-wrapper {
  transform: translateY(-5px);
  background: rgba(53, 116, 95, 0.1);
}

.upload-dropzone h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.upload-dropzone p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.upload-info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
}

.info-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.info-item i {
  color: var(--accent-emerald);
  margin-top: 0.25rem;
}

.info-item-text h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.info-item-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.docs-table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.docs-table-title {
  padding: 1.25rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 400;
  border-bottom: 1px solid var(--border-color);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.docs-table th {
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.5px;
}

.docs-table td {
  padding: 1.25rem 1.5rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.td-doc-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.td-doc-name i {
  color: var(--accent-cyan);
}

.chunk-badge {
  background: rgba(78, 146, 112, 0.1);
  border: 1px solid rgba(78, 146, 112, 0.25);
  color: var(--accent-emerald);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-block;
}

.docs-table td:nth-child(2),
.docs-table td:nth-child(3),
.docs-table td:nth-child(4),
.docs-table td:nth-child(5),
.docs-table td:nth-child(6) {
  white-space: nowrap;
}

.btn-delete-doc {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-delete-doc:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

/* ==========================================================================
   6. MOCK MODALS (UPLOAD FLOW IN ACTION)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.upload-progress-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.upload-modal-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.upload-modal-title i {
  color: var(--accent-purple);
}

.upload-modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.step-label-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.step-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
}

.step-item.active .step-label-wrapper {
  color: var(--accent-purple);
  font-weight: 600;
}

.step-item.active .step-icon {
  border-color: var(--accent-purple);
  background: rgba(53, 116, 95, 0.1);
  color: var(--accent-purple);
}

.step-item.completed .step-label-wrapper {
  color: var(--text-primary);
}

.step-item.completed .step-icon {
  border-color: var(--accent-emerald);
  background: rgba(78, 146, 112, 0.15);
  color: var(--accent-emerald);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spinner-spin 0.8s linear infinite !important;
  display: none;
}

@keyframes spinner-spin {
  to { transform: rotate(360deg); }
}

.step-item.active .spinner {
  display: block;
}

.step-item.completed .check-mark {
  display: block;
}

.check-mark {
  display: none;
  color: var(--accent-emerald);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-modal-close {
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
}

/* Icons via Font Awesome Mock */
[class^="ri-"], [class*=" ri-"] {
  display: inline-block;
  line-height: 1;
}

/* Attachment Menu Dropdown */
.attachment-dropdown {
  position: absolute;
  bottom: 52px;
  left: 10px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  width: 280px;
  z-index: 50;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.attachment-dropdown.open {
  display: flex;
}

/* Mobile: o dropdown de anexos tinha largura fixa (280px) e lista baixa,
   ficando cortado. Aqui ele ocupa a largura do card e ganha altura util. */
@media (max-width: 880px) {
  .attachment-dropdown {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 58px;
    max-height: 60vh;
  }

  .attachment-dropdown .dropdown-list {
    max-height: 40vh;
  }
}

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

.dropdown-header {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.15);
}

.dropdown-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.dropdown-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item i {
  color: var(--accent-cyan);
  font-size: 1rem;
}

.dropdown-item.upload-btn {
  color: var(--accent-purple);
  font-weight: 600;
  border-top: 1px solid var(--border-color);
}

.dropdown-item.upload-btn i {
  color: var(--accent-purple);
}

/* Ensure RemixIcon spins properly */
.ri-spin {
  animation: spin 1.2s linear infinite !important;
  display: inline-block !important;
}

#btn-multiple-docs:hover,
#btn-upload-attachment:hover {
  color: var(--text-primary) !important;
}
#btn-multiple-docs:hover i,
#btn-upload-attachment:hover i {
  color: var(--accent-cyan) !important;
}

/* ==========================================================================
   9. PREMIUM CUSTOM TOGGLE SWITCH
   ========================================================================== */
.doc-toggle-container {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-toggle-container:hover {
  color: var(--text-primary);
}

.switch-wrapper {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch-wrapper input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Knob */
.switch-slider::before {
  content: "";
  position: absolute;
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover glow track */
.doc-toggle-container:hover .switch-slider {
  border-color: rgba(76, 138, 147, 0.35);
}

/* Checked State Styles */
.switch-wrapper input:checked + .switch-slider {
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: 0 0 10px rgba(76, 138, 147, 0.25);
}

.switch-wrapper input:checked + .switch-slider::before {
  transform: translateX(16px);
  background-color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.doc-toggle-container:has(input:checked) {
  color: var(--accent-cyan);
}

/* ==========================================================================
   10. PREMIUM MODEL SELECTOR
   ========================================================================== */
.model-selector-group {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.2rem;
  border-radius: 30px;
  align-items: center;
  margin-left: 0.5rem;
}

[data-theme="light"] .model-selector-group {
  background: var(--bg-secondary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.model-select-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  white-space: nowrap;
}

.model-select-btn:hover {
  color: var(--text-primary);
}

.model-select-btn.active {
  background: var(--bg-tertiary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.model-select-btn[data-model="lumen"].active {
  color: var(--accent-emerald, #4E9270);
  border: 1px solid rgba(78, 146, 112, 0.25);
}

.model-select-btn[data-model="logus"].active {
  color: var(--accent-cyan, #4C8A93);
  border: 1px solid rgba(76, 138, 147, 0.25);
}

.model-select-btn[data-model="aether"].active {
  color: #35745F; /* Purple */
  border: 1px solid rgba(53, 116, 95, 0.25);
}

/* Typing cursor animation for agent responses */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.typing-cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background-color: var(--accent-cyan);
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 0.8s infinite;
  border-radius: 2px;
}

.export-academic-btn:hover {
  background: rgba(53, 116, 95, 0.16) !important;
  border-color: rgba(53, 116, 95, 0.4) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(53, 116, 95, 0.1);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary) !important;
}

.action-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   3. PRICING & LIMITS SYSTEM (SEGAN FREE / CORE / COSMOS)
   ========================================================================== */

/* Pricing Section on Landing Page */
.pricing-section {
  width: 100%;
  max-width: 1200px;
  padding: 5rem 1.5rem;
  margin-top: 3rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.pricing-title {
  font-family: var(--font-heading);
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  font-weight: 400;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.pricing-subtitle {
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 3.5rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.2rem;
  margin-top: 1.5rem;
  align-items: stretch;
}

.pricing-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.75rem 2.25rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
  overflow: hidden;
}

.pricing-card.featured {
  border-color: var(--accent-purple);
  box-shadow: 0 0 24px rgba(53, 116, 95, 0.12);
  background: var(--bg-secondary);
}

.pricing-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-cyan);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.pricing-card.featured:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 0 35px rgba(53, 116, 95, 0.25);
}

.plan-ribbon {
  position: absolute;
  top: 18px;
  right: -38px;
  background: var(--accent-gradient);
  color: #0C0C0D;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.3rem 2.75rem;
  transform: rotate(45deg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-name {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plan-price {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 1rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.plan-price span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.plan-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.5;
  min-height: 45px;
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 2.5rem;
  flex: 1;
}

.plan-features li {
  font-size: 0.88rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.plan-features li i {
  color: var(--accent-emerald);
  font-size: 1.15rem;
}

.plan-features li.disabled {
  color: var(--text-muted);
}

.plan-features li.disabled i {
  color: var(--text-muted);
}

.plan-promo-badge {
  background: rgba(78, 146, 112, 0.08);
  border: 1px solid rgba(78, 146, 112, 0.3);
  color: var(--accent-emerald);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: inline-block;
}

/* Locked UI Elements & Tooltips */
.feature-locked {
  position: relative !important;
  opacity: 0.55 !important;
  cursor: not-allowed !important;
}

.feature-locked * {
  pointer-events: none !important;
}

.locked-badge-container {
  display: inline-flex;
  align-items: center;
}

.locked-lock-icon {
  margin-left: 0.35rem;
  color: #F59E0B;
  cursor: help;
  font-size: 0.95rem;
  vertical-align: middle;
  display: inline-block;
  animation: lock-wobble 4s ease-in-out infinite;
}

@keyframes lock-wobble {
  0%, 100% { transform: rotate(0); }
  45% { transform: rotate(0); }
  50% { transform: rotate(-10deg); }
  55% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  65% { transform: rotate(0); }
}

/* Tooltips styling using data attributes */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: normal;
  width: 230px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99999;
  pointer-events: none;
  font-weight: 500;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

[data-tooltip].tooltip-left::after {
  left: auto;
  right: -20px;
  transform: translateX(0) scale(0.9);
}

[data-tooltip].tooltip-left:hover::after {
  transform: translateX(0) scale(1);
}

[data-tooltip].tooltip-bottom::after {
  bottom: auto;
  top: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
}

[data-tooltip].tooltip-bottom:hover::after {
  transform: translateX(-50%) scale(1);
}

/* Sidebar Billing Card */
.sidebar-billing-card {
  margin: 0;
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(53, 116, 95, 0.3);
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.25);
}

.sidebar-billing-card:hover {
  background: var(--bg-tertiary);
  border-color: rgba(53, 116, 95, 0.5);
}

/* Billing selector styling for modal */
.billing-option-card {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}

.billing-option-card:hover {
  border-color: var(--accent-purple);
}

.billing-option-card.active {
  border-color: var(--accent-emerald);
  background: rgba(78, 146, 112, 0.03);
}

.discount-tag {
  background: rgba(53, 116, 95, 0.1);
  border: 1px solid rgba(53, 116, 95, 0.25);
  color: #4C8A93;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.settings-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--text-primary) !important;
}

.settings-tab-btn.active {
  background: rgba(53, 116, 95, 0.1) !important;
  color: var(--accent-cyan) !important;
  border-left: 3px solid var(--accent-cyan) !important;
  border-radius: 0 6px 6px 0 !important;
}

/* ==========================================================================
   11. RESPONSIVIDADE — o app era fixo para desktop; abaixo, breakpoints
   para landing page e para o workspace logado (sidebar vira gaveta).
   ========================================================================== */

/* Botão hamburguer (novo, só de UI — mostra/esconde a sidebar no mobile) */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  /* Centro do botão (38px) alinhado ao centro da linha do header mobile
     (56px): (56-38)/2 = 9. Com 14 ele ficava 5px abaixo dos pills. */
  top: 9px;
  left: 14px;
  z-index: 310;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

/* Com a gaveta ABERTA, o hambúrguer não fica flutuando por cima do menu
   ("voando"): some suave. Chave única = .sidebar.mobile-open, então vale para
   qualquer caminho de fechar (overlay, navegação, nova conversa). Fecha-se
   tocando o overlay escuro à direita da gaveta. */
.app-container:has(.sidebar.mobile-open) .mobile-menu-toggle {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 290;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Landing page ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  #landing-page {
    padding: 1.5rem 1.25rem 4rem;
  }

  header {
    margin-bottom: 3rem;
  }

  .nav-links .nav-link {
    display: none;
  }

  .hero {
    margin-bottom: 4rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .features-container,
  .targets-section {
    margin-bottom: 3.5rem;
  }

  .targets-section {
    padding: 2.5rem 1.5rem;
  }

  .pricing-section {
    padding: 3.5rem 1.25rem;
  }
}

@media (max-width: 480px) {
  .logo-container span {
    font-size: 0.95em;
  }

  .hero-tag {
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
  }

  .welcome-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Workspace logado (sidebar + chat) ───────────────────────────────── */
@media (max-width: 880px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 300;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5);
  }

  .chat-workspace {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .chat-header {
    height: auto;
    min-height: 56px;
    /* 3.6rem: o hambúrguer (fixo) termina em 52px — isso dá ~6px de respiro
       até a seta. 3.4 encostava; 3.5 (original) deixava vão. */
    padding: 0.55rem 0.75rem 0.55rem 3.6rem;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  /* "Espaço de Trabalho" some no mobile pra dar espaço aos controles */
  .chat-header-title {
    display: none;
  }

  /* Os 3 seletores quebram linha no mobile pra não vazar e ficarem visíveis */
  .chat-header-info {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    gap: 0.5rem !important;
    padding-bottom: 2px;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .model-selector-group {
    flex-shrink: 0;
    margin-left: 0 !important;
  }

  /* "Limpar Chat" fica só com o ícone no mobile */
  #btn-clear-chat {
    flex-shrink: 0;
    font-size: 0 !important;
    padding: 0.5rem !important;
  }

  #btn-clear-chat i {
    font-size: 1rem;
  }

  .messages-container {
    padding: 0.75rem 0.5rem !important;
    min-width: 0 !important;
  }

  .chat-message {
    max-width: 100% !important;
    width: 100% !important;
    gap: 0 !important;
    padding: 0.6rem 0.4rem !important;
  }

  .chat-message.assistant {
    padding-left: 0.4rem !important;
    border-left-width: 2px !important;
  }

  .chat-message.assistant .message-avatar {
    display: none !important;
  }

  .agent-response-section {
    padding: 0.6rem 0.75rem !important;
    margin-bottom: 0.85rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .chat-input-wrapper {
    padding: 0.7rem;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .chat-input-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 0.5rem !important;
  }

  .chat-input-footer {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 0.5rem !important;
  }

  /* As ações no rodapé quebram linha no mobile para exibição perfeita */
  .chat-input-actions {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    gap: 0.25rem 0.3rem !important;
    padding-right: 0 !important;
  }

  #btn-toggle-header-options {
    display: inline-flex !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: 20px !important;
    font-size: 0.7rem !important;
    height: 25px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
  }

  #btn-toggle-header-options.active {
    border-color: var(--accent-cyan) !important;
    color: var(--accent-cyan) !important;
  }
  /* A seta conta o estado: aponta pra baixo fechado, gira pra cima aberto. */
  #btn-toggle-header-options i { transition: transform 0.2s ease; }
  #btn-toggle-header-options.active i { transform: rotate(180deg); }

  #header-options-wrapper {
    display: none !important;
  }

  #header-options-wrapper.mobile-expanded {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    width: 100% !important;
    margin-top: 0.4rem !important;
  }

  #header-options-wrapper.mobile-expanded .model-selector-group {
    margin-left: 0 !important;
    padding: 0.25rem 0.65rem !important;
  }

  /* ── Header mobile achatado (11/08) ────────────────────────────────────
     O painel de ajustes expandia POR CIMA do contador e da pill do teste
     ("Memória" atropelando o "5 usos hoje" — print do Felipe). Culpa da
     hierarquia: info (com o painel dentro) e actions eram irmãos disputando
     a mesma linha. display:contents dissolve o invólucro e todo mundo vira
     filho direto do header, com ordem explícita:
       linha 1 — [ícone ajustes] ........ [contador][7 dias grátis]
       linha 2+ — painel expandido em largura total, SEM sobrepor nada.  */
  .chat-header { flex-wrap: wrap !important; row-gap: 0.45rem !important; }
  .chat-header-info { display: contents !important; }
  .top-model-selector { display: none !important; } /* garantia: o seletor de modelo morreu no modelo único */
  #btn-toggle-header-options { order: 1 !important; margin-left: 0 !important; }
  .chat-header-actions { order: 2 !important; margin-left: auto !important; align-items: center; flex: 0 0 auto; }
  #header-options-wrapper { order: 3 !important; }
  #header-options-wrapper.mobile-expanded { flex-basis: 100% !important; }

  /* Mostra o botão "Pesquisas"; a aparência (contorno gradiente) vem da
     classe .btn-pesquisas — por isso não sobrescrevemos cor/borda aqui. */
  #btn-toggle-extra-options {
    display: inline-flex !important;
    padding: 0.2rem 0.6rem !important;
    font-size: 0.68rem !important;
    height: 26px !important;
  }

  #mobile-extra-options-wrapper {
    display: none !important;
  }

  #mobile-extra-options-wrapper.mobile-expanded {
    display: inline-flex !important;
    flex-wrap: wrap !important;
    gap: 0.25rem 0.3rem !important;
    width: 100% !important;
    margin-top: 0.4rem !important;
  }

  .mobile-line-break {
    display: block !important;
    flex-basis: 100% !important;
    height: 0 !important;
  }

  .mobile-hide-text {
    display: none !important;
  }

  #chat-input-hint,
  #estimated-time-hint,
  .chat-input-footer-hint {
    display: none !important;
  }

  .top-model-selector {
    display: none !important;
  }

  #mobile-model-select-wrapper {
    display: inline-flex !important;
    padding: 0.15rem 0.35rem !important;
    margin-left: 0 !important;
    height: 25px !important;
    border-radius: 20px !important;
  }

  #mobile-model-select-wrapper select {
    font-size: 0.65rem !important;
  }

  .doc-toggle-container {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0.15rem 0.35rem !important;
    gap: 0.2rem !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--border-color) !important;
  }

  .doc-toggle-container span {
    font-size: 0.65rem;
  }

  #btn-upload-attachment,
  #btn-multiple-docs {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0.15rem 0.35rem !important;
    gap: 0.2rem !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--border-color) !important;
    height: 25px !important;
  }

  /* "Anexar doc" com o contorno gradiente (herdado do antigo Pesquisas):
     anexar documento é o negócio principal — é este botão que convida.
     Dois backgrounds: o de dentro (padding-box) é a cor do card, o de fora
     (border-box) é o gradiente, aparecendo só na área da borda. */
  #btn-upload-attachment {
    color: var(--accent-cyan) !important;
    font-weight: 700 !important;
    padding: 0.15rem 0.55rem !important;
    border: 1px solid transparent !important;
    background:
      linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
      var(--accent-gradient) border-box !important;
  }
  #btn-upload-attachment i {
    color: var(--accent-cyan) !important;
  }

  #btn-upload-attachment span,
  #btn-multiple-docs span {
    font-size: 0.65rem;
  }

  /* Welcome mais enxuto (o print mostrava ele empurrando tudo pra baixo) */
  .welcome-overlay {
    padding: 1.25rem;
    justify-content: flex-start;
    padding-top: 2rem;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .welcome-logo {
    width: 44px;
    height: 44px;
    margin-bottom: 1rem;
  }

  .welcome-overlay h2 {
    font-size: 1.6rem;
    max-width: 100% !important;
    word-break: break-word !important;
  }

  /* Exibe os boxes de sugestão em linha rolável no mobile (salva espaço) */
  .welcome-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-bottom: 0.75rem !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .welcome-grid::-webkit-scrollbar {
    display: none !important;
  }

  .welcome-suggestion {
    flex: 0 0 160px !important;
    padding: 0.85rem !important;
    box-sizing: border-box !important;
    min-height: 90px !important;
  }

  .welcome-suggestion h4 {
    font-size: 0.8rem !important;
    margin-bottom: 0.25rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .welcome-suggestion p {
    font-size: 0.68rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .welcome-overlay p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Hero da landing empilha: texto em cima, animação embaixo */
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .hero-copy {
    max-width: 100%;
  }

  .hero-tag,
  .hero-actions {
    justify-content: center;
  }

  .hero p {
    margin-left: auto;
    margin-right: auto;
  }

  /* Mobile (20/08/2026): o choque de abertura passa a ser o "SEM LIMITE DE
     TAMANHO" com a animação do documento sendo anexado — a constelação de
     cossenos e a pergunta "Por que o Segan entrega precisão absoluta?" só
     adiavam esse momento numa tela pequena. No desktop nada muda: lá a
     constelação fica ao LADO do texto (não ocupa scroll) e continua. */
  .hero-visual {
    display: none;
  }
  .features-title {
    display: none;
  }

  .precision-drawer {
    width: 100%;
    right: -100%;
  }

  /* Bug de flexbox: item flex tem min-width:auto e NAO encolhe abaixo do
     conteudo — a tabela (min-width:720px) empurrava o painel inteiro para
     fora da tela. min-width:0 permite encolher e conter o scroll. */
  .app-container main,
  .docs-workspace,
  .chat-workspace {
    min-width: 0;
    max-width: 100vw;
  }

  .upload-zone-container {
    grid-template-columns: 1fr;
  }

  .upload-dropzone {
    padding: 2rem 1rem;
  }

  .upload-info-card {
    padding: 1.25rem;
  }

  .docs-content {
    padding: 1.25rem;
    min-width: 0;
  }

  .docs-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .docs-table {
    min-width: 720px;
  }

  #profile-modal .modal-content {
    flex-direction: column !important;
    height: auto !important;
    max-height: 88vh !important;
    width: 94% !important;
  }

  #profile-modal .modal-content > div:first-child {
    width: 100% !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    padding: 0.6rem !important;
    gap: 0.4rem !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color);
  }
}

@media (max-width: 520px) {
  .upload-progress-modal {
    padding: 1.5rem !important;
  }

  .modal-overlay {
    padding: 0.75rem;
  }
}


/* ==========================================================================
   Revelação do botão "excluir conversa" — sem JS de hover (que causava
   duplo-toque no mobile). Desktop: aparece no hover do item. Touch: sempre
   visível (semi-transparente).
   ========================================================================== */
@media (hover: hover) {
  .sidebar-doc-item .btn-delete-chat { opacity: 0 !important; }
  .sidebar-doc-item:hover .btn-delete-chat { opacity: 1 !important; }
}
@media (hover: none) {
  .sidebar-doc-item .btn-delete-chat { opacity: 0.55 !important; }
}

/* ==========================================================================
   12. BOTÃO "PESQUISAS" (mobile) — discreto de propósito.
   O contorno gradiente que morava aqui migrou para o "Anexar doc": anexar
   documento é o negócio principal do Segan, a pesquisa é coadjuvante.
   ========================================================================== */
.btn-pesquisas {
  display: none; /* JS/media query mostram no mobile */
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 28px;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-body);
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.btn-pesquisas:hover {
  color: var(--text-primary);
}

/* Popover do "Pesquisas": menu flutuante com interruptores, ancorado acima do
   botão — escolhe o que fica ATIVO, sem esticar a caixa de envio. */
.popover-pesquisas {
  position: fixed;
  z-index: 1200;
  min-width: 236px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  padding: 0.35rem;
  display: none;
}
.popover-pesquisas.aberto { display: block; }

.pesq-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: 8px;
  cursor: pointer;
}
.pesq-row:hover { background: rgba(255, 255, 255, 0.04); }
.pesq-row i { font-size: 1rem; color: var(--accent-cyan); }
.pesq-row .pesq-nome { flex: 1 1 auto; text-align: left; }

/* o interruptor (pill que desliza, como no menu do Claude) */
.pesq-pill {
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.pesq-pill::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.18s ease, background 0.18s ease;
}
.pesq-row.on .pesq-pill { background: var(--accent-purple); border-color: transparent; }
.pesq-row.on .pesq-pill::after { transform: translateX(14px); background: #fff; }

/* Estado ativo (opções abertas) — preenche com o gradiente */
.btn-pesquisas.active {
  color: #fff;
  background: var(--accent-gradient) border-box;
  border-color: transparent;
}

/* ── Seção "Ver para crer": resposta fundamentada em evidência ────────────── */
.evidence-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 4rem;
  align-items: center;
}
.evidence-copy h2 {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  line-height: 1.15;
  margin: 1rem 0;
  letter-spacing: -0.02em;
}
.evidence-copy p { color: var(--text-secondary); line-height: 1.7; }

.ev-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
  padding: 1.5rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.10);
  min-height: 340px;
}
.ev-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}
.ev-avatar { width: 20px; height: 20px; }
[data-theme="dark"] .ev-avatar { filter: invert(1) brightness(1.8); }
.ev-name { font-weight: 600; font-size: 0.9rem; }
.ev-status,
.ev-status-done {
  margin-left: auto;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.ev-status { color: var(--text-secondary); }
.ev-status i { animation: evSpin 1s linear infinite; }
.ev-status-done {
  color: var(--accent-emerald);
  font-weight: 600;
  margin-left: 0;
}

.ev-line {
  line-height: 1.6;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.ev-line strong { color: var(--accent-emerald); }

.ev-cites { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0; }
.ev-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
}
.ev-page,
.ev-link {
  font-style: normal;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
}
.ev-page {
  color: var(--accent-cyan);
  background: rgba(76, 138, 147, 0.14);
}
.ev-link {
  color: var(--accent-emerald);
  background: rgba(78, 146, 112, 0.14);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ev-source {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  background: var(--bg-primary);
}
.ev-source + .ev-source { margin-top: 0.6rem; }
/* Duas provas distintas: o documento do usuário e a página consultada na web. */
.ev-src-doc { border-left: 3px solid var(--accent-cyan); }
.ev-src-web { border-left: 3px solid var(--accent-emerald); }
.ev-source-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.ev-score {
  margin-left: auto;
  color: var(--accent-emerald);
  font-weight: 700;
  letter-spacing: 0;
}
.ev-quote {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
}
.ev-quote mark {
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Timeline única de 11s: todos os elementos compartilham a mesma duração
   (sem animation-delay), então as fases nunca dessincronizam no loop. */
.ev-line,
.ev-chip,
.ev-source,
.ev-status,
.ev-status-done { opacity: 0; }

.ev-l1  { animation: evL1  11s ease-out infinite; }
.ev-l2  { animation: evL2  11s ease-out infinite; }
.ev-c1  { animation: evC1  11s cubic-bezier(.2,.9,.3,1.3) infinite; }
.ev-c2  { animation: evC2  11s cubic-bezier(.2,.9,.3,1.3) infinite; }
.ev-src-doc { animation: evSrcDoc 11s ease-out infinite; }
.ev-src-web { animation: evSrcWeb 11s ease-out infinite; }
.ev-status { animation: evStatus 11s ease-out infinite; }
.ev-status-done { animation: evDone 11s ease-out infinite; }
.ev-src-doc mark { animation: evMarkDoc 11s ease-out infinite; }
.ev-src-web mark { animation: evMarkWeb 11s ease-out infinite; }
.ev-page { animation: evPulsePage 11s ease-out infinite; }
.ev-link { animation: evPulseLink 11s ease-out infinite; }

@keyframes evSpin { to { transform: rotate(360deg); } }

@keyframes evStatus {
  0%, 3%   { opacity: 1; }
  40%, 100% { opacity: 0; }
}
@keyframes evDone {
  0%, 70%  { opacity: 0; transform: scale(.9); }
  76%, 92% { opacity: 1; transform: scale(1); }
  96%, 100% { opacity: 0; }
}
/* As duas primeiras frases entram RÁPIDO (o gancho da demo). Linha 1 pronta em
   ~0,66s, linha 2 em ~1,3s (antes eram 1,1s e 2,4s). As citações vêm logo atrás
   pra não abrir buraco. O bloco das fontes/marca-texto (40%+) fica intocado. */
@keyframes evL1 {
  0%      { opacity: 0; transform: translateY(6px); }
  6%, 90% { opacity: 1; transform: none; }
  95%, 100% { opacity: 0; }
}
@keyframes evL2 {
  0%, 6%   { opacity: 0; transform: translateY(6px); }
  12%, 90% { opacity: 1; transform: none; }
  95%, 100% { opacity: 0; }
}
@keyframes evC1 {
  0%, 18%  { opacity: 0; transform: translateY(10px) scale(.94); }
  24%, 90% { opacity: 1; transform: none; }
  95%, 100% { opacity: 0; }
}
@keyframes evC2 {
  0%, 24%  { opacity: 0; transform: translateY(10px) scale(.94); }
  30%, 90% { opacity: 1; transform: none; }
  95%, 100% { opacity: 0; }
}
/* Prova 1: o documento. Prova 2: o link. Entram em sequência, nunca juntas. */
@keyframes evSrcDoc {
  0%, 40%  { opacity: 0; transform: translateY(12px); }
  44%, 92% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; }
}
@keyframes evSrcWeb {
  0%, 56%  { opacity: 0; transform: translateY(12px); }
  60%, 92% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; }
}

/* O destaque "varre" o trecho comprovado, como um marca-texto. */
@keyframes evMarkDoc {
  0%, 46% {
    background-image: linear-gradient(90deg, rgba(76,138,147,.32), rgba(76,138,147,.32));
    background-repeat: no-repeat;
    background-size: 0% 100%;
  }
  54%, 100% {
    background-image: linear-gradient(90deg, rgba(76,138,147,.32), rgba(76,138,147,.32));
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
}
@keyframes evMarkWeb {
  0%, 63% {
    background-image: linear-gradient(90deg, rgba(78,146,112,.32), rgba(78,146,112,.32));
    background-repeat: no-repeat;
    background-size: 0% 100%;
  }
  71%, 100% {
    background-image: linear-gradient(90deg, rgba(78,146,112,.32), rgba(78,146,112,.32));
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
}

/* Cada fonte pisca uma vez, no momento em que sua prova aparece. */
@keyframes evPulsePage {
  0%, 41%, 51%, 100% { box-shadow: 0 0 0 0 rgba(76,138,147,0); }
  46% { box-shadow: 0 0 0 5px rgba(76,138,147,.22); }
}
@keyframes evPulseLink {
  0%, 58%, 69%, 100% { box-shadow: 0 0 0 0 rgba(78,146,112,0); }
  63% { box-shadow: 0 0 0 5px rgba(78,146,112,.22); }
}

@media (max-width: 900px) {
  .evidence-section {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 3.5rem 1.25rem;
  }
  .evidence-copy h2 { font-size: 1.9rem; }
  .ev-card { padding: 1.1rem; min-height: 0; }
  .ev-chip { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ev-line, .ev-chip, .ev-source, .ev-status-done { opacity: 1; animation: none; }
  .ev-status, .ev-quote mark, .ev-page, .ev-link { animation: none; }
  .ev-status { opacity: 0; }
  .ev-src-doc mark { background: rgba(76,138,147,.32); }
  .ev-src-web mark { background: rgba(78,146,112,.32); }
}

/* Quatro exemplos no mesmo molde, revezando. O ciclo de 44s é múltiplo exato
   dos 11s da animação interna, então cada card fica visível durante o seu
   próprio ciclo — nunca no meio do ciclo de outro. */
.evidence-demo { display: grid; }
.ev-card { grid-area: 1 / 1; }
.ev-card-1 { animation: evCard1 44s linear infinite; }
.ev-card-2 { animation: evCard2 44s linear infinite; }
.ev-card-3 { animation: evCard3 44s linear infinite; }
.ev-card-4 { animation: evCard4 44s linear infinite; }

@keyframes evCard1 { 0%, 23% { opacity: 1; } 25%, 98% { opacity: 0; } 100% { opacity: 1; } }
@keyframes evCard2 { 0%, 23% { opacity: 0; } 25%, 48% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes evCard3 { 0%, 48% { opacity: 0; } 50%, 73% { opacity: 1; } 75%, 100% { opacity: 0; } }
@keyframes evCard4 { 0%, 73% { opacity: 0; } 75%, 98% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ev-card { animation: none; }
  .ev-card-2, .ev-card-3, .ev-card-4 { display: none; }
}

/* A palavra "SEGAN" agora é o wordmark vetorial da marca, não texto renderizado
   com a fonte do sistema. O ".AI" continua em texto para herdar o accent. */
.wordmark-lockup { display: inline-flex; align-items: baseline; gap: 1px; }
.logo-wordmark {
  height: 0.72em;
  width: auto;
  display: block;
  transform: translateY(0.04em);
}

/* Toolbar do chat: "Limpar Chat" virou só a lixeira. O texto ocupava largura
   demais e empurrava Memória/Intensidade para a linha de baixo cedo demais. */
.btn-icon-only {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.chat-header-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* O botão de menu é fixo no canto (left:14px, 38px de largura). Sem esta folga
   ele cobria a logo da sidebar quando o menu abria. */
@media (max-width: 880px) {
  .sidebar-header { padding-left: 64px; }
}

/* A casinha herdava o tamanho de fonte do container e saía desproporcional. */
#btn-sidebar-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1.2rem;
  flex-shrink: 0;
}
#btn-sidebar-home:hover { background: var(--bg-tertiary); }

/* Configurações no mobile: as abas viravam uma faixa com rolagem horizontal,
   obrigando o usuário a arrastar de lado para achar as outras seções. Agora
   elas quebram em grade e cabem todas na tela de uma vez. */
@media (max-width: 880px) {
  #profile-modal .modal-content {
    flex-direction: column !important;
    height: auto !important;
    max-height: 90vh !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-y: auto !important;
  }
  /* Trilho de abas */
  #profile-modal .modal-content > div:first-child {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)) !important;
    overflow-x: visible !important;
    padding: 0.75rem !important;
    gap: 0.4rem !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color);
  }
  /* O título "CONFIGURAÇÕES" ocupava uma coluna inteira do grid sem necessidade */
  #profile-modal .modal-content > div:first-child > div:first-child {
    display: none !important;
  }
  #profile-modal .settings-tab-btn {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 0.3rem !important;
    padding: 0.6rem 0.4rem !important;
    font-size: 0.7rem !important;
    line-height: 1.2;
  }
  /* Painel de conteúdo rola sozinho, sem empurrar o modal */
  #profile-modal .modal-content > div:last-child {
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* Itens de grid têm min-width:auto por padrão e se recusam a encolher abaixo do
   conteúdo. Somado ao white-space:nowrap dos chips, o card ficava mais largo que
   a tela e o centramento do grid o jogava para fora à direita. */
.evidence-section > * { min-width: 0; }
.evidence-demo { min-width: 0; justify-items: center; }
.ev-card { width: 100%; max-width: 100%; }

@media (max-width: 900px) {
  .evidence-section { justify-items: center; text-align: center; }
  .evidence-copy { max-width: 34rem; }
  .ev-card { text-align: left; }
  .ev-cites { justify-content: flex-start; }
  .ev-chip {
    white-space: normal;
    max-width: 100%;
    word-break: break-word;
  }
  .ev-source-head { flex-wrap: wrap; }
  .ev-source-head span { word-break: break-word; }
}

/* ── "Sem limite de tamanho": indexa o arquivo inteiro e cita páginas distantes
   entre si (45, 1.402, 2.013) — a prova de que leu tudo, não só o começo. ── */
.scale-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 4rem;
  align-items: center;
}
.scale-section > * { min-width: 0; }
.scale-demo { min-width: 0; justify-items: center; }

.sc-card {
  width: 100%;
  max-width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
  padding: 1.5rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.10);
}

.sc-file { display: flex; align-items: center; gap: 0.75rem; }
.sc-file > i {
  font-size: 1.35rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}
.sc-file-meta { display: flex; flex-direction: column; min-width: 0; }
.sc-file-name { font-weight: 600; font-size: 0.95rem; }
.sc-file-sub { font-size: 0.78rem; color: var(--text-secondary); }

.sc-scan { margin: 1.25rem 0 1.5rem; position: relative; }
.sc-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.sc-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent-gradient);
  animation: scFill 9s ease-out infinite;
}
.sc-status-read,
.sc-status-done {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
}
.sc-status-read { color: var(--text-secondary); animation: scReading 9s linear infinite; }
.sc-status-done {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  color: var(--accent-emerald);
  font-weight: 600;
  opacity: 0;
  animation: scDone 9s ease-out infinite;
}

.sc-hits { display: flex; flex-direction: column; gap: 0.5rem; }
.sc-hit {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-cyan);
  opacity: 0;
}
.sc-hit-text {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
  min-width: 0;
}
.sc-page {
  margin-left: auto;
  font-style: normal;
  font-weight: 700;
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--accent-cyan);
  background: rgba(76, 138, 147, 0.14);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  flex-shrink: 0;
}
.sc-h1 { animation: scHit1 9s cubic-bezier(.2,.9,.3,1.25) infinite; }
.sc-h2 { animation: scHit2 9s cubic-bezier(.2,.9,.3,1.25) infinite; }
.sc-h3 { animation: scHit3 9s cubic-bezier(.2,.9,.3,1.25) infinite; }

@keyframes scFill {
  0%, 6%   { width: 0; }
  44%, 92% { width: 100%; }
  97%, 100% { width: 0; }
}
@keyframes scReading {
  0%, 40%  { opacity: 1; }
  44%, 100% { opacity: 0; }
}
@keyframes scDone {
  0%, 44%  { opacity: 0; transform: translateY(4px); }
  50%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scHit1 {
  0%, 50%  { opacity: 0; transform: translateY(10px); }
  57%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scHit2 {
  0%, 59%  { opacity: 0; transform: translateY(10px); }
  66%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scHit3 {
  0%, 68%  { opacity: 0; transform: translateY(10px); }
  75%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}

@media (max-width: 900px) {
  .scale-section {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 3.5rem 1.25rem;
    justify-items: center;
    text-align: center;
  }
  .scale-section .evidence-copy { max-width: 34rem; }
  .sc-card { padding: 1.1rem; text-align: left; }
  .sc-hit-text { font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-fill { width: 100%; animation: none; }
  .sc-hit { opacity: 1; animation: none; }
  .sc-status-read { display: none; }
  .sc-status-done { position: static; opacity: 1; animation: none; }
}

/* A sequência agora tem um passo a mais: o arquivo é anexado, o usuário PERGUNTA,
   e só então vem a leitura e as citações. Sem a pergunta, as páginas apareciam
   do nada e não ficava claro que eram uma resposta. Ciclo esticado para 10s. */
.sc-file-ok {
  margin-left: auto;
  color: var(--accent-emerald);
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0;
  animation: scOk 10s ease-out infinite;
}
.sc-ask {
  margin: 1rem 0 0;
  margin-left: auto;
  width: fit-content;
  max-width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 14px 14px 4px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  color: var(--text-primary);
  opacity: 0;
  animation: scAsk 10s cubic-bezier(.2,.9,.3,1.25) infinite;
}
.sc-scan { margin: 1.1rem 0 1.5rem; }

.sc-fill        { animation-duration: 10s; }
.sc-status-read { animation-duration: 10s; }
.sc-status-done { animation-duration: 10s; }
.sc-h1, .sc-h2, .sc-h3 { animation-duration: 10s; }

@keyframes scOk {
  0%, 4%   { opacity: 0; transform: scale(.7); }
  9%, 92%  { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scAsk {
  0%, 12%  { opacity: 0; transform: translateY(8px); }
  18%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scFill {
  0%, 22%  { width: 0; }
  50%, 92% { width: 100%; }
  97%, 100% { width: 0; }
}
@keyframes scReading {
  0%, 20%  { opacity: 0; }
  24%, 47% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
@keyframes scDone {
  0%, 50%  { opacity: 0; transform: translateY(4px); }
  56%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scHit1 {
  0%, 58%  { opacity: 0; transform: translateY(10px); }
  64%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scHit2 {
  0%, 65%  { opacity: 0; transform: translateY(10px); }
  71%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}
@keyframes scHit3 {
  0%, 72%  { opacity: 0; transform: translateY(10px); }
  78%, 92% { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-ask, .sc-file-ok { opacity: 1; animation: none; }
}

/* ── "Meus Documentos" no mobile: estante de livros ──────────────────────────
   A tabela precisa de 720px e obrigava a arrastar de lado (até para achar a
   coluna de ordenar). Abaixo de 880px cada linha vira um "livro": lombada na
   esquerda, título em serifada e os metadados empilhados dentro da capa. */
@media (max-width: 880px) {
  .docs-table { min-width: 0; }
  .docs-table thead { display: none; }
  .docs-table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.9rem;
    padding: 1rem;
  }
  .docs-table tbody tr {
    display: block;
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px 10px 10px 4px;
    padding: 0.9rem 0.9rem 0.9rem 1.2rem;
    overflow: hidden;
    box-shadow: 2px 6px 16px rgba(0, 0, 0, 0.14);
  }
  /* A lombada */
  .docs-table tbody tr::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 7px;
    background: var(--accent-gradient);
  }
  /* Vinco entre a lombada e a capa */
  .docs-table tbody tr::after {
    content: "";
    position: absolute;
    left: 7px; top: 0; bottom: 0;
    width: 1px;
    background: rgba(0, 0, 0, 0.25);
  }
  .docs-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: none !important;
    padding: 0.3rem 0;
    font-size: 0.82rem;
  }
  .docs-table tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  /* Título do livro */
  .docs-table tbody td.td-name {
    display: block;
    padding: 0 2.4rem 0.55rem 0;
    margin-bottom: 0.4rem;
    border-bottom: 1px dashed var(--border-color) !important;
  }
  .docs-table tbody td.td-name::before { display: none; }
  .td-name .td-doc-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
  }
  .docs-table tbody td.td-actions {
    position: absolute;
    top: 0.6rem; right: 0.6rem;
    padding: 0;
  }
  .docs-table tbody td.td-actions::before { display: none; }
  /* Linhas de estado (carregando / vazio) ocupam a estante inteira */
  .docs-table tbody td[colspan] { display: block; }
  .docs-table tbody td[colspan]::before { display: none; }
}

/* O hambúrguer é fixo em left:14px e cobria o título "Gerenciador de
   Documentos" / "Resumo por Capítulo". Mesma folga já aplicada ao chat-header. */
@media (max-width: 880px) {
  .docs-header { padding-left: 3.5rem; }
}

/* ── Cards em carrossel quando os 3 não cabem mais lado a lado ───────────────
   Antes eles empilhavam em coluna, o que dava uma rolagem vertical enorme.
   Abaixo de 1024px viram uma faixa deslizante com scroll-snap. Os cards ficam
   com menos de 100% de largura de propósito: a "espiada" no card seguinte é o
   que avisa o usuário de que dá para arrastar. */
@media (max-width: 1024px) {
  .features-grid {
    display: flex;
    grid-template-columns: none;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 1.25rem;
    padding: 0.25rem 1.25rem 1rem;
    /* Sangra até as bordas da tela para o card poder "sair" pelo lado */
    margin: 0 -1.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .features-grid::-webkit-scrollbar { display: none; }

  .features-grid .feature-card {
    flex: 0 0 min(82%, 330px);
    scroll-snap-align: start;
    margin: 0;
  }

  /* O hover de elevação não faz sentido em toque e cortava no overflow */
  .features-grid .feature-card:hover { transform: none; }
}

/* ── Aviso de potencial ocioso ───────────────────────────────────────────────
   Aparece dentro da mensagem, na voz da AI, quando o usuário perguntou sem
   documento e sem busca. Usa o mesmo contorno gradiente do botão "Pesquisas"
   (dupla camada de background: padding-box sólido + border-box gradiente),
   porque é o mesmo convite — só que no momento em que ele importa. */
.idle-nudge {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-top: 1rem;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
    var(--accent-gradient) border-box;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  animation: idleNudgeIn 0.35s ease-out;
}
@keyframes idleNudgeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.idle-nudge-icon {
  color: var(--accent-cyan);
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.idle-nudge-text { min-width: 0; }
/* Cursor piscando enquanto "digita"; some quando termina. */
.idle-nudge-text::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent-cyan);
  animation: idleCaret 0.9s step-end infinite;
}
.idle-nudge.done .idle-nudge-text::after { display: none; }
@keyframes idleCaret {
  0%, 50% { opacity: 1; }
  50.1%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .idle-nudge { animation: none; }
  .idle-nudge-text::after { display: none; }
}

/* Coluna interna da box do aviso: texto em cima, botão embaixo. */
.idle-nudge-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

/* Botão do aviso de ociosidade — DENTRO da box, discreto: outline verde suave,
   sem gradiente gritando. Revela suave quando a "digitação" termina. */
.idle-nudge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.idle-nudge-actions.show { opacity: 1; transform: none; }
.idle-nudge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  background: rgba(78, 146, 112, 0.10);
  color: var(--accent-emerald);
  border: 1px solid rgba(78, 146, 112, 0.35);
  transition: var(--transition);
  white-space: nowrap;
}
.idle-nudge-btn i { font-size: 0.95rem; }
.idle-nudge-btn:hover { background: rgba(78, 146, 112, 0.18); border-color: var(--accent-emerald); }
.idle-nudge-btn:disabled { cursor: default; opacity: 0.7; }
.idle-nudge-btn:disabled:hover { background: rgba(78, 146, 112, 0.10); }

/* ── Escala: 3 livros famosos revezando (Bíblia, Guerra e Paz, LOTR) ─────────
   O ciclo de 30s é múltiplo exato dos 10s da animação interna de cada card,
   então cada livro entra sempre no início do próprio ciclo. O nome do livro no
   título troca em sincronia com o card. */
.features-container .scale-section {
  padding: 2.5rem 0 3.5rem; /* a seção agora vive dentro da features-container */
  max-width: none;
}
.sc-card { grid-area: 1 / 1; }
.sc-card-1 { animation: scRot1 30s linear infinite; }
.sc-card-2 { animation: scRot2 30s linear infinite; }
.sc-card-3 { animation: scRot3 30s linear infinite; }
@keyframes scRot1 { 0%, 31% { opacity: 1; } 33%, 98% { opacity: 0; } 100% { opacity: 1; } }
@keyframes scRot2 { 0%, 31% { opacity: 0; } 33%, 64% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes scRot3 { 0%, 64% { opacity: 0; } 66%, 98% { opacity: 1; } 100% { opacity: 0; } }

.sc-swap { display: inline-grid; align-items: baseline; }
.sc-w { grid-area: 1 / 1; white-space: nowrap; opacity: 0; }
.sc-w1 { animation: scRot1 30s linear infinite; }
.sc-w2 { animation: scRot2 30s linear infinite; }
.sc-w3 { animation: scRot3 30s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .sc-card, .sc-w { animation: none; }
  .sc-card-1, .sc-w1 { opacity: 1; }
  .sc-card-2, .sc-card-3, .sc-w2, .sc-w3 { display: none; }
}

/* ── "Leitura real": IA comum passa o olho, o Segan percorre a página ───────
   Painel esquerdo: 5 fontes "lidas" num piscar (a farsa do skim) e um veredito
   vago sem citação. Painel direito: uma faixa de leitura desce linha por linha
   e só então sai a citação entre aspas com página e fonte. Loop de 12s. */
.dp-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.dp-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
  padding: 1.1rem;
  min-width: 0;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.10);
}
.dp-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.88rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.85rem;
}
.dp-logo { width: 16px; height: 16px; }
[data-theme="dark"] .dp-logo { filter: invert(1) brightness(1.8); }
.dp-tag {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.dp-tag-deep { color: var(--accent-emerald); border-color: rgba(78,146,112,.35); }

.dp-src {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  padding: 0.28rem 0;
}
.dp-src .dp-chk { margin-left: auto; color: var(--text-muted); opacity: 0; }
/* Todos os checks estalam quase juntos: a "leitura" de 47 fontes em 3 segundos */
.dp-s1 .dp-chk { animation: dpChk 12s linear infinite; animation-delay: 0s; }
.dp-s2 .dp-chk { animation: dpChk 12s linear infinite; animation-delay: 0.15s; }
.dp-s3 .dp-chk { animation: dpChk 12s linear infinite; animation-delay: 0.3s; }
.dp-s4 .dp-chk { animation: dpChk 12s linear infinite; animation-delay: 0.45s; }
.dp-s5 .dp-chk { animation: dpChk 12s linear infinite; animation-delay: 0.6s; }
@keyframes dpChk {
  0%, 4%   { opacity: 0; transform: scale(.6); }
  6%, 92%  { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; }
}
.dp-verdict {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.5;
  opacity: 0;
  animation: dpVerdict 12s ease-out infinite;
}
.dp-verdict .dp-nofonte {
  display: block;
  margin-top: 0.45rem;
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #EF4444;
  opacity: 0.75;
}
@keyframes dpVerdict {
  0%, 9%   { opacity: 0; transform: translateY(5px); }
  13%, 92% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; }
}

.dp-page {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0.6rem 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.dp-line {
  display: block;
  height: 7px;
  border-radius: 4px;
  background: var(--bg-tertiary);
}
.dp-key { animation: dpKey 12s linear infinite; }
@keyframes dpKey {
  0%, 42%  { background: var(--bg-tertiary); }
  46%, 92% { background: rgba(78, 146, 112, 0.55); }
  96%, 100% { background: var(--bg-tertiary); }
}
/* A faixa de leitura desce a página linha a linha */
.dp-reader {
  position: absolute;
  left: 4px; right: 4px; top: 7px;
  height: 13px;
  border-radius: 4px;
  background: rgba(76, 138, 147, 0.18);
  border-left: 2px solid var(--accent-cyan);
  opacity: 0;
  animation: dpRead 12s linear infinite;
}
@keyframes dpRead {
  0%, 7%   { opacity: 0; transform: translateY(0); }
  9%       { opacity: 1; transform: translateY(0); }
  55%      { opacity: 1; transform: translateY(84px); }
  58%, 100% { opacity: 0; transform: translateY(84px); }
}
.dp-quote {
  margin-top: 0.8rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-primary);
  opacity: 0;
  animation: dpQuote 12s cubic-bezier(.2,.9,.3,1.2) infinite;
}
.dp-quote em {
  display: block;
  margin-top: 0.35rem;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
}
@keyframes dpQuote {
  0%, 57%  { opacity: 0; transform: translateY(8px); }
  63%, 92% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; }
}

@media (max-width: 640px) {
  .dp-card { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .dp-chk, .dp-verdict, .dp-quote { opacity: 1; animation: none; }
  .dp-reader { display: none; }
  .dp-key { background: rgba(78, 146, 112, 0.55); animation: none; }
}

/* ── Correções do revezamento e gatilho por visibilidade ─────────────────────
   Os cards agora se EMPILHAM na mesma célula (o bug era .scale-demo sem
   display:grid: os cards fluíam um abaixo do outro e o vazio aparecia).
   O revezamento passou pro JS porque CSS não reinicia a animação interna
   quando o card volta a aparecer; o JS troca a classe .active e as animações
   internas recomeçam do zero em cada entrada. */
.scale-demo { display: grid; }
.sc-card { grid-area: 1 / 1; opacity: 0; transition: opacity 0.45s ease; }
.sc-card.active { opacity: 1; }
.sc-card-1, .sc-card-2, .sc-card-3 { animation: none; }

/* Animações internas só rodam no card ativo — e recomeçam quando ele ativa */
.sc-card:not(.active) .sc-fill,
.sc-card:not(.active) .sc-status-read,
.sc-card:not(.active) .sc-status-done,
.sc-card:not(.active) .sc-file-ok,
.sc-card:not(.active) .sc-ask,
.sc-card:not(.active) .sc-h1,
.sc-card:not(.active) .sc-h2,
.sc-card:not(.active) .sc-h3 { animation: none; }

#sc-book { transition: opacity 0.28s ease; }
#sc-book .accent-text { white-space: nowrap; }

/* Seções animadas ficam congeladas até entrarem na tela (JS põe .in-view) */
.anim-gate:not(.in-view) * { animation-play-state: paused !important; }

/* O painel comparativo respirava mais em cima do que embaixo */
#depth { padding-top: 3.25rem; }

/* Status "lendo…" do painel Segan: visível durante a varredura, some na citação */
.dp-reading {
  margin-top: 0.55rem;
  font-size: 0.74rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  opacity: 0;
  animation: dpReading 12s linear infinite;
}
.dp-reading i {
  color: var(--accent-cyan);
  animation: evSpin 1s linear infinite;
}
@keyframes dpReading {
  0%, 8%   { opacity: 0; }
  10%, 54% { opacity: 1; }
  58%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-card { transition: none; }
  .dp-reading { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-card-1 { opacity: 1 !important; }
}

/* ── Ritmo vertical uniforme na landing ─────────────────────────────────────
   O descompasso vinha de duas fontes somadas: features-container com
   margin-bottom de 6rem e evidence-section com padding de 5rem — o vão ACIMA
   de uma animação era o dobro do vão abaixo. Agora toda fronteira entre
   seções soma o mesmo respiro. */
.features-container { margin-bottom: 0; padding: 3.25rem 0; }
.evidence-section { padding: 3.25rem 2rem; }
/* Título -> animação estava apertado demais dentro da seção de precisão */
.features-container .scale-section { padding: 3rem 0 3.75rem; }

/* ── Documentos de exemplo (onboarding) ──────────────────────────────────────
   Badge "Exemplo", chips de sugestão de pergunta e o tour de boas-vindas.
   Os docs demo são compartilhados: visual sempre discreto, nunca competindo
   com o conteúdo do próprio usuário. */
.demo-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: 4px;
  white-space: nowrap;
}

#demo-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem 0.15rem;
}
.demo-suggestions-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.demo-suggestions-label i { color: var(--accent-cyan); }
.demo-suggestion-chip {
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.3;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  max-width: 100%;
}
.demo-suggestion-chip:hover {
  border-color: rgba(6, 182, 212, 0.45);
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.07);
}

.demo-tour-box {
  max-width: 560px;
  width: calc(100% - 2rem);
  padding: 2rem;
  max-height: 90vh;
  overflow-y: auto;
}
#demo-tour-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.demo-tour-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  color: inherit;
  font: inherit;
}
.demo-tour-card:hover {
  border-color: rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.05);
  transform: translateY(-1px);
}
.demo-tour-card-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.demo-tour-card-head > i {
  font-size: 1.35rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}
.demo-tour-card-head strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 700;
}
.demo-tour-card-head span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.demo-tour-question {
  margin: 0;
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.demo-tour-question i {
  color: var(--accent-purple);
  font-style: normal;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

@media (max-width: 640px) {
  .demo-tour-box { padding: 1.4rem 1.1rem; }
  .demo-suggestions-label { width: 100%; }
}

/* ── Animações do onboarding (tour de boas-vindas + chips) ───────────────────
   Escopadas só ao tour para não tocar nos modais já validados. O box entra
   com fade + subida; os cards revelam em cascata; os chips surgem em sequência. */
@keyframes demoOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes demoBoxIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes demoCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes demoChipIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes demoIconFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

#demo-tour-modal.active {
  animation: demoOverlayIn 0.28s ease both;
}
#demo-tour-modal.active .demo-tour-box {
  animation: demoBoxIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Ícone do cabeçalho flutua de leve */
#demo-tour-modal .upload-modal-title > i {
  display: inline-block;
  animation: demoIconFloat 3.2s ease-in-out infinite;
}

/* Cards surgindo em cascata (o JS injeta na ordem; o nth-child dá o atraso) */
#demo-tour-list .demo-tour-card {
  opacity: 0;
  animation: demoCardIn 0.4s ease both;
}
#demo-tour-list .demo-tour-card:nth-child(1) { animation-delay: 0.14s; }
#demo-tour-list .demo-tour-card:nth-child(2) { animation-delay: 0.22s; }
#demo-tour-list .demo-tour-card:nth-child(3) { animation-delay: 0.30s; }
#demo-tour-list .demo-tour-card:nth-child(4) { animation-delay: 0.38s; }
#demo-tour-list .demo-tour-card:nth-child(5) { animation-delay: 0.46s; }
#demo-tour-list .demo-tour-card:nth-child(6) { animation-delay: 0.54s; }

/* Chips de sugestão entram em sequência quando o box aparece */
#demo-suggestions[style*="flex"] .demo-suggestion-chip {
  opacity: 0;
  animation: demoChipIn 0.3s ease both;
}
#demo-suggestions .demo-suggestion-chip:nth-child(2) { animation-delay: 0.05s; }
#demo-suggestions .demo-suggestion-chip:nth-child(3) { animation-delay: 0.12s; }
#demo-suggestions .demo-suggestion-chip:nth-child(4) { animation-delay: 0.19s; }

@media (prefers-reduced-motion: reduce) {
  #demo-tour-modal.active,
  #demo-tour-modal.active .demo-tour-box,
  #demo-tour-list .demo-tour-card,
  #demo-suggestions .demo-suggestion-chip,
  #demo-tour-modal .upload-modal-title > i {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ── Correções de mobile: modais roláveis + filtros de documentos ────────────
   1) Modais com muito conteúdo (planos, perfil) precisam rolar dentro da caixa
      no celular — senão o botão de baixo (ex.: "Ativar Assinatura") fica fora
      da tela e é impossível de tocar. */
.modal-overlay .upload-progress-modal,
.modal-overlay .modal-content {
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 2) Aba "Documentos Indexados": a busca e o "Ordenar" transbordavam para o
      lado em telas estreitas, obrigando a arrastar. Agora quebram em linha e a
      busca ocupa a largura disponível. */
@media (max-width: 640px) {
  .docs-table-title-bar { align-items: flex-start; }
  .docs-filters {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.6rem !important;
  }
  .docs-filters .search-wrapper { flex: 1 1 100%; }
  .docs-filters .search-wrapper input#docs-search {
    width: 100% !important;
    box-sizing: border-box;
  }
  .docs-filters .sort-wrapper { flex: 1 1 100%; }
  .docs-filters .sort-wrapper select#docs-sort { flex: 1; }
}

/* ── Tour de boas-vindas v2: boxes lado a lado ───────────────────────────────
   Os cards viraram quadradinhos em grade (ícone + título + páginas) no lugar
   da lista retangular cheia de texto. A pergunta de exemplo continua viva: o
   clique preenche o chat e os chips de sugestão assumem de lá. */
#demo-tour-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
#demo-tour-list .demo-tour-card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
  padding: 1.05rem 0.6rem 0.95rem;
  min-height: 108px;
}
.demo-tour-icon {
  font-size: 1.7rem;
  color: var(--accent-cyan);
  line-height: 1;
}
#demo-tour-list .demo-tour-card strong {
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--text-primary);
  font-weight: 700;
}
#demo-tour-list .demo-tour-card span {
  font-size: 0.66rem;
  color: var(--text-muted);
}
#demo-tour-list .demo-tour-card:hover .demo-tour-icon {
  transform: scale(1.12);
  transition: transform 0.25s ease;
}
.demo-tour-box { max-width: 500px; }

@media (max-width: 560px) {
  #demo-tour-list { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  #demo-tour-list .demo-tour-card { min-height: 96px; padding: 0.85rem 0.5rem; }
}

/* ── Mobile v2: Ordenar sempre à vista + modais compráveis ───────────────────
   O scroll horizontal era do .docs-table-container INTEIRO — e a barra com
   busca/Ordenar mora dentro dele, então rolava junto com a tabela. Agora quem
   rola é só a TABELA; a barra de título fica parada na tela. */
@media (max-width: 1100px) {
  .docs-table-container { overflow-x: visible; }
  .docs-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}
/* No modo estante (≤880px) a tabela vira cards e não estoura — volta ao normal */
@media (max-width: 880px) {
  .docs-table { display: table; overflow: visible; }
}

/* Modais: altura presa ao viewport REAL do celular (dvh ignora a barra do
   navegador; vh no iOS não) — o botão "Ativar Assinatura" fica sempre
   alcançável rolando dentro da caixa. */
.modal-overlay { overscroll-behavior: contain; }
.modal-overlay .upload-progress-modal,
.modal-overlay .modal-content {
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}
/* Telas baixas: ancora no topo pra caixa nunca "nascer" cortada */
@media (max-height: 700px) {
  .modal-overlay { align-items: flex-start; overflow-y: auto; }
}

/* ── Modal de planos v2 ──────────────────────────────────────────────────────
   Cards com hierarquia real: nome + tagline, preço grande, mini-lista de
   recursos e faixa "MAIS POPULAR" no Cosmos. O card selecionado ganha borda
   acesa; o plano atual do usuário é marcado pelo JS com .bp-current. */
.billing-modal-box .billing-option-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.billing-modal-box .billing-option-card:hover {
  border-color: rgba(6, 182, 212, 0.35);
  transform: translateY(-1px);
}
.billing-modal-box .billing-option-card.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
  box-shadow: 0 0 0 1px var(--accent-cyan), 0 8px 24px rgba(6, 182, 212, 0.08);
}
.billing-modal-box .bp-cosmos.active {
  border-color: var(--accent-purple);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 1px var(--accent-purple), 0 8px 24px rgba(99, 102, 241, 0.12);
}
.billing-modal-box .bp-eternum.active {
  border-color: #C9A66B;
  box-shadow: 0 0 0 1px #C9A66B, 0 8px 24px rgba(201, 166, 107, 0.12);
}

.bp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.bp-id { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.bp-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.bp-tagline { font-size: 0.72rem; color: var(--text-muted); }
.bp-price { text-align: right; flex-shrink: 0; }
.bp-price strong {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  display: block;
  line-height: 1.2;
  color: var(--text-primary);
}
.bp-price span { font-size: 0.64rem; color: var(--text-muted); display: block; }

.bp-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.75rem;
}
.bp-features li {
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.bp-features li i { color: var(--accent-emerald); font-size: 0.9rem; flex-shrink: 0; }

.bp-ribbon {
  position: absolute;
  top: -9px;
  right: 14px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.bp-extras { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.bp-extras .discount-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
}

/* Marca "Seu plano" no card do plano atual (JS põe .bp-current) */
.billing-option-card.bp-current::after {
  content: "Seu plano";
  position: absolute;
  top: -9px;
  left: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
}

@media (max-width: 560px) {
  .bp-features { grid-template-columns: 1fr; }
  .billing-modal-box { padding: 1.4rem 1.1rem !important; }
}

/* ── Modal de planos v3 (molde Duolingo) ─────────────────────────────────────
   Cards compactos em linha (nome + preço), Cosmos com faixa e borda em
   gradiente, CTA única gigante ("Experimente por R$ 0,00"), Core/Eternum
   atrás do "Ver todos os planos", desconto recolhido. Entrada em cascata. */
.billing-modal-box .billing-option-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 2.4rem 0.9rem 1.1rem;
  border-radius: 12px;
}
.billing-modal-box .bp-price { display: flex; align-items: baseline; gap: 0.15rem; }
.billing-modal-box .bp-price strong { font-size: 1rem; display: inline; }
.billing-modal-box .bp-price span { display: inline; font-size: 0.66rem; }
.billing-modal-box .bp-tagline { max-width: 260px; }

/* ── Vitrine do Free (09/08): chip de contexto + deltas DE→PARA + timeline ──
   Só aparecem quando quem olha está no plano Free (classe bp-vitrine posta
   pelo JS). Pagante vendo upgrade mantém os cards compactos de sempre. */
#bp-chip-free {
  display: none; /* o JS liga (flex) só para usuário Free */
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.32rem 0.8rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  width: fit-content;
  margin-bottom: 0.75rem;
}
#bp-chip-free .bpc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }

.billing-modal-box .billing-option-card.bp-vitrine { flex-wrap: wrap; }
.bp-vitrine-extra { flex-basis: 100%; display: none; margin-top: 0.25rem; }
.billing-option-card.bp-vitrine .bp-vitrine-extra { display: block; }
/* Na vitrine a tagline compacta é redundante — os deltas logo abaixo dizem o
   mesmo com mais força. Escondê-la devolve duas linhas pro modal caber. */
.billing-option-card.bp-vitrine .bp-tagline { display: none; }

.bpv-deltas { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.55rem; }
/* flex-start + line-heights casados: quando o texto quebra em duas linhas, o
   "de" riscado e a seta ficam presos à PRIMEIRA linha, não boiando no meio. */
.bpv-delta { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.8rem; line-height: 1.45; color: var(--text-secondary); }
.bpv-delta b { color: var(--text-primary); }
.bpv-de {
  width: 64px; flex: 0 0 auto; text-align: right;
  font-size: 0.7rem; line-height: 1.66; color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(178, 91, 91, 0.65);
}
/* Seta em TEXTO (→). O ▶ anterior tem apresentação emoji no iPhone e virava
   um botão de play azul no meio do card. */
.bpv-seta { font-size: 0.72rem; line-height: 1.62; color: var(--text-muted); flex: 0 0 auto; }

/* (A linha do tempo saiu na versão C de 09/08 — virou meia frase na nota
   do botão. Os deltas acima são o único extra da vitrine.) */

/* Check de seleção no canto (só no card ativo) */
.bp-check {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%) scale(0.6);
  font-size: 1.15rem;
  color: var(--accent-cyan);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.billing-option-card.active .bp-check { opacity: 1; transform: translateY(-50%) scale(1); }
.bp-cosmos.active .bp-check { color: var(--accent-purple); }
.bp-eternum.active .bp-check { color: #C9A66B; }

/* Cosmos selecionado: borda em gradiente (truque de background duplo) */
.billing-modal-box .bp-cosmos.active {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
    linear-gradient(90deg, var(--accent-cyan), var(--accent-purple)) border-box;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.14);
}

/* Core/Eternum escondidos até "Ver todos os planos" */
#billing-cards .bp-more { display: none; }
#billing-cards .bp-more.bp-more-open {
  display: flex;
  animation: demoCardIn 0.3s ease both;
}

/* Links discretos (ver planos / código de desconto) */
.billing-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  margin: 0 auto 0.9rem;
  transition: var(--transition);
}
.billing-link-btn:hover { color: var(--text-primary); }

/* CTA respirando no hover */
#btn-billing-activate:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.3);
}

/* Entrada: box sobe + cards em cascata */
#billing-modal.active .billing-modal-box {
  animation: demoBoxIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#billing-modal.active .billing-option-card {
  animation: demoCardIn 0.38s ease both;
}
#billing-modal.active .billing-option-card:nth-child(1) { animation-delay: 0.1s; }
#billing-modal.active .billing-option-card:nth-child(2) { animation-delay: 0.18s; }
#billing-modal.active .billing-option-card:nth-child(3) { animation-delay: 0.26s; }
#billing-modal.active .billing-option-card:nth-child(4) { animation-delay: 0.32s; }
#billing-modal.active #btn-billing-activate {
  animation: demoCardIn 0.4s ease 0.3s both;
}

@media (prefers-reduced-motion: reduce) {
  #billing-modal.active .billing-modal-box,
  #billing-modal.active .billing-option-card,
  #billing-modal.active #btn-billing-activate,
  #billing-cards .bp-more.bp-more-open {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 560px) {
  .billing-modal-box .bp-tagline { max-width: 170px; }
  /* O modal precisa caber INTEIRO na tela do celular — rolagem interna aqui
     é defeito, não recurso (reclamação recorrente). Respiro menor no mobile. */
  .billing-modal-box { padding: 1.35rem 1.1rem !important; }
  .billing-modal-box .billing-option-card { padding: 0.8rem 2.2rem 0.8rem 0.95rem; }
}

/* ── Confirmação do teste grátis (tela do R$ 0,00) ───────────────────────────
   Passo intermediário antes da página do Asaas: o número gigante mata a
   dúvida, a lista diz quando (e se) haverá cobrança, e o aviso prepara para
   o "total R$ 89" que a página deles exibe como valor mensal. */
.trial-zero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 1.1rem 0 0.4rem;
}
.trial-zero .tz-big {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.trial-zero .tz-hoje {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.trial-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.trial-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.45;
}
.trial-points li i {
  color: var(--accent-emerald);
  font-size: 1.05rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}
.trial-heads-up {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: rgba(6, 182, 212, 0.06);
  border: 1px dashed rgba(6, 182, 212, 0.3);
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.trial-heads-up i {
  color: var(--accent-cyan);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
#billing-trial-confirm { animation: demoCardIn 0.35s ease both; }
#btn-trial-go:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.3);
}
@media (prefers-reduced-motion: reduce) {
  #billing-trial-confirm { animation: none; }
}

/* ── Documentos bloqueados (excedem o armazenamento do plano atual) ───────────
   A trava REAL é no servidor (workflow de chat recusa docs fora da cota); isto
   aqui é a UX: cadeado, linha esmaecida, item não selecionável no anexo. */
.doc-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 4px;
  white-space: nowrap;
}
.doc-row-locked .td-name,
.doc-row-locked td[data-label="Páginas"],
.doc-row-locked td[data-label="Tamanho"],
.doc-row-locked td[data-label="Capítulos"],
.doc-row-locked td[data-label="Origem"] {
  opacity: 0.5;
}
.dropdown-item-locked { opacity: 0.55; }
.dropdown-item-locked:hover { opacity: 0.75; }

/* ── Grifos nas respostas da AI ──────────────────────────────────────────────
   Citações entre aspas (4+ palavras) ganham marca-texto clean; referências
   de página "(página X)" ficam verdes — o olho acha a evidência na hora. */
/* Citação LONGA (>7 palavras): CARD de verdade — bloco elevado, faixa verde à
   esquerda (assinatura Segan) e sombra suave embaixo. Sem grifo, sem borda
   quebrada entre linhas: uma caixa limpa que respira. */
.quote-box {
  display: block;
  margin: 0.85em 0;
  padding: 0.85em 1.15em;
  background: var(--bg-tertiary); /* um degrau acima da bolha (agora bg-secondary) */
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-emerald);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  line-height: 1.6;
}
[data-theme="light"] .quote-box {
  /* Um degrau da seção branca (mesma lógica do escuro): creme suave da paleta,
     com a faixa verde + sombra segurando o destaque. */
  background: var(--bg-primary);
  box-shadow: 0 8px 22px rgba(24, 45, 34, 0.10);
}

/* Caixa "de trás" do agente (a que contém o card): NEUTRA, um degrau da bolha.
   O HTML gerado traz estilo inline branco-a-2% (feito pro escuro; no claro
   sumia) — !important porque o original é inline. Nada de verde: a hierarquia
   é página → bolha → seção do agente → card da citação (o único com verde). */
.agent-response-section {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--border-color) !important;
}
[data-theme="light"] .agent-response-section {
  /* Espelha o escuro: card BRANCO definido (como a caixa do usuário) sobre o
     creme da página — antes era cinza e parecia transparente. */
  background: #FFFFFF !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 4px 20px rgba(24, 45, 34, 0.06) !important;
}

/* Citação CURTA (4–7 palavras): grifo marca-texto (pinta só a metade de baixo).
   Verde pra combinar com a elegância do resto; calibrado por tema. */
.quote-highlight {
  background: linear-gradient(transparent 48%, rgba(78, 146, 112, 0.32) 48%);
  border-radius: 3px;
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
[data-theme="light"] .quote-highlight {
  background: linear-gradient(transparent 48%, rgba(78, 146, 112, 0.22) 48%);
}

/* Nota pós-pesquisa: nº de páginas do relatório gerado (busca web/acadêmica).
   Discreta, no rodapé da resposta — o número é o único destaque. */
.search-pages-note {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(127, 127, 127, 0.25);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.search-pages-note i { color: var(--accent-emerald); font-size: 1rem; margin-top: 0.05rem; }
.search-pages-note strong { color: var(--text-primary); }

/* (página X): só a cor — verde degradê elegante, mesma fonte, sem pílula/borda. */
.page-ref {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
  /* Era nowrap para "(página 12)" não quebrar no meio. Só que a citação da web
     traz o nome inteiro da obra — "(página 1769, Bíblia Sagrada Contendo o
     Velho e o Novo Testamentos - Intellectual Reserve, Inc.)" — e sem poder
     quebrar ela atravessava a borda do card. Quebrar é feio; vazar é pior. */
  overflow-wrap: anywhere;
}
/* Nada dentro da resposta pode atravessar a borda: nome de obra, URL crua,
   token comprido de PDF. A caixa manda, o conteúdo se ajusta. */
.agent-response-section, .agent-response-section * { min-width: 0; overflow-wrap: anywhere; }
/* Fallback caso o navegador não recorte o gradiente no texto */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .page-ref { color: var(--accent-emerald); background: none; }
}

/* ── Tutorial "o que o Segan faz" (pós-onboarding, estilo videogame) ────── */
.tutorial-segan-overlay{position:fixed;inset:0;z-index:2600;background:rgba(5,8,7,.72);backdrop-filter:blur(6px);display:flex;align-items:center;justify-content:center;padding:1rem;opacity:0;transition:opacity .25s ease}
.tutorial-segan-overlay.aberto{opacity:1}
.tutorial-segan{width:min(430px,94vw);background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:var(--radius-lg);padding:1.6rem 1.5rem 1.35rem;transform:translateY(14px) scale(.97);transition:transform .28s cubic-bezier(.2,.9,.3,1.2);box-shadow:0 24px 60px rgba(0,0,0,.5)}
.tutorial-segan-overlay.aberto .tutorial-segan{transform:none}
.tut-eyebrow{display:inline-flex;align-items:center;gap:.4rem;font-size:.68rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--accent-cyan);background:rgba(53,116,95,.14);border:1px solid rgba(53,116,95,.35);border-radius:999px;padding:.28rem .7rem;margin-bottom:.85rem}
.tut-titulo{font-family:var(--font-heading);font-size:1.22rem;font-weight:800;color:var(--text-primary);margin:0 0 .35rem}
.tut-sub{font-size:.84rem;color:var(--text-secondary);line-height:1.55;margin:0 0 1.1rem}
.tut-linhas{display:flex;flex-direction:column;gap:.6rem;margin-bottom:1.25rem}
.tut-linha{display:flex;gap:.75rem;align-items:flex-start;background:rgba(255,255,255,.025);border:1px solid rgba(255,255,255,.06);border-radius:10px;padding:.7rem .8rem}
.tut-linha i{font-size:1.1rem;color:var(--accent-cyan);margin-top:.1rem;flex-shrink:0}
.tut-linha b{color:var(--text-primary);font-size:.83rem;display:block;margin-bottom:.1rem}
.tut-linha span{font-size:.78rem;color:var(--text-secondary);line-height:1.45}
.tut-cta{width:100%;display:flex;align-items:center;justify-content:center;gap:.5rem;padding:.85rem;border:none;border-radius:10px;background:linear-gradient(90deg,var(--accent-cyan),var(--accent-purple));color:#fff;font-weight:800;font-size:.92rem;cursor:pointer;transition:var(--transition)}
.tut-cta:hover{filter:brightness(1.1)}
.tut-depois{width:100%;margin-top:.55rem;background:transparent;border:none;color:var(--text-muted);font-size:.8rem;font-weight:600;cursor:pointer;padding:.45rem;transition:var(--transition)}
.tut-depois:hover{color:var(--text-secondary)}

/* Linha de preferência nas configurações (switch próprio, 34×20) */
.pref-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;background:rgba(255,255,255,.02);border:1px solid rgba(255,255,255,.06);border-radius:8px;padding:.85rem 1rem;cursor:pointer;width:100%;text-align:left;color:var(--text-primary);transition:var(--transition)}
.pref-row:hover{border-color:rgba(255,255,255,.14)}
.pref-row .pref-txt b{font-size:.85rem;font-weight:700;display:block;color:var(--text-primary)}
.pref-row .pref-txt span{font-size:.75rem;color:var(--text-secondary);line-height:1.4;display:block;margin-top:.15rem}
.pref-pill{position:relative;width:34px;height:20px;border-radius:999px;background:rgba(255,255,255,.14);transition:background .18s ease;flex-shrink:0}
.pref-pill::after{content:"";position:absolute;top:3px;left:3px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .18s ease}
.pref-row.on .pref-pill{background:var(--accent-purple)}
.pref-row.on .pref-pill::after{transform:translateX(14px)}

/* ── Modelo único (08/08): o usuário não escolhe modelo ─────────────────── */
/* O seletor continua no DOM (o sorteador usa selectModel() nos botões
   ocultos e abas antigas dependem dos elementos) — só sai da vista. */
.top-model-selector{display:none!important}
#mobile-model-select-wrapper{display:none!important}
#btn-toggle-models{display:none!important}
#models-detail{display:none!important}

/* Marca invisivel de resposta provisoria (aviso que o cofre pode substituir) */
.segan-provisorio { display: none !important; }

/* ── Resumo por Capítulo: leitura em andamento ──────────────────────────────
   O loader antigo era um spinner + barra que pulava 30→65→100 sem relação com
   o que o servidor fazia. Aqui as etapas são as reais (abrir, fatiar, reunir
   trechos, redigir) e a barra anda com o tempo decorrido contra uma estimativa
   derivada do nº de páginas do documento — nunca chega a 100% antes do texto. */
.sum-load {
  display: none;   /* o JS troca para flex ao iniciar */
  flex-direction: column;
  gap: 1.35rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.sum-load-head { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.sum-load-ident { min-width: 0; }
.sum-load-orb {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.35rem;
  color: var(--accent-emerald);
  background: var(--accent-glow);
  border: 1px solid rgba(78, 146, 112, 0.28);
  position: relative;
}
/* Pulso lento: o documento está sendo lido agora. Um anel, não um spinner —
   spinner promete "quase lá" e este trabalho leva dezenas de segundos. */
.sum-load-orb::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(78, 146, 112, 0.5);
  animation: sumPulse 2.4s ease-out infinite;
}
@keyframes sumPulse {
  0%   { transform: scale(1);    opacity: 0.85; }
  70%  { transform: scale(1.22); opacity: 0; }
  100% { transform: scale(1.22); opacity: 0; }
}
.sum-load-doc {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sum-load-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: flex; flex-wrap: wrap; gap: 0.15rem 0.55rem;
}
.sum-load-meta span { display: inline-flex; align-items: center; gap: 0.28rem; }

.sum-steps { display: flex; flex-direction: column; gap: 0.1rem; }
.sum-step {
  display: flex; align-items: flex-start; gap: 0.7rem;
  padding: 0.42rem 0;
  font-size: 0.87rem;
  color: var(--text-muted);
  transition: color 0.35s ease;
}
.sum-step i { font-size: 1rem; line-height: 1.45; flex-shrink: 0; width: 1rem; text-align: center; }
.sum-step.ativa { color: var(--text-primary); font-weight: 600; }
.sum-step.ativa i { color: var(--accent-cyan); }
.sum-step.feita { color: var(--text-secondary); }
.sum-step.feita i { color: var(--accent-emerald); }

.sum-bar {
  width: 100%; height: 5px;
  background: rgba(127, 127, 127, 0.14);
  border-radius: 10px;
  overflow: hidden;
}
.sum-bar-fill {
  width: 0%; height: 100%;
  background: var(--accent-gradient);
  border-radius: inherit;
  transition: width 0.6s linear;
}
.sum-load-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sum-elapsed {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 0.35rem;
}

/* ── Resumo pronto: prosa ───────────────────────────────────────────────────
   Antes o texto saía cru num pre-wrap: o markdown aparecia como "#" e "**" na
   tela e as citações não tinham tratamento nenhum. Agora passa pelo mesmo
   pipeline do chat (formatResponseText + safeHTML), então .quote-box,
   .quote-highlight e .page-ref valem aqui também — sem CSS novo para eles. */
.sum-prosa {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 2.1rem;
  box-shadow: var(--shadow);
  width: 100%;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.8;
}
.sum-prosa p { margin: 0.85em 0; }
.sum-prosa p:first-child { margin-top: 0; }
.sum-prosa p:last-child { margin-bottom: 0; }
.sum-prosa strong { color: var(--text-primary); font-weight: 600; }
.sum-prosa h1, .sum-prosa h2, .sum-prosa h3, .sum-prosa h4 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  margin: 1.6em 0 0.55em;
}
.sum-prosa > h1:first-child, .sum-prosa > h2:first-child,
.sum-prosa > h3:first-child, .sum-prosa > h4:first-child { margin-top: 0; }
.sum-prosa h1 { font-size: 1.5rem; }
.sum-prosa h2 { font-size: 1.25rem; }
.sum-prosa h3, .sum-prosa h4 { font-size: 1.08rem; }
/* Regra fina abaixo do título da obra: fecha o cabeçalho sem pesar.
   ("# Obra" vira h2 no formatResponseText — h1 fica reservado à página.) */
.sum-prosa > h1:first-child,
.sum-prosa > h2:first-child {
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--border-color);
}
@media (max-width: 640px) {
  .sum-prosa { padding: 1.4rem 1.25rem; }
  .sum-load { padding: 1.35rem; }
}

/* ── Nota de rodapé do resumo ───────────────────────────────────────────────
   O agente já escrevia isto em texto corrido no fim do resumo, onde se perdia
   depois de 16 mil caracteres. Tiramos de lá (RODAPE_DO_AGENTE) e devolvemos
   aqui: mesma informação, separada do texto da obra, para a pessoa entender
   que as divisões não são capítulos oficiais quando não são. */
.sum-nota {
  margin-top: 2rem;
  padding-top: 1.15rem;
  border-top: 1px dashed rgba(127, 127, 127, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.sum-nota p {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.sum-nota i {
  color: var(--accent-cyan);
  font-size: 0.95rem;
  line-height: 1.5;
  flex-shrink: 0;
}
.sum-nota strong { color: var(--text-secondary); font-weight: 600; }

/* ── Aviso do Resumo grátis do Free ─────────────────────────────────────────
   O Free tem 1 resumo na vida. Sem dizer isso na cara, a pessoa gera o
   primeiro achando que é ilimitado e descobre o limite quando tenta o segundo
   — que é o pior momento possível para descobrir. */
.sum-aviso-free {
  display: none;   /* o JS liga só para quem é Free */
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  line-height: 1.55;
  background: var(--accent-glow);
  border: 1px solid rgba(78, 146, 112, 0.28);
  color: var(--text-secondary);
}
.sum-aviso-free.gasto {
  background: rgba(127, 127, 127, 0.08);
  border-color: var(--border-color);
  color: var(--text-muted);
}
.sum-aviso-free i { color: var(--accent-emerald); font-size: 1rem; line-height: 1.45; flex-shrink: 0; }
.sum-aviso-free.gasto i { color: var(--text-muted); }
.sum-aviso-free strong { color: var(--text-primary); font-weight: 600; }
.sum-aviso-free.gasto strong { color: var(--text-secondary); }

/* Aviso de não sair durante o resumo. O chat tem o cofre no servidor; o resumo
   não tem — sair no meio perde o trabalho de verdade. */
.sum-nao-saia {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.25);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.sum-nao-saia i { color: #EAB308; font-size: 0.95rem; line-height: 1.45; flex-shrink: 0; }
.sum-nao-saia strong { color: var(--text-primary); font-weight: 600; }


/* ── PDF do Resumo por Capítulo ─────────────────────────────────────────────
   Imprime a PRÓPRIA página, não um iframe: o Safari do iOS não abre print()
   chamado de dentro de iframe, e a maior parte dos nossos usuários está no
   celular. Na tela o bloco fica escondido; na impressão ele é a única coisa
   visível. */
#resumo-print { display: none; }

@media print {
  body.imprimindo-resumo > *:not(#resumo-print) { display: none !important; }
  body.imprimindo-resumo #resumo-print { display: block !important; }
  body.imprimindo-resumo {
    background: #fff !important;
    color: #111 !important;
    overflow: visible !important;
    height: auto !important;
  }
  @page { size: A4 portrait; margin: 25mm 20mm; }

  #resumo-print, #resumo-print * {
    font-family: Georgia, "Times New Roman", serif !important;
    color: #111 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  #resumo-print { font-size: 11.5pt; line-height: 1.65; }
  #resumo-print h1, #resumo-print h2, #resumo-print h3, #resumo-print h4 {
    line-height: 1.3; page-break-after: avoid; margin: 1.4em 0 .5em; font-weight: 700;
  }
  #resumo-print h2 { font-size: 15pt; }
  #resumo-print h3, #resumo-print h4 { font-size: 13pt; }
  #resumo-print p { margin: .7em 0; text-align: justify; orphans: 3; widows: 3; }

  /* Citação longa vira recuo clássico: box com sombra e borda colorida fica
     horrível no papel e some quando a impressora ignora o fundo. */
  #resumo-print .quote-box {
    display: block; margin: .9em 0 .9em 10mm; padding: 0 0 0 4mm;
    border: none !important; border-left: 2pt solid #999 !important;
    border-radius: 0 !important; font-size: 10.5pt; color: #333 !important;
  }
  #resumo-print .quote-highlight { background: none !important; font-style: italic; }
  #resumo-print .page-ref { font-weight: 700; }

  #resumo-print .rp-capa { page-break-after: always; text-align: center; padding-top: 28%; }
  #resumo-print .rp-marca { font-size: 11pt; letter-spacing: .3em; text-transform: uppercase; color: #666 !important; margin-bottom: 42mm; }
  #resumo-print .rp-tipo  { font-size: 12pt; letter-spacing: .14em; text-transform: uppercase; color: #666 !important; margin-bottom: 6mm; }
  #resumo-print .rp-obra  { font-size: 22pt; font-weight: 700; line-height: 1.3; margin-bottom: 10mm; }
  #resumo-print .rp-risca { width: 40mm; height: 2pt; background: #222 !important; margin: 0 auto 10mm; }
  #resumo-print .rp-data  { font-size: 10pt; color: #666 !important; }
  #resumo-print .rp-rodape {
    margin-top: 14mm; padding-top: 4mm; border-top: 1pt solid #ccc;
    font-size: 9pt; color: #555 !important; font-style: italic;
  }
}

/* ── Conserto de responsividade dos blocos do Resumo (18/08) ────────────────
   Item flex tem min-width:auto por padrão e NÃO encolhe abaixo do conteúdo.
   Sem min-width:0, um <span> de texto longo dentro de um flex row empurra o
   painel inteiro para fora da tela — foi o que aconteceu no celular com o
   aviso amarelo, a nota do rodapé e o título do documento no loader.
   O app já tinha esse conserto para a tabela de documentos; os blocos novos
   nasceram sem ele. */
.sum-load, .sum-prosa, .sum-nota, .sum-aviso-free, .sum-nao-saia,
#summary-chapters-list, #summary-results-container {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.sum-load-head, .sum-load-ident, .sum-load-meta, .sum-load-foot,
.sum-step, .sum-nota p, .sum-aviso-free, .sum-nao-saia { min-width: 0; }
.sum-load-head > *, .sum-step > *, .sum-nota p > *,
.sum-aviso-free > *, .sum-nao-saia > * { min-width: 0; }
/* O ícone é o único que não pode encolher, senão vira um risco achatado. */
.sum-step i, .sum-nota i, .sum-aviso-free i, .sum-nao-saia i,
.sum-load-orb { flex-shrink: 0; }

/* Cabeçalho do resultado: com o botão de PDF ao lado do selo, não cabe em uma
   linha no celular. Quebra em vez de vazar. */
#summary-results-container > div:first-child { flex-wrap: wrap; gap: 0.6rem; }

@media (max-width: 640px) {
  /* No celular o título do documento pode ocupar duas linhas: cortar com
     reticências esconde justamente o nome da obra, que é a informação. */
  .sum-load-doc {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 0.98rem;
  }
  .sum-load { padding: 1.15rem; gap: 1.1rem; }
  .sum-prosa { padding: 1.25rem 1.1rem; font-size: 0.92rem; }
  .sum-load-meta { font-size: 0.74rem; }
  #summary-pdf-rodape button { width: 100%; justify-content: center; }
}

/* ── Mobile da landing (20/08/2026) ──────────────────────────────────────────
   Este bloco fica no FIM do arquivo de propósito: as regras base de
   .scale-section (~3500) vêm DEPOIS do bloco mobile principal (~2528), e em
   especificidade igual quem aparece por último ganha. Aqui embaixo, ganhamos. */
@media (max-width: 880px) {
  /* 1. Hero mais curto: o parágrafo termina em "sem resumir." — o fecho
        empurrava o "SEM LIMITE DE TAMANHO" pra fora da primeira rolagem. */
  .hero-p-extra { display: none; }
  .hero { margin-bottom: 1.25rem; }
  #features .scale-section { padding-top: 0.75rem; }

  /* 2. Ordem da seção: selo → título → ANIMAÇÃO → parágrafo. O texto
        "Diferente de outras IAs..." vinha antes e atrasava a demonstração.
        display:contents promove os filhos do evidence-copy a itens do grid
        da própria seção; o order reordena sem duplicar HTML e sem tocar no
        desktop, onde o layout de duas colunas segue intacto. */
  .scale-section { gap: 1.25rem; }
  .scale-section .evidence-copy { display: contents; }
  .scale-section .evidence-copy .hero-tag { order: 1; }
  .scale-section .evidence-copy h2 { order: 2; }
  .scale-section .scale-demo { order: 3; margin-top: 0.5rem; }
  .scale-section .evidence-copy p { order: 4; max-width: 34rem; }
}

/* ── Estado do anexo no compositor (26/08/2026) ──────────────────────────────
   Opção A: a barra de documentos ativos agora aparece TAMBÉM quando não há
   documento nenhum, em tom neutro — "sem documento" era um estado invisível,
   e gente perguntava "você leu o que anexei?" sem nunca ter anexado.
   Opção B: o aviso que sobe no clique de enviar quando a pergunta menciona um
   anexo inexistente. Avisa, não proíbe: o botão da direita envia assim mesmo. */
/* O !important não é preguiça: #active-doc-indicator carrega background e
   border-bottom em style INLINE no index.html, e inline vence qualquer
   seletor. Sem isto a barra do estado vazio saía com o fundo azulado do
   estado "com documento" — o oposto do que ela precisa comunicar. */
#active-doc-indicator.sem-doc {
  background: rgba(201, 162, 39, 0.07) !important;
  border-bottom: 1px solid rgba(201, 162, 39, 0.28) !important;
}
#active-doc-indicator.sem-doc .sd-aviso {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  color: #C9A227;
  font-size: 0.78rem;
  line-height: 1.4;
  min-width: 0;
}
#active-doc-indicator.sem-doc .sd-aviso > i { font-size: 0.95rem; flex: none; }
#active-doc-indicator.sem-doc .sd-anexar {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
#active-doc-indicator.sem-doc .sd-anexar:hover { color: #C9A227; }
#active-doc-indicator.sem-doc .sd-anexar:focus-visible { outline: 2px solid #C9A227; outline-offset: 2px; }

#aviso-anexo {
  display: none;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  margin: 0;
  /* Borda inteira, não só embaixo: o aviso é inserido DENTRO do padding do
     card, então ele flutua — meia borda ficaria solta no meio do nada. */
  background: rgba(201, 162, 39, 0.09);
  border: 1px solid rgba(201, 162, 39, 0.32);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  color: #C9A227;
  font-size: 0.8rem;
  line-height: 1.5;
  min-width: 0;
}
#aviso-anexo > i { font-size: 1rem; line-height: 1.4; flex: none; }
#aviso-anexo .aa-txt { flex: 1 1 14rem; min-width: 0; color: var(--text-secondary); }
#aviso-anexo .aa-txt strong { display: block; color: var(--text-primary); font-weight: 600; }
#aviso-anexo .aa-acoes { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-left: auto; }
#aviso-anexo button {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 7px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
#aviso-anexo .aa-btn-principal {
  background: #C9A227;
  border: 1px solid #C9A227;
  color: #1a1608;
}
#aviso-anexo .aa-btn-principal:hover { background: #d8b13a; }
#aviso-anexo .aa-btn-secundario {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
#aviso-anexo .aa-btn-secundario:hover { color: var(--text-primary); border-color: var(--text-muted); }
#aviso-anexo button:focus-visible { outline: 2px solid #C9A227; outline-offset: 2px; }

@media (max-width: 520px) {
  /* Empilhado, não lado a lado: com white-space:nowrap dois botões dividindo
     360px estouravam a caixa — o texto não quebra e a largura vaza. */
  #aviso-anexo { padding: 0.65rem 0.7rem; }
  #aviso-anexo .aa-acoes { margin-left: 0; width: 100%; flex-direction: column; }
  #aviso-anexo .aa-acoes button { width: 100%; padding: 0.5rem 0.7rem; }
  #aviso-anexo .aa-txt { flex-basis: 100%; }
}

/* Convite dos exemplos no dropdown de anexo (01/09/2026). Quem abre o clipe
   sem ter documento próprio saía de mãos vazias; os 5 PDFs de exemplo são a
   resposta para esse momento exato. */
#convite-exemplos {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  background: rgba(78, 146, 112, 0.07);
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: left;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}
#convite-exemplos:hover { background: rgba(78, 146, 112, 0.14); color: var(--text-primary); }
#convite-exemplos strong { color: var(--accent-emerald); font-weight: 600; }
#convite-exemplos > i { font-size: 0.95rem; color: var(--accent-emerald); flex: none; margin-top: 0.1rem; }
#convite-exemplos:focus-visible { outline: 2px solid var(--accent-emerald); outline-offset: -2px; }

/* Cancelar assinatura: discreto, mas legível. O tom de alerta só aparece no
   hover — antes de passar o mouse ele não deve competir com o botão de
   assinar, depois precisa deixar claro que é uma ação de saída. */
#btn-cancel-subscription:hover {
  color: var(--accent-red, #C05A4E) !important;
  background: rgba(192, 90, 78, 0.08);
}
#btn-cancel-subscription:focus-visible {
  outline: 2px solid var(--accent-red, #C05A4E);
  outline-offset: 2px;
}

/* Garantia embaixo do CTA da vitrine (04/09/2026). Responsivo: flex com
   quebra de linha no texto, ícone fixo; no celular a frase ocupa duas linhas
   sem estourar o modal. */
#billing-garantia {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.7rem 0 0;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: rgba(78, 146, 112, 0.08);
  border: 1px solid rgba(78, 146, 112, 0.22);
  color: var(--accent-emerald);
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: left;
}
#billing-garantia > i { flex: none; font-size: 0.95rem; margin-top: 0.05rem; }
#billing-garantia > span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 900px) { #billing-garantia { font-size: 0.76rem; padding: 0.45rem 0.6rem; } }
