:root {
    --p9-ink: #333645;
    --p9-blue: #3890ff;
    --p9-blue-deep: #2c75d0;
    --p9-muted: #7d8b99;
    --p9-border: #e7edf2;
    --p9-soft: #f6f8fb;
    --p9-danger: #b94a48;
    --p9-danger-bg: #fdf3f2;
    --p9-success: #659f13;
    --p9-success-bg: #f5faec;
}

body {
    color: var(--p9-ink);
}

body.modal-open {
    overflow: hidden;
}

.header ul li > a.current-demo {
    color: #b2bfc9;
    background-color: rgba(0, 0, 0, 0.18);
    text-decoration: none;
}

.demo-page {
    padding: 78px 16px 48px;
}

.auth-frame {
    width: 620px;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

.auth-frame.auth-frame-wide {
    width: 620px;
}

.auth-card {
    overflow: hidden;
}

.auth-subtitle {
    margin: -6px 16px 18px;
    text-align: center;
    color: var(--p9-muted);
    font-size: 13px;
    line-height: 1.8;
}

.auth-form {
    margin-top: 2px;
}

.auth-field {
    margin-bottom: 14px;
}

.auth-label {
    display: block;
    margin-bottom: 8px;
    color: #8ea0b3;
    font-size: 12px;
}

.auth-label-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.auth-label-row .auth-label {
    margin-bottom: 0;
}

.auth-label-hint {
    color: #9aa6b2;
    font-size: 11px;
    line-height: 1.5;
    text-align: right;
}

.input-wrap {
    position: relative;
}

.auth-form input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(136, 149, 166, 0.18);
    border-radius: 4px;
    background: #eff2f5;
}

.auth-form input:focus {
    border-color: rgba(56, 144, 255, 0.38);
    box-shadow: inset 0 0 0 1px rgba(56, 144, 255, 0.14);
    background: #f5f8fb;
}

.auth-form input.has-toggle {
    padding-right: 56px;
}

.inline-field {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.inline-field input {
    flex: 1;
    min-width: 0;
}

.inline-field .code-button {
    min-width: 110px;
    white-space: nowrap;
}

.toggle-pass {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    color: var(--p9-muted);
    padding: 0;
    font-size: 12px;
}

.toggle-pass:hover {
    color: var(--p9-blue-deep);
    opacity: 1;
}

.field-message {
    min-height: 18px;
    padding-top: 6px;
    color: #9aa6b2;
    font-size: 12px;
    line-height: 18px;
}

.field-message.is-error {
    color: var(--p9-danger);
}

.field-message.is-success {
    color: var(--p9-success);
}

.field-caption {
    margin-top: 4px;
    color: #95a0ab;
    font-size: 12px;
    line-height: 18px;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
    font-size: 13px;
}

.helper-block {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #edf1f5;
}

.helper-title {
    margin-bottom: 10px;
    color: #9ba7b3;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.step-view.is-hidden {
    display: none;
}

.step-head {
    margin-bottom: 4px;
}

.step-pill {
    display: inline-block;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #edf4ff;
    color: #4a86c5;
    padding: 4px 10px;
    font-size: 12px;
}

.step-title {
    color: #425160;
    font-size: 18px;
}

.step-summary {
    margin-bottom: 16px;
    border: 1px solid #e5edf5;
    border-radius: 8px;
    background: #f5f8fb;
    padding: 10px 12px;
    color: #6d7b89;
    font-size: 12px;
    line-height: 1.8;
}

.auth-card.register-card {
    padding-top: 24px;
}

.demo-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.demo-chip {
    border: 1px solid #d8e0e8;
    border-radius: 16px;
    background: #f7f9fb;
    color: #5d6b7b;
    padding: 5px 12px;
    font-size: 12px;
    line-height: 1.2;
}

.demo-chip:hover {
    background: #eef3f7;
    opacity: 1;
}

.rule-box {
    margin-top: 12px;
    border: 1px solid #ecf0f4;
    border-radius: 8px;
    background: #f6f8fb;
    padding: 12px 14px;
}

.rule-box ul {
    margin: 0;
    padding: 0;
}

.rule-box li {
    list-style: none;
    color: #748291;
    font-size: 12px;
    line-height: 1.8;
}

.status-panel {
    display: none;
    margin-top: 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.8;
}

.status-panel.is-error,
.status-panel.is-success {
    display: block;
}

.status-panel.is-error {
    border-color: #f0d7d3;
    background: var(--p9-danger-bg);
    color: var(--p9-danger);
}

.status-panel.is-success {
    border-color: #dce8f1;
    background: #f4f8fa;
    color: #3a87ad;
}

.success-view {
    display: none;
    padding: 8px 0 4px;
    text-align: center;
}

.success-view.is-visible {
    display: block;
}

.success-mark {
    width: 66px;
    height: 66px;
    margin: 0 auto 16px;
    border-radius: 33px;
    background: linear-gradient(180deg, #dff0fc, #cde6ff);
    color: var(--p9-blue);
    font-size: 30px;
    line-height: 66px;
}

.success-title {
    margin-bottom: 8px;
    color: #425160;
    font-size: 20px;
}

.success-text {
    margin-bottom: 16px;
    color: var(--p9-muted);
    font-size: 13px;
    line-height: 1.8;
}

.demo-footer-note {
    margin-top: 18px;
    text-align: center;
    color: #8f99a4;
    font-size: 12px;
    line-height: 1.7;
}

.manual-note {
    margin-top: 12px;
    border: 1px solid #efe7c9;
    border-radius: 8px;
    background: #fbfaf4;
    padding: 12px 14px;
    color: #927c48;
    font-size: 12px;
    line-height: 1.8;
}

.auth-modal-mask {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(37, 43, 54, 0.5);
    padding: 20px;
}

.auth-modal-mask.is-open {
    display: flex;
}

.modal-card {
    width: 460px;
    max-width: 100%;
    border: 1px solid #dce3ea;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
    padding: 30px 32px 24px;
}

.modal-title {
    text-align: center;
    color: #46515d;
    font-size: 20px;
}

.modal-subtitle {
    margin: 10px 0 18px;
    text-align: center;
    color: var(--p9-muted);
    font-size: 13px;
    line-height: 1.8;
}

.modal-note {
    margin-bottom: 14px;
    border: 1px solid #e9eef3;
    border-radius: 8px;
    background: #f5f8fb;
    padding: 10px 12px;
    color: #6d7b89;
    font-size: 12px;
    line-height: 1.7;
}

.modal-success {
    display: none;
    text-align: center;
}

.modal-success.is-visible {
    display: block;
}

.modal-success .success-mark {
    margin-top: 4px;
}

.modal-actions {
    margin-top: 14px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-actions .btn {
    flex: 1;
}

.demo-preview {
    width: 680px;
    max-width: 100%;
    margin: 0 auto;
}

.preview-box {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    padding: 24px 24px 20px;
}

.preview-tag {
    display: inline-block;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #edf4ff;
    color: #4a86c5;
    padding: 4px 10px;
    font-size: 12px;
}

.preview-box h3 {
    margin-bottom: 8px;
    color: #3c4652;
    font-size: 24px;
    font-weight: 400;
}

.preview-box p {
    color: #72808c;
    line-height: 1.9;
}

.preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.page-tip {
    margin-top: 12px;
    border-left: 3px solid #89b8f5;
    background: #f4f8fb;
    padding: 10px 12px;
    color: #6d7b89;
    font-size: 12px;
    line-height: 1.8;
}

@media (max-width: 640px) {
    .demo-page {
        padding-top: 70px;
    }

    .auth-frame,
    .auth-frame.auth-frame-wide {
        width: 100%;
    }

    .sbox.auth-card,
    .modal-card,
    .preview-box {
        padding: 24px 18px 18px;
    }

    .inline-field {
        flex-direction: column;
    }

    .inline-field .code-button {
        width: 100%;
    }

    .auth-links {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-label-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .auth-label-hint {
        text-align: left;
    }

    .preview-actions {
        flex-direction: column;
    }
}
