﻿/* ==========================================================================
   HERMES APMT WEB â€” ESTILOS INSTITUCIONAIS HOMOLOGADOS (MISSÃƒO 42)
   Design System Institucional: Navy Blue, Gold Accent, Tipografia Limpa
   CompatÃ­vel com ResoluÃ§Ãµes Desktop de EstaÃ§Ãµes APMT (1366x768 atÃ© 4K)
   ========================================================================== */

:root {
  --primary: #0a2540;
  --primary-hover: #14385f;
  --primary-light: #1e3a8a;
  --accent: #d4af37;
  --accent-hover: #b8972e;
  --accent-soft: rgba(212, 175, 55, 0.15);
  --bg-main: #0b1120;
  --bg-sidebar: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #334155;
  --border: #334155;
  --border-light: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --msg-user-bg: #1e3a8a;
  --msg-asst-bg: #1e293b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   HEADER INSTITUCIONAL
   ========================================================================== */
.header-bar {
  background-color: var(--primary);
  border-bottom: 2px solid var(--accent);
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.user-name {
  font-weight: 600;
  color: #ffffff;
}

.user-role-badge {
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.btn-logout {
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.main-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR (HISTÃ“RICO PRIVADO)
   ========================================================================== */
.sidebar {
  width: 290px;
  min-width: 290px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.btn-new-chat {
  width: 100%;
  background: var(--primary-light);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.btn-new-chat:hover {
  background: var(--primary-hover);
  border-color: var(--accent);
}

.sessions-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.session-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.5rem 0.5rem 0.25rem 0.5rem;
  letter-spacing: 0.5px;
}

.session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  user-select: none;
}

.session-card:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.session-card.active {
  background: var(--bg-surface);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

.session-card-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.session-card-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
}

.session-card-time {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.session-actions {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.session-card:hover .session-actions,
.session-card.active .session-actions {
  display: flex;
}

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

.btn-action-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-action-icon.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.status-dot.offline {
  background-color: var(--danger, #e63946) !important;
  box-shadow: 0 0 6px var(--danger, #e63946) !important;
}

.status-dot.warning {
  background-color: var(--warning, #e9c46a) !important;
  box-shadow: 0 0 6px var(--warning, #e9c46a) !important;
}

/* ==========================================================================
   ÃREA DE CHAT CENTRAL
   ========================================================================== */
.chat-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  position: relative;
}

.chat-header {
  height: 48px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
}

.chat-header-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Mensagens */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 820px;
  width: 100%;
}

.msg-row.user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.msg-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-avatar.user-avatar {
  background: var(--primary-light);
  color: #ffffff;
}

.msg-avatar.hermes-avatar {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.msg-bubble {
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: 0.92rem;
  position: relative;
  word-break: break-word;
}

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

.msg-row.assistant .msg-bubble {
  background-color: var(--msg-asst-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
}

/* Markdown styling inside assistant message */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3, .msg-bubble h4 {
  margin: 0.8rem 0 0.4rem 0;
  color: #ffffff;
  font-weight: 600;
}
.msg-bubble h1 { font-size: 1.25rem; }
.msg-bubble h2 { font-size: 1.1rem; }
.msg-bubble h3 { font-size: 1rem; }

.msg-bubble p {
  margin-bottom: 0.6rem;
}
.msg-bubble p:last-child {
  margin-bottom: 0;
}

.msg-bubble ul, .msg-bubble ol {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

.msg-bubble li {
  margin-bottom: 0.25rem;
}

.msg-bubble pre {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin: 0.6rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.msg-bubble code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 5px;
  border-radius: 3px;
  color: #f0c27f;
}

.msg-bubble pre code {
  background: transparent;
  padding: 0;
  color: #e2e8f0;
}

.msg-bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6rem 0;
  font-size: 0.85rem;
}

.msg-bubble th, .msg-bubble td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.msg-bubble th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.msg-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
}

.btn-copy {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-copy:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

/* Indicador de processamento */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.5rem 0.75rem;
}

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

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   CARDS DE ANEXO E ARTEFATO
   ========================================================================== */
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: #e2e8f0;
}

.artifact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin: 0.6rem 0;
  gap: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.artifact-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.artifact-icon {
  background: var(--accent-soft);
  color: var(--accent);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.artifact-meta {
  display: flex;
  flex-direction: column;
}

.artifact-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffffff;
}

.artifact-size {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.btn-download-artifact {
  background: var(--accent);
  color: var(--primary);
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-download-artifact:hover {
  background: var(--accent-hover);
}

/* ==========================================================================
   COMPOSER (BARRA INFERIOR DE ENTRADA)
   ========================================================================== */
.composer-area {
  padding: 1rem 1.5rem;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attachment-staging {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  background: var(--bg-surface);
  border: 1px dashed var(--accent);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: #cbd5e1;
  max-height: 120px;
  overflow-y: auto;
}

.attachment-staging-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.25rem;
}

.btn-clear-all-attachments {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-clear-all-attachments:hover {
  background: var(--danger);
  color: #ffffff;
}

.attachment-staging-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.attachment-staging-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.22rem 0.5rem;
  font-size: 0.78rem;
  color: #e2e8f0;
  max-width: 100%;
}

.staged-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.btn-detach {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 4px;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  transition: border-color 0.2s;
}

.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.composer-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  min-height: 24px;
  max-height: 180px;
  line-height: 1.5;
  padding: 4px 0;
}

.composer-textarea::placeholder {
  color: var(--text-dim);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-composer-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-composer-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-send {
  background: var(--accent);
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.composer-footer-note {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

/* ==========================================================================
   MODAIS E NOTIFICAÃ‡Ã•ES
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #ffffff;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.modal-input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  outline: none;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-modal-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.btn-modal-confirm {
  background: var(--accent);
  color: var(--primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
}

.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideIn 0.25s ease-out;
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}

.toast.toast-warning {
  border-left: 4px solid var(--accent);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   ESTILOS DE LOGIN INSTITUCIONAL
   ========================================================================== */
.login-body {
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0b1120 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4), 0 8px 10px -6px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  color: #ffffff;
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: 0.5px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-form-group {
  margin-bottom: 1.25rem;
}

.login-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
}

.login-form-group input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.btn-login {
  width: 100%;
  background: var(--accent);
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.btn-login:hover {
  background: var(--accent-hover);
}

.login-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: none;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.login-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2rem;
  line-height: 1.4;
}

/* ==========================================================================
   RAG INSTITUCIONAL APMT â€” CITAÃ‡Ã•ES E PROVENIÃŠNCIA (MISSÃƒO 43)
   ========================================================================== */
.rag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.rag-sources-panel {
  margin-top: 0.75rem;
  padding: 0.75rem 0.95rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.rag-sources-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rag-sources-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rag-sources-list li {
  color: var(--text-muted);
  line-height: 1.45;
}

.rag-source-num {
  font-weight: 700;
  color: var(--accent);
  margin-right: 0.25rem;
}

.rag-source-name {
  color: var(--text-main);
  font-weight: 600;
}

.rag-source-page {
  color: #38bdf8;
  font-weight: 600;
}

.rag-source-heading {
  color: #cbd5e1;
  font-style: italic;
}


/* ==========================================================================
   INDICADOR VISUAL DE PROGRESSO DE MISSÕES — HERMES APMT
   ========================================================================== */

.mission-progress-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border: 1px solid rgba(0, 180, 216, 0.3);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  margin: 0.85rem 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.25s ease-in-out;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 680px;
}

.mission-progress-card.state-concluida {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.1);
}

.mission-progress-card.state-pendente-conferencia {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.1);
}

.mission-progress-card.state-interrompida {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(40, 15, 15, 0.95), rgba(30, 20, 20, 0.9));
}

.mission-header {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.mission-gauge-wrapper {
  position: relative;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mission-circle-gauge {
  width: 54px;
  height: 54px;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 3.5;
}

.gauge-fill {
  fill: none;
  stroke: #00b4d8;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 113.1;
  stroke-dashoffset: 113.1;
  transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

.state-concluida .gauge-fill {
  stroke: #10b981;
}

.state-pendente-conferencia .gauge-fill {
  stroke: #f59e0b;
}

.state-interrompida .gauge-fill {
  stroke: #ef4444;
}

.mission-percent-large {
  position: absolute;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
}

.mission-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
  min-width: 0;
}

.mission-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mission-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.mission-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mission-badge.status-processando {
  background: rgba(0, 180, 216, 0.15);
  color: #00b4d8;
  border: 1px solid rgba(0, 180, 216, 0.3);
}

.mission-badge.status-concluida {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.mission-badge.status-pendente-conferencia {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mission-badge.status-interrompida {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.mission-current-step {
  font-size: 0.85rem;
  color: #cbd5e1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mission-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mission-meta-row strong {
  color: #f1f5f9;
}

.mission-meta-separator {
  color: var(--text-dim);
}

.mission-fallback-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  padding: 3px 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 600;
}

.mission-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.mission-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00b4d8, #48cae4);
  border-radius: 3px;
  transition: width 0.35s ease;
}

.state-concluida .mission-progress-bar {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.state-pendente-conferencia .mission-progress-bar {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.state-interrompida .mission-progress-bar {
  background: #ef4444;
}

.mission-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.btn-mission-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-mission-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-cancel-mission {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-cancel-mission:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.btn-toggle-details svg {
  transition: transform 0.2s ease;
}

.btn-toggle-details.expanded svg {
  transform: rotate(180deg);
}

.mission-details-panel {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mission-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
  padding: 3px 0;
}

.step-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-icon.icon-done {
  color: #10b981;
}

.step-icon.icon-active {
  color: #00b4d8;
  animation: spin 1.2s linear infinite;
}

.step-icon.icon-pending {
  color: var(--text-dim);
}

.step-icon.icon-failed {
  color: #ef4444;
}

.mission-step-item.is-active {
  color: #ffffff;
  font-weight: 600;
}

.mission-step-item.is-done {
  color: #cbd5e1;
}

.mission-step-item.is-failed {
  color: #fca5a5;
}

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