.modal {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(4px);
  box-sizing: border-box;
}

.modal.pos-center {
  display: none;
  justify-content: center;
  align-items: center;
}

.modal.pos-top-center {
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
}

.modal.pos-bottom-center {
  display: none;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 40px;
}

.modal.pos-center-left {
  display: none;
  justify-content: flex-start;
  align-items: center;
  padding-left: 40px;
}

.modal.pos-center-right {
  display: none;
  justify-content: flex-end;
  align-items: center;
  padding-right: 40px;
}

.modal.pos-top-left {
  display: none;
  justify-content: flex-start;
  align-items: flex-start;
  padding-top: 40px;
  padding-left: 40px;
}

.modal.pos-top-right {
  display: none;
  justify-content: flex-end;
  align-items: flex-start;
  padding-top: 40px;
  padding-right: 40px;
}

.modal.pos-bottom-left {
  display: none;
  justify-content: flex-start;
  align-items: flex-end;
  padding-bottom: 40px;
  padding-left: 40px;
}

.modal.pos-bottom-right {
  display: none;
  justify-content: flex-end;
  align-items: flex-end;
  padding-bottom: 40px;
  padding-right: 40px;
}

.main-modal {
  background: #ffffff;
  border-radius: var(--border-radius);
  width: 524px;
  max-width: 90%;
  position: relative;
  box-sizing: border-box;
  overflow: auto;
}

.modal-content {
  padding: 24px;
  color: #475569;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 8px;
  padding-right: 32px;
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.main-modal:has(.preview-download-btn) .modal-content h2 {
  padding-right: 72px;
}

.modal-stripe {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: #3b82f6;
}

.main-modal.success .modal-stripe {
  background: #22c55e;
}

.main-modal.error .modal-stripe {
  background: #ef4444;
}

.main-modal.warning .modal-stripe {
  background: #f59e0b;
}

.main-modal.info .modal-stripe {
  background: #3b82f6;
}

.close,
.preview-download-btn {
  position: absolute;
  top: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 18px;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
  z-index: 10;
}

.close {
  right: 16px;
}

.close:hover {
  color: #ef4444;
  background: #fef2f2;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 20px 24px;
  box-sizing: border-box;
}

copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  background: #f1f5f9;
  color: #0f172a;
  padding: 2px 3px 2px 7px;
  border-radius: var(--border-radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  user-select: text;
}

copy .copy-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

copy .copy-icon:hover,
copy .copy-icon:focus-visible {
  background-color: #e2e8f0;
  color: #0f172a;
  outline: none;
}

copy .copy-icon .ui-icon {
  width: 13px;
  height: 13px;
}

.copy-buffer {
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0;
}

.modal-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
  box-sizing: border-box;
}

.modal-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
}

.modal-form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  color: #0f172a;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius);
  outline: none;
  box-sizing: border-box;
}

.modal-form-input:focus {
  border-color: #2563eb;
}

.modal-form-input:user-invalid {
  border-color: #ef4444;
}

.panel-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99998;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-sizing: border-box;
  padding: 12px;
}

.panel-modal.is-open {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: panelModalBackdropIn 0.2s ease-out;
}

@keyframes panelModalBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.panel-modal.is-open .panel-modal-container {
  animation: panelModalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-modal-container {
  background: #f4f6f9;
  border-radius: var(--border-radius);
  width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.panel-modal[data-size=medium] .panel-modal-container {
  width: 60vw;
  height: 60vh;
  min-height: 420px;
  max-height: calc(100vh - 24px);
}

@media (max-width: 900px) {
  .panel-modal[data-size=medium] .panel-modal-container {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }
}
@keyframes panelModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.panel-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--org-theme-color, #ffffff);
  color: var(--nav-text-color, #1e293b);
  flex-shrink: 0;
  border-radius: 4px 4px 0 0;
}

.panel-modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-modal-icon {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
}

.panel-modal-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.panel-modal-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--border-radius);
  transition: color 0.15s ease, background 0.15s ease;
  padding: 0;
}

.panel-modal-close:hover {
  color: #ef4444;
  background: rgba(255, 255, 255, 0.08);
}

.panel-modal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  box-sizing: border-box;
  min-height: 0;
}

.panel-modal-body .settings-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
  height: auto;
}

.panel-modal-body .settings-sidebar {
  width: 210px;
  flex-shrink: 0;
}

.panel-modal-body .settings-content {
  flex: 1;
  min-width: 0;
}

.panel-modal-body .card {
  margin: 0;
  animation: none;
}

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

.panel-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.panel-modal-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: var(--border-radius);
}

.panel-modal-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.panel-modal-loading,
.panel-modal-error {
  padding: 32px;
  text-align: center;
  font-size: 14px;
  color: #555657;
}

@media (max-width: 768px) {
  .panel-modal {
    padding: 0;
    align-items: flex-end;
  }
  .panel-modal.is-open {
    align-items: flex-end;
  }
  .panel-modal-container {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--border-radius);
  }
  .panel-modal-body .settings-layout {
    flex-direction: column;
  }
  .panel-modal-body .settings-sidebar {
    width: 100%;
  }
}
.slide-panel {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99998;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: flex-end;
}

.slide-panel.is-open {
  display: flex;
  animation: slidePanelBackdrop 0.2s ease-out forwards;
}

@keyframes slidePanelBackdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.slide-panel-container {
  width: 400px;
  box-shadow: -8px 0 30px rgba(16, 24, 40, 0.18);
  max-width: 100%;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow: auto;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
.slide-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.slide-panel-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.slide-panel-close {
  background: none;
  border: none;
  font-size: 17px;
  color: #9ca3af;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.slide-panel-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.slide-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #ffffff;
  border-radius: var(--border-radius, 6px);
  padding: 16px 20px 16px 24px;
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 500;
}

.toast.toast-hiding {
  opacity: 0;
  transform: translateX(100%);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.toast-stripe {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
}

.toast.success .toast-stripe {
  background: #22c55e;
}

.toast.error .toast-stripe {
  background: #ef4444;
}

.toast.warning .toast-stripe {
  background: #f59e0b;
}

.toast.info .toast-stripe {
  background: #3b82f6;
}

.toast-icon {
  width: 19px;
  height: 19px;
  margin-top: 2px;
}

.toast.success .toast-icon {
  color: #22c55e;
}

.toast.error .toast-icon {
  color: #ef4444;
}

.toast.warning .toast-icon {
  color: #f59e0b;
}

.toast.info .toast-icon {
  color: #3b82f6;
}

.toast-content {
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  transition: color 0.15s ease;
}

.toast-close:hover {
  color: #ef4444;
}

.preview-loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 75vh;
  width: 100%;
}

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

.preview-download-btn {
  right: 52px;
}

.preview-download-btn:hover {
  color: var(--primary-color, #0ea5e9);
  background: #f1f5f9;
}

.preview-loading-text {
  color: #666;
  font-size: 14px;
}

.preview-iframe {
  width: 100%;
  height: 75vh;
  border: none;
  border-radius: var(--border-radius, 4px);
  display: none;
  margin: 0;
  padding: 0;
  background: white;
}

.preview-text-container {
  width: 100%;
  max-height: 75vh;
  overflow: auto;
  display: none;
  background: white;
  border-radius: var(--border-radius, 4px);
  padding: 16px;
  box-sizing: border-box;
}

.preview-text-content {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 14px;
}