:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #18212f;
    --muted: #637083;
    --border: #dce2e9;
    --primary: #1f5d8f;
    --primary-hover: #174b75;
    --success: #157347;
    --success-soft: #edf8f2;
    --warning: #8a5a09;
    --warning-soft: #fff8e8;
    --danger: #b42318;
    --danger-soft: #fff1f0;
    --focus: #0b74c9;
    --shadow: 0 12px 34px rgba(31, 45, 61, 0.09);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0;
}

button, input, summary { font: inherit; letter-spacing: 0; }

a { color: inherit; }

.installer-shell {
    width: min(1040px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0 28px;
}

.installer-header {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 23px;
    font-weight: 750;
}

.eyebrow {
    margin: 0 0 2px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 22px; line-height: 1.25; }
h2 { margin-bottom: 4px; font-size: 20px; line-height: 1.3; }
.header-meta { margin: 0; color: var(--muted); font-size: 14px; }

.stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 12px 18px;
    color: var(--muted);
    border-right: 1px solid var(--border);
}

.step:last-child { border-right: 0; }
.step span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 50%; font-size: 13px; font-weight: 750; flex: 0 0 auto; }
.step strong { font-size: 14px; }
.step.active { color: var(--text); background: #f8fbfe; }
.step.active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.done { color: var(--success); }
.step.done span { background: var(--success-soft); border-color: #b8dfca; }

.install-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
}

.section-heading p, .completion-panel > p { margin-bottom: 0; color: var(--muted); }
.step-index { color: var(--primary); font-size: 12px; font-weight: 800; padding-top: 5px; }

.check-list { padding: 8px 28px; }
.check-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 68px; border-bottom: 1px solid #edf0f3; }
.check-row:last-child { border-bottom: 0; }
.check-row strong { display: block; font-size: 14px; }
.check-row p { margin: 2px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.check-state { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; }
.check-row.pass .check-state { color: var(--success); background: var(--success-soft); }
.check-row.fail .check-state { color: var(--danger); background: var(--danger-soft); }
.check-row.pending .check-state { color: var(--warning); background: var(--warning-soft); }
.check-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.check-row.pass .check-label { color: var(--success); }
.check-row.fail .check-label { color: var(--danger); }

.panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.button-secondary:hover { border-color: #aeb9c5; background: #f7f9fb; }
.button:disabled { cursor: not-allowed; opacity: .52; }
.button:focus-visible, input:focus-visible, summary:focus-visible, .copy-button:focus-visible { outline: 3px solid rgba(11, 116, 201, .24); outline-offset: 2px; }

form fieldset { margin: 0; padding: 24px 28px; border: 0; border-bottom: 1px solid var(--border); }
form legend { width: 100%; margin-bottom: 16px; color: var(--text); font-size: 15px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.database-grid { grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr); }
.database-grid .field:last-child { grid-column: span 2; }
.field { min-width: 0; }
.field label, .compact-form > label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 750; }
.field input, .compact-form input {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid #bac4cf;
    border-radius: 5px;
    background: #fff;
    color: var(--text);
}
.field input:hover, .compact-form input:hover { border-color: #8795a5; }
.field small, .checkbox-row small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 14px; border: 1px solid #ecd9aa; border-radius: 6px; background: var(--warning-soft); cursor: pointer; }
.checkbox-row input, .show-password input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); }
.checkbox-row strong { display: block; font-size: 13px; }
.show-password { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 13px; cursor: pointer; }

details { margin: 0; border-bottom: 1px solid var(--border); }
summary { min-height: 52px; padding: 15px 28px; font-weight: 750; cursor: pointer; }
.details-grid { padding: 0 28px 24px; }

.alert { margin: 20px 28px; padding: 14px 16px; border: 1px solid; border-radius: 6px; font-size: 14px; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert > span { display: block; margin-top: 8px; }
.inline-command { display: block; margin-top: 9px; padding: 9px 10px; border-radius: 4px; background: rgba(255, 255, 255, .72); color: var(--text); overflow-wrap: anywhere; }
.alert-error { color: #7a1d17; background: var(--danger-soft); border-color: #f1b8b3; }
.alert-warning { color: #704908; background: var(--warning-soft); border-color: #ecd9aa; }

.access-panel { max-width: 650px; margin: 72px auto 0; }
.compact-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 26px 28px 30px; }
.compact-form > label { grid-column: 1 / -1; margin-bottom: -5px; }

.completion-panel { padding: 52px 28px; text-align: center; }
.status-symbol { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%; font-size: 28px; font-weight: 800; }
.status-symbol.success { color: var(--success); background: var(--success-soft); }
.completion-panel .button { margin-top: 22px; }

.finish-steps { display: grid; gap: 16px; margin: 0; padding: 24px 28px 6px 64px; }
.finish-steps li { padding-left: 5px; }
.finish-steps strong, .finish-steps span { display: block; }
.finish-steps span { color: var(--muted); font-size: 13px; }
.command-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 18px 28px; padding: 10px; border: 1px solid #bac4cf; border-radius: 6px; background: #111827; }
.command-box code { align-self: center; padding: 4px 7px; color: #e8edf3; font-family: Consolas, "SFMono-Regular", monospace; font-size: 13px; overflow-wrap: anywhere; }
.copy-button { min-width: 92px; min-height: 42px; border: 0; border-radius: 5px; background: #e7eef5; color: #173b5c; font-weight: 750; cursor: pointer; }
.copy-button:hover { background: #d7e4ef; }
.root-work-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 28px; }
.root-work-list span { padding: 10px 12px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); font-size: 12px; text-align: center; }
.waiting { display: flex; align-items: center; gap: 14px; margin: 24px 28px 28px; padding: 16px; border-top: 1px solid var(--border); }
.waiting strong { display: block; font-size: 14px; }
.waiting p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s ease-in-out infinite; }

.installer-footer { padding: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

@keyframes pulse {
    0%, 100% { opacity: .35; box-shadow: 0 0 0 0 rgba(31, 93, 143, .3); }
    50% { opacity: 1; box-shadow: 0 0 0 7px rgba(31, 93, 143, 0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 760px) {
    .installer-shell { width: min(100% - 20px, 620px); padding-top: 20px; }
    .installer-header { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; }
    .brand-mark { width: 42px; height: 42px; }
    .header-meta { grid-column: 1 / -1; }
    .step { justify-content: center; min-height: 52px; padding: 10px 6px; }
    .step strong { display: none; }
    .section-heading, form fieldset { padding-left: 18px; padding-right: 18px; }
    .check-list { padding-left: 18px; padding-right: 18px; }
    .check-row { grid-template-columns: 30px minmax(0, 1fr); padding: 9px 0; }
    .check-label { grid-column: 2; }
    .form-grid, .database-grid { grid-template-columns: 1fr; }
    .database-grid .field:last-child { grid-column: auto; }
    .details-grid { padding-left: 18px; padding-right: 18px; }
    summary { padding-left: 18px; padding-right: 18px; }
    .alert, .command-box, .root-work-list, .waiting { margin-left: 18px; margin-right: 18px; }
    .panel-actions { padding: 16px 18px; flex-direction: column-reverse; }
    .button { width: 100%; }
    .compact-form { grid-template-columns: 1fr; padding: 22px 18px; }
    .root-work-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .command-box { grid-template-columns: 1fr; }
}
