.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-container.active {
  opacity: 1;
  visibility: visible;
}

.modal-container .modal-content {
  border-radius: var(--half);
  width: 90%;
  max-width: 900px;
  min-height: 30vh;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  position: relative;
  margin-top: 30px;
}

.modal-container .modal-content .modal-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: var(--half) var(--half);
}

.modal-container .modal-content .modal-header .modal-close {
  cursor: pointer;
  opacity: 0.7;
  font-size: 18px;
}

.modal-container .modal-content .modal-header .modal-close:hover {
  opacity: 1;
}

.modal-container .hidden {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--half) var(--one);
  border-radius: var(--half);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  gap: var(--half);
}

.btn.primary {
  background-color: var(--primary-color);
  color: white;
}

.btn.primary:hover {
  filter: brightness(1.1);
}

.btn.primary:disabled {
  background-color: var(--border-color);
  opacity: 0.7;
  cursor: not-allowed;
}

.btn .material-symbols-outlined {
  font-size: 20px;
}

.export-modal .modal-content {
  overflow: hidden;
  padding: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

/* Bug report modal: make fields larger + more user friendly (scoped to avoid global form duplication) */
#bug-report-modal .modal-content,
#bug-report .modal-content {
  max-width: 760px;
}

#bug-report-modal .modal-body,
#bug-report .modal-body {
  padding: var(--one);
}

#bug-report-modal label,
#bug-report label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-color);
}

#bug-report-modal .required,
#bug-report .required {
  margin-left: 0.25rem;
  color: var(--primary-color);
  font-weight: 800;
}

#bug-report-modal input,
#bug-report-modal select,
#bug-report-modal textarea,
#bug-report input,
#bug-report select,
#bug-report textarea {
  width: 100%;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--tile-elevation-2);
  color: var(--text-color);
  line-height: 1.5;
  font-size: 1rem;
  box-sizing: border-box;
}

#bug-report-modal input::placeholder,
#bug-report-modal textarea::placeholder,
#bug-report input::placeholder,
#bug-report textarea::placeholder {
  color: var(--muted-text);
}

#bug-report-modal textarea,
#bug-report textarea {
  min-height: 140px;
  resize: vertical;
}

#bug-report-modal #bug-report-steps,
#bug-report #bug-report-steps {
  min-height: 220px;
}

#bug-report-modal input:focus,
#bug-report-modal select:focus,
#bug-report-modal textarea:focus,
#bug-report input:focus,
#bug-report select:focus,
#bug-report textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

#bug-report-modal .btn.primary:disabled,
#bug-report-modal #bug-report-submit:disabled,
#bug-report .btn.primary:disabled,
#bug-report #bug-report-submit:disabled {
  background-color: var(--primary-color-dark);
  color: #fff;
  opacity: 0.7;
  cursor: not-allowed;
  filter: none;
}

#bug-report-modal .btn.primary:disabled:hover,
#bug-report-modal #bug-report-submit:disabled:hover,
#bug-report .btn.primary:disabled:hover,
#bug-report #bug-report-submit:disabled:hover {
  filter: none;
}

#bug-report-modal .field-error,
#bug-report .field-error {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--error-color, #F44336);
}

#bug-report .bug-report-attachments-hint {
  margin-top: 0.4rem;
  color: var(--muted-text);
  font-size: 0.9rem;
}

#bug-report .bug-report-attachments-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#bug-report .bug-report-attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--tile-elevation-2);
}

#bug-report .bug-report-attachment-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

#bug-report .bug-report-attachment-left .material-symbols-rounded {
  color: var(--primary-color);
  font-size: 1.2rem;
}

#bug-report .bug-report-attachment-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#bug-report .bug-report-attachment-meta .name {
  font-weight: 600;
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 48ch;
}

#bug-report .bug-report-attachment-meta .details {
  font-size: 0.85rem;
  color: var(--muted-text);
}

.export-modal .export-tabs {
  display: flex;
  padding: var(--half) var(--half) 0;
  background-color: transparent;
  z-index: 5;
  position: relative;
}

.export-modal .export-tabs .export-tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--half) var(--one);
  cursor: pointer;
  gap: 8px;
  opacity: 0.7;
  background-color: var(--tile-bg);
  border-radius: var(--half) var(--half) 0 0;
  margin: 0 2px;
  min-width: 100px;
  border-bottom-color: transparent;
  position: relative;
}

.export-modal .export-tabs .export-tab:hover {
  opacity: 1;
}

.export-modal .export-tabs .export-tab.active {
  opacity: 1;
  font-weight: 500;
  background-color: var(--tile-bg);
  position: relative;
}

.export-modal .export-tabs .export-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--tile-bg);
}

.export-modal .export-tabs .export-tab .material-symbols-outlined {
  font-size: 20px;
}

.export-modal .export-content {
  flex: 1;
  position: relative;
  background-color: var(--tile-bg);
  border-radius: var(--half) var(--half) 0 0;
  margin-top: -1px;
  z-index: 1;
  overflow: hidden;
}

.export-modal .export-content .export-section {
  display: none;
  height: 100%;
}

.export-modal .export-content .export-section.active {
  display: block;
}

.export-modal .export-content .export-section .content-container {
  height: 100%;
  position: relative;
  overflow-y: auto;
  padding: var(--one);
  padding-bottom: 0;
}

.export-modal .export-content .export-section .content-container::-webkit-scrollbar {
  width: 6px;
}

.export-modal .export-content .export-section .content-container::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.export-modal .export-content .export-section .content-container .content-box {
  width: 100%;
  height: 100%;
  min-height: 200px;
  position: relative;
}

.export-modal .export-content .export-section .content-container .content-box .loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
}

.export-modal .export-content .export-section .content-container .content-box .loading-state .loading-text {
  margin-top: var(--half);
}

.export-modal .export-content .export-section .content-container .content-box .content-state {
  display: none;
}

.export-modal .export-content .export-section .content-container .content-box .content-state.active {
  display: block;
}

.export-modal .export-content .export-section .content-container .content-box .content-state.active.formatted-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: var(--half);
}

.export-modal .export-content .export-section .content-container .content-box .content-state.active.formatted-content::-webkit-scrollbar {
  width: 10px;
}

.export-modal .export-content .export-section .content-container .content-box .content-state.active.formatted-content::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.export-modal .export-content .export-section.placeholder-content .placeholder-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  text-align: center;
  color: var(--text-muted);
}

.export-modal .export-content .export-section.placeholder-content .placeholder-container .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: var(--one);
}

.export-modal .export-content .export-section.placeholder-content .placeholder-container h3 {
  margin-bottom: var(--half);
}

.export-modal .export-content .export-section.placeholder-content .placeholder-container p {
  max-width: 280px;
}

.export-modal .format-selection {
  padding: var(--one) var(--two);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--one);
}

.export-modal .format-selection select {
  padding: var(--half) var(--one);
  border-radius: var(--half);
  border: none;
  background-color: var(--page-bg);
  color: var(--text-color);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  appearance: none;
  position: relative;
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 30px;
}

.export-modal .format-selection select:focus {
  box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb, 0, 82, 204), 0.2);
  outline: none;
}

.export-modal .format-selection select option {
  padding: var(--half);
}

.export-modal .format-selection .ai-detection {
  display: flex;
  align-items: center;
  position: relative;
}

.export-modal .format-selection .ai-detection .detection-icon {
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--primary-color);
  margin: 0 var(--half);
}

.export-modal .format-selection .ai-detection .detection-icon .material-symbols-outlined {
  font-size: 20px;
}

.export-modal .format-selection .ai-detection .detection-icon .white-icon {
  color: white;
}

.export-modal .format-selection .ai-detection .detection-label {
  margin-left: 6px;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--primary-color);
  white-space: nowrap;
}

.export-modal .format-selection .ai-detection .detection-text {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--tile-bg);
  padding: var(--half);
  border-radius: var(--half);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  min-width: 300px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10;
  max-width: 400px;
}

.export-modal .format-selection .ai-detection .detection-text strong {
  color: var(--primary-color);
}

.export-modal .format-selection .ai-detection:hover .detection-text {
  opacity: 1;
  visibility: visible;
}

.export-modal .format-selection .ai-detection .error-text {
  color: var(--error-color, #e53935);
  font-weight: bold;
}

.export-modal .jira-content .content-box, .export-modal .confluence-content .content-box, .export-modal .mail-content .content-box, .export-modal .download-content .content-box {
  background-color: var(--page-bg);
  border-radius: var(--half);
}

.export-modal .jira-content .content-box .content-state, .export-modal .confluence-content .content-box .content-state, .export-modal .mail-content .content-box .content-state, .export-modal .download-content .content-box .content-state {
  padding: var(--one);
}

.export-modal .jira-content .content-box .content-state h3, .export-modal .jira-content .content-box .content-state h4, .export-modal .confluence-content .content-box .content-state h3, .export-modal .confluence-content .content-box .content-state h4, .export-modal .mail-content .content-box .content-state h3, .export-modal .mail-content .content-box .content-state h4, .export-modal .download-content .content-box .content-state h3, .export-modal .download-content .content-box .content-state h4 {
  margin-top: 0;
  margin-bottom: var(--half);
}

.export-modal .jira-content .content-box .content-state p, .export-modal .jira-content .content-box .content-state ul, .export-modal .jira-content .content-box .content-state ol, .export-modal .confluence-content .content-box .content-state p, .export-modal .confluence-content .content-box .content-state ul, .export-modal .confluence-content .content-box .content-state ol, .export-modal .mail-content .content-box .content-state p, .export-modal .mail-content .content-box .content-state ul, .export-modal .mail-content .content-box .content-state ol, .export-modal .download-content .content-box .content-state p, .export-modal .download-content .content-box .content-state ul, .export-modal .download-content .content-box .content-state ol {
  line-height: 1.5;
}

.export-modal .jira-content .content-box .content-state.error-state .error-container, .export-modal .confluence-content .content-box .content-state.error-state .error-container, .export-modal .mail-content .content-box .content-state.error-state .error-container, .export-modal .download-content .content-box .content-state.error-state .error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--error-color);
  padding: var(--two);
}

.export-modal .jira-content .content-box .content-state.error-state .error-container .material-symbols-outlined, .export-modal .confluence-content .content-box .content-state.error-state .error-container .material-symbols-outlined, .export-modal .mail-content .content-box .content-state.error-state .error-container .material-symbols-outlined, .export-modal .download-content .content-box .content-state.error-state .error-container .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: var(--one);
}

.export-modal .jira-content .content-box .content-state.email-content .email-preview .email-header, .export-modal .confluence-content .content-box .content-state.email-content .email-preview .email-header, .export-modal .mail-content .content-box .content-state.email-content .email-preview .email-header, .export-modal .download-content .content-box .content-state.email-content .email-preview .email-header {
  background-color: var(--tile-bg);
  padding: var(--half) var(--one);
  margin-bottom: var(--one);
  border-radius: var(--half);
}

.export-modal .jira-content .content-box .content-state.email-content .email-preview .email-header .email-field, .export-modal .confluence-content .content-box .content-state.email-content .email-preview .email-header .email-field, .export-modal .mail-content .content-box .content-state.email-content .email-preview .email-header .email-field, .export-modal .download-content .content-box .content-state.email-content .email-preview .email-header .email-field {
  margin-bottom: var(--half);
}

.export-modal .jira-content .content-box .content-state.email-content .email-preview .email-header .email-field:last-child, .export-modal .confluence-content .content-box .content-state.email-content .email-preview .email-header .email-field:last-child, .export-modal .mail-content .content-box .content-state.email-content .email-preview .email-header .email-field:last-child, .export-modal .download-content .content-box .content-state.email-content .email-preview .email-header .email-field:last-child {
  margin-bottom: 0;
}

.export-modal .jira-content .content-box .content-state.email-content .email-preview .email-body, .export-modal .confluence-content .content-box .content-state.email-content .email-preview .email-body, .export-modal .mail-content .content-box .content-state.email-content .email-preview .email-body, .export-modal .download-content .content-box .content-state.email-content .email-preview .email-body {
  padding: var(--half);
}

.export-modal .jira-content .content-box .content-state.download-content .download-preview .file-info, .export-modal .confluence-content .content-box .content-state.download-content .download-preview .file-info, .export-modal .mail-content .content-box .content-state.download-content .download-preview .file-info, .export-modal .download-content .content-box .content-state.download-content .download-preview .file-info {
  display: flex;
  align-items: center;
  background-color: var(--tile-bg);
  padding: var(--one);
  border-radius: var(--half);
  margin-bottom: var(--one);
}

.export-modal .jira-content .content-box .content-state.download-content .download-preview .file-info .file-icon, .export-modal .confluence-content .content-box .content-state.download-content .download-preview .file-info .file-icon, .export-modal .mail-content .content-box .content-state.download-content .download-preview .file-info .file-icon, .export-modal .download-content .content-box .content-state.download-content .download-preview .file-info .file-icon {
  font-size: 48px;
  margin-right: var(--one);
}

.export-modal .jira-content .content-box .content-state.download-content .download-preview .file-info .file-details .filename, .export-modal .confluence-content .content-box .content-state.download-content .download-preview .file-info .file-details .filename, .export-modal .mail-content .content-box .content-state.download-content .download-preview .file-info .file-details .filename, .export-modal .download-content .content-box .content-state.download-content .download-preview .file-info .file-details .filename {
  font-weight: bold;
  font-size: 1.2em;
  margin-bottom: var(--half);
}

.export-modal .jira-content .content-box .content-state.download-content .download-preview .file-info .file-details .file-meta, .export-modal .confluence-content .content-box .content-state.download-content .download-preview .file-info .file-details .file-meta, .export-modal .mail-content .content-box .content-state.download-content .download-preview .file-info .file-details .file-meta, .export-modal .download-content .content-box .content-state.download-content .download-preview .file-info .file-details .file-meta {
  color: var(--text-muted);
  font-size: 0.9em;
}

.export-modal .jira-content .content-box .content-state.download-content .download-preview .file-preview, .export-modal .confluence-content .content-box .content-state.download-content .download-preview .file-preview, .export-modal .mail-content .content-box .content-state.download-content .download-preview .file-preview, .export-modal .download-content .content-box .content-state.download-content .download-preview .file-preview {
  background-color: var(--tile-bg);
  padding: var(--one);
  border-radius: var(--half);
}

.export-modal .jira-content .content-box .content-state.download-content .download-preview .file-preview h4, .export-modal .confluence-content .content-box .content-state.download-content .download-preview .file-preview h4, .export-modal .mail-content .content-box .content-state.download-content .download-preview .file-preview h4, .export-modal .download-content .content-box .content-state.download-content .download-preview .file-preview h4 {
  margin-top: 0;
  margin-bottom: var(--half);
}

.export-modal .jira-content .content-box .content-state.download-content .download-preview .file-preview .code-preview, .export-modal .confluence-content .content-box .content-state.download-content .download-preview .file-preview .code-preview, .export-modal .mail-content .content-box .content-state.download-content .download-preview .file-preview .code-preview, .export-modal .download-content .content-box .content-state.download-content .download-preview .file-preview .code-preview {
  background-color: var(--code-bg);
  padding: var(--half);
  border-radius: var(--half);
  overflow-x: auto;
  font-family: monospace;
  white-space: pre-wrap;
}

.export-modal .export-footer {
  padding: var(--one);
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--tile-bg);
}

.export-modal .export-footer .footer-format-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  position: relative;
  margin: 0 var(--one);
}

.export-modal .export-footer .footer-format-container .ai-detection {
  display: flex;
  align-items: center;
  position: relative;
  margin-left: var(--half);
}

.export-modal .export-footer .footer-format-container .ai-detection .detection-icon {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-modal .export-footer .footer-format-container .ai-detection .detection-icon .material-symbols-outlined {
  font-size: 20px;
  color: white;
}

.export-modal .export-footer .footer-format-container .ai-detection .detection-text {
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--tile-bg);
  padding: var(--half);
  border-radius: var(--half);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  min-width: 380px;
  max-width: 400px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10;
}

.export-modal .export-footer .footer-format-container .ai-detection .detection-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px;
  border-style: solid;
  border-color: var(--tile-bg) transparent transparent transparent;
}

.export-modal .export-footer .footer-format-container .ai-detection .detection-text strong {
  text-transform: uppercase;
}

.export-modal .export-footer .footer-format-container .ai-detection:hover .detection-text {
  opacity: 1;
  visibility: visible;
}

.export-modal .export-footer .export-btn {
  margin-left: auto;
  border-radius: var(--half);
}

.export-modal .export-footer .export-btn .material-symbols-outlined {
  font-size: 20px;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
}

.spin {
  animation: spin 1.5s linear infinite;
}

.error-message {
  color: var(--error-color, #e53935);
  padding: var(--one);
  border-radius: var(--half);
  margin: var(--half) 0;
  background-color: rgba(229, 57, 53, 0.1);
}

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

.image-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-modal .image-preview-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.image-preview-modal .image-preview-container {
  position: relative;
  z-index: 1;
  background: var(--bg-color);
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.image-preview-modal .image-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--one) var(--two);
  border-bottom: 1px solid var(--border-color);
}

.image-preview-modal .image-preview-header .image-preview-title {
  font-weight: 600;
  font-size: 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.image-preview-modal .image-preview-header .image-preview-close {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: var(--half);
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background 0.2s;
}

.image-preview-modal .image-preview-header .image-preview-close:hover {
  background: var(--button-bg);
}

.image-preview-modal .image-preview-header .image-preview-close .material-symbols-outlined {
  font-size: 24px;
}

.image-preview-modal .image-preview-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--two);
  min-height: 400px;
}

.image-preview-modal .image-preview-content .image-preview-img {
  max-width: 100%;
  max-height: calc(90vh - 150px);
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.image-preview-modal .image-preview-footer {
  display: flex;
  gap: var(--one);
  padding: var(--one) var(--two);
  border-top: 1px solid var(--border-color);
}

.image-preview-modal .image-preview-footer button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--half);
  padding: var(--one) var(--two);
  background: var(--button-bg);
  border: none;
  border-radius: 6px;
  color: var(--text-color);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.image-preview-modal .image-preview-footer button:hover {
  background: var(--primary-color);
  color: white;
}

.image-preview-modal .image-preview-footer button .material-symbols-outlined {
  font-size: 20px;
}

/* File content preview modal (e.g., DOCX preview rendered from markdown cache) */
.file-content-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.file-content-modal.active {
  opacity: 1;
  visibility: visible;
}

.file-content-modal .file-content-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
}

.file-content-modal .file-content-container {
  position: relative;
  z-index: 1;
  background: var(--tile-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: min(1100px, 94vw);
  height: min(84vh, 820px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.file-content-modal .file-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--one);
  padding: var(--one) var(--two);
  border-bottom: 1px solid var(--border-color);
}

.file-content-modal .file-content-title {
  font-weight: 600;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-content-modal .file-content-close {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: var(--half);
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background 0.2s;
}

.file-content-modal .file-content-close:hover {
  background: var(--button-bg);
}

.file-content-modal .file-content-close .material-symbols-rounded {
  font-size: 22px;
}

.file-content-modal .file-content-body {
  flex: 1;
  overflow: auto;
  padding: var(--one);
  background: var(--page-bg);
}

.file-content-modal[data-preview-kind="doc"] .file-content-body {
  background: var(--tile-elevation-2);
}

.file-content-modal[data-preview-kind="slides"] .file-content-body {
  background: var(--tile-elevation-2);
}

.file-content-modal[data-preview-kind="code"] .file-content-body {
  background: #1e1e2e;
  padding: 0;
  overflow: hidden;
}

.file-content-modal[data-preview-kind="image"] .file-content-body {
  background: #12151e;
  padding: var(--one);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-content-modal .file-content-image-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.file-content-modal .file-content-image-preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.file-content-modal .file-content-footer {
  display: flex;
  gap: var(--one);
  padding: var(--one) var(--two);
  border-top: 1px solid var(--border-color);
  background: var(--tile-bg);
  justify-content: flex-end;
}

.file-content-modal .file-content-loading {
  display: flex;
  align-items: center;
  gap: var(--half);
  color: var(--muted-text);
}

.file-content-modal .file-content-download.btn {
  text-decoration: none;
  background: var(--button-bg);
  color: var(--button-text);
  border: 1px solid var(--border-color);
}

.file-content-modal .file-content-download.btn:visited {
  color: var(--button-text);
}

.file-content-modal .file-content-download.btn:hover {
  background: var(--button-bg-hover);
}

.file-content-modal .file-content-download.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.file-content-modal .btn .material-symbols-rounded {
  font-size: 20px;
}

/* Rendered markdown inside file preview modal */
.file-content-modal .file-content-preview {
  min-width: 0;
}

.file-content-modal .file-content-code-preview {
  padding: 0;
  background: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.file-content-modal .file-content-code-preview .code-language-badge {
  position: absolute;
  top: 8px;
  right: 16px;
  z-index: 2;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a6adc8;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  pointer-events: none;
}

.file-content-modal .file-content-code-preview .code-viewer {
  display: flex;
  flex: 1;
  overflow: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13.5px;
  line-height: 1.65;
}

.file-content-modal .file-content-code-preview .code-line-numbers {
  flex-shrink: 0;
  padding: 16px 16px 16px 20px;
  text-align: right;
  color: #585b70;
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
  white-space: pre;
  font-variant-numeric: tabular-nums;
}

.file-content-modal .file-content-code-preview .code-pre {
  flex: 1;
  margin: 0;
  padding: 16px 16px 16px 20px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre;
  color: #cdd6f4;
}

.file-content-modal .file-content-code-preview .code-pre code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  background: transparent;
  padding: 0;
  border: none;
  display: block;
  white-space: pre;
}

/* Syntax highlighting token colors (scoped to code preview modal) */
.file-content-code-preview .token.comment,
.file-content-code-preview .token.block-comment,
.file-content-code-preview .token.prolog,
.file-content-code-preview .token.doctype,
.file-content-code-preview .token.cdata {
  color: #6c7086;
}

.file-content-code-preview .token.punctuation {
  color: #bac2de;
}

.file-content-code-preview .token.tag,
.file-content-code-preview .token.attr-name,
.file-content-code-preview .token.namespace,
.file-content-code-preview .token.deleted {
  color: #f38ba8;
}

.file-content-code-preview .token.function-name,
.file-content-code-preview .token.function {
  color: #89b4fa;
}

.file-content-code-preview .token.boolean,
.file-content-code-preview .token.number {
  color: #fab387;
}

.file-content-code-preview .token.class-name,
.file-content-code-preview .token.constant,
.file-content-code-preview .token.symbol {
  color: #f9e2af;
}

.file-content-code-preview .token.keyword,
.file-content-code-preview .token.builtin,
.file-content-code-preview .token.selector,
.file-content-code-preview .token.important,
.file-content-code-preview .token.atrule {
  color: #cba6f7;
}

.file-content-code-preview .token.string,
.file-content-code-preview .token.char,
.file-content-code-preview .token.attr-value,
.file-content-code-preview .token.regex,
.file-content-code-preview .token.variable {
  color: #a6e3a1;
}

.file-content-code-preview .token.operator,
.file-content-code-preview .token.entity,
.file-content-code-preview .token.url {
  color: #89dceb;
}

.file-content-code-preview .token.decorator,
.file-content-code-preview .token.annotation {
  color: #f9e2af;
}

.file-content-code-preview .token.property {
  color: #89b4fa;
}

.file-content-code-preview .token.triple-quoted-string {
  color: #a6e3a1;
}

.file-content-code-preview .token.bold,
.file-content-code-preview .token.important {
  font-weight: 700;
}

.file-content-code-preview .token.italic {
  font-style: italic;
}

.file-content-code-preview .token.inserted {
  color: #a6e3a1;
}

.file-content-modal[data-preview-kind="doc"] .file-content-preview {
  max-width: 920px;
  margin: 0 auto;
  background: var(--tile-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: var(--two);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.14);
}

.file-content-modal[data-preview-kind="slides"] .file-content-preview {
  max-width: 980px;
  margin: 0 auto;
  background: var(--tile-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: var(--two);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.14);
}

.file-content-modal[data-preview-kind="sheet"] .file-content-preview {
  max-width: none;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.file-content-modal .file-content-preview .message-content {
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content {
  font-size: 1.05rem;
}

.file-content-modal[data-preview-kind="sheet"] .file-content-preview .message-content {
  font-size: 0.95rem;
}

.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content {
  font-size: 1rem;
}

.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h1,
.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h2,
.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h3,
.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h4,
.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h5,
.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h6,
.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h1,
.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h2,
.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h3,
.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h4,
.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h5,
.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h6 {
  color: var(--text-color);
}

.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h1 {
  font-size: 1.8rem;
  margin-top: 0;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--border-color);
}

.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h2 {
  font-size: 1.35rem;
}

.file-content-modal[data-preview-kind="doc"] .file-content-preview .message-content h3 {
  font-size: 1.15rem;
}

.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h1 {
  font-size: 1.35rem;
  margin-top: 0;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--border-color);
}

.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h2 {
  font-size: 1.2rem;
  margin: 1.4em 0 0.7em;
  padding: 0.5em 0.75em;
  background: var(--tile-elevation-2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.file-content-modal[data-preview-kind="slides"] .file-content-preview .message-content h3 {
  font-size: 1.05rem;
  color: var(--muted-text);
}

.file-content-modal .office-preview-details {
  margin: 1em 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--tile-elevation-2);
  overflow: hidden;
}

.file-content-modal .office-preview-details > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 600;
  user-select: none;
}

.file-content-modal .office-preview-details[open] > summary {
  border-bottom: 1px solid var(--border-color);
}

.file-content-modal .office-preview-pre {
  margin: 0;
  padding: 12px;
  background: var(--page-bg);
  border: none;
  border-radius: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
}

.file-content-modal .file-content-preview .message-content h1,
.file-content-modal .file-content-preview .message-content h2,
.file-content-modal .file-content-preview .message-content h3 {
  line-height: 1.25;
  margin: 1.1em 0 0.55em;
}

.file-content-modal .file-content-preview .message-content p {
  margin: 0.65em 0;
}

.file-content-modal .file-content-preview .message-content ul,
.file-content-modal .file-content-preview .message-content ol {
  padding-left: 1.4em;
}

/* Markdown tables (used heavily by XLSX previews) */
.file-content-modal .file-content-preview .table-wrapper {
  margin: 1em 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--tile-bg);
}

.file-content-modal .file-content-preview table {
  width: 100%;
}

.file-content-modal .file-content-preview .markdown-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}

.file-content-modal .file-content-preview .markdown-table th,
.file-content-modal .file-content-preview .markdown-table td {
  padding: 8px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  white-space: normal;
  word-break: break-word;
}

.file-content-modal[data-preview-kind="sheet"] .file-content-preview .markdown-table th,
.file-content-modal[data-preview-kind="sheet"] .file-content-preview .markdown-table td {
  white-space: nowrap;
}

.file-content-modal .file-content-preview .markdown-table th:last-child,
.file-content-modal .file-content-preview .markdown-table td:last-child {
  border-right: none;
}

.file-content-modal .file-content-preview .markdown-table tr:last-child td {
  border-bottom: none;
}

.file-content-modal .file-content-preview .markdown-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--tile-elevation-2);
  font-weight: 600;
}

.file-content-modal .file-content-preview .markdown-table tbody tr:nth-child(even) {
  background: rgba(var(--primary-color-rgb), 0.04);
}

.file-content-modal .file-content-preview .markdown-table tbody tr:hover {
  background: rgba(var(--primary-color-rgb), 0.08);
}

@media (max-width: 768px) {
  .file-content-modal .file-content-container {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .file-content-modal .file-content-header,
  .file-content-modal .file-content-footer {
    padding-left: var(--one);
    padding-right: var(--one);
  }

  .file-content-modal[data-preview-kind="doc"] .file-content-preview {
    padding: var(--one);
    border-radius: 10px;
  }
}

.mcp-server-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  margin: .5rem 0;
  background: var(--bg-elevated);
}

.mcp-server-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}

.mcp-server-header h4 {
  margin: 0;
  font-weight: 600;
  font-size: 1em;
}

.mcp-subtitle {
  margin-top: .25rem;
  color: var(--text-secondary);
  font-size: .9rem;
}

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

.status-indicator.connected {
  background-color: #4CAF50;
}

.status-indicator.disconnected {
  background-color: #f44336;
}

.error-message {
  color: #f44336;
  font-size: 0.9em;
  margin: .25rem 0;
  padding: .25rem .5rem;
  background-color: rgba(244, 67, 54, 0.1);
  border-radius: 4px;
}

.empty {
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.loading {
  text-align: center;
  color: var(--text-secondary);
}

.mcp-tools-list ul,
.mcp-prompts-list ul,
.mcp-resources-list ul {
  margin: .25rem 0 .5rem 1rem;
}

.config-warning-modal .modal-content {
  max-width: 560px;
  min-height: auto;
  background: var(--tile-bg);
  color: var(--text-color);
  padding: var(--two);
  border: 1px solid var(--border-color);
  border-radius: var(--half);
  margin-top: 0;
}

.config-warning-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--half);
  padding: 0;
}

.config-warning-title-row {
  display: flex;
  align-items: center;
  gap: var(--half);
  font-size: 1.35rem;
  font-weight: 600;
  flex: 1;
  justify-content: center;
}

.config-warning-icon {
  color: var(--error-color, #F44336);
}

.config-warning-modal .modal-body {
  margin-top: var(--half);
  max-height: 60vh;
  overflow-y: auto;
  background: var(--page-bg);
  padding: var(--one);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  line-height: 1.6;
  font-size: 14px;
}

.config-warning-modal .modal-body p {
  margin: 0 0 var(--half) 0;
}

.config-warning-modal .modal-body p:last-child {
  margin-bottom: 0;
}

.config-warning-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: var(--half) 0;
}

.config-warning-file-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(var(--error-color-rgb, 244, 67, 54), 0.12);
  color: var(--error-color, #F44336);
  border: 1px solid rgba(var(--error-color-rgb, 244, 67, 54), 0.3);
  word-break: break-all;
}

.config-warning-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--half);
  margin-top: var(--one);
  padding: 0;
}

.config-warning-cancel {
  background: var(--tile-elevation-2);
  color: var(--text-color);
}

.config-warning-cancel:hover {
  background: var(--tile-elevation-3);
}

.file-content-sensitive-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px var(--two);
  background: rgba(var(--error-color-rgb, 244, 67, 54), 0.1);
  border-bottom: 1px solid rgba(var(--error-color-rgb, 244, 67, 54), 0.25);
  color: var(--error-color, #F44336);
  font-size: 13px;
  font-weight: 500;

  .material-symbols-rounded {
    font-size: 18px;
    flex-shrink: 0;
  }
}

.file-content-modal[data-sensitive="true"] .file-content-header {
  border-bottom: none;
}

.file-content-modal[data-sensitive="true"] .file-content-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
