/* ============================================================
   FlexNeur — new theme (dark emerald) + app shell components.
   Loaded after main/sidebar/chat/image, so the tokens below
   win the cascade and the whole UI follows the new palette.
   ============================================================ */

/* —— New design tokens —— */
:root {
  --bg-canvas: #070D0D;
  --bg-surface: #111A17;
  --bg-card-active: #182621;
  --border-subtle: #1E332B;
  --accent-primary: #10B981;
  --accent-mint: #00C896;
  --text-main: #ECFDF5;
  --text-muted: #8E9F97;

  /* —— App token remap: every component follows the new theme —— */
  --color-bg: var(--bg-canvas);
  --color-surface: var(--bg-surface);
  --color-surface-raised: #16241E;
  --color-surface-hover: var(--bg-card-active);
  --color-surface-translucent: rgba(236, 253, 245, 0.03);
  --color-surface-user: #15221C;
  --color-surface-sidebar: #050A09;
  --color-overlay: #0E1713;

  --color-text: var(--text-main);
  --color-text-secondary: #B9C6BF;
  --color-text-muted: var(--text-muted);
  --color-text-faint: #7A8A82;

  --color-accent: var(--accent-primary);
  --color-accent-hover: var(--accent-mint);
  --color-accent-deep: #0A8A66;
  --color-accent-soft: rgba(16, 185, 129, 0.10);
  --color-accent-softer: rgba(16, 185, 129, 0.05);
  --color-accent-line: rgba(16, 185, 129, 0.40);

  --color-border: var(--border-subtle);
  --color-border-strong: rgba(236, 253, 245, 0.14);
  --color-focus: var(--accent-primary);
  --color-on-accent: #04231A;

  --gradient-brand: linear-gradient(135deg, var(--accent-mint) 0%, var(--accent-primary) 52%, var(--accent-deep) 100%);
  --gradient-brand-orb: radial-gradient(circle at 34% 30%, var(--accent-mint), var(--accent-primary) 48%, var(--accent-deep));
  --gradient-brand-glow: rgba(16, 185, 129, 0.16);
}

/* The `hidden` attribute toggles the model picker, the quick
   chips and the history periods; it must always win over a
   component's own display rule. */
[hidden] { display: none !important; }

/* Configurações: janela independente, dimensionada pelo viewport (nunca pela sidebar). */
.settings-dialog {
  display: flex;
  flex-direction: row;
  width: min(860px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  height: min(780px, calc(100dvh - 48px));
  min-height: 0;
  max-height: calc(100dvh - 48px);
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
}

.settings-container {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.settings-nav {
  display: flex;
  flex: 0 0 176px;
  flex-direction: column;
  gap: 3px;
  padding: 16px 10px;
  border-right: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.015);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-nav-title {
  padding: 0 10px 12px;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.settings-nav-btn:hover,
.settings-nav-btn.active {
  border-color: var(--color-border);
  background: var(--color-surface-translucent);
  color: var(--color-text);
}

.settings-nav-btn.active {
  background: var(--color-accent-soft);
  border-color: var(--color-accent-line);
}

.settings-nav-btn > span:first-child { flex: 0 0 18px; text-align: center; }
.settings-nav-spacer { flex: 1 1 auto; }
.settings-sign-out { color: var(--color-danger); }
.settings-sign-out:hover { color: var(--color-danger); background: var(--color-danger-soft); }

.settings-content {
  /* A rolagem acontece dentro do conteúdo; o dialog mantém altura fixa. */
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: 22px 24px;
  overscroll-behavior: contain;
  overflow-y: auto;
}

.settings-content-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-content-heading .dialog-title { margin-bottom: 5px; font-size: 1.15rem; }
.settings-content-heading .dialog-text { margin-bottom: 0; }
.settings-tab-panel { display: none; }
.settings-tab-panel.active { display: block; }
.settings-tab-panel[aria-hidden="true"] { display: none; }

@media (max-width: 620px) {
  .settings-dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); height: auto; min-height: 0; max-height: calc(100dvh - 20px); overflow: hidden; }
  .settings-container { flex-direction: column; height: 100%; min-height: 0; }
  .settings-nav { flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 12px; border-right: 0; border-bottom: 1px solid var(--color-border); }
  .settings-nav-title { flex: 0 0 auto; width: auto; padding: 0 6px 4px; white-space: nowrap; }
  .settings-nav-btn { flex: 0 0 auto; width: auto; justify-content: center; gap: 6px; padding-inline: 8px; }
  .settings-nav-spacer { display: none; }
  .settings-sign-out { flex: 0 0 auto; justify-content: flex-start; }
  .settings-content { min-height: 0; padding: 18px; overflow-y: auto; }
}

/* —— Sidebar history grouped by period —— */
.conv-period {
  flex-shrink: 0;
}

.conv-period-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4) var(--space-1);
}

.conv-period .conv-list {
  padding: 0 var(--space-3);
}

/* —— Settings (sidebar footer area) —— */
.sidebar-account-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 12px var(--space-4) var(--space-2);
  padding: 6px 8px 6px 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.sidebar-account-row .auth-panel {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 3px 8px;
  border: 0;
  background: transparent;
}

.sidebar-settings {
  flex-shrink: 0;
  padding: 0;
  border: 0;
}

.settings-trigger {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  height: 32px;
  justify-content: center;
  padding: 0;
  border-radius: 11px;
}

.settings-trigger .sidebar-item-text { display: none; }
.settings-trigger .sidebar-item-icon { display: grid; place-items: center; }

.layout.sidebar-collapsed .sidebar-account-row {
  flex-direction: column;
  gap: 8px;
  margin: var(--space-2);
}

.layout.sidebar-collapsed .sidebar-account-row .auth-panel {
  flex: 0 0 auto;
  margin: 0;
  padding: var(--space-2);
}


.toggle-switch {
  position: relative;
  width: 34px;
  height: 18px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-switch .toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch.on {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle-switch.on .toggle-knob {
  transform: translateX(16px);
  background: var(--color-on-accent);
}

.toggle-switch:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* —— Quick Chips (Standard Mode shortcuts above the composer) —— */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  width: 100%;
  max-width: min(var(--composer-w), 100%);
  margin: 0 auto var(--space-2);
}

.quick-chip {
  padding: 2px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.quick-chip:hover {
  color: var(--text-main);
  border-color: var(--color-accent-line);
  background: var(--bg-card-active);
}

/* —— Composer contenteditable (menções inline) ——
   #input deixou de ser textarea para hospedar chips inline reais.
   O placeholder usa data-placeholder porque contenteditable não suporta
   ::placeholder. A menção é um nó inline identificável (span.mention),
   nunca texto arbitrário. */
#input {
  display: block;
  height: 26px;
  max-height: 140px;
  min-height: 26px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: hidden;
  overflow-y: hidden;
  cursor: text;
}
#input[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-faint);
  pointer-events: none;
}
#input .mention {
  display: inline;
  background: rgba(56, 132, 255, 0.15);
  border: 1px solid rgba(56, 132, 255, 0.38);
  border-radius: 6px;
  padding: 0 5px;
  color: #5ea2ff;
  font-weight: 600;
  white-space: nowrap;
  user-select: all;
}
#input .mention-icon { margin-right: 3px; }

/* —— Central TOOLS: descrição curta + estado da ferramenta —— */
.tool-note {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.tool-note.limited {
  color: var(--color-warning, #d9a441);
}

.sidebar-nav-btn.active {
  border-color: var(--color-accent-line);
  background: var(--bg-card-active);
  color: var(--text-main);
}

/* —— Menu de menções @ (modos de pesquisa junto ao composer) ——
   Ancora acima do campo: .input-area já é position: relative.
   Só existe no composer principal (#input); edição de mensagens
   usa outro elemento e nunca recebe este menu. */
.mention-menu {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 100%;
  margin-bottom: 6px;
  width: 100%;
  max-width: min(var(--composer-w), 100%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  z-index: 60;
}

.mention-menu[hidden] {
  display: none;
}

.mention-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.mention-option:hover,
.mention-option.focused {
  border-color: var(--color-accent-line);
  background: var(--bg-card-active);
}

.mention-check {
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
}

.mention-check.on {
  color: var(--color-accent);
}

.mention-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.mention-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.mention-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* —— Fontes do grounding (só URLs reais vindas do backend) —— */
.research-sources {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
}

.research-sources-title {
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.research-sources-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.research-sources-list a {
  color: var(--color-accent);
  text-decoration: none;
  word-break: break-all;
}

.research-sources-list a:hover {
  text-decoration: underline;
}

/* —— Collapsed sidebar: hide the text-only blocks —— */
.layout.sidebar-collapsed .sidebar-advanced,
.layout.sidebar-collapsed .conv-period-label {
  display: none !important;
}

/* —— Retire the hardcoded old-teal rgba values so every
       component follows the new accent tokens —— */
.btn-new {
  padding: 5px 12px;
  height: 32px;
  font-size: 0.875rem;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.13), rgba(16, 185, 129, 0.06));
}

.btn-new:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.55);
}

#search-input:focus,
.dialog-input:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.conv-item.active {
  border-color: rgba(16, 185, 129, 0.22);
}

.main {
  background: radial-gradient(120% 55% at 50% -8%, rgba(16, 185, 129, 0.06), transparent 62%), var(--color-bg);
}

.ai-core {
  box-shadow: 0 0 44px var(--gradient-brand-glow), inset 0 0 0 1px rgba(16, 185, 129, 0.18);
}

.msg-edit-input:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.input-area {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.97) 38%);
}

/* O composer permanece visível na área de chat. */
.main .input-area {
  display: block !important;
  visibility: visible !important;
}

/* —— Layout flex full-height (estilo ChatGPT) ——
   Hierarquia: .layout (100dvh, overflow hidden) →
   .main (flex column, overflow hidden) →
   #chat-scroll (flex: 1, rolagem interna) →
   .input-area (flex-shrink: 0, ancorado no fundo).
   O min-height: 0 nos itens flex aninhados é o
   hardening que impede o conteúdo de empurrar o
   composer para fora da viewport; .main recebe
   overflow: hidden como defesa absoluta contra
   qualquer filho estourar o container.
   Obs.: o spec genérico pedia height: 100vh em .main,
   mas .main já é flex: 1 dentro de .layout (100dvh) —
   a abordagem flex respeita melhor a altura dinâmica
   do viewport mobile. */
.main {
  overflow: hidden;
  min-height: 0;
}

#chat-scroll {
  min-height: 0;
}

/* Composer ancorado: nunca comprimido (flex-shrink: 0
   em main.css) e sempre acima do conteúdo rolado.
   width: 100% e box-sizing: border-box já vêm do
   reset global (*) e do comportamento block do
   footer. O spec pedia max-width: 800px +
   background transparent, mas aqui a largura da
   coluna é centralizada por .chat-inner/--composer-w
   e o gradiente de fade é parte do design system —
   trocá-los regrediria o visual responsivo. */
.input-area {
  position: relative;
  z-index: 10;
}

.input-box:focus-within {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.07), var(--elevation-2);
}

#btn-send.ready {
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.28);
}

.model-picker.open {
  border-color: rgba(16, 185, 129, 0.5);
}

.model-trigger-dot {
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.75);
}

.model-option.active {
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.26);
}

.model-option.active:hover {
  background: rgba(16, 185, 129, 0.14);
}

.image-prompt-panel:focus-within {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.07), var(--elevation-2);
}

.image-aspect-picker.open .image-aspect-trigger {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.07);
}

.image-aspect-option[aria-selected="true"],
.image-count-option[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.26);
}

.image-aspect-option[aria-selected="true"]:hover,
.image-aspect-option[aria-selected="true"].active {
  background: rgba(16, 185, 129, 0.14);
}

.image-count-option + .image-count-option[aria-pressed="true"] {
  box-shadow: inset 1px 0 0 rgba(16, 185, 129, 0.26);
}

.image-generate:hover:not(:disabled) {
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.26);
}

.image-result {
  background: radial-gradient(70% 110% at 50% -10%, rgba(16, 185, 129, 0.05), transparent 62%);
}

/* —— Active chat header (topo do painel de chat) ——
   Header em fluxo: título à esquerda, ações à direita
   (margin-left: auto). Substitui o posicionamento
   absoluto anterior (top: 16px; right: 60px). */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  width: 100%;
  min-height: 52px;
  box-sizing: border-box;
}

.chat-header-title {
  min-width: 0;
}

/* position: relative ancora o dropdown (top: calc(100% + 6px))
   neste container; z-index: 100 preserva a ordem de pilha
   anterior sobre o conteúdo do chat e o model picker. */
.chat-header-actions {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* O toggle de chat temporário mora no header em fluxo:
   anula o position: absolute de main.css. */
.chat-header-actions .btn-temp {
  position: static;
}

#active-chat-menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--color-text, #e0e0e0);
  cursor: pointer;
  transition: background 0.15s;
}

#active-chat-menu-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

#active-chat-menu-btn:disabled { opacity: 0.32; cursor: default; }

.chat-header-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 208px;
  padding: var(--space-1);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-medium);
  background: var(--color-overlay);
  box-shadow: var(--elevation-3);
}

.chat-header-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 7px var(--space-3);
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.82rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s;
}
.chat-header-menu-item:hover { background: var(--color-surface-hover); }
.chat-header-menu-item[data-action="delete"] { color: var(--color-danger); }
.chat-header-menu-item[data-action="delete"]:hover { background: var(--color-danger-soft); }

/* Google Sheets (Workspace): status de conexão e hints do modal. */
.sheets-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  background: var(--color-surface-translucent);
}
.sheets-status-on {
  color: var(--color-accent);
  border-color: var(--color-accent-line);
}
.sheets-status-off {
  color: var(--color-text-muted);
}
.sheets-hint {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.sheet-item .sheet-item-meta {
  min-height: 1em;
}


input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 1.1em; height: 1.1em;
  border-radius: 4px;
}

/* Painel de andamento da IA: etapas observáveis com explicações legíveis. */
.thinking-trace {
  margin: 1px 0 14px;
  max-width: min(100%, 46rem);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}
.thinking-trace[hidden] { display: none; }
.thinking-trace-summary {
  display: inline-flex;
  min-height: 26px;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 4px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.thinking-trace-summary::-webkit-details-marker { display: none; }
.thinking-trace-summary::marker { content: ""; }
.thinking-trace-summary:hover,
.thinking-trace-summary:focus-visible {
  color: var(--color-text-secondary);
  background: var(--color-surface-translucent);
  border-color: var(--color-border);
}
.thinking-trace-summary:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.thinking-trace-arrow {
  display: inline-block;
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin: -3px 1px 0 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.72;
  transform: rotate(45deg);
  transition: transform 150ms ease, opacity 150ms ease;
}
.thinking-trace[open] .thinking-trace-arrow {
  margin-top: 4px;
  transform: rotate(225deg);
}
.thinking-trace-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 550;
  letter-spacing: 0.005em;
}
.thinking-trace-title::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-primary, #10b981);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.09);
}
.exchange.assistant[data-thinking-finished="true"] .thinking-trace-title::before {
  background: var(--color-text-faint);
  box-shadow: none;
}
.thinking-trace-duration {
  color: var(--color-text-faint);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.thinking-trace-note {
  margin: 1px 0 7px 20px;
  max-width: 42rem;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
}
/* Mensagens de andamento escritas pelo modelo, intercaladas na linha do tempo. */
.thinking-progress-update {
  display: block;
  min-width: 0;
  margin: 2px 0 8px 14px;
  padding: 5px 10px 8px 0;
  color: var(--color-text);
  font-size: 0.9rem;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.thinking-trace-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 2px 10px;
  padding: 3px 0 3px 0;
  list-style: none;
  border-left: 1px solid var(--color-border-strong);
}
.thinking-trace-step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  min-height: 25px;
  padding: 3px 0 5px;
  color: var(--color-text-muted);
}
.thinking-trace-icon {
  display: inline-flex;
  box-sizing: border-box;
  width: 20px;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin: 1px 0 0 -10px;
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text-faint);
  transition: color 140ms ease, background 140ms ease;
}
.thinking-trace-step[data-state="current"] .thinking-trace-icon {
  color: var(--accent-primary, #10b981);
  background: rgba(16, 185, 129, 0.09);
}
.thinking-trace-step[data-state="current"] .thinking-trace-text {
  color: var(--color-text-secondary);
  font-weight: 500;
}
.thinking-trace-step[data-state="done"] .thinking-trace-icon {
  color: var(--color-text-faint);
  background: transparent;
}
.thinking-trace-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 1px 0 2px;
}
.thinking-trace-text {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.thinking-trace-description {
  display: block;
  max-width: 43rem;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.thinking-trace-step[data-state="current"] .thinking-trace-description {
  color: var(--color-text-secondary);
}
.thinking-trace-step[data-state="done"] .thinking-trace-description {
  color: var(--color-text-faint);
}
@media (hover: hover) {
  .thinking-trace-step:hover .thinking-trace-text { color: var(--color-text-secondary); }
}
@media (max-width: 520px) {
  .thinking-trace-steps { margin-left: 8px; }
  .thinking-trace-step { gap: 7px; }
  .thinking-trace-summary { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-trace-summary,
  .thinking-trace-arrow,
  .thinking-trace-icon { transition: none; }
}


/* Estados da linha do tempo: atividade atual em destaque, etapas concluídas discretas. */
.thinking-trace-title::before {
  flex: 0 0 5px;
  transition: background 160ms ease, box-shadow 160ms ease;
}
.exchange.assistant:not([data-thinking-finished="true"]) .thinking-trace-title::before {
  animation: thinkingTracePulse 1.8s ease-in-out infinite;
}
.thinking-trace-step[data-state="current"] .thinking-trace-icon {
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.10);
  color: var(--accent-primary, #10b981);
}
.thinking-trace-step[data-state="current"] .thinking-trace-icon svg {
  filter: drop-shadow(0 0 2px rgba(16, 185, 129, 0.14));
}
.thinking-trace-step[data-state="done"] {
  color: var(--color-text-faint);
}
.thinking-trace-step[data-state="done"] .thinking-trace-icon {
  background: transparent;
  color: var(--color-text-faint);
  opacity: 0.78;
}
.thinking-trace-step[data-state="done"] .thinking-trace-text {
  font-weight: 400;
}
@keyframes thinkingTracePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08); }
  50% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.02); }
}
@media (prefers-reduced-motion: reduce) {
  .exchange.assistant:not([data-thinking-finished="true"]) .thinking-trace-title::before {
    animation: none;
  }
}


/* Privacy & Security controls inside the unified Settings dialog. */
.settings-section-title { margin: 0 0 12px; font-size: 1rem; }
.settings-control-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 12px 0; padding: 14px;
  border: 1px solid var(--color-border); border-radius: 10px;
  background: rgba(255,255,255,0.025);
}
.settings-control-copy { display: flex; flex: 1 1 auto; flex-direction: column; gap: 5px; min-width: 0; }
.settings-control-copy strong { color: var(--color-text); font-size: 0.88rem; }
.settings-control-copy p, .settings-footnote, .settings-security-state p {
  margin: 0; color: var(--color-text-muted); font-size: 0.76rem; line-height: 1.5;
}
.dialog-btn.danger { border-color: rgba(232,91,91,0.35); color: var(--color-danger); }
.dialog-btn.danger:hover:not(:disabled) { background: var(--color-danger-soft); }
.settings-control-card-danger { border-color: rgba(232,91,91,0.22); }
.settings-security-state {
  display: flex; align-items: flex-start; gap: 12px; margin: 12px 0 18px;
  padding: 13px; border: 1px solid var(--color-accent-line);
  border-radius: 10px; background: var(--color-accent-soft);
}
.settings-security-state > div { display: flex; flex-direction: column; gap: 4px; }
.settings-security-state strong { color: var(--color-text); font-size: 0.86rem; }
.settings-security-icon {
  display: grid; flex: 0 0 24px; width: 24px; height: 24px; place-items: center;
  border-radius: 50%; background: rgba(34,197,94,0.14); color: #4ade80; font-weight: 700;
}
.settings-footnote { margin-top: 12px; }
@media (max-width: 620px) {
  .settings-control-card { align-items: stretch; flex-direction: column; }
  .settings-control-card .dialog-btn { width: 100%; }
}


/* Training dataset export actions */
.training-export-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}
#training-export-format {
  display: block;
  width: min(100%, 340px);
  margin-top: 7px;
}
@media (max-width: 620px) {
  .training-export-actions { width: 100%; }
  .training-export-actions .dialog-btn { flex: 1 1 0; }
}


/* Adult eligibility controls shown only to allowlisted training administrators. */
.training-eligibility-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.training-eligibility-lookup {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.training-eligibility-lookup label {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.training-eligibility-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.training-eligibility-input-row .dialog-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
.training-eligibility-confirm {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}
.training-eligibility-confirm input {
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--color-accent);
}
.training-eligibility-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.training-eligibility-actions .dialog-btn {
  flex: 1 1 210px;
}
@media (max-width: 620px) {
  .training-eligibility-input-row,
  .training-eligibility-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .training-eligibility-input-row .dialog-btn,
  .training-eligibility-actions .dialog-btn {
    width: 100%;
  }
}


/* ============================================================
   FLEXNEUR — Aurora workspace refresh
   Polish pass: clearer hierarchy, calmer surfaces and a more
   deliberate message/composer rhythm. Keeps existing markup.
   ============================================================ */
:root {
  --sidebar-w: 300px;
  --max-w: 50rem;
  --composer-w: 54rem;
  --bg-canvas: #070e0c;
  --bg-surface: #101a16;
  --bg-card-active: #14261e;
  --border-subtle: rgba(112, 163, 139, 0.15);
  --accent-primary: #18c994;
  --accent-mint: #55e3bd;
  --text-main: #effaf5;
  --text-muted: #91a99d;
}

/* The sidebar should feel like a separate workspace rail, not another panel. */
.sidebar {
  background:
    radial-gradient(120% 38% at 0% 0%, rgba(20, 201, 148, 0.075), transparent 68%),
    linear-gradient(180deg, #000000 0%, #000000 100%);
  border-right-color: rgba(130, 178, 155, 0.14);
}

.sidebar-header {
  padding: 17px 16px 15px;
  border-bottom: 1px solid rgba(130, 178, 155, 0.11);
}

.brand-mark img {
  filter: drop-shadow(0 0 10px rgba(24, 201, 148, 0.22));
}

.brand-name {
  letter-spacing: 0.075em;
}

.brand-status {
  letter-spacing: 0.12em;
  font-size: 0.65rem;
}

.sidebar-top {
  padding: 13px 14px 9px;
}

.btn-new {
  min-height: 42px;
  height: 42px;
  padding-inline: 14px;
  border-radius: 12px;
  border-color: rgba(24, 201, 148, 0.34);
  background: linear-gradient(135deg, rgba(24, 201, 148, 0.17), rgba(24, 201, 148, 0.055));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  font-size: 0.9rem;
}

.btn-new:hover {
  border-color: rgba(85, 227, 189, 0.58);
  background: linear-gradient(135deg, rgba(24, 201, 148, 0.23), rgba(24, 201, 148, 0.085));
  box-shadow: 0 7px 22px rgba(0, 0, 0, 0.18);
}

.sidebar-section-title,
.sidebar-label {
  color: #8fa99c;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.sidebar-section-title {
  padding: 12px 14px 7px;
}

.sidebar-nav-list {
  gap: 4px;
  padding-inline: 9px;
}

.sidebar-nav-btn {
  min-height: 40px;
  padding-inline: 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
  color: #dcebe4;
  font-size: 0.9rem;
  font-weight: 550;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.sidebar-nav-btn:hover {
  transform: translateX(2px);
  border-color: rgba(85, 227, 189, 0.16);
  background: rgba(24, 201, 148, 0.075);
}

.sidebar-nav-btn[aria-current="page"],
.sidebar-nav-btn[aria-current="true"] {
  border-color: rgba(24, 201, 148, 0.22);
  background: rgba(24, 201, 148, 0.11);
  color: #f2fff9;
}

.sidebar-label {
  padding: 16px 14px 8px;
}

.sidebar-search {
  padding-inline: 10px;
  margin-bottom: 5px;
}

#search-input {
  min-height: 42px;
  height: 42px;
  border-radius: 12px;
  border-color: rgba(130, 178, 155, 0.16);
  background: rgba(255, 255, 255, 0.027);
  color: var(--text-main);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

#search-input:focus {
  border-color: rgba(24, 201, 148, 0.52);
  background: rgba(24, 201, 148, 0.045);
  box-shadow: 0 0 0 3px rgba(24, 201, 148, 0.085);
}

.conv-period-label {
  padding: 11px 15px 6px;
  color: #718c7f;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
}

.conv-period .conv-list {
  padding-inline: 9px;
}

.conv-item {
  position: relative;
  min-height: 48px;
  padding: 8px 10px 8px 13px;
  border-radius: 11px;
}

.conv-item:hover {
  border-color: rgba(130, 178, 155, 0.13);
  background: rgba(255, 255, 255, 0.035);
}

.conv-item.active {
  border-color: rgba(24, 201, 148, 0.22);
  background: linear-gradient(105deg, rgba(24, 201, 148, 0.12), rgba(24, 201, 148, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.conv-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--accent-primary);
  box-shadow: 0 0 12px rgba(24, 201, 148, 0.45);
}

.conv-title {
  font-size: 0.86rem;
  font-weight: 550;
}

.conv-preview {
  margin-top: 3px;
  color: #8ea69a;
  font-size: 0.7rem;
}

.sidebar-account-row {
  margin: 10px 12px 13px;
  padding: 7px 8px;
  border-color: rgba(130, 178, 155, 0.16);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.96));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.sidebar-account-row #auth-avatar {
  box-shadow: 0 0 0 2px rgba(24, 201, 148, 0.17);
}

.sidebar-account-row #auth-name {
  font-size: 0.86rem;
  font-weight: 600;
}

/* Main canvas: quiet depth, without competing with the conversation. */
.main {
  background:
    radial-gradient(65% 42% at 50% -6%, rgba(24, 201, 148, 0.105), transparent 76%),
    radial-gradient(48% 52% at 100% 100%, rgba(16, 100, 73, 0.045), transparent 78%),
    #070e0c;
}

.chat-header {
  min-height: 58px;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(130, 178, 155, 0.075);
  background: rgba(7, 14, 12, 0.36);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#active-chat-menu-btn {
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #a9beb3;
}

#active-chat-menu-btn:hover {
  border-color: rgba(130, 178, 155, 0.15);
  background: rgba(255, 255, 255, 0.045);
  color: #f1fbf5;
}

.chat-inner {
  max-width: calc(var(--max-w) + var(--space-12));
  padding: clamp(24px, 3.1vh, 38px) clamp(22px, 3.4vw, 42px) 30px;
}

.exchange {
  padding: 18px 0;
}

.exchange.assistant .row {
  gap: 14px;
}

.ai-dot {
  width: 32px;
  height: 32px;
  margin-top: 3px;
  border: 1px solid rgba(85, 227, 189, 0.22);
  background: radial-gradient(circle at 34% 28%, #6cf1cb, #16b985 52%, #08734f 100%);
  box-shadow: 0 0 0 5px rgba(24, 201, 148, 0.055), 0 0 22px rgba(24, 201, 148, 0.19);
}

.exchange.assistant .content {
  color: #eaf6f0;
  font-size: 0.98rem;
  line-height: 1.78;
  letter-spacing: 0.002em;
}

.exchange.assistant .ai-body {
  max-width: 100%;
}

.exchange.assistant .content p + p,
.exchange.assistant .content ul,
.exchange.assistant .content ol {
  margin-top: 0.78em;
}

.model-used {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
  padding: 4px 9px;
  border: 1px solid rgba(130, 178, 155, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #91a99d;
  font-size: 0.7rem;
}

.exchange.assistant .assistant-msg-meta {
  margin-top: 8px;
}

.exchange.assistant .assistant-msg-actions {
  gap: 6px;
}

.exchange.assistant .speak-btn,
.exchange.assistant .assistant-msg-actions button {
  min-height: 31px;
  padding: 5px 9px;
  border-radius: 9px;
  color: #91a99d;
  transition: background 140ms ease, color 140ms ease;
}

.exchange.assistant .speak-btn:hover,
.exchange.assistant .assistant-msg-actions button:hover {
  background: rgba(24, 201, 148, 0.075);
  color: #dff9ed;
}

.exchange.user .user-block {
  max-width: 78%;
  gap: 6px;
}

.exchange.user .content {
  padding: 12px 17px;
  border: 1px solid rgba(85, 227, 189, 0.16);
  border-radius: 20px 20px 6px 20px;
  background: linear-gradient(145deg, rgba(24, 67, 49, 0.72), rgba(17, 39, 29, 0.88));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  color: #f0fbf5;
  font-size: 0.96rem;
  line-height: 1.68;
}

.msg-time {
  color: #718c7f;
  font-size: 0.68rem;
}

.msg-action {
  border-radius: 8px;
}

.msg-action:hover {
  background: rgba(24, 201, 148, 0.08);
}

/* Prompt suggestions become quiet utility chips above the composer. */
.prompts {
  gap: 8px;
  margin-bottom: 12px;
}

.prompt {
  min-height: 31px;
  padding: 5px 11px;
  border: 1px solid rgba(130, 178, 155, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.027);
  color: #a9beb3;
  font-size: 0.75rem;
  font-weight: 550;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}

.prompt:hover {
  transform: translateY(-1px);
  border-color: rgba(24, 201, 148, 0.3);
  background: rgba(24, 201, 148, 0.075);
  color: #e8fbf2;
}

/* Composer: more legible controls, larger target areas and a stable focus state. */
.input-area {
  padding: 14px 26px 21px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.97) 34%);
}

.input-box {
  min-height: 74px;
  padding: 10px 12px;
  gap: 9px;
  border: 1px solid rgba(85, 227, 189, 0.27);
  border-radius: 23px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.98), rgba(0, 0, 0, 0.98));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.input-box:hover {
  border-color: rgba(85, 227, 189, 0.38);
}

.input-box:focus-within {
  border-color: rgba(85, 227, 189, 0.68);
  background: linear-gradient(135deg, #000000, #000000);
  box-shadow: 0 0 0 4px rgba(24, 201, 148, 0.085), 0 14px 38px rgba(0, 0, 0, 0.28);
}

#btn-attach,
#btn-mic,
#btn-send {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
}

#btn-attach {
  border-color: rgba(130, 178, 155, 0.16);
  background: rgba(255, 255, 255, 0.035);
  color: #a9beb3;
}

#btn-attach:hover {
  border-color: rgba(85, 227, 189, 0.36);
  background: rgba(24, 201, 148, 0.09);
  color: #eafff4;
}

#input {
  min-height: 32px;
  height: 32px;
  padding: 5px 7px;
  color: #f0fbf5;
  font-size: 0.96rem;
  line-height: 1.55;
}

#input[data-placeholder]:empty::before {
  color: #81998c;
}

#btn-mic {
  color: #9bb2a5;
}

#btn-mic:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #effaf4;
}

#btn-send {
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  color: #849d90;
}

#btn-send.ready {
  background: linear-gradient(145deg, #33d6a5, #10a979);
  color: #04271b;
  box-shadow: 0 4px 17px rgba(24, 201, 148, 0.27);
}

#btn-send.ready:hover {
  background: linear-gradient(145deg, #62e8be, #1ac18e);
  box-shadow: 0 5px 22px rgba(24, 201, 148, 0.36);
}

#btn-send.stop-mode {
  border-radius: 12px;
}

.model-picker {
  min-height: 36px;
  border-color: rgba(130, 178, 155, 0.16);
  background: rgba(255, 255, 255, 0.035);
}

.model-picker:hover {
  border-color: rgba(85, 227, 189, 0.3);
  background: rgba(24, 201, 148, 0.06);
}

.privacy-warning {
  margin-top: 11px;
  color: #71887d;
  font-size: 0.69rem;
  letter-spacing: 0.005em;
}

.privacy-sep {
  color: #476257;
  margin-inline: 8px;
}

/* Menus and popovers inherit the same quieter surface language. */
.chat-header-dropdown,
.chat-menu,
.model-menu,
.mention-menu {
  border-color: rgba(130, 178, 155, 0.2);
  background: rgba(0, 0, 0, 0.97);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

:where(button, a, input, textarea, [role="button"]):focus-visible {
  outline-color: rgba(85, 227, 189, 0.85);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  :root {
    --max-w: 46rem;
    --composer-w: 50rem;
  }
  .chat-inner {
    padding-inline: 24px;
  }
  .input-area {
    padding-inline: 20px;
  }
}

@media (max-width: 640px) {
  .sidebar-header {
    padding: 15px 14px 13px;
  }
  .chat-header {
    min-height: 52px;
    padding-inline: 14px;
  }
  .chat-inner {
    padding: 18px 15px 18px;
  }
  .exchange {
    padding: 14px 0;
  }
  .exchange.assistant .row {
    gap: 10px;
  }
  .exchange.assistant .content {
    font-size: 0.94rem;
    line-height: 1.72;
  }
  .exchange.assistant .speak-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 9px 12px;
    touch-action: manipulation;
  }
  .exchange.user .user-block {
    max-width: 92%;
  }
  .exchange.user .content {
    padding: 10px 14px;
    border-radius: 17px 17px 5px 17px;
  }
  .prompts {
    display: flex;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 2px 7px;
    scrollbar-width: none;
  }
  .prompts::-webkit-scrollbar {
    display: none;
  }
  .prompt {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .input-area {
    padding: 9px 10px 13px;
  }
  .input-box {
    min-height: 64px;
    padding: 8px;
    gap: 6px;
    border-radius: 19px;
  }
  #btn-attach,
  #btn-mic,
  #btn-send {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }
  #input {
    min-width: 2.5rem;
    font-size: 0.92rem;
  }
  .privacy-warning {
    margin-top: 8px;
    font-size: 0.64rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-nav-btn,
  .btn-new,
  .conv-item,
  .prompt,
  .input-box,
  #btn-attach,
  #btn-mic,
  #btn-send {
    transition: none !important;
  }
}


/* ============================================================
   FLEXNEUR — Rounded surfaces system
   Shared finish for Chat, Tools, Image Studio and Settings.
   Visual-only overrides; no component IDs or behavior changes.
   ============================================================ */

/* Main composer: true capsule with matching rounded end caps. */
.main .input-area .input-box {
  min-height: 76px;
  padding: 10px 13px;
  border-radius: 999px;
  border-color: rgba(85, 227, 189, 0.30);
  background: linear-gradient(120deg, rgba(0, 0, 0, 0.98), rgba(0, 0, 0, 0.98));
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.main .input-area .input-box:hover {
  border-color: rgba(85, 227, 189, 0.44);
}

.main .input-area .input-box:focus-within {
  border-color: rgba(85, 227, 189, 0.72);
  border-radius: 999px;
  box-shadow:
    0 0 0 4px rgba(24, 201, 148, 0.085),
    0 16px 38px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.main .input-area #btn-attach,
.main .input-area #btn-mic,
.main .input-area #btn-send {
  width: 39px;
  height: 39px;
  flex-basis: 39px;
  border-radius: 50%;
}

.main .input-area #btn-attach {
  border-color: rgba(130, 178, 155, 0.17);
  background: rgba(255, 255, 255, 0.04);
}

.main .input-area #btn-send.ready {
  border-radius: 50%;
  background: linear-gradient(145deg, #48dfb3, #12b985);
  box-shadow: 0 4px 17px rgba(24, 201, 148, 0.26);
}

.main .input-area #btn-send.stop-mode {
  border-radius: 50%;
}

.main .input-area .mode-dropdown-trigger,
.main .input-area .model-picker,
.main .input-area .quick-chip {
  border-radius: 999px;
}

.main .input-area .mode-dropdown-trigger {
  min-height: 36px;
  padding-inline: 13px;
  border-color: rgba(130, 178, 155, 0.17);
  background: rgba(255, 255, 255, 0.035);
}

/* Shared rounded treatment for floating dialogs and settings. */
.dialog-overlay {
  background: rgba(2, 8, 6, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dialog {
  border-color: rgba(85, 227, 189, 0.18);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.985), rgba(0, 0, 0, 0.99));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.dialog-input,
.dialog textarea,
.dialog select {
  border-color: rgba(130, 178, 155, 0.19);
  border-radius: 15px;
  background: rgba(4, 13, 9, 0.52);
  color: #effaf5;
}

.dialog-input:focus,
.dialog textarea:focus,
.dialog select:focus {
  border-color: rgba(85, 227, 189, 0.58);
  box-shadow: 0 0 0 4px rgba(24, 201, 148, 0.075);
}

.dialog-btn {
  min-height: 36px;
  padding: 7px 16px;
  border-radius: 999px;
  border-color: rgba(130, 178, 155, 0.2);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.dialog-btn:hover:not(:disabled) {
  border-color: rgba(85, 227, 189, 0.30);
  background: rgba(24, 201, 148, 0.075);
  transform: translateY(-1px);
}

.dialog-btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #35d7a7, #10ae7b);
  color: #04271b;
}

.dialog-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #65e9c0, #22c995);
}

.memory-dialog {
  border-radius: 25px;
  border-color: rgba(85, 227, 189, 0.2);
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.99), rgba(0, 0, 0, 0.99));
  box-shadow: 0 26px 76px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.memory-assistant-reply,
.memory-selection-chip,
.memory-empty-icon {
  border-radius: 16px;
}

.memory-ask-row {
  border-color: rgba(85, 227, 189, 0.24);
  background: rgba(4, 13, 9, 0.56);
}

.memory-ask-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

/* Configurações: overlay próprio, fixo e centralizado no viewport inteiro.
   A sidebar permanece abaixo da camada escura e não participa do cálculo. */
#settings-modal.active,
#settings-modal:not([hidden]) {
  inset: 0;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 24px);
}

#settings-modal .settings-dialog {
  width: min(860px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  height: min(780px, calc(100dvh - 48px));
  min-height: 0;
  max-height: calc(100dvh - 48px);
  border: 1px solid var(--color-border-strong);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(14, 26, 21, 0.98), rgba(7, 13, 10, 0.99));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.50), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

#settings-modal .settings-container {
  height: 100%;
  min-height: 0;
}

#settings-modal .settings-nav {
  flex-basis: 176px;
  gap: 3px;
  padding: 16px 10px;
  border-right-color: var(--color-border);
  background: rgba(255, 255, 255, 0.01);
}

#settings-modal .settings-nav-title {
  padding: 0 10px 12px;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#settings-modal .settings-nav-section-label {
  margin: 14px 10px 4px;
  color: var(--color-text-faint);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#settings-modal .settings-nav-btn {
  min-height: 34px;
  padding: 6px 10px;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

#settings-modal .settings-nav-btn.settings-nav-sub {
  min-height: 30px;
  padding-left: 27px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

#settings-modal .settings-nav-btn:hover {
  border-color: var(--color-border);
  background: var(--color-surface-translucent);
  color: var(--color-text);
}

#settings-modal .settings-nav-btn.active {
  border-color: var(--color-accent-line);
  background: var(--color-accent-soft);
  color: var(--color-text);
  box-shadow: none;
}

#settings-modal .settings-sign-out {
  color: var(--color-danger);
}

#settings-modal .settings-sign-out:hover {
  border-color: rgba(232, 91, 91, 0.2);
  background: rgba(232, 91, 91, 0.085);
  color: var(--color-danger);
}

#settings-modal .settings-content {
  min-height: 0;
  max-height: none;
  padding: 22px 24px;
  background: transparent;
}

#settings-modal .settings-content-heading {
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

#settings-modal .settings-content-heading .dialog-title {
  margin-bottom: 3px;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

#settings-modal .settings-content-heading .dialog-text {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

#settings-modal .memory-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border-strong);
  border-radius: 9px;
  background: var(--color-surface-translucent);
  color: var(--color-text-secondary);
}

#settings-modal .memory-close:hover {
  border-color: var(--color-accent-line);
  background: var(--color-accent-soft);
  color: var(--color-text);
}

#settings-modal .settings-section-title,
#settings-modal .dialog-title {
  color: var(--color-text);
}

#settings-modal .settings-control-card,
#settings-modal .settings-security-state,
#settings-modal .personalization-row,
#settings-modal .memory-assistant-reply {
  border-color: var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-translucent);
  box-shadow: none;
}

#settings-modal .settings-control-card {
  padding: 14px 16px;
}

#settings-modal .settings-control-copy strong,
#settings-modal .personalization-row-title {
  color: var(--color-text);
  font-size: 0.86rem;
}

#settings-modal .settings-control-copy p,
#settings-modal .settings-footnote,
#settings-modal .settings-security-state p,
#settings-modal .personalization-row-subtitle {
  color: var(--color-text-muted);
  line-height: 1.55;
}

#settings-modal .personalization-textarea,
#settings-modal .settings-content .dialog-input,
#settings-modal .settings-content textarea:not(.memory-ask-input) {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-translucent);
  color: var(--color-text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

#settings-modal .personalization-textarea:focus,
#settings-modal .settings-content .dialog-input:focus,
#settings-modal .settings-content textarea:not(.memory-ask-input):focus {
  border-color: rgba(85, 227, 189, 0.58);
  background: rgba(8, 25, 16, 0.72);
  box-shadow: 0 0 0 4px rgba(24, 201, 148, 0.075);
}

#settings-modal .personalization-row {
  padding: 14px 16px;
}

#settings-modal .toggle-switch {
  width: 42px;
  height: 24px;
  border-radius: 999px;
}

#settings-modal .toggle-switch .toggle-knob {
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
}

#settings-modal .toggle-switch.on .toggle-knob {
  transform: translateX(18px);
}

/* Dedicated image studio follows the same panel and form language. */
.image-view {
  background:
    radial-gradient(70% 42% at 50% 0%, rgba(24, 201, 148, 0.07), transparent 74%),
    #070e0c;
}

.image-back {
  min-height: 38px;
  padding-inline: 16px;
  border-radius: 999px;
  border-color: rgba(130, 178, 155, 0.18);
  background: rgba(255, 255, 255, 0.03);
}

.image-card {
  max-width: 74rem;
}

.image-prompt-panel,
.image-controls,
.image-result {
  border-color: rgba(85, 227, 189, 0.18);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.97));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.19), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.image-prompt-panel:focus-within {
  border-color: rgba(85, 227, 189, 0.58);
  box-shadow: 0 0 0 4px rgba(24, 201, 148, 0.075), 0 14px 40px rgba(0, 0, 0, 0.19);
}

#image-prompt,
#image-negative-prompt {
  color: #effaf5;
}

.image-controls {
  padding: 18px;
}

.image-result {
  overflow: hidden;
}

@media (max-width: 900px) {
  #settings-modal .settings-dialog {
    width: min(780px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
  }
}

@media (max-width: 620px) {
  .main .input-area .input-box {
    min-height: 64px;
    padding: 7px 9px;
    border-radius: 999px;
  }

  .main .input-area .input-box:focus-within {
    border-radius: 999px;
  }

  #settings-modal .settings-dialog {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 20px);
    border-radius: 16px;
  }

  #settings-modal .settings-container {
    min-height: 0;
  }

  #settings-modal .settings-nav {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  #settings-modal .settings-nav-title {
    flex: 0 0 auto;
    width: auto;
    padding: 0 6px 5px;
  }

  #settings-modal .settings-nav-section-label {
    display: none;
  }

  #settings-modal .settings-nav-btn,
  #settings-modal .settings-nav-btn.settings-nav-sub {
    flex: 0 0 auto;
    width: auto;
    justify-content: center;
    min-height: 36px;
    padding-inline: 9px;
    font-size: 0.78rem;
  }

  #settings-modal .settings-content {
    min-height: 0;
    max-height: none;
    padding: 18px 16px;
  }


}

@media (prefers-reduced-motion: reduce) {
  .dialog-btn,
  #settings-modal .settings-nav-btn {
    transition: none !important;
  }
}


/* Experiência simples: prioriza o primeiro passo e deixa as ações fáceis de reconhecer. */
.chat-inner:has(#welcome) {
  max-width: 72rem;
  padding: clamp(28px, 5vh, 52px) clamp(18px, 3vw, 40px) 28px;
}

.ai-presence {
  width: 100%;
  max-width: 58rem;
  margin-inline: auto;
  padding-top: 0;
}

.ai-core {
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  animation: none;
}

.ai-presence h1 {
  margin-bottom: 10px;
  font-size: clamp(1.85rem, 4vw, 2.4rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.ai-presence p {
  max-width: 34rem;
  font-size: 0.96rem;
  line-height: 1.6;
}

.prompts {
  width: 100%;
  max-width: 54rem;
  margin: clamp(24px, 4vh, 36px) auto 0;
  gap: 14px;
}

.prompt {
  min-height: 116px;
  padding: 20px;
  gap: 18px;
  border-color: rgba(236, 253, 245, 0.11);
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(236, 253, 245, 0.045), rgba(236, 253, 245, 0.018));
  color: var(--color-text);
  font-size: 0.94rem;
}

.prompt-icon {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 12px;
  background: var(--color-accent-soft);
}

.prompt-icon svg {
  width: 21px;
  height: 21px;
}

.prompt-text {
  font-weight: 650;
  line-height: 1.4;
}

.prompt:hover {
  border-color: var(--color-accent-line);
  background: linear-gradient(155deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.045));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}

.main .input-area {
  padding: 14px clamp(16px, 3vw, 32px) 18px;
}

.main .input-box {
  min-height: 72px;
  border-radius: 20px;
}

.main #input {
  font-size: 1rem;
  line-height: 1.55;
}

.main .privacy-warning {
  margin-top: 10px;
  font-size: 0.74rem;
  line-height: 1.5;
}

@media (max-width: 820px) {
  .chat-inner:has(#welcome) {
    padding: 28px 20px 20px;
  }

  .prompts {
    grid-template-columns: 1fr;
    max-width: 34rem;
  }

  .prompt {
    min-height: 76px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .chat-inner:has(#welcome) {
    padding: 24px 16px 14px;
  }

  .ai-core {
    width: 46px;
    height: 46px;
    margin-bottom: 16px;
  }

  .ai-presence h1 {
    font-size: clamp(1.7rem, 7vw, 2rem);
  }

  .prompts {
    margin-top: 22px;
    gap: 10px;
  }

  .prompt {
    min-height: 68px;
    padding: 14px;
    border-radius: 15px;
  }

  .main .input-area {
    padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .main .input-box {
    min-height: 66px;
    border-radius: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-core { animation: none; }
  .prompt { transition: none; }
}
