:root {
    color-scheme: light;
    --bg: #f4f7f6;
    --surface: #ffffff;
    --surface-soft: #eef4f2;
    --text: #16201d;
    --muted: #66746f;
    --line: #dce5e1;
    --primary: #147c72;
    --primary-dark: #0d5f58;
    --accent: #c57a1a;
    --danger: #b42318;
    --success: #137333;
    --warning: #8a5a00;
    --shadow: 0 18px 45px rgba(24, 41, 37, 0.12);
}

* {
    box-sizing: border-box;
}

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

body {
    background: linear-gradient(135deg, rgba(20, 124, 114, 0.08), transparent 36%), linear-gradient(315deg, rgba(197, 122, 26, 0.08), transparent 32%), var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid rgba(220, 229, 225, 0.75);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 750;
}

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main {
    flex: 1;
    width: 100%;
}

.auth-page,
.center-page {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.auth-card {
    width: min(100%, 440px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-card.wide {
    width: min(100%, 540px);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

h1,
h2 {
    margin: 0;
    line-height: 1.25;
}

.lede {
    margin: 10px 0 22px;
    color: var(--muted);
}

.form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 7px;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

label {
    color: #26322f;
    font-weight: 650;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cbd8d4;
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: none;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #66746f 50%), linear-gradient(135deg, #66746f 50%, transparent 50%);
    background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 9px 15px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--surface-soft);
    border-color: var(--line);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
}

.btn-full {
    width: 100%;
}

.alert {
    margin: 0 0 16px;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid;
}

.alert-success {
    color: var(--success);
    background: #edf7ef;
    border-color: #bde5c5;
}

.alert-error {
    color: var(--danger);
    background: #fff0ed;
    border-color: #f3c1b9;
}

.alert-warning {
    color: var(--warning);
    background: #fff8e5;
    border-color: #f0d890;
}

.auth-card .admin-toast-stack,
.mx-login-card .admin-toast-stack {
    display: grid;
    gap: 10px;
    margin: 0 0 16px;
}

.auth-card .admin-toast,
.mx-login-card .admin-toast {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 9px;
    border: 1px solid #f3c1b9;
    border-radius: 6px;
    background: #fff0ed;
    color: var(--danger);
    padding: 10px 11px;
}

.auth-card .admin-toast-success,
.mx-login-card .admin-toast-success {
    border-color: #bde5c5;
    background: #edf7ef;
    color: var(--success);
}

.auth-card .admin-toast-warning,
.mx-login-card .admin-toast-warning {
    border-color: #f0d890;
    background: #fff8e5;
    color: var(--warning);
}

.auth-card .admin-toast-icon,
.auth-card .admin-toast-close,
.mx-login-card .admin-toast-icon,
.mx-login-card .admin-toast-close {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: currentColor;
}

.auth-card .admin-toast-icon svg,
.auth-card .admin-toast-close svg,
.mx-login-card .admin-toast-icon svg,
.mx-login-card .admin-toast-close svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-card .admin-toast-message,
.mx-login-card .admin-toast-message {
    min-width: 0;
    font-size: 14px;
    font-weight: 650;
}

.auth-card .admin-toast-close,
.mx-login-card .admin-toast-close {
    border: 0;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.auth-card .admin-toast-close:hover,
.mx-login-card .admin-toast-close:hover {
    background: rgba(180, 35, 24, 0.08);
}

.auth-card .admin-toast-progress,
.mx-login-card .admin-toast-progress {
    display: none;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.split-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.hero {
    min-height: calc(100vh - 64px);
    display: grid;
    align-items: center;
    padding: 72px 32px 96px;
}

.hero-inner {
    width: min(1120px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 48px;
    align-items: center;
}

.hero-copy h1 {
    font-size: clamp(38px, 6vw, 74px);
    letter-spacing: 0;
}

.hero-copy p {
    max-width: 560px;
    color: var(--muted);
    font-size: 18px;
}

.workspace-preview {
    min-height: 420px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfb;
}

.preview-body {
    display: grid;
    grid-template-columns: 170px 1fr;
    min-height: 364px;
}

.preview-menu {
    border-right: 1px solid var(--line);
    background: #f6faf8;
    padding: 14px;
}

.preview-menu span,
.preview-doc span {
    display: block;
    height: 10px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: #d9e5e1;
}

.preview-menu span:nth-child(2) {
    width: 72%;
    background: #c8dbd6;
}

.preview-menu span:nth-child(3) {
    width: 86%;
}

.preview-doc {
    padding: 24px;
}

.preview-doc h2 {
    margin-bottom: 18px;
}

.preview-doc span:nth-of-type(1) {
    width: 92%;
}

.preview-doc span:nth-of-type(2) {
    width: 98%;
}

.preview-doc span:nth-of-type(3) {
    width: 75%;
}

.panel-page {
    width: min(1040px, 100%);
    margin: 0 auto;
    padding: 36px 16px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.settings-grid {
    display: grid;
    gap: 18px;
}

.settings-section {
    display: grid;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.settings-section h2 {
    font-size: 18px;
}

.settings-section:last-of-type {
    border-bottom: 0;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
}

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.switch input {
    position: absolute;
    opacity: 0;
}

.switch-track {
    width: 50px;
    height: 28px;
    border-radius: 999px;
    background: #c8d5d1;
    transition: 0.2s ease;
}

.switch-track::after {
    content: "";
    width: 22px;
    height: 22px;
    position: absolute;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
    transition: 0.2s ease;
}

.switch input:checked+.switch-track {
    background: var(--primary);
}

.switch input:checked+.switch-track::after {
    transform: translateX(22px);
}

.install-page {
    width: min(920px, 100%);
    margin: 0 auto;
    padding: 34px 16px;
}

.install-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.section-title {
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.installer-body {
    min-height: 100vh;
    background: #f6f7f4;
    color: #1d2522;
}

.installer-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 247, 244, 0.94)), radial-gradient(circle at 14% 10%, rgba(20, 124, 114, 0.12), transparent 28%), radial-gradient(circle at 86% 6%, rgba(197, 122, 26, 0.11), transparent 24%);
}

.installer-wrap {
    position: relative;
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 64px;
}

.installer-card {
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #d8e0dc;
    border-radius: 8px;
    box-shadow: 0 22px 60px rgba(28, 43, 39, 0.12);
}

.installer-header {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 16px;
    align-items: center;
    padding: 34px 38px 30px;
    border-bottom: 1px solid #e2e8e5;
    background: linear-gradient(90deg, rgba(20, 124, 114, 0.09), transparent 56%), #fbfcfb;
}

.installer-logo {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #147c72;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(20, 124, 114, 0.24);
}

.installer-kicker {
    margin: 0 0 6px;
    color: #147c72;
    font-size: 13px;
    font-weight: 750;
}

.installer-header h1 {
    margin: 0;
    font-size: 30px;
}

.installer-header p:last-child {
    margin: 8px 0 0;
    color: #66746f;
}

.installer-errors {
    margin: 24px 38px 0;
    padding: 12px 14px;
    border: 1px solid #efb7ad;
    border-radius: 6px;
    background: #fff2ef;
    color: #a8281d;
}

.installer-errors div+div {
    margin-top: 5px;
}

.installer-progress-bar {
    padding: 22px 38px 18px;
    border-bottom: 1px solid #e2e8e5;
    background: #fff;
}

.progress-track {
    position: relative;
    height: 6px;
    margin: 0 13%;
    overflow: hidden;
    border-radius: 999px;
    background: #e4ebe8;
}

.progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--install-progress, 0%);
    border-radius: inherit;
    background: #147c72;
    transition: width 0.25s ease;
}

.progress-points {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 13px;
}

.progress-point {
    display: grid;
    justify-items: center;
    gap: 7px;
    color: #7a8782;
    text-align: center;
}

.progress-point span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid #cbd8d4;
    border-radius: 50%;
    background: #fff;
    font-size: 13px;
    font-weight: 800;
}

.progress-point strong {
    font-size: 14px;
}

.progress-point.is-current {
    color: #147c72;
}

.progress-point.is-current span,
.progress-point.is-done span {
    border-color: #147c72;
    background: #147c72;
    color: #fff;
}

.progress-point.is-done {
    color: #2f5650;
}

.installer-form {
    display: grid;
}

.installer-section {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 18px;
    padding: 30px 38px;
    border-bottom: 1px solid #e6ece9;
}

.installer-section-single {
    grid-template-columns: 1fr;
}

.section-number {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #cbd8d4;
    border-radius: 50%;
    background: #f8faf9;
    color: #147c72;
    font-weight: 800;
}

.section-content {
    min-width: 0;
}

.section-content h2 {
    margin: 0;
    font-size: 20px;
}

.section-content>p {
    margin: 6px 0 18px;
    color: #66746f;
}

.installer-section label span {
    color: #b42318;
}

.check-list {
    display: grid;
    gap: 10px;
}

.check-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid #dce5e1;
    border-radius: 8px;
    background: #fbfcfb;
}

.check-status {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 900;
}

.check-item strong,
.check-item small {
    display: block;
}

.check-item small {
    margin-top: 2px;
    color: #66746f;
    word-break: break-all;
}

.check-item.is-ok .check-status {
    background: #edf7ef;
    color: #137333;
}

.check-item.is-fail {
    border-color: #efb7ad;
    background: #fff8f6;
}

.check-item.is-fail .check-status {
    background: #fff0ed;
    color: #b42318;
}

.installer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 38px;
    background: #fbfcfb;
    color: #66746f;
}

.install-done {
    display: grid;
    justify-items: center;
    padding: 52px 32px;
    text-align: center;
}

.done-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 50%;
    background: #edf7ef;
    color: #137333;
    font-size: 30px;
    font-weight: 900;
}

.install-done h2 {
    margin: 0;
}

.install-done p {
    max-width: 520px;
    margin: 10px 0 22px;
    color: #66746f;
}

.installer-form input[type="text"],
.installer-form input[type="email"],
.installer-form input[type="password"],
.installer-form input[type="url"],
.installer-form input[type="number"] {
    min-height: 40px;
    padding: 7px 11px;
}

.installer-footer .btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

@media (max-width: 820px) {
    .topbar {
        padding: 0 16px;
    }
    .hero {
        padding: 40px 16px 56px;
    }
    .hero-inner {
        grid-template-columns: 1fr;
    }
    .preview-body {
        grid-template-columns: 1fr;
    }
    .preview-menu {
        display: none;
    }
    .install-grid,
    .inline-form {
        grid-template-columns: 1fr;
    }
    .installer-wrap {
        width: min(100% - 20px, 980px);
        padding: 18px 0 34px;
    }
    .installer-header,
    .installer-section,
    .installer-footer {
        padding-left: 18px;
        padding-right: 18px;
    }
    .installer-header {
        grid-template-columns: 1fr;
    }
    .installer-section {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
    }
    .section-number {
        width: 28px;
        height: 28px;
        margin-top: 1px;
        font-size: 14px;
    }
    .section-content h2 {
        min-height: 30px;
        display: flex;
        align-items: center;
        font-size: 19px;
    }
    .installer-section-single {
        grid-template-columns: 1fr;
    }
    .section-content>p {
        grid-column: 1 / -1;
        margin-top: 8px;
    }
    .installer-form input[type="text"],
    .installer-form input[type="email"],
    .installer-form input[type="password"],
    .installer-form input[type="url"],
    .installer-form input[type="number"] {
        min-height: 38px;
        padding: 6px 10px;
    }
    .installer-footer {
        align-items: stretch;
        flex-direction: column;
    }
    .installer-footer .btn {
        width: 100%;
    }
    .installer-progress-bar {
        padding: 18px 16px 14px;
    }
    .progress-track {
        margin: 0 12%;
        height: 5px;
    }
    .progress-points {
        margin-top: 10px;
    }
    .progress-point {
        gap: 5px;
    }
    .progress-point span {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .progress-point strong {
        font-size: 12px;
    }
}
