:root {
    --oauth-brand-1: #5b6cf0;
    --oauth-brand-2: #7c3aed;
    --oauth-text: #1a1d26;
    --oauth-muted: #64748b;
    --oauth-border: #e2e8f0;
}

.oauth-authorize-mode .login-box,
.oauth-authorize-mode .cp-card,
.oauth-authorize-mode .mc-card {
    max-width: 920px !important;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.oauth-split-card {
    overflow: visible;
    background: #fff;
    border-radius: 16px;
}

.oauth-split {
    display: flex;
    align-items: stretch;
    min-height: 0;
}

.oauth-split-left {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.oauth-split-divider {
    width: 1px;
    background: var(--oauth-border);
    flex-shrink: 0;
}

.oauth-split-right {
    flex: 1 1 50%;
    min-width: 0;
    padding: 28px 28px 32px;
    background: linear-gradient(180deg, #fafbfd 0%, #fff 100%);
    display: flex;
    flex-direction: column;
}

.oauth-left-body {
    flex: 0 1 auto;
    padding: 16px 28px 28px;
}

.oauth-login-panel {
    display: flex;
    flex-direction: column;
}

.oauth-session-panel {
    padding: 36px 28px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
}

.oauth-session-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--oauth-brand-1), var(--oauth-brand-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(91, 108, 240, 0.28);
}

.oauth-session-label {
    font-size: 12px;
    color: var(--oauth-muted);
    margin: 0 0 4px;
}

.oauth-session-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--oauth-text);
    margin: 0 0 8px;
}

.oauth-session-hint {
    font-size: 13px;
    color: var(--oauth-muted);
    margin: 0 0 20px;
    line-height: 1.6;
}

.oauth-session-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--oauth-muted);
    background: #fff;
    border: 1px solid var(--oauth-border);
    border-radius: 999px;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.oauth-session-logout:hover,
.oauth-session-logout:focus {
    color: var(--oauth-brand-1);
    border-color: rgba(91, 108, 240, 0.45);
    background: rgba(91, 108, 240, 0.04);
    text-decoration: none;
}

.oauth-consent-head {
    margin-bottom: 20px;
}

.oauth-consent-head h2 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: var(--oauth-text);
}

.oauth-consent-head p {
    margin: 0;
    font-size: 13px;
    color: var(--oauth-muted);
    line-height: 1.5;
}

.oauth-consent-app {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--oauth-border);
    border-radius: 14px;
    background: #fff;
    margin-bottom: 18px;
}

.oauth-consent-app .app-icon,
.oauth-consent-app .app-icon-placeholder {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    object-fit: cover;
}

.oauth-consent-app .app-icon-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--oauth-brand-1), var(--oauth-brand-2));
    color: #fff;
    font-size: 20px;
}

.oauth-consent-app .app-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--oauth-text);
}

.oauth-consent-app .app-id {
    font-size: 12px;
    color: var(--oauth-muted);
    margin: 0;
    word-break: break-all;
}

.oauth-perm-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    border: 1px solid var(--oauth-border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.oauth-perm-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--oauth-text);
    border-bottom: 1px solid var(--oauth-border);
}

.oauth-perm-list li:last-child {
    border-bottom: none;
}

.oauth-perm-list li i {
    color: var(--oauth-brand-1);
    margin-top: 2px;
    width: 16px;
    text-align: center;
}

.oauth-consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--oauth-text);
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
}

.oauth-consent-check input {
    margin-top: 3px;
    accent-color: var(--oauth-brand-1);
    flex-shrink: 0;
}

.oauth-consent-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.btn-oauth-consent {
    height: 46px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.btn-oauth-consent-primary {
    background: linear-gradient(135deg, var(--oauth-brand-1), var(--oauth-brand-2));
    color: #fff;
    box-shadow: 0 8px 20px rgba(91, 108, 240, 0.35);
}

.btn-oauth-consent-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-oauth-consent-ghost {
    background: #fff;
    color: var(--oauth-muted);
    border: 1px solid var(--oauth-border);
}

.oauth-consent-tip {
    font-size: 12px;
    color: var(--oauth-muted);
    text-align: center;
    margin: 0 0 12px;
    min-height: 18px;
}

.oauth-login-tabs {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid var(--oauth-border);
}

.oauth-login-tabs li {
    flex: 1;
    text-align: center;
}

.oauth-login-tabs li a {
    display: block;
    padding: 14px 8px;
    font-size: 14px;
    color: var(--oauth-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.oauth-login-tabs li.active a {
    color: var(--oauth-brand-1);
    border-bottom-color: var(--oauth-brand-1);
    font-weight: 600;
}

.oauth-form-group {
    margin-bottom: 14px;
}

.oauth-form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--oauth-text);
    line-height: 1.4;
}

.oauth-form-control {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--oauth-border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--oauth-text);
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.oauth-form-control::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.oauth-form-control:focus {
    outline: none;
    border-color: rgba(91, 108, 240, 0.5);
    box-shadow: 0 0 0 3px rgba(91, 108, 240, 0.12);
}

.oauth-input-with-btn {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.oauth-input-with-btn .oauth-form-control {
    flex: 1;
    min-width: 0;
}

.oauth-kaptcha-btn {
    flex-shrink: 0;
    min-width: 108px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--oauth-border);
    border-radius: 10px;
    background: #fff;
    color: var(--oauth-brand-1);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
    box-sizing: border-box;
}

.oauth-kaptcha-btn:disabled {
    color: #94a3b8;
    cursor: not-allowed;
    background: #f8fafc;
}

.oauth-kaptcha-btn:not(:disabled):hover {
    background: rgba(91, 108, 240, 0.08);
    border-color: rgba(91, 108, 240, 0.35);
}

.oauth-remember-row {
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--oauth-muted);
}

.btn-oauth-login {
    width: 100%;
    height: 46px;
    margin-top: 4px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--oauth-brand-1), var(--oauth-brand-2));
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(91, 108, 240, 0.3);
}

.oauth-qr-center {
    text-align: center;
    padding: 12px 0;
}

.oauth-qr-frame {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--oauth-border);
    border-radius: 12px;
    margin-bottom: 12px;
}

/* Safari：优先 canvas；库会同时生成 canvas+img，只保留一个 */
.oauth-qr-frame canvas,
#qrcode canvas,
#chaoran_third_qrcode canvas,
#chaoran_third_qrcode_dialog canvas,
#loginQrcodeBox canvas {
    display: block !important;
    margin: 0 auto;
    max-width: 100%;
    height: auto !important;
}

.oauth-qr-frame:has(canvas) img,
#qrcode:has(canvas) img,
#chaoran_third_qrcode:has(canvas) img,
#chaoran_third_qrcode_dialog:has(canvas) img,
#loginQrcodeBox:has(canvas) img {
    display: none !important;
}

.oauth-qr-frame img[src=""],
.oauth-qr-frame img:not([src]),
#qrcode img[src=""],
#qrcode img:not([src]),
#chaoran_third_qrcode img[src=""],
#chaoran_third_qrcode img:not([src]),
#chaoran_third_qrcode_dialog img[src=""],
#chaoran_third_qrcode_dialog img:not([src]) {
    display: none !important;
}

.oauth-qr-status {
    font-size: 14px;
    color: var(--oauth-text);
    margin: 8px 0;
}

.oauth-qr-hint {
    font-size: 12px;
    color: var(--oauth-muted);
    margin: 4px 0 12px;
}

.oauth-qr-actions a {
    font-size: 13px;
    color: var(--oauth-brand-1);
    text-decoration: none;
}

.oauth-qr-scanned {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 8px 0 0;
}

.oauth-qr-scanned-avatar {
    width: 140px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f2f8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(26, 29, 38, 0.08);
}

.oauth-qr-scanned-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.oauth-qr-scanned-avatar-placeholder {
    font-size: 56px;
    color: #b8bfd0;
}

.oauth-qr-scanned-name {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--oauth-text);
}

.oauth-qr-status-success {
    color: #16a34a;
}

.btn-oauth-qr-switch {
    margin-top: 20px;
    min-width: 200px;
    padding: 10px 24px;
    border-radius: 8px;
    border: 1px solid var(--oauth-border);
    background: #fff;
    color: var(--oauth-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.btn-oauth-qr-switch:hover,
.btn-oauth-qr-switch:focus {
    border-color: rgba(91, 108, 240, 0.35);
    background: rgba(91, 108, 240, 0.04);
    outline: none;
}

.oauth-alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin: 12px 24px;
    font-size: 13px;
    position: relative;
}

.oauth-alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.oauth-alert-close {
    position: absolute;
    right: 10px;
    top: 8px;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    line-height: 1;
}

.oauth-login-only {
    padding: 0;
}

.oauth-split.oauth-split-stack {
    flex-direction: column;
}

.oauth-split.oauth-split-stack .oauth-split-divider {
    width: 100%;
    height: 1px;
}

.oauth-split.oauth-split-stack .oauth-split-right {
    padding: 24px 20px 28px;
}

/* ===== 经典风格（uniformlogin）OAuth 授权页 ===== */
#login.oauth-authorize-mode .login-page {
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 20px;
}

#login.oauth-authorize-mode .login-box.oauth-authorize-mode {
    max-width: 960px !important;
    margin: 0 auto;
}

#login.oauth-authorize-mode .card {
    overflow: visible;
}

#login.oauth-authorize-mode .oauth-split-card {
    background: #fff;
    border-radius: 22px;
    box-shadow: none;
}

#login.oauth-authorize-mode .oauth-split-left {
    background: #fff;
    border-radius: 22px 0 0 22px;
}

#login.oauth-authorize-mode .oauth-split-right {
    border-radius: 0 22px 22px 0;
    padding: 24px 28px 28px;
}

#login.oauth-authorize-mode .oauth-login-tabs {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.06), rgba(37, 99, 235, 0.1));
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

#login.oauth-authorize-mode .oauth-login-tabs li a {
    padding: 12px 8px;
    font-size: 13px;
}

#login.oauth-authorize-mode .oauth-login-tabs li.active a {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

#login.oauth-authorize-mode .oauth-left-body {
    padding: 18px 28px 24px;
}

#login.oauth-authorize-mode .oauth-form-control {
    height: 46px;
    border-radius: 12px;
    border-color: rgba(148, 163, 184, 0.45);
    background: linear-gradient(180deg, #f9fbff, #f3f7ff);
}

#login.oauth-authorize-mode .oauth-form-control:focus {
    border-color: rgba(79, 70, 229, 0.55);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

#login.oauth-authorize-mode .btn-oauth-login {
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5, #2563eb);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

#login.oauth-authorize-mode .btn-oauth-consent-primary {
    background: linear-gradient(135deg, #4f46e5, #2563eb);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

/* ===== 云门户（cloudportal）OAuth / 普通 OAuth 登录 ===== */
.cp-page .oauth-split-card,
.cp-page .oauth-login-only {
    border-radius: 16px;
}

.cp-page.oauth-authorize-mode .cp-card,
.cp-page .cp-card .oauth-login-only {
    overflow: visible;
}

.cp-page .oauth-login-tabs {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(59, 130, 246, 0.1));
}

.cp-page .oauth-login-tabs li.active a {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.cp-page .btn-oauth-login,
.cp-page .btn-oauth-consent-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

.cp-page .oauth-kaptcha-btn {
    color: #2563eb;
}

.cp-page .oauth-kaptcha-btn:not(:disabled):hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.35);
}

.cp-page .oauth-form-control:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ===== 极简居中（minimalcenter）OAuth / 普通 OAuth 登录 ===== */
.mc-page.oauth-authorize-mode .mc-card {
    max-width: 960px !important;
    width: 100%;
}

.mc-page .oauth-split-card {
    border-radius: 16px;
}

.mc-page .oauth-login-tabs li.active a {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.mc-page .btn-oauth-login,
.mc-page .btn-oauth-consent-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

.mc-page .oauth-kaptcha-btn {
    color: #4f46e5;
}

.mc-page .oauth-form-control:focus {
    border-color: rgba(79, 70, 229, 0.55);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

@media (max-width: 768px) {
    .oauth-split {
        flex-direction: column;
        min-height: auto;
    }

    .oauth-split-divider {
        width: 100%;
        height: 1px;
    }

    .oauth-split-right {
        padding: 24px 20px 28px;
    }

    .oauth-left-body {
        padding: 12px 16px 20px;
    }

    #login.oauth-authorize-mode .oauth-split-left,
    #login.oauth-authorize-mode .oauth-split-right {
        border-radius: 0;
    }
}
