/* ═══════════════════════════════════════════════════════════════════════════
   DOSIS Design System — Clean & Professional
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ─── Base Palette ─── */
  --gray-950: #0a0a0f;
  --gray-900: #12121a;
  --gray-850: #1a1a24;
  --gray-800: #22222e;
  --gray-700: #2e2e3e;
  --gray-600: #3d3d50;
  --gray-500: #5a5a72;
  --gray-450: #7c7c94;
  --gray-400: #8888a0;
  --gray-300: #a8a8be;
  --gray-200: #c8c8d8;
  --gray-100: #e4e4ec;
  --gray-50: #f2f2f6;

  /* ─── Brand / Accent ─── */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-200: #a7f3d0;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-900: #064e3b;

  /* ─── Semantic ─── */
  --bg-app: var(--gray-950);
  --bg-primary: var(--gray-900);
  --bg-secondary: var(--gray-850);
  --bg-elevated: var(--gray-800);
  --bg-hover: var(--gray-700);

  --accent: var(--emerald-500);
  --accent-hover: var(--emerald-400);
  --accent-subtle: rgba(16, 185, 129, 0.1);
  --accent-muted: rgba(16, 185, 129, 0.06);

  --text-primary: var(--gray-100);
  --text-secondary: var(--gray-400);
  /* gray-450 (não gray-500): garante ≥4.5:1 em textos pequenos como timestamps */
  --text-tertiary: var(--gray-450);
  /* ink escuro sobre o accent: branco no emerald-500 dá só 2.54:1 (reprova WCAG);
     texto escuro no mesmo verde dá ~7.5:1 e mantém o verde vibrante da marca */
  --text-on-accent: var(--gray-950);

  --border: var(--gray-700);
  --border-subtle: var(--gray-800);
  --border-active: var(--emerald-500);

  --danger: #ef4444;
  --danger-soft: #f87171;                 /* red-400: melhor legibilidade em texto/borda no dark */
  --danger-subtle: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.1);
  --success: #10b981;
  --success-subtle: rgba(16, 185, 129, 0.1);
  --violet: #8b5cf6;                       /* conquistas/badges de aprendizado */
  --violet-soft: #a78bfa;
  --violet-subtle: rgba(139, 92, 246, 0.1);
  --info: #3b82f6;
  --info-soft: #60a5fa;
  --info-subtle: rgba(59, 130, 246, 0.1);
  --warning-soft: #fbbf24;
  /* aliases -500/-400 usados pelos painéis de dashboard (mk-*) e diagnósticos */
  --red-500: var(--danger);
  --amber-500: var(--warning);
  --blue-500: var(--info);
  --green-500: #22c55e;

  /* ─── Geometry ─── */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ─── Shadows ─── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);

  /* ─── Transitions ─── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-normal: 250ms var(--ease-out);
  --transition-slow: 350ms var(--ease-out);

  /* ─── Tokens conscientes de tema ───────────────────────────────────────────
     Existem para o tema claro poder invertê-los sem tocar em componente.
     NO DARK são os valores originais que estavam espalhados pelo arquivo. */

  /* Superfície de card (usada pelo botão de áudio); no dark = elevado */
  --bg-card: var(--bg-elevated);

  /* Borda mais forte (hover de botões/badges e polegar da scrollbar) */
  --border-strong: var(--border-strong);

  /* Scrim de modais/overlays (fundo escurecido atrás de diálogos) */
  --scrim: rgba(0, 0, 0, 0.72);

  /* Realces "clarear sobre o fundo": code inline, cabeçalho de tabela, etc.
     No dark clareiam; no claro precisam escurecer (senão somem). */
  --overlay-raise: rgba(255, 255, 255, 0.06);
  --code-inline-bg: rgba(255, 255, 255, 0.08);
  --code-block-bg: rgba(0, 0, 0, 0.3);

  /* Cores dos modos de chat (indicador do seletor "Novo chat") */
  --mode-private: #a78bfa;
  --mode-public: #38bdf8;
  --mode-instruction: #fb923c;
  --mode-pop: #f472b6;
  --mode-search: #facc15;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TEMA CLARO — redefine apenas a camada semântica. Componentes não mudam.
   Estratégia: não invertemos a escala crua (--gray-*, --emerald-*); apenas
   reapontamos os tokens semânticos. Off-white frio (não branco puro, não cream).
   Elevação inverte: no claro, "elevado" = branco puro sobre o app cinza-claro.
   ═══════════════════════════════════════════════════════════════════════════ */

:root[data-theme='light'] {
  /* ─── Superfícies ─── */
  --bg-app: #eef0f3;          /* neutro frio, alinhado ao cinza azulado da marca */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f6f8;
  --bg-elevated: #ffffff;
  --bg-hover: #e9ebef;
  --bg-card: #ffffff;

  /* ─── Accent (emerald-700: como TEXTO em fundo claro passa AA, ~4.8:1) ─── */
  --accent: #047857;
  --accent-hover: #065f46;    /* hover escurece (no claro) */
  --accent-subtle: rgba(5, 150, 105, 0.12);
  --accent-muted: rgba(5, 150, 105, 0.08);

  /* ─── Texto (contraste verificado ≥4.5:1 sobre branco E sobre o off-white) ─── */
  --text-primary: #1a1a24;
  --text-secondary: #55556a;
  --text-tertiary: #5f5f72;
  /* No claro o accent é escuro → texto do botão é claro (a lógica inverte
     em relação ao dark, onde o accent é vibrante e o texto é escuro). */
  --text-on-accent: #ffffff;

  /* ─── Bordas ─── */
  --border: #d9dce1;
  --border-subtle: #e6e8ec;
  --border-active: #047857;
  --border-strong: #c2c6cf;

  /* ─── Semânticas (variantes -600/-700: no claro precisam escurecer p/ texto) ─── */
  --danger: #dc2626;
  --danger-soft: #dc2626;
  --danger-subtle: rgba(220, 38, 38, 0.1);
  --warning: #b45309;
  --warning-soft: #b45309;
  --warning-subtle: rgba(180, 83, 9, 0.1);
  --success: #047857;
  --success-subtle: rgba(5, 150, 105, 0.1);
  --violet: #7c3aed;
  --violet-soft: #7c3aed;
  --violet-subtle: rgba(124, 58, 237, 0.1);
  --info: #2563eb;
  --info-soft: #2563eb;
  --info-subtle: rgba(37, 99, 235, 0.1);

  /* aliases usados pelos painéis de dashboard */
  --red-500: #dc2626;
  --amber-500: #b45309;
  --blue-500: #2563eb;
  --green-500: #16a34a;

  /* ─── Sombras: suaves e com tinta fria (preto forte "suja" no claro) ─── */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.10);
  --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.18);

  /* ─── Tokens conscientes de tema (invertidos) ─── */
  --scrim: rgba(16, 24, 40, 0.35);
  --overlay-raise: rgba(16, 24, 40, 0.05);
  --code-inline-bg: rgba(16, 24, 40, 0.06);
  --code-block-bg: rgba(16, 24, 40, 0.05);

  /* Modos de chat: -600/-700 p/ legibilidade do indicador no claro */
  --mode-private: #7c3aed;
  --mode-public: #0284c7;
  --mode-instruction: #ea580c;
  --mode-pop: #db2777;
  --mode-search: #ca8a04;
}

/* Transição suave ao alternar tema (respeitando reduce-motion mais abaixo) */
html {
  transition: background-color var(--transition-normal);
}

/* ─── Reset & Base ────────────────────────────────────────────────────────── */

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

/* Acessibilidade: respeita "reduzir movimento" do SO — neutraliza transições
   e animações (mantendo um tique de 0.01ms para não quebrar callbacks de onend). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  font-size: 14px;
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ─── Base Elements ───────────────────────────────────────────────────────── */

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.4;
}

button:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input, textarea, select {
  font-family: inherit;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.625rem 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

input::placeholder, textarea::placeholder {
  color: var(--text-tertiary);
}

/* ─── Button Variants ─────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border: 1px solid var(--accent);
  font-weight: 600;
  padding: 0.625rem 1.25rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: transparent;
}

.btn-danger:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-subtle);
  border-color: transparent;
}

.btn-warning {
  color: var(--warning) !important;
  border-color: var(--warning) !important;
}
.btn-warning:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.1);
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.625rem;
}

/* ─── Tags ────────────────────────────────────────────────────────────────── */

.ideas-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  background: var(--accent-subtle);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: var(--emerald-400);
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  margin-right: 0.375rem;
  margin-bottom: 0.25rem;
}

.ideas-list-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.login-root {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg-app);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 2px 2px, var(--border-subtle) 1px, transparent 0);
  background-size: 100% 100%, 32px 32px;
}

.login-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: var(--radius-full);
}

.login-logo {
  margin-bottom: 2.5rem;
  text-align: center;
}

.login-logo h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.2;
}

.login-logo p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-field label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.form-field input {
  width: 100%;
}

.login-error {
  color: var(--danger);
  font-size: 0.8125rem;
  background: var(--danger-subtle);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
}

.login-form .btn-primary {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.main-layout {
  display: grid;
  grid-template-areas:
    "nav header"
    "nav body";
  grid-template-columns: 68px 1fr;
  grid-template-rows: 52px 1fr;
  height: 100%;
  background: var(--bg-app);
}

/* ── Vertical Nav ── */

.main-layout-nav {
  grid-area: nav;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 0.25rem;
  z-index: 50;
}

.nav-brand-vertical {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  writing-mode: horizontal-tb;
  transform: none;
  opacity: 1;
}

.nav-icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1.125rem;
  padding: 0;
}

.nav-icon-btn span {
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

.nav-icon-btn:hover {
  background: var(--accent-muted);
  color: var(--text-primary);
  border-color: transparent;
}

.nav-icon-btn--active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.2);
}

.nav-spacer {
  flex: 1;
}

.nav-icon-btn--logout {
  color: var(--text-tertiary);
  margin-top: auto;
}

.nav-icon-btn--logout:hover {
  color: var(--danger);
  background: var(--danger-subtle);
}

/* ── Header ── */

.main-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.main-header-nav {
  display: none; /* Navigation moved to sidebar icons */
}

.main-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.main-header-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.main-header-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-nav {
  display: none;
}

/* ── Body ── */

.main-body {
  grid-area: body;
  display: flex;
  overflow: hidden;
}

.main-sidebar {
  width: 280px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  padding: 1rem;
  flex-shrink: 0;
  overflow-y: auto;
  transition: width 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
}

.main-sidebar--collapsed {
  width: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  border-right: none;
}

.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.main-content--full {
  /* já ocupa flex: 1 */
}

/* ─── Loading ─────────────────────────────────────────────────────────────── */

.loading-root {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SESSION SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */

.session-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 1.25rem;
}

.session-sidebar-new {
  position: relative;
}

.btn-new-session {
  background: var(--accent);
  color: var(--text-on-accent);
  border: 1px solid var(--accent);
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  width: 100%;
  cursor: pointer;
}

.btn-new-session:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

/* ── Mode Picker (popover) ── */

.mode-picker {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  animation: picker-in 0.15s ease-out;
}

@keyframes picker-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mode-picker-title {
  display: flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.5rem 0.5rem;
}

.mode-picker-option {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  padding-left: 0.75rem;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  color: var(--text-primary);
}

.mode-picker-option:hover {
  background: var(--bg-secondary);
  border-left-color: var(--picker-accent, var(--accent));
}

.mode-picker-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.mode-picker-option:disabled:hover {
  background: transparent;
  border-left-color: transparent;
}

.mode-picker-back {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 0.375rem 0 0;
  margin-right: 0.25rem;
}

.mode-picker-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
}

.mode-picker-desc {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  margin-top: 1px;
}

.session-list {
  flex: 1;
  overflow-y: auto;
}

.session-archive-link {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  padding: 0.625rem 0.25rem 0.125rem;
  text-align: left;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.session-archive-link:hover {
  color: var(--text-secondary);
}

.session-group {
  margin-bottom: 0.5rem;
}

.session-group-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.5rem 0.35rem;
}

.session-empty {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  padding: 1rem 0.5rem;
  text-align: center;
}

.session-item {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.session-item:hover {
  background: var(--bg-secondary);
}

.session-item--active {
  background: var(--accent-subtle);
  border-color: rgba(16, 185, 129, 0.15);
}

.session-item-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.375rem;
}

.session-item--active .session-item-title {
  color: var(--accent);
}

.session-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.session-mode-badge {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
}

.session-delete-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.session-item:hover .session-delete-btn {
  opacity: 1;
}

.session-delete-btn:hover {
  color: var(--danger);
  background: var(--danger-subtle);
}

/* ── Conversas de Task agendada (selo permanente + alerta de resultado novo) ── */

.session-task-badge {
  margin-right: 0.375rem;
  font-size: 0.75rem;
  opacity: 0.85;
}

.session-task-time {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.session-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}

.session-item--unread {
  border-color: rgba(245, 158, 11, 0.35);
}

.session-item--unread .session-item-title {
  font-weight: 700;
}

.session-item--unread .session-task-time {
  color: var(--warning);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-app);
  position: relative;
}

.chat-topbar {
  padding: 0.75rem 1.5rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-session-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-topbar-back {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.5rem 0.25rem 0;
  margin-right: 0.25rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Mode Indicator ── */

.mode-indicator {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

/* ── No Session ── */

.chat-no-session {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg-app);
}

.chat-no-session-inner {
  text-align: center;
  max-width: 320px;
}

.chat-no-session-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.chat-no-session-hint {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ── Messages ── */

.chat-messages {
  flex: 1;
  /* Sem isso, o padrão do flexbox (min-height:auto) não deixa essa área
     encolher pra caber um IRMÃO mais alto (ex.: o painel "Transformar em
     Task" cresce ao escolher recorrência semanal/mensal) — o excesso
     empurra o resto do `.chat-page` pra fora da tela, escondendo até o
     botão de ação lá embaixo, em vez de só rolar aqui dentro. */
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-messages--empty {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
}

.chat-empty-title {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.chat-empty-hint {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.chat-empty-hint code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.375rem;
  font-size: 0.75rem;
  color: var(--accent);
}

.chat-empty-help-btn {
  font-family: var(--font-mono, monospace);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.375rem;
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.chat-empty-help-btn:hover {
  background: var(--bg-hover);
}

/* ── Message Bubble ── */

.message-bubble {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  animation: message-appear 0.3s var(--ease-out) forwards;
  opacity: 0;
}

@keyframes message-appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-bubble--user {
  align-self: flex-end;
}

.message-bubble--assistant,
.message-bubble--system {
  align-self: flex-start;
}

.message-bubble-content {
  font-size: 0.875rem;
  line-height: 1.7;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-bubble--user .message-bubble-content {
  background: var(--accent);
  color: var(--text-on-accent);
  border-bottom-right-radius: var(--radius-xs);
}

.message-bubble--assistant .message-bubble-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-xs);
}

.message-bubble--system .message-bubble-content {
  background: var(--accent-muted);
  border: 1px dashed rgba(16, 185, 129, 0.2);
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.message-bubble-time {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 0 0.25rem;
}

.message-bubble--user .message-bubble-time {
  text-align: right;
}

/* ── Thinking Dots ── */

.message-bubble--thinking {
  align-self: flex-start;
}

.message-bubble--thinking .message-bubble-content {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: thinking-pulse 1.2s ease-in-out infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%           { opacity: 1;   transform: scale(1.1); }
}

/* ── Streaming ── */

.message-bubble--streaming {
  align-self: flex-start;
}

.message-bubble--streaming .message-bubble-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-xs);
}

.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: var(--accent);
  margin-left: 2px;
  border-radius: 1px;
  vertical-align: text-bottom;
  animation: cursor-blink 0.7s ease-in-out infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── Markdown dentro das bolhas ── */

.message-bubble-content .md-p {
  margin: 0 0 0.5em;
}

.message-bubble-content .md-p:last-child {
  margin-bottom: 0;
}

.message-bubble-content .md-heading {
  font-weight: 600;
  margin: 0.75em 0 0.35em;
  line-height: 1.3;
}

.message-bubble-content h4.md-heading { font-size: 0.95rem; }
.message-bubble-content h5.md-heading { font-size: 0.875rem; }

.message-bubble-content strong {
  font-weight: 600;
}

.message-bubble-content em {
  font-style: italic;
  opacity: 0.85;
}

.message-bubble-content .md-list {
  margin: 0.35em 0 0.5em;
  padding-left: 1.4em;
}

.message-bubble-content .md-list--ordered {
  list-style-type: decimal;
}

.message-bubble-content .md-list-item {
  margin-bottom: 0.25em;
  line-height: 1.6;
}

.message-bubble-content .md-list-item::marker {
  color: var(--accent);
  font-weight: 600;
}

.message-bubble-content .md-code-inline {
  background: var(--code-inline-bg);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-xs);
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8em;
}

.message-bubble--user .md-code-inline {
  background: rgba(255, 255, 255, 0.15);
}

.message-bubble-content .md-code-block {
  background: var(--code-block-bg);
  padding: 0.75em 1em;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.5em 0;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8em;
  line-height: 1.5;
}

.message-bubble-content .md-code-block code {
  background: none;
  padding: 0;
}

.message-bubble-content .md-blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25em 0.75em;
  margin: 0.5em 0;
  opacity: 0.85;
  font-style: italic;
}

.message-bubble-content .md-table-wrapper {
  overflow-x: auto;
  margin: 0.5em 0;
}

.message-bubble-content .md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.825rem;
}

.message-bubble-content .md-table th,
.message-bubble-content .md-table td {
  border: 1px solid var(--border-subtle);
  padding: 0.35em 0.6em;
  text-align: left;
}

.message-bubble-content .md-table th {
  background: var(--overlay-raise);
  font-weight: 600;
}

.message-bubble-content .md-hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 0.75em 0;
}

/* ── Chat Input ── */

.chat-input-area {
  padding: 1rem 1.5rem 1.25rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* Envolve o botão "Gerar agora" + o input, no rodapé do chat */
.chat-compose {
  flex-shrink: 0;
}

.btn-generate-now {
  display: block;
  width: calc(100% - 3rem);
  margin: 0.75rem 1.5rem 0;
  padding: 0.625rem 1rem;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.btn-generate-now:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-generate-now:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 0.75rem 1rem;
  resize: none;
  min-height: 44px;
  max-height: 320px;
  overflow-y: auto;
  transition: border-color var(--transition-fast);
}

.chat-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.btn-send {
  height: 44px;
  min-width: 44px;
  padding: 0 1.25rem;
  background: var(--accent);
  color: var(--text-on-accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* ── Audio Recorder ── */

.audio-recorder {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-audio {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-audio:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-audio:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-audio-stop {
  background: var(--danger-subtle);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
  animation: audio-pulse 1.5s ease-in-out infinite;
}

.btn-audio-stop:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

@keyframes audio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.audio-duration {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  text-align: center;
}

.audio-transcribing {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.audio-error {
  font-size: 0.6875rem;
  color: var(--danger);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Error Banner ── */

.chat-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  background: var(--danger-subtle);
  border-bottom: 1px solid rgba(239, 68, 68, 0.15);
  font-size: 0.8125rem;
  color: var(--danger);
  flex-shrink: 0;
}

.chat-error-dismiss {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 0.75rem;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  cursor: pointer;
}

.chat-error-dismiss:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ── Sessão concluída (banner) ── */

.chat-completed-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--accent-subtle);
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

.chat-completed-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-completed-text {
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.chat-completed-link {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8125rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.chat-completed-link:hover {
  background: var(--accent);
  color: var(--text-on-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SOURCE BADGES (RAG)
   ═══════════════════════════════════════════════════════════════════════════ */

.source-badges {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.source-badges-label {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.source-badges-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.source-badge-wrapper {
  display: flex;
  flex-direction: column;
}

.source-badge {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: fit-content;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.source-badge:hover {
  border-color: var(--border-strong);
}

.source-badge--expanded {
  border-color: var(--accent);
}

.source-badge-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  transition: background var(--transition-fast);
}

.source-badge-main:not(:disabled):hover {
  background: var(--bg-hover);
}

.source-badge-main:disabled {
  cursor: default;
}

.source-badge-type {
  font-weight: 600;
  font-size: 0.625rem;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

.source-badge-type--document {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info-soft);
}

.source-badge-type--knowledge {
  background: var(--accent-subtle);
  color: var(--accent);
}

.source-badge-title {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-badge-category {
  font-size: 0.625rem;
  color: var(--text-tertiary);
}

.source-badge-toggle {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-subtle);
  cursor: pointer;
  padding: 0 8px;
  transition: background var(--transition-fast);
}

.source-badge-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN PANEL (área única de administração com guias por tema)
   ═══════════════════════════════════════════════════════════════════════════ */

.admin-panel {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.admin-panel-nav {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
  overflow-y: auto;
}

.admin-panel-group { margin-bottom: 0.35rem; }

.admin-panel-group-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 0.6rem 0.6rem 0.3rem;
}

.admin-panel-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.admin-panel-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.admin-panel-tab--active {
  background: var(--accent-subtle);
  color: var(--text-primary);
  font-weight: 600;
}
.admin-panel-tab--active .admin-panel-tab-icon { color: var(--accent); }

.admin-panel-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}
.admin-panel-tab:hover .admin-panel-tab-icon { color: var(--text-secondary); }

.admin-panel-footer {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle, var(--border));
}

.admin-panel-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;          /* a página interna (.ideas-page) é quem rola */
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WIKI
   ═══════════════════════════════════════════════════════════════════════════ */

.wiki-page {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.wiki-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
}

.wiki-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.5rem;
}

.wiki-brand {
  font-weight: 700;
  font-size: 1rem;
}

.wiki-admin-actions {
  display: flex;
  gap: 4px;
}

.wiki-icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.wiki-icon-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

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

.wiki-icon-btn--danger:hover:not(:disabled) {
  border-color: var(--danger, #e5484d);
  color: var(--danger, #e5484d);
}

.wiki-search {
  position: relative;
  padding: 0.5rem 1rem;
}

.wiki-search-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.8125rem;
}

.wiki-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.wiki-search-clear {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
}

.wiki-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.wiki-nav-group { margin-bottom: 0.75rem; }

.wiki-nav-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 0.25rem 0.5rem;
}

.wiki-nav-count {
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.625rem;
  color: var(--text-secondary);
}

.wiki-nav-item {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.wiki-nav-item:hover {
  background: var(--bg-hover);
}

.wiki-nav-item--active {
  background: var(--accent-subtle);
}

.wiki-nav-caret-btn {
  flex-shrink: 0;
  width: 18px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.wiki-nav-caret {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
  display: inline-block;
}

.wiki-nav-caret--open { transform: rotate(90deg); }

.wiki-nav-caret-spacer { display: inline-block; width: 18px; flex-shrink: 0; }

.wiki-nav-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 6px 8px 6px 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

/* O título precisa estar em elemento próprio p/ o ellipsis funcionar dentro do flex */
.wiki-nav-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiki-nav-item:hover .wiki-nav-label { color: var(--text-primary); }
.wiki-nav-item--active .wiki-nav-label { color: var(--accent); font-weight: 600; }

.wiki-nav-childcount {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.625rem;
  color: var(--text-tertiary);
}


.wiki-empty {
  padding: 1rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  text-align: center;
}

.wiki-empty-hint { font-size: 0.75rem; }

.wiki-reader {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;            /* a reader não rola; cada coluna rola sozinha */
  display: flex;
  flex-direction: column;
}

/* Estados sem página selecionada (erro/vazio) ainda precisam de respiro */
.wiki-reader > .ideas-error { margin: 1rem 2.5rem 0; }

.wiki-reader-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.wiki-reader-empty-icon { font-size: 3rem; opacity: 0.4; }
.wiki-reader-empty-title { font-size: 1.1rem; font-weight: 600; margin-top: 0.5rem; }
.wiki-reader-empty-hint { font-size: 0.875rem; }

.wiki-nav-caret {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  margin-right: 4px;
}

.wiki-reader-cols {
  flex: 1;
  min-height: 0;               /* permite as colunas internas rolarem */
  display: flex;
  gap: 3rem;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
  overflow: hidden;
}

.wiki-toc {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  overflow-y: auto;            /* barra do TOC na borda direita */
  border-left: 1px solid var(--border-subtle);
  padding: 2rem 0.5rem 2rem 1rem;
}

.wiki-toc-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 0.25rem;
}

.wiki-toc-item {
  text-align: left;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.35;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: normal;
  overflow-wrap: anywhere;
  width: 100%;
}

.wiki-toc-item:hover { color: var(--accent); background: var(--bg-hover); }
.wiki-toc-item--l3 { padding-left: 16px; font-size: 0.78rem; color: var(--text-tertiary); }

.wiki-article {
  flex: 1;
  max-width: 860px;
  min-width: 0;
  height: 100%;
  overflow-y: auto;            /* barra do texto colada ao texto */
  padding: 2rem 1.5rem 3rem 2.5rem;
}

/* ── Edição da página ── */
.wiki-edit { display: flex; flex-direction: column; gap: 0.75rem; }

.wiki-edit-row {
  display: flex;
  gap: 1rem;
}

.wiki-edit-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.wiki-edit-linkbar { position: relative; }

.wiki-edit-linkresults {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 2px;
  overflow: hidden;
}

.wiki-edit-linkitem {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
}

.wiki-edit-linkitem:hover { background: var(--bg-hover); color: var(--accent); }

.wiki-edit-content {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  resize: vertical;
}

.wiki-edit-actions { display: flex; gap: 0.5rem; }

/* ── POPs / páginas vinculadas (rodapé do índice) ── */
.wiki-children {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.wiki-children-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.wiki-children-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 0.5rem;
}

.wiki-child {
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 3px 0;
}

.wiki-child:hover { color: var(--accent); }
.wiki-child-arrow { color: var(--accent); }

.wiki-article-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.wiki-article-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wiki-delete-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 0.7rem;
  padding: 3px 8px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.wiki-delete-btn:hover:not(:disabled) {
  border-color: var(--danger, #e5484d);
  color: var(--danger, #e5484d);
}

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

.wiki-crumb-sep { margin: 0 4px; }
.wiki-crumb-slug { font-family: monospace; text-transform: none; }

.wiki-article-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.5rem 0;
  color: var(--text-primary);
}

.wiki-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.wiki-article-body { font-size: 0.95rem; line-height: 1.7; }

.md-wiki-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  cursor: pointer;
}

.md-wiki-link:hover {
  border-bottom-style: solid;
}

.md-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 0.5rem 0;
}

.wiki-backlinks {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.wiki-backlinks-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wiki-backlinks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.wiki-backlink {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wiki-backlink:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.message-bubble-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.answered-by {
  font-size: 0.625rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}

.answered-by--local {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}

.message-bubble-task-btn {
  margin-top: 6px;
  align-self: flex-start;
  font-size: 0.75rem;
  padding: 4px 10px;
}

.answered-by--api {
  background: var(--accent-subtle);
  color: var(--accent);
}

.source-badge-excerpt {
  margin-top: 4px;
  padding: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   IDEAS / KNOWLEDGE / DOCUMENTS PAGES (Shared Layout)
   ═══════════════════════════════════════════════════════════════════════════ */

.ideas-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem;
  overflow-y: auto;
  gap: 1rem;
}

.ideas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ideas-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.ideas-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  background: var(--danger-subtle);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--danger);
}

.ideas-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.ideas-search-input {
  flex: 1;
  min-width: 180px;
}

.ideas-select {
  min-width: 150px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

.ideas-date-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

.ideas-loading {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  padding: 2rem;
  text-align: center;
}

.ideas-empty {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  padding: 2rem;
  text-align: center;
  line-height: 1.6;
}

.ideas-empty code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.375rem;
  font-size: 0.8125rem;
  color: var(--accent);
}

/* ── Ideas Content (Split View) ── */

.ideas-content {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.ideas-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Ideas List Item ── */

.ideas-list-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ideas-list-item:hover {
  border-color: var(--border);
  background: var(--bg-secondary);
}

.ideas-list-item--active {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.ideas-list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
}

.ideas-list-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.ideas-list-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ideas-list-item-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.ideas-list-item-author {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.idea-delete-btn {
  opacity: 0;
  transition: opacity 0.15s;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.ideas-list-item:hover .idea-delete-btn {
  opacity: 1;
}

/* ── Ideas Detail ── */

.ideas-detail {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-y: auto;
  padding: 1.5rem;
}

.ideas-detail-empty {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  text-align: center;
  padding: 3rem 1rem;
}

.ideas-detail-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ideas-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.ideas-detail-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.ideas-detail-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 0.75rem;
  background: var(--accent-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-subtle);
}

.ideas-detail-content {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Markdown dentro do detalhe de ideias/conhecimento */
.ideas-detail-content--markdown {
  white-space: normal;
}

.ideas-detail-content--markdown .md-heading {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.25rem;
}

.ideas-detail-content--markdown .md-heading:first-child {
  margin-top: 0;
}

.ideas-detail-content--markdown .md-p {
  margin: 0.5rem 0;
}

.ideas-detail-content--markdown .md-list {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.ideas-detail-content--markdown .md-list-item {
  margin: 0.25rem 0;
}

.ideas-detail-content--markdown .md-list--ordered {
  list-style-type: decimal;
}

.ideas-detail-content--markdown .md-code-inline {
  background: var(--bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.ideas-detail-content--markdown .md-blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.75rem 0;
  padding: 0.5rem 1rem;
  background: var(--accent-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.ideas-detail-content--markdown .md-hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1rem 0;
}

.ideas-detail-content--markdown strong {
  color: var(--text-primary);
  font-weight: 600;
}

.ideas-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.ideas-detail-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ── Ideas Edit Mode ── */

.ideas-detail-edit {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ideas-edit-label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.ideas-edit-input {
  width: 100%;
}

.ideas-edit-textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
}

.ideas-edit-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Knowledge Type Badge ── */

.knowledge-type-badge {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge--success {
  background: var(--success-subtle);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge--warning {
  background: var(--warning-subtle);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.badge--muted {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  border-color: var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DOCUMENTS PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.documents-upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.documents-upload-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.documents-upload-filename {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-style: italic;
}

.documents-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.documents-list-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all var(--transition-fast);
}

.documents-list-item:hover {
  border-color: var(--border);
}

.documents-list-item--highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
  animation: highlight-pulse 1.6s ease-out;
}

@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent); }
  60%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 2px var(--accent-subtle); }
}

.documents-list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.documents-list-item-title--link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}

.documents-list-item-title--link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.documents-list-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.documents-list-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.documents-version {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.documents-list-item-actions {
  display: flex;
  gap: 0.5rem;
}

.documents-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.documents-checkbox-label input[type="checkbox"] {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN PAGES
   ═══════════════════════════════════════════════════════════════════════════ */

.nav-separator {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  align-self: center;
  margin: 0 2px;
}

/* ── Ícone de ajuda (ⓘ) com popover explicativo ── */
.info-hint {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.info-hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.info-hint-icon:hover {
  opacity: 1;
  color: var(--accent);
}

.info-hint-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: 320px;
  max-width: 80vw;
  padding: 0.75rem 0.875rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  white-space: pre-line;
  text-transform: none;
  letter-spacing: normal;
}

.admin-select {
  appearance: auto;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

.admin-role-select {
  appearance: auto;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

/* ── Permissões de tipos de chat por usuário ── */
.admin-chat-modes {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.admin-chat-modes-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.admin-chat-modes-all {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-style: italic;
}

.admin-chat-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.375rem 0.75rem;
}

.admin-chat-mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.admin-chat-mode-option input {
  accent-color: var(--accent);
  cursor: pointer;
}

.admin-success {
  padding: 0.75rem 1rem;
  background: var(--success-subtle);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  color: var(--emerald-400);
  font-size: 0.8125rem;
}

.admin-config-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-config-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.admin-config-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-config-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
}

.admin-config-field label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── Fluxo & Recursos (monitor de LLM/tool ao vivo) ── */

.flow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.flow-table th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border-subtle);
}

.flow-table td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

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

.flow-table-detail {
  color: var(--text-secondary);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-running {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--accent);
}

.flow-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: flow-pulse-anim 1.2s ease-in-out infinite;
}

@keyframes flow-pulse-anim {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.flow-speed--ok { color: var(--success, #22c55e); font-weight: 600; }
.flow-speed--slow { color: var(--warning); font-weight: 600; }
.flow-speed--critical { color: var(--danger); font-weight: 700; }

.admin-config-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.admin-config-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-style: italic;
}

.admin-editable-name {
  cursor: pointer;
  border-bottom: 1px dashed var(--border-strong);
  transition: color var(--transition-fast);
}

.admin-editable-name:hover {
  color: var(--accent);
}

.admin-edit-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.admin-edit-name .ideas-search-input {
  flex: 1;
}

.admin-you-badge {
  background: rgba(59, 130, 246, 0.15) !important;
  color: var(--info-soft) !important;
  border-color: rgba(59, 130, 246, 0.25) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STRUCTURED PREVIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.structured-preview {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 0.75rem 1.5rem;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.structured-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--accent-muted);
}

.structured-preview-heading {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
}

.structured-preview-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.structured-preview-label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.structured-preview-input {
  width: 100%;
}

.structured-preview-textarea {
  width: 100%;
  resize: vertical;
  min-height: 100px;
}

.structured-preview-textarea--sm {
  min-height: 56px;
}

.structured-preview-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.structured-preview-field-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.structured-preview-field-value {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.structured-preview-content {
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.structured-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.structured-preview-tag {
  display: inline-flex;
  padding: 0.125rem 0.5rem;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.structured-preview-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Admin Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */

.dashboard-page {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  max-height: 100%;
}

.dashboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.dashboard-period {
  display: flex;
  gap: 0.375rem;
}

.dashboard-section {
  margin-bottom: 1.5rem;
}

.dashboard-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

/* Health indicators */
.dashboard-health {
  display: flex;
  gap: 1rem;
}

.health-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.health-up .health-dot { background: var(--emerald-500); box-shadow: 0 0 6px var(--emerald-500); }
.health-down .health-dot { background: var(--red-500, #ef4444); box-shadow: 0 0 6px var(--red-500, #ef4444); }
.health-warn .health-dot { background: var(--amber-500, #f59e0b); box-shadow: 0 0 6px var(--amber-500, #f59e0b); }
.health-up .health-status { color: var(--emerald-500); font-weight: 600; }
.health-down .health-status { color: var(--red-500, #ef4444); font-weight: 600; }
.health-warn .health-status { color: var(--amber-500, #f59e0b); font-weight: 600; }

/* KPI cards */
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-label {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

.kpi-warning .kpi-value { color: var(--amber-500, #f59e0b); }
.kpi-danger .kpi-value { color: var(--red-500, #ef4444); }

/* Bar charts */
.dashboard-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.chart-bar-container {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-bar {
  width: 80%;
  max-width: 28px;
  background: var(--emerald-500);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.chart-bar-blue {
  background: var(--blue-500, #3b82f6);
}

.chart-label {
  font-size: 0.5625rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
  white-space: nowrap;
}

/* Tables */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dashboard-table {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.dashboard-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.dashboard-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
}

.dashboard-table td {
  padding: 0.4375rem 0.75rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

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

.td-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.td-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.td-error-detail {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dashboard-errors code {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  background: rgba(239, 68, 68, 0.1);
  color: var(--red-500, #ef4444);
  border-radius: var(--radius-sm);
}

.admin-loading {
  color: var(--text-tertiary);
  text-align: center;
  padding: 3rem;
}

.admin-error {
  color: var(--red-500, #ef4444);
  text-align: center;
  padding: 2rem;
}

.dashboard-table code {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

/* Knowledge source cards */
.knowledge-source-card {
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.knowledge-source-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.knowledge-source-kpis {
  display: flex;
  gap: 1rem;
}

.kpi-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.kpi-mini-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-mini-label {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.125rem;
}

/* Diagnóstico do Sistema */
.diag-overall {
  margin-left: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.diag-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.diag-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.diag-ok {
  border-color: var(--success);
  background: var(--success-subtle);
}

.diag-warn {
  border-color: var(--warning);
  background: var(--warning-subtle);
}

.diag-danger {
  border-color: var(--danger);
  background: var(--danger-subtle);
}

.diag-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.diag-dot {
  font-size: 0.625rem;
  line-height: 1;
}

.diag-area {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 7rem;
}

.diag-message {
  color: var(--text-primary);
}

.diag-tip {
  margin-top: 0.375rem;
  margin-left: 1.125rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Groups Management (Épico 10.2)
   ═══════════════════════════════════════════════════════════════════════════ */

.groups-layout {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

.groups-list-panel {
  flex: 1;
  min-width: 0;
}

.groups-members-panel {
  width: 340px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-y: auto;
}

.groups-members-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.groups-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.groups-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  transition: background 0.15s;
}

.groups-member-item:hover {
  background: var(--bg-hover);
}

.groups-member-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.groups-member-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.groups-member-username {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.groups-add-member {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.groups-add-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.groups-available-users {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 280px;
  overflow-y: auto;
}

.documents-list-item--selected {
  border-color: var(--accent) !important;
  background: var(--accent-subtle);
}

.admin-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.badge--accent {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Wizard Steps (Épico 10.3 — Criação de Percurso)
   ═══════════════════════════════════════════════════════════════════════════ */

.wizard-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  background: transparent;
  transition: all 0.15s;
}

.wizard-step--active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}

.wizard-step--done {
  color: var(--text-secondary);
}

.wizard-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}

.wizard-step--active .wizard-step-num {
  background: var(--accent);
  color: var(--text-on-accent);
}

.wizard-step--done .wizard-step-num {
  background: var(--accent);
  color: var(--text-on-accent);
  opacity: 0.6;
}

.wizard-step-label {
  display: none;
}

@media (min-width: 640px) {
  .wizard-step-label {
    display: inline;
  }
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.wizard-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
  line-height: 1.5;
}

.wizard-selected-docs {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.wizard-summary {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.wizard-summary-row {
  display: flex;
  gap: 1rem;
}

.wizard-summary-label {
  flex-shrink: 0;
  width: 120px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.wizard-summary-value {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ─── Badge Danger ─── */
.badge--danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-soft);
}

/* ─── Generation Progress ─── */
.generation-progress {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.generation-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.generation-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}
.generation-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.generation-progress-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

/* ─── Module Preview ─── */
.module-preview {
  margin-top: 1rem;
}
.module-preview-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.5rem;
  max-height: 500px;
  overflow-y: auto;
}
.module-preview-text {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  margin: 0;
}

/* ─── Module Edit ─── */
.module-edit-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 0.75rem;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  resize: vertical;
}
.module-edit-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Admin Quiz Review ─── */
.admin-quiz-question {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.admin-quiz-question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
}
.admin-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0.5rem;
}
.admin-quiz-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.admin-quiz-option--correct {
  background: rgba(16, 185, 129, 0.1);
  color: var(--text-primary);
}
.admin-quiz-explanation {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}
.admin-quiz-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 0.25rem;
  font-weight: 500;
}
.admin-quiz-opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.admin-quiz-opt-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 20px;
}
.admin-quiz-edit {
  padding: 4px 0;
}

/* ─── Learning Dashboard ─── */
.learning-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.learning-tabs {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1.5rem 0;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.learning-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.learning-tab:hover { color: var(--text-primary); }

.learning-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.learning-shell-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.learning-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.learning-stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.learning-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.learning-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.learning-section-title {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}
.learning-progress-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.learning-progress-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}
.documents-list-item--disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ─── Module Page (study layout — imersivo) ─── */

.module-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}

/* Topbar compacto */
.module-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  flex-shrink: 0;
  min-height: 40px;
}
.module-topbar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 1rem;
}
.module-topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.module-topbar-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.module-topbar-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.module-topbar-back:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Container principal — limpo, sem borda, ocupa tudo */
.module-page .module-reader-content {
  padding: 2rem 3rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Quando é mídia: sem scroll, centraliza conteúdo */
.module-page .module-reader-content:has(.module-media-page) {
  overflow-y: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Texto */
.module-reader-text {
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height: 1.85;
  word-wrap: break-word;
  max-width: 900px;
  margin: 0 auto;
}
.module-reader-text h2 {
  font-size: 1.35rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.module-reader-text h3 {
  font-size: 1.15rem;
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
}
.module-reader-text p {
  margin-bottom: 0.8rem;
}
.module-reader-text ul,
.module-reader-text ol {
  margin-bottom: 0.8rem;
  padding-left: 1.5rem;
}
.module-reader-text li {
  margin-bottom: 0.3rem;
}

/* Pagination */
.module-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.4rem 0;
  flex-shrink: 0;
}
.module-pagination-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.module-pagination-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}
.module-pagination-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.2);
}
.module-pagination-dot:hover:not(.active) {
  border-color: var(--text-primary);
  background: var(--bg-hover);
}
.module-pagination-dot.media {
  border-radius: 3px;
  width: 14px;
  height: 8px;
}
.module-pagination-dot.media.active {
  background: var(--accent);
  border-color: var(--accent);
}

.module-reader-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0 0.75rem;
  flex-shrink: 0;
}

/* ─── Module Media (dentro do mesmo container) ─── */

.module-media-page {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.module-media-figure {
  margin: 0;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.module-media-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.module-media-caption {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
}

.module-media-video {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 8px;
}

.module-media-audio {
  width: 100%;
  max-width: 600px;
}

.module-media-image-zoomable {
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.module-media-image-zoomable:hover {
  opacity: 0.85;
}

.module-media-link {
  color: var(--accent);
  text-decoration: underline;
}

.module-media-video-actions {
  margin-top: 0.25rem;
}

/* ─── Fullscreen Modals (zoom imagem / vídeo tela cheia) ─── */

.media-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.media-zoom-image {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  transition: transform 0.15s ease;
  cursor: default;
  user-select: none;
}
.media-zoom-controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
}
.media-zoom-controls button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
}
.media-zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.15);
}
.media-zoom-controls span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  min-width: 3rem;
  text-align: center;
}

.video-fullscreen-iframe {
  width: 92vw;
  height: 88vh;
  border: none;
  border-radius: 8px;
}

/* ─── Admin Media Management ─── */

.admin-media-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-media-file-pick {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-media-file-pick .ideas-search-input {
  flex: 1;
}

.admin-media-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.admin-media-item-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 0.5rem;
}

.admin-media-item-type {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.admin-media-item-caption {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.admin-media-item-source {
  margin-bottom: 0.5rem;
}

.admin-media-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* ─── Quiz Wizard ─── */
.quiz-indicator {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.quiz-indicator-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.quiz-indicator-dot:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.quiz-indicator-dot--active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-on-accent);
}
.quiz-indicator-dot--answered:not(.quiz-indicator-dot--active) {
  border-color: var(--accent);
  color: var(--accent);
}
.quiz-progress-info {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.quiz-question-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.quiz-question-text {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0 0 1.25rem;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  color: var(--text-primary);
}
.quiz-option:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.quiz-option--selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.quiz-option-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-secondary);
}
.quiz-option--selected .quiz-option-letter {
  background: var(--accent);
  color: var(--text-on-accent);
}
.quiz-option-text {
  font-size: 0.8125rem;
  line-height: 1.5;
  padding-top: 2px;
}
.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

/* ─── Quiz Result ─── */
.quiz-result-card {
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.quiz-result-card--passed {
  background: var(--accent-subtle);
  border: 2px solid var(--accent);
}
.quiz-result-card--failed {
  background: var(--danger-subtle);
  border: 2px solid var(--danger-soft);
}
.quiz-result-score {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}
.quiz-result-card--passed .quiz-result-score {
  color: var(--accent);
}
.quiz-result-card--failed .quiz-result-score {
  color: var(--danger-soft);
}
.quiz-result-status {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.quiz-result-detail {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.quiz-detail--wrong {
  background: var(--danger-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
}
.quiz-detail-feedback {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: 6px;
}
.quiz-detail-correct {
  font-size: 0.8125rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.quiz-detail-explanation {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Badge Grid ─── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: default;
  transition: all 0.15s ease;
}
.badge-card--earned {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.badge-card--locked {
  opacity: 0.4;
  filter: grayscale(1);
}
.badge-card-icon {
  font-size: 1.5rem;
}
.badge-card-name {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 500;
}
.badge-card--earned .badge-card-name {
  color: var(--text-primary);
}

/* ─── Leaderboard ─── */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 1.5rem;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: var(--bg-elevated);
}
.leaderboard-row--self {
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
}
.leaderboard-rank {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-tertiary);
  min-width: 30px;
}
.leaderboard-row--self .leaderboard-rank {
  color: var(--accent);
}
.leaderboard-name {
  font-size: 0.8125rem;
  color: var(--text-primary);
  flex: 1;
}
.leaderboard-xp {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Toast Notifications
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: var(--shadow-md);
  animation: toast-slide-in 0.3s ease-out;
  pointer-events: auto;
  max-width: 360px;
}
.toast--xp {
  border-color: var(--warning);
}
.toast--badge {
  border-color: var(--violet);
}
.toast--info {
  border-color: var(--accent);
}
.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.toast-message {
  font-size: 0.8125rem;
  color: var(--text-primary);
}
@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Monitoramento de Treinamento — painéis modernos
   ═══════════════════════════════════════════════════════════════════════════ */

/* KPIs */
.mk-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.mk-kpi {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.mk-kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.mk-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.mk-kpi-icon--blue   { background: var(--info-subtle);    color: var(--info-soft); }
.mk-kpi-icon--violet { background: var(--violet-subtle);  color: var(--violet-soft); }
.mk-kpi-icon--high   { background: var(--success-subtle); color: var(--emerald-400); }
.mk-kpi-icon--mid    { background: var(--warning-subtle); color: var(--warning-soft); }
.mk-kpi-icon--low    { background: var(--danger-subtle);  color: var(--danger-soft); }
.mk-kpi-body { display: flex; flex-direction: column; }
.mk-kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; color: var(--text-primary); }
.mk-kpi-label { font-size: 0.75rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }

/* Painéis (2 colunas) */
.mk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.mk-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.mk-panel--full { margin-bottom: 1rem; }
.mk-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.875rem 1.1rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
}
.mk-count {
  background: rgba(239,68,68,0.15);
  color: var(--danger-soft);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.6875rem;
  font-weight: 700;
}

/* Linhas com barra de progresso */
.mk-rows { display: flex; flex-direction: column; }
.mk-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0.75rem 1.1rem;
  border: none;
  background: none;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}
.mk-row:last-child { border-bottom: none; }
.mk-row--clickable { cursor: pointer; transition: background var(--transition-fast); }
.mk-row--clickable:hover { background: var(--bg-hover); }
.mk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mk-row-name { font-size: 0.875rem; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row-sub { font-size: 0.6875rem; color: var(--text-tertiary); }
.mk-row-metric { display: flex; align-items: center; gap: 8px; width: 160px; flex-shrink: 0; }
.mk-bar { flex: 1; height: 6px; background: var(--bg-tertiary); border-radius: 999px; overflow: hidden; }
.mk-bar-fill { height: 100%; border-radius: 999px; transition: width var(--transition-base); }
.mk-bar-fill--high { background: var(--emerald-400); }
.mk-bar-fill--mid  { background: var(--warning-soft); }
.mk-bar-fill--low  { background: var(--danger-soft); }
.mk-bar-val { font-size: 0.75rem; color: var(--text-secondary); width: 34px; text-align: right; }
.mk-chip {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.mk-chip--high { background: var(--success-subtle); color: var(--emerald-400); }
.mk-chip--mid  { background: var(--warning-subtle); color: var(--warning-soft); }
.mk-chip--low  { background: var(--danger-subtle);  color: var(--danger-soft); }

/* Alertas */
.mk-alerts { display: flex; flex-direction: column; }
.mk-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.1rem;
  border: none;
  background: none;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.mk-alert:last-child { border-bottom: none; }
.mk-alert:hover { background: var(--bg-hover); }
.mk-alert--overdue  { background: var(--danger-subtle); }
.mk-alert--low_score { background: var(--warning-subtle); }
.mk-alert--inactive { background: var(--bg-tertiary); }
.mk-alert-tag { font-size: 0.75rem; font-weight: 600; flex-shrink: 0; }
.mk-alert-user { font-size: 0.8125rem; color: var(--accent); font-weight: 500; flex-shrink: 0; }
.mk-alert-detail { font-size: 0.75rem; color: var(--text-tertiary); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Colaboradores */
.mk-search { margin: 0.875rem 1.1rem; width: calc(100% - 2.2rem); }
.mk-people { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 1.1rem 1.1rem; }
.mk-person {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.mk-person:hover { border-color: var(--accent); }
.mk-person-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
}
.mk-person-name { font-size: 0.8125rem; color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   Admin Learning Stats (Épico 10.9)
   ═══════════════════════════════════════════════════════════════════════════ */

.admin-stats-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 860px;          /* compacto e escaneável, sem espalhar pela tela */
}
.admin-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.admin-stats-table th,
.admin-stats-table td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
/* Primeira coluna (nome) ocupa o resto; métricas ficam estreitas e à direita */
.admin-stats-table th:first-child,
.admin-stats-table td:first-child {
  width: auto;
}
.admin-stats-table th:not(:first-child),
.admin-stats-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
  width: 130px;
}
.admin-stats-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.admin-stats-table tbody tr:hover {
  background: var(--bg-secondary);
}
.admin-stats-table tbody tr:last-child td {
  border-bottom: none;
}
.admin-stats-clickable {
  color: var(--accent);
  font-weight: 500;
}

/* Status badges */
.admin-stats-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 500;
}
.admin-stats-status--enrolled {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.admin-stats-status--in_progress {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}
.admin-stats-status--completed {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* Module status icons in table */
.admin-module-icon {
  font-size: 0.875rem;
  cursor: default;
}

/* Alerts — borda completa + tint por severidade (sem side-stripe) */
.admin-alert {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}
.admin-alert--overdue {
  border-color: var(--danger);
  background: var(--danger-subtle);
}
.admin-alert--low_score {
  border-color: var(--warning);
  background: var(--warning-subtle);
}
.admin-alert--inactive {
  border-color: var(--border-strong);
  background: var(--bg-secondary);
}

/* Link-style button */
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s;
}
.btn-link:hover {
  text-decoration-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Meu Aprendizado — jornada, momentum e cultura
   ═══════════════════════════════════════════════════════════════════════════ */
.learn {
  height: 100%;
  overflow-y: auto;
  padding: 1.75rem clamp(1rem, 4vw, 3rem) 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* ── Hero ── */
.learn-hero {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding: 1.75rem 2rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(130% 150% at 100% 0%, var(--accent-muted), transparent 60%),
    var(--bg-secondary);
}
.learn-hero-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}
/* Faixa de stats + troféus embutida no hero */
.learn-hero-stats {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.learn-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.learn-stat-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.learn-stat.is-hot .learn-stat-num {
  color: var(--warning);
}
.learn-stat-den {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
}
.learn-stat-lbl {
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.learn-trophy-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-width: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.learn-trophy-entry:hover {
  border-color: var(--accent);
  background: var(--accent-muted, rgba(255, 255, 255, 0.03));
}
.learn-trophy-entry:hover .learn-trophy-cta {
  color: var(--accent);
}
.learn-hero-hello {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.learn-hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  text-wrap: balance;
}
.learn-hero-sub {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  max-width: 52ch;
  line-height: 1.5;
}
.learn-level {
  min-width: 264px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.learn-level-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.learn-level-num {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--tier, var(--text-primary));
}
/* No claro, escurece a cor da tier mantendo o matiz (ouro/prata puros reprovam contraste) */
:root[data-theme='light'] .learn-level-num {
  color: color-mix(in srgb, var(--tier, var(--text-primary)) 62%, #000);
}
.learn-level-name {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.learn-level-bar {
  height: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.learn-level-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--transition-slow);
}
.learn-level-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.learn-level-hint strong {
  color: var(--text-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Momentum (linha de status, não cards) ── */
.learn-momentum {
  display: flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  overflow: hidden;
}
.learn-momentum-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1.25rem;
  border-left: 1px solid var(--border-subtle);
}
.learn-momentum-cell:first-child {
  border-left: none;
}
.learn-momentum-num {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.learn-momentum-cell.is-hot .learn-momentum-num {
  color: var(--warning);
}
.learn-momentum-den {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-tertiary);
}
.learn-momentum-lbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Tira de badges dentro da entrada da Sala de Troféus */
.learn-trophy-icons {
  display: flex;
  gap: 0.35rem;
  min-width: 0;
  flex-wrap: nowrap;
}
.learn-trophy-ic {
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.28;
  filter: grayscale(0.7);
  transition: opacity 0.15s ease;
}
.learn-trophy-ic.is-earned {
  opacity: 1;
  filter: none;
}
.learn-trophy-cta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Seções ── */
.learn-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.learn-h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
}
.learn-h3-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.learn-h3-count {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Trilhas ── */
.learn-paths {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.875rem;
}
.learn-path {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.learn-path[role='button'] {
  cursor: pointer;
}
.learn-path:hover {
  transform: translateY(-2px);
  border-color: var(--border);
  background: var(--bg-elevated);
}
.learn-path--active {
  box-shadow: var(--shadow-glow);
}
.learn-path--done {
  opacity: 0.9;
}
.learn-path-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.learn-path-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.learn-path-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.learn-chip {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.learn-chip--level {
  background: var(--accent-subtle);
  color: var(--accent);
}
.learn-chip--done {
  background: var(--success-subtle);
  color: var(--accent);
}
.learn-path-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.learn-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.learn-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--transition-slow);
}
.learn-path-pct {
  min-width: 2.5rem;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.learn-path-next {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.learn-path-next strong {
  color: var(--text-primary);
  font-weight: 600;
}
.learn-path-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
}
.learn-fact {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.learn-fact strong {
  color: var(--text-primary);
}
.learn-path-cta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}
.learn-path-btn {
  pointer-events: none;
}
.learn-deadline {
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.learn-deadline.is-urgent {
  color: var(--warning);
  font-weight: 600;
}

/* ── Conquistas (roadmap de badges) ── */
.learn-badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}
.learn-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
  padding: 0.7rem 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.learn-badge.is-earned {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.learn-badge.is-earned:hover {
  transform: translateY(-2px);
}
.learn-badge.is-locked {
  opacity: 0.78;
}
.learn-badge-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.learn-badge.is-locked .learn-badge-icon {
  filter: grayscale(1);
  opacity: 0.5;
}
.learn-badge-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}
.learn-badge.is-locked .learn-badge-name {
  color: var(--text-secondary);
}
.learn-badge-hint {
  font-size: 0.65rem;
  line-height: 1.3;
  color: var(--text-tertiary);
}
.learn-badge.is-earned .learn-badge-hint {
  color: var(--accent);
  font-weight: 600;
}

/* ── Ranking ── */
.learn-rank {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.learn-rank-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}
.learn-rank-row:first-child {
  border-top: none;
}
.learn-rank-row.is-self {
  background: var(--accent-muted);
}
.learn-rank-pos {
  min-width: 2rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.learn-rank-row.is-top .learn-rank-pos {
  font-size: 1.15rem;
}
.learn-rank-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}
.learn-rank-you {
  color: var(--accent);
  font-weight: 600;
}
.learn-rank-xp {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.learn-rank-nudge {
  padding: 0.25rem 0.25rem 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ── Empty (onboarding) ── */
.learn-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: 3rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
}
.learn-empty-icon {
  font-size: 2.5rem;
}
.learn-empty-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
}
.learn-empty-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 44ch;
  line-height: 1.5;
}

/* ── Responsivo ── */
@media (max-width: 720px) {
  .learn-hero-main {
    grid-template-columns: 1fr;
  }
  .learn-level {
    min-width: 0;
  }
  .learn-hero-stats {
    gap: 1.25rem;
  }
  .learn-trophy-entry {
    margin-left: 0;
  }
}

/* ── Revisão do quiz (enunciado + alternativas + porquê) ── */
.quiz-review-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.quiz-review {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.quiz-review--wrong {
  border-color: var(--danger-soft);
}
.quiz-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.quiz-review-num {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}
.quiz-review-question {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-primary);
}
.quiz-review-options {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.quiz-review-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.quiz-review-option.is-correct {
  background: var(--success-subtle);
  border-color: var(--accent);
  color: var(--text-primary);
}
.quiz-review-option.is-wrong {
  background: var(--danger-subtle);
  border-color: var(--danger-soft);
  color: var(--text-primary);
}
.quiz-review-opt-key {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.quiz-review-option.is-correct .quiz-review-opt-key {
  background: var(--accent);
  color: var(--text-on-accent);
}
.quiz-review-option.is-wrong .quiz-review-opt-key {
  background: var(--danger-soft);
  color: var(--gray-950);
}
.quiz-review-opt-text {
  flex: 1;
  line-height: 1.4;
}
.quiz-review-opt-mark {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
}
.quiz-review-opt-mark--ok {
  color: var(--accent);
}
.quiz-review-opt-mark--bad {
  color: var(--danger-soft);
}
.quiz-review-why {
  padding: 0.6rem 0.8rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.quiz-review-why strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Badge de contagem no menu lateral ── */
.nav-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Aprovações de conteúdo (fluxo do gestor)
   ═══════════════════════════════════════════════════════════════════════════ */
.appr {
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.appr-head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.appr-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 60ch;
}
.appr-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.appr-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.appr-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.appr-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.appr-meta strong {
  color: var(--text-primary);
}
.appr-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.appr-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.appr-toggle {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.appr-content {
  padding: 0.875rem 1rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  max-height: 340px;
  overflow-y: auto;
}
.appr-reject {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}
.appr-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
.appr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 3rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
}
.appr-empty-icon {
  font-size: 2.25rem;
}
.appr-empty-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
}
.appr-empty-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Seletor de gestor do grupo (Admin) ── */
.groups-manager {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.groups-manager-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}
.groups-manager-hint {
  font-weight: 400;
  color: var(--text-secondary);
}

/* ─── Área social (curtidas + comentários) ─────────────────────────────────── */
.social-panel {
  width: 100%;
  max-width: 720px;
  margin: 1.5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}
.social-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.social-like {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2, var(--bg-secondary));
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}
.social-like:hover:not(:disabled) {
  border-color: var(--danger-soft);
  color: var(--danger-soft);
}
.social-like.is-liked {
  border-color: var(--danger-soft);
  color: var(--danger-soft);
  background: var(--danger-subtle);
}
.social-like-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.social-count {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.social-composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}
.social-textarea {
  width: 100%;
  resize: vertical;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}
.social-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.social-empty {
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-style: italic;
}
.social-comments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.social-comment {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
}
.social-comment-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}
.social-comment-author {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.social-comment-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.social-comment-del {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 0.2rem;
  line-height: 1;
}
.social-comment-del:hover {
  color: var(--danger-soft);
}
.social-comment-body {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  line-height: 1.45;
}

/* ─── Guia da jornada de conquistas ────────────────────────────────────────── */
.learn-h3-with-help {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.learn-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.learn-help-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  backdrop-filter: blur(2px);
}
.guide-modal {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}
.guide-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}
.guide-close:hover { color: var(--text-primary); }

.guide-head { margin-bottom: 1.25rem; padding-right: 1.5rem; }
.guide-title {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
  color: var(--text-primary);
}
.guide-sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}
.guide-sub strong { color: var(--accent); font-weight: 600; }

.guide-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  margin-bottom: 1.5rem;
}
.guide-status-now { display: flex; flex-direction: column; }
.guide-status-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }
.guide-status-level { font-size: 1.1rem; font-weight: 700; color: var(--tier, var(--text-primary)); }
:root[data-theme='light'] .guide-status-level { color: color-mix(in srgb, var(--tier, var(--text-primary)) 62%, #000); }
.guide-status-xp { font-size: 0.85rem; color: var(--text-secondary); }
.guide-status-xp strong { color: var(--text-primary); }

.guide-block { margin-bottom: 1.5rem; }
.guide-h3 { margin: 0 0 0.35rem; font-size: 1rem; color: var(--text-primary); }
.guide-note { margin: 0 0 0.75rem; font-size: 0.82rem; color: var(--text-secondary); }

.guide-ladder {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.guide-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  opacity: 0.55;
}
.guide-step.reached { opacity: 1; }
.guide-step.current {
  border-color: var(--accent);
  background: var(--accent-subtle);
  opacity: 1;
}
.guide-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text-on-accent, #04140d);
  font-size: 0.7rem;
  font-weight: 700;
}
.guide-step:not(.reached) .guide-step-num { background: var(--border); color: var(--text-secondary); }
.guide-step-name { font-size: 0.82rem; color: var(--text-primary); }
.guide-step-tag {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 700;
}

.guide-tracks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}
.guide-track {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-primary);
}
.guide-track-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}
.guide-track-title { font-weight: 700; font-size: 0.92rem; color: var(--text-primary); }
.guide-track-count { font-size: 0.78rem; color: var(--text-secondary); }
.guide-track-blurb { margin: 0 0 0.7rem; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; }
.guide-track-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.guide-badge-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  opacity: 0.62;
}
.guide-badge-row.earned { opacity: 1; }
.guide-badge-icon { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.guide-badge-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.guide-badge-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.guide-badge-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.35; }
.guide-badge-state { color: var(--accent); font-weight: 700; flex-shrink: 0; }

.guide-foot {
  margin-top: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: flex-start;
}
.guide-foot p { margin: 0; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }

/* ─── Trilha travada por tier ───────────────────────────────────────────────── */
.learn-path.is-locked {
  opacity: 0.72;
}
.learn-fact--tier {
  font-weight: 600;
  color: var(--tier);
}
:root[data-theme='light'] .learn-fact--tier:not(.is-locked) {
  color: color-mix(in srgb, var(--tier) 62%, #000);
}
.learn-fact--tier.is-locked {
  color: var(--text-secondary);
}
.learn-path-lock {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--bg-tertiary, var(--bg-secondary));
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Importação de trilha (admin) ──────────────────────────────────────────── */
.learn-admin-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.import-panel {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 860px;
}
.import-intro {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
}
.import-intro p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}
.import-prompt-btn.is-copied {
  background: var(--success, var(--accent));
}
.import-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.import-file input[type="file"] {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.import-textarea {
  width: 100%;
  resize: vertical;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  line-height: 1.5;
}
.import-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.import-groups-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.import-hint {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-style: italic;
}
.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Cursos dentro da trilha (aluno + admin) ───────────────────────────────── */
.learn-course-block {
  margin-bottom: 1.5rem;
}
.learn-course-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.learn-course-desc {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.learn-course-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.learn-course-done {
  color: var(--accent);
}
.admin-course-group {
  margin-bottom: 0.75rem;
}
.admin-course-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0.5rem 0.25rem;
  margin-top: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
.admin-course-count {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Imagem markdown com falha de carregamento — aviso limpo */
.md-image-fallback {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
}

/* ─── Cards de curso (acordeão) na visão da trilha ──────────────────────────── */
.course-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.course-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.course-card.is-open {
  border-color: var(--accent);
}
.course-card.is-done {
  border-color: var(--accent-subtle);
}
.course-card-head {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem 1.15rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.course-card-head:hover {
  background: var(--accent-muted, rgba(255, 255, 255, 0.02));
}
.course-card-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.95rem;
}
.course-card.is-done .course-card-index {
  background: var(--accent);
  color: var(--text-on-accent, #04140d);
}
.course-card-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}
.course-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.course-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card-facts {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}
.course-card-fact {
  font-size: 0.76rem;
  color: var(--text-secondary);
}
.course-card-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.status--done { background: var(--accent-subtle); color: var(--accent); }
.status--wip { background: var(--warning-subtle); color: var(--warning); }
.status--new { background: var(--bg-tertiary, var(--bg-primary)); color: var(--text-secondary); }
.course-card-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.course-card-pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.course-card-chevron {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.course-card-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--border-subtle, var(--border));
}
.course-card-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.course-card-body {
  padding: 0.25rem 1.1rem 1rem;
  border-top: 1px solid var(--border-subtle, var(--border));
}
.course-card-cert {
  padding: 0.75rem 0 0.25rem;
}

/* ─── Grade de cards de curso + modal de aulas ──────────────────────────────── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
}
.course-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.course-tile:hover {
  border-color: var(--accent);
  background: var(--accent-muted, rgba(255, 255, 255, 0.02));
  transform: translateY(-2px);
}
.course-tile.is-done {
  border-color: var(--accent-subtle);
}
.course-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.course-tile-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.9rem;
}
.course-tile.is-done .course-tile-index {
  background: var(--accent);
  color: var(--text-on-accent, #04140d);
}
.course-tile-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.course-tile-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-tile-facts {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.15rem;
}
.course-tile-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--border-subtle, var(--border));
  overflow: hidden;
  margin-top: 0.35rem;
}
.course-tile-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.course-tile-cta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.1rem;
}

.course-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  backdrop-filter: blur(2px);
}
.course-modal {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.6rem;
  box-shadow: var(--shadow-lg);
}
.course-modal-head {
  margin-bottom: 1rem;
  padding-right: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.9rem;
}
.course-modal-title {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  color: var(--text-primary);
}
.course-modal-desc {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.course-modal-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* ─── Conversas arquivadas (busca/gestão) ───────────────────────────────────── */

.archive-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  backdrop-filter: blur(2px);
}

.archive-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.archive-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.archive-modal-title {
  margin: 0;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.archive-modal-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.archive-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.archive-modal-search {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.archive-modal-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.archive-modal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.archive-modal-item:hover {
  background: var(--bg-hover);
}

.archive-modal-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.archive-modal-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-modal-item-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

/* ─── Modal de ajuda (/help) ─────────────────────────────────────────────────── */

.help-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  backdrop-filter: blur(2px);
}

.help-modal {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.help-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.help-modal-title {
  margin: 0;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.help-modal-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.help-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.help-modal-body {
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* ─── Capas (thumbnails) de trilha e curso ──────────────────────────────────── */
.learn-path { overflow: hidden; }
.learn-path-thumb {
  width: calc(100% + 2.5rem);
  height: 120px;
  object-fit: cover;
  margin: -1.1rem -1.25rem 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
.course-tile { overflow: hidden; }
.course-tile-thumb {
  width: calc(100% + 2.2rem);
  height: 120px;
  object-fit: cover;
  margin: -1rem -1.1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.course-modal-thumb {
  width: calc(100% + 3.2rem);
  height: 180px;
  object-fit: cover;
  margin: -1.6rem -1.6rem 1rem;
  border-radius: 16px 16px 0 0;
}

/* ─── Controle de capa (admin) ──────────────────────────────────────────────── */
.admin-course-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.thumb-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin: 0.5rem 0;
  flex-wrap: wrap;
}
.thumb-section-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 110px;
}
.thumb-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.thumb-preview {
  width: 88px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 52px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-style: italic;
}
.thumb-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.thumb-actions label {
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — tela dedicada (não é o layout desktop espremido). Só Chat, sem
   Wiki/Aprender/Admin. Usa os MESMOS tokens semânticos do tema (claro/escuro
   funcionam de graça), mas layout e espaçamento pensados pra toque/celular.
   ═══════════════════════════════════════════════════════════════════════════ */

.mob-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-app);
}

.mob-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(env(safe-area-inset-top) + 0.875rem) 1rem 0.875rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mob-header-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.mob-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.mob-header-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mob-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.mob-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mob-icon-btn:active {
  background: var(--bg-hover);
}

/* ThemeToggle é feito pra nav rail vertical (ícone + legenda "Tema" embaixo) —
 * no header mobile vira só o ícone, do mesmo tamanho dos outros botões. */
.mob-header-actions .nav-theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.mob-header-actions .nav-theme-toggle span {
  display: none;
}

.mob-session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem calc(env(safe-area-inset-bottom) + 5.5rem);
  -webkit-overflow-scrolling: touch;
}

.mob-session-group-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1rem 0.5rem 0.375rem;
}

.mob-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.875rem 0.75rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.mob-session-item:active {
  background: var(--bg-hover);
}

.mob-session-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.mob-session-item-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mob-session-mode-badge {
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.mob-session-item--unread {
  background: var(--warning-subtle);
}

.mob-session-item--unread .mob-session-item-title {
  font-weight: 700;
}

.mob-session-delete {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  flex-shrink: 0;
  cursor: pointer;
}

.mob-session-delete:active {
  background: var(--bg-hover);
  color: var(--danger, #e5484d);
}

.mob-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  gap: 0.375rem;
}

.mob-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.mob-empty-hint {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.mob-session-archive-link {
  flex-shrink: 0;
  width: 100%;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  padding: 0.75rem 1rem calc(env(safe-area-inset-bottom) + 0.75rem);
  text-align: left;
  cursor: pointer;
}

.mob-fab {
  position: fixed;
  right: 1.25rem;
  bottom: calc(env(safe-area-inset-bottom) + 1.5rem);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  z-index: 30;
}

.mob-fab:active {
  filter: brightness(0.92);
}

/* ── Folha deslizante (nova conversa) ── */

.mob-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim, rgba(0, 0, 0, 0.5));
  z-index: 100;
  display: flex;
  align-items: flex-end;
  animation: mob-fade-in 0.15s ease-out;
}

@keyframes mob-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes mob-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.mob-sheet {
  width: 100%;
  max-height: 80vh;
  background: var(--bg-elevated);
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 0.625rem 1rem calc(env(safe-area-inset-bottom) + 1rem);
  display: flex;
  flex-direction: column;
  animation: mob-sheet-up 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
}

.mob-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong, var(--border-subtle));
  margin: 0.25rem auto 0.75rem;
  flex-shrink: 0;
}

.mob-sheet-title {
  display: flex;
  align-items: center;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 0.25rem 0.75rem;
}

.mob-sheet-back {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  padding: 0 0.5rem 0 0;
  cursor: pointer;
}

.mob-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mob-sheet-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
}

.mob-sheet-option:active:not(:disabled) {
  background: var(--bg-hover);
}

.mob-sheet-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mob-sheet-option-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--picker-accent, var(--accent));
  flex-shrink: 0;
}

.mob-sheet-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.mob-sheet-option-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mob-sheet-option-desc {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.mob-sheet-cancel {
  margin-top: 0.5rem;
  padding: 0.875rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Conversa (reaproveita o ChatPage — só ajusta pra toque/tela cheia) ── */

.mob-thread {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mob-thread .chat-page {
  height: 100%;
}

.mob-thread .chat-topbar {
  padding-top: calc(env(safe-area-inset-top) + 0.75rem);
}

.mob-thread .chat-topbar-back {
  font-size: 1.5rem;
  padding: 0.25rem 0.75rem 0.25rem 0;
}

.mob-thread .message-bubble {
  max-width: 88%;
}

.mob-thread .chat-input-area {
  padding: 0.625rem 0.75rem calc(env(safe-area-inset-bottom) + 0.625rem);
}

.mob-thread .chat-textarea {
  font-size: 1rem; /* ≥16px evita o zoom automático do Safari/iOS ao focar */
  line-height: 1.4;
  padding: 0.625rem 0.875rem;
  max-height: 140px; /* rola por dentro em vez de crescer a tela toda num post grande */
}

.mob-thread .btn-audio {
  width: 40px;
  height: 40px;
}

/* Botão de enviar vira um ícone circular (seta) — mais compacto e familiar
   (WhatsApp/Telegram) do que o pill "Enviar" de texto, que sozinho já ocupava
   quase 1/4 da largura útil de uma tela pequena. */
.btn-send-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.125rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
