.ma-auth {
    --ma-ink: #13233a;
    --ma-muted: #4c5d72;
    --ma-line: #d9e1e9;
    --ma-surface: #fff;
    --ma-action: #173657;
    min-block-size: 100svh;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 4vw, 3.75rem);
    background: #eff3f6;
    color: var(--ma-ink);
    text-align: start;
    font-family: Tajawal, "Segoe UI", Arial, sans-serif;
}
.ma-auth:lang(en) { font-family: "Segoe UI", Arial, sans-serif; }
.ma-auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
    inline-size: min(100%, 70rem);
    min-block-size: 39rem;
    background: var(--ma-surface);
    border: 1px solid var(--ma-line);
    border-radius: 1.35rem;
    overflow: hidden;
    box-shadow: 0 20px 55px rgb(23 54 87 / 9%);
}
.ma-auth-content {
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
    padding: clamp(1.65rem, 4vw, 3rem);
}
.ma-auth-top, .ma-auth-brand {
    display: flex;
    align-items: center;
    gap: .8rem;
}
.ma-auth-top { justify-content: space-between; }
.ma-auth-brand {
    color: var(--ma-ink);
    font: 650 clamp(.85rem, 1.4vw, 1rem)/1.15 "Segoe UI", Arial, sans-serif;
    white-space: nowrap;
}
.ma-auth-brand strong { color: #52647a; font-weight: 600; }
.ma-auth-mark {
    display: grid;
    place-items: center;
    inline-size: 2.55rem;
    block-size: 2.55rem;
    border-radius: .7rem;
    background: #142d49;
    color: #f6dfb7;
    font: 700 .88rem/1 "Segoe UI", Arial, sans-serif;
}
.ma-auth .ma-auth-language {
    display: inline-grid;
    place-items: center;
    min-block-size: 2.55rem;
    padding-inline: .7rem;
    border: 1px solid var(--ma-line);
    border-radius: .6rem;
    color: var(--ma-action);
    font-weight: 650;
    text-decoration: none;
}
.ma-auth-language:hover { background: #f0f4f8; }
.ma-auth-body {
    inline-size: min(100%, 24rem);
    margin: auto;
    padding-block-start: 2.2rem;
}
.ma-auth h1 {
    margin: 0;
    color: var(--ma-ink);
    font-size: clamp(1.9rem, 3.15vw, 2.85rem);
    line-height: 1.15;
    letter-spacing: -.04em;
}
.ma-auth:lang(ar) h1 { letter-spacing: normal; }
.ma-auth h1:focus { outline: none; }
.ma-auth-description { margin-block: .65rem 1.45rem; color: var(--ma-muted); line-height: 1.55; }
.ma-auth-form { display: grid; gap: .85rem; margin: 0; }
.ma-auth-field { display: grid; gap: .31rem; min-inline-size: 0; }
.ma-auth label { color: var(--ma-ink); font-size: .93rem; font-weight: 680; }
.ma-auth input:not([type=hidden]) {
    inline-size: 100%;
    min-block-size: 2.85rem;
    padding: .6rem .8rem;
    border: 1px solid #bac8d5;
    border-radius: .63rem;
    background: #fbfcfe;
    box-sizing: border-box;
    color: var(--ma-ink);
    font: 1rem/1.3 "Segoe UI", Arial, sans-serif;
    text-align: left;
}
.ma-auth input::placeholder { color: #637489; }
.ma-auth input:hover { border-color: #8da4b8; }
.ma-auth input:focus { border-color: #345f86; background: white; }
.ma-auth :is(input, button, a):focus-visible { outline: 2px solid #276192; outline-offset: 3px; }
.ma-auth-hint { color: var(--ma-muted); font-size: .83rem; }
.ma-auth .ma-auth-submit {
    min-block-size: 3rem;
    margin-block-start: .25rem;
    padding: .65rem 1rem;
    border: 1px solid var(--ma-action);
    border-radius: .65rem;
    background: var(--ma-action);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.ma-auth .ma-auth-submit:hover { background: #234d75; }
.ma-auth-notice {
    margin-block: 0 1rem;
    padding: .65rem .85rem;
    border: 1px solid #c6d7e5;
    border-radius: .6rem;
    background: #edf5fb;
    color: #214965;
}
.ma-auth-notice[role=alert] { border-color: #edd3d2; background: #fcf1f0; color: #842f37; }
.ma-auth .ma-auth-footer {
    display: inline-block;
    margin-block-start: 1rem;
    color: var(--ma-action);
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: .2em;
}
.ma-auth-photo {
    background: #172842 url("images/ma-erp-login-lobby.jpg") center 58% / cover no-repeat;
}
.ma-auth-activation .ma-auth-photo {
    background-image: url("images/ma-erp-activation-skyline.jpg");
}
@media (min-width: 761px) and (max-height: 740px) {
    .ma-auth { padding-block: 1rem; }
    .ma-auth-shell { min-block-size: min(35rem, calc(100svh - 2rem)); }
    .ma-auth-content { padding-block: 1.3rem; }
    .ma-auth-body { padding-block-start: 1.25rem; }
    .ma-auth-description { margin-block-end: .95rem; }
    .ma-auth-form { gap: .65rem; }
    .ma-auth input:not([type=hidden]) { min-block-size: 2.65rem; }
}
@media (max-width: 760px) {
    .ma-auth { align-items: start; padding: .85rem; }
    .ma-auth-shell {
        grid-template-columns: minmax(0, 1fr);
        inline-size: min(100%, 33rem);
        min-block-size: 0;
        border-radius: .95rem;
    }
    .ma-auth-content { padding: 1.2rem clamp(1rem, 4vw, 1.75rem) 1.55rem; }
    .ma-auth-body { inline-size: 100%; padding-block-start: 1.25rem; }
    .ma-auth-photo { grid-row: 1; block-size: clamp(5.5rem, 20vw, 8rem); background-position: center 54%; }
    .ma-auth-description { margin-block-end: 1rem; }
}

/* Keep the activation form within the available viewport without clipping focus or errors. */
.ma-auth:has(.ma-auth-activation) {
    box-sizing: border-box;
    min-block-size: 100dvh;
    padding-block: clamp(.5rem, 2dvh, 1.5rem);
}
.ma-auth-activation {
    min-block-size: min(39rem, calc(100dvh - 3rem));
}
.ma-auth-activation .ma-auth-content {
    padding-block: clamp(1rem, 3dvh, 2.1rem);
}
.ma-auth-activation .ma-auth-body {
    inline-size: min(100%, 26rem);
    padding-block-start: clamp(.65rem, 2.7dvh, 1.65rem);
}
.ma-auth-activation .ma-auth-description {
    margin-block: .45rem clamp(.6rem, 1.6dvh, 1rem);
}
.ma-auth-activation .ma-auth-form { gap: clamp(.5rem, 1.2dvh, .8rem); }
.ma-auth-activation .ma-auth-notice { margin-block-end: .6rem; }

@media (max-width: 760px) {
    .ma-auth:has(.ma-auth-activation) { place-items: center; }
    .ma-auth-activation { min-block-size: 0; }
    .ma-auth-activation .ma-auth-body { inline-size: 100%; }
    .ma-auth-activation .ma-auth-photo {
        block-size: clamp(4.5rem, 11dvh, 7rem);
    }
}
@media (max-width: 760px) and (max-height: 710px) {
    .ma-auth-activation .ma-auth-photo { display: none; }
}
@media (max-height: 700px) {
    .ma-auth-activation .ma-auth-content { padding-block: .9rem; }
    .ma-auth-activation .ma-auth-top { gap: .5rem; }
    .ma-auth-activation :is(.ma-auth-mark, .ma-auth-language) { min-block-size: 2.25rem; }
    .ma-auth-activation .ma-auth-mark { block-size: 2.25rem; inline-size: 2.25rem; }
    .ma-auth-activation h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
    .ma-auth-activation .ma-auth-description { font-size: .9rem; line-height: 1.4; }
    .ma-auth-activation .ma-auth-field { gap: .2rem; }
    .ma-auth-activation label { font-size: .875rem; line-height: 1.2; }
    .ma-auth-activation input:not([type=hidden]) { min-block-size: 2.6rem; padding-block: .4rem; }
    .ma-auth-activation .ma-auth-submit { min-block-size: 2.65rem; padding-block: .4rem; }
    .ma-auth-activation .ma-auth-footer { margin-block-start: .6rem; }
    .ma-auth-activation .ma-auth-notice { padding: .35rem .6rem; font-size: .85rem; line-height: 1.3; }
}
@media (max-height: 520px) and (min-width: 480px) {
    .ma-auth:has(.ma-auth-activation) { padding-inline: 1rem; }
    .ma-auth-activation {
        grid-template-columns: minmax(0, 1fr);
        inline-size: min(100%, 40rem);
        min-block-size: 0;
    }
    .ma-auth-activation .ma-auth-photo { display: none; }
    .ma-auth-activation .ma-auth-content { padding-block: .6rem; }
    .ma-auth-activation .ma-auth-body { inline-size: 100%; }
    .ma-auth-activation .ma-auth-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ma-auth-activation .ma-auth-submit { grid-column: 1 / -1; }
    .ma-auth-activation :is(.ma-auth-footer, .ma-auth-description) { font-size: .85rem; }
}

@media (max-height: 400px) and (min-width: 480px) {
    .ma-auth:has(.ma-auth-activation) { padding-block: .375rem; }
    .ma-auth-activation .ma-auth-content { padding-block: .4rem; }
    .ma-auth-activation .ma-auth-body { padding-block-start: .35rem; }
    .ma-auth-activation h1 { font-size: 1.4rem; }
    .ma-auth-activation .ma-auth-description { margin-block: .25rem .4rem; }
    .ma-auth-activation .ma-auth-form { gap: .35rem .6rem; }
    .ma-auth-activation input:not([type=hidden]) { min-block-size: 2.25rem; }
    .ma-auth-activation .ma-auth-submit { min-block-size: 2.35rem; margin-block-start: 0; }
    .ma-auth-activation .ma-auth-footer { margin-block-start: .35rem; }
}

@media (max-width: 365px) and (max-height: 535px) {
    .ma-auth:has(.ma-auth-activation) { padding-block: .4rem; }
    .ma-auth-activation .ma-auth-content { padding-block: .6rem; }
    .ma-auth-activation .ma-auth-body { padding-block-start: .45rem; }
    .ma-auth-activation h1 { font-size: 1.4rem; line-height: 1.1; }
    .ma-auth-activation .ma-auth-description { margin-block: .3rem .5rem; }
    .ma-auth-activation .ma-auth-form { gap: .4rem; }
    .ma-auth-activation input:not([type=hidden]) { min-block-size: 2.4rem; }
    .ma-auth-activation .ma-auth-submit { min-block-size: 2.5rem; margin-block-start: 0; }
    .ma-auth-activation .ma-auth-footer { margin-block-start: .45rem; }
}

@media (max-height: 700px) {
    .ma-auth-activation .ma-auth-body:has(.ma-auth-notice[role=alert]) .ma-auth-description {
        display: none;
    }
    .ma-auth-activation .ma-auth-notice[role=alert] { margin-block: .35rem; }
}
