/* Profile styles are isolated from the shared standalone-modal rules below. */
@import url('./profile-modal.css');

/* ============================================
   Shared Component Styles
   ============================================ */

/* ─── Settings Toggle Rows ─────────────────────────────── */
.setting-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  cursor: pointer;
  transition: background 0.15s;
  font-size: var(--font-size-sm, 13px);
  color: var(--text-secondary);
}

.toggle-row:hover {
  background: rgba(255,255,255,0.08);
}

.toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary, #6366f1);
  cursor: pointer;
}

.toggle-row span {
  flex: 1;
}

/* --- Buttons --- */

.btn-sm {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-sm:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--accent-gradient);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  transition: all var(--transition-normal);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

/* --- Modal --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* .modal-content — used by TicketModals.js create/project popups */
.modal-content {
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 32px;
  background: linear-gradient(145deg, rgba(30, 30, 45, 0.95) 0%, rgba(20, 20, 35, 0.98) 100%);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid var(--border-highlight, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), inset 0 0 40px rgba(255,255,255,0.03);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-content.modal-wide { max-width: 640px; }
.modal-content h2 {
  margin: 0 0 20px; font-size: var(--font-size-lg, 16px); font-weight: 600; color: var(--text-primary);
}
.modal-content h3 {
  margin: 16px 0 12px; font-size: var(--font-size-base, 14px); font-weight: 600; color: var(--text-secondary);
}
.modal-content .form-group {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
}
.modal-content .form-group label {
  font-size: var(--font-size-sm, 13px); font-weight: 600; color: var(--text-primary);
}
.modal-content .form-group input,
.modal-content .form-group select,
.modal-content .form-group textarea {
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-color, rgba(255,255,255,0.06));
  background: var(--glass-bg, rgba(255,255,255,0.04));
  color: var(--text-primary);
  font-size: var(--font-size-sm, 13px);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.modal-content .form-group input:focus,
.modal-content .form-group select:focus,
.modal-content .form-group textarea:focus {
  border-color: var(--accent-primary, #6366f1);
}
.modal-content .modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
}
.modal-content .btn-cancel {
  padding: 8px 18px;
  background: transparent;
  border: 1px solid var(--border-color, rgba(255,255,255,0.1));
  border-radius: var(--radius-sm, 8px);
  color: var(--text-secondary);
  font-size: var(--font-size-sm, 13px);
  cursor: pointer;
}
.modal-content .btn-cancel:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.modal-content .project-list { margin-bottom: 16px; }
.modal-content .project-card {
  padding: 10px 14px; margin-bottom: 8px;
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--border-color, rgba(255,255,255,0.06));
  border-radius: var(--radius-sm, 8px);
}
.modal-content .project-card strong { color: var(--text-primary); }
.modal-content .project-card p { margin: 4px 0 0; font-size: 12px; color: var(--text-secondary); }

.modal-overlay.hidden {
  display: none;
}

.modal-container {
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  background: linear-gradient(145deg, rgba(30, 30, 45, 0.9) 0%, rgba(20, 20, 35, 0.95) 100%);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid var(--border-highlight, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), inset 0 0 40px rgba(255,255,255,0.03);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal {
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
}

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

.modal-header h3 {
  margin: 0;
  font-size: var(--font-size-lg);
}

.modal-title {
  font-size: var(--font-size-lg, 16px);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  color: var(--text-secondary);
  cursor: pointer;
}

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

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Modal form elements */
.modal-body .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-body .form-group label {
  font-size: var(--font-size-sm, 13px);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-color, rgba(255,255,255,0.06));
  background: var(--glass-bg, rgba(255,255,255,0.04));
  color: var(--text-primary);
  font-size: var(--font-size-sm, 13px);
  outline: none;
  transition: border-color 0.15s;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
  border-color: var(--accent-primary, #6366f1);
}

.modal-body .btn-action {
  padding: 10px 20px;
  background: var(--accent-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
  color: white;
  border: none;
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-sm, 13px);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.modal-body .btn-action:hover {
  opacity: 0.9;
}

.modal-body .btn-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-body .status-message {
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-sm, 13px);
}

.modal-body .status-message.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.modal-body .status-message.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.modal-body .status-message.info {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #6366f1;
}

/* History list */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  padding: 10px 14px;
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.history-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent-primary, #6366f1);
}

.history-item-title {
  font-size: var(--font-size-sm, 13px);
  font-weight: 600;
  color: var(--text-primary);
}

.history-item-meta {
  font-size: var(--font-size-xs, 11px);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Login form */
.login-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-sm, 13px);
}

.login-status.logged-in {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.login-status.logged-out {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Inside the Profile & Access modal the status box must STACK (the base
   .login-status is a horizontal bar). Without this the two paragraphs and the
   button row get laid out as side-by-side flex columns — text wraps one word
   per line and the Open Settings / Sign Out buttons overlap. */
.modal-content .login-status {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  line-height: 1.5;
}
.modal-content .login-status p { margin: 0 0 6px; }
.modal-content .login-status .modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Presentation list */
.presentation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.presentation-item {
  padding: 12px 14px;
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: background 0.15s;
}

.presentation-item:hover {
  background: rgba(255,255,255,0.08);
}

/* --- Settings --- */

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-group label {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.setting-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
}

.theme-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: all var(--transition-normal);
}

.theme-option i {
  font-size: 16px;
}

.theme-option:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.theme-option.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: inset 0 0 0 1px var(--accent-primary);
}

/* --- Toast Notifications --- */

.toast-container {
  position: fixed;
  bottom: 48px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1001;
}

.toast {
  padding: 16px 20px;
  background: linear-gradient(145deg, rgba(30, 30, 45, 0.8) 0%, rgba(20, 20, 35, 0.95) 100%);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid var(--border-light);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), inset 0 0 20px rgba(255,255,255,0.05);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 360px;
}

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

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

.toast.error {
  border-left: 3px solid var(--status-error);
}

.toast.info {
  border-left: 3px solid var(--status-active);
}

/* --- Ticket Detail Overlay --- */

.ticket-detail-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.6); /* ERROR #8: Darker backdrop */
}

.ticket-detail-panel {
  width: 50%;
  min-width: 450px;
  max-width: 800px;
  background: linear-gradient(270deg, rgba(20, 20, 35, 0.85) 0%, rgba(30, 30, 45, 0.75) 100%); /* ERROR #8: Reduced opacity */
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  border-left: 1px solid var(--border-highlight);
  box-shadow: -10px 0 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.detail-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.detail-meta {
  padding: 12px 20px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* --- Timeline --- */

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
  margin-top: 4px;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

.timeline-content .timeline-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.timeline-content .timeline-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-top: 2px;
}

/* --- Subtasks --- */

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--font-size-sm);
}

.subtask-status {
  font-size: 16px;
}

.subtask-name {
  flex: 1;
  color: var(--text-primary);
}

.subtask-cost {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

/* ============================================
   Phase 2+ Component Overrides (Liquid Glass)
   ============================================ */

/* ─── RAG Upload Container ─────────────────────────────── */
.rag-upload-container {
  margin: 0 12px;
  padding: 12px;
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 12px);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ─── Mesh Chat Overlay ────────────────────────────────── */
.mesh-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.mesh-overlay.hidden {
  display: none;
}

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

.mesh-panel {
  width: 90%;
  max-width: 1000px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(30, 30, 45, 0.85) 0%, rgba(20, 20, 35, 0.95) 100%);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid var(--border-highlight, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), inset 0 0 40px rgba(255,255,255,0.03);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.mesh-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.mesh-panel-header .panel-title {
  font-size: var(--font-size-lg, 16px);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mesh-panel-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.mesh-sidebar {
  width: 260px;
  border-right: 1px solid var(--border-color, rgba(255,255,255,0.06));
  overflow-y: auto;
  padding: 12px;
}

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

/* ─── MCP Components in Insights Panel ─────────────────── */
#mcpServerStatus,
#mcpToolsList {
  max-height: 300px;
  overflow-y: auto;
  font-size: var(--font-size-xs, 11px);
}

/* Override MCP card backgrounds for glass theme */
#mcpServerStatus .mcp-server-card,
#mcpToolsList .mcp-tool-card {
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-sm, 8px);
  margin-bottom: 8px;
}

#mcpServerStatus .mcp-servers-summary,
#mcpToolsList .tools-filter-bar {
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-sm, 8px);
  padding: 8px;
  margin-bottom: 8px;
}

#mcpServerStatus .mcp-empty-state,
#mcpToolsList .mcp-empty-state,
#mcpServerStatus .mcp-loading,
#mcpToolsList .mcp-loading {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-xs, 11px);
}

/* ─── Voice Input Button Override ──────────────────────── */
.chat-input-wrapper .mic-button,
.chat-input-wrapper .chat-tts-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-color, rgba(255,255,255,0.06));
  background: var(--glass-bg, rgba(255,255,255,0.04));
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.chat-input-wrapper .mic-button:hover,
.chat-input-wrapper .chat-tts-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.chat-input-wrapper .mic-button.recording {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
  animation: pulseRed 1.5s infinite;
}

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

.chat-input-wrapper .chat-tts-toggle.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent-primary, #6366f1);
}

/* ─── Recording Indicator ──────────────────────────────── */
.chat-input-area .recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-sm, 8px);
  margin: 0 0 8px 0;
  font-size: var(--font-size-xs, 11px);
  color: #ef4444;
}

.chat-input-area .recording-indicator .pulsing {
  animation: pulseRed 1.5s infinite;
}

/* ─── ChatTTS Indicator ────────────────────────────────── */
.chat-tts-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-sm, 8px);
  margin: 0 12px 8px 12px;
  font-size: var(--font-size-xs, 11px);
  color: var(--accent-primary, #6366f1);
}

.chat-tts-indicator .tts-stop-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
}

.chat-tts-indicator .tts-stop-btn:hover {
  color: #ef4444;
}

/* ─── Presentation Gallery Modal Override ──────────────── */
#presentation-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#presentation-gallery-modal .presentation-modal-content {
  background: linear-gradient(145deg, rgba(30, 30, 45, 0.9) 0%, rgba(20, 20, 35, 0.95) 100%);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid var(--border-highlight, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  width: 90%;
  max-width: 900px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#presentation-gallery-modal .presentation-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

#presentation-gallery-modal .presentation-modal-header h2 {
  margin: 0;
  font-size: var(--font-size-lg, 16px);
  color: var(--text-primary);
}

#presentation-gallery-modal .presentation-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

#presentation-gallery-modal .presentation-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#presentation-gallery-modal .presentation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

#presentation-gallery-modal .presentation-card {
  background: var(--glass-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
}

#presentation-gallery-modal .presentation-card:hover {
  border-color: var(--accent-primary, #6366f1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

#presentation-gallery-modal .presentation-card-content {
  padding: 12px;
}

#presentation-gallery-modal .presentation-card-title {
  font-size: var(--font-size-sm, 13px);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

#presentation-gallery-modal .presentation-card-meta {
  display: flex;
  gap: 12px;
  font-size: var(--font-size-xs, 11px);
  color: var(--text-muted);
}

#presentation-gallery-modal .presentation-card-button {
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  background: var(--accent-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
  color: white;
  border: none;
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-xs, 11px);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

#presentation-gallery-modal .presentation-card-button:hover {
  opacity: 0.9;
}

/* ─── Toolbar Button Active State ──────────────────────── */
.chat-toolbar .btn-icon.active,
.chat-toolbar .btn-icon:focus {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary, #6366f1);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ============================================
   Mobile Responsive Overrides (≤ 640px)
   ============================================ */
@media (max-width: 640px) {
  /* Ticket detail panel: min-width 450px would overflow a phone screen;
     expand to cover the full overlay area and stack vertically. */
  .ticket-detail-overlay {
    justify-content: stretch;
  }
  .ticket-detail-panel {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  /* Mesh chat panel: collapse the fixed 260px sidebar above the main area. */
  .mesh-panel-body {
    flex-direction: column;
  }
  .mesh-sidebar {
    width: 100%;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
  }

  /* Toast container: prevent right-edge overflow on narrow screens. */
  .toast-container {
    right: 8px;
    left: 8px;
  }
  .toast {
    max-width: none;
  }

  /* Modal form inputs: enforce 16px minimum to prevent iOS auto-zoom. */
  .modal-content .form-group input,
  .modal-content .form-group select,
  .modal-content .form-group textarea,
  .modal-body .form-group input,
  .modal-body .form-group select,
  .modal-body .form-group textarea {
    font-size: 16px;
  }

  /* Modal content: reduce side padding so content doesn't clip. */
  .modal-content {
    padding: 20px 16px;
  }
  .modal {
    padding: 20px 16px;
  }

  /* Modal actions: allow buttons to wrap on very narrow modals. */
  .modal-content .modal-actions {
    flex-wrap: wrap;
  }
}

/* ── App assistant bubble (ADR-085 D9) ──────────────────────────────────────
   The framework-rendered, manifest-declared floating assistant — the safe
   replacement for letting a package inject JS into the cockpit shell. Themed
   from the design-system variables so a packaged skin restyles it for free. */
.app-assistant-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border-color, #30363d);
  background: var(--accent-color, #1f6feb);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgb(0 0 0 / 35%);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.app-assistant-fab:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgb(0 0 0 / 45%); }
.app-assistant-fab.is-open { transform: scale(0.94); }

.app-assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 86px;
  z-index: 60;
  width: min(400px, calc(100vw - 44px));
  height: min(560px, calc(100vh - 140px));
  background: var(--panel-bg, #161b22);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgb(0 0 0 / 45%);
}
.app-assistant-panel[hidden] { display: none; }
.app-assistant-panel iframe { width: 100%; height: 100%; border: 0; display: block; }
