*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -ms-overflow-style: scrollbar;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.47059;
    background: #f5f5f7;
    color: #1d1d1f;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: #06c;
}

a:hover {
    text-decoration: underline;
}

.header {
    width: 100%;
    max-width: 980px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 22px 0;
}

.header-logo {
    color: #1d1d1f;
}

.header-actions {
    width: 18px;
    height: 18px;
    color: #1d1d1f;
}

.main-container {
    flex: 1;
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0 20px;
}

.form-container {
    width: 100%;
    max-width: 430px;
    padding: 36px 0 20px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.step-hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.apple-big-logo {
    width: 140px;
    height: 140px;
    margin-bottom: 24px;
}

.apple-big-logo svg {
    width: 100%;
    height: 100%;
}

.apple-big-logo--sm {
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
}

.title {
    font-weight: 700;
    font-size: 24px;
    line-height: 1.16667;
    text-align: center;
    margin-bottom: 20px;
    color: #1d1d1f;
}

.title--sm {
    font-size: 20px;
}

.info-text {
    font-size: 14px;
    line-height: 1.42859;
    color: #6e6e73;
    text-align: center;
    margin-bottom: 24px;
    max-width: 400px;
}

.email-display {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    text-align: center;
    margin-bottom: 20px;
    word-break: break-all;
}

.signin-form {
    width: 100%;
    max-width: 400px;
}

.form-group {
    margin-bottom: 16px;
}

.input-field {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 400;
    color: #1d1d1f;
    background: #fff;
    border: 1.5px solid #d2d2d7;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.input-field::placeholder {
    color: #86868b;
}

.input-field:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.remember-group {
    margin: 16px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 400px;
}

.remember-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #0071e3;
    cursor: pointer;
}

.remember-group label {
    font-size: 14px;
    color: #1d1d1f;
    cursor: pointer;
    user-select: none;
}

/* ===== PRIVACY WRAPPER (ícone + texto) ===== */
.privacy-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 400px;
}

.privacy-icon {
    display: block;
    min-width: 28px;
    width: 28px;
    height: 34px;
    margin-top: 0;
    background-image: url('https://appleid.cdn-apple.com/appleauth/static/bin/cb1754975187/dist/assets/privacy.svg');
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-size: contain;
    box-sizing: border-box;
}

.tk-caption {
    font-size: 12px;
    line-height: 1.33341;
    color: #86868b;
    margin: 0;
    text-align: left;
}

.tk-caption p {
    margin: 0;
}

.tk-caption a {
    font-size: 12px;
    color: #86868b;
    text-decoration: underline;
}

.tk-caption a:hover {
    color: #1d1d1f;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.honeypot-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.error-message {
    display: none;
    font-size: 13px;
    color: #ff3b30;
    text-align: center;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: rgba(255, 59, 48, 0.08);
    border-radius: 8px;
    line-height: 1.4;
}

.error-message.visible {
    display: block;
}

.submit-btn {
    width: 100%;
    height: 50px;
    background: #0071e3;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 17px;
    font-weight: 400;
    color: #fff;
    transition: background 0.2s ease, opacity 0.2s ease;
    margin-bottom: 16px;
    -webkit-appearance: none;
    appearance: none;
}

.submit-btn:hover {
    background: #0077ed;
}

.submit-btn:active {
    background: #006edb;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.submit-btn.loading .btn-text { display: none; }
.submit-btn.loading .spinner { display: inline-block; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

.apple-id-link {
    display: block;
    text-align: center;
    font-size: 14px;
    color: #06c;
    margin-bottom: 0;
}

.back-link {
    background: none;
    border: none;
    color: #06c;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    display: block;
    margin: 12px auto 0;
    text-align: center;
}

.back-link:hover {
    text-decoration: underline;
}

.code-input-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.code-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 500;
    font-family: inherit;
    color: #1d1d1f;
    background: #fff;
    border: 1.5px solid #d2d2d7;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    caret-color: transparent;
}

.code-digit:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.code-digit.filled {
    border-color: #1d1d1f;
}

.code-note {
    font-size: 12px;
    color: #86868b;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.33341;
}

.separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.separator-line {
    flex: 1;
    height: 1px;
    background: #d2d2d7;
}

.separator-text {
    font-size: 11px;
    font-weight: 400;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.protected-icon {
    margin-bottom: 20px;
}

.protected-icon svg {
    width: 64px;
    height: 64px;
}

.protected-text {
    font-size: 15px;
    color: #1d1d1f;
    text-align: center;
    margin-bottom: 20px;
    max-width: 360px;
}

.protected-box {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    max-width: 380px;
    width: 100%;
}

.protected-box-text {
    font-size: 13px;
    color: #6e6e73;
    line-height: 1.4;
    margin: 0;
}

.protected-note {
    font-size: 13px;
    color: #86868b;
    text-align: center;
    margin-bottom: 20px;
    max-width: 360px;
    line-height: 1.4;
}

.footer {
    width: 100%;
    max-width: 980px;
    margin: 40px auto 20px;
    padding: 0 22px;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.footer-link {
    font-size: 12px;
    color: #86868b;
}

.footer-text {
    font-size: 12px;
    color: #86868b;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.visible {
    display: flex;
}

.loading-spinner-large {
    width: 36px;
    height: 36px;
    border: 3px solid #e8e8ed;
    border-top-color: #0071e3;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@media (max-width: 480px) {
    .form-container {
        padding: 24px 0 16px;
    }
    .title {
        font-size: 22px;
    }
    .code-digit {
        width: 42px;
        height: 50px;
        font-size: 20px;
    }
    .code-input-group {
        gap: 8px;
    }
    .apple-big-logo {
        width: 120px;
        height: 120px;
    }
    .apple-big-logo--sm {
        width: 64px;
        height: 64px;
    }
    .header {
        padding: 20px 16px 0;
    }
}