.glass-effect {
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    background-color: rgba(255, 255, 255, 0.3);
}

.fade-out {
    transition: opacity 0.5s ease-out;
    opacity: 0;
}

#markdown-preview {
    font-family: sans-serif;
    line-height: 1.6;
    font-size: 14px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #f9f9f9;
    overflow-y: auto;
    max-height: 500px;
}

#markdown-preview h1,
#markdown-preview h2,
#markdown-preview h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: bold;
}

#markdown-preview p {
    margin-bottom: 1em;
}

#markdown-preview ul {
    list-style-type: disc;
    padding-left: 1.5em;
    margin-bottom: 1em;
}

#markdown-preview ol {
    list-style-type: decimal;
    padding-left: 1.5em;
    margin-bottom: 1em;
}

#markdown-preview li {
    margin-bottom: 0.25em;
}

#markdown-preview blockquote {
    border-left: 4px solid #ccc;
    padding-left: 1em;
    color: #555;
    margin: 1em 0;
    font-style: italic;
}

/* Keep EasyMDE inside its half of the description modal. */
#offer-description-form .EasyMDEContainer {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

#offer-description-form .editor-toolbar,
#offer-description-form .editor-statusbar {
    flex-shrink: 0;
}

#offer-description-form .CodeMirror {
    flex: 1;
    height: 0;
    min-height: 0;
}

#offer-description-form .CodeMirror-scroll {
    min-height: 0;
    overscroll-behavior: contain;
}

.package-status-popover {
    position: fixed;
    z-index: 100;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overflow-wrap: anywhere;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 8px 30px #0f172a26;
    font-size: 12px;
    line-height: 1.5;
}

.package-status-popover p { margin: 5px 0; }

/* Long export tables must not push the selected record's details off-screen. */
.crm-detail-modal {
    position: fixed;
    z-index: 90;
    top: 50%;
    left: 50%;
    width: min(720px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    transform: translate(-50%, -50%);
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
    border: 1px solid #94a3b8;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .38), 0 18px 50px rgba(15, 23, 42, .3);
}

.crm-detail-modal--wide { width: min(960px, calc(100vw - 24px)); }

.crm-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #334155;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.crm-modal-close:hover,
.crm-modal-close:focus-visible { background: #e2e8f0; outline: 2px solid #60a5fa; outline-offset: 1px; }

.crm-detail-modal > h2:first-of-type,
.crm-detail-modal > div:first-of-type h2 { padding-right: 38px; }

.package-history-group { background: #fff; }
.package-history-summary {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 3.25rem;
    padding: .75rem 1rem;
    cursor: pointer;
    list-style-position: inside;
}
.package-history-summary:hover { background: #f8fafc; }
.package-history-summary strong { min-width: 14rem; font-size: 1rem; }
.package-count-current,
.package-count-old,
.package-count-muted { border-radius: 999px; padding: .15rem .55rem; font-size: .75rem; }
.package-count-current { border: 1px solid #bbf7d0; background: #f0fdf4; color: #166534; }
.package-count-old { border: 1px solid #fed7aa; background: #fff7ed; color: #9a3412; }
.package-count-muted { border: 1px solid #e2e8f0; background: #f8fafc; color: #64748b; }
.package-group-date { margin-left: auto; color: #64748b; font-size: .75rem; }
.package-history-content { overflow-x: auto; border-top: 1px solid #e2e8f0; padding: .75rem 1rem 1rem; }
.package-history-heading { margin-top: .25rem; font-size: .8rem; font-weight: 700; color: #166534; }
.package-history-heading--old { margin-top: 1rem; color: #9a3412; }
@media (max-width: 760px) {
    .package-history-summary { flex-wrap: wrap; }
    .package-history-summary strong { min-width: calc(100% - 2rem); }
    .package-group-date { width: 100%; margin-left: 1.25rem; }
}

.export-jobs-units-table {
    width: 100%;
    min-width: 760px;
    table-layout: auto;
}

.export-jobs-units-table .ej-offer-column { width: 260px; }
.export-jobs-units-table .ej-portals-column { width: auto; }

.ej-offer-disclosure {
    width: 100%;
    border-left: 4px solid transparent;
    padding-left: 8px;
}
.ej-offer-disclosure--domestic { border-left-color: #2563eb; }
.ej-offer-disclosure--foreign { border-left-color: #9333ea; }

.ej-offer-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    cursor: pointer;
    list-style-position: outside;
    white-space: nowrap;
}

.ej-offer-summary::marker { color: #475569; }
.ej-offer-summary:hover { background: #f8fafc; }
.ej-offer-bulk { margin-left: auto; }

.ej-portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    padding: 4px 0 12px 22px;
}

.ej-portal-card {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: center;
    gap: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

.ej-portal-card > strong { width: 100%; }

.ej-portal-card--reference { background: #f8fafc; }

.ej-portal-pill {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    padding: 2px 7px;
    color: #334155;
    font-size: 11px;
    line-height: 1.35;
}

.ej-portal-pill--ready { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.ej-portal-pill--warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.ej-portal-pill--danger { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.ej-portal-pill--domestic { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.ej-portal-pill--foreign { border-color: #e9d5ff; background: #faf5ff; color: #7e22ce; font-weight: 700; }

@media (max-width: 760px) {
    .export-jobs-units-table { min-width: 680px; }
    .ej-portal-grid { grid-template-columns: 1fr; }
}

.package-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    vertical-align: middle;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: package-spin .75s linear infinite;
}

@keyframes package-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .package-spinner { animation: none; } }
