/* ==========================================================================
   VARIÁVEIS E CONFIGURAÇÕES DE DESIGN SYSTEM - NORMA DIGITAL
   Cores Oficiais: #193D4A (Teal Escuro), #214655 (Teal Médio), #FBB03B (Âmbar Ouro)
   ========================================================================== */
:root {
  /* Paleta Oficial Norma Digital */
  --norma-teal-dark: #193D4A;
  --norma-teal-medium: #214655;
  --norma-amber-gold: #FBB03B;

  /* Tema Claro (Padrão) */
  --bg-app: #f4f7f8;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-card-muted: #f1f5f9;
  --bg-header: #ffffff;
  --bg-input: #ffffff;
  --bg-button-secondary: #ffffff;
  --bg-button-secondary-hover: #f1f5f9;
  --bg-chat-bubble-user: #193D4A;
  --bg-chat-bubble-ai: #ffffff;
  
  /* Cores de Destaque e Gradientes */
  --accent-color: #193D4A;
  --accent-secondary: #214655;
  --accent-gold: #FBB03B;
  --accent-glow: rgba(251, 176, 59, 0.15);
  --gradient-accent: linear-gradient(135deg, #193D4A 0%, #214655 100%);
  --gradient-accent-hover: linear-gradient(135deg, #122c36 0%, #193D4A 100%);
  --gradient-glow: 0 4px 14px rgba(25, 61, 74, 0.22);
  --gradient-gold: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%);
  
  /* Cores de Estado */
  --color-success: #10b981;
  --color-warning: #FBB03B;
  --color-danger: #ef4444;
  --color-locked: #94a3b8;
  
  /* Cores de Texto */
  --text-primary: #0e2229;
  --text-secondary: #2b4955;
  --text-muted: #6f8c98;
  --text-user: #ffffff;
  
  /* Bordas e Efeitos Visuais */
  --border-color: #dbe4e8;
  --border-focus: #FBB03B;
  --glass-blur: blur(12px);
  --shadow-premium: 0 10px 25px -5px rgba(25, 61, 74, 0.08), 0 8px 10px -6px rgba(25, 61, 74, 0.04);
  
  /* Fontes */
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* ==========================================================================
   TEMA ESCURO (DARK MODE) - NORMA DIGITAL
   ========================================================================== */
body.theme-dark {
  --bg-app: #0c1a20;
  --bg-sidebar: #11242c;
  --bg-card: #132b34;
  --bg-card-subtle: #0f232a;
  --bg-card-muted: #173642;
  --bg-header: #11242c;
  --bg-input: #0d1e24;
  --bg-button-secondary: #173642;
  --bg-button-secondary-hover: #1d4352;
  --bg-chat-bubble-user: #FBB03B;
  --bg-chat-bubble-ai: #142e38;

  --accent-color: #FBB03B;
  --accent-secondary: #214655;
  --accent-gold: #FBB03B;
  --accent-glow: rgba(251, 176, 59, 0.2);
  --gradient-accent: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%);
  --gradient-accent-hover: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-glow: 0 4px 14px rgba(251, 176, 59, 0.28);

  --border-color: #1f3f4c;
  --border-focus: #FBB03B;

  --text-primary: #f4f8f9;
  --text-secondary: #cbe0e7;
  --text-muted: #8da7b2;
  --text-user: #0c1a20;
  --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.25);
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout Geral - 2 Colunas (Barra Lateral Esquerda + Chat Expandido) */
.app-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: 100%;
  height: 100%;
  max-height: 100%;
  width: 100vw;
  overflow: hidden;
  background-image: 
    radial-gradient(at 10% 20%, rgba(25, 61, 74, 0.03) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(251, 176, 59, 0.03) 0px, transparent 50%);
  transition: grid-template-columns 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   PAINEL LATERAL ESQUERDO: BARRA DE NAVEGAÇÃO & API
   ========================================================================== */
.sidebar-left {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 24px 20px;
  gap: 16px;
  width: 300px;
  min-width: 300px;
  box-sizing: border-box;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.22s ease,
              visibility 0.28s;
}

/* Estado Recolhido da Barra Lateral no Desktop */
.app-container.sidebar-collapsed {
  grid-template-columns: 0px 1fr;
}

.app-container.sidebar-collapsed .sidebar-left {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  border-right-color: transparent;
}

/* Marca/Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
  position: relative;
}

.logo-icon {
  background: linear-gradient(135deg, #193D4A 0%, #255162 100%);
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.35rem;
  color: #FBB03B;
  box-shadow: 0 4px 14px rgba(25, 61, 74, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(251, 176, 59, 0.35);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  user-select: none;
}

.brand:hover .logo-icon {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(25, 61, 74, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.brand-text h1 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1;
  color: var(--text-primary);
  margin: 0;
}

.brand-badge {
  font-family: var(--font-title);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(251, 176, 59, 0.14);
  color: #b45309;
  border: 1px solid rgba(251, 176, 59, 0.35);
  line-height: 1.2;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.brand-subtitle,
.brand-text span:not(.brand-badge) {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

/* Gerenciador de Projetos */
.project-manager {
  margin-bottom: 4px;
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.project-header h2 {
  font-family: var(--font-title);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1.2px;
  font-weight: 700;
}

.icon-btn-small {
  background: rgba(25, 61, 74, 0.06);
  border: 1px solid rgba(25, 61, 74, 0.18);
  color: var(--accent-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  transition: all 0.2s ease;
}

.icon-btn-small:hover {
  background: var(--accent-color);
  color: #ffffff;
  transform: scale(1.05);
}

.icon-btn-small i {
  width: 15px;
  height: 15px;
}

.project-manager {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 10px;
}

.projects-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.projects-list::-webkit-scrollbar {
  width: 4px;
}

.projects-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

/* Atalho para Artefatos na Barra Lateral */
.sidebar-nav {
  margin-top: 4px;
  margin-bottom: 4px;
}

.nav-artifacts-btn {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid rgba(25, 61, 74, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(25, 61, 74, 0.06);
}

.nav-artifacts-btn:hover {
  background: rgba(25, 61, 74, 0.05);
  border-color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 61, 74, 0.12);
}

.nav-artifacts-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-artifacts-content i {
  width: 18px;
  height: 18px;
  color: var(--accent-color);
}

.nav-artifacts-content span {
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.nav-artifacts-btn:hover .nav-arrow {
  transform: translateX(3px);
  color: var(--accent-color);
}

/* Configurações da API */
.api-config {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  margin-top: auto;
}

.config-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.config-header i {
  width: 16px;
  height: 16px;
  color: var(--accent-color);
}

.config-header h3 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.config-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.3;
}

.model-select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.model-select-group label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.model-select-group select {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.model-select-group select:focus {
  border-color: var(--border-focus);
}

.input-group {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.input-group input {
  flex: 1;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  transition: border-color 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.input-group button {
  background: var(--gradient-accent);
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.input-group button:hover {
  opacity: 0.9;
}

.input-group button i {
  width: 15px;
  height: 15px;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-text {
  font-size: 0.7rem;
  font-weight: 500;
}

.api-status.online .status-indicator {
  background-color: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}
.api-status.online .status-text {
  color: var(--color-success);
}

.api-status.offline .status-indicator {
  background-color: var(--color-warning);
  box-shadow: 0 0 6px var(--color-warning);
}
.api-status.offline .status-text {
  color: var(--text-secondary);
}

.mode-notice {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
}

/* ==========================================================================
   PAINEL CENTRAL: CHAT & BARRA ADD HORIZONTAL
   ========================================================================== */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background-color: #f8fafc;
}

.chat-header {
  height: 60px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: var(--glass-blur);
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 10;
}

.agent-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.agent-avatar span {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
}

.pulse-ring {
  border: 2px solid var(--accent-color);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: absolute;
  animation: avatarPulse 2.5s infinite ease-out;
  opacity: 0;
}

@keyframes avatarPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.agent-meta h2 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
  animation: dotPulse 1.5s infinite ease-in-out;
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.agent-badge span:last-child {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   BARRA HORIZONTAL DO CICLO ADD (Abaixo do Cabeçalho)
   ========================================================================== */
/* No Modo Artefatos (foco total em leitura e edição de documentos), o stepper é ocultado */
.workspace-main[data-view-mode="artifacts"] .chat-steps-bar {
  display: none !important;
}

.chat-steps-bar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 4px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  z-index: 5;
  flex-shrink: 0;
  min-height: 34px;
}

.horizontal-steps {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.horizontal-steps .step-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  cursor: default;
  user-select: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.horizontal-steps .step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.68rem;
  color: var(--text-secondary);
  background-color: #ffffff;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.horizontal-steps .step-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.horizontal-steps .step-title {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.25s ease;
}

.horizontal-steps .step-status {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horizontal-steps .step-arrow {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Estados da Barra Horizontal (Stepper Informativo) */
.horizontal-steps .step-item.active {
  background-color: rgba(25, 61, 74, 0.06);
  border-color: var(--norma-teal-dark);
  box-shadow: 0 2px 8px rgba(25, 61, 74, 0.08);
}

.horizontal-steps .step-item.active .step-num {
  border-color: var(--norma-teal-dark);
  background: var(--gradient-accent);
  color: white;
  box-shadow: 0 2px 6px rgba(25, 61, 74, 0.25);
}

.horizontal-steps .step-item.active .step-title {
  color: var(--norma-teal-dark);
}

.horizontal-steps .step-item.completed {
  border-color: rgba(16, 185, 129, 0.35);
  background-color: rgba(16, 185, 129, 0.05);
}

.horizontal-steps .step-item.completed .step-num {
  border-color: #10b981;
  background-color: #ecfdf5;
  color: #059669;
}

.horizontal-steps .step-item.completed .step-title {
  color: var(--text-primary);
}

.horizontal-steps .step-item.upcoming {
  opacity: 0.72;
  background-color: #fafbfc;
}

/* Área de mensagens do chat */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar,
.editor-body::-webkit-scrollbar,
.projects-list::-webkit-scrollbar,
.artifact-content-box::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.editor-body::-webkit-scrollbar-track,
.projects-list::-webkit-scrollbar-track,
.artifact-content-box::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.editor-body::-webkit-scrollbar-thumb,
.projects-list::-webkit-scrollbar-thumb,
.artifact-content-box::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.editor-body::-webkit-scrollbar-thumb:hover,
.projects-list::-webkit-scrollbar-thumb:hover,
.artifact-content-box::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.28);
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: messageAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.message.ai {
  align-self: flex-start;
}

.message-sender {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.message-bubble {
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.message.user .message-bubble {
  background-color: var(--bg-chat-bubble-user);
  color: var(--text-user);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(25, 61, 74, 0.18);
}

.message.ai .message-bubble {
  background-color: var(--bg-chat-bubble-ai);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Markdown styling inside Chat Bubble */
.message-bubble p {
  margin-bottom: 10px;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}
.message.ai .message-bubble strong {
  font-weight: 600;
  color: #0f172a;
}
.message.user .message-bubble strong {
  font-weight: 600;
  color: #ffffff;
}
.message-bubble ul, .message-bubble ol {
  margin-left: 20px;
  margin-bottom: 10px;
}
.message-bubble li {
  margin-bottom: 4px;
}
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
  font-family: var(--font-title);
  font-weight: 700;
  margin: 12px 0 6px 0;
}

.message.ai .message-bubble h1,
.message.ai .message-bubble h2,
.message.ai .message-bubble h3 {
  color: #0f172a;
}

.message.user .message-bubble h1,
.message.user .message-bubble h2,
.message.user .message-bubble h3 {
  color: #ffffff;
}

/* Efeito de carregando (Typing Indicator) */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  align-items: center;
  justify-content: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
  animation: typingDot 1.4s infinite ease-in-out;
}

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

@keyframes typingDot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Input Área do Chat */
.chat-input-area {
  padding: 16px 24px 20px 24px;
  border-top: 1px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--glass-blur);
}

.input-box {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.input-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(251, 176, 59, 0.25);
}

.input-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 6px 2px;
  max-height: 120px;
}

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

.input-box textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background: var(--gradient-accent);
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--gradient-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gradient-accent-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary i {
  width: 17px;
  height: 17px;
}

.btn-secondary {
  background-color: var(--bg-button-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MODAL DE ARTEFATOS GERADOS & DOCUMENTAÇÃO
   ========================================================================== */
.modal-content.modal-artifacts {
  width: 1180px;
  max-width: 95vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-artifacts-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
  overflow: hidden;
  background-color: #f1f5f9;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-title-icon {
  width: 26px;
  height: 26px;
  color: var(--accent-color);
}

.modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.artifact-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #f8fafc;
  overflow: hidden;
  height: 100%;
}

.artifact-toolbar {
  height: 52px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  z-index: 2;
}

#artifact-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.6px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover:not(:disabled) {
  color: var(--accent-color);
  background-color: rgba(25, 61, 74, 0.08);
  border-color: rgba(25, 61, 74, 0.25);
  transform: translateY(-1px);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn i {
  width: 16px;
  height: 16px;
}

.artifact-content-box {
  flex: 1;
  padding: 32px 24px;
  overflow-y: auto;
  background-color: #f1f5f9;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 80px;
  line-height: 1.5;
}

/* Visualizador Markdown estilo Folha A4 */
.markdown-body {
  max-width: 900px;
  margin: 0 auto;
  background-color: #ffffff;
  padding: 48px 56px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-primary);
  min-height: 100%;
}

.markdown-body h1, 
.markdown-body h2, 
.markdown-body h3 {
  font-family: var(--font-title);
  color: #0f172a;
  margin-top: 20px;
  margin-bottom: 10px;
  font-weight: 700;
}

.markdown-body h1 { font-size: 1.35rem; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.markdown-body h2 { font-size: 1.15rem; }
.markdown-body h3 { font-size: 1rem; }

.markdown-body p {
  margin-bottom: 12px;
}

.markdown-body ul, 
.markdown-body ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body code {
  background-color: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.82rem;
  color: #e11d48;
}

.markdown-body pre {
  background-color: #0f172a;
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid #334155;
  margin-bottom: 14px;
}

.markdown-body pre code {
  background-color: transparent;
  padding: 0;
  color: #f8fafc;
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent-gold);
  background-color: rgba(251, 176, 59, 0.08);
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 0 6px 6px 0;
  color: #334155;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 18px 0;
}

/* Modo Editor no Painel de Artefatos */
.artifact-editor-textarea {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  height: 100%;
  min-height: 600px;
  background-color: #ffffff;
  border: 1.5px solid var(--accent-color);
  border-radius: 8px;
  padding: 36px 44px;
  color: #0f172a;
  font-family: var(--font-body), monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  resize: none;
  outline: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(25, 61, 74, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s;
  display: block;
}

.artifact-editor-textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 0 3px var(--accent-glow);
}

.save-edit-btn {
  color: #15803d !important;
  border-color: #bbf7d0 !important;
  background: #f0fdf4 !important;
}

.save-edit-btn:hover {
  background: #15803d !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.3);
}

/* ==========================================================================
   ESTILOS DE ANEXO DE ARQUIVOS
   ========================================================================== */
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(25, 61, 74, 0.06);
  border: 1px solid rgba(25, 61, 74, 0.2);
  border-radius: 8px;
  padding: 6px 12px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--accent-color);
  animation: messageAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: fit-content;
}

.attachment-preview span {
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.attachment-preview button:hover {
  color: var(--color-danger);
  background-color: rgba(239, 68, 68, 0.1);
}

.attach-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  align-self: center;
  margin-bottom: 2px;
}

.attach-btn:hover {
  color: var(--accent-color);
  background-color: rgba(25, 61, 74, 0.08);
}

.mic-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  align-self: center;
  margin-bottom: 2px;
}

.mic-btn:hover:not(:disabled) {
  color: var(--accent-color);
  background-color: rgba(25, 61, 74, 0.08);
}

.mic-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.mic-btn i {
  width: 16px;
  height: 16px;
}

/* Estado de gravação ativa */
.mic-btn.recording {
  color: white !important;
  background-color: var(--color-danger) !important;
  animation: micPulse 1.5s infinite ease-in-out;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

@keyframes micPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
  }
}

/* ==========================================================================
   MODAL DE NOVO PROJETO & GERAL
   ========================================================================== */
/* ==========================================================================
   SISTEMA UNIVERSAL DE FORMULÁRIOS E MODAIS (DESIGN SYSTEM)
   ========================================================================== */

/* Linhas e Colunas de Formulário */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-bottom: 14px;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  width: 100%;
}

.form-group label,
.form-col label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.form-help {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: -2px;
  margin-bottom: 4px;
}

/* Estilização Geral de Inputs, Selects e Textareas */
input[type="text"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-primary);
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  line-height: 1.5;
  box-sizing: border-box;
  transition: all 0.2s ease;
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="search"]:hover,
select:hover,
textarea:hover {
  border-color: #94a3b8;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background-color: #ffffff;
}

/* Seta Customizada Elegante para Todos os Selects */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 38px;
  cursor: pointer;
}

select:disabled {
  background-color: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.75;
}

/* Modais do Sistema */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-content {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 580px;
  max-width: 95vw;
  max-height: 90vh;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalAppear 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalAppear {
  0% { transform: scale(0.96) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-content.modal-sources,
.modal-content.modal-qa {
  width: 900px !important;
}

.modal-content.modal-export {
  width: 540px !important;
}

.modal-content.modal-admin {
  width: 680px !important;
}

.modal-content.modal-dialog-card {
  width: 560px !important;
  max-width: 94vw;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

.dialog-message {
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.55;
  margin: 0;
}

.dialog-textarea {
  min-height: 130px;
  max-height: 320px;
  resize: vertical;
  line-height: 1.55;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 10px 14px;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  background: var(--bg-card, #ffffff);
  color: var(--text-primary, #0f172a);
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dialog-textarea:focus {
  outline: none;
  border-color: var(--primary-color, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dialog-input-hint {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  margin-top: 6px;
}

/* Botão Excluir / Perigo nos Modais - Estilo idêntico ao Cancelar, com borda e texto em vermelho */
.btn-danger,
.modal-footer button.btn-danger,
#dialog-confirm-btn.btn-danger {
  background-color: #ffffff !important;
  border: 1px solid #ef4444 !important;
  color: #dc2626 !important;
  min-height: 36px !important;
  height: 36px !important;
  width: auto !important;
  padding: 8px 18px !important;
  border-radius: 8px !important;
  font-family: var(--font-body) !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  box-sizing: border-box !important;
}

.btn-danger:hover,
.modal-footer button.btn-danger:hover,
#dialog-confirm-btn.btn-danger:hover {
  background-color: #fef2f2 !important;
  border-color: #dc2626 !important;
  color: #b91c1c !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15) !important;
}

.btn-danger:active,
.modal-footer button.btn-danger:active,
#dialog-confirm-btn.btn-danger:active {
  background-color: #fee2e2 !important;
  transform: translateY(1px) !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.modal-title-group i {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--accent-color);
}

.modal-header h2 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

.modal-footer button {
  min-height: 36px;
  height: 36px;
  width: auto;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.modal-footer button.btn-secondary,
button#dialog-cancel-btn {
  background-color: var(--bg-button-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.modal-footer button.btn-secondary:hover,
button#dialog-cancel-btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.file-drop-area {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  background-color: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.file-drop-area:hover, .file-drop-area.dragover {
  border-color: var(--accent-color);
  background-color: rgba(25, 61, 74, 0.04);
}

.file-drop-area i {
  width: 28px;
  height: 28px;
  color: var(--accent-color);
}

.file-drop-area span {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.modal-file-list {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

.modal-file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f1f5f9;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.modal-file-list li span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  font-weight: 500;
}

.modal-file-list li button {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.modal-file-list li button:hover {
  background-color: rgba(239, 68, 68, 0.1);
  border-radius: 4px;
}

.modal-file-list li button i {
  width: 14px;
  height: 14px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   CONTROLE DE ARTEFATOS (APROVAÇÃO, SELEÇÃO E EDIÇÃO MANUAL)
   ========================================================================== */

/* Botão de aprovar na mensagem da IA */
.message-actions-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-approve-msg {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-approve-msg:hover {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(22, 163, 74, 0.15);
}

.btn-approve-msg i {
  width: 14px;
  height: 14px;
  color: #16a34a;
  transition: transform 0.2s ease;
}

.btn-approve-msg:hover i {
  transform: scale(1.15);
}

/* Menu Flutuante de Seleção (Selection Tooltip) */
.selection-popup {
  position: absolute;
  z-index: 10000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(25, 61, 74, 0.25);
  border-radius: 30px;
  padding: 4px 6px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 0 10px rgba(25, 61, 74, 0.08);
  animation: tooltipPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes tooltipPop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.btn-selection-action {
  background: transparent;
  border: none;
  color: #334155;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.btn-selection-action:hover {
  background: var(--gradient-accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(25, 61, 74, 0.25);
}

.btn-selection-action i {
  width: 14px;
  height: 14px;
  color: var(--accent-color);
}

.btn-selection-action:hover i {
  color: #ffffff;
}

/* ==========================================================================
   FASE 2: SELETOR DE PERFIS (RBAC) E BUSCA / FILTROS DA SIDEBAR
   ========================================================================== */
.profile-switcher-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.profile-switcher-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-switcher-header i {
  width: 14px;
  height: 14px;
  color: var(--accent-color);
}

.profile-switcher-header label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
}

.role-select-wrapper {
  position: relative;
  width: 100%;
}

.role-select-wrapper select,
select#role-select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.role-select-wrapper select:focus,
select#role-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.role-badge-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 2px 0;
}

.role-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
  flex-shrink: 0;
}

body.role-pmo .role-status-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

body.role-admin .role-status-dot {
  background-color: var(--norma-amber-gold);
  box-shadow: 0 0 6px rgba(251, 176, 59, 0.5);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 30px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  background: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.project-filter-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 3px;
}

.filter-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 5px 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab.active {
  background: #ffffff;
  color: var(--accent-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
}

.project-item:hover {
  background: #f8fafc;
  border-color: var(--border-color);
}

.project-item.active {
  background: rgba(25, 61, 74, 0.08);
  border-color: var(--norma-teal-dark);
}

.project-item.active .project-item-name {
  color: var(--norma-teal-dark);
  font-weight: 700;
}

.project-item.active .project-item-meta span {
  color: var(--norma-teal-medium);
}

.project-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

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

.project-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.project-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.project-item:hover .project-actions {
  opacity: 1;
}

.btn-item-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-item-action:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-item-action.active-pin {
  color: #f59e0b;
}

.admin-link-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.admin-link-btn:hover {
  background: #f1f5f9;
  color: var(--accent-color);
  border-color: var(--accent-color);
}

/* ==========================================================================
   WORKSPACE HEADER & FERRAMENTAS
   ========================================================================== */
.workspace-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  min-height: 52px;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 900;
}

.workspace-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.project-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

#header-project-name {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.project-tags-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  overflow: hidden;
}

.badge-tag {
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.tag-modality {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.25);
  font-weight: 600;
}

.tag-type {
  background: rgba(251, 176, 59, 0.15);
  color: #92400e;
  border: 1px solid rgba(251, 176, 59, 0.35);
  font-weight: 600;
}

.tag-client {
  background: rgba(25, 61, 74, 0.08);
  color: var(--norma-teal-dark);
  border: 1px solid rgba(25, 61, 74, 0.2);
  font-weight: 600;
}

.tag-updated {
  background: #f1f5f9;
  color: var(--text-muted);
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.view-mode-selector {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 6px;
  gap: 2px;
}

.view-mode-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.2;
}

.view-mode-btn i {
  width: 13px;
  height: 13px;
}

.view-mode-btn.active {
  background: #ffffff;
  color: var(--accent-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 2px;
}

.btn-tool {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.2;
}

.btn-tool i {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
}

.btn-tool:hover {
  background: #f8fafc;
  color: var(--accent-color);
  border-color: var(--accent-color);
}

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

.badge-count {
  background: #e2e8f0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

/* ==========================================================================
   DROPDOWN DE OPÇÕES DO HEADER (Contexto, Fontes, QA, Tokens, Exportar)
   ========================================================================== */
.header-tools-wrapper {
  position: relative;
  display: inline-flex;
  z-index: 950;
}

.header-tools-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.header-tools-trigger .dropdown-chevron-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.header-tools-trigger.active .dropdown-chevron-icon {
  transform: rotate(180deg);
}

.header-tools-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  min-width: 220px;
  z-index: 99999;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeInDown 0.18s ease-out;
}

.header-dropdown-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.header-dropdown-item:hover {
  background: rgba(25, 61, 74, 0.07);
  color: var(--norma-teal-dark);
}

.header-dropdown-item i {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: color 0.15s;
}

.header-dropdown-item:hover i {
  color: var(--norma-teal-dark);
}

.header-dropdown-item.btn-tokens:hover i {
  color: #d97706;
}

.header-dropdown-item.btn-export:hover i {
  color: var(--norma-teal-dark);
}

.header-dropdown-item .dropdown-item-label {
  flex: 1;
}

.header-dropdown-item .badge-count {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: #e2e8f0;
  color: var(--text-secondary);
  font-weight: 700;
}

.header-dropdown-item .badge-tokens {
  background: rgba(251, 176, 59, 0.18);
  color: #b45309;
}

.header-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 6px;
}

.export-dropdown-wrapper {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-premium);
  min-width: 220px;
  z-index: 1000;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.82rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}

.dropdown-menu a i {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.dropdown-menu a:hover {
  background: #f8fafc;
  color: var(--accent-color);
}

.dropdown-menu a:hover i {
  color: var(--accent-color);
}

/* Modal de Exportação Consolidada */
.export-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.export-option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.export-option-card:hover {
  border-color: var(--accent-color);
  background: rgba(25, 61, 74, 0.03);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 61, 74, 0.08);
}

.export-option-card:active {
  transform: translateY(0);
}

.export-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.export-icon-box i {
  width: 22px;
  height: 22px;
}

.export-icon-box.doc {
  background: #eff6ff;
  color: #2563eb;
}

.export-icon-box.md {
  background: #f0fdfa;
  color: #0f766e;
}

.export-icon-box.json {
  background: #fffbeb;
  color: #d97706;
}

.export-icon-box.pdf {
  background: #fef2f2;
  color: #dc2626;
}

.export-icon-box.narration {
  background: #f5f3ff;
  color: #7c3aed;
}

.export-card-content {
  flex: 1;
  min-width: 0;
}

.export-card-content h4 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.export-card-content p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.35;
}

.export-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.export-option-card:hover .export-arrow {
  color: var(--accent-color);
  transform: translateX(3px);
}

/* Dark Mode para Modal de Exportação */
body.theme-dark .export-option-card {
  background: #11242c;
  border-color: #1f3f4c;
}

body.theme-dark .export-option-card:hover {
  background: #16303b;
  border-color: var(--norma-accent-gold);
}

body.theme-dark .export-card-content h4 {
  color: #f1f5f9;
}

body.theme-dark .export-card-content p {
  color: #94a3b8;
}

body.theme-dark .export-icon-box.doc {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
}

body.theme-dark .export-icon-box.md {
  background: rgba(15, 118, 110, 0.2);
  color: #2dd4bf;
}

body.theme-dark .export-icon-box.json {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
}

body.theme-dark .export-icon-box.pdf {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

body.theme-dark .export-icon-box.narration {
  background: rgba(124, 58, 237, 0.2);
  color: #a78bfa;
}

/* ==========================================================================
   FASE 3: LAYOUT DO WORKSPACE (CHAT + SPLIT VIEW + ARTEFATOS)
   ========================================================================== */
.workspace-layout {
  display: flex;
  flex: 1 1 0%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
}

/* Modo Conversa */
.workspace-layout.mode-chat {
  display: flex;
  flex-direction: row;
}

.workspace-layout.mode-chat .chat-section {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 0%;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.workspace-layout.mode-chat .editor-section {
  display: none !important;
}

/* Modo Dividido (Split View) */
.workspace-layout.mode-split {
  display: flex;
  flex-direction: row;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.workspace-layout.mode-split .chat-section {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 0%;
  width: 48%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
}

.workspace-layout.mode-split .editor-section {
  display: flex !important;
  flex-direction: column;
  flex: 1.1 1 0%;
  width: 52%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* Modo Artefatos */
.workspace-layout.mode-artifacts {
  display: flex;
  flex-direction: row;
}

.workspace-layout.mode-artifacts .chat-section {
  display: none !important;
}

.workspace-layout.mode-artifacts .editor-section {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 0%;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ==========================================================================
   CHAT SECTION E AÇÕES CONTEXTUAIS NAS RESPOSTAS
   ========================================================================== */
.chat-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  background: #ffffff;
  overflow: hidden;
}

.chat-messages {
  flex: 1 1 0%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.message-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.message-card.user {
  align-self: flex-end;
  max-width: 750px;
}

.message-bubble {
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.message-bubble.user {
  background: var(--bg-chat-bubble-user);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.message-bubble.ai {
  background: var(--bg-chat-bubble-ai);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.message-bubble.ai h1, .message-bubble.ai h2, .message-bubble.ai h3 {
  margin-top: 14px;
  margin-bottom: 8px;
  font-family: var(--font-title);
}

.message-bubble.ai ul, .message-bubble.ai ol {
  padding-left: 20px;
  margin: 8px 0;
}

.message-bubble.ai table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.88rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.message-bubble.ai th, .message-bubble.ai td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.message-bubble.ai th {
  background: #f8fafc;
  font-weight: 600;
}

/* Barra de Ações Contextuais na Mensagem da AIDIA */
.msg-context-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
}

.btn-msg-action {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-msg-action i {
  width: 13px;
  height: 13px;
}

.btn-msg-action:hover {
  background: #f1f5f9;
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.btn-msg-action.btn-action-primary {
  background: rgba(25, 61, 74, 0.08);
  color: var(--norma-teal-dark);
  border-color: var(--norma-teal-dark);
}

.btn-msg-action.btn-action-primary:hover {
  background: var(--norma-teal-dark);
  color: #ffffff;
}

/* ==========================================================================
   FASE 6 & 7: EDITOR DE ARTEFATOS (A4 SHEET & VISUAL BRIEFING)
   ========================================================================== */
.editor-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  background: #f8fafc;
  overflow: hidden;
}

.editor-header,
.editor-header-unified {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  min-height: 46px;
  max-height: 46px;
  flex-shrink: 0;
  gap: 12px;
  position: relative;
  z-index: 100;
}

.artifacts-dropdown-wrapper {
  position: relative;
  flex: 1;
  max-width: 580px;
  min-width: 0;
}

.btn-artifacts-dropdown {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-artifacts-dropdown:hover {
  border-color: var(--accent-color, #FBB03B);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(251, 176, 59, 0.18);
}

.btn-artifacts-dropdown.active {
  border-color: #193D4A;
  box-shadow: 0 0 0 3px rgba(25, 61, 74, 0.12);
  background: #ffffff;
}

.editor-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}

.actions-sep {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 2px;
}

.btn-editor-action {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  line-height: 1.2;
}

.btn-editor-action i {
  width: 13px;
  height: 13px;
}

.btn-editor-action.btn-create-art {
  background: #f8fafc;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.btn-editor-action.btn-create-art:hover {
  background: #f1f5f9;
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.btn-editor-action.save {
  background: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
}

.btn-editor-action.save:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 8px rgba(25, 61, 74, 0.25);
}

.btn-editor-action:hover:not(.save) {
  background: #f1f5f9;
  color: var(--text-primary);
}

.artifacts-navigation-bar {
  display: none;
}

.dropdown-active-art-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
}

.dropdown-tag-step {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1.2;
}

.dropdown-tag-step.step-analise {
  background: rgba(33, 70, 85, 0.12);
  color: #193D4A;
  border: 1px solid rgba(25, 61, 74, 0.25);
}

.dropdown-tag-step.step-design {
  background: rgba(251, 176, 59, 0.18);
  color: #b45309;
  border: 1px solid rgba(251, 176, 59, 0.4);
}

.dropdown-tag-step.step-desenvolvimento {
  background: rgba(14, 165, 233, 0.14);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.dropdown-tag-step.step-geral {
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.dropdown-art-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.dropdown-active-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.dropdown-active-status {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.dropdown-active-status.approved {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.dropdown-active-status.draft {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.dropdown-right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dropdown-count-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(25, 61, 74, 0.08);
  color: var(--text-secondary);
  white-space: nowrap;
}

.dropdown-chevron-icon {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-artifacts-dropdown.active .dropdown-chevron-icon {
  transform: rotate(180deg);
}

/* Menu Dropdown Flutuante */
.artifacts-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 420px;
  max-width: 720px;
  background: #ffffff;
  border: 1.5px solid var(--border-color, #cbd5e1);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.06);
  z-index: 99999;
  overflow: hidden;
  max-height: 460px;
  display: flex;
  flex-direction: column;
  animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu-header {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #193D4A;
}

.dropdown-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dropdown-header-title i {
  width: 15px;
  height: 15px;
  color: var(--norma-teal-dark, #193D4A);
}

.dropdown-total-badge {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.dropdown-artifacts-list {
  overflow-y: auto;
  padding: 8px;
  max-height: 380px;
}

/* Cabeçalho de Etapa ADDIE no Menu */
.dropdown-stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px 10px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
}

.dropdown-stage-header:first-child {
  border-top: none;
  margin-top: 0;
}

.dropdown-stage-header span.stage-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dropdown-stage-header.analise span.stage-dot { background: #193D4A; }
.dropdown-stage-header.design span.stage-dot { background: #FBB03B; }
.dropdown-stage-header.desenvolvimento span.stage-dot { background: #0284c7; }

/* Item de Artefato no Dropdown */
.dropdown-artifact-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  margin-bottom: 2px;
}

.dropdown-artifact-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.dropdown-artifact-item.active {
  background: rgba(25, 61, 74, 0.07);
  border-color: rgba(25, 61, 74, 0.25);
}

.dropdown-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.dropdown-item-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.dropdown-artifact-item.active .dropdown-item-icon {
  color: var(--norma-teal-dark, #193D4A);
}

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

.dropdown-artifact-item.active .dropdown-item-title {
  font-weight: 700;
  color: var(--norma-teal-dark, #193D4A);
}

.dropdown-item-version {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
  flex-shrink: 0;
}

.dropdown-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dropdown-item-check {
  width: 14px;
  height: 14px;
  color: #059669;
  opacity: 0;
}

.dropdown-artifact-item.active .dropdown-item-check {
  opacity: 1;
}

.btn-mini-add {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px dashed var(--accent-color);
  background: transparent;
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-mini-add:hover {
  background: rgba(25, 61, 74, 0.06);
}

.editor-body {
  flex: 1 1 0%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 24px 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.regular-markdown-editor {
  width: 100%;
  max-width: 850px;
  display: flex;
  flex-direction: column;
}

/* Barra de Ferramentas Fixa do Documento (Superior) */
.editor-toolbar-fixed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  min-height: 36px;
  max-height: 36px;
  flex-shrink: 0;
  z-index: 10;
  gap: 10px;
}

.doc-mode-toggle {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 6px;
  gap: 2px;
}

.doc-tab-btn {
  border: none;
  background: transparent;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.2;
}

.doc-tab-btn i {
  width: 13px;
  height: 13px;
}

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

.doc-tab-btn.active {
  background: #ffffff;
  color: var(--accent-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.format-actions-group {
  display: flex;
  align-items: center;
  gap: 2px;
  transition: all 0.2s ease;
}

.format-actions-group.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.format-btn {
  border: none;
  background: transparent;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: background 0.15s;
  line-height: 1.2;
}

.format-btn:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.format-sep {
  width: 1px;
  height: 14px;
  background: var(--border-color);
  margin: 0 3px;
}

/* Folha A4 Realista */
.a4-sheet {
  width: 100%;
  max-width: 850px;
  min-height: 950px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  padding: 32px 56px 48px 56px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.75;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 40px;
}

/* Modo Leitura / Visualização (Markdown Body) */
.markdown-body {
  color: var(--text-primary);
}

.markdown-body h1 {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
  margin-top: 24px;
  margin-bottom: 14px;
}

.markdown-body h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-top: 20px;
  margin-bottom: 10px;
}

.markdown-body h3 {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 600;
  color: #334155;
  margin-top: 16px;
  margin-bottom: 8px;
}

.markdown-body p {
  margin-bottom: 14px;
  color: #334155;
}

.markdown-body ul, .markdown-body ol {
  margin-left: 24px;
  margin-bottom: 14px;
  color: #334155;
}

.markdown-body li {
  margin-bottom: 6px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.88rem;
}

.markdown-body table th,
.markdown-body table td {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.markdown-body table th {
  background-color: #f8fafc;
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-body table tr:nth-child(even) {
  background-color: #fbfcfe;
}

.markdown-body blockquote {
  border-left: 4px solid var(--norma-amber-gold);
  background-color: rgba(251, 176, 59, 0.08);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
  color: #475569;
  font-style: italic;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 24px 0;
}

/* Textarea de Edição da Folha A4 */
textarea.artifact-text-editor {
  resize: none;
  border: 1px solid var(--border-color);
  font-family: var(--font-body), monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  overflow-y: hidden;
  display: block;
}

textarea.artifact-text-editor:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 20px rgba(15, 23, 42, 0.06);
}

/* ==========================================================================
   FOLHA A4 WYSIWYG (EDIÇÃO DIRETA ESTILO WORD / GOOGLE DOCS)
   ========================================================================== */
.wysiwyg-editor {
  outline: none;
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 950px;
}

.wysiwyg-editor:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 2px var(--accent-glow), 0 8px 30px rgba(15, 23, 42, 0.08);
}

.wysiwyg-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
  display: block;
}

.wysiwyg-editor ::selection {
  background-color: rgba(251, 176, 59, 0.3);
  color: #0e2229;
}

/* Tabelas Dinâmicas no Editor WYSIWYG */
.wysiwyg-editor table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}

.wysiwyg-editor th,
.wysiwyg-editor td {
  border: 1px solid #cbd5e1;
  padding: 10px 14px;
  min-width: 80px;
  vertical-align: top;
  position: relative;
}

.wysiwyg-editor th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #1e293b;
}

.wysiwyg-editor td:focus,
.wysiwyg-editor th:focus {
  outline: 2px solid var(--accent-color);
  background-color: #fdfdfe;
}

/* Destaques e Citações Instrucionais */
.wysiwyg-editor blockquote {
  border-left: 4px solid var(--norma-amber-gold);
  background-color: rgba(251, 176, 59, 0.08);
  padding: 12px 18px;
  margin: 18px 0;
  border-radius: 0 8px 8px 0;
  color: #334155;
}

/* Listas com espaçamento confortável */
.wysiwyg-editor ul,
.wysiwyg-editor ol {
  padding-left: 28px;
  margin: 14px 0;
}

.wysiwyg-editor li {
  margin-bottom: 6px;
  line-height: 1.65;
}

/* Estado Ativo dos Botões de Formatação */
.format-btn.active {
  background: rgba(25, 61, 74, 0.1) !important;
  color: var(--norma-teal-dark) !important;
  border-color: var(--norma-teal-dark) !important;
}

/* Formulário Especializado: Visual Briefing */
.visual-briefing-form {
  width: 100%;
  max-width: 850px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.visual-briefing-form label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.visual-briefing-form input,
.visual-briefing-form select,
.visual-briefing-form textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.visual-briefing-form input:focus,
.visual-briefing-form select:focus,
.visual-briefing-form textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.prompt-field {
  background: rgba(251, 176, 59, 0.08);
  border: 1px solid rgba(251, 176, 59, 0.3);
  border-radius: 8px;
  padding: 14px;
}

.prompt-field label {
  color: #92400e;
}

/* ==========================================================================
   FASE 4: GAVETA LATERAL DE CONTEXTO
   ========================================================================== */
.context-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid var(--border-color);
  box-shadow: -6px 0 25px rgba(0, 0, 0, 0.08);
  z-index: 1100;
  display: flex;
  flex-direction: column;
}

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

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-title-group i {
  color: var(--accent-color);
  width: 20px;
  height: 20px;
}

.drawer-title-group h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.context-block h4, .context-items-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.form-group-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.form-group-compact label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group-compact input, .form-group-compact textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  box-sizing: border-box;
}

.btn-secondary-sm {
  width: 100%;
  padding: 7px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary-sm:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

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

.new-context-item-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.new-context-item-box select, .new-context-item-box textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.8rem;
  box-sizing: border-box;
}

.btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.btn-cancel-sm {
  border: none;
  background: transparent;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-save-sm {
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.context-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.context-item-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

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

.item-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.item-badge.decisao { background: #dcfce7; color: #166534; }
.item-badge.premissa { background: rgba(25, 61, 74, 0.08); color: var(--norma-teal-dark); }
.item-badge.pendencia { background: #fef3c7; color: #92400e; }
.item-badge.risco { background: #fee2e2; color: #991b1b; }

.context-item-text {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ==========================================================================
   FASE 5 & 8: TABELA DE FONTES E PAINEL DE QA
   ========================================================================== */
.sources-list-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  margin-top: 14px;
}

.sources-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.sources-table th, .sources-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

.sources-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

select.status-badge-source {
  width: auto;
  min-width: 130px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 28px 5px 12px;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  background-position: right 8px center;
  background-size: 12px 12px;
  outline: none;
  transition: all 0.2s;
  box-shadow: none;
}

select.status-badge-source.oficial {
  background-color: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

select.status-badge-source.complementar {
  background-color: rgba(33, 70, 85, 0.1);
  color: var(--norma-teal-dark);
  border-color: rgba(33, 70, 85, 0.25);
}

select.status-badge-source.aguardando {
  background-color: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

select.status-badge-source.referencia {
  background-color: rgba(251, 176, 59, 0.15);
  color: #92400e;
  border-color: rgba(251, 176, 59, 0.35);
}

select.status-badge-source.obsoleto {
  background-color: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

.qa-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.qa-scope-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
}

.qa-score-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px 24px;
  margin-bottom: 20px;
}

.qa-score-gauge {
  display: flex;
  align-items: baseline;
  background: #ffffff;
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-color);
  box-shadow: var(--shadow-premium);
  flex-shrink: 0;
}

.qa-score-gauge small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.qa-findings-tabs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.finding-title {
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.finding-title.blocker { color: #dc2626; }
.finding-title.alert { color: #d97706; }
.finding-title.recommendation { color: var(--norma-teal-medium); }

.findings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.finding-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
}

.finding-card.blocker { border-left: 4px solid #dc2626; }
.finding-card.alert { border-left: 4px solid #d97706; }
.finding-card.recommendation { border-left: 4px solid var(--norma-teal-medium); }

.finding-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.finding-dimension {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ==========================================================================
   FASE 10: ADMIN PANEL & RBAC SOMENTE LEITURA
   ========================================================================== */
.admin-section-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
}

.admin-section-box h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.bases-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.base-status-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.base-title {
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.base-status-badge.ok {
  font-size: 0.72rem;
  color: #15803d;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Regras para Perfil PMO (Somente Leitura) */
body.role-pmo .pmo-hide,
body.role-pmo #send-btn,
body.role-pmo #save-artifact-btn,
body.role-pmo #new-version-artifact-btn,
body.role-pmo #btn-create-artifact-quick,
body.role-pmo #admin-panel-btn,
body.role-pmo #new-project-btn {
  display: none !important;
}

body.role-pmo #chat-input,
body.role-pmo #artifact-text-editor,
body.role-pmo .visual-briefing-form input,
body.role-pmo .visual-briefing-form textarea,
body.role-pmo .visual-briefing-form select {
  pointer-events: none;
  background: #f8fafc;
  opacity: 0.85;
}

.pmo-badge-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

/* ==========================================================================
   FASE 11: DESIGN RESPONSIVO AVANÇADO (TABLETS & SMARTPHONES)
   ========================================================================== */

/* ==========================================================================
   CONTROLES DE TOGGLE DA BARRA LATERAL (DESKTOP & MOBILE)
   ========================================================================== */
/* Botão de Controle da Barra Lateral (Ao lado do Logo) */
.sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(25, 61, 74, 0.08);
  border-color: rgba(25, 61, 74, 0.15);
  color: var(--norma-teal-dark);
}

.sidebar-collapse-btn i {
  width: 16px;
  height: 16px;
}

/* Botão para Expandir Barra Lateral (Visível no cabeçalho APENAS quando a barra lateral está recolhida) */
.sidebar-expand-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--surface-card, #ffffff);
  color: var(--accent-color, #193D4A);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.sidebar-expand-btn:hover {
  background: var(--accent-color, #193D4A);
  color: #ffffff;
  border-color: var(--accent-color, #193D4A);
  box-shadow: 0 2px 8px rgba(25, 61, 74, 0.18);
  transform: scale(1.05);
}

.sidebar-expand-btn i {
  width: 18px;
  height: 18px;
}

/* Quando a barra lateral está recolhida no desktop, o botão de expandir aparece perfeitamente */
.app-container.sidebar-collapsed .sidebar-expand-btn {
  display: inline-flex !important;
}

/* Estilos dos Componentes de Gestão de Usuários no Painel Admin */
.admin-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.admin-section-header-info {
  flex: 1 1 280px;
  min-width: 0;
}

/* Botão de Destaque Primário Profissional (Criar Nova Conta / Cadastrar) */
.admin-btn-action-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  min-height: 38px;
  width: auto !important;
  border-radius: 8px;
  background: linear-gradient(135deg, #193D4A 0%, #245263 100%);
  color: #ffffff !important;
  border: 1px solid rgba(25, 61, 74, 0.4);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(25, 61, 74, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.admin-btn-action-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #132e38 0%, #193D4A 100%);
  border-color: #FBB03B;
  box-shadow: 0 4px 14px rgba(25, 61, 74, 0.28), 0 0 0 1px rgba(251, 176, 59, 0.4);
  transform: translateY(-1px);
  color: #ffffff !important;
}

.admin-btn-action-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(25, 61, 74, 0.2);
}

.admin-btn-action-primary i {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  flex-shrink: 0;
}

/* Botão de Destaque Secundário (Cancelar / Copiar) */
.admin-btn-action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 38px;
  width: auto !important;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.admin-btn-action-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--accent-color);
}

.admin-btn-action-secondary i {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  flex-shrink: 0;
}

/* Garante que botões btn-primary com texto tenham largura automática e espaçamento adequado */
button.btn-primary:not(#send-btn),
.btn-primary.small {
  width: auto !important;
  height: auto !important;
  min-height: 36px !important;
  padding: 8px 16px !important;
}

.admin-user-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.85rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}

.admin-user-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(25, 61, 74, 0.12);
}

.admin-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #193D4A 0%, #2a5868 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.role-badge.designer {
  background: rgba(25, 61, 74, 0.1);
  color: #193D4A;
  border: 1px solid rgba(25, 61, 74, 0.2);
}

.role-badge.pmo {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.role-badge.admin {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.admin-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

.admin-action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.3);
}

.admin-action-btn i {
  width: 14px;
  height: 14px;
}

/* Controles Mobile Ocultos por Padrão no Desktop */
.mobile-menu-btn,
.mobile-close-sidebar-btn,
.sidebar-backdrop {
  display: none;
}

/* --------------------------------------------------------------------------
   TELAS MÉDIAS & LAPTOPS COMPACTOS (Largura <= 1280px)
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .workspace-header {
    padding: 10px 18px;
    gap: 12px;
  }

  /* Oculta data de atualização no cabeçalho para priorizar o nome do projeto */
  .workspace-header .tag-updated {
    display: none;
  }

  /* Compacta os botões de ferramentas (Contexto, Fontes, QA, Exportar) mantendo ícone e badge */
  .workspace-toolbar .btn-tool {
    padding: 6px 10px;
    gap: 5px;
  }

  .workspace-toolbar .btn-tool > span:not(.badge-count) {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   SELETORES COMPACTOS (Largura <= 1080px)
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  /* Compacta o seletor de modo (Conversa, Dividido, Artefatos) para ícones limpos com tooltips */
  .view-mode-btn {
    padding: 6px 10px;
  }

  .view-mode-btn span {
    display: none;
  }

  .header-divider {
    margin: 0 2px;
  }
}

/* --------------------------------------------------------------------------
   TABLETS & LAPTOPS COMPACTOS (Largura <= 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
  }

  /* Barra Lateral em Gaveta Off-Canvas Deslizante */
  .sidebar-left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    z-index: 10050;
    background-color: var(--bg-sidebar);
    box-shadow: 6px 0 28px rgba(15, 23, 42, 0.25);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar-left.open {
    transform: translateX(0);
  }

  /* Backdrop Escuro com Efeito Blur */
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    display: block;
  }

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

  /* Botão Menu Hamburguer no Cabeçalho */
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
  }

  .mobile-menu-btn:hover {
    background: #f8fafc;
    border-color: var(--accent-color);
    color: var(--accent-color);
  }

  .mobile-menu-btn i {
    width: 20px;
    height: 20px;
  }

  /* Botão Fechar Sidebar */
  .mobile-close-sidebar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s;
  }

  .mobile-close-sidebar-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
  }

  .mobile-close-sidebar-btn i {
    width: 16px;
    height: 16px;
  }

  /* Workspace Ganha 100% da Largura */
  .workspace-main {
    width: 100vw;
    flex: 1 1 0%;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .workspace-header {
    padding: 10px 16px;
    min-height: 56px;
    gap: 12px;
  }

  .workspace-title-area {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .workspace-toolbar {
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .chat-steps-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 14px;
  }

  .chat-steps-bar::-webkit-scrollbar {
    display: none;
  }

  .horizontal-steps {
    min-width: max-content;
  }

  /* Modais Grandes em Tablets */
  .modal-content.modal-sources,
  .modal-content.modal-qa,
  .modal-content.modal-admin {
    max-width: 94vw !important;
    width: 94vw !important;
  }
}

/* --------------------------------------------------------------------------
   SMARTPHONES E TELAS PEQUENAS (Largura <= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* No celular, esconde o modo Dividido para não esmagar as colunas */
  .view-mode-selector button[data-mode="split"] {
    display: none !important;
  }

  /* Caso o modo dividido esteja ativo, força exibição em 1 coluna única */
  .workspace-layout.mode-split {
    flex-direction: column !important;
  }

  .workspace-layout.mode-split .chat-section {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    border-right: none !important;
  }

  .workspace-layout.mode-split .editor-section {
    display: none !important;
  }

  /* Cabeçalho do Workspace Reorganizado e Otimizado no Mobile */
  .workspace-header {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .workspace-title-area {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .project-identity {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  #header-project-name {
    font-size: 0.92rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }

  .project-tags-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    overflow: hidden !important;
  }

  .project-tags-row .tag-client,
  .project-tags-row .tag-updated {
    display: none !important;
  }

  .badge-tag {
    font-size: 0.65rem !important;
    padding: 1px 6px !important;
  }

  .workspace-toolbar {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 2px !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  .workspace-toolbar::-webkit-scrollbar {
    display: none !important;
  }

  .view-mode-selector {
    flex-shrink: 0 !important;
    display: flex !important;
  }

  .view-mode-btn {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
  }

  .btn-tool {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
    flex-shrink: 0 !important;
  }

  .header-divider {
    display: none !important;
  }

  /* Ciclo ADD Compacto no Mobile */
  .chat-steps-bar {
    padding: 4px 10px !important;
    border-bottom: 1px solid var(--border-color) !important;
    min-height: 32px !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 5 !important;
  }

  .chat-steps-bar::-webkit-scrollbar {
    display: none !important;
  }

  .horizontal-steps {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: max-content !important;
    width: auto !important;
  }

  .horizontal-steps .step-item {
    padding: 3px 8px !important;
    border-radius: 5px !important;
    flex-shrink: 0 !important;
  }

  .horizontal-steps .step-num {
    width: 18px !important;
    height: 18px !important;
    font-size: 0.65rem !important;
  }

  .horizontal-steps .step-title {
    font-size: 0.72rem !important;
  }

  .horizontal-steps .step-status {
    display: none !important;
  }

  .horizontal-steps .step-arrow {
    width: 10px !important;
    height: 10px !important;
  }

  /* Folha A4 Fluida Adaptada a Smartphones */
  .a4-sheet {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 16px 14px !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    border-left: none !important;
    border-right: none !important;
    margin-bottom: 16px !important;
    font-size: 0.9rem !important;
    line-height: 1.65 !important;
  }

  .editor-body {
    padding: 8px 4px !important;
  }

  .editor-toolbar-fixed {
    padding: 6px 10px !important;
    gap: 8px !important;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .editor-toolbar-fixed::-webkit-scrollbar {
    display: none;
  }

  .doc-tab-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .format-btn {
    padding: 4px 6px;
    font-size: 0.75rem;
  }

  .artifacts-navigation-bar {
    display: none !important;
  }

  .editor-header,
  .editor-header-unified {
    padding: 8px 10px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    gap: 8px !important;
  }

  .artifacts-dropdown-wrapper {
    max-width: 100% !important;
    width: 100% !important;
  }

  .editor-actions {
    width: 100% !important;
    display: flex !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 4px !important;
  }

  .editor-actions::-webkit-scrollbar {
    display: none !important;
  }

  .actions-sep {
    display: none !important;
  }

  .btn-editor-action {
    padding: 5px 8px !important;
    font-size: 0.74rem !important;
    flex-shrink: 0 !important;
  }

  /* Área de Chat Otimizada */
  .chat-messages {
    padding: 12px 10px !important;
    gap: 12px !important;
  }

  .message {
    max-width: 94% !important;
    padding: 10px 12px !important;
    font-size: 0.88rem !important;
  }

  .chat-input-area {
    padding: 8px 10px 12px 10px !important;
  }

  .input-box {
    padding: 6px 10px !important;
    gap: 6px !important;
  }

  .input-footer {
    display: none !important; /* economiza espaço para teclado virtual */
  }

  #chat-input {
    font-size: 0.88rem !important;
  }

  /* Gaveta Lateral de Contexto Full-Width no Mobile */
  .context-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    border-left: none !important;
  }

  /* Modais em Telas Pequenas (Centralizados na Tela) */
  .modal-overlay {
    padding: 16px 12px !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: rgba(15, 23, 42, 0.65) !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow-y: auto !important;
  }

  .modal-content,
  .modal-content.modal-sources,
  .modal-content.modal-qa,
  .modal-content.modal-export,
  .modal-content.modal-admin,
  .modal-content.modal-dialog-card {
    width: 95vw !important;
    max-width: 520px !important;
    max-height: 86vh !important;
    max-height: 86dvh !important;
    border-radius: 16px !important;
    border: 1px solid var(--border-color) !important;
    display: flex !important;
    flex-direction: column !important;
    margin: auto !important;
    padding-bottom: 0 !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.35) !important;
    overflow: hidden !important;
  }

  .modal-header {
    padding: 14px 16px !important;
    flex-shrink: 0 !important;
  }

  .modal-title-group {
    gap: 10px !important;
  }

  .modal-title-group i {
    width: 22px !important;
    height: 22px !important;
  }

  .modal-title-group h2 {
    font-size: 1rem !important;
  }

  .modal-subtitle {
    font-size: 0.72rem !important;
    line-height: 1.3 !important;
  }

  .modal-body {
    padding: 14px 16px 20px 16px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .file-drop-area {
    padding: 14px !important;
    gap: 6px !important;
    border-radius: 10px !important;
  }

  .file-drop-area i {
    width: 22px !important;
    height: 22px !important;
  }

  .file-drop-area span {
    font-size: 0.78rem !important;
    line-height: 1.3 !important;
  }

  /* Tabela de Fontes em Formato de Cards no Mobile */
  .sources-list-container {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
    margin-top: 10px !important;
  }

  .sources-table {
    min-width: 100% !important;
    width: 100% !important;
    display: block !important;
    border-collapse: separate !important;
  }

  .sources-table thead {
    display: none !important;
  }

  .sources-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .sources-table tr {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 12px 14px !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    position: relative !important;
  }

  body.theme-dark .sources-table tr {
    background: #11242c !important;
    border-color: #1f3f4c !important;
  }

  /* Coluna 1: Nome do Documento */
  .sources-table td:nth-child(1) {
    padding: 0 !important;
    padding-right: 36px !important;
    border-bottom: none !important;
    font-size: 0.85rem !important;
    line-height: 1.35 !important;
    color: var(--text-primary) !important;
    word-break: break-word !important;
    hyphens: auto !important;
  }

  /* Coluna 2: Status Badge / Select */
  .sources-table td:nth-child(2) {
    padding: 0 !important;
    border-bottom: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .sources-table td:nth-child(2) select.status-badge-source {
    width: auto !important;
    min-width: 140px !important;
    max-width: 180px !important;
    height: 30px !important;
    font-size: 0.76rem !important;
    padding: 4px 26px 4px 10px !important;
  }

  /* Coluna 3: Versão */
  .sources-table td:nth-child(3) {
    padding: 0 !important;
    border-bottom: none !important;
    font-size: 0.74rem !important;
    color: var(--text-muted) !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  .sources-table td:nth-child(3)::before {
    content: "Versão: " !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    margin-right: 4px !important;
  }

  /* Coluna 4: Papel / Notas */
  .sources-table td:nth-child(4) {
    padding: 0 !important;
    border-bottom: none !important;
    font-size: 0.78rem !important;
    color: var(--text-secondary) !important;
    line-height: 1.35 !important;
    background: var(--bg-card-subtle, #f8fafc) !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    border: 1px dashed var(--border-color) !important;
  }

  body.theme-dark .sources-table td:nth-child(4) {
    background: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
  }

  /* Coluna 5: Ações (Botão Excluir) */
  .sources-table td:nth-child(5) {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    padding: 0 !important;
    border-bottom: none !important;
  }

  .sources-table td:nth-child(5) .btn-item-action {
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.18) !important;
    transition: background 0.15s ease !important;
  }

  .sources-table td:nth-child(5) .btn-item-action:active {
    background: rgba(239, 68, 68, 0.2) !important;
  }

  /* Caso vazio (colspan=5) */
  .sources-table td[colspan] {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 24px 12px !important;
    font-size: 0.84rem !important;
    color: var(--text-muted) !important;
    border: none !important;
  }

  .modal-footer {
    padding: 12px 16px !important;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0 !important;
  }

  .modal-footer button {
    flex: 1;
    justify-content: center;
  }

  .qa-controls-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding-bottom: 16px !important;
    margin-bottom: 16px !important;
  }

  .qa-scope-picker {
    width: 100% !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  .qa-scope-picker select {
    width: 100% !important;
    height: 38px !important;
    font-size: 0.84rem !important;
  }

  #run-qa-audit-btn {
    width: 100% !important;
    justify-content: center !important;
    height: 42px !important;
    font-size: 0.88rem !important;
  }

  .qa-score-card {
    padding: 14px 16px !important;
    gap: 14px !important;
  }

  .qa-score-gauge {
    width: 58px !important;
    height: 58px !important;
    font-size: 1.25rem !important;
  }

  .bases-status-grid {
    grid-template-columns: 1fr !important;
  }

  .visual-briefing-form .form-row {
    grid-template-columns: 1fr !important;
  }
}

/* --------------------------------------------------------------------------
   SMARTPHONES COMPACTOS (Largura <= 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .btn-tool span:not(.badge-count) {
    display: none; /* Em telas muito estreitas, exibe apenas os ícones e badges */
  }

  .btn-tool {
    padding: 7px 9px;
  }

  .brand-text h1 {
    font-size: 1.15rem;
  }
}

/* ==========================================================================
   FASE 12: CONTROLES DE TEMA & TEMA ESCURO INSTITUCIONAL (NORMA DIGITAL)
   ========================================================================== */

/* Botão Alternador de Tema na Barra de Ferramentas */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.btn-theme-toggle i {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   REGRAS INSTITUCIONAIS DO TEMA ESCURO (DARK MODE - 100% CONTRASTE & LEGIBILIDADE)
   ========================================================================== */

body.theme-dark {
  background-color: #0c1a20 !important;
  color: #f4f8f9 !important;
}

body.theme-dark .app-container {
  background-color: #0c1a20 !important;
  background-image: 
    radial-gradient(at 10% 20%, rgba(251, 176, 59, 0.04) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(33, 70, 85, 0.25) 0px, transparent 50%) !important;
}

/* --------------------------------------------------------------------------
   1. BARRA LATERAL ESQUERDA (SIDEBAR)
   -------------------------------------------------------------------------- */
body.theme-dark .sidebar-left {
  background-color: #11242c !important;
  border-right-color: #1f3f4c !important;
}

body.theme-dark .brand {
  border-bottom-color: #1f3f4c !important;
}

body.theme-dark .brand-text h1 {
  color: #f4f8f9 !important;
}

body.theme-dark .brand-badge {
  background: rgba(251, 176, 59, 0.16) !important;
  color: #FBB03B !important;
  border-color: rgba(251, 176, 59, 0.3) !important;
}

body.theme-dark .brand-subtitle,
body.theme-dark .brand-text span:not(.brand-badge) {
  color: #8da7b2 !important;
}

body.theme-dark .sidebar-collapse-btn {
  color: #8da7b2 !important;
}

body.theme-dark .sidebar-collapse-btn:hover {
  background-color: #142d36 !important;
  color: #FBB03B !important;
}

body.theme-dark .sidebar-expand-btn {
  background-color: #142d36 !important;
  border-color: #1f3f4c !important;
  color: #FBB03B !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

body.theme-dark .sidebar-expand-btn:hover {
  background-color: #FBB03B !important;
  color: #0c1a20 !important;
  border-color: #FBB03B !important;
}

body.theme-dark .admin-btn-action-primary {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%) !important;
  color: #0c1a20 !important;
  border: 1px solid rgba(251, 176, 59, 0.6) !important;
  box-shadow: 0 2px 10px rgba(251, 176, 59, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

body.theme-dark .admin-btn-action-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  box-shadow: 0 4px 16px rgba(251, 176, 59, 0.45) !important;
  color: #000000 !important;
}

body.theme-dark .admin-btn-action-secondary {
  background: #142d36 !important;
  border-color: #1f3f4c !important;
  color: #e2e8f0 !important;
}

body.theme-dark .admin-btn-action-secondary:hover {
  background: #1a3c49 !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

/* Seletor de Perfil Ativo (RBAC) */
body.theme-dark .profile-switcher-box {
  background: #0f232a !important;
  border: 1px solid #1f3f4c !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
}

body.theme-dark .profile-switcher-header i {
  color: #FBB03B !important;
}

body.theme-dark .profile-switcher-header label {
  color: #FBB03B !important;
}

body.theme-dark .role-select-wrapper select,
body.theme-dark select#role-select {
  background-color: #142d36 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
  box-shadow: none !important;
}

body.theme-dark select#role-select:focus {
  border-color: #FBB03B !important;
  box-shadow: 0 0 0 2px rgba(251, 176, 59, 0.25) !important;
}

body.theme-dark select#role-select option {
  background-color: #142d36 !important;
  color: #f4f8f9 !important;
}

body.theme-dark .role-badge-status {
  color: #cbe0e7 !important;
}

/* Treinamentos na Sidebar */
body.theme-dark .project-header h2 {
  color: #8da7b2 !important;
}

body.theme-dark .search-box input {
  background-color: #0d1e24 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
}

body.theme-dark .search-box input:focus {
  border-color: #FBB03B !important;
}

body.theme-dark .search-box input::placeholder {
  color: #527584 !important;
}

body.theme-dark .search-box .search-icon {
  color: #8da7b2 !important;
}

body.theme-dark .project-filter-tabs {
  background-color: #0d1e24 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .filter-tab {
  color: #8da7b2 !important;
}

body.theme-dark .filter-tab.active {
  background-color: #173642 !important;
  color: #FBB03B !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body.theme-dark .project-item {
  border-color: #1f3f4c !important;
}

body.theme-dark .project-item:hover {
  background-color: #173642 !important;
}

body.theme-dark .project-item.active {
  background-color: #1a3c48 !important;
  border-color: #2e6074 !important;
}

body.theme-dark .project-item-name {
  color: #f4f8f9 !important;
}

body.theme-dark .project-item-meta span {
  color: #8da7b2 !important;
}

body.theme-dark .project-actions button {
  color: #8da7b2 !important;
}

body.theme-dark .project-actions button:hover {
  color: #FBB03B !important;
}

body.theme-dark .admin-link-btn {
  background-color: #142d36 !important;
  border: 1px solid #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .admin-link-btn:hover {
  background-color: #173642 !important;
  color: #FBB03B !important;
  border-color: #FBB03B !important;
}

body.theme-dark .icon-btn-small {
  background: #142d36 !important;
  border: 1px solid #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .icon-btn-small:hover {
  background: #173642 !important;
  color: #FBB03B !important;
  border-color: #FBB03B !important;
}

/* --------------------------------------------------------------------------
   2. CABEÇALHO DO WORKSPACE & TOOLBAR
   -------------------------------------------------------------------------- */
body.theme-dark .workspace-main {
  background-color: #0c1a20 !important;
}

body.theme-dark .workspace-header {
  background-color: #11242c !important;
  border-bottom-color: #1f3f4c !important;
}

body.theme-dark #header-project-name {
  color: #f4f8f9 !important;
}

body.theme-dark .tag-updated {
  background: #193642 !important;
  color: #8da7b2 !important;
}

body.theme-dark .tag-modality {
  background: #1e293b !important;
  color: #93c5fd !important;
  border: 1px solid rgba(147, 197, 253, 0.25) !important;
}

body.theme-dark .tag-client {
  background: #163644 !important;
  color: #7dd3fc !important;
}

body.theme-dark .tag-type {
  background: #2b2818 !important;
  color: #FBB03B !important;
}

body.theme-dark .view-mode-selector {
  background-color: #0d1e24 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .view-mode-btn {
  color: #8da7b2 !important;
}

body.theme-dark .view-mode-btn.active {
  background-color: #173642 !important;
  color: #FBB03B !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}

body.theme-dark .btn-tool {
  background-color: #132b34 !important;
  border: 1px solid #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .btn-tool i {
  color: #cbe0e7 !important;
}

body.theme-dark .btn-tool:hover {
  background-color: #173642 !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .btn-tool:hover i {
  color: #FBB03B !important;
}

body.theme-dark .badge-count {
  background-color: #1f4250 !important;
  color: #f4f8f9 !important;
}

body.theme-dark .header-tools-dropdown {
  background-color: #132b34 !important;
  border: 1px solid #1f3f4c !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5) !important;
}

body.theme-dark .header-dropdown-item {
  color: #e2e8f0 !important;
}

body.theme-dark .header-dropdown-item:hover {
  background-color: #183845 !important;
  color: #7dd3fc !important;
}

body.theme-dark .header-dropdown-item i {
  color: #8da7b2 !important;
}

body.theme-dark .header-dropdown-item:hover i {
  color: #7dd3fc !important;
}

body.theme-dark .header-dropdown-item.btn-tokens:hover i {
  color: #FBB03B !important;
}

body.theme-dark .header-dropdown-item .badge-count {
  background-color: #1f4250 !important;
  color: #cbe0e7 !important;
}

body.theme-dark .header-dropdown-item .badge-tokens {
  background: rgba(251, 176, 59, 0.22) !important;
  color: #FBB03B !important;
}

body.theme-dark .header-dropdown-divider {
  background-color: #1f3f4c !important;
}

body.theme-dark .dropdown-menu {
  background-color: #132b34 !important;
  border: 1px solid #1f3f4c !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

body.theme-dark .dropdown-menu a {
  color: #f4f8f9 !important;
}

body.theme-dark .dropdown-menu a i {
  color: #8da7b2 !important;
}

body.theme-dark .dropdown-menu a:hover {
  background-color: #183845 !important;
  color: #FBB03B !important;
}

body.theme-dark .dropdown-menu a:hover i {
  color: #FBB03B !important;
}

/* --------------------------------------------------------------------------
   3. BARRA HORIZONTAL DO CICLO A.D.D. (ANÁLISE, DESIGN, DESENVOLVIMENTO)
   -------------------------------------------------------------------------- */
body.theme-dark .chat-steps-bar {
  background-color: #11242c !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark .horizontal-steps .step-item {
  background-color: #132b34 !important;
  border: 1px solid #1f3f4c !important;
  cursor: default !important;
}

body.theme-dark .horizontal-steps .step-item.upcoming {
  opacity: 0.65 !important;
  background-color: #0e2027 !important;
}

body.theme-dark .horizontal-steps .step-num {
  background-color: #0f232a !important;
  border: 1.5px solid #214655 !important;
  color: #cbe0e7 !important;
}

body.theme-dark .horizontal-steps .step-title {
  color: #f4f8f9 !important;
}

body.theme-dark .horizontal-steps .step-status {
  color: #8da7b2 !important;
}

body.theme-dark .horizontal-steps .step-arrow {
  color: #527584 !important;
}

/* Etapa Ativa */
body.theme-dark .horizontal-steps .step-item.active {
  background-color: #1a3c48 !important;
  border-color: #FBB03B !important;
  box-shadow: 0 2px 8px rgba(251, 176, 59, 0.15) !important;
}

body.theme-dark .horizontal-steps .step-item.active .step-num {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%) !important;
  border-color: #FBB03B !important;
  color: #0c1a20 !important;
  box-shadow: 0 2px 8px rgba(251, 176, 59, 0.35) !important;
}

body.theme-dark .horizontal-steps .step-item.active .step-title {
  color: #FBB03B !important;
}

/* Etapa Concluída */
body.theme-dark .horizontal-steps .step-item.completed {
  background-color: #0f2c25 !important;
  border-color: #059669 !important;
}

body.theme-dark .horizontal-steps .step-item.completed .step-num {
  background-color: #059669 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
}

body.theme-dark .horizontal-steps .step-item.completed .step-title {
  color: #a7f3d0 !important;
}

/* Etapa Bloqueada */
body.theme-dark .horizontal-steps .step-item.locked {
  background-color: #0d1e24 !important;
  border-color: #1a3540 !important;
  opacity: 0.5 !important;
}

/* --------------------------------------------------------------------------
   4. PAINEL DE CHAT & MENSAGENS (AIDIA & USUÁRIO)
   -------------------------------------------------------------------------- */
body.theme-dark .chat-panel,
body.theme-dark .chat-section,
body.theme-dark .workspace-layout {
  background-color: #0c1a20 !important;
}

body.theme-dark .chat-messages {
  background-color: #0c1a20 !important;
}

body.theme-dark .message-card {
  color: #f4f8f9 !important;
}

/* BALÃO DA AIDIA (Fundo Teal Escuro Rico + Texto Claro Impecável) */
body.theme-dark .message-bubble.ai,
body.theme-dark .message-card.ai .message-bubble {
  background: #142e38 !important;
  background-color: #142e38 !important;
  border: 1px solid #1f4250 !important;
  color: #f4f8f9 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}

body.theme-dark .message-bubble.ai p,
body.theme-dark .message-bubble.ai li,
body.theme-dark .message-bubble.ai span {
  color: #e2edf1 !important;
}

body.theme-dark .message-bubble.ai strong,
body.theme-dark .message-bubble.ai b {
  color: #FBB03B !important;
  font-weight: 700 !important;
}

body.theme-dark .message-bubble.ai em,
body.theme-dark .message-bubble.ai i {
  color: #fce7b2 !important;
}

body.theme-dark .message-bubble.ai h1,
body.theme-dark .message-bubble.ai h2,
body.theme-dark .message-bubble.ai h3,
body.theme-dark .message-bubble.ai h4 {
  color: #FBB03B !important;
  border-bottom: 1px solid #1f4250 !important;
}

body.theme-dark .message-bubble.ai a {
  color: #FBB03B !important;
  text-decoration: underline !important;
}

body.theme-dark .message-bubble.ai blockquote {
  border-left: 4px solid #FBB03B !important;
  background-color: rgba(251, 176, 59, 0.08) !important;
  color: #cbe0e7 !important;
  padding: 10px 14px !important;
  border-radius: 0 6px 6px 0 !important;
}

body.theme-dark .message-bubble.ai code {
  background: #0a171d !important;
  color: #FBB03B !important;
  border: 1px solid #1f4250 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
}

body.theme-dark .message-bubble.ai pre {
  background: #0a171d !important;
  border: 1px solid #1f4250 !important;
  padding: 12px !important;
  border-radius: 8px !important;
}

body.theme-dark .message-bubble.ai pre code {
  background: transparent !important;
  color: #f4f8f9 !important;
  border: none !important;
  padding: 0 !important;
}

body.theme-dark .message-bubble.ai hr {
  border: none !important;
  border-top: 1px solid #1f4250 !important;
  margin: 14px 0 !important;
}

body.theme-dark .message-bubble.ai table {
  border-collapse: collapse !important;
  width: 100% !important;
  margin: 12px 0 !important;
}

body.theme-dark .message-bubble.ai th {
  background-color: #183743 !important;
  color: #FBB03B !important;
  border: 1px solid #1f4250 !important;
  padding: 8px 12px !important;
}

body.theme-dark .message-bubble.ai td {
  border: 1px solid #1f4250 !important;
  color: #f4f8f9 !important;
  padding: 8px 12px !important;
  background-color: transparent !important;
}

body.theme-dark .message-bubble.ai tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

/* BALÃO DO USUÁRIO (Âmbar Ouro Vibrante + Texto Escuro) */
body.theme-dark .message-bubble.user,
body.theme-dark .message-card.user .message-bubble {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%) !important;
  color: #0c1a20 !important;
  box-shadow: 0 4px 14px rgba(251, 176, 59, 0.25) !important;
  border: none !important;
}

body.theme-dark .message-bubble.user p,
body.theme-dark .message-bubble.user span,
body.theme-dark .message-bubble.user strong {
  color: #0c1a20 !important;
  font-weight: 600 !important;
}

/* Indicador de Digitação */
body.theme-dark #chat-typing-indicator .message-bubble.ai {
  background: #142e38 !important;
  border: 1px solid #1f4250 !important;
}

body.theme-dark #chat-typing-indicator span {
  color: #8da7b2 !important;
}

/* Botões de Ações sob a Mensagem da AIDIA */
body.theme-dark .btn-msg-action {
  background: #11262f !important;
  border: 1px solid #1f4250 !important;
  color: #cbe0e7 !important;
}

body.theme-dark .btn-msg-action i {
  color: inherit !important;
}

body.theme-dark .btn-msg-action:hover {
  background: #183845 !important;
  color: #FBB03B !important;
  border-color: #FBB03B !important;
}

body.theme-dark .btn-msg-action.btn-action-primary {
  background: rgba(251, 176, 59, 0.15) !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .btn-msg-action.btn-action-primary:hover {
  background: #FBB03B !important;
  color: #0c1a20 !important;
}

/* Área de Input do Chat */
body.theme-dark .chat-input-area {
  background-color: #11242c !important;
  border-top: 1px solid #1f3f4c !important;
}

body.theme-dark .input-box {
  background-color: #0d1e24 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark #chat-input {
  background: transparent !important;
  color: #f4f8f9 !important;
}

body.theme-dark #chat-input::placeholder {
  color: #527584 !important;
}

body.theme-dark .attach-btn,
body.theme-dark .mic-btn {
  color: #8da7b2 !important;
}

body.theme-dark .attach-btn:hover,
body.theme-dark .mic-btn:hover {
  background: #173642 !important;
  color: #FBB03B !important;
}

body.theme-dark #send-btn {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%) !important;
  color: #0c1a20 !important;
  border: none !important;
}

body.theme-dark #send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  box-shadow: 0 4px 14px rgba(251, 176, 59, 0.35) !important;
}

body.theme-dark .input-footer {
  color: #6e8e9b !important;
}

body.theme-dark .attachment-preview {
  background-color: #173642 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
}

body.theme-dark .attachment-preview span {
  color: #f4f8f9 !important;
}

body.theme-dark .attachment-preview i {
  color: #FBB03B !important;
}

/* --------------------------------------------------------------------------
   5. EDITOR DE ARTEFATOS (PAINEL DIREITO / MODO ARTEFATOS / DIVIDIDO)
   -------------------------------------------------------------------------- */
body.theme-dark .editor-section {
  background-color: #0c1a20 !important;
}

body.theme-dark .editor-header {
  background-color: #11242c !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark #current-artifact-title {
  color: #f4f8f9 !important;
}

body.theme-dark #current-artifact-meta,
body.theme-dark .editor-meta {
  color: #8da7b2 !important;
}

body.theme-dark .btn-editor-action {
  background-color: #142d36 !important;
  border: 1px solid #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .actions-sep {
  background-color: #1f3f4c !important;
}

body.theme-dark .btn-editor-action:hover:not(.save) {
  background-color: #173642 !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .btn-editor-action.save {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%) !important;
  color: #0c1a20 !important;
  border-color: #FBB03B !important;
  font-weight: 700 !important;
}

body.theme-dark .btn-editor-action.save:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

/* Pílulas de Navegação de Artefatos */
body.theme-dark .artifacts-navigation-bar {
  background-color: #0e2027 !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark .btn-artifacts-dropdown {
  background: #142d36 !important;
  border-color: #1f3f4c !important;
  color: #cbe0e7 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}

body.theme-dark .btn-artifacts-dropdown:hover {
  border-color: #FBB03B !important;
  box-shadow: 0 2px 10px rgba(251, 176, 59, 0.2) !important;
}

body.theme-dark .btn-artifacts-dropdown.active {
  border-color: #FBB03B !important;
}

body.theme-dark .dropdown-active-title {
  color: #e2e8f0 !important;
}

body.theme-dark .dropdown-count-pill {
  background: rgba(251, 176, 59, 0.15) !important;
  color: #FBB03B !important;
}

body.theme-dark .artifacts-dropdown-menu {
  background: #142d36 !important;
  border-color: #1f3f4c !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55) !important;
}

body.theme-dark .dropdown-menu-header {
  background: #0e2027 !important;
  border-bottom-color: #1f3f4c !important;
  color: #FBB03B !important;
}

body.theme-dark .dropdown-header-title i {
  color: #FBB03B !important;
}

body.theme-dark .dropdown-stage-header {
  border-top-color: #1f3f4c !important;
  color: #94a3b8 !important;
}

body.theme-dark .dropdown-artifact-item:hover {
  background: #1c3d4a !important;
  border-color: #285465 !important;
}

body.theme-dark .dropdown-artifact-item.active {
  background: rgba(251, 176, 59, 0.15) !important;
  border-color: #FBB03B !important;
}

body.theme-dark .dropdown-artifact-item.active .dropdown-item-title {
  color: #FBB03B !important;
}

body.theme-dark .dropdown-item-title {
  color: #e2e8f0 !important;
}

body.theme-dark .dropdown-item-version {
  background: #1f3f4c !important;
  color: #94a3b8 !important;
}

body.theme-dark .btn-mini-add {
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .btn-mini-add:hover {
  background-color: rgba(251, 176, 59, 0.12) !important;
}

/* Barra de Ferramentas Fixa (WYSIWYG Estilo Word/Docs) */
body.theme-dark .editor-toolbar-fixed {
  background-color: #11242c !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark .doc-mode-toggle {
  background-color: #0d1e24 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .doc-tab-btn {
  color: #8da7b2 !important;
}

body.theme-dark .doc-tab-btn.active {
  background-color: #173642 !important;
  color: #FBB03B !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body.theme-dark .format-btn {
  color: #cbe0e7 !important;
}

body.theme-dark .format-btn:hover {
  background-color: #173642 !important;
  color: #FBB03B !important;
}

body.theme-dark .format-btn.active {
  background-color: rgba(251, 176, 59, 0.15) !important;
  color: #FBB03B !important;
  border-color: #FBB03B !important;
}

body.theme-dark .format-sep {
  background-color: #1f3f4c !important;
}

/* FOLHA A4 WYSIWYG NO DARK MODE */
body.theme-dark .a4-sheet,
body.theme-dark .artifact-preview-box,
body.theme-dark .wysiwyg-editor {
  background-color: #132b34 !important;
  border: 1px solid #1f3f4c !important;
  color: #e2edf1 !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45) !important;
}

body.theme-dark .wysiwyg-editor:empty::before {
  color: #6e8e9b !important;
}

body.theme-dark .wysiwyg-editor h1,
body.theme-dark .wysiwyg-editor h2,
body.theme-dark .wysiwyg-editor h3,
body.theme-dark .markdown-body h1,
body.theme-dark .markdown-body h2,
body.theme-dark .markdown-body h3 {
  color: #FBB03B !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark .wysiwyg-editor p,
body.theme-dark .wysiwyg-editor li,
body.theme-dark .markdown-body p,
body.theme-dark .markdown-body li {
  color: #e2edf1 !important;
}

body.theme-dark .wysiwyg-editor strong,
body.theme-dark .wysiwyg-editor b,
body.theme-dark .markdown-body strong,
body.theme-dark .markdown-body b {
  color: #ffffff !important;
  font-weight: 700 !important;
}

body.theme-dark .wysiwyg-editor em,
body.theme-dark .wysiwyg-editor i {
  color: #fce7b2 !important;
}

body.theme-dark .wysiwyg-editor blockquote,
body.theme-dark .markdown-body blockquote {
  border-left: 4px solid #FBB03B !important;
  background-color: rgba(251, 176, 59, 0.08) !important;
  color: #cbe0e7 !important;
}

body.theme-dark .wysiwyg-editor table,
body.theme-dark .markdown-body table {
  border-collapse: collapse !important;
  width: 100% !important;
}

body.theme-dark .wysiwyg-editor th,
body.theme-dark .markdown-body table th {
  background-color: #183743 !important;
  color: #FBB03B !important;
  border: 1px solid #1f3f4c !important;
  font-weight: 700 !important;
}

body.theme-dark .wysiwyg-editor td,
body.theme-dark .markdown-body table td {
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
  background-color: transparent !important;
}

body.theme-dark .wysiwyg-editor td:focus,
body.theme-dark .wysiwyg-editor th:focus {
  outline: 2px solid #FBB03B !important;
  background-color: #1c404f !important;
}

body.theme-dark .wysiwyg-editor tr:nth-child(even) td,
body.theme-dark .markdown-body table tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

body.theme-dark .wysiwyg-editor ::selection {
  background-color: #214655 !important;
  color: #FBB03B !important;
}

body.theme-dark textarea.artifact-text-editor {
  background-color: #132b34 !important;
  color: #f4f8f9 !important;
  border: 1px solid #1f3f4c !important;
}

/* Formulário Especializado: Briefing Visual */
body.theme-dark .visual-briefing-form {
  background-color: #132b34 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
}

body.theme-dark .visual-briefing-form label {
  color: #cbe0e7 !important;
}

body.theme-dark .prompt-field {
  background-color: #192b34 !important;
  border: 1px solid #294c5b !important;
}

body.theme-dark .prompt-field label {
  color: #FBB03B !important;
}

/* --------------------------------------------------------------------------
   6. GAVETA LATERAL DE MEMÓRIA CONTEXTUAL
   -------------------------------------------------------------------------- */
body.theme-dark .context-drawer {
  background-color: #132b34 !important;
  border-left: 1px solid #1f3f4c !important;
}

body.theme-dark .drawer-header {
  background-color: #173642 !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark .drawer-title-group h3 {
  color: #f4f8f9 !important;
}

body.theme-dark .drawer-title-group i {
  color: #FBB03B !important;
}

body.theme-dark .context-block h4,
body.theme-dark .context-items-header h4 {
  color: #FBB03B !important;
}

body.theme-dark .context-item-card {
  background-color: #183845 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .context-item-text {
  color: #f4f8f9 !important;
}

body.theme-dark .btn-secondary-sm,
body.theme-dark #save-context-core-btn {
  background-color: #173642 !important;
  border: 1px solid #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .btn-secondary-sm:hover,
body.theme-dark #save-context-core-btn:hover {
  background-color: #1d4352 !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .new-context-item-box {
  background-color: #0f232a !important;
  border: 1px solid #1f3f4c !important;
}

/* --------------------------------------------------------------------------
   7. MODAIS (CRIAR TREINAMENTO, FONTES, QA, VERSÕES, ADMIN, DIÁLOGOS)
   -------------------------------------------------------------------------- */
body.theme-dark .modal-overlay {
  background-color: rgba(4, 12, 16, 0.8) !important;
}

body.theme-dark .modal-content {
  background-color: #132b34 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5) !important;
}

body.theme-dark .modal-header {
  background-color: #173642 !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark .modal-header h2 {
  color: #FBB03B !important;
}

body.theme-dark .modal-subtitle {
  color: #8da7b2 !important;
}

body.theme-dark .modal-footer {
  background-color: #173642 !important;
  border-top: 1px solid #1f3f4c !important;
}

body.theme-dark .dialog-textarea {
  background-color: #0b1e25 !important;
  border-color: #1f3f4c !important;
  color: #f4f8f9 !important;
}

body.theme-dark .dialog-textarea:focus {
  border-color: #FBB03B !important;
  box-shadow: 0 0 0 3px rgba(251, 176, 59, 0.2) !important;
}

body.theme-dark .dialog-input-hint {
  color: #8da7b2 !important;
}

/* ÁREA DE UPLOAD (DROPZONE) NO DARK MODE */
body.theme-dark .file-drop-area {
  background-color: #0d1e24 !important;
  border: 2px dashed #1f3f4c !important;
}

body.theme-dark .file-drop-area:hover,
body.theme-dark .file-drop-area.dragover {
  background-color: #15323d !important;
  border-color: #FBB03B !important;
}

body.theme-dark .file-drop-area i {
  color: #FBB03B !important;
}

body.theme-dark .file-drop-area span {
  color: #cbe0e7 !important;
}

body.theme-dark .modal-file-list li {
  background-color: #173642 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
}

/* BOTÕES EM MODAIS (CANCELAR / CONFIRMAR) */
body.theme-dark .btn-secondary,
body.theme-dark .modal-footer button.btn-secondary,
body.theme-dark button#cancel-project-btn,
body.theme-dark button#cancel-artifact-btn,
body.theme-dark button#dialog-cancel-btn,
body.theme-dark .btn-cancel-sm {
  background-color: #173642 !important;
  border: 1px solid #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .btn-secondary:hover,
body.theme-dark .modal-footer button.btn-secondary:hover,
body.theme-dark button#cancel-project-btn:hover,
body.theme-dark button#cancel-artifact-btn:hover,
body.theme-dark button#dialog-cancel-btn:hover,
body.theme-dark .btn-cancel-sm:hover {
  background-color: #1d4352 !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .btn-primary,
body.theme-dark .modal-footer .btn-primary,
body.theme-dark #create-project-btn,
body.theme-dark #confirm-create-artifact-btn,
body.theme-dark #dialog-confirm-btn:not(.btn-danger),
body.theme-dark #run-qa-audit-btn,
body.theme-dark .btn-save-sm {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%) !important;
  color: #0c1a20 !important;
  border: 1px solid #FBB03B !important;
  font-weight: 700 !important;
}

body.theme-dark .btn-primary:hover,
body.theme-dark .modal-footer .btn-primary:hover,
body.theme-dark #create-project-btn:hover,
body.theme-dark #confirm-create-artifact-btn:hover,
body.theme-dark #dialog-confirm-btn:not(.btn-danger):hover,
body.theme-dark #run-qa-audit-btn:hover,
body.theme-dark .btn-save-sm:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  box-shadow: 0 4px 14px rgba(251, 176, 59, 0.35) !important;
}

/* Botão Excluir no Tema Escuro: idêntico ao Cancelar, com borda e texto vermelhos */
body.theme-dark .btn-danger,
body.theme-dark .modal-footer button.btn-danger,
body.theme-dark #dialog-confirm-btn.btn-danger {
  background-color: #173642 !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  color: #f87171 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

body.theme-dark .btn-danger:hover,
body.theme-dark .modal-footer button.btn-danger:hover,
body.theme-dark #dialog-confirm-btn.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.18) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25) !important;
}

body.theme-dark .btn-danger:active,
body.theme-dark .modal-footer button.btn-danger:active,
body.theme-dark #dialog-confirm-btn.btn-danger:active {
  background-color: rgba(239, 68, 68, 0.25) !important;
  transform: translateY(1px) !important;
}

/* Tabela de Fontes */
body.theme-dark .sources-list-container {
  background-color: #11262f !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .sources-table th {
  background-color: #173642 !important;
  color: #cbe0e7 !important;
  border-bottom: 1px solid #1f3f4c !important;
}

body.theme-dark .sources-table td {
  border-bottom: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
}

/* Modal QA */
body.theme-dark .qa-controls-bar {
  background-color: #11262f !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .qa-scope-picker label {
  color: #cbe0e7 !important;
}

body.theme-dark .qa-score-card {
  background: #0f232a !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .qa-score-gauge {
  background: #142e38 !important;
  border: 2px solid #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .qa-score-summary h4 {
  color: #f4f8f9 !important;
}

body.theme-dark #qa-score-summary-text {
  color: #cbe0e7 !important;
}

body.theme-dark .finding-card {
  background: #142e38 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
}

body.theme-dark .finding-header {
  color: #f4f8f9 !important;
}

/* Painel Administrativo */
body.theme-dark .admin-section-box {
  background-color: #0f232a !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .admin-section-box h4 {
  color: #FBB03B !important;
}

body.theme-dark .base-status-card {
  background-color: #15323e !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .base-title {
  color: #f4f8f9 !important;
}

body.theme-dark .base-info {
  color: #8da7b2 !important;
}

/* Modal de Diálogos */
body.theme-dark .dialog-message {
  color: #e2edf1 !important;
}

/* Formulários e Inputs Gerais */
body.theme-dark input[type="text"],
body.theme-dark input[type="password"],
body.theme-dark input[type="search"],
body.theme-dark select,
body.theme-dark textarea {
  background-color: #0d1e24 !important;
  border: 1px solid #1f3f4c !important;
  color: #f4f8f9 !important;
}

body.theme-dark input[type="text"]:focus,
body.theme-dark input[type="password"]:focus,
body.theme-dark input[type="search"]:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus {
  border-color: #FBB03B !important;
  box-shadow: 0 0 0 2px rgba(251, 176, 59, 0.25) !important;
}

body.theme-dark select option {
  background-color: #0d1e24 !important;
  color: #f4f8f9 !important;
}

body.theme-dark .form-group label,
body.theme-dark .form-col label,
body.theme-dark .form-group-compact label {
  color: #cbe0e7 !important;
}

body.theme-dark .form-help {
  color: #8da7b2 !important;
}

/* Banner PMO */
body.theme-dark .pmo-badge-banner {
  background: #33250b !important;
  border-bottom-color: #78350f !important;
  color: #fde68a !important;
}

/* ==========================================================================
   FASE 13: GOVERNANÇA DE ARTEFATOS & CARDS DE PROPOSTA DA AIDIA
   ========================================================================== */

.artifact-proposal-card {
  margin-top: 14px;
  background: #ffffff;
  border: 1.5px solid rgba(25, 61, 74, 0.22);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
}

.prop-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.prop-card-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge-prop-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #eaf2f5;
  color: #193D4A;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-prop-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-prop-status.new {
  background: rgba(251, 176, 59, 0.18);
  color: #b45309;
  border: 1px solid rgba(251, 176, 59, 0.45);
}

.badge-prop-status.revision {
  background: rgba(33, 70, 85, 0.12);
  color: #193D4A;
  border: 1px solid rgba(33, 70, 85, 0.3);
}

.badge-prop-step {
  font-size: 0.72rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-prop-module {
  font-size: 0.72rem;
  font-weight: 500;
  background: #f8fafc;
  color: #64748b;
  padding: 3px 8px;
  border-radius: 4px;
}

.prop-card-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #193D4A;
  line-height: 1.35;
}

.prop-card-summary {
  background: #f0f7fa;
  border-left: 3px solid #214655;
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 0.84rem;
  color: #214655;
  line-height: 1.45;
}

.prop-card-summary strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #193D4A;
}

/* Barra de alternância do Diff */
.prop-diff-toggle-bar {
  margin: 10px 0;
}

.btn-toggle-diff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #214655;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle-diff:hover {
  background: #eaf2f5;
  border-color: #214655;
  color: #193D4A;
}

/* Visualizador de Diff Seção a Seção */
.prop-diff-view {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 10px 0 14px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.diff-header-info {
  background: #eef4f7;
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #214655;
  border-bottom: 1px solid #e2e8f0;
}

.diff-content {
  padding: 6px 0;
}

.diff-line {
  display: flex;
  gap: 8px;
  padding: 2px 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-sym {
  font-weight: 700;
  user-select: none;
  flex-shrink: 0;
  width: 14px;
}

.diff-added {
  background: rgba(16, 185, 129, 0.12);
  color: #065f46;
  border-left: 3px solid #10b981;
}

.diff-removed {
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
  border-left: 3px solid #ef4444;
}

.diff-context {
  color: #64748b;
  border-left: 3px solid transparent;
}

/* Painel de Prévia do Documento Limpo */
.prop-preview-container {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafbfc;
  overflow: hidden;
  margin: 12px 0;
}

.prop-preview-label {
  background: #eef4f7;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #193D4A;
  border-bottom: 1px solid #e2e8f0;
}

.prop-preview-label span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.prop-preview-body {
  max-height: 320px;
  overflow-y: auto;
  padding: 16px;
  background: #ffffff;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #1e293b;
}

/* Barra de Ações da Proposta */
.prop-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #edf2f7;
}

.btn-prop-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-prop-action.btn-approve {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%);
  color: #0c1a20;
  border: 1px solid #FBB03B;
  box-shadow: 0 2px 6px rgba(251, 176, 59, 0.25);
}

.btn-prop-action.btn-approve:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 10px rgba(251, 176, 59, 0.35);
}

.btn-prop-action.btn-adjust,
.btn-prop-action.btn-edit {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #214655;
}

.btn-prop-action.btn-adjust:hover,
.btn-prop-action.btn-edit:hover {
  background: #f1f7f9;
  border-color: #214655;
  color: #193D4A;
}

.btn-prop-action.btn-discard {
  background: #ffffff;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.btn-prop-action.btn-discard:hover {
  background: #fef2f2;
  border-color: #dc2626;
}

.prop-resolved-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
}

.prop-resolved-badge.approved {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.prop-resolved-badge.discarded {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* Badges de Status na Barra de Navegação de Artefatos */
.badge-pill-status {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.badge-pill-status.approved {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.badge-pill-status.draft {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-pill-status.legacy {
  background: rgba(33, 70, 85, 0.12);
  color: #214655;
  border: 1px solid rgba(33, 70, 85, 0.25);
}

/* Badges da Etapa ADDIE na Barra de Navegação de Artefatos */
.badge-pill-step-tag {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1.2;
}

.badge-pill-step-tag.step-analise {
  background: rgba(33, 70, 85, 0.1);
  color: #193D4A;
  border: 1px solid rgba(25, 61, 74, 0.25);
}

.badge-pill-step-tag.step-design {
  background: rgba(251, 176, 59, 0.16);
  color: #b45309;
  border: 1px solid rgba(251, 176, 59, 0.4);
}

.badge-pill-step-tag.step-desenvolvimento {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-pill-step-tag.step-geral {
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.25);
}

/* --------------------------------------------------------------------------
   SOBREPOSIÇÕES PARA O TEMA ESCURO (DARK MODE - GOVERNANÇA DE ARTEFATOS)
   -------------------------------------------------------------------------- */

body.theme-dark .artifact-proposal-card {
  background: #142e38 !important;
  border-color: #1f4250 !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35) !important;
}

body.theme-dark .prop-card-title {
  color: #FBB03B !important;
}

body.theme-dark .badge-prop-type {
  background: #0d1e24 !important;
  color: #cbe0e7 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .badge-prop-status.new {
  background: rgba(251, 176, 59, 0.18) !important;
  color: #FBB03B !important;
  border-color: #FBB03B !important;
}

body.theme-dark .badge-prop-status.revision {
  background: rgba(33, 70, 85, 0.35) !important;
  color: #7dd3fc !important;
  border-color: #38bdf8 !important;
}

body.theme-dark .badge-prop-step {
  background: #0f232a !important;
  color: #8da7b2 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .badge-prop-module {
  background: #0f232a !important;
  color: #8da7b2 !important;
  border: 1px solid #1f3f4c !important;
}

body.theme-dark .prop-card-summary {
  background: #0d1e24 !important;
  border-left-color: #FBB03B !important;
  color: #e2edf1 !important;
}

body.theme-dark .prop-card-summary strong {
  color: #FBB03B !important;
}

body.theme-dark .btn-toggle-diff {
  background: #11242c !important;
  border-color: #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .btn-toggle-diff:hover {
  background: #173642 !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .prop-diff-view {
  background: #0d1e24 !important;
  border-color: #1f3f4c !important;
}

body.theme-dark .diff-header-info {
  background: #11242c !important;
  border-bottom-color: #1f3f4c !important;
  color: #8da7b2 !important;
}

body.theme-dark .diff-added {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6ee7b7 !important;
  border-left-color: #10b981 !important;
}

body.theme-dark .diff-removed {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #fca5a5 !important;
  border-left-color: #ef4444 !important;
}

body.theme-dark .diff-context {
  color: #8da7b2 !important;
}

body.theme-dark .prop-preview-container {
  border-color: #1f3f4c !important;
  background: #0d1e24 !important;
}

body.theme-dark .prop-preview-label {
  background: #11242c !important;
  border-bottom-color: #1f3f4c !important;
  color: #FBB03B !important;
}

body.theme-dark .prop-preview-body {
  background: #0f232a !important;
  color: #e2edf1 !important;
}

body.theme-dark .prop-actions-bar {
  border-top-color: #1f3f4c !important;
}

body.theme-dark .btn-prop-action.btn-approve {
  background: linear-gradient(135deg, #FBB03B 0%, #f59e0b 100%) !important;
  color: #0c1a20 !important;
  border-color: #FBB03B !important;
}

body.theme-dark .btn-prop-action.btn-approve:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  box-shadow: 0 4px 12px rgba(251, 176, 59, 0.4) !important;
}

body.theme-dark .btn-prop-action.btn-adjust,
body.theme-dark .btn-prop-action.btn-edit {
  background: #11242c !important;
  border-color: #1f3f4c !important;
  color: #cbe0e7 !important;
}

body.theme-dark .btn-prop-action.btn-adjust:hover,
body.theme-dark .btn-prop-action.btn-edit:hover {
  background: #173642 !important;
  border-color: #FBB03B !important;
  color: #FBB03B !important;
}

body.theme-dark .btn-prop-action.btn-discard {
  background: #1c1417 !important;
  border-color: #7f1d1d !important;
  color: #fca5a5 !important;
}

body.theme-dark .btn-prop-action.btn-discard:hover {
  background: #2b171c !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

body.theme-dark .prop-resolved-badge.approved {
  background: #064e3b !important;
  color: #a7f3d0 !important;
  border-color: #059669 !important;
}

body.theme-dark .prop-resolved-badge.discarded {
  background: #450a0a !important;
  color: #fecaca !important;
  border-color: #dc2626 !important;
}

body.theme-dark .badge-pill-status.approved {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

body.theme-dark .badge-pill-status.draft {
  background: rgba(251, 176, 59, 0.18) !important;
  color: #FBB03B !important;
  border-color: rgba(251, 176, 59, 0.35) !important;
}

body.theme-dark .badge-pill-status.legacy {
  background: rgba(141, 167, 178, 0.15) !important;
  color: #8da7b2 !important;
  border-color: rgba(141, 167, 178, 0.3) !important;
}

body.theme-dark .badge-pill-step-tag.step-analise {
  background: rgba(33, 70, 85, 0.4) !important;
  color: #8ed6ec !important;
  border-color: rgba(33, 70, 85, 0.65) !important;
}

body.theme-dark .badge-pill-step-tag.step-design {
  background: rgba(251, 176, 59, 0.2) !important;
  color: #FBB03B !important;
  border-color: rgba(251, 176, 59, 0.45) !important;
}

body.theme-dark .badge-pill-step-tag.step-desenvolvimento {
  background: rgba(14, 165, 233, 0.2) !important;
  color: #38bdf8 !important;
  border-color: rgba(14, 165, 233, 0.45) !important;
}

body.theme-dark .badge-pill-step-tag.step-geral {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

/* ==========================================================================
   RELÓGIO DE TOKENS & TELEMETRIA DA API (ESTILOS COMPLETOS)
   ========================================================================== */

/* Botão no Cabeçalho */
.btn-tool.btn-tokens {
  border-color: rgba(251, 176, 59, 0.4);
}

.btn-tool.btn-tokens:hover {
  border-color: #FBB03B;
  background: rgba(251, 176, 59, 0.08);
}

.btn-tool.btn-tokens i {
  color: #d97706;
}

.badge-count.badge-tokens {
  background: rgba(251, 176, 59, 0.18);
  color: #b45309;
  border: 1px solid rgba(251, 176, 59, 0.4);
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  letter-spacing: -0.2px;
}

body.theme-dark .btn-tool.btn-tokens {
  border-color: rgba(251, 176, 59, 0.35);
  background: #11242c;
}

body.theme-dark .btn-tool.btn-tokens:hover {
  background: #193844;
  border-color: #FBB03B;
}

body.theme-dark .btn-tool.btn-tokens i {
  color: #FBB03B;
}

body.theme-dark .badge-count.badge-tokens {
  background: rgba(251, 176, 59, 0.22);
  color: #FBB03B;
  border-color: rgba(251, 176, 59, 0.5);
}

/* Modal de Tokens */
.modal-content.modal-tokens {
  max-width: 1040px;
  width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header-icon-box.tokens {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(251, 176, 59, 0.25) 0%, rgba(217, 119, 6, 0.25) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d97706;
  border: 1.5px solid rgba(251, 176, 59, 0.45);
  flex-shrink: 0;
}

body.theme-dark .modal-header-icon-box.tokens {
  background: linear-gradient(135deg, rgba(251, 176, 59, 0.2) 0%, rgba(251, 176, 59, 0.05) 100%);
  color: #FBB03B;
  border-color: rgba(251, 176, 59, 0.4);
}

/* Barra de Filtros */
.tokens-filter-bar {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.tokens-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tokens-filter-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  white-space: nowrap;
}

.tokens-filter-group label i {
  width: 14px;
  height: 14px;
}

.select-scope {
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  min-width: 220px;
}

/* Pílulas de Período */
.tokens-period-pills {
  display: flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
  flex-wrap: wrap;
}

.period-pill-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.period-pill-btn:hover {
  color: var(--norma-teal-dark);
}

.period-pill-btn.active {
  background: #ffffff;
  color: var(--norma-teal-dark);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tokens-custom-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.date-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.date-input-wrap input {
  padding: 4px 8px;
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.tokens-filter-actions {
  margin-left: auto;
}

/* Grade de KPIs */
.tokens-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.token-kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

.token-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.token-kpi-card.highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #ffffff 0%, rgba(16, 185, 129, 0.04) 100%);
}

.kpi-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-box i {
  width: 20px;
  height: 20px;
}

.kpi-icon-box.gold {
  background: rgba(251, 176, 59, 0.15);
  color: #d97706;
}

.kpi-icon-box.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.kpi-icon-box.green {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.kpi-icon-box.purple {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
}

.kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.kpi-val-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-value {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.kpi-badge {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(251, 176, 59, 0.18);
  color: #b45309;
}

.kpi-badge.cost {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

.kpi-badge.neutral {
  background: #f1f5f9;
  color: #64748b;
}

.kpi-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 4px 0 0 0;
  line-height: 1.3;
}

.kpi-split-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.kpi-split-row span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.kpi-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(16, 185, 129, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.kpi-progress-bar {
  height: 100%;
  background: #3b82f6;
  border-radius: 3px 0 0 3px;
  transition: width 0.4s ease;
}

/* Painéis de Distribuição (Grid 2 colunas) */
.tokens-breakdown-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
}

.tokens-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.tokens-box-header {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tokens-box-header h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tokens-box-header h4 i {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
}

.box-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
}

.tokens-box-body {
  padding: 14px 16px;
}

.tokens-box-body.no-padding {
  padding: 0;
}

/* Listas com Barras */
.tokens-bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tokens-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tokens-bar-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
}

.tokens-bar-item-name {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
}

.tokens-bar-item-stats {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tokens-bar-track {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.tokens-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #193D4A 0%, #2b6176 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.tokens-bar-fill.gold {
  background: linear-gradient(90deg, #FBB03B 0%, #d97706 100%);
}

.tokens-bar-fill.purple {
  background: linear-gradient(90deg, #8b5cf6 0%, #6d28d9 100%);
}

.tokens-bar-fill.green {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.tokens-models-section h5 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 6px 0;
  letter-spacing: 0.4px;
}

.tokens-bar-list.mini .tokens-bar-track {
  height: 5px;
}

/* Tabela de Logs */
.table-scrollable {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.tokens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
  text-align: left;
}

.tokens-table th {
  background: #f1f5f9;
  padding: 8px 12px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1;
}

.tokens-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.tokens-table tr:hover td {
  background: #f8fafc;
}

.token-op-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  display: inline-block;
}

.token-op-badge.chat {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.token-op-badge.proposta_artefato {
  background: rgba(251, 176, 59, 0.18);
  color: #b45309;
}

.token-op-badge.auditoria_qa {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

.token-model-badge {
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.token-num-cell {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
}

.footer-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* ==========================================================================
   DARK MODE PARA O RELÓGIO DE TOKENS
   ========================================================================== */
body.theme-dark .tokens-filter-bar {
  background: #11242c;
  border-color: #1f3f4c;
}

body.theme-dark .select-scope {
  background: #0d1a20;
  border-color: #1f3f4c;
  color: #f1f5f9;
}

body.theme-dark .tokens-period-pills {
  background: #0d1a20;
}

body.theme-dark .period-pill-btn {
  color: #94a3b8;
}

body.theme-dark .period-pill-btn:hover {
  color: #f1f5f9;
}

body.theme-dark .period-pill-btn.active {
  background: #193D4A;
  color: #FBB03B;
}

body.theme-dark .tokens-custom-date-row input {
  background: #0d1a20;
  border-color: #1f3f4c;
  color: #f1f5f9;
}

body.theme-dark .token-kpi-card {
  background: #11242c;
  border-color: #1f3f4c;
}

body.theme-dark .token-kpi-card.highlight {
  background: linear-gradient(135deg, #11242c 0%, rgba(16, 185, 129, 0.08) 100%);
  border-color: rgba(16, 185, 129, 0.4);
}

body.theme-dark .kpi-value {
  color: #f1f5f9;
}

body.theme-dark .kpi-badge.neutral {
  background: #193D4A;
  color: #94a3b8;
}

body.theme-dark .tokens-box {
  background: #11242c;
  border-color: #1f3f4c;
}

body.theme-dark .tokens-box-header {
  background: #0d1a20;
  border-color: #1f3f4c;
}

body.theme-dark .tokens-box-header h4 {
  color: #f1f5f9;
}

body.theme-dark .box-badge {
  background: #193D4A;
  color: #cbd5e1;
}

body.theme-dark .tokens-bar-track {
  background: #193D4A;
}

body.theme-dark .tokens-bar-item-name {
  color: #f1f5f9;
}

body.theme-dark .tokens-table th {
  background: #0d1a20;
  border-color: #1f3f4c;
  color: #cbd5e1;
}

body.theme-dark .tokens-table td {
  border-color: #1f3f4c;
  color: #f1f5f9;
}

body.theme-dark .tokens-table tr:hover td {
  background: #16303b;
}

body.theme-dark .token-model-badge {
  background: #193D4A;
  color: #94a3b8;
}

@media (max-width: 900px) {
  .tokens-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tokens-breakdown-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .tokens-kpi-grid {
    grid-template-columns: 1fr;
  }
  .tokens-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .select-scope {
    width: 100%;
  }
}

/* ==========================================================================
   TELA CHEIA DE LOGIN PROFISSIONAL (SUPABASE AUTH)
   ========================================================================== */

.login-screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.login-screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-container {
  display: flex;
  width: 100%;
  max-width: 980px;
  min-height: 600px;
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 24px 60px -12px rgba(25, 61, 74, 0.25), 0 12px 24px -8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
}

/* Painel Esquerdo: Branding e Recursos */
.login-brand-panel {
  flex: 1;
  background: linear-gradient(145deg, #122c36 0%, #193D4A 55%, #214655 100%);
  color: #ffffff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-brand-panel::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 176, 59, 0.22) 0%, transparent 70%);
  pointer-events: none;
}

.login-brand-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-logo-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon.large {
  width: 52px;
  height: 52px;
  font-size: 28px;
  border-radius: 14px;
  background: var(--gradient-gold);
  color: #193D4A;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(251, 176, 59, 0.4);
}

.login-brand-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  color: #ffffff;
}

.login-brand-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--norma-amber-gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

.login-brand-tagline {
  font-size: 0.95rem;
  color: #c7dbe3;
  line-height: 1.5;
  margin-top: 6px;
}

.login-features-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 36px 0;
}

.login-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.login-feature-item .feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--norma-amber-gold);
  flex-shrink: 0;
}

.login-feature-item strong {
  display: block;
  font-size: 0.95rem;
  color: #ffffff;
  font-weight: 600;
}

.login-feature-item p {
  font-size: 0.82rem;
  color: #9cb8c4;
  margin: 2px 0 0;
  line-height: 1.4;
}

.login-brand-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #83a5b3;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
}

/* Painel Direito: Formulário */
.login-form-panel {
  flex: 1.15;
  padding: 48px 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
}

.login-form-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-card-header h2 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-card-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Alerta de Erro */
.login-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-danger);
  font-size: 0.86rem;
  font-weight: 500;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.login-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.login-input-wrapper input {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 42px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.92rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.login-input-wrapper input:focus {
  outline: none;
  border-color: var(--norma-amber-gold);
  box-shadow: 0 0 0 3px rgba(251, 176, 59, 0.18);
}

.login-eye-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s;
}

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

.login-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
  margin-bottom: 16px;
}

.remember-me-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.login-submit-btn {
  width: 100%;
  height: 48px;
  background: var(--gradient-accent);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(25, 61, 74, 0.25);
  transition: all 0.2s ease;
}

.login-submit-btn:hover {
  background: var(--gradient-accent-hover);
  box-shadow: 0 8px 24px rgba(25, 61, 74, 0.35);
  transform: translateY(-1px);
}

.login-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Chips de Acesso Rápido de Demonstração */
.login-quick-demo {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-demo-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-demo-divider::before,
.quick-demo-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.quick-demo-divider span {
  padding: 0 10px;
}

.quick-demo-chips {
  display: flex;
  gap: 8px;
}

.quick-chip {
  flex: 1;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-chip:hover {
  background: var(--bg-card-muted);
  border-color: var(--norma-amber-gold);
  color: var(--norma-teal-dark);
}

/* ==========================================================================
   USUÁRIO AUTENTICADO: SIDEBAR E HEADER
   ========================================================================== */

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.user-session-box {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.sidebar-footer-actions .admin-link-btn {
  flex: 1;
}

.user-session-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.user-avatar-circle.small {
  width: 28px;
  height: 28px;
  font-size: 0.72rem;
}

.user-session-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

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

.user-session-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn,
.header-logout-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sidebar-logout-btn:hover,
.header-logout-btn:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
}

.role-badge-pill {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(25, 61, 74, 0.1);
  color: var(--norma-teal-dark);
}

body.role-designer .role-badge-pill {
  background: rgba(33, 70, 85, 0.12);
  color: #193D4A;
}

body.role-pmo .role-badge-pill {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
}

body.role-admin .role-badge-pill {
  background: rgba(251, 176, 59, 0.2);
  color: #b45309;
}

/* Header User Pill */
.header-user-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.header-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

@media (max-width: 820px) {
  .login-container {
    flex-direction: column;
    max-width: 480px;
    min-height: auto;
  }
  .login-brand-panel {
    padding: 32px 28px;
  }
  .login-features-list {
    display: none;
  }
  .login-form-panel {
    padding: 36px 28px;
  }
}

/* Modo Escuro: Card do Usuário no Rodapé da Sidebar */
body.theme-dark .sidebar-footer {
  border-top-color: #1f3f4c !important;
}

body.theme-dark .user-session-box {
  background-color: #11262f !important;
  border-color: #1f3f4c !important;
}

body.theme-dark .role-badge-status {
  color: #9cb8c4 !important;
}

/* ==========================================================================
   ESTILOS DE IMPRESSÃO (PDF / A4)
   Garante que a impressão mostre estritamente o artefato/documento,
   ocultando toda a interface do sistema (header, chat, sidebar, etc.)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 18mm 16mm 18mm 16mm;
  }

  /* Oculta toda a interface do sistema operacional */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .sidebar-left,
  .app-header,
  .chat-steps-bar,
  .chat-section,
  .editor-header,
  .editor-toolbar,
  .input-box,
  .modal-overlay,
  .toast-container,
  .sidebar-collapse-btn,
  .floating-sidebar-toggle-btn,
  .versions-history-list,
  .api-status,
  .editor-actions {
    display: none !important;
    visibility: hidden !important;
  }

  .app-container {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .workspace-main,
  .editor-section,
  .editor-body,
  .artifact-sheet-wrapper {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  .artifact-preview-box {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt !important;
    line-height: 1.6 !important;
  }

  .artifact-text-editor {
    display: none !important;
  }

  /* Evita quebras de página desagradáveis em títulos, tabelas e citações */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
    color: #193D4A !important;
  }

  table, figure, pre, blockquote {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  table {
    border-collapse: collapse !important;
    width: 100% !important;
  }

  th, td {
    border: 1px solid #cbd5e1 !important;
    padding: 6px 10px !important;
  }

  th {
    background-color: #193D4A !important;
    color: #ffffff !important;
  }

  blockquote {
    border-left: 4px solid #FBB03B !important;
    background-color: #fefce8 !important;
    color: #854d0e !important;
  }
}

/* Formulário de entrada do AIDIA */
.login-screen-overlay .login-container {
  display: block;
  width: min(100%, 520px);
  min-height: auto;
}
.login-screen-overlay .login-form-panel {
  width: 100%;
  min-height: auto;
  padding: clamp(24px, 6vw, 44px);
}
.login-screen-overlay .login-form-card {
  max-width: none;
}
