/* Shared EnGen 1 -> 2 -> 3 Workflow & Modal Chrome Tokens */

.eg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}

.eg-modal-shell {
    position: relative;
    background: #ffffff;
    width: 95vw;
    max-width: 880px;
    max-height: 95vh;
    border-radius: 14px;
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f172a;
    box-sizing: border-box;
}

.eg-modal-shell--md {
    max-width: 680px;
}

.eg-modal-shell--lg {
    max-width: 820px;
}

.eg-modal-header {
    background: #1a3a5f;
    color: #ffffff;
    padding: 9px 18px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.eg-modal-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.eg-modal-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.eg-modal-sub {
    font-size: 0.76rem;
    color: #bfdbfe;
    font-weight: 600;
}

.eg-header-pill {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.eg-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    box-shadow: none;
    transition: background 0.15s ease;
}

.eg-modal-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.eg-context-bar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.eg-context-group {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.eg-context-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.eg-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 18px;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 1 -> 2 -> 3 Step Cards */
.eg-step-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
    border-radius: 9px;
    padding: 9px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.eg-step-1 {
    border-color: #bfdbfe;
    border-left-color: #2563eb;
}

.eg-step-2 {
    border-color: #fde68a;
    border-left-color: #d97706;
}

.eg-step-3 {
    border-color: #e9d5ff;
    border-left-color: #7e22ce;
}

.eg-step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.eg-step-title-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
}

.eg-step-badge {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.eg-step-1 .eg-step-badge { background: #2563eb; }
.eg-step-2 .eg-step-badge { background: #d97706; }
.eg-step-3 .eg-step-badge { background: #7e22ce; }

.eg-step-title {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.eg-step-1 .eg-step-title { color: #1e3a8a; }
.eg-step-2 .eg-step-title { color: #92400e; }
.eg-step-3 .eg-step-title { color: #581c87; }

.eg-step-pill {
    font-size: 0.69rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.eg-step-1 .eg-step-pill {
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.eg-step-2 .eg-step-pill {
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.eg-step-3 .eg-step-pill {
    color: #7e22ce;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
}

.eg-field-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.eg-modal-shell .eg-input,
.eg-input {
    width: 100%;
    padding: 6px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.82rem;
    box-sizing: border-box;
    color: #0f172a;
    background: #ffffff;
}

.eg-modal-shell .eg-textarea,
.eg-textarea {
    width: 100%;
    padding: 6px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    min-height: 46px;
    line-height: 1.35;
    color: #0f172a;
    background: #ffffff;
}

/* Unified input & placeholder typography across all modal fields */
.eg-modal-shell input[type="text"],
.eg-modal-shell input[type="number"],
.eg-modal-shell input,
.eg-modal-shell textarea,
.eg-modal-shell select {
    font-size: 0.82rem;
}

.eg-modal-shell input::placeholder,
.eg-modal-shell textarea::placeholder {
    font-size: 0.82rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 400;
    color: #64748b;
    opacity: 1;
}

.eg-dropzone-placeholder {
    font-size: 0.82rem;
    font-weight: 400;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Compact Side-by-Side Source Attachments (File Drop + URL Link) */
.eg-attach-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: center;
}

.eg-dropzone {
    border: 1.5px dashed #94a3b8;
    background: #f8fafc;
    padding: 5px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.eg-dropzone:hover {
    border-color: #d97706;
    background: #fffbeb;
}

.eg-link-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.eg-modal-shell .eg-link-input,
.eg-link-input {
    width: 100%;
    padding: 5px 24px 5px 30px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.82rem;
    box-sizing: border-box;
    min-height: 32px;
    background: #ffffff;
    color: #0f172a;
}

.eg-link-clear {
    display: none;
    position: absolute;
    right: 5px;
    background: none;
    border: none;
    box-shadow: none;
    color: #94a3b8;
    font-size: 0.95rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 3px;
    height: auto;
}

.eg-file-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    max-height: 92px;
    overflow-y: auto;
    padding-top: 2px;
}

.eg-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    max-width: 100%;
    padding: 3px 6px 3px 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 0.72rem;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.eg-file-chip:hover {
    border-color: #f59e0b;
    background: #ffffff;
    box-shadow: 0 2px 6px -2px rgba(217, 119, 6, 0.22);
}

.eg-file-chip.is-previewing {
    border-color: #f59e0b;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(217, 119, 6, 0.16);
}

.eg-file-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
    flex-shrink: 0;
}

.eg-file-chip-idx {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
    font-size: 0.64rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

.eg-file-chip.is-previewing .eg-file-chip-idx {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.eg-file-chip-name {
    flex: 0 1 auto;
    max-width: 96px;
    min-width: 0;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eg-file-chip-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.15;
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.eg-file-chip-tag--pages {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.eg-file-chip-tag--sel {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.eg-file-chip-tag--pick {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #c2410c;
}

.eg-file-chip-tag--muted {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

.eg-file-chip-tag--err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.eg-file-chip-meta {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    flex-shrink: 0;
}

.eg-file-chip-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    padding: 2px 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.eg-file-chip-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.eg-file-chip-btn--del:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Modal Footer (Inline Status on Left, Actions on Right) */
.eg-modal-footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 9px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.eg-footer-status-wrap {
    flex: 1;
    min-width: 0;
}

.eg-footer-hint {
    font-size: 0.74rem;
    font-weight: 700;
    color: #64748b;
}

.eg-footer-status {
    display: none;
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid transparent;
}

.eg-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.eg-modal-shell .eg-btn-secondary {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    height: 34px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 0.825rem;
    cursor: pointer;
    box-shadow: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.eg-modal-shell .eg-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.eg-modal-shell .eg-btn-primary {
    background: #ffffff;
    color: #334155;
    border: 1px solid #c084fc;
    padding: 6px 16px;
    height: 34px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 0.825rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: none;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.eg-modal-shell .eg-btn-primary svg {
    color: #7e22ce;
    flex-shrink: 0;
}

.eg-modal-shell .eg-btn-primary:hover {
    background: #faf5ff;
    border-color: #7e22ce;
    color: #0f172a;
    box-shadow: 0 2px 6px -2px rgba(126, 34, 206, 0.18);
}

.eg-modal-shell .eg-btn-primary.eg-btn-blue {
    border-color: #93c5fd;
    color: #334155;
}

.eg-modal-shell .eg-btn-primary.eg-btn-blue svg {
    color: #2563eb;
}

.eg-modal-shell .eg-btn-primary.eg-btn-blue:hover {
    background: #eff6ff;
    border-color: #2563eb;
    color: #0f172a;
    box-shadow: 0 2px 6px -2px rgba(37, 99, 235, 0.18);
}

/* Light modern segmented mode switcher (Refine Existing / Generate New) */
.eg-mode-switch {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 3px;
    border-radius: 9px;
    gap: 3px;
    align-items: center;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.eg-mode-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.79rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #475569;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.eg-mode-switch-btn:hover:not(.is-active-blue):not(.is-active-purple) {
    background: rgba(255, 255, 255, 0.65);
    color: #0f172a;
}

.eg-mode-switch-btn.is-active-blue {
    background: #ffffff;
    border-color: #93c5fd;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.eg-mode-switch-btn.is-active-blue svg {
    color: #2563eb;
}

.eg-mode-switch-btn.is-active-purple {
    background: #ffffff;
    border-color: #d8b4fe;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.eg-mode-switch-btn.is-active-purple svg {
    color: #7e22ce;
}

/* Align Ask AI footer actions directly underneath the Refine Existing left column */
#ask-ai-modal-footer .eg-footer-col-left {
    display: contents;
}

#ask-ai-modal-footer.is-refine-mode {
    display: grid;
    grid-template-columns: minmax(0, 1.38fr) minmax(380px, 1fr);
    gap: 16px;
    align-items: center;
}

#ask-ai-modal-footer.is-refine-mode .eg-footer-col-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

#ask-ai-modal-footer.is-refine-mode .eg-footer-hint {
    visibility: hidden;
}

@media (max-width: 960px) {
    #ask-ai-modal-footer.is-refine-mode {
        grid-template-columns: 1fr;
    }
}

.eg-modal-shell .eg-btn-navy {
    background: #1a3a5f;
    color: #ffffff;
    border: none;
    padding: 7px 18px;
    height: auto;
    border-radius: 7px;
    font-weight: 700;
    font-size: 0.84rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: none;
    transition: background 0.15s ease;
}

.eg-modal-shell .eg-btn-navy:hover {
    background: #0f2947;
}

.eg-modal-shell .eg-btn-danger-soft {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 7px 14px;
    height: auto;
    border-radius: 7px;
    font-weight: 700;
    font-size: 0.84rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: none;
    transition: background 0.15s ease;
}

.eg-modal-shell .eg-btn-danger-soft:hover {
    background: #fee2e2;
}

/* Contextual Next-Action Glow Cue (Single-Spotlight Nudge) */
@keyframes egNudgePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--eg-nudge-rgb, 37, 99, 235), 0.34),
                    0 0 10px 0 rgba(var(--eg-nudge-rgb, 37, 99, 235), 0.14);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(var(--eg-nudge-rgb, 37, 99, 235), 0.22),
                    0 0 14px 2px rgba(var(--eg-nudge-rgb, 37, 99, 235), 0.26);
    }
}

.eg-nudge {
    --eg-nudge-rgb: 37, 99, 235;
    animation: egNudgePulse 2.4s ease-in-out infinite;
    position: relative;
}

.eg-nudge-blue { --eg-nudge-rgb: 37, 99, 235; }
.eg-nudge-indigo { --eg-nudge-rgb: 79, 70, 229; }
.eg-nudge-slate { --eg-nudge-rgb: 100, 116, 139; }
.eg-nudge-teal { --eg-nudge-rgb: 13, 148, 136; }
.eg-nudge-purple { --eg-nudge-rgb: 126, 34, 206; }
.eg-nudge-emerald { --eg-nudge-rgb: 5, 150, 105; }
.eg-nudge-amber { --eg-nudge-rgb: 217, 119, 6; }
.eg-nudge-navy { --eg-nudge-rgb: 26, 58, 95; }
.eg-nudge-red { --eg-nudge-rgb: 220, 38, 38; }

.eg-nudge:hover,
.eg-nudge:focus-visible,
.eg-nudge:disabled {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .eg-nudge {
        animation: none;
        box-shadow: 0 0 0 3px rgba(var(--eg-nudge-rgb, 37, 99, 235), 0.24);
    }
}

/* Full-Screen Single-Viewport Split Workspace (Zero Scroll on Laptop & Desktop) */
.eg-modal-shell.eg-modal-shell--source-workspace {
    width: calc(100vw - 20px);
    max-width: none;
    height: calc(100vh - 20px);
    max-height: none;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-header {
    padding: 8px 18px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-title {
    font-size: 1.02rem;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-context-bar {
    padding: 7px 18px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-form-col > .eg-context-bar {
    padding: 7px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-body {
    display: grid;
    grid-template-columns: minmax(0, 1.38fr) minmax(380px, 1fr);
    gap: 16px;
    overflow: hidden;
    padding: 12px 18px;
    align-items: start;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-form-col {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-mixer-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
}

/* Crisp, legible controls calibrated to fit single-screen without scrolling */
.eg-modal-shell.eg-modal-shell--source-workspace .eg-step-card {
    padding: 10px 14px;
    gap: 7px;
    border-radius: 9px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-step-badge {
    width: 22px;
    height: 22px;
    font-size: 0.76rem;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-step-title {
    font-size: 0.90rem;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-step-pill {
    font-size: 0.72rem;
    padding: 1px 9px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-field-label {
    font-size: 0.72rem;
    margin-bottom: 3px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-input,
.eg-modal-shell.eg-modal-shell--source-workspace .eg-textarea,
.eg-modal-shell.eg-modal-shell--source-workspace .eg-link-input,
.eg-modal-shell.eg-modal-shell--source-workspace select {
    font-size: 0.89rem;
    padding: 6px 10px;
    border-radius: 7px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-link-input {
    padding-left: 31px;
    min-height: 35px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-textarea {
    min-height: 56px;
    line-height: 1.38;
}

.eg-modal-shell.eg-modal-shell--source-workspace input::placeholder,
.eg-modal-shell.eg-modal-shell--source-workspace textarea::placeholder,
.eg-modal-shell.eg-modal-shell--source-workspace .eg-dropzone-placeholder {
    font-size: 0.87rem;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-dropzone {
    min-height: 35px;
    padding: 5px 10px;
    border-radius: 7px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .ai-mode-pill {
    padding: 7px 9px !important;
    font-size: 0.83rem !important;
    border-radius: 7px !important;
    user-select: none;
}

.ai-mode-pill-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-mode-order-badge {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #7e22ce;
    color: #ffffff;
    font-size: 0.64rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-mode-grip {
    font-size: 0.68rem;
    color: #a855f7;
    opacity: 0.72;
    letter-spacing: -1px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.ai-mode-pill.is-draggable:hover {
    border-color: #a855f7 !important;
    background: #f3e8ff !important;
}

.ai-mode-pill.is-dragging {
    opacity: 0.42 !important;
    cursor: grabbing !important;
}

.ai-mode-pill.is-drag-over {
    border-color: #7e22ce !important;
    background: #f3e8ff !important;
    box-shadow: 0 0 0 2px rgba(126, 34, 206, 0.22);
    transform: scale(1.02);
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-file-list {
    max-height: 92px;
    gap: 5px;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-file-chip {
    padding: 3px 6px 3px 6px;
    font-size: 0.72rem;
}

.eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-footer {
    padding: 8px 18px;
}

/* Keep legacy split-pane styles intact for Read & Listen Studio if used elsewhere */
.eg-pdf-split-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
}

.eg-pdf-idle-placeholder {
    margin: auto;
    padding: 24px 18px;
    text-align: center;
    color: #475569;
    font-size: 0.8rem;
    line-height: 1.5;
    max-width: 280px;
}

@media (max-width: 960px) {
    .eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-form-col,
    .eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-mixer-col {
        overflow-y: visible;
    }
}

/* =========================================================================
   AI MIXER — Calm Brushed-Slate Instrument Console (Studio Pill Motif)
   ========================================================================= */
.eg-mixer-card {
    background: linear-gradient(165deg, #eef2f7 0%, #e7edf5 58%, #e2e9f2 100%);
    border: 1px solid #cbd5e1;
    border-radius: 13px;
    padding: 10px 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #1e293b;
    box-shadow: 0 2px 12px -4px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.eg-mixer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.eg-mixer-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #1a3a5f;
    letter-spacing: 0.015em;
}

.eg-mixer-reset-btn {
    appearance: none;
    background: rgba(255, 255, 255, 0.72);
    color: #475569;
    border: 1px solid rgba(148, 163, 184, 0.36);
    border-radius: 8px;
    padding: 3px 9px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.eg-mixer-reset-btn:hover {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(100, 116, 139, 0.45);
    box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.10);
}

.eg-mixer-presets-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.055);
    border: 1px solid rgba(148, 163, 184, 0.32);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 0 rgba(255, 255, 255, 0.78);
}

.eg-mixer-preset-pill {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 5px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    line-height: 1.1;
    color: #475569;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: none;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.eg-mixer-preset-pill::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #94a3b8;
    opacity: 0.65;
    flex-shrink: 0;
    transition: background 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.eg-mixer-preset-pill:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.62);
    color: #0f172a;
}

.eg-mixer-preset-pill.is-active {
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.42);
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.12), 0 1px 2px rgba(15, 23, 42, 0.05), inset 0 1px 0 #ffffff;
}

.eg-mixer-preset-pill.is-active::before {
    background: #0284c7;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.18);
}

.eg-mixer-preset-pill:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.30);
}

.eg-seg-rows {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 2px 0;
}

/* CEFR Row — Full-width vertical liquid bars with Auto..C2 tags */
.eg-seg-row--cefr {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 7px 12px 17px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid rgba(148, 163, 184, 0.36);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.eg-cefr-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.eg-seg-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.67rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.15;
    white-space: nowrap;
}

.eg-seg-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    opacity: 0.85;
    flex-shrink: 0;
}

.eg-seg-hint {
    font-size: 0.76rem;
    font-weight: 600;
    color: #1a3a5f;
    text-align: right;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eg-cefr-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 2px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 0;
    touch-action: none;
    user-select: none;
    cursor: pointer;
}

.eg-cefr-bar .eg-seg-btn {
    position: relative;
    appearance: none;
    flex: 1 1 0;
    min-width: 0;
    height: 34px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 5px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
}

@keyframes eg-mixer-liquid-shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.06); }
}

.eg-vbar-tick {
    display: block;
    width: 8px;
    height: 22px;
    border-radius: 4px;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, rgba(226, 232, 240, 0.55) 100%);
    border: 1px solid rgba(148, 163, 184, 0.36);
    transition: height 0.18s cubic-bezier(0.22, 1, 0.36, 1), width 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.eg-cefr-bar .eg-seg-btn:hover .eg-vbar-tick {
    height: 26px;
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.22) 0%, rgba(59, 130, 246, 0.10) 100%);
    border-color: rgba(2, 132, 199, 0.45);
}

.eg-cefr-bar .eg-seg-btn.is-filled .eg-vbar-tick {
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.30) 0%, rgba(59, 130, 246, 0.12) 100%);
    border: 1px solid rgba(2, 132, 199, 0.40);
    border-top: 1.5px solid rgba(2, 132, 199, 0.68);
}

.eg-cefr-bar .eg-seg-btn.is-active .eg-vbar-tick {
    width: 10px;
    height: 30px;
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.52) 0%, rgba(59, 130, 246, 0.20) 100%);
    border: 1px solid rgba(2, 132, 199, 0.68);
    border-top: 2px solid rgba(56, 189, 248, 0.95);
    box-shadow: 0 3px 8px -2px rgba(2, 132, 199, 0.34);
}

.eg-cefr-bar .eg-seg-btn.is-auto-stop.is-active .eg-vbar-tick {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(226, 232, 240, 0.45) 100%);
    border: 1.5px dashed rgba(2, 132, 199, 0.72);
    box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.14);
}

.eg-vbar-tag {
    position: absolute;
    top: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.59rem;
    font-weight: 600;
    line-height: 1;
    color: #94a3b8;
    letter-spacing: 0.01em;
    white-space: nowrap;
    pointer-events: none;
    transition: color 0.14s ease;
}

.eg-cefr-bar .eg-seg-btn.is-filled .eg-vbar-tag {
    color: #475569;
}

.eg-cefr-bar .eg-seg-btn.is-active .eg-vbar-tag {
    color: #0369a1;
    font-weight: 700;
}

/* Architectural section divider between Target Level (CEFR) & Output Tuning */
.eg-mixer-section-sep {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 1px 2px -1px 2px;
}

.eg-mixer-section-sep::before,
.eg-mixer-section-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.28);
}

.eg-mixer-section-sep span {
    font-size: 0.59rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

/* Segmented discrete chooser inside mixer (e.g. Script Format) */
.eg-seg-row--choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 6px 4px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid rgba(148, 163, 184, 0.36);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.eg-choice-bar {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.055);
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.eg-choice-bar .eg-seg-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    font-size: 0.71rem;
    font-weight: 600;
    padding: 4px 9px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.eg-choice-bar .eg-seg-btn:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.65);
    color: #0f172a;
}

.eg-choice-bar .eg-seg-btn.is-active {
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.42);
    color: #1a3a5f;
    font-weight: 700;
    box-shadow: 0 1px 5px -1px rgba(15, 23, 42, 0.12), inset 0 1px 0 #ffffff;
}

/* Continuous Liquid Vessel Rows (Length, Complexity, Traps, Hints, Register) */
.eg-seg-row--liquid {
    display: block;
}

.eg-liquid-bar {
    position: relative;
    overflow: hidden;
    height: 39px;
    background: #ffffff;
    border: 1.5px solid rgba(148, 163, 184, 0.38);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
    touch-action: none;
    user-select: none;
    cursor: ew-resize;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.eg-liquid-bar:hover {
    border-color: rgba(2, 132, 199, 0.56);
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.12);
}

.eg-mixer-liquid {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.06) 0%, rgba(2, 132, 199, 0.20) 100%);
    border-right: 2px solid rgba(2, 132, 199, 0.52);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: width 0.38s cubic-bezier(0.22, 1, 0.36, 1), background 0.28s ease, border-color 0.28s ease, opacity 0.25s ease;
}

.eg-mixer-liquid::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -3px;
    width: 4px;
    height: 14px;
    border-radius: 999px;
    background: rgba(2, 132, 199, 0.72);
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.16s ease;
}

.eg-liquid-bar:hover .eg-mixer-liquid.has-liquid:not(.is-full)::after {
    opacity: 1;
}

.eg-mixer-ghost {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0%;
    background: rgba(2, 132, 199, 0.055);
    border-right: 1.5px dashed rgba(2, 132, 199, 0.55);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: width 0.16s ease, opacity 0.14s ease;
}

.eg-mixer-ghost.is-visible {
    opacity: 1;
}

.eg-seg-hint.is-preview {
    color: #0284c7;
    font-style: italic;
}

.eg-mixer-rigor-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    margin-right: 6px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: 1px;
    background: rgba(2, 132, 199, 0.10);
    border: 1px solid rgba(2, 132, 199, 0.26);
    color: #0369a1;
}

.eg-mixer-rigor-badge[data-rigor="gentle"] {
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.28);
    color: #047857;
}

.eg-mixer-rigor-badge[data-rigor="challenging"] {
    background: rgba(79, 70, 229, 0.10);
    border-color: rgba(79, 70, 229, 0.28);
    color: #4338ca;
}

.eg-mixer-rigor-badge[data-rigor="exam"] {
    background: rgba(217, 119, 6, 0.12);
    border-color: rgba(217, 119, 6, 0.34);
    color: #b45309;
}

.eg-mixer-liquid[data-depth="low"] {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.05) 0%, rgba(14, 165, 233, 0.15) 100%);
    border-right-color: rgba(14, 165, 233, 0.44);
}

.eg-mixer-liquid[data-depth="mid"] {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.07) 0%, rgba(2, 132, 199, 0.22) 100%);
    border-right-color: rgba(2, 132, 199, 0.56);
}

.eg-mixer-liquid[data-depth="high"] {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.10) 0%, rgba(2, 132, 199, 0.30) 100%);
    border-right-color: rgba(2, 132, 199, 0.72);
}

.eg-mixer-liquid.has-liquid {
    opacity: 1;
    animation: eg-mixer-liquid-shimmer 3s infinite ease-in-out;
}

.eg-mixer-liquid.is-full {
    border-right-color: transparent;
}

.eg-liquid-overlay {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
}

.eg-liquid-zones {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: stretch;
}

.eg-liquid-zones .eg-seg-btn {
    position: relative;
    appearance: none;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.14s ease;
}

.eg-liquid-zones .eg-seg-btn:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1px;
    height: 5px;
    background: rgba(100, 116, 139, 0.34);
    pointer-events: none;
}

.eg-liquid-zones .eg-seg-btn:hover {
    background: rgba(2, 132, 199, 0.05);
}

.eg-seg-btn:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(2, 132, 199, 0.38);
}

.eg-mixer-readout {
    margin-top: 1px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.30);
    border-radius: 9px;
    padding: 6px 9px;
    font-size: 0.74rem;
    color: #334155;
    line-height: 1.42;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.eg-mixer-readout strong {
    color: #1a3a5f;
    font-weight: 700;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 6px;
}

.eg-file-chip-view {
    font-size: 0.66rem;
    font-weight: 700;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* =========================================================================
   AI DRAFT KINETIC LOGO GENERATION OVERLAY (About EnGen Spatial-Glass Motif)
   ========================================================================= */
.eg-draft-loader-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(241, 245, 249, 0.72);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.eg-draft-loader-overlay.is-open {
    opacity: 1;
}

.eg-draft-loader-card {
    width: 100%;
    max-width: 390px;
    padding: 26px 28px 22px 28px;
    border-radius: 22px;
    box-sizing: border-box;
    text-align: center;
    background: linear-gradient(145deg, #ffffff 0%, #ffffff 58%, rgba(246, 251, 255, 0.97) 85%, rgba(244, 246, 255, 0.96) 100%);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 24px 56px -14px rgba(15, 23, 42, 0.20), 0 0 0 1px rgba(148, 163, 184, 0.24), inset 0 1px 0 #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    transform: translateY(8px) scale(0.97);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.eg-draft-loader-overlay.is-open .eg-draft-loader-card {
    transform: translateY(0) scale(1);
}

.eg-draft-loader-hero {
    position: relative;
    width: 210px;
    height: 210px;
    margin: 0 auto 6px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eg-draft-loader-emblem {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.72;
    pointer-events: none;
}

@keyframes egWorkflowRotorCW {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes egWorkflowRotorCCW {
    from { transform: rotate(360deg); }
    to   { transform: rotate(0deg); }
}

.eg-draft-loader-svg {
    width: 210px;
    height: 210px;
}

.eg-draft-loader-svg .eg-rotor-outer {
    transform-origin: 32px 32px;
    animation: egWorkflowRotorCW 14s linear infinite;
}

.eg-draft-loader-svg .eg-rotor-mid {
    transform-origin: 32px 32px;
    animation: egWorkflowRotorCCW 9s linear infinite;
}

.eg-draft-loader-svg .eg-rotor-core {
    transform-origin: 32px 32px;
    animation: egWorkflowRotorCW 6s linear infinite;
}

.eg-draft-loader-horizon {
    display: block;
    width: 100%;
    height: 1px;
    margin: 6px 0 5px 0;
    background: linear-gradient(90deg, transparent 0%, rgba(6, 182, 212, 0.72) 28%, rgba(245, 158, 11, 0.65) 72%, transparent 100%);
}

.eg-draft-loader-overlay.is-done .eg-draft-loader-svg .eg-rotor-outer,
.eg-draft-loader-overlay.is-done .eg-draft-loader-svg .eg-rotor-mid,
.eg-draft-loader-overlay.is-done .eg-draft-loader-svg .eg-rotor-core {
    animation-duration: 40s;
}

.eg-draft-loader-center {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 14px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.92) 45%, rgba(255, 255, 255, 0) 100%);
}

.eg-draft-loader-pct {
    font-size: 2.05rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(125deg, #0369a1 0%, #0284c7 58%, #b45309 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.eg-draft-loader-overlay.is-done .eg-draft-loader-pct {
    background: linear-gradient(125deg, #059669 0%, #10b981 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.eg-draft-loader-time {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
}

.eg-draft-loader-label {
    margin-top: 10px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    min-height: 24px;
}

.eg-draft-loader-stages {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.eg-draft-stage {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.71rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(241, 245, 249, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.24);
    transition: all 0.2s ease;
}

.eg-draft-stage-dot {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.eg-draft-stage.is-active {
    color: #0369a1;
    background: rgba(240, 249, 255, 0.95);
    border-color: rgba(2, 132, 199, 0.36);
    box-shadow: 0 2px 6px -2px rgba(2, 132, 199, 0.20);
}

.eg-draft-stage.is-active .eg-draft-stage-dot {
    background: #0284c7;
    box-shadow: 0 0 0 2.5px rgba(2, 132, 199, 0.22);
}

.eg-draft-stage.is-done {
    color: #047857;
    background: rgba(236, 253, 245, 0.92);
    border-color: rgba(16, 185, 129, 0.34);
}

.eg-draft-stage.is-done .eg-draft-stage-dot {
    background: #10b981;
}

.eg-draft-loader-cancel {
    margin-top: 16px;
    appearance: none;
    background: transparent;
    color: #64748b;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 8px;
    padding: 5px 16px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.eg-draft-loader-cancel:hover {
    background: rgba(241, 245, 249, 0.9);
    color: #0f172a;
    border-color: rgba(100, 116, 139, 0.45);
}

/* === MOBILE AI DRAFT, ASK AI & MIXER SHEET (<= 768px ONLY — DESKTOP UNTOUCHED) === */
@media (max-width: 768px) {
    .eg-modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }
    .eg-modal-shell {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
    }
    .eg-modal-header {
        padding: 12px 14px !important;
        gap: 8px !important;
    }
    .eg-modal-title {
        font-size: 0.96rem !important;
    }
    .eg-modal-sub {
        font-size: 0.72rem !important;
    }
    .eg-modal-body,
    .eg-modal-shell.eg-modal-shell--source-workspace .eg-modal-body {
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 12px 12px 18px !important;
        gap: 12px !important;
    }
    .eg-modal-form-col,
    .eg-modal-mixer-col {
        width: 100% !important;
        min-width: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
    }
    /* Context bar (Class / Title) */
    .eg-context-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 8px 10px !important;
    }
    .eg-context-group {
        min-width: 0 !important;
        width: 100% !important;
        flex: 1 1 auto !important;
    }
    /* Step 1 Foundation: stack Topic + Read & Listen button */
    .eg-step-1 > div > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 7px !important;
    }
    /* Step 2 Attachments: stack File drop + URL input */
    .eg-attach-grid {
        grid-template-columns: 1fr !important;
        gap: 7px !important;
    }
    /* Step 3 Test Modes: comfortable 2-column grid on mobile */
    #ai-builder-modes-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }
    #ai-builder-modes-grid .ai-mode-pill {
        padding: 8px 9px !important;
        font-size: 0.82rem !important;
    }
    /* Ask AI Type Grid & Translation Language Bar */
    #ask-ai-type-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    #ai-builder-translate-lang-bar,
    #ask-ai-translate-lang-wrap {
        gap: 6px !important;
        padding: 8px !important;
    }
    #ai-builder-translate-lang-bar select,
    #ask-ai-translate-lang-wrap select {
        min-width: 0 !important;
        flex: 1 1 110px !important;
        height: 36px !important;
    }
    /* Prevent iOS Safari auto-zoom on form fields */
    .eg-modal-shell input[type="text"],
    .eg-modal-shell input[type="number"],
    .eg-modal-shell input[type="url"],
    .eg-modal-shell select,
    .eg-modal-shell textarea {
        font-size: 16px !important;
    }
    /* AI Mixer: comfortable touch targets */
    .eg-mixer-card {
        padding: 12px !important;
        gap: 8px !important;
    }
    .eg-mixer-presets {
        flex-wrap: wrap !important;
        gap: 5px !important;
    }
    .eg-mixer-preset-btn {
        padding: 6px 10px !important;
        font-size: 0.76rem !important;
    }
    .eg-cefr-bar-btn {
        min-height: 44px !important;
    }
    .eg-seg-bar {
        min-height: 36px !important;
    }
    /* Sticky bottom action footer */
    .eg-modal-footer {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
    }
    .eg-footer-hint {
        display: none !important;
    }
    .eg-modal-footer .eg-footer-actions,
    .eg-modal-footer > div:last-child {
        width: 100% !important;
        display: flex !important;
        justify-content: flex-end !important;
        gap: 8px !important;
    }
    .eg-btn-primary,
    .eg-btn-secondary,
    .eg-btn-blue {
        padding: 10px 14px !important;
        font-size: 0.86rem !important;
        min-height: 40px !important;
    }
    /* Kinetic loader compact on phone */
    .eg-draft-loader-card {
        width: calc(100vw - 28px) !important;
        padding: 20px 16px !important;
    }
}
