/* Toast (#modal-custom-toast): clip absolutely positioned progress bar to border-radius */
#modal-custom-toast {
    overflow: hidden;
}

.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(4px);
    z-index: 30000;
}

.modal-backdrop-custom.active {
    display: flex;
}

.modal-box-custom {
    width: 100%;
    max-width: 520px;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
    color: #1f2937;
}

.modal-header-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    color: #ffffff;
}

/* Bright warning header (#EDF046): dark text/icons for contrast */
.modal-header-custom.modal-header-on-light {
    color: #1a1a1a;
}

.modal-header-custom.modal-header-on-light .modal-icon-custom {
    background: rgba(0, 0, 0, 0.1);
}

.modal-header-custom.modal-header-on-light .modal-icon-custom svg,
.modal-header-custom.modal-header-on-light .modal-icon-custom i {
    fill: #1a1a1a;
    color: #1a1a1a;
}

.modal-header-custom.modal-header-on-light .modal-close-custom {
    color: #1a1a1a;
}

.modal-icon-custom {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    flex: 0 0 34px;
}

.modal-icon-custom svg,
.modal-icon-custom i {
    width: 18px;
    height: 18px;
    fill: #ffffff;
    color: #ffffff;
    font-size: 18px;
}

.modal-title-custom {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    flex: 1 1 auto;
}

.modal-close-custom {
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-body-custom {
    padding: 1.25rem;
}

.modal-desc-custom {
    margin: 0 0 1rem;
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
}

.detail-box-custom {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #f9fafb;
    margin-bottom: 1rem;
}

.detail-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.detail-header-custom span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}

.detail-header-custom button.btn-sm-custom,
button.btn-sm-custom.btn-copy-detail {
    border: 0;
    background: transparent;
    color: #374151;
    border-radius: 8px;
    padding: 4px 8px;
    margin: 0 -4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
}

.detail-header-custom button.btn-sm-custom::-moz-focus-inner,
button.btn-sm-custom.btn-copy-detail::-moz-focus-inner {
    border: 0 !important;
    padding: 0;
}

.detail-header-custom button.btn-sm-custom:focus,
.detail-header-custom button.btn-sm-custom:focus-visible,
.detail-header-custom button.btn-sm-custom:focus-within,
.detail-header-custom button.btn-sm-custom:active,
button.btn-sm-custom.btn-copy-detail:focus,
button.btn-sm-custom.btn-copy-detail:focus-visible,
button.btn-sm-custom.btn-copy-detail:active {
    outline: 0 !important;
    outline-style: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

.detail-header-custom .btn-sm-custom-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.detail-header-custom .btn-sm-custom:active .btn-sm-custom-icon-wrap {
    background: #e5e7eb;
    border-color: #cbd5e1;
}

.detail-header-custom .btn-sm-custom-label {
    white-space: nowrap;
}

.detail-header-custom .btn-sm-custom.is-copied .btn-sm-custom-label {
    color: #059669;
}

.detail-box-custom pre {
    margin: 0;
    padding: 14px 16px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.6;
    font-family: Consolas, Monaco, monospace;
}

.meta-grid-custom {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.meta-card-custom {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    padding: 12px 14px;
}

.meta-key-custom {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.meta-val-custom {
    font-size: 16px;
    line-height: 1.25;
    font-weight: 700;
    color: #111827;
    word-break: break-word;
}

.modal-footer-custom {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 1rem 1.25rem 1.25rem;
}

.modal-footer-actions-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.modal-footer-link-wrap {
    flex: 0 1 auto;
    min-width: 0;
}

.btn-footer-link-custom {
    border: 0;
    background: transparent;
    padding: 10px 4px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
}

.btn-footer-link-custom:hover {
    color: #111827;
}

.btn-footer-link-custom:focus,
.btn-footer-link-custom:focus-visible,
.btn-footer-link-custom:active {
    outline: none;
    box-shadow: none;
}

.btn-secondary-custom,
.btn-primary-custom {
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary-custom {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
}

.btn-primary-custom {
    border: 1px solid transparent;
    color: #ffffff;
}

.btn-modal-footer-close.btn-modal-footer-close-on-light {
    color: #1a1a1a;
}

.btn-modal-footer-close.btn-modal-footer-close-on-light:hover {
    filter: brightness(0.94);
}

.btn-modal-footer-close.btn-modal-footer-close-on-light:focus-visible {
    outline: 2px solid rgba(26, 26, 26, 0.35);
    outline-offset: 2px;
}

.btn-modal-footer-close:hover {
    filter: brightness(0.92);
}

.btn-modal-footer-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .meta-grid-custom {
        grid-template-columns: 1fr;
    }

    .modal-footer-custom {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-footer-link-wrap {
        width: 100%;
    }

    .modal-footer-actions-custom {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .btn-primary-custom {
        width: 100%;
    }
}
