:root {
    --mc-primary: #1c81c5;
    --mc-primary-hover: #14679e;
    --mc-accent: #fce120;
    --mc-text: #172033;
    --mc-muted: #667085;
    --mc-border: #d9dee8;
    --mc-surface: #ffffff;
    --mc-background: #f5f7fb;
    --mc-danger: #b42318;
    --mc-success: #067647;
    --mc-radius: 12px;
    --mc-focus: 0 0 0 3px rgba(28, 129, 197, .16);
}

*, *::before, *::after { box-sizing: border-box; }

/* Author `display` rules on a class (e.g. .auth-control, .auth-otp-inputs)
   always win over the UA default [hidden]{display:none}, regardless of
   selector specificity — so any element that's both toggled via the
   `hidden` attribute/property and styled by a class setting `display`
   would silently stay visible without this override. */
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--mc-text);
    background:
        radial-gradient(circle at 12% 10%, rgba(28, 129, 197, .09), transparent 30rem),
        var(--mc-background);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
a { color: var(--mc-primary); text-underline-offset: 3px; }
a:hover { color: var(--mc-primary-hover); }

.auth-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
}

.auth-container { width: min(100%, 440px); }
.auth-container--wide { width: min(100%, 860px); }

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: var(--mc-text);
    font-weight: 750;
    text-decoration: none;
}

.auth-brand img { display: block; width: 156px; height: auto; object-fit: contain; }

.auth-card {
    position: relative;
    padding: 32px;
    border: 1px solid #e3e7ee;
    border-radius: 16px;
    background: var(--mc-surface);
    box-shadow: 0 16px 48px rgba(16, 24, 40, .08);
}

.auth-card__language {
    display: flex;
    justify-content: flex-end;
    margin: -10px -10px 8px;
}

.auth-card + .auth-card { margin-top: 18px; }
.auth-header { margin-bottom: 26px; text-align: center; }
.auth-title { margin: 0; font-size: clamp(1.55rem, 4vw, 1.9rem); line-height: 1.2; letter-spacing: -.025em; }
.auth-subtitle { margin: 9px 0 0; color: var(--mc-muted); }
.auth-account { margin: 18px 0; padding: 10px 14px; border-radius: 9px; background: #f6f8fc; text-align: center; overflow-wrap: anywhere; }

.auth-field { margin-bottom: 18px; }
.auth-label { display: inline-block; margin-bottom: 7px; color: #344054; font-size: 14px; font-weight: 650; }
.auth-hint { margin: 6px 0 0; color: var(--mc-muted); font-size: 13px; }
.auth-control {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--mc-border);
    border-radius: 9px;
    outline: 0;
    color: var(--mc-text);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea.auth-control { min-height: 110px; resize: vertical; }
.auth-control::placeholder { color: #98a2b3; }
.auth-control:hover { border-color: #b6bfce; }
.auth-control:focus { border-color: var(--mc-primary); box-shadow: var(--mc-focus); }
.auth-control[readonly], .auth-control:disabled { color: #667085; background: #f2f4f7; cursor: not-allowed; }
.auth-control.is-invalid, .auth-control[aria-invalid="true"] { border-color: #d92d20; }
.auth-error { display: block; margin-top: 6px; color: var(--mc-danger); font-size: 13px; }

.auth-check { display: flex; align-items: flex-start; gap: 9px; margin: 4px 0 18px; color: #344054; cursor: pointer; }
.auth-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--mc-primary); flex: 0 0 auto; }

.auth-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.auth-button:focus-visible, .auth-link-button:focus-visible { outline: 0; box-shadow: var(--mc-focus); }
.auth-button:disabled { opacity: .58; cursor: not-allowed; }
.auth-button--block { width: 100%; }
.auth-button--primary { color: #fff; background: var(--mc-primary); border-color: var(--mc-primary); }
.auth-button--primary:hover { color: #fff; background: var(--mc-primary-hover); border-color: var(--mc-primary-hover); }
.auth-button--secondary { color: #344054; background: #fff; border-color: var(--mc-border); }
.auth-button--secondary:hover { color: var(--mc-text); background: #f8f9fc; border-color: #b6bfce; }
.auth-provider-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.auth-button--danger { color: #fff; background: #d92d20; border-color: #d92d20; }
.auth-button--danger:hover { color: #fff; background: #b42318; border-color: #b42318; }
.auth-link-button { padding: 3px 0; border: 0; color: var(--mc-primary); background: transparent; cursor: pointer; }

.auth-alert { margin-bottom: 18px; padding: 12px 14px; border: 1px solid; border-radius: 9px; font-size: 14px; }
.auth-alert--danger { color: var(--mc-danger); border-color: #fecdca; background: #fef3f2; }
.auth-alert--success { color: var(--mc-success); border-color: #abefc6; background: #ecfdf3; }
.auth-alert--info { color: #175cd3; border-color: #b2ddff; background: #eff8ff; }
.auth-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; font-size: 14px; }
.auth-links--login {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 10px;
    font-size: 13px;
    justify-content: space-between;
    white-space: nowrap;
}
.auth-links--login > *,
.auth-links--login a { min-width: 0; white-space: nowrap; }
.auth-links--center { justify-content: center; }
.auth-actions--start { justify-content: flex-start; }
.auth-copy { color: var(--mc-muted); }
.auth-copy--compact { margin-bottom: 0; }
.auth-form-spaced { margin-top: 20px; }
.auth-form-spaced-sm { margin-top: 12px; }
.auth-code-control { max-width: 320px; letter-spacing: .15em; }
.auth-code-control--center { max-width: none; text-align: center; font-size: 20px; letter-spacing: .16em; }
.auth-otp-rules { display: grid; gap: 6px; margin: -4px 0 16px; color: var(--mc-muted); font-size: 13px; }
.auth-otp-rules span { display: flex; align-items: center; gap: 7px; }
.auth-otp-inputs { display: grid; grid-template-columns: repeat(6, minmax(38px, 1fr)); gap: 8px; }
.auth-otp-input {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--mc-border);
    border-radius: 11px;
    background: #fff;
    color: var(--mc-text);
    font-size: 20px;
    font-weight: 750;
    text-align: center;
    outline: 0;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.auth-otp-input:focus { border-color: var(--mc-primary); box-shadow: var(--mc-focus); transform: translateY(-1px); }
.auth-steps { padding-left: 20px; color: var(--mc-muted); }
.auth-username-control { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--mc-border); border-radius: 9px; background: #fff; }
.auth-username-control:focus-within { border-color: var(--mc-primary); box-shadow: var(--mc-focus); }
.auth-username-prefix { padding: 10px 0 10px 12px; color: var(--mc-muted); white-space: nowrap; }
.auth-username-input { padding-left: 2px; border: 0; box-shadow: none !important; }
.auth-available { color: var(--mc-success); }
.auth-disclosure { margin-top: 10px; }
.auth-disclosure > summary { list-style: none; }
.auth-disclosure > summary::-webkit-details-marker { display: none; }
.auth-disclosure__body { padding: 18px 0 4px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #98a2b3; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: #eaecf0; }
.auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.auth-section-title { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.auth-section-copy { margin: 5px 0 20px; color: var(--mc-muted); }
.auth-status { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 13px; font-weight: 650; }
.auth-status--on { color: var(--mc-success); background: #dcfae6; }
.auth-status--off { color: #475467; background: #f2f4f7; }

.auth-method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.auth-method-card {
    position: relative;
    min-width: 0;
    min-height: 82px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--mc-border);
    border-radius: 12px;
    color: #344054;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.auth-method-card:hover { border-color: #98a2b3; }
.auth-method-card.is-selected { border-color: var(--mc-primary); box-shadow: 0 0 0 3px rgba(28, 129, 197, .10); background: #f7fbff; }
.auth-method-card__icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--mc-primary); background: #eff8ff; font-size: 20px; }
.auth-method-card strong, .auth-method-card small { display: block; }
.auth-method-card small { margin-top: 2px; color: var(--mc-muted); font-size: 11px; line-height: 1.35; }
.auth-method-card__radio { width: 18px; height: 18px; border: 2px solid #cbd5e1; border-radius: 50%; }
.auth-method-card.is-selected .auth-method-card__radio { border: 5px solid var(--mc-primary); }
.auth-reset-secondary-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; font-size: 13px; }
.auth-resend { display: grid; gap: 12px; margin-top: 18px; padding: 14px; border: 1px solid #e4e7ec; border-radius: 11px; background: #f8fafc; }
.auth-resend__copy { display: grid; gap: 2px; }
.auth-resend__copy strong { color: #344054; font-size: 14px; }
.auth-resend__copy span { color: var(--mc-muted); font-size: 12px; }
.auth-resend .auth-button { min-height: 40px; font-size: 13px; }

.auth-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.45); border-top-color: currentColor; border-radius: 50%; animation: auth-spin .7s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
    .auth-shell { align-items: start; padding: 24px 14px; }
    .auth-card { padding: 24px 20px; border-radius: 14px; }
    .auth-card__language { margin: -5px -2px 8px; }
    .auth-grid { grid-template-columns: 1fr; }
    .auth-method-grid { grid-template-columns: 1fr; }
    .auth-reset-secondary-actions { align-items: flex-start; flex-direction: column; }
    .auth-actions { align-items: stretch; flex-direction: column-reverse; }
    .auth-actions .auth-button { width: 100%; }
    .auth-links { align-items: flex-start; flex-direction: column; }
    .auth-links--login {
        align-items: center;
        display: grid;
        gap: 8px;
        font-size: clamp(10px, 3vw, 13px);
        grid-template-columns: max-content max-content;
        justify-content: space-between;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
/* Shared country-aware phone input */
.auth-phone-control {
    display: flex;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.auth-phone-control:focus-within {
    border-color: #2689c9;
    box-shadow: 0 0 0 4px rgba(38, 137, 201, .12);
}
.auth-phone-control.is-invalid,
.auth-phone-control:has(.auth-control.is-invalid) {
    border-color: #d92d20;
}
.auth-phone-prefix {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 0 12px;
    border-right: 1px solid #e4e7ec;
    color: #344054;
    background: #f8fafc;
    font-weight: 700;
}
.auth-phone-prefix[hidden] { display: none; }
.auth-phone-prefix__flag { font-size: 1.25rem; line-height: 1; }
.auth-phone-country {
    width: 92px;
    border: 0;
    outline: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
}
.auth-phone-control > .auth-control,
.auth-phone-control > .auth-control:focus,
.auth-phone-control > .auth-control.is-invalid {
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
