/*
 * Apple 风格认证页覆盖层。
 * 在 app.css 之后加载，只覆盖登录 / 同意 / 错误页的视觉，不改业务样式。
 */

body.auth-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 38%);
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    margin: 0;
    padding: 44px 36px 32px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 28px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    animation: card-in 0.4s ease-out both;
}

.auth-card.wide {
    max-width: 520px;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #1d1d1f;
    color: #ffffff;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-mark.small {
    width: 32px;
    height: 32px;
    margin: 0;
    border-radius: 9px;
    font-size: 14px;
}

.auth-header h1,
.auth-card h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #1d1d1f;
}

.auth-header .subtitle,
.auth-card .subtitle {
    margin: 10px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: #6e6e73;
}

.auth-header .subtitle strong {
    color: #1d1d1f;
    font-weight: 600;
}

.auth-form {
    margin: 0;
}

.field {
    display: block;
    margin-bottom: 14px;
}

.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: #6e6e73;
}

.field input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f5f5f7;
    color: #1d1d1f;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field input:focus {
    background: #ffffff;
    border-color: #0071e3;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.field input::placeholder {
    color: #a1a1a6;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: #1d1d1f;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
}

.btn-primary:hover {
    background: #000000;
}

.btn-primary:active {
    transform: scale(0.985);
}

.btn-primary.block {
    display: flex;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 0 22px;
    border: 1px solid #d2d2d7;
    border-radius: 999px;
    background: transparent;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s;
}

.btn-ghost:hover {
    background: #f5f5f7;
}

.btn-ghost.danger {
    color: #b42318;
    border-color: #fecaca;
}

.source-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.source-item {
    margin: 0;
}

.source-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 16px;
    background: #ffffff;
    text-decoration: none;
    color: inherit;
    transition: background 0.16s, border-color 0.16s;
}

.source-link:hover {
    background: #f5f5f7;
    border-color: #b8b8bd;
}

.source-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #f5f5f7;
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 600;
}

.source-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.source-name {
    font-size: 15px;
    font-weight: 600;
}

.source-desc {
    font-size: 12.5px;
    color: #6e6e73;
}

.source-arrow {
    color: #86868b;
    font-size: 16px;
}

.source-badge {
    padding: 3px 8px;
    border-radius: 999px;
    background: #e8f2ff;
    color: #0066cc;
    font-size: 10.5px;
    font-weight: 600;
}

.source-badge.muted {
    background: #f5f5f7;
    color: #86868b;
}

.source-item.is-disabled .source-link {
    opacity: 0.55;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 14px;
}

.alert-error {
    background: #fff2f2;
    border: 1px solid #fecaca;
    color: #b42318;
}

.alert-ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.hint {
    font-size: 12.5px;
    line-height: 1.7;
    color: #86868b;
}

.muted {
    color: #86868b;
}

.auth-footer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e5e5ea;
    text-align: center;
}

.link {
    color: #0066cc;
    text-decoration: none;
    font-size: 13px;
}

.link:hover {
    text-decoration: underline;
}

code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #f5f5f7;
    font-size: 12px;
    font-family: "SF Mono", ui-monospace, Menlo, monospace;
}

.consent-list {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.consent-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
}

.consent-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #0071e3;
}

.consent-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.consent-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.consent-desc {
    font-size: 12.5px;
    color: #6e6e73;
    line-height: 1.6;
}

.panel {
    padding: 14px 16px;
    border-radius: 14px;
    background: #f5f5f7;
    border: 1px solid #e5e5ea;
}

.kv {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 8px 12px;
    margin: 0 0 18px;
    font-size: 13px;
}

.kv dt {
    color: #6e6e73;
}

.kv dd {
    margin: 0;
    color: #1d1d1f;
}

.error-card {
    text-align: center;
}

.error-code {
    margin: 18px 0 8px;
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: #1d1d1f;
}

.error-card .btn-primary {
    margin-top: 22px;
}

/* 登录后租户选择 */
.tenant-list {
    display: grid;
    gap: 10px;
}

.tenant-form {
    margin: 0;
}

.tenant-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid #d2d2d7;
    border-radius: 16px;
    background: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: background 0.16s, border-color 0.16s;
}

.tenant-card:hover {
    background: #f5f5f7;
    border-color: #b8b8bd;
}

.tenant-card.is-current {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.tenant-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tenant-name {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
}

.tenant-meta {
    font-size: 12.5px;
    color: #6e6e73;
}

.tenant-role {
    padding: 3px 8px;
    border-radius: 999px;
    background: #e8f2ff;
    color: #0066cc;
    font-size: 10.5px;
    font-weight: 600;
}

@media (max-width: 520px) {
    body.auth-page {
        padding: 20px 14px;
    }

    .auth-card {
        padding: 36px 24px 28px;
        border-radius: 24px;
    }

    .auth-header h1,
    .auth-card h1 {
        font-size: 23px;
    }
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
