/* 全站 Modal 外壳与标题栏规范。必须放在页面局部样式之后加载。 */

/* 面板外壳 */
html body .modal .modal-content {
  border: 1px solid #e5e7eb !important;
  border-radius: 14px !important;
  background: #fff !important;
  color: #111827 !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08) !important;
  overflow: hidden !important;
}

html body .modal.modal-fullscreen .modal-content,
html body .modal.modal-edge-to-edge .modal-content {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* 标题栏 */
html body .modal :is(.modal-header, .tw-editor-head) {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
  gap: 8px !important;
  padding: 9px 12px !important;
  background: #fff !important;
  border-bottom: 1px solid #e5e7eb !important;
}

/* 任务卡片详情：关闭钮悬浮叠层，不走标准标题栏白底 */
html body .modal.task-detail-modal > .modal-dialog > .modal-content > .modal-header {
  background: transparent !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
}

html body .modal :is(.modal-header, .tw-editor-head) .modal-title,
html body .modal :is(.modal-header, .tw-editor-head) h2 {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  color: #111827 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  letter-spacing: -.02em !important;
}

html body .modal :is(.modal-header, .tw-editor-head) .modal-title i,
html body .modal :is(.modal-header, .tw-editor-head) h2 > i {
  vertical-align: -.05em;
}

/* 操作区：独立按钮，不做胶囊底。 */
html body .modal :is(.modal-header, .tw-editor-head) :is(.modal-header-actions, .modal-header-buttons, .task-modal-actions) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex: 0 0 auto !important;
  gap: 8px !important;
  margin-left: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 关闭 / 全屏按钮：30x30 浅灰圆角。 */
html body .modal :is(.modal-header, .tw-editor-head) :is(
  .close,
  .btn-close,
  .btn-modal-fs,
  .task-modal-btn,
  .tw-editor-close,
  .wf-icon-btn.close
) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 30px !important;
  float: none !important;
  box-sizing: border-box !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: #f3f4f6 !important;
  background-image: none !important;
  color: #4b5563 !important;
  font-family: inherit !important;
  font-size: 14px !important;
  line-height: 1 !important;
  text-shadow: none !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

/* Font Awesome solid 必须 900，否则叉号不显示。 */
html body .modal :is(.modal-header, .tw-editor-head) :is(.close, .btn-close, .btn-modal-fs, .task-modal-btn, .tw-editor-close, .wf-icon-btn.close) i,
html body .modal :is(.modal-header, .tw-editor-head) :is(.close, .btn-close, .btn-modal-fs, .task-modal-btn, .tw-editor-close, .wf-icon-btn.close) .fa,
html body .modal :is(.modal-header, .tw-editor-head) :is(.close, .btn-close, .btn-modal-fs, .task-modal-btn, .tw-editor-close, .wf-icon-btn.close) .fas {
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
  color: inherit !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* 旧版 × 文本：隐藏文字，改画 FA 叉号。 */
html body .modal :is(.modal-header, .tw-editor-head) .close > span {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

html body .modal :is(.modal-header, .tw-editor-head) .close:not(:has(> i))::before {
  content: "\f00d";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  color: inherit;
}

html body .modal :is(.modal-header, .tw-editor-head) .btn-close {
  background-image: none !important;
}
html body .modal :is(.modal-header, .tw-editor-head) .btn-close::before {
  content: "\f00d";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  color: inherit;
}

html body .modal :is(.modal-header, .tw-editor-head) :is(.close, .btn-close, .btn-modal-fs, .task-modal-btn, .tw-editor-close, .wf-icon-btn.close):hover {
  background: #e5e7eb !important;
  color: #111827 !important;
  opacity: 1 !important;
}

html body .modal :is(.modal-header, .tw-editor-head) :is(.close, .btn-close, .btn-modal-fs, .task-modal-btn, .tw-editor-close, .wf-icon-btn.close):focus-visible {
  outline: 2px solid #3498db !important;
  outline-offset: 2px;
}

html body .modal :is(.modal-header, .tw-editor-head) > .close,
html body .modal :is(.modal-header, .tw-editor-head) > .btn-close {
  margin-left: auto !important;
}

html.oa-modal-auto-fullscreen body .modal:not([data-modal-fullscreen-policy="manual"]) .btn-modal-fs,
html body .modal[data-modal-fullscreen-policy="locked"] .btn-modal-fs {
  display: none !important;
}

@media (max-width: 768px) {
  html body .modal[data-modal-fullscreen-policy="responsive"] .btn-modal-fs {
    display: none !important;
  }
}
