.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 24, 0.54);
    backdrop-filter: blur(12px) saturate(90%);
    -webkit-backdrop-filter: blur(12px) saturate(90%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
    padding: 24px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-container {
    position: relative;
    width: min(620px, 100%);
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(215,91,63,.10);
    border-radius: 24px;
    box-shadow: 0 28px 90px rgba(16,24,40,.28), 0 2px 8px rgba(16,24,40,.08);
    transform: translateY(12px) scale(.975);
    transition: transform .26s cubic-bezier(.2,.85,.3,1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}
.modal-overlay.active .modal-container { transform: translateY(0) scale(1); }
.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8b8f98;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 17px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    z-index: 10;
}
.modal-close:hover { background: #f0f2f5; color: #1c2433; transform: rotate(3deg); }
.modal-header {
    padding: 30px 34px 10px;
    border: 0;
}
.modal-header h2 {
    margin: 0;
    color: #182033;
    font-size: 25px;
    line-height: 1.2;
    font-weight: 650;
    letter-spacing: -.35px;
    font-family: inherit;
}
.modal-body { padding: 0 34px 28px; }
.install-intro p {
    margin: 0 0 24px;
    color: #6f7480;
    font-size: 14px;
    line-height: 1.5;
}
.steps-container { display: grid; gap: 13px; }
.install-step {
    display: grid;
    grid-template-columns: 28px minmax(0,1fr);
    gap: 13px;
    align-items: start;
}
.install-step-compact {
    padding: 15px 16px;
    background: #f8f8f6;
    border: 1px solid #ebeae5;
    border-radius: 15px;
}
.install-step-primary {
    padding: 18px 16px 16px;
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 17px;
    box-shadow: 0 4px 18px rgba(215,91,63,.045);
}
.step-kicker {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #D75B3F;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    margin-top: 1px;
}
.step-content { min-width: 0; }
.step-title {
    margin: 2px 0 6px;
    color: #1d2535;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 650;
}
.step-desc {
    margin: 0;
    color: #737782;
    font-size: 13.5px;
    line-height: 1.55;
}
.compact-desc { margin-bottom: 0; }
.step-desc kbd {
    display: inline-block;
    min-width: 24px;
    padding: 1px 7px;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-bottom-color: #cfd2d8;
    border-radius: 6px;
    color: #5d6470;
    font: 12px/1.55 "SF Mono", ui-monospace, Menlo, monospace;
    text-align: center;
    box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.step-desc code {
    padding: 2px 7px;
    background: #f4f1f5;
    border-radius: 6px;
    color: #b72d69;
    font: 12px/1.5 "SF Mono", ui-monospace, Menlo, monospace;
}
.command-wrapper {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 7px 7px 7px 14px;
    background: #f6f7f8;
    border: 1px solid #dfe3e8;
    border-radius: 13px;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    outline: none;
}
.command-wrapper:hover,
.command-wrapper:focus-visible {
    border-color: rgba(215,91,63,.42);
    box-shadow: 0 0 0 3px rgba(215,91,63,.07);
}
.command-wrapper.is-copied {
    background: #f2f7f3;
    border-color: #a9c9b1;
    box-shadow: 0 0 0 3px rgba(65,135,82,.08);
}
.command-code {
    min-width: 0;
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: transparent;
    color: #28384f;
    font: 12.5px/1.55 "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    user-select: none;
}
.copy-btn {
    align-self: center;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid rgba(215,91,63,.08);
    border-radius: 10px;
    background: #e9edf2;
    color: #344156;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font: 600 12.5px/1 inherit;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.copy-btn:hover { background: #dde4ec; color: #D75B3F; transform: translateY(-1px); }
.command-hint {
    margin-top: 9px;
    color: #858991;
    font-size: 12px;
    line-height: 1.45;
}
.modal-footer {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #ecece8;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: #777c85;
    font-size: 12px;
}
.footer-check { color: #526174; }
.footer-check i { margin-right: 5px; color: #D75B3F; }
.footer-dot { color: #b8bbc0; }
.modal-loading, .modal-error { text-align: center; padding: 42px 20px; }
.loading-spinner {
    width: 30px;
    height: 30px;
    margin: 0 auto 14px;
    border: 3px solid #e6e9ed;
    border-top-color: #D75B3F;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.modal-loading p { margin: 0; color: #747983; font-size: 13px; }
.modal-error p { margin: 14px 0; color: #b42318; }
.btn-retry {
    border: 0;
    border-radius: 10px;
    padding: 9px 16px;
    background: #D75B3F;
    color: #fff;
    cursor: pointer;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
    .modal-overlay { padding: 14px; align-items: flex-end; }
    .modal-container { border-radius: 22px 22px 18px 18px; }
    .modal-header { padding: 24px 22px 8px; }
    .modal-header h2 { font-size: 22px; }
    .modal-body { padding: 0 22px 22px; }
    .install-intro p { margin-bottom: 18px; }
    .install-step { grid-template-columns: 26px minmax(0,1fr); gap: 10px; }
    .install-step-compact, .install-step-primary { padding: 14px 13px; }
    .command-wrapper { grid-template-columns: 1fr; padding: 12px; }
    .copy-btn { width: 100%; }
}

dialog.modal-container {
    padding: 0;
    margin: auto;
    max-width: calc(100vw - 48px);
    max-height: calc(100dvh - 48px);
    overflow: auto;
    transform: none;
    color: #182033;
}
dialog::backdrop {
    background: rgba(15,18,24,.54);
    backdrop-filter: blur(12px) saturate(90%);
    -webkit-backdrop-filter: blur(12px) saturate(90%);
}
.command-code, .legal pre.command {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    text-overflow: clip;
    user-select: text;
}
.command-wrapper {cursor: auto;}
@media (max-width: 600px) {
    dialog.modal-container {margin: auto auto 14px; max-width: calc(100vw - 28px);}
}


.install-intro [data-state]:empty { display: none; }
.install-email-frame { display: block; width: 100%; height: 12rem; border: 0; }
.install-email-page { margin: 0; color: #182033; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.install-email { display: grid; gap: .45rem; max-width: 34rem; }
.install-email label { font-weight: 600; }
.install-email input[type=email] { box-sizing: border-box; width: 100%; padding: .6rem .75rem; border: 1px solid #bec3ca; border-radius: .6rem; font: inherit; }
.install-email p { margin: 0; color: #5e646d; font-size: .85rem; }
.install-email .copy-btn { justify-self: start; width: auto; margin: .35rem 0; }

.install-icon { flex: 0 0 auto; width: 1em; height: 1em; vertical-align: -.13em; }
.footer-check .install-icon { margin-right: 5px; color: #d75b3f; }
.command-hint[data-feedback]:empty { display: none; }
.modal-close .install-icon { width: 17px; height: 17px; }
.modal-body [data-retry] { margin-bottom: 12px; }
.modal-body [data-state].is-loading::before {
    content: ""; display: block; box-sizing: border-box; width: 30px; height: 30px; margin: 0 auto 14px;
    border: 3px solid #e6e9ed; border-top-color: #d75b3f; border-radius: 50%; animation: spin .8s linear infinite;
}
.modal-body [data-state].is-loading { text-align: center; padding: 35px 20px; }
@media (prefers-reduced-motion: reduce) { .modal-body [data-state].is-loading::before { animation: none; } }
