/* 项目统一 SweetAlert2 样式（主站 / embed / 独立页共用）
   令牌与 index_home 对齐；无 --hm-* 时用下方回退色 */

:root {
  --swal-accent: var(--hm-accent, #2f6fe0);
  --swal-accent-hover: var(--hm-accent-hover, #2559bd);
  --swal-accent-soft: var(--hm-accent-soft, #eaf1fd);
  --swal-ink: var(--hm-ink, #1b2636);
  --swal-ink-2: var(--hm-ink-2, #3f4d63);
  --swal-muted: var(--hm-muted, #64748b);
  --swal-border: var(--hm-border, #e3e8ef);
  --swal-surface: var(--hm-surface, #ffffff);
  --swal-sunken: var(--hm-sunken, #f6f8fb);
  --swal-success: var(--hm-success, #1f9d8b);
  --swal-warning: var(--hm-warning, #d4860f);
  --swal-danger: var(--hm-danger, #d6483f);
  --swal-radius: var(--hm-radius, 10px);
  --swal-shadow: var(--hm-shadow-pop, 0 12px 32px rgba(20, 32, 52, .16));
  --swal-focus: var(--hm-focus-ring, 0 0 0 3px rgba(47, 111, 224, .2));
}

/* --------------------------------------------------------------------------
   中间大弹窗（非 toast）
   -------------------------------------------------------------------------- */

/* 仅中间大弹窗有遮罩；toast 必须保持透明，否则右上角小提示会整屏变暗 */
body:not(.swal2-toast-shown) .swal2-container.swal2-backdrop-show,
body:not(.swal2-toast-shown) .swal2-container.swal2-noanimation {
  background: rgba(20, 32, 52, .42) !important;
}

body.swal2-toast-shown .swal2-container,
body.swal2-toast-shown .swal2-container.swal2-backdrop-show,
body.swal2-toast-shown .swal2-container.swal2-noanimation {
  background: transparent !important;
}

.swal2-popup:not(.swal2-toast) {
  width: min(28rem, calc(100vw - 2rem)) !important;
  padding: 1.35rem 1.25rem 1.15rem !important;
  border: 1px solid rgba(255, 255, 255, .36) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, .94) !important;
  color: var(--swal-ink) !important;
  box-shadow: var(--swal-shadow) !important;
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

.swal2-popup:not(.swal2-toast) .swal2-title {
  margin: 0 !important;
  padding: .15rem .35rem 0 !important;
  color: var(--swal-ink) !important;
  font-size: 1.125rem !important;
  font-weight: 650 !important;
  line-height: 1.4 !important;
}

.swal2-popup:not(.swal2-toast) .swal2-html-container {
  margin: .55rem .35rem .15rem !important;
  padding: 0 !important;
  color: var(--swal-ink-2) !important;
  font-size: .9375rem !important;
  font-weight: 400 !important;
  line-height: 1.55 !important;
}

/* Swal2 成功/错误图标内部用 em 定位；只能改 font-size 缩放，
   直接改 width/height 会让 X / 对勾错位（呈倒 V） */
.swal2-popup:not(.swal2-toast) .swal2-icon {
  font-size: .7rem !important; /* 5em → 3.5rem */
  width: 5em !important;
  height: 5em !important;
  margin: .15rem auto .75rem !important;
  border-width: .2em !important;
  line-height: 5em !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon .swal2-icon-content {
  font-size: 3.75em !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success .swal2-success-ring {
  border-color: color-mix(in srgb, var(--swal-success) 32%, transparent) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success [class^='swal2-success-line'] {
  background-color: var(--swal-success) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success {
  border-color: var(--swal-success) !important;
  color: var(--swal-success) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error {
  border-color: var(--swal-danger) !important;
  color: var(--swal-danger) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
  background-color: var(--swal-danger) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-warning {
  border-color: color-mix(in srgb, var(--swal-warning) 55%, #fff) !important;
  color: var(--swal-warning) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-info {
  border-color: color-mix(in srgb, var(--swal-accent) 45%, #fff) !important;
  color: var(--swal-accent) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-question {
  border-color: color-mix(in srgb, var(--swal-muted) 40%, #fff) !important;
  color: var(--swal-muted) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-actions {
  gap: .5rem !important;
  margin: 1.05rem auto 0 !important;
  padding: 0 .2rem !important;
}

.swal2-popup:not(.swal2-toast) .swal2-styled {
  margin: 0 !important;
  min-width: 5.5rem;
  padding: .55rem 1.15rem !important;
  border-radius: 8px !important;
  font-size: .875rem !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.swal2-popup:not(.swal2-toast) .swal2-styled:focus,
.swal2-popup:not(.swal2-toast) .swal2-styled:active,
.swal2-popup:not(.swal2-toast) .swal2-styled.swal2-default-outline:focus {
  box-shadow: none !important;
  outline: none !important;
}

.swal2-popup:not(.swal2-toast) .swal2-actions:not(.swal2-loading) .swal2-styled:hover {
  background-image: none !important;
}

.swal2-popup:not(.swal2-toast) .swal2-actions:not(.swal2-loading) .swal2-styled:active {
  background-image: none !important;
}

/* 默认确认色：盖掉插件紫；有 confirmButtonColor 内联时仍以业务色为准 */
.swal2-popup:not(.swal2-toast) .swal2-styled.swal2-confirm {
  background-color: var(--swal-accent);
  border: 1px solid transparent !important;
  color: #fff;
}

.swal2-popup:not(.swal2-toast) .swal2-styled.swal2-confirm:hover {
  background-color: var(--swal-accent-hover);
}

/* 取消：次要描边按钮（统一视觉，盖掉默认灰底 / 常见红取消） */
.swal2-popup:not(.swal2-toast) .swal2-styled.swal2-cancel {
  background-color: var(--swal-sunken) !important;
  border: 1px solid var(--swal-border) !important;
  color: var(--swal-ink-2) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-styled.swal2-cancel:hover {
  background-color: #eef2f7 !important;
  border-color: #cdd6e2 !important;
}

.swal2-popup:not(.swal2-toast) .swal2-styled.swal2-deny {
  background-color: var(--swal-danger);
  border: 1px solid transparent !important;
  color: #fff;
}

.swal2-popup:not(.swal2-toast) .swal2-styled.swal2-deny:hover {
  background-color: #c23d35;
}

.swal2-popup:not(.swal2-toast) .swal2-close {
  width: 2rem !important;
  height: 2rem !important;
  margin: .35rem .35rem 0 0 !important;
  border-radius: 8px !important;
  color: var(--swal-muted) !important;
  font-size: 1.65rem !important;
  transition: background-color .15s ease, color .15s ease;
}

.swal2-popup:not(.swal2-toast) .swal2-close:hover {
  background: var(--swal-sunken) !important;
  color: var(--swal-ink) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-input,
.swal2-popup:not(.swal2-toast) .swal2-textarea,
.swal2-popup:not(.swal2-toast) .swal2-select,
.swal2-popup:not(.swal2-toast) .swal2-file {
  margin: .75rem 1rem .15rem !important;
  border: 1px solid var(--swal-border) !important;
  border-radius: 8px !important;
  background: var(--swal-surface) !important;
  color: var(--swal-ink) !important;
  font-size: .9375rem !important;
  box-shadow: none !important;
}

.swal2-popup:not(.swal2-toast) .swal2-input:focus,
.swal2-popup:not(.swal2-toast) .swal2-textarea:focus,
.swal2-popup:not(.swal2-toast) .swal2-select:focus,
.swal2-popup:not(.swal2-toast) .swal2-file:focus {
  border-color: var(--swal-accent) !important;
  box-shadow: var(--swal-focus) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-validation-message {
  margin: .75rem 1rem 0 !important;
  border-radius: 8px !important;
  background: #fdeceb !important;
  color: var(--swal-danger) !important;
  font-size: .875rem !important;
  font-weight: 500 !important;
}

.swal2-popup:not(.swal2-toast) .swal2-validation-message::before {
  background-color: var(--swal-danger) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-footer {
  margin: .85rem .35rem 0 !important;
  padding: .75rem .35rem 0 !important;
  border-top: 1px solid var(--swal-border) !important;
  color: var(--swal-muted) !important;
  font-size: .8125rem !important;
}

.swal2-popup:not(.swal2-toast) .swal2-loader {
  border-color: var(--swal-accent) transparent var(--swal-accent) transparent !important;
}

.swal2-popup:not(.swal2-toast) .swal2-timer-progress-bar {
  background: color-mix(in srgb, var(--swal-accent) 45%, transparent) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-timer-progress-bar-container {
  border-bottom-right-radius: 12px !important;
  border-bottom-left-radius: 12px !important;
}

/* --------------------------------------------------------------------------
   Toast（右上角小提示，沿用既有布局）
   -------------------------------------------------------------------------- */

.swal2-container .swal2-popup.swal2-toast {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: auto !important;
  min-width: 180px !important;
  max-width: 280px !important;
  min-height: 44px !important;
  padding: 8px 12px !important;
  border: 1px solid rgba(255, 255, 255, .36) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, .96) !important;
  font-size: 13px !important;
  grid-template-columns: none !important;
  grid-template-rows: none !important;
  overflow: hidden !important;
  box-shadow: 0 0 0 1px rgba(20, 32, 52, .03), 0 1px 2px rgba(20, 32, 52, .05),
    0 6px 18px rgba(20, 32, 52, .08) !important;
}

.swal2-container .swal2-popup.swal2-toast > *,
.swal2-container .swal2-popup.swal2-toast .swal2-icon,
.swal2-container .swal2-popup.swal2-toast .swal2-title,
.swal2-container .swal2-popup.swal2-toast .swal2-html-container,
.swal2-container .swal2-popup.swal2-toast .swal2-timer-progress-bar-container {
  grid-column: auto !important;
  grid-row: auto !important;
}

/* toast 图标默认 2em；用 font-size 缩放，勿写死 px（否则 X/勾与动画错位） */
.swal2-container .swal2-popup.swal2-toast .swal2-icon {
  flex: 0 0 auto !important;
  font-size: 12px !important; /* 2em → 24px；不受上方 toast 的 13px 影响 */
  width: 2em !important;
  height: 2em !important;
  min-width: 2em !important;
  margin: 0 !important;
  border-width: .25em !important;
  align-self: center !important;
  position: relative !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-html-container,
.swal2-container .swal2-popup.swal2-toast .swal2-title {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--swal-ink) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 20px !important;
  text-align: left !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-info {
  border-color: var(--swal-accent) !important;
  color: var(--swal-accent) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-warning {
  border-color: var(--swal-warning) !important;
  color: var(--swal-warning) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-error {
  border-color: var(--swal-danger) !important;
  color: var(--swal-danger) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-question {
  border-color: var(--swal-muted) !important;
  color: var(--swal-muted) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-success {
  border-color: var(--swal-success) !important;
  color: var(--swal-success) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring {
  border-color: color-mix(in srgb, var(--swal-success) 30%, transparent) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-success [class^='swal2-success-line'] {
  background-color: var(--swal-success) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
  background-color: var(--swal-danger) !important;
}

/* 压过 wf-modal(3000) / 附件预览(3200)；插件默认仅 1060，会钻到 modal 下面 */
.swal2-container {
  z-index: 4300;
}

/* embed / iframe 内 toast 不被裁切 */
body.im-embed .swal2-container {
  z-index: 20000;
}
