:root {
    --gk-auth-primary: var(--gk-primary, #ef394e);
    --gk-auth-primary-hover: #d92f43;
    --gk-auth-text: var(--gk-text, #172033);
    --gk-auth-muted: #667085;
    --gk-auth-border: #e4e7ec;
    --gk-auth-surface: #fff;
    --gk-auth-soft: #f8fafc;
    --gk-auth-error: #c62828;
    --gk-auth-success: #087f5b;
}

.gk-auth-inline,
.gk-auth-overlay,
.gk-auth-page,
.gk-mobile-change {
    direction: rtl;
    font-family: inherit;
}

.gk-auth-inline *,
.gk-auth-overlay *,
.gk-auth-page *,
.gk-mobile-change * { box-sizing: border-box; }

.gk-auth-inline {
    width: 100%;
    display: flex;
    justify-content: center;
}

.gk-auth-card {
    position: relative;
    width: min(100%, 430px);
    padding: 30px;
    border: 1px solid var(--gk-auth-border);
    border-radius: 20px;
    background: var(--gk-auth-surface);
    box-shadow: 0 18px 50px rgba(16, 24, 40, .10);
}

.gk-auth-header { margin-bottom: 22px; text-align: center; }
.gk-auth-brand { min-height: 38px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: var(--gk-auth-text); }
.gk-auth-brand .custom-logo-link { display: inline-flex; }
.gk-auth-brand img { display: block; width: auto; max-width: 150px; max-height: 48px; object-fit: contain; }
.gk-auth-title { margin: 0; color: var(--gk-auth-text); font-size: 21px; line-height: 1.5; font-weight: 800; }
.gk-auth-description { margin: 7px 0 0; color: var(--gk-auth-muted); font-size: 13px; line-height: 1.9; }

.gk-auth-close {
    position: absolute;
    inset: 15px auto auto 15px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--gk-auth-border);
    border-radius: 50%;
    background: #fff;
    color: #475467;
    cursor: pointer;
}
.gk-auth-close:hover { color: var(--gk-auth-text); background: var(--gk-auth-soft); }
.gk-auth-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.gk-auth-step[hidden] { display: none !important; }
.gk-auth-step.is-active { animation: gk-auth-enter .18s ease-out; }
@keyframes gk-auth-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.gk-auth-label { display: block; margin: 0 0 8px; color: var(--gk-auth-text); font-size: 13px; font-weight: 700; }
.gk-auth-input-wrap { position: relative; }
.gk-auth-input-wrap > svg {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    fill: none;
    stroke: #98a2b3;
    stroke-width: 1.7;
    pointer-events: none;
}
.gk-auth-input {
    display: block;
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--gk-auth-border);
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: var(--gk-auth-text);
    font: inherit;
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.gk-auth-input-wrap .gk-auth-input { padding-right: 44px; }
.gk-auth-input:hover { border-color: #cfd4dc; }
.gk-auth-input:focus { border-color: var(--gk-auth-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gk-auth-primary) 13%, transparent); }
.gk-auth-help { margin: 8px 0 16px; color: var(--gk-auth-muted); font-size: 12px; line-height: 1.8; }

.gk-auth-check { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; color: #475467; font-size: 12px; cursor: pointer; }
.gk-auth-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--gk-auth-primary); }

.gk-auth-primary {
    position: relative;
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--gk-auth-primary);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s, transform .15s;
}
.gk-auth-primary:hover:not(:disabled) { background: var(--gk-auth-primary-hover); }
.gk-auth-primary:active:not(:disabled) { transform: translateY(1px); }
.gk-auth-primary:disabled { opacity: .65; cursor: wait; }
.gk-auth-spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.38); border-top-color: #fff; border-radius: 50%; animation: gk-auth-spin .7s linear infinite; }
.gk-auth-primary.is-loading [data-button-label] { opacity: .55; }
.gk-auth-primary.is-loading .gk-auth-spinner { display: inline-block; }
@keyframes gk-auth-spin { to { transform: rotate(360deg); } }

.gk-auth-alert { min-height: 0; margin: 0; border-radius: 10px; font-size: 12px; line-height: 1.8; text-align: right; }
.gk-auth-alert.is-error,
.gk-auth-alert.is-success { min-height: auto; margin-bottom: 14px; padding: 9px 11px; }
.gk-auth-alert.is-error { color: var(--gk-auth-error); background: #fff1f1; border: 1px solid #ffd6d6; }
.gk-auth-alert.is-success { color: var(--gk-auth-success); background: #ecfdf3; border: 1px solid #c5f2d7; }

.gk-auth-legal { margin: 13px 0 0; color: var(--gk-auth-muted); font-size: 11px; line-height: 1.8; text-align: center; }
.gk-auth-legal a { color: var(--gk-auth-text); text-decoration: underline; text-underline-offset: 3px; }
.gk-auth-password-link { display: block; margin-top: 15px; color: var(--gk-auth-primary); font-size: 12px; font-weight: 700; text-align: center; text-decoration: none; }
.gk-auth-password-link:hover { text-decoration: underline; }
.gk-auth-hp { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; }

.gk-auth-code-note { margin: 0 0 18px; color: var(--gk-auth-muted); font-size: 13px; line-height: 1.9; text-align: center; }
.gk-auth-code-note b { color: var(--gk-auth-text); }
.gk-auth-edit { margin-right: 6px; padding: 0; border: 0; background: none; color: var(--gk-auth-primary); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.gk-auth-otp-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.gk-auth-otp { display: flex; justify-content: center; gap: 7px; margin-bottom: 18px; }
.gk-otp-input {
    width: min(48px, calc((100% - 35px) / 6));
    min-width: 0;
    height: 50px;
    padding: 0;
    border: 1px solid var(--gk-auth-border);
    border-radius: 10px;
    outline: none;
    background: var(--gk-auth-soft);
    color: var(--gk-auth-text);
    font: inherit;
    font-size: 20px;
    font-weight: 800;
    text-align: center;
}
.gk-otp-input:focus { border-color: var(--gk-auth-primary); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gk-auth-primary) 12%, transparent); }
.gk-auth-timer-row { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-bottom: 14px; color: var(--gk-auth-muted); font-size: 12px; }
.gk-auth-timer-row [data-gk-sms-login-timer] { direction: ltr; font-variant-numeric: tabular-nums; }
.gk-auth-resend { padding: 4px 0; border: 0; background: none; color: var(--gk-auth-primary); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.gk-auth-resend:disabled { color: #98a2b3; cursor: default; }

.gk-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 20px;
    overflow-y: auto;
    background: rgba(16, 24, 40, .58);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s, visibility .18s;
}
.gk-auth-overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
.gk-auth-dialog { width: min(100%, 430px); outline: none; transform: translateY(8px) scale(.985); transition: transform .18s; }
.gk-auth-overlay.is-open .gk-auth-dialog { transform: none; }
.gk-auth-overlay .gk-auth-card { width: 100%; }
body.gk-auth-modal-open { overflow: hidden !important; }

.gk-auth-page { width: min(100%, 980px); margin: 24px auto; }
.gk-auth-page__tabs { width: min(100%, 520px); margin: 0 auto 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; border: 1px solid var(--gk-auth-border); border-radius: 13px; background: #fff; }
.gk-auth-page__tab { min-height: 42px; padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--gk-auth-muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.gk-auth-page__tab.is-active { background: var(--gk-auth-soft); color: var(--gk-auth-text); }
.gk-auth-page__panel[hidden] { display: none !important; }
.gk-auth-page__panel--password { width: min(100%, 760px); margin: auto; }
.gk-auth-page__panel--password .u-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.gk-auth-page__panel--password form.login,
.gk-auth-page__panel--password form.register { margin: 0; padding: 24px; border: 1px solid var(--gk-auth-border); border-radius: 18px; background: #fff; }

.gk-auth-logged-in { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--gk-auth-border); border-radius: 14px; background: #fff; }
.gk-auth-logged-in img { border-radius: 50%; }
.gk-auth-logged-in div { display: grid; gap: 4px; }
.gk-auth-logged-in a { color: var(--gk-auth-primary); font-size: 12px; }

.gk-mobile-change { margin: 18px 0 26px; padding: 18px; border: 1px solid var(--gk-auth-border); border-radius: 14px; background: #fff; }
.gk-mobile-change__summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.gk-mobile-change__summary > div { display: grid; gap: 5px; }
.gk-mobile-change__summary span { color: var(--gk-auth-muted); font-size: 13px; }
.gk-mobile-change__form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--gk-auth-border); }
.gk-mobile-change__actions { display: flex; gap: 8px; margin-top: 12px; }
.gk-mobile-change__otp { margin-top: 15px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.gk-mobile-change__otp .gk-auth-label { grid-column: 1 / -1; }

.gk-sms-login-wrapper-centered { width: 100%; padding: 28px 0; }
.gk-sms-login-box-container { width: min(100%, 480px); margin: auto; }
.gk-sms-login-title { margin: 0 0 7px; color: var(--gk-auth-text); font-size: 22px; font-weight: 800; text-align: center; }
.gk-sms-login-subtitle { margin: 0 0 20px; color: var(--gk-auth-muted); font-size: 13px; text-align: center; }

@media (max-width: 767px) {
    .gk-auth-overlay { align-items: end; padding: 0; }
    .gk-auth-dialog { width: 100%; }
    .gk-auth-card { padding: 25px 20px max(22px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
    .gk-auth-inline .gk-auth-card { border-radius: 16px; }
    .gk-auth-page__panel--password .u-columns { grid-template-columns: 1fr; }
    .gk-auth-otp { gap: 5px; }
    .gk-otp-input { height: 46px; font-size: 18px; border-radius: 8px; }
    .gk-mobile-change__summary { align-items: flex-start; flex-direction: column; }
    .gk-mobile-change__otp { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .gk-auth-step.is-active,
    .gk-auth-overlay,
    .gk-auth-dialog { animation: none; transition: none; }
}

.gk-recovery-setup {
    direction: rtl;
    margin: 18px 0 24px;
    padding: 20px;
    border: 1px solid #f2d18a;
    border-radius: 16px;
    background: #fffaf0;
}
.gk-recovery-setup * { box-sizing: border-box; }
.gk-recovery-setup__head { margin-bottom: 16px; }
.gk-recovery-setup__head strong { display: block; color: var(--gk-auth-text); font-size: 15px; }
.gk-recovery-setup__head p { margin: 5px 0 0; color: var(--gk-auth-muted); font-size: 12px; line-height: 1.9; }
.gk-recovery-setup__fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.gk-recovery-setup__fields label { min-width: 0; }
.gk-recovery-setup__fields label > span { display: block; margin-bottom: 7px; color: var(--gk-auth-text); font-size: 12px; font-weight: 700; }
.gk-mobile-change__timer { grid-column: 1 / -1; color: var(--gk-auth-muted); font-size: 11px; }
.gk-mobile-change .button.is-loading,
.gk-recovery-setup .button.is-loading { opacity: .65; cursor: wait; }

@media (max-width: 767px) {
    .gk-recovery-setup { padding: 16px; }
    .gk-recovery-setup__fields { grid-template-columns: 1fr; }
}
