
:root {
  --z-modal: 3000;          
  --z-modal-top: 3200;      
}


.ui-modal,
.mc-modal,
.doc-qc-modal,
.dlmodal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--overlay);
}

.ui-modal:not(.hidden):not([hidden]),
.mc-modal:not(.hidden),
.doc-qc-modal:not([hidden]),
.dlmodal:not([hidden]) { display: flex; }


.ui-modal-mask,
.mc-modal-mask,
.doc-qc-mask,
.dlmodal-mask {
  position: absolute;
  inset: 0;
  background: transparent;
}


.ui-modal-card,
.mc-modal-card,
.doc-qc-card,
.dlmodal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border: var(--color-border-width) solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  animation: uiModalPop var(--mc-dur, .25s) var(--mc-ease, ease) both;
  overflow: hidden;   
}

.doc-qc-card         { padding: 22px 22px 18px; }


.ui-modal-head,
.mc-modal-head,
.doc-qc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mc-gap-md, 12px);
  padding: var(--mc-gap-lg, 16px) var(--mc-gap-xl, 22px);
  border-bottom: 1px solid var(--color-border);
}


.ui-modal-title,
.mc-modal-title,
.doc-qc-modal-title {
  margin: 0;
  font-size: var(--mc-font-h3, 17px);
  font-weight: 700;
  color: var(--color-text-title);
}


.ui-modal-close,
.mc-modal-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 18px;
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s;
}
.ui-modal-close:hover,
.mc-modal-close:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}
.ui-modal-close:focus-visible,
.mc-modal-close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}


.ui-modal-body,
.mc-modal-body {
  padding: var(--mc-gap-xl, 22px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}


.ui-modal-foot,
.mc-modal-foot,
.doc-qc-modal-foot,
.dlmodal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}


body.ui-modal-open { overflow: hidden; }


@keyframes uiModalPop {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-modal-card, .mc-modal-card, .doc-qc-card, .dlmodal-card { animation: none; }
}


.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--main-shadow-hover);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--color-text-title); margin-bottom: 16px; }
