:root {
    color-scheme: light;
    --forest: #173f35;
    --forest-deep: #102b24;
    --forest-light: #245846;
    --green: #2f6b57;
    --green-soft: #e6efe9;
    --cream: #f5f1e7;
    --cream-deep: #ebe4d4;
    --paper: #fffdf8;
    --surface: #fbf8f0;
    --surface-muted: #f4f0e5;
    --ink: #1d2b27;
    --ink-soft: #35443e;
    --muted: #718078;
    --muted-light: #9aa49d;
    --line: #ded8ca;
    --line-soft: #ebe5d8;
    --gold: #c29a44;
    --gold-soft: #f5edda;
    --coral: #b96f57;
    --coral-soft: #f8e9e3;
    --blue: #4d7189;
    --blue-soft: #eaf0f3;
    --danger: #a45342;
    --danger-soft: #f7e9e4;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-serif: Georgia, "Songti SC", "STSong", "SimSun", serif;
    --shadow: 0 28px 80px rgba(35, 45, 39, .12);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    background:
        radial-gradient(circle at 14% 18%, rgba(194, 154, 68, .08), transparent 30%),
        radial-gradient(circle at 88% 82%, rgba(47, 107, 87, .08), transparent 34%),
        var(--cream);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.spinner {
    width: 13px;
    height: 13px;
    display: inline-block;
    border: 1.6px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: installSpin .7s linear infinite;
}

@keyframes installSpin { to { transform: rotate(360deg); } }

.check-row.is-off { opacity: .62; }
.password-toggle.is-on { color: var(--green); }

.icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: inline-block;
    vertical-align: middle;
    flex: none;
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.install-shell {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   左侧导航
   -------------------------------------------------------------------------- */
.install-rail {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 34px 32px 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 8%, rgba(215, 166, 75, .15), transparent 27%),
        linear-gradient(155deg, #1b4a3d 0%, #143a30 55%, #102e26 100%);
    color: #f2ecdd;
}

.install-rail:before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .045) .7px, transparent .7px);
    background-size: 4px 4px;
    opacity: .55;
    pointer-events: none;
}

.install-rail:after {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    right: -180px;
    bottom: 70px;
    border: 1px solid rgba(238, 226, 198, .12);
    border-radius: 50%;
    box-shadow: 0 0 0 38px rgba(238, 226, 198, .035), 0 0 0 78px rgba(238, 226, 198, .022);
    pointer-events: none;
}

.install-rail > * { position: relative; z-index: 1; }

.install-brand { display: flex; align-items: center; gap: 11px; }

.install-brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #f7f0df, #e8ddc4);
    color: var(--forest);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}

.install-brand-mark svg { width: 30px; height: 30px; display: block; }

.install-brand-copy { display: flex; flex-direction: column; line-height: 1.3; }
.install-brand-copy strong { font-family: var(--font-serif); font-size: 17px; font-weight: 600; letter-spacing: .045em; }
.install-brand-copy small { margin-top: 2px; color: rgba(231, 224, 203, .42); font-size: 8px; letter-spacing: .2em; }

.rail-kicker {
    margin: 58px 0 12px;
    color: var(--gold);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .2em;
}

.install-rail h1 {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(23px, 2.3vw, 29px);
    font-weight: 600;
    line-height: 1.55;
    letter-spacing: .01em;
}

.rail-desc {
    margin: 14px 0 0;
    color: rgba(229, 223, 205, .52);
    font-size: 10.5px;
    line-height: 1.9;
}

.install-steps {
    list-style: none;
    margin: 42px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.install-step {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 10px;
    color: rgba(230, 224, 207, .38);
    font-size: 10.5px;
    transition: background .18s, color .18s;
}

.install-step.is-current { background: rgba(255, 255, 255, .075); color: #f7f0df; }
.install-step.is-done { color: rgba(231, 225, 208, .65); }

.step-number {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(230, 224, 207, .22);
    border-radius: 50%;
    font-size: 8.5px;
    font-weight: 600;
    flex: none;
}

.install-step.is-current .step-number { border-color: var(--gold); background: var(--gold); color: var(--forest-deep); }
.install-step.is-done .step-number { border-color: rgba(215, 166, 75, .35); color: var(--gold); background: transparent; }
.step-number .icon { width: 10px; height: 10px; stroke-width: 2.4; }
.step-label { letter-spacing: .04em; }

.rail-foot {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(217, 211, 194, .25);
    font-size: 8px;
    letter-spacing: .08em;
}

.rail-dot { width: 2px; height: 2px; border-radius: 50%; background: currentColor; }

/* --------------------------------------------------------------------------
   右侧内容
   -------------------------------------------------------------------------- */
.install-main {
    min-width: 0;
    padding: 42px clamp(24px, 5vw, 72px) 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.install-card {
    width: min(720px, 100%);
    padding: clamp(28px, 4vw, 46px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    box-shadow: var(--shadow);
    animation: cardIn .4s cubic-bezier(.22, .8, .32, 1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.install-kicker {
    margin: 0 0 10px;
    color: var(--gold);
    font-size: 8.5px;
    font-weight: 650;
    letter-spacing: .22em;
}

.install-card h2 {
    margin: 0 0 9px;
    font-family: var(--font-serif);
    font-size: clamp(23px, 2.4vw, 30px);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .01em;
}

.install-lead {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.85;
}

.install-foot {
    width: min(720px, 100%);
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted-light);
    font-size: 8px;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   提示
   -------------------------------------------------------------------------- */
.install-alert {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 10px;
    line-height: 1.7;
}

.install-alert > .icon { width: 15px; height: 15px; margin-top: 1px; }
.install-alert p { margin: 0; }
.install-alert + .install-alert { margin-top: -8px; }
.install-alert--error { border-color: #edcfc6; background: var(--danger-soft); color: #8d4a3b; }
.install-alert--warning { border-color: #ead9b5; background: var(--gold-soft); color: #876725; }
.install-alert--success { border-color: #cfe0d5; background: var(--green-soft); color: var(--green); }
.install-alert--info { border-color: #d6e1e7; background: var(--blue-soft); color: #45667b; }
.install-alert details { margin-top: 6px; }
.install-alert summary { cursor: pointer; font-size: 9px; opacity: .72; }
.install-alert pre {
    max-height: 160px;
    overflow: auto;
    margin: 6px 0 0;
    padding: 8px 10px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .5);
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 8.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* --------------------------------------------------------------------------
   环境检查
   -------------------------------------------------------------------------- */
.env-list {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    border-top: 1px solid var(--line-soft);
}

.env-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--line-soft);
}

.env-status {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    flex: none;
    background: var(--surface-muted);
    color: var(--muted-light);
}

.env-status .icon { width: 12px; height: 12px; stroke-width: 2.1; }
.env-item.is-ok .env-status { background: var(--green-soft); color: var(--green); }
.env-item.is-bad .env-status { background: var(--danger-soft); color: var(--danger); }
.env-item.is-optional .env-status { background: var(--gold-soft); color: var(--gold); }

.env-label { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.env-label strong { color: var(--ink-soft); font-size: 10.5px; font-weight: 550; }
.env-label small { color: var(--muted-light); font-size: 8.5px; line-height: 1.55; }
.env-value { flex: none; color: var(--muted); font-size: 9px; letter-spacing: .02em; }
.env-item.is-ok .env-value { color: var(--green); }
.env-item.is-bad .env-value { color: var(--danger); }

/* --------------------------------------------------------------------------
   表单
   -------------------------------------------------------------------------- */
.install-form { display: flex; flex-direction: column; }

.install-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.install-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.install-field--wide { grid-column: 1 / -1; }
.install-field label { color: var(--ink-soft); font-size: 10px; font-weight: 550; letter-spacing: .02em; }
.install-field label small { color: var(--muted-light); font-weight: 400; margin-left: 4px; }

.field-input {
    width: 100%;
    min-height: 43px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font-size: 11.5px;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}

.field-input::placeholder { color: #b3b6ad; }
.field-input:hover { border-color: #cfc7b7; }
.field-input:focus {
    border-color: color-mix(in srgb, var(--green) 55%, var(--line));
    background: var(--paper);
    box-shadow: 0 0 0 3px rgba(47, 107, 87, .08);
}

select.field-input {
    appearance: none;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.field-hint { margin: 0; color: var(--muted-light); font-size: 8.5px; line-height: 1.6; }

.password-wrap { position: relative; }
.password-wrap .field-input { padding-right: 44px; }

.password-toggle {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 33px;
    height: 33px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted-light);
}

.password-toggle:hover { color: var(--green); background: var(--surface-muted); }
.password-toggle .icon { width: 15px; height: 15px; }

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 15px;
    padding: 11px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .18s, background .18s;
}

.check-row:hover { border-color: var(--line); background: var(--surface-muted); }
.check-row input { margin: 3px 0 0; width: 14px; height: 14px; accent-color: var(--green); flex: none; }
.check-row span { display: flex; flex-direction: column; gap: 1px; }
.check-row strong { color: var(--ink-soft); font-size: 10px; font-weight: 550; }
.check-row small { color: var(--muted-light); font-size: 8.5px; line-height: 1.55; }

.install-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

.install-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted-light);
    font-size: 8.5px;
    line-height: 1.5;
}

.install-hint .icon { width: 12px; height: 12px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 550;
    letter-spacing: .02em;
    white-space: nowrap;
    transition: background .18s, border-color .18s, box-shadow .18s, transform .18s;
}

.btn .icon { width: 13px; height: 13px; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.btn--primary {
    background: var(--forest);
    color: #f8f3e8;
    box-shadow: 0 7px 18px rgba(23, 63, 53, .16);
}

.btn--primary:hover:not([disabled]) { background: var(--forest-light); box-shadow: 0 9px 24px rgba(23, 63, 53, .22); }

.btn--ghost {
    border-color: var(--line);
    background: transparent;
    color: var(--muted);
}

.btn--ghost:hover { border-color: #cfc7b7; background: var(--surface-muted); color: var(--ink); }

.text-link {
    color: var(--muted);
    font-size: 9px;
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-underline-offset: 3px;
}

.text-link:hover { color: var(--green); }

/* --------------------------------------------------------------------------
   数据库选择
   -------------------------------------------------------------------------- */
.driver-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.driver-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .18s, background .18s, box-shadow .18s;
}

.driver-card:hover { border-color: #cfc7b7; background: var(--surface-muted); }
.driver-card input { position: absolute; opacity: 0; pointer-events: none; }
.driver-card:has(input:checked) {
    border-color: color-mix(in srgb, var(--green) 42%, var(--line));
    background: color-mix(in srgb, var(--green-soft) 48%, var(--paper));
    box-shadow: 0 0 0 2px rgba(47, 107, 87, .06);
}

.driver-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--muted);
    flex: none;
}

.driver-card:has(input:checked) .driver-icon { background: var(--green); color: #f8f3e8; }
.driver-icon .icon { width: 16px; height: 16px; }
.driver-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.driver-copy strong { font-family: var(--font-serif); font-size: 13px; font-weight: 600; }
.driver-copy small { color: var(--muted-light); font-size: 8px; line-height: 1.55; }

.driver-check {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 15px;
    height: 15px;
    display: none;
    place-items: center;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
}

.driver-check .icon { width: 9px; height: 9px; stroke-width: 2.6; }
.driver-card:has(input:checked) .driver-check { display: grid; }

.db-panel[hidden] { display: none; }

.install-sep {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 25px 0 17px;
    color: var(--muted-light);
    font-size: 8px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.install-sep:before, .install-sep:after { content: ""; height: 1px; flex: 1; background: var(--line-soft); }

.install-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0;
    padding: 13px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: var(--surface);
    color: var(--muted);
    font-size: 9px;
    line-height: 1.75;
}

.install-note > .icon { width: 15px; height: 15px; color: var(--gold); margin-top: 1px; }
.install-note strong { display: block; color: var(--ink-soft); font-size: 10px; font-weight: 550; margin-bottom: 2px; }
.install-note p { margin: 0; }
.install-note code, .install-card code {
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--surface-muted);
    color: var(--ink-soft);
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: .9em;
    word-break: break-all;
}

.db-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 22px;
    padding: 11px 13px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: var(--surface);
}

.db-summary-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green);
    flex: none;
}

.db-summary-icon .icon { width: 14px; height: 14px; }
.db-summary div { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.db-summary strong { font-size: 9.5px; font-weight: 550; color: var(--ink-soft); }
.db-summary small { color: var(--muted-light); font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   成功页
   -------------------------------------------------------------------------- */
.install-success { text-align: center; padding: 4px 0 2px; }

.success-mark {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--green-soft) 52%, transparent);
}

.success-mark .icon { width: 30px; height: 30px; stroke-width: 2; }
.install-success h2 { margin-bottom: 11px; }
.install-success > p:not(.install-kicker) { max-width: 460px; margin: 0 auto 23px; color: var(--muted); font-size: 10.5px; line-height: 1.85; }

.success-actions { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 22px 0 25px; }
.success-actions .btn { min-height: 44px; }

.success-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin: 22px 0;
    padding: 1px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: var(--line-soft);
    text-align: left;
    overflow: hidden;
}

.success-facts > div { padding: 11px 13px; background: var(--surface); }
.success-facts dt { color: var(--muted-light); font-size: 7.5px; letter-spacing: .08em; text-transform: uppercase; }
.success-facts dd { margin: 2px 0 0; color: var(--ink-soft); font-size: 10px; font-weight: 500; word-break: break-all; }

.install-success .install-note { margin-top: 8px; text-align: left; }

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .install-shell { grid-template-columns: 1fr; }
    .install-rail { padding: 24px 24px 20px; }
    .install-rail h1 { font-size: 23px; }
    .rail-kicker { margin-top: 28px; }
    .rail-desc { max-width: 520px; }
    .install-steps { flex-direction: row; flex-wrap: wrap; margin-top: 22px; gap: 5px; }
    .install-step { flex: 1 1 145px; padding: 7px 8px; }
    .rail-foot { display: none; }
    .install-main { padding: 26px 18px 20px; justify-content: flex-start; }
    .install-card { border-radius: 18px; }
}

@media (max-width: 640px) {
    .install-rail { padding: 20px 18px 18px; }
    .install-brand-mark { width: 34px; height: 34px; border-radius: 10px; }
    .install-brand-mark svg { width: 26px; height: 26px; }
    .install-rail h1 { font-size: 21px; }
    .rail-desc { display: none; }
    .install-steps { margin-top: 18px; }
    .install-step { flex: 1 1 100%; }
    .install-card { padding: 23px 18px; }
    .install-grid, .driver-grid, .success-facts { grid-template-columns: 1fr; }
    .install-field--wide { grid-column: auto; }
    .install-actions { flex-direction: column-reverse; align-items: stretch; }
    .install-actions .btn { width: 100%; }
    .install-hint { justify-content: center; text-align: center; }
    .success-actions { flex-direction: column; }
    .success-actions .btn { width: 100%; }
    .install-foot { flex-direction: column; gap: 4px; }
    .env-value { max-width: 90px; text-align: right; overflow-wrap: anywhere; }
}
