@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@400;500;600;700&display=swap');@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');:root {
  /* Google Fonts Import */
  

  /* Typography */
  --font-main: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --font-code: 'ui-monospace', 'SFMono-Regular', 'Consolas', monospace;

  /* Theme Defaults (Light Mode - Antigravity Style - Blue) */
  --bg-app: #ffffff;
  --bg-sidebar: #f8f9fa;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0f4f9;
  --bg-input: #f0f4f9;
  
  --text-primary: #1f1f1f;
  --text-secondary: #444746;
  --text-tertiary: #747775;
  
  --border-subtle: #e3e3e3;
  --border-strong: #c4c7c5;
  
  --accent-primary: #0b57d0;
  --accent-hover: #0842a0;
  --accent-bg: #d3e3fd;
  
  --success: #146c2e;
  --success-bg: #c4eed0;
  --danger: #b3261e;
  --danger-bg: #f9dedc;
  --warning: #b3261e;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-float: 0 8px 30px rgba(0,0,0,0.12);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Chat Bubbles */
  --chat-user-bg: var(--bg-surface-hover);
  --chat-user-text: var(--text-primary);
  --chat-bot-bg: transparent;
  --chat-bot-text: var(--text-primary);
}

/* Color Themes (Light Mode Overrides) */
:root[data-color-theme='emerald'] {
  --accent-primary: #0d652d;
  --accent-hover: #0a4f23;
  --accent-bg: #c4eed0;
}
:root[data-color-theme='amethyst'] {
  --accent-primary: #6b21a8;
  --accent-hover: #581c87;
  --accent-bg: #e9d5ff;
}
:root[data-color-theme='amber'] {
  --accent-primary: #b45309;
  --accent-hover: #92400e;
  --accent-bg: #fef3c7;
}
:root[data-color-theme='ruby'] {
  --accent-primary: #be123c;
  --accent-hover: #9f1239;
  --accent-bg: #ffe4e6;
}

[data-theme='dark'] {
  /* Theme Overrides (Dark Mode - Antigravity Style - Blue) */
  --bg-app: #131314;
  --bg-sidebar: #1e1f22;
  --bg-surface: #282a2d;
  --bg-surface-hover: #333538;
  --bg-input: #1e1f22;
  
  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --text-tertiary: #8e918f;
  
  --border-subtle: #444746;
  --border-strong: #747775;
  
  --accent-primary: #a8c7fa;
  --accent-hover: #c2e7ff;
  --accent-bg: rgba(168, 199, 250, 0.15);
  
  --success: #6dd58c;
  --success-bg: rgba(109, 213, 140, 0.15);
  --danger: #f2b8b5;
  --danger-bg: rgba(242, 184, 181, 0.15);
  --warning: #f2b8b5;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
  --shadow-float: 0 8px 30px rgba(0,0,0,0.4);

  /* Chat Bubbles */
  --chat-user-bg: #1e1f22;
  --chat-user-text: var(--text-primary);
}

/* Color Themes (Dark Mode Overrides) */
[data-theme='dark'][data-color-theme='emerald'] {
  --accent-primary: #6dd58c;
  --accent-hover: #81c995;
  --accent-bg: rgba(109, 213, 140, 0.15);
}
[data-theme='dark'][data-color-theme='amethyst'] {
  --accent-primary: #d8b4fe;
  --accent-hover: #e9d5ff;
  --accent-bg: rgba(216, 180, 254, 0.15);
}
[data-theme='dark'][data-color-theme='amber'] {
  --accent-primary: #fcd34d;
  --accent-hover: #fde68a;
  --accent-bg: rgba(252, 211, 77, 0.15);
}
[data-theme='dark'][data-color-theme='ruby'] {
  --accent-primary: #fda4af;
  --accent-hover: #fecdd3;
  --accent-bg: rgba(253, 164, 175, 0.15);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ========================================================= */
/* LAYOUT PRINCIPALE                                         */
/* ========================================================= */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.sidebar-header .bot-icon {
  color: var(--accent-primary);
  background: var(--accent-bg);
  padding: 8px;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

/* Sezioni Sidebar */
.sidebar-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.sidebar-section:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.sidebar-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

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

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}
.btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Select & Input Glass (Minimal) */
.control-group {
  margin-bottom: 16px;
}
.control-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.select-glass, .input-glass {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.select-glass:focus, .input-glass:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* Checkbox Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.checkbox-glass {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.checkbox-glass:hover {
  background-color: var(--bg-surface-hover);
}
.checkbox-glass.checked {
  background-color: var(--accent-bg);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Badge Identità */
.identity-badge {
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 20px;
}
.identity-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.identity-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}
.identity-details .label {
  color: var(--text-secondary);
  margin-right: 6px;
}
.identity-details .val {
  color: var(--text-primary);
  font-weight: 500;
}

/* Docs List & Cards */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.doc-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all 0.2s ease;
}
.doc-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.doc-card-title {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.doc-card-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.badge-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}
.badge-tag.dept {
  background-color: var(--bg-surface-hover);
  color: var(--text-secondary);
}
.doc-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.7rem;
}
.status-indicator.COMPLETED { color: var(--success); }
.status-indicator.PROCESSING { color: var(--accent-primary); }
.status-indicator.ERROR { color: var(--danger); }

/* LLM Cards */
.llm-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  border-radius: var(--radius-md);
}
.llm-icon {
  color: var(--accent-primary);
  background: var(--accent-bg);
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* --- MAIN CONTENT (CHAT) --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  position: relative;
}

/* Top Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background-color: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.model-badge {
  background-color: var(--accent-bg);
  color: var(--accent-primary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-code);
}
.theme-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* Chat History */
.chat-history {
  flex: 1;
  padding: 32px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Message Bubble Layout */
.message-wrapper {
  display: flex;
  gap: 16px;
  max-width: 850px;
  margin: 0 auto;
  width: 100%;
}
.message-wrapper.user {
  flex-direction: row-reverse;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--bg-surface-hover);
  color: var(--text-secondary);
}
.message-wrapper.bot .avatar {
  background-color: var(--accent-bg);
  color: var(--accent-primary);
}

.message-bubble {
  max-width: 80%;
  font-size: 1rem;
  line-height: 1.6;
}
.message-wrapper.user .message-bubble {
  background-color: var(--chat-user-bg);
  color: var(--chat-user-text);
  padding: 12px 20px;
  border-radius: 20px 20px 4px 20px;
}
.message-wrapper.bot .message-bubble {
  background-color: var(--chat-bot-bg);
  color: var(--chat-bot-text);
  padding: 12px 0;
}

/* Citations */
.citations-box {
  margin-top: 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}
.citations-box h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.citation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.citation-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.citation-score {
  background-color: var(--success-bg);
  color: var(--success);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.citation-content {
  font-size: 0.85rem;
  color: var(--text-primary);
}
.citation-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 6px;
  display: flex;
  gap: 12px;
}

/* Tool Execution Approval Card */
.approval-card {
  margin-top: 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.approval-card-header {
  background-color: var(--accent-bg);
  color: var(--accent-primary);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.approval-card-body {
  padding: 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.approval-card-body pre {
  background-color: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 0.8rem;
}
.approval-card-actions {
  display: flex;
  gap: 12px;
  padding: 0 16px 16px;
}
.approve-btn, .reject-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font-main);
}
.approve-btn {
  background-color: var(--accent-primary);
  color: #fff;
}
.approve-btn:hover { background-color: var(--accent-hover); }
.reject-btn {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.reject-btn:hover { background-color: var(--bg-surface-hover); color: var(--text-primary); }

.actioned-status {
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
}
.actioned-status.approved { color: var(--success); }
.actioned-status.rejected { color: var(--text-secondary); }

/* Input Area Floating */
.input-area-wrapper {
  padding: 0 24px 32px;
  background: transparent;
}
.input-area {
  max-width: 850px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 32px;
  padding: 8px 8px 8px 24px;
  box-shadow: var(--shadow-float);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.input-area:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 8px 40px rgba(11, 87, 208, 0.15);
}
.input-area input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-main);
  outline: none;
}
.input-area input::placeholder {
  color: var(--text-tertiary);
}
.send-btn {
  background-color: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.send-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
  transform: scale(1.05);
}
.send-btn:disabled {
  background-color: var(--bg-surface-hover);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
}
.modal-content {
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-float);
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}
.modal-header h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-full);
}
.modal-close-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Buttons in Modals */
.btn-primary, .btn-secondary {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font-main);
  font-size: 0.9rem;
}
.btn-primary {
  background-color: var(--accent-primary);
  color: #fff;
}
.btn-primary:hover { background-color: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 0 24px;
}
.modal-tab-btn {
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-family: var(--font-main);
  font-size: 0.9rem;
}
.modal-tab-btn:hover { color: var(--text-primary); }
.modal-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Animations */
.spin {
  animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--text-tertiary);
  border-radius: 50%;
  margin-right: 4px;
  animation: typing 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* React Markdown adjustments */
.message-bubble pre {
  background-color: var(--bg-surface-hover);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border-subtle);
}
.message-bubble code {
  font-family: var(--font-code);
  font-size: 0.9em;
  background-color: var(--bg-surface-hover);
  padding: 2px 4px;
  border-radius: 4px;
}
.message-bubble pre code {
  background-color: transparent;
  padding: 0;
}
.message-bubble p {
  margin-bottom: 12px;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}
.message-bubble ul, .message-bubble ol {
  margin-bottom: 12px;
  padding-left: 20px;
}

/* --- LAYOUT FIXES --- */
#root {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  position: relative;
  overflow: hidden;
  height: 100vh;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

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

.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.welcome-screen h2 {
  font-size: 2rem;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.welcome-screen p {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

/* --- SIDEBAR NAV (OPTION B) --- */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 0.95rem;
  font-family: var(--font-main);
}
.nav-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background-color: var(--accent-bg);
  color: var(--accent-primary);
  font-weight: 600;
}
.nav-user {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nav-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Theme Color Selector */
.color-picker {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s;
}
.color-swatch:hover {
  transform: scale(1.1);
}
.color-swatch.active {
  border-color: var(--text-primary);
  transform: scale(1.1);
}
.theme-selector-group {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-main);
  font-weight: 500;
}
.theme-btn.active {
  background: var(--accent-bg);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* --- SPLIT SCREEN LAYOUT --- */
.main-panel-split {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
.left-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 400px;
  border-right: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}
.right-pane-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  max-width: 50%;
  min-width: 400px;
  animation: slideInRight 0.3s ease-out;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- CHAT HISTORY (SIDEBAR) --- */
.chat-history-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
}
.history-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 4px;
  padding-left: 8px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* --- MULTI-AGENT SELECTOR --- */
.agent-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}
.agent-pill {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-app);
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.agent-pill svg {
  flex-shrink: 0;
  display: block;
}
.agent-pill:hover {
  border-color: var(--text-tertiary);
}
.agent-pill.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* --- QUICK ACTIONS --- */
.quick-actions-bar {
  display: flex;
  gap: 8px;
  padding: 0 24px 12px 24px;
  overflow-x: auto;
}
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.quick-action-btn:hover {
  background: var(--accent-bg);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* --- LIBRARY VIEW --- */
.library-container {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}
.library-folder {
  margin-bottom: 16px;
}
.library-folder-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.library-doc-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s;
}
.library-doc-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.library-doc-icon {
  color: var(--danger);
  margin-bottom: 8px;
}
.library-doc-title {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-doc-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* --- DOCUMENT VIEWER PANE --- */
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.viewer-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.viewer-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.viewer-close:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}
.viewer-content {
  flex: 1;
  padding: 32px;
  background: var(--bg-input);
  overflow-y: auto;
}
.mock-pdf-page {
  background: white;
  padding: 40px;
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  min-height: 800px;
  color: #333;
}
[data-theme='dark'] .mock-pdf-page {
  background: #1e1e1e;
  color: #ccc;
}
.highlight-yellow {
  background-color: rgba(255, 235, 59, 0.4);
  padding: 2px 4px;
  border-radius: 2px;
}

/* Canvas Editor */
.canvas-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}
.canvas-toggle-btn.active, .canvas-toggle-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}
.canvas-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}
[data-theme='dark'] .canvas-editor {
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}
.canvas-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-hover);
}
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.toolbar-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}
.canvas-textarea {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  padding: 24px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: transparent;
  outline: none;
}

/* Graph RAG Visualization Mock */
.graph-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px;
  overflow: hidden;
}
.graph-header {
  margin-bottom: 24px;
}
.graph-header h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  background: var(--text-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.graph-header p {
  color: var(--text-secondary);
}
.graph-visualization-mock {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.graph-edges {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
}
.edge {
  stroke: var(--accent-primary);
  stroke-width: 2;
  opacity: 0.4;
}
.edge.dashed {
  stroke-dasharray: 5, 5;
  opacity: 0.2;
}
.graph-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 2;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}
.graph-node:hover {
  transform: scale(1.1);
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}
.graph-node span {
  position: absolute;
  bottom: -25px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}
.graph-node.central {
  width: 100px;
  height: 100px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
}
.graph-node.central:hover {
  transform: translate(-50%, -50%) scale(1.1);
}
.graph-node.satellite {
  width: 60px;
  height: 60px;
  color: var(--text-secondary);
}
.graph-node.satellite.hr-node { top: 20%; left: 30%; transform: translate(-50%, -50%); }
.graph-node.satellite.legal-node { top: 30%; left: 70%; transform: translate(-50%, -50%); }
.graph-node.satellite.doc-node { top: 80%; left: 50%; transform: translate(-50%, -50%); }
.graph-node.satellite:hover { color: var(--accent-primary); }

/* ACL Permission Badges */
.acl-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 8px;
  width: fit-content;
  letter-spacing: 0.02em;
}
.acl-badge.restricted {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.acl-badge.open {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ============================================
   PHASE 3: Multi-Agent Swarm Trace
   ============================================ */
.swarm-trace-panel {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.2);
}
.trace-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: #0a0a14;
  border: none;
  color: #38bdf8;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  cursor: pointer;
  transition: background 0.2s;
}
.trace-toggle:hover { background: #0f0f1e; }
.trace-steps {
  background: #060610;
  padding: 8px 12px;
  max-height: 200px;
  overflow-y: auto;
}
.trace-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  opacity: 0;
  animation: traceStepIn 0.3s ease forwards;
}
.trace-step.running { color: #facc15; }
.trace-step.done { color: #22c55e; }
.trace-icon { font-size: 0.85rem; }
.trace-text { flex: 1; }
.trace-time {
  color: #64748b;
  font-size: 0.7rem;
  margin-left: auto;
}
@keyframes traceStepIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   PHASE 3: Text-to-SQL Chart Widget
   ============================================ */
.chart-widget-container {
  background: rgba(10, 10, 30, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}
[data-theme='light'] .chart-widget-container {
  background: rgba(240, 245, 255, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.chart-widget-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--accent-primary);
}

/* ============================================
   PHASE 3: Voice Mode
   ============================================ */
.mic-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.mic-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}
.mic-btn.recording {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
  animation: pulseRed 1.5s ease-in-out infinite;
}
@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
.voice-indicator {
  text-align: center;
  font-size: 0.8rem;
  color: #ef4444;
  padding: 4px;
  font-weight: 500;
  animation: pulseRed 1.5s ease-in-out infinite;
}

/* ============================================
   PHASE 3: PII Auto-Redaction
   ============================================ */
.pii-toggle-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.pii-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.pii-toggle-btn.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}
.pii-toggle-btn:not(.active) {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}
.redacted {
  background-color: #111;
  color: #111;
  padding: 2px 6px;
  border-radius: 3px;
  user-select: none;
  cursor: not-allowed;
  transition: all 0.4s ease;
  position: relative;
}
[data-theme='light'] .redacted {
  background-color: #222;
  color: #222;
}
.redacted.revealed {
  background-color: rgba(250, 204, 21, 0.2);
  color: inherit;
  cursor: default;
  user-select: auto;
}

/* ============================================
   PHASE 4: Enterprise WOW Features
   ============================================ */

/* Glassmorphism Panel */
.glass-panel {
  background: rgba(30, 30, 30, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  padding: 20px;
  color: #fff;
}

[data-theme='light'] .glass-panel {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
  color: #333;
}

/* 1. Network Map Animations */
.node-glow {
  animation: pulse-glow 2s infinite alternate;
}

@keyframes pulse-glow {
  0% { filter: drop-shadow(0 0 4px var(--accent-primary)); }
  100% { filter: drop-shadow(0 0 12px var(--accent-primary)); }
}

.traffic-flow-path {
  stroke-dasharray: 10;
  animation: flow-traffic 20s linear infinite;
}

@keyframes flow-traffic {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

/* 2. Agent Swarm Animations */
.swarm-msg {
  animation: swarm-move 2s ease-in-out forwards;
}

@keyframes swarm-move {
  0% { transform: scale(0) translate(0, 0); opacity: 0; }
  20% { transform: scale(1) translate(10px, -10px); opacity: 1; }
  80% { transform: scale(1) translate(90px, -90px); opacity: 1; }
  100% { transform: scale(0) translate(100px, -100px); opacity: 0; }
}

/* 3. SOC Radar & Alerts */
.soc-radar {
  border-radius: 50%;
  border: 1px solid rgba(34, 197, 94, 0.3);
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle, rgba(34,197,94,0.1) 0%, transparent 70%);
}

.soc-radar::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 50%;
  background: linear-gradient(90deg, rgba(34,197,94,0.5) 0%, transparent 100%);
  transform-origin: 0% 0%;
  animation: scan-radar 4s linear infinite;
}

@keyframes scan-radar {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.alert-critical {
  animation: flash-red 1s infinite alternate;
  border-left: 4px solid #ef4444;
}

@keyframes flash-red {
  0% { background-color: rgba(239, 68, 68, 0.05); }
  100% { background-color: rgba(239, 68, 68, 0.2); }
}

/* 4. Audit Trail Laser Verify */
.audit-laser-container {
  position: relative;
  overflow: hidden;
}

.audit-laser {
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 4px;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e, 0 0 20px #22c55e;
  opacity: 0;
}

.audit-laser.active {
  animation: laser-scan 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes laser-scan {
  0% { top: 0; opacity: 1; }
  90% { top: 100%; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Common enterprise grid */
.enterprise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  padding: 24px;
}


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

html, body, #root {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #090d16;
  color: #f8fafc;
  font-family: 'Outfit', sans-serif;
}

.app-layout {
  display: flex;
  width: 100%;
  height: 100dvh; /* dvh = dynamic viewport height, esclude automaticamente la barra del browser */
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #111827 0%, #030712 100%);
}

/* Sfondi sfocati dinamici */
.blob {
  position: absolute;
  filter: blur(120px);
  z-index: 0;
  opacity: 0.25;
  animation: float 12s infinite alternate ease-in-out;
  pointer-events: none;
}
.blob-1 {
  width: 500px; height: 500px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  top: -10%; left: 10%;
}
.blob-2 {
  width: 450px; height: 450px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  bottom: -5%; right: 15%;
  animation-delay: -6s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.1); }
}

/* --- SIDEBAR --- */
.sidebar {
  width: 380px;
  flex-shrink: 0;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow-y: auto;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-section {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- CONTROLLI SIMULATORE --- */
.control-group {
  margin-bottom: 16px;
}

.control-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 6px;
}

.input-glass, .select-glass {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input-glass:focus, .select-glass:focus {
  border-color: #3b82f6;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.checkbox-glass {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  user-select: none;
  transition: all 0.2s ease;
}

.checkbox-glass:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.checkbox-glass.checked {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.checkbox-glass input {
  display: none;
}

/* Badge Identità Attiva */
.identity-badge {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
  border: 1px solid rgba(124, 58, 237, 0.3);
  padding: 16px;
  border-radius: 12px;
  margin-top: 8px;
}

.identity-header {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a78bfa;
  margin-bottom: 8px;
}

.identity-details {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.identity-details div {
  display: flex;
  justify-content: space-between;
}

.identity-details span.label {
  color: #64748b;
}

.identity-details span.val {
  color: #f1f5f9;
  font-weight: 500;
}

/* --- DASHBOARD DOCUMENTI --- */
.dashboard-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  transform: translateY(-1px);
}

.docs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.doc-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.doc-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  word-break: break-all;
}

.doc-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-tag.dept {
  background: rgba(14, 165, 233, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.badge-tag.class {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.doc-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 4px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.status-indicator.COMPLETED { color: #10b981; }
.status-indicator.PROCESSING { color: #3b82f6; }
.status-indicator.PENDING { color: #f59e0b; }
.status-indicator.ERROR { color: #ef4444; }

/* --- MAIN PANEL --- */
.main-panel {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  z-index: 5;
  background: transparent;
  overflow: hidden;
}

/* Header */
.header {
  flex-shrink: 0;
  height: 80px;
  min-height: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  z-index: 20;
}

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

.header-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-meta {
  display: flex;
  gap: 8px;
}

.upload-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 18px;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.upload-btn:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Chat Area */
.chat-box {
  flex: 1;
  min-height: 0;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}
.chat-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.message-wrapper {
  display: flex;
  gap: 18px;
  max-width: 75%;
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.message-wrapper.user { 
  align-self: flex-end; 
  flex-direction: row-reverse; 
}
.message-wrapper.bot { 
  align-self: flex-start; 
}

.avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; justify-content: center; align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.user .avatar { 
  color: #10b981; 
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
}
.bot .avatar { 
  color: #0ea5e9; 
  background: rgba(14, 165, 233, 0.1); 
  border-color: rgba(14, 165, 233, 0.2); 
}

.message-bubble {
  padding: 16px 24px;
  border-radius: 20px;
  line-height: 1.6;
  font-size: 0.975rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.message-bubble p {
  margin: 0 0 10px 0;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul {
  margin: 8px 0 8px 20px;
  padding: 0;
  list-style-type: disc;
}

.message-bubble li {
  margin-bottom: 6px;
}

.message-bubble code {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  color: #38bdf8;
}

.citation-pill {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.1);
}

.user .message-bubble {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}

.bot .message-bubble {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top-left-radius: 4px;
}

/* --- HUMAN-IN-THE-LOOP APPROVAL CARD --- */
.approval-card {
  margin-top: 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-left: 4px solid #3b82f6;
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
  animation: scaleIn 0.3s ease-out forwards;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.approval-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #60a5fa;
}

.approval-card-body {
  font-size: 0.85rem;
  color: #94a3b8;
}

.approval-card-body strong {
  display: block;
  margin-bottom: 6px;
  color: #cbd5e1;
}

.approval-card-body pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  color: #e2e8f0;
}

.approval-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.approve-btn, .reject-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  font-family: inherit;
}

.approve-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.approve-btn:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
}

.reject-btn {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.reject-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #f87171;
  transform: translateY(-1px);
}

.actioned-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 6px;
}
.actioned-status.approved { color: #10b981; }
.actioned-status.rejected { color: #ef4444; }

/* Typing Indicator */
.typing-indicator span {
  display: inline-block;
  width: 6px; height: 6px;
  background: #60a5fa;
  border-radius: 50%;
  margin: 0 3px;
  animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Input Area */
.input-area-wrapper {
  flex-shrink: 0;
  padding: 24px 40px;
  background: rgba(15, 23, 42, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.input-area {
  display: flex;
  gap: 14px;
}

.input-area input {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px 28px;
  border-radius: 100px;
  color: white;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s;
}

.input-area input:focus {
  background: rgba(255, 255, 255, 0.04);
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.send-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}
.send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  transform: scale(1.05);
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

/* ChatGPT/Google-style Sources Footer in Bot Message Bubble */
.message-sources-footer {
  margin-top: 14px;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sources-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
  width: 100%;
}

.sources-header {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-footer-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
  cursor: default;
}

.source-footer-pill:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.3);
  color: #38bdf8;
  transform: translateY(-1px);
}

/* --- REACT MODALS FOR CONNECTORS --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  width: 95%;
  max-width: 750px;
  max-height: 85vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
              0 0 40px rgba(59, 130, 246, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(to right, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

.modal-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0 24px;
}

.modal-tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 14px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  font-family: inherit;
}

.modal-tab-btn:hover {
  color: #f8fafc;
}

.modal-tab-btn.active {
  color: #38bdf8;
}

.modal-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(to right, #38bdf8, #818cf8);
}

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

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a78bfa;
  border-left: 3px solid #7c3aed;
  padding-left: 8px;
  margin-bottom: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid.full-width {
  grid-template-columns: 1fr;
}

.sub-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color 0.2s;
}

.sub-card:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.sub-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.sub-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.textarea-glass {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 0.9rem;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
  resize: vertical;
  min-height: 80px;
  transition: all 0.2s ease;
}

.textarea-glass:focus {
  border-color: #3b82f6;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-icon-btn:hover {
  color: #cbd5e1;
}

.list-editor-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.list-editor-item .input-glass {
  flex: 1;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 15, 30, 0.4);
}

.modal-footer-actions {
  display: flex;
  gap: 12px;
}

.btn-glass {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  outline: none;
}

.btn-glass.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.btn-glass.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
  transform: translateY(-1px);
}

.btn-glass.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-glass.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-glass.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-glass.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-glass.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-glass.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.btn-glass:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* --- BANNER TEST --- */
.test-result-banner {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.test-result-banner.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.test-result-banner.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.test-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.test-result-errors {
  padding-left: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  margin-top: 4px;
}

/* --- LOGS DI SINCRONIZZAZIONE --- */
.logs-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  max-height: 350px;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.logs-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  font-weight: 600;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

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

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

.log-status {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.log-status.SUCCESS { color: #10b981; }
.log-status.RUNNING { color: #3b82f6; }
.log-status.ERROR { color: #ef4444; }

.log-error-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #ef4444;
  word-break: break-all;
}

/* ============================================
   🎙️ VOICE AVATAR MODAL
   ============================================ */

.voice-modal-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  animation: slideUpFade 0.3s ease-out;
  pointer-events: none; /* allows clicking under it, but the container will catch clicks */
}

.voice-modal-container {
  width: 320px; /* Make it a bit smaller for a side widget */
  max-width: 90vw;
  background: rgba(10, 16, 32, 0.92);
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 20px;
  pointer-events: auto;
  box-shadow: 
    0 0 60px rgba(0, 212, 255, 0.08),
    0 30px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  overflow: hidden;
  animation: modalScaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: 28px;
}

.voice-modal-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 14px;
}

.voice-mode-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  transition: all 0.4s ease;
}

.voice-mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.voice-close-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-close-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.voice-globe-wrapper {
  position: relative;
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-globe-canvas {
  border-radius: 50%;
}

.voice-transcript-area {
  min-height: 56px;
  max-height: 80px;
  width: 100%;
  padding: 0 28px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.voice-transcript-text {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.5;
  font-style: italic;
}

.voice-status-text {
  font-size: 0.85rem;
  color: #475569;
  font-style: normal;
}

.voice-error-text {
  font-size: 0.82rem;
  color: #f87171;
}

.voice-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.voice-mic-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--mic-color, #00d4ff);
  background: rgba(0, 212, 255, 0.06);
  color: var(--mic-color, #00d4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.15);
  position: relative;
}

.voice-mic-btn:hover:not(.disabled) {
  background: rgba(0, 212, 255, 0.12);
  transform: scale(1.07);
  box-shadow: 0 0 36px rgba(0, 212, 255, 0.28);
}

.voice-mic-btn.listening {
  border-color: #00ffcc;
  color: #00ffcc;
  background: rgba(0, 255, 204, 0.08);
  box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.4);
  animation: mic-pulse 1.2s infinite;
}

@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.4); }
  70% { box-shadow: 0 0 0 16px rgba(0, 255, 204, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0); }
}

.voice-mic-btn.disabled {
  opacity: 0.4;
  cursor: default;
  border-color: #bf5fff;
  color: #bf5fff;
  background: rgba(191, 95, 255, 0.06);
}

.voice-mic-hint {
  font-size: 0.75rem;
  color: #475569;
  letter-spacing: 0.03em;
}

.voice-stop-btn {
  background: transparent;
  border: 1px solid rgba(191, 95, 255, 0.3);
  color: #a78bfa;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.2s;
  font-family: inherit;
}

.voice-stop-btn:hover {
  background: rgba(191, 95, 255, 0.1);
  border-color: #a78bfa;
}

.voice-footer-note {
  font-size: 0.7rem;
  color: #334155;
  margin-top: 12px;
  letter-spacing: 0.02em;
}

.mic-btn.voice-avatar-trigger {
  background: linear-gradient(135deg, rgba(0,212,255,0.12) 0%, rgba(191,95,255,0.12) 100%);
  border: 1px solid rgba(0, 212, 255, 0.25);
  color: #00d4ff;
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.12);
  flex-shrink: 0;
}

.mic-btn.voice-avatar-trigger:hover {
  background: linear-gradient(135deg, rgba(0,212,255,0.2) 0%, rgba(191,95,255,0.2) 100%);
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 28px rgba(0, 212, 255, 0.25);
  transform: scale(1.05);
}

/* ============================================
   🌌 3D KNOWLEDGE GALAXY
   ============================================ */

.galaxy-stats-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(10,16,32,0.75);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 12px;
  color: #64748b;
  display: flex;
  gap: 10px;
  align-items: center;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.galaxy-legend {
  position: absolute;
  bottom: 24px;
  left: 18px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(10,16,32,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(10px);
}

.galaxy-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.galaxy-doc-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 260px;
  background: rgba(10,16,32,0.92);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  animation: modalScaleUp 0.25s ease;
}

.galaxy-doc-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.galaxy-doc-panel-title {
  padding: 12px 14px;
  font-size: 13px;
  color: #e2e8f0;
  font-weight: 600;
  word-break: break-all;
  line-height: 1.4;
}

.galaxy-doc-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 14px 10px;
}

.gdp-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gdp-status {
  padding: 6px 14px 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ============================================
   🧩 WORKFLOW BUILDER
   ============================================ */

.wf-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(10,16,32,0.8);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
}

.wf-name-input {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 14px;
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  font-family: 'Outfit', sans-serif;
}

.wf-name-input:focus {
  border-color: #3b82f6;
}

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

.wf-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: #94a3b8;
}

.wf-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
}

.wf-btn.primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}

.wf-btn.primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16,185,129,0.35);
}

.wf-btn.danger {
  color: #f87171;
  border-color: rgba(239,68,68,0.2);
}

.wf-btn.danger:hover {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.4);
}

.wf-palette {
  width: 160px;
  flex-shrink: 0;
  background: rgba(10,16,32,0.7);
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.wf-palette-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #475569;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 0 4px;
}

.wf-palette-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.wf-palette-node:hover {
  filter: brightness(1.2);
  transform: translateX(2px);
}

.wf-config-panel {
  width: 260px;
  flex-shrink: 0;
  background: rgba(10,16,32,0.85);
  border-left: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  backdrop-filter: blur(12px);
}

.wf-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.wf-config-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wf-field-label {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.wf-field-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 12px;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 12px;
  outline: none;
  font-family: 'Outfit', sans-serif;
}

.wf-field-input:focus {
  border-color: #3b82f6;
}

.wf-run-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3,7,18,0.65);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wf-run-modal {
  width: 460px;
  max-width: 90%;
  background: rgba(10,16,32,0.95);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 20px;
  overflow: hidden;
  animation: modalScaleUp 0.3s ease;
  box-shadow: 0 0 50px rgba(0,212,255,0.1), 0 25px 50px rgba(0,0,0,0.6);
}

.wf-run-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 700;
  color: #00d4ff;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.wf-run-logs {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  max-height: 340px;
  overflow-y: auto;
}

.wf-run-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #94a3b8;
  animation: slideIn 0.3s ease;
}

.wf-run-complete {
  margin-top: 12px;
  padding: 14px;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 12px;
  color: #34d399;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  line-height: 1.7;
  animation: slideIn 0.4s ease;
}
