
#cmModal,
#docViewModal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    background: rgba(17, 24, 39, 0.5);
    overflow-y: auto;
    padding: 24px;
}
#cmModal.in,
#cmModal.show,
#docViewModal.in,
#docViewModal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}
#cmModal .modal-dialog,
#docViewModal .modal-dialog {
    margin: 0;
    width: 90%;
    max-width: 800px;
}
#cmModal .modal-content,
#docViewModal .modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 85vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
#cmModal .modal-header,
#docViewModal .modal-header {
    background: #f5f3ff;
    border-bottom: 1px solid #ede9fe;
    padding: 16px 24px;
    flex-shrink: 0;
}
#cmModal .modal-header,
#docViewModal .modal-header { display: flex; align-items: center; }
#cmModal .modal-header .modal-title,
#docViewModal .modal-header .modal-title { order: 1; flex: 1; margin: 0; }
#cmModal .modal-header .close,
#docViewModal .modal-header .close {
    order: 2;
    font-size: 22px;
    background: transparent;
    border: 0;
    color: #6b7280;
    line-height: 1;
    padding: 0 6px;
    margin: 0 0 0 12px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}
#cmModal .modal-header .close:hover,
#docViewModal .modal-header .close:hover { opacity: 1; color: #1e1b4b; }
#cmModal .modal-title,
#docViewModal .modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e1b4b;
}

#cmModal .modal-title > i,
#docViewModal .modal-title > i {
    color: #7c3aed;
    margin-right: 4px;
}
#cmModal .modal-body,
#docViewModal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 160px;
}

#cmModal .ui-tab-bar,
#docViewModal .ui-tab-bar {
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    margin-right: 0;
}

#cmModal .cm-footer,
#docViewModal .cm-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 14px 24px;
    border-top: 1px solid #ede9fe;
    gap: 8px;
    background: #f5f3ff;
    border-radius: 0 0 12px 12px;
}

#docViewModal .modal-content { height: 85vh; max-height: 85vh; }
#docViewModal .modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #f9fafb;
}
#docViewModal .modal-body > * { max-width: 100%; max-height: 100%; }
#docViewModal .modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    display: block;
}
#docViewModal .modal-body img {
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    display: block;

    width: auto;
    height: auto;
}
#docViewModal .dvm-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #6b7280;
    text-align: center;
}
#docViewModal .dvm-unsupported i { font-size: 40px; color: #d1d5db; }
#docViewModal .dvm-unsupported p { font-size: 14px; margin: 0; }

@keyframes cmSkelShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
.cm-skel {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}
.cm-skel-full { grid-column: 1 / -1; }
.cm-skel-label,
.cm-skel-input,
.cm-skel-area {
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: cmSkelShimmer 1.4s ease-in-out infinite;
}
.cm-skel-label {
    height: 10px;
    width: 60%;
    border-radius: 4px;
    margin-bottom: 6px;
}
.cm-skel-input {
    height: 38px;
    border-radius: 8px;
}
.cm-skel-area {
    height: 78px;
    border-radius: 8px;
}

.cm-error {
    padding: 40px;
    text-align: center;
    color: #dc2626;
}
.cm-error i {
    font-size: 28px;
    margin-bottom: 12px;
    display: block;
}

.cm-busy-overlay {
    position: absolute;
    inset: 0;
    display: none;                          
    background: #fff;
    border-radius: inherit;
    z-index: 6;
    pointer-events: auto;
    overflow-y: auto;
}
