.ap-signin-body {
    min-width: 320px;
    overflow-x: hidden;
    color: #101b3d;
    background: #f7f8fa;
}

.ap-signin-shell {
    display: grid;
    grid-template-columns: minmax(0, 58.4fr) minmax(480px, 41.6fr);
    min-height: 100vh;
    direction: ltr;
}

.ap-signin-hero {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background-color: #062b5f;
    background-image: url('../images/almarai-parts/main-page-reference.png');
    background-repeat: no-repeat;
    background-position: left top;
    background-size: auto 100%;
}

.ap-signin-hero::after {
    content: "";
    position: absolute;
    inset: 0 0 0 auto;
    width: 2px;
    background: linear-gradient(180deg, rgba(255,255,255,.32), rgba(255,255,255,.04));
}

.ap-signin-secure-link {
    position: absolute;
    z-index: 2;
    top: 3.8vh;
    left: 2.35vw;
    width: 12.4vw;
    height: 4.25vh;
    min-width: 145px;
    min-height: 31px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    font-size: 0;
    text-decoration: none;
}

.ap-signin-secure-link:hover {
    background: rgba(64, 151, 255, .08);
}

.ap-signin-secure-link:focus-visible { outline: 3px solid rgba(117, 203, 255, .72); outline-offset: 3px; }

.ap-signin-secure-link svg,
.ap-signin-secure-link span { visibility: hidden; }

.ap-signin-access {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 100vh;
    place-items: center;
    padding: clamp(76px, 9vh, 104px) clamp(24px, 4vw, 70px) clamp(28px, 5vh, 58px);
    background:
        radial-gradient(circle at 52% 7%, rgba(211, 218, 229, .27), transparent 31%),
        linear-gradient(135deg, #fafafa 0%, #f5f6f8 52%, #fff 100%);
}

.ap-language-switch {
    position: absolute;
    z-index: 3;
    top: clamp(24px, 3.1vh, 35px);
    right: clamp(28px, 3.4vw, 48px);
    display: flex;
    align-items: center;
    min-height: 39px;
    padding: 3px 6px;
    border: 1px solid #d1d5de;
    border-radius: 11px;
    background: rgba(255,255,255,.74);
    box-shadow: 0 5px 20px rgba(48, 58, 80, .04);
    backdrop-filter: blur(8px);
}

.ap-language-switch button {
    min-width: 78px;
    min-height: 31px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    color: #4a5060;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
}

.ap-language-switch button.is-active { color: #0025b4; font-weight: 800; }
.ap-language-switch button:hover { color: #0025b4; background: #f4f6fb; }
.ap-language-switch > span { width: 1px; height: 17px; background: #7c818c; }

.ap-signin-card {
    width: min(100%, 620px);
    padding: clamp(25px, 3.6vh, 40px) clamp(30px, 3.4vw, 58px) clamp(21px, 3vh, 34px);
    border: 1px solid rgba(210, 214, 222, .68);
    border-radius: 12px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 18px 42px rgba(18, 27, 48, .17);
}

.ap-signin-branding { display: grid; justify-items: center; }

.ap-signin-almarai-logo {
    display: block;
    width: min(57%, 250px);
    max-height: 132px;
    object-fit: contain;
}

.ap-signin-brand-divider {
    width: 100%;
    height: 1px;
    margin: 12px 0 17px;
    background: #c7cbd3;
}

.ap-signin-partner-logos {
    display: grid;
    grid-template-columns: minmax(95px, .8fr) 1px minmax(150px, 1.35fr);
    align-items: center;
    width: 91%;
    min-height: 70px;
    gap: 22px;
}

.ap-signin-partner-logos img {
    display: block;
    width: 100%;
    max-height: 64px;
    object-fit: contain;
}

.ap-signin-partner-logos > span { width: 1px; height: 54px; background: #c9cdd5; }

.ap-signin-heading { margin-top: clamp(18px, 2.7vh, 28px); }
.ap-signin-heading h2 { margin: 0; color: #111b3f; font-size: clamp(24px, 1.8vw, 30px); font-weight: 800; letter-spacing: -.035em; line-height: 1.16; }
.ap-signin-heading p { margin: 5px 0 0; color: #596078; font-size: 14px; font-weight: 400; line-height: 1.45; }

.ap-signin-alert {
    margin-top: 13px;
    padding: 10px 12px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}
.ap-signin-alert-error { color: #9d2638; border-color: #efbec6; background: #fff3f5; }
.ap-signin-alert-success { color: #236d33; border-color: #bce1c4; background: #f1faf3; }

.ap-signin-form { display: grid; gap: 13px; margin-top: 17px; }

.ap-signin-control {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 53px;
    border: 1px solid #c7cbd3;
    border-radius: 8px;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.ap-signin-control:focus-within {
    border-color: #0d38c6;
    box-shadow: 0 0 0 3px rgba(14, 55, 198, .12);
}

.ap-signin-control > svg {
    flex: 0 0 auto;
    width: 23px;
    height: 23px;
    margin-left: 16px;
    fill: none;
    stroke: #4f5871;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ap-signin-control input {
    width: 100%;
    min-width: 0;
    min-height: 51px;
    padding: 0 14px;
    border: 0;
    outline: 0;
    color: #17213f;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
}
.ap-signin-control input::placeholder { color: #969bad; opacity: 1; }

.ap-password-toggle {
    display: grid;
    flex: 0 0 auto;
    width: 50px;
    height: 51px;
    place-items: center;
    border: 0;
    border-radius: 0 8px 8px 0;
    color: #4d5872;
    background: transparent;
}
.ap-password-toggle:hover { color: #0c35be; background: #f5f7fb; }
.ap-password-toggle svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ap-password-toggle .ap-eye-closed { display: none; }
.ap-password-toggle.is-visible .ap-eye-open { display: none; }
.ap-password-toggle.is-visible .ap-eye-closed { display: block; }

.ap-signin-field-error { margin: -8px 2px 0; color: #b32e42; font-size: 11px; font-weight: 600; }

.ap-signin-options { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 1px; }

.ap-remember-control { display: inline-flex; align-items: center; gap: 8px; color: #424a63; cursor: pointer; }
.ap-remember-control input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.ap-remember-control > span { display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid #c0c6d0; border-radius: 3px; background: #fff; }
.ap-remember-control input:checked + span { border-color: #0b38c6; background: #0b38c6; }
.ap-remember-control input:checked + span::after { content: ""; width: 7px; height: 4px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.ap-remember-control input:focus-visible + span { outline: 3px solid rgba(41,166,216,.27); outline-offset: 2px; }
.ap-remember-control b { font-size: 12px; font-weight: 500; }

.ap-forgot-button { padding: 3px 0; border: 0; color: #0027bc; background: transparent; font-size: 12px; font-weight: 600; }
.ap-forgot-button:hover { text-decoration: underline; }

.ap-signin-submit {
    display: grid;
    grid-template-columns: 1fr 69px;
    align-items: stretch;
    width: 100%;
    min-height: 57px;
    margin-top: 5px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(90deg, #0731c4, #0024ad);
    box-shadow: 0 10px 22px rgba(6, 45, 184, .17);
    font-size: 16px;
    font-weight: 600;
    transition: box-shadow .18s ease, transform .18s ease;
}
.ap-signin-submit > span { display: grid; place-items: center; padding-left: 69px; }
.ap-signin-submit > b { display: grid; place-items: center; background: linear-gradient(135deg, #41aa37, #2d922c); }
.ap-signin-submit svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ap-signin-submit:hover { box-shadow: 0 13px 26px rgba(6, 45, 184, .25); transform: translateY(-1px); }
.ap-signin-submit:active { transform: translateY(0); }

.ap-signin-support {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 17px 0 0;
    color: #4e566e;
    font-size: 12px;
    line-height: 1.45;
}
.ap-signin-support svg { width: 19px; height: 19px; margin-right: 2px; fill: none; stroke: #536078; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ap-signin-support a { color: #002cc4; font-weight: 600; text-decoration: none; }
.ap-signin-support a:hover { text-decoration: underline; }

.ap-signin-authorized {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 69px;
    margin-top: 20px;
    padding: 12px 20px;
    border: 1px solid #d5d9e1;
    border-radius: 8px;
    color: #0730be;
    background: #f8f9fb;
    text-align: center;
}
.ap-signin-authorized svg { flex: 0 0 auto; width: 35px; height: 35px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ap-signin-authorized strong { font-size: 13px; font-weight: 600; }
.ap-signin-credit { margin: 11px 0 0; color: #9298a7; font-size: 9px; font-weight: 500; letter-spacing: .025em; text-align: center; }

.ap-signin-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.ap-recovery-dialog {
    width: min(92vw, 480px);
    max-width: none;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 14px;
    color: #17213f;
    background: transparent;
}
.ap-recovery-dialog::backdrop { background: rgba(4, 18, 47, .63); backdrop-filter: blur(5px); }
.ap-recovery-window { position: relative; padding: 34px; border: 1px solid rgba(215,218,226,.9); border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(0,13,43,.32); text-align: center; }
.ap-recovery-close { position: absolute; top: 12px; right: 14px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #d9dde5; border-radius: 8px; color: #5d6475; background: #fff; font-size: 22px; line-height: 1; }
.ap-recovery-close:hover { color: #0a31bb; border-color: #8fa4dc; }
.ap-recovery-icon { display: grid; width: 56px; height: 56px; margin: 0 auto 17px; place-items: center; border-radius: 16px; color: #0a35c6; background: #eef3ff; }
.ap-recovery-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ap-recovery-window h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.ap-recovery-window p { margin: 11px 0 23px; color: #626b80; font-size: 13px; line-height: 1.65; }
.ap-recovery-email, .ap-recovery-cancel { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; border-radius: 8px; font-size: 13px; font-weight: 700; text-decoration: none; }
.ap-recovery-email { color: #fff; background: #0731c4; }
.ap-recovery-email:hover { background: #00239f; }
.ap-recovery-cancel { margin-top: 9px; border: 1px solid #d2d7e0; color: #3e475b; background: #fff; }
.ap-recovery-cancel:hover { color: #0731c4; border-color: #9bacd7; background: #f8f9fc; }

html[dir="rtl"] .ap-signin-card,
html[dir="rtl"] .ap-recovery-window { direction: rtl; }
html[dir="rtl"] .ap-signin-control > svg { margin-right: 16px; margin-left: 0; }
html[dir="rtl"] .ap-password-toggle { border-radius: 8px 0 0 8px; }
html[dir="rtl"] .ap-signin-submit > span { padding-right: 69px; padding-left: 0; }
html[dir="rtl"] .ap-signin-support svg { margin-right: 0; margin-left: 2px; }
html[dir="rtl"] .ap-recovery-close { right: auto; left: 14px; }

@media (min-aspect-ratio: 11/5) and (min-width: 981px) {
    .ap-signin-hero { background-size: auto 116%; }
}

@media (max-width: 1180px) {
    .ap-signin-shell { grid-template-columns: minmax(0, 52fr) minmax(470px, 48fr); }
    .ap-signin-access { padding-right: 28px; padding-left: 28px; }
    .ap-signin-card { padding-right: 34px; padding-left: 34px; }
}

@media (max-width: 980px) {
    .ap-signin-shell { grid-template-columns: 1fr; }
    .ap-signin-hero { min-height: clamp(300px, 43vw, 440px); background-position: left top; background-size: 170.7% 100%; }
    .ap-signin-access { min-height: auto; padding: 82px 22px 36px; }
    .ap-language-switch { top: 22px; right: 22px; }
    .ap-signin-card { width: min(100%, 610px); }
}

@media (max-width: 620px) {
    .ap-signin-hero { min-height: 270px; }
    .ap-signin-secure-link { top: 4%; left: 4%; width: 24%; height: 8%; min-width: 0; min-height: 0; }
    .ap-signin-access { padding: 75px 13px 20px; }
    .ap-language-switch { top: 18px; right: 14px; }
    .ap-language-switch button { min-width: 66px; font-size: 12px; }
    .ap-signin-card { padding: 25px 20px 20px; border-radius: 10px; }
    .ap-signin-almarai-logo { width: min(62%, 220px); }
    .ap-signin-partner-logos { width: 100%; grid-template-columns: minmax(82px, .8fr) 1px minmax(128px, 1.35fr); gap: 14px; }
    .ap-signin-heading h2 { font-size: 24px; }
    .ap-signin-heading p { font-size: 13px; }
    .ap-signin-submit { min-height: 53px; grid-template-columns: 1fr 57px; }
    .ap-signin-submit > span { padding-left: 57px; }
    html[dir="rtl"] .ap-signin-submit > span { padding-right: 57px; padding-left: 0; }
    .ap-signin-authorized { min-height: 62px; gap: 10px; padding: 10px 12px; }
    .ap-signin-authorized svg { width: 29px; height: 29px; }
    .ap-recovery-window { padding: 30px 21px 23px; }
}

@media (max-height: 760px) and (min-width: 981px) {
    .ap-signin-access { padding-top: 67px; padding-bottom: 18px; }
    .ap-signin-card { padding-top: 22px; padding-bottom: 17px; }
    .ap-signin-almarai-logo { max-height: 88px; }
    .ap-signin-brand-divider { margin-top: 7px; margin-bottom: 10px; }
    .ap-signin-partner-logos { min-height: 54px; }
    .ap-signin-partner-logos img { max-height: 50px; }
    .ap-signin-partner-logos > span { height: 44px; }
    .ap-signin-heading { margin-top: 12px; }
    .ap-signin-form { margin-top: 12px; gap: 10px; }
    .ap-signin-control, .ap-signin-control input, .ap-password-toggle { min-height: 47px; height: 47px; }
    .ap-signin-submit { min-height: 49px; }
    .ap-signin-support { margin-top: 11px; }
    .ap-signin-authorized { min-height: 56px; margin-top: 12px; }
    .ap-signin-credit { margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .ap-signin-secure-link,
    .ap-signin-submit { transition: none; }
}
