/* GraphAgent - Clean Compact Styling */

/* Side Pane Container (full-height, fixed) */
#graph-agent-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--modal-bg);
  border-left: none;
  transition: width 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
}

#graph-agent-modal.visible {
  width: 400px;
}

/* Header */
.ga-header {
  padding: 4px 12px;
  background: var(--ga-header-bg);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--ga-header-hover);
  user-select: none;
  height: 41px;
  min-height: 41px;
  flex-shrink: 0;
}

.ga-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.ga-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  line-height: 1;
  transform: translateY(-3px);
}

.ga-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Model Selector Toggle */
.ga-model-selector {
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 8px;
}

.ga-model-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 2px 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  height: 22px;
  line-height: 1;
  margin: 1px 0 0 0;
}

.ga-model-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

.ga-model-toggle.claude-active {
  background: rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.5);
}

.ga-model-toggle.openai-active {
  background: rgba(16, 163, 127, 0.3);
  border-color: rgba(16, 163, 127, 0.5);
}

.ga-model-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Messages */
#ga-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--ga-messages-bg);
  min-height: 150px;
}

.msg {
  padding: 12px 14px 12px 16px;
  margin-bottom: 10px;
  border-radius: 6px;
  line-height: 1.5;
  word-wrap: break-word;
}

.msg-user {
  background: var(--ga-msg-user-bg);
  margin-left: auto;
  max-width: 85%;
  text-align: right;
  border: 1px solid var(--ga-msg-user-border);
}

.msg-assistant {
  background: var(--ga-msg-assistant-bg);
  border: 1px solid var(--ga-msg-assistant-border);
  max-width: 90%;
}

.msg-system {
  background: #fef3c7;
  border: 1px solid #fde68a;
  text-align: center;
  font-size: 13px;
  color: #92400e;
}

.msg-welcome {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  text-align: center;
  color: #1e40af;
}

.msg-thinking {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  font-style: italic;
  color: #6b7280;
}

/* Thinking Container - holds reasoning + tool calls */
.msg-thinking-container {
  background: var(--ga-messages-bg);
  border: 1px solid var(--ga-msg-assistant-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  max-width: 90%;
}

/* Reasoning text - updates in real-time */
.msg-reasoning {
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 13px;
}

/* Tool calls list */
.msg-tool-calls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--ga-msg-assistant-border);
}

/* Individual tool call - gray like ChatGPT */
.tool-call-item {
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 8px;
  background: var(--ga-msg-assistant-bg);
  border-radius: 4px;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
}

/* Markdown Typography */
.msg h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--ga-msg-assistant-border);
  padding-bottom: 6px;
}
.msg h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 18px 0 10px;
  color: var(--text-secondary);
}
.msg h2:first-child, .msg h3:first-child {
  margin-top: 0;
}
.msg p {
  margin: 10px 0;
  line-height: 1.6;
}

/* Tables - Clean solid lines with vertical borders */
.msg table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
  border: 1px solid var(--border-color);
}
.msg th {
  background: var(--ga-msg-assistant-bg);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}
.msg td {
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  vertical-align: top;
  color: var(--text-primary);
}
.msg tr:nth-child(even) {
  background: var(--ga-messages-bg);
}

/* Lists - keep bullets inside container */
.msg ul, .msg ol {
  margin: 12px 0;
  padding-left: 20px;
  list-style-position: inside;
}
.msg li {
  margin: 6px 0;
  line-height: 1.5;
  padding-left: 4px;
}

/* Links */
.msg a {
  color: var(--accent-primary);
  text-decoration: underline;
}
.msg a:hover {
  color: var(--accent-hover);
}

/* Horizontal rules - clean divider */
.msg hr {
  border: none;
  border-top: 1px solid var(--ga-msg-assistant-border);
  margin: 16px 0;
}

/* Code - inline and blocks converted to styled monospace text */
.msg code {
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 12px;
  background: var(--ga-msg-assistant-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
}
.msg pre {
  background: var(--ga-msg-assistant-bg);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
}
.msg pre code {
  background: none;
  padding: 0;
  font-size: 12px;
  line-height: 1.5;
}

/* Mermaid Diagram Styling */
.mermaid-container {
  margin: 16px 0;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--ga-msg-assistant-border);
  border-radius: 8px;
  overflow-x: auto;
}

.msg .mermaid {
  display: flex;
  justify-content: center;
  background: transparent;
  padding: 0;
  margin: 0;
}

.msg .mermaid svg {
  max-width: 100%;
  height: auto;
}

.mermaid-error {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: "SF Mono", Monaco, Consolas, monospace;
}

[data-theme="dark"] .mermaid-error {
  color: #fca5a5;
  background: #451a1a;
  border-color: #7f1d1d;
}

/* Gantt Chart Specific Styling - Horizontal scroll for wide charts */
.mermaid-container.gantt-chart {
  overflow-x: auto;
  overflow-y: visible;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.mermaid-container.gantt-chart .mermaid svg {
  max-width: none;
}

/* Quick Actions */
.ga-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 10px;
  background: var(--ga-actions-bg);
  border-top: 1px solid var(--ga-actions-border);
  flex-shrink: 0;
}

.ga-btn {
  padding: 6px 10px;
  background: var(--ga-header-bg);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ga-btn:hover {
  background: var(--ga-header-hover);
}

.ga-btn:active {
  background: var(--accent-active);
}

/* Per-response PDF icon button */
.msg-assistant {
  position: relative;
}

.ga-pdf-icon {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #9ca3af);
  opacity: 0;
  transition: opacity 0.2s, background 0.15s, color 0.15s;
}

.msg-assistant:hover .ga-pdf-icon {
  opacity: 1;
}

.ga-pdf-icon:hover {
  background: var(--bg-tertiary, #f3f4f6);
  color: var(--text-secondary, #4b5563);
}

.ga-pdf-icon:active {
  background: var(--border-color, #d1d5db);
}

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

@media print {
  .ga-pdf-icon {
    display: none;
  }
}

/* Input Area */
.ga-input-area {
  padding: 12px;
  background: var(--ga-actions-bg);
  border-top: 1px solid var(--ga-actions-border);
  position: relative;
  flex-shrink: 0;
}

#ga-input {
  width: 100%;
  padding: 12px 48px 44px 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 88px;
  max-height: 200px;
  box-sizing: border-box;
  background: var(--ga-input-bg);
  color: var(--text-primary);
}

#ga-input:focus {
  outline: none;
  border-color: var(--ga-header-bg);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

#ga-send {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--ga-header-bg);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#ga-send i {
  width: 18px;
  height: 18px;
}

#ga-send:hover {
  background: var(--ga-header-hover);
}

#ga-send:disabled {
  background: var(--btn-secondary-bg);
  cursor: not-allowed;
}

/* Attachment Button - positioned above send button */
.ga-attach-btn {
  position: absolute;
  bottom: 62px;
  right: 24px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--ga-msg-assistant-bg);
  color: var(--text-muted);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.ga-attach-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border-hover);
}

.ga-attach-btn:active {
  background: var(--border-color);
}

/* Pending Attachment Pill */
.ga-pending-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 20px;
  font-size: 13px;
  color: #1e40af;
  margin-bottom: 8px;
  max-width: fit-content;
}

.ga-attachment-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ga-attachment-remove {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  padding: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.ga-attachment-remove:hover {
  background: #bfdbfe;
  color: #1d4ed8;
}

/* Upload Progress Indicator */
.ga-upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 13px;
  color: #166534;
  margin-bottom: 8px;
}

.ga-upload-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #86efac;
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: ga-spin 0.8s linear infinite;
}

@keyframes ga-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Account Icon Button */
.account-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.2s;
  border-radius: 4px;
}

.account-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.account-icon-btn i {
  width: 24px;
  height: 24px;
  display: block;
}

/* Auth Container - Dropdown from header */
#graph-agent-auth {
  position: fixed;
  top: 40px;
  right: 20px;
  background: var(--modal-bg);
  padding: 16px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px var(--shadow-strong);
  z-index: 9999;
  max-width: 280px;
  animation: dropDown 0.2s ease-out;
}

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

#graph-agent-auth h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

#graph-agent-auth input {
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  font-size: 14px;
  box-sizing: border-box;
  background: var(--input-bg);
  color: var(--text-primary);
}

#graph-agent-auth input:focus {
  outline: none;
  border-color: var(--ga-header-bg);
  box-shadow: 0 0 0 1px var(--ga-header-bg);
}

#graph-agent-auth button {
  width: 100%;
  padding: 8px;
  margin-bottom: 6px;
  background: var(--ga-header-bg);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

#graph-agent-auth button:hover {
  background: var(--ga-header-hover);
}

/* User Profile - Inline in header */
#graph-agent-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  height: 32px;
}

.user-email {
  font-size: 14px;
  color: #fff;
  font-weight: 500;
  margin: 0;
  padding: 0;
}

.btn-signout {
  padding: 0 10px;
  background: rgba(220, 38, 38, 0.5);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s;
  height: 24px;
  margin: 0;
  display: inline-block;
}

.btn-signout:hover {
  background: rgba(220, 38, 38, 0.8);
}

/* History Button - Clock Icon in Header */
#history-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0 0 0 8px;
  color: #fff;
  transition: background 0.2s;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

#history-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

#history-btn i {
  width: 20px;
  height: 20px;
  display: block;
}

/* Ask Claude Button - Sparkle Icon in Header */
#ask-claude-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0 0 0 8px;
  color: #fff;
  transition: background 0.2s;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

#ask-claude-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

#ask-claude-btn i {
  width: 20px;
  height: 20px;
  display: block;
}

/* Scrollbar */
#ga-messages::-webkit-scrollbar {
  width: 6px;
}

#ga-messages::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

#ga-messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

#ga-messages::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Session History Modal */
#session-history-modal {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 480px;
  max-height: calc(100vh - 90px);
  background: var(--modal-bg);
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--shadow-strong);
  display: none;
  flex-direction: column;
  z-index: 10001;
  border: 1px solid var(--ga-msg-assistant-border);
  color: var(--text-primary);
}

#session-history-modal.visible {
  display: flex;
}

.sh-loading {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.sh-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  min-height: 200px;
  max-height: calc(100vh - 250px);
}

.sh-session-item {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--ga-messages-bg);
  border: 1px solid var(--ga-msg-assistant-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.sh-session-item:hover {
  background: var(--ga-msg-assistant-bg);
  border-color: var(--ga-header-bg);
  box-shadow: 0 2px 4px var(--shadow-color);
}

.sh-session-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sh-session-preview {
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sh-session-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.sh-footer {
  padding: 10px;
  border-top: 1px solid var(--ga-msg-assistant-border);
  background: var(--ga-messages-bg);
}

.sh-refresh-btn {
  width: 100%;
  background: #6b7280;
}

.sh-refresh-btn:hover {
  background: #4b5563;
}

.sh-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.sh-sessions::-webkit-scrollbar {
  width: 6px;
}

.sh-sessions::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.sh-sessions::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.sh-sessions::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Monitoring Events Card */
.monitoring-events-card {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}

.me-header {
  background: #f59e0b;
  color: white;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.me-title {
  font-weight: 600;
  flex: 1;
}
.me-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.me-events {
  padding: 8px;
}

.me-event {
  /* Button 46 Style Base */
  border: 0;
  border-radius: 12px;
  padding: 10px 24px 10px 14px; /* Adapted padding */
  margin-bottom: 12px;
  
  /* Initial Gray Default (will be overridden by severity) */
  background-color: #f3f3f3;
  background-image: linear-gradient(to bottom, #f3f3f3 0%, #dddddd 50%, #d2d2d2 50%, #dfdfdf 100%);
  
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #d5d5d5, 0 -1px 2px 1px #efefef;
  
  color: #333;
  text-shadow: 0 1px 1px #fff;
  cursor: pointer;
  position: relative;
  transition: all 0.1s ease;
  
  /* Ensure borders from original button-46 are handled */
  border-bottom: 1px solid #b4b4b4;
  border-right: 1px solid #dfdfdf;
}

.me-event:hover {
  /* Hover effect from Button 46 (Lightened) */
  background-color: #e5e5e5;
  background-image: linear-gradient(to bottom, #e5e5e5 0%, #d1d1d1 50%, #c4c4c4 50%, #b8b8b8 100%);
  box-shadow: inset 0 1px 0 0 #f2f2f2, 0 1px 0 0 #c9c9c9, 0 -1px 2px 1px #e3e3e3;
}

.me-event:active {
  /* Active effect from Button 46 */
  box-shadow: inset 0 0 30px 0 #999999, 0 1px 0 0 rgba(255, 255, 255, .1);
  border-bottom: none; /* Adjust border on press */
  transform: translateY(1px);
}



.me-event:last-child {
  margin-bottom: 0;
}

.me-event.dismissing {
  opacity: 0.5;
  pointer-events: none;
}

/* Severity colors (matches n8n agent: critical, warning, info) */
/* Severity colors - affecting borders and 3D shadows */
/* Severity Gradients */

/* Critical - Red Glossy (Medium Shadows) */
.me-severity-critical {
  background-color: #fee2e2;
  /* Top: White -> Red-100. Bottom: Red-200 -> Red-100 */
  background-image: linear-gradient(to bottom, #ffffff 0%, #fee2e2 50%, #fecaca 50%, #fee2e2 100%);
  border-bottom: 1px solid #b91c1c;
  border-right: 1px solid #f87171;
  color: #450a0a;
  /* Medium Shadow: Red-400 for better definition without being gray */
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #f87171, 0 -1px 2px 1px #fef2f2;
}
.me-severity-critical:hover {
  background-color: #fecaca;
  /* Ultra-Light Hover */
  background-image: linear-gradient(to bottom, #ffffff 0%, #fff1f2 50%, #fee2e2 50%, #fff1f2 100%);
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #ef4444, 0 -1px 2px 1px #fee2e2;
}
.me-severity-critical:active {
  box-shadow: inset 0 0 30px 0 #fecaca, 0 1px 0 0 rgba(255, 255, 255, .1);
  border-bottom: none;
}

/* Warning - Amber Glossy (Medium Shadows) */
.me-severity-warning {
  background-color: #fef3c7;
  /* Top: White -> Amber-100. Bottom: Amber-200 -> Amber-100 */
  background-image: linear-gradient(to bottom, #ffffff 0%, #fef3c7 50%, #fde68a 50%, #fef3c7 100%);
  border-bottom: 1px solid #b45309;
  border-right: 1px solid #fbbf24;
  color: #451a03;
  /* Medium Shadow: Amber-400 */
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #fbbf24, 0 -1px 2px 1px #fffbeb;
}
.me-severity-warning:hover {
  background-color: #fde68a;
  /* Ultra-Light Hover */
  background-image: linear-gradient(to bottom, #ffffff 0%, #fffbeb 50%, #fef3c7 50%, #fffbeb 100%);
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #f59e0b, 0 -1px 2px 1px #fef3c7;
}
.me-severity-warning:active {
  box-shadow: inset 0 0 30px 0 #fde68a, 0 1px 0 0 rgba(255, 255, 255, .1);
  border-bottom: none;
}

/* Info - Blue Glossy (Medium Shadows) */
.me-severity-info {
  background-color: #dbeafe;
  /* Top: White -> Blue-100. Bottom: Blue-200 -> Blue-100 */
  background-image: linear-gradient(to bottom, #ffffff 0%, #dbeafe 50%, #bfdbfe 50%, #dbeafe 100%);
  border-bottom: 1px solid #1d4ed8;
  border-right: 1px solid #60a5fa;
  color: #172554;
  /* Medium Shadow: Blue-400 */
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #60a5fa, 0 -1px 2px 1px #eff6ff;
}
.me-severity-info:hover {
  background-color: #bfdbfe;
  /* Ultra-Light Hover */
  background-image: linear-gradient(to bottom, #ffffff 0%, #eff6ff 50%, #dbeafe 50%, #eff6ff 100%);
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #3b82f6, 0 -1px 2px 1px #dbeafe;
}
.me-severity-info:active {
  box-shadow: inset 0 0 30px 0 #bfdbfe, 0 1px 0 0 rgba(255, 255, 255, .1);
  border-bottom: none;
}

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

.me-severity-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dc2626;
  color: white;
}

.me-severity-critical .me-severity-badge {
  background: #dc2626;
}
.me-severity-warning .me-severity-badge {
  background: #f59e0b;
  color: #1f2937;
}
.me-severity-info .me-severity-badge {
  background: #3b82f6;
}

.me-type-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #374151;
}

.me-date {
  font-size: 11px;
  color: #6b7280;
  margin-left: auto;
}

.me-event-title {
  font-weight: 600; /* Slightly bolder for readability */
  color: #1f2937;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.4;
  /* Text Wrapping Fixes */
  white-space: normal; 
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word; /* Ensure aggressive breaking for long words if needed */
  max-width: 100%;
}

.me-event-company {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

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

.me-event-actions .me-btn {
  flex: 1;
}

.me-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.me-btn-link {
  background: #2563eb;
  color: white;
}

.me-btn-link:hover {
  background: #1d4ed8;
}

.me-btn-dismiss {
  background: #e5e7eb;
  color: #374151;
}

.me-btn-dismiss:hover {
  background: #d1d5db;
}

.me-btn-remediate {
  background: #059669;
  color: white;
}

.me-btn-remediate:hover {
  background: #047857;
}

/* Agent Analysis Button - Grey 3D style matching event cards */
.me-btn-agent-analysis {
  background-color: #f3f3f3;
  background-image: linear-gradient(to bottom, #f3f3f3 0%, #dddddd 50%, #d2d2d2 50%, #dfdfdf 100%);
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #b4b4b4;
  border: none;
  border-bottom: 1px solid #b4b4b4;
  border-right: 1px solid #dfdfdf;
  border-radius: 12px;
  color: #333;
  text-shadow: 0 1px 1px #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.me-btn-agent-analysis:hover {
  background-color: #e5e5e5;
  background-image: linear-gradient(to bottom, #e5e5e5 0%, #d1d1d1 50%, #c4c4c4 50%, #b8b8b8 100%);
  box-shadow: inset 0 1px 0 0 #f2f2f2, 0 1px 0 0 #c9c9c9;
  transform: translateY(-1px);
}

.me-btn-agent-analysis:active {
  box-shadow: inset 0 0 30px 0 #999999, 0 1px 0 0 rgba(255, 255, 255, .1);
  border-bottom: none;
  transform: translateY(0);
}

/* Add to Database Button - Grey 3D style matching event cards */
.me-btn-add-to-db {
  background-color: #f3f3f3;
  background-image: linear-gradient(to bottom, #f3f3f3 0%, #dddddd 50%, #d2d2d2 50%, #dfdfdf 100%);
  box-shadow: inset 0 1px 0 0 white, 0 1px 0 0 #b4b4b4;
  border: none;
  border-bottom: 1px solid #b4b4b4;
  border-right: 1px solid #dfdfdf;
  border-radius: 12px;
  color: #333;
  text-shadow: 0 1px 1px #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.me-btn-add-to-db:hover {
  background-color: #e5e5e5;
  background-image: linear-gradient(to bottom, #e5e5e5 0%, #d1d1d1 50%, #c4c4c4 50%, #b8b8b8 100%);
  box-shadow: inset 0 1px 0 0 #f2f2f2, 0 1px 0 0 #c9c9c9;
  transform: translateY(-1px);
}

.me-btn-add-to-db:active {
  box-shadow: inset 0 0 30px 0 #999999, 0 1px 0 0 rgba(255, 255, 255, .1);
  border-bottom: none;
  transform: translateY(0);
}

/* Close Button (X) */
.me-btn-close {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.me-btn-close:hover {
  background: #f3f4f6;
  color: #ef4444;
}

/* ============================================
   HEADER ALERTS DROPDOWN
   ============================================ */

/* Alerts Container - positioned relative for dropdown */
#alerts-dropdown-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 32px;
}

/* Alerts Header Button */
.alerts-header-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0 8px 0 0;
  color: #fff;
  transition: background 0.2s;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  position: relative;
}

.alerts-header-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.alerts-header-btn i {
  width: 20px;
  height: 20px;
  display: block;
}

/* Red Badge Counter */
.alerts-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc2626;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Dropdown Panel */
.alerts-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 400px;
  max-width: 90vw; /* Prevent overflow on small screens */
  /* Increased height by 20% (was 500px) */
  max-height: 600px;
  background: var(--modal-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  /* Ensure children (header/content) respect the border radius */
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow-strong);
  z-index: 10001;
  display: none;
  flex-direction: column;
  animation: alertsDropDown 0.2s ease-out;
}

.alerts-dropdown.visible {
  display: flex;
}

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

/* Dropdown Header */
/* Dropdown Header */
/* Dropdown Header */
.alerts-dropdown-header {
  padding: 4px 12px; /* Minimal padding */
  background: #f59e0b;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #d97706;
  min-height: 28px; /* Force compact height */
}

.alerts-dropdown-title {
  font-weight: 600;
  font-size: 13px; /* Slightly smaller */
  line-height: 1; /* Tightest line height */
}

.alerts-refresh-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transition: background 0.2s;
  transform: translateY(-3px);
}

.alerts-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.alerts-refresh-btn i {
  width: 12px;
  height: 12px;
  display: block;
}

.alerts-refresh-btn.spinning i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Dropdown Content */
.alerts-dropdown-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  /* Adjusted to fit within new parent max-height */
  max-height: 550px;
  background: var(--modal-bg);
}

.alerts-dropdown-content::-webkit-scrollbar {
  width: 6px;
}

.alerts-dropdown-content::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.alerts-dropdown-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

/* Empty State */
.alerts-dropdown-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Alert Items in Dropdown (reuse existing .me-event styles) */
.alerts-dropdown .me-event {
  margin-bottom: 8px;
}

.alerts-dropdown .me-event:last-child {
  margin-bottom: 0;
}

/* ============================================
   FOOTNOTE SUPERSCRIPTS
   ============================================ */

/* Inline footnote references */
.ga-messages sup {
  font-size: 0.7em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
  top: -0.5em;
  color: #4f46e5;
  font-weight: 600;
  margin: 0 1px;
  cursor: default;
}

/* Footnote numbers in Sources list */
.ga-messages p sup:first-child,
.ga-messages li sup:first-child {
  margin-right: 4px;
}

/* ============================================
   WEB SEARCH TOGGLE & PROGRESS
   ============================================ */

/* Web Search Toggle Button - positioned bottom left */
#ga-web-search-toggle {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--ga-msg-assistant-bg);
  color: var(--text-muted);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  gap: 0;
}

#ga-web-search-toggle i {
  width: 14px;
  height: 14px;
}

#ga-web-search-toggle .ga-toggle-label {
  font-size: 7px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: -1px;
}

#ga-web-search-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border-hover);
}

/* Web Search Toggle Active State */
#ga-web-search-toggle.active {
  background: var(--ga-header-bg);
  color: #fff;
  border-color: var(--ga-header-hover);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

#ga-web-search-toggle.active:hover {
  background: var(--ga-header-hover);
  border-color: var(--accent-active);
}

/* Web Search Progress Indicator */
.ga-web-search-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  font-size: 13px;
  color: #1d4ed8;
  margin-bottom: 8px;
}

.ga-web-search-progress .ga-search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ga-web-search-progress .ga-search-icon.spinning {
  animation: ga-globe-spin 1.5s linear infinite;
}

@keyframes ga-globe-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ga-progress-text {
  flex: 1;
}

/* ============================================
   WEB SEARCH CITATIONS CARD
   ============================================ */

.web-search-citations-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}

.wsc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--ga-msg-assistant-bg);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.wsc-header:hover {
  background: var(--bg-tertiary);
}

.wsc-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.wsc-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

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

.web-search-citations-card.collapsed .wsc-toggle {
  transform: rotate(-90deg);
}

.wsc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.web-search-citations-card.collapsed .wsc-list {
  display: none;
}

.wsc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s;
}

.wsc-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
  box-shadow: 0 1px 3px var(--shadow-color);
}

.wsc-index {
  width: 18px;
  height: 18px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.wsc-item-title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wsc-item-domain {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.wsc-external {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.wsc-item:hover .wsc-external {
  opacity: 1;
  color: var(--accent-primary);
}

/* Scrollbar for citations list */
.wsc-list::-webkit-scrollbar {
  width: 4px;
}

.wsc-list::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.wsc-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 2px;
}

.wsc-list::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ============================================
   AGENT DIVIDER (vertical drag handle)
   ============================================ */

.agent-divider {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  z-index: 1101;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s ease, right 0.3s ease;
  background: #d0d0d0;
  border-left: none;
  border-right: none;
  pointer-events: none;
}

[data-theme="dark"] .agent-divider {
  background: #2a2a2a;
}

.agent-divider.visible {
  width: 3px;
  pointer-events: auto;
  box-shadow: -1px 0 0 var(--border-color), 1px 0 0 var(--border-color);
}

.agent-divider:hover,
.agent-divider.dragging {
  background: #b0b0b0;
}

[data-theme="dark"] .agent-divider:hover,
[data-theme="dark"] .agent-divider.dragging {
  background: #444;
}

/* Grip dots hidden at 3px width — too narrow to display */
.agent-divider-grip {
  display: none;
}

/* Prevent text selection during divider drag */
body.divider-dragging {
  user-select: none !important;
  cursor: col-resize !important;
}

body.divider-dragging * {
  cursor: col-resize !important;
}
