:root {
    color-scheme: dark;
    --page-bg: #020705;
    --panel: #061008;
    --surface: #09150d;
    --surface-raised: #0e1c12;
    --surface-deep: #010703;
    --text: #fffdf2;
    --muted: #aab7ad;
    --line: #24412f;
    --line-soft: rgba(79, 168, 115, .22);
    --accent: #60da25;
    --accent-dark: #2f7d52;
    --accent-soft: rgba(96, 218, 37, .12);
    --gold: #cea956;
    --success: #60da25;
    --warning: #cea956;
    --danger: #d76868;
    --info: #82b79a;
    --radius-lg: 24px;
    --radius-md: 15px;
    --radius-sm: 10px;
    --shadow: 0 28px 90px rgba(0, 0, 0, .52);
    --content-pad: clamp(22px, 3vw, 34px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page-bg); }
body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(rgba(2, 7, 5, .88), rgba(2, 7, 5, .96)),
        url('../../assets/brand/hero-banner.png') center / cover fixed,
        var(--page-bg);
    color: var(--text);
    font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
code, pre { font-family: "Cascadia Code", Consolas, monospace; text-transform: none; }
code { overflow-wrap: anywhere; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.02; letter-spacing: -.04em; }
h2 { margin-bottom: 10px; font-size: clamp(1.3rem, 2vw, 1.65rem); line-height: 1.15; }
h3 { margin-bottom: 8px; font-size: 1.1rem; }
p { color: var(--muted); }

.installer-shell {
    min-height: 100vh;
    width: 100%;
    padding: clamp(20px, 4vw, 48px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.installer-card {
    width: min(1040px, 100%);
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: rgba(6, 16, 8, .97);
    box-shadow: var(--shadow);
}

.installer-head {
    padding: 28px var(--content-pad) 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "brand progress"
        "title progress";
    align-items: end;
    gap: 18px 28px;
}

.brand-row {
    grid-area: brand;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}
.brand-row img {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    object-fit: contain;
}
.brand-row > div { min-width: 0; display: grid; line-height: 1.18; }
.brand-row strong { font-size: 1.02rem; color: var(--text); }
.brand-row small { color: var(--muted); font-size: .78rem; }

.installer-head > div:not(.brand-row) { grid-area: title; min-width: 0; }
.eyebrow {
    margin-bottom: 7px;
    color: var(--gold);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.progress-count {
    grid-area: progress;
    min-width: 64px;
    padding: 9px 12px;
    align-self: end;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--accent);
    font-weight: 900;
    text-align: center;
}

.progress-track {
    height: 6px;
    margin: 0 var(--content-pad);
    overflow: hidden;
    border: 1px solid rgba(96, 218, 37, .08);
    border-radius: 999px;
    background: var(--surface-deep);
}
.progress-track span {
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent));
}

.step-list {
    margin: 0;
    padding: 20px var(--content-pad) 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 7px;
    list-style: none;
}
.step-list li {
    min-width: 0;
    min-height: 42px;
    padding: 8px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
}
.step-list li > span {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface-raised);
    color: var(--muted);
    font-size: .7rem;
    font-weight: 900;
}
.step-list li.active {
    border-color: rgba(96, 218, 37, .26);
    background: var(--accent-soft);
    color: var(--text);
}
.step-list li.active > span,
.step-list li.done > span {
    border-color: var(--accent);
    background: var(--accent);
    color: #061008;
}
.step-list li.done { color: var(--text); }

.installer-messages {
    padding: 20px var(--content-pad) 0;
    display: grid;
    gap: 10px;
}
.installer-content {
    padding: 30px var(--content-pad) 34px;
}
.installer-content > :last-child { margin-bottom: 0; }
.lead {
    max-width: 780px;
    margin-bottom: 26px;
    font-size: .98rem;
}

.notice {
    margin: 0;
    padding: 13px 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-raised);
}
.installer-content .notice { margin: 18px 0; }
.notice strong { color: var(--text); }
.notice span { color: var(--muted); }
.notice.error { border-color: rgba(215, 104, 104, .58); background: rgba(74, 20, 20, .32); }
.notice.success { border-color: rgba(96, 218, 37, .42); background: rgba(27, 71, 20, .25); }
.notice.info { border-color: rgba(130, 183, 154, .45); }
.notice.warning { border-color: rgba(206, 169, 86, .5); background: rgba(78, 55, 16, .3); }

.check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 26px 0;
}
.check-row {
    min-width: 0;
    min-height: 62px;
    padding: 15px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
}
.check-row > span:first-child {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 900;
}
.check-row strong { min-width: 0; line-height: 1.3; }
.check-row.pass > span:first-child { background: var(--accent); color: #061008; }
.check-row.fail { border-color: rgba(215, 104, 104, .6); }
.check-row.fail > span:first-child { background: #9b3e3e; color: #fff; }

.summary-grid {
    margin: 24px 0 28px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.summary-grid > div {
    min-width: 0;
    min-height: 82px;
    padding: 15px 16px;
    display: grid;
    align-content: start;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
}
.summary-grid strong { color: var(--text); }
.summary-grid span,
.summary-grid code { color: #d7e3d9; overflow-wrap: anywhere; }

.form-stack { display: grid; gap: 16px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.form-grid .full { grid-column: 1 / -1; }
label > span {
    display: block;
    margin-bottom: 7px;
    color: #dce6de;
    font-size: .82rem;
    font-weight: 800;
}
label small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: .74rem;
}
input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    outline: 0;
    background: var(--surface-raised);
}
input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(96, 218, 37, .12);
}
.check-label {
    display: flex !important;
    align-items: center;
    gap: 11px;
}
.check-label input { width: 18px !important; min-height: 18px; accent-color: var(--accent); }
.check-label span { margin: 0; }

.actions {
    margin-top: 28px;
    padding-top: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line-soft);
}
.actions.end { justify-content: flex-end; }
.button {
    min-height: 43px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #061008;
    font-weight: 900;
    cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button.secondary { border-color: var(--line); background: var(--surface-raised); color: var(--text); }
.button[disabled] { opacity: .48; cursor: not-allowed; }

.instruction-card {
    margin-top: 26px;
    padding: 24px;
    border: 1px solid rgba(96, 218, 37, .36);
    border-radius: var(--radius-md);
    background: var(--surface);
}
.instruction-card ol { margin: 16px 0 20px; padding-left: 22px; color: var(--muted); line-height: 1.8; }
.instruction-card .actions { margin-top: 18px; padding-top: 0; border-top: 0; }
.command-box {
    padding: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-deep);
}
.command-box code { flex: 1; color: #bfffa5; overflow-wrap: anywhere; }
.command-box button {
    min-height: 38px;
    padding: 8px 12px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: #061008;
    font-weight: 900;
    cursor: pointer;
}

.library-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.library-choice {
    min-height: 72px;
    padding: 15px !important;
    display: flex !important;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    cursor: pointer;
}
.library-choice:hover { border-color: var(--accent); }
.library-choice input { width: 18px !important; height: 18px; flex: 0 0 auto; accent-color: var(--accent); }
.library-choice span { display: grid; gap: 2px; }
.library-choice strong { color: var(--text); }
.library-choice small { color: var(--muted); text-transform: capitalize; }

.install-progress {
    margin: 26px 0;
    padding: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}
.install-progress-track {
    grid-column: 1 / -1;
    height: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-deep);
}
.install-progress-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent));
    transition: width .35s ease;
}
.install-progress strong { color: var(--text); }
.install-progress span { color: #bfffa5; font-weight: 900; }
.notice[data-install-progress-error] { display: grid; gap: 10px; }
.notice[data-install-progress-error] .button { justify-self: start; }

.error-card,
.completion-card { width: min(760px, 100%); }
.installer-message-content { padding: 38px var(--content-pad); }
.error-details { display: grid; gap: 10px; }
.error-details > div {
    padding: 13px 15px;
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}
.error-details dt { color: var(--muted); }
.error-details dd { min-width: 0; margin: 0; }

.working-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    padding: 24px;
    display: grid;
    place-items: center;
    background: rgba(2, 7, 5, .86);
    backdrop-filter: blur(7px);
}
.working-panel {
    width: min(380px, 100%);
    padding: 24px;
    display: grid;
    justify-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    box-shadow: var(--shadow);
    text-align: center;
}
.working-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: installer-spin .7s linear infinite;
}
.working-message { font-weight: 900; }
.working-time,
.working-help { color: var(--muted); font-size: .78rem; }
.working-help { min-height: 1.2em; }
@keyframes installer-spin { to { transform: rotate(360deg); } }

@media (max-width: 940px) {
    .step-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    :root { --content-pad: 20px; }
    .installer-shell { padding: 12px; align-items: flex-start; }
    .installer-card { margin-top: 8px; border-radius: 18px; }
    .installer-head {
        padding-top: 22px;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand progress"
            "title title";
        align-items: center;
        gap: 16px;
    }
    .brand-row img { width: 48px; height: 48px; flex-basis: 48px; }
    .progress-count { min-width: 58px; padding: 8px 10px; }
    .step-list {
        padding-top: 16px;
        display: flex;
        overflow-x: auto;
        gap: 8px;
        scrollbar-width: thin;
    }
    .step-list li { min-width: 116px; }
    .installer-content { padding-top: 26px; padding-bottom: 28px; }
    .form-grid,
    .check-grid,
    .summary-grid { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: auto; }
    .actions { align-items: stretch; flex-direction: column-reverse; }
    .actions.end { align-items: stretch; }
    .button { width: 100%; }
    .command-box { flex-direction: column; }
    .command-box button { width: 100%; }
    .notice { display: grid; gap: 4px; }
}

@media (max-width: 420px) {
    :root { --content-pad: 16px; }
    .installer-shell { padding: 8px; }
    .installer-head { padding-top: 18px; }
    .brand-row strong { font-size: .94rem; }
    .brand-row small { font-size: .7rem; }
    h1 { font-size: 2rem; }
    .check-row,
    .summary-grid > div { min-height: 0; }
}
