:root {
    --portal-bg: #eef4f8;
    --portal-surface: #ffffff;
    --portal-text: #172033;
    --portal-muted: #667085;
    --portal-border: #d9e2ec;
    --portal-accent: #0f766e;
    --portal-accent-text: #ffffff;
    --portal-card-bg: #ffffff;
    --portal-card-text: #172033;
    font-size: 15px;
}

@font-face {
    font-family: "Tajawal";
    src: url("../fonts/Tajawal-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF;
}

@font-face {
    font-family: "Tajawal";
    src: url("../fonts/Tajawal-Latin-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: "Tajawal";
    src: url("../fonts/Tajawal-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF;
}

@font-face {
    font-family: "Tajawal";
    src: url("../fonts/Tajawal-Latin-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    direction: rtl;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    color: var(--portal-text);
    background: var(--portal-bg);
    font-family: "Tajawal", Tahoma, Arial, sans-serif;
    overflow-x: hidden;
}

button,
input {
    max-width: 100%;
    font: inherit;
}

.portal-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 0;
}

.portal-desktop-hero {
    display: none;
}

.mobile-frame {
    width: min(430px, 100%);
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto auto 1fr;
    background: linear-gradient(180deg, #fcfdff 0%, #eef3fb 100%);
    box-shadow: 0 24px 70px rgba(16, 42, 67, 0.12);
}

.portal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 204px;
    padding: 24px 18px 16px;
    text-align: center;
}

.portal-logo {
    order: 1;
    display: inline-grid;
    place-items: center;
    width: 88px;
    height: 106px;
    flex: 0 0 106px;
    margin-bottom: 12px;
    color: var(--portal-accent);
    font-weight: 700;
    overflow: hidden;
}

.portal-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.portal-header__text {
    order: 2;
    display: grid;
    justify-items: center;
    gap: 3px;
    max-width: 100%;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}

.portal-header strong,
.portal-header small {
    display: block;
    overflow-wrap: anywhere;
}

.portal-header strong {
    color: var(--portal-text);
    font-size: 1.08rem;
    line-height: 1.35;
}

.portal-header small {
    color: var(--portal-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.portal-tabs {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: 0 18px 14px;
    padding: 5px;
    background: #e8eef5;
    border-radius: 8px;
    overflow: hidden;
}

.portal-tabs::before {
    content: "";
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: -1;
    width: calc(50% - 5px);
    height: calc(100% - 10px);
    background: var(--portal-accent);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(16, 42, 67, 0.12);
    transform: translateX(0);
    transition:
        transform 180ms ease,
        background-color 180ms ease,
        box-shadow 180ms ease;
}

.portal-tabs[data-active-portal="employee"]::before {
    transform: translateX(-100%);
}

.portal-tabs a {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-height: 42px;
    color: var(--portal-muted);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition:
        color 160ms ease,
        transform 160ms ease;
}

.portal-tabs a.is-active {
    color: var(--portal-accent-text);
}

.portal-tabs a:active {
    transform: scale(0.98);
}

.portal-tabs.is-switching::before {
    box-shadow: 0 10px 26px rgba(16, 42, 67, 0.18);
}

.portal-content {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 0 18px 24px;
}

.portal-card {
    padding: 18px;
    color: var(--portal-card-text);
    background: var(--portal-card-bg);
    border: 1px solid rgba(217, 226, 236, 0.9);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(16, 42, 67, 0.08);
}

.portal-card--compact {
    margin-top: 42px;
}

.portal-card__intro {
    margin-bottom: 16px;
    text-align: center;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--portal-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.portal-card h1 {
    margin: 0;
    font-size: 1.42rem;
    line-height: 1.3;
}

.stack-form {
    display: grid;
    gap: 13px;
}

.stack-form label {
    display: grid;
    gap: 6px;
    color: var(--portal-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.stack-form input {
    min-height: 46px;
    padding: 10px 12px;
    color: var(--portal-text);
    background: #ffffff;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    outline: none;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.stack-form input:focus {
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 3px rgba(177, 143, 102, 0.16);
}

.stack-form .check-field {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 24px;
    color: var(--portal-text);
    cursor: pointer;
}

.stack-form .check-field input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    accent-color: var(--portal-accent);
    cursor: pointer;
}

.primary-btn {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    color: var(--portal-accent-text);
    background: var(--portal-accent);
    font-weight: 700;
    cursor: pointer;
}

.portal-link {
    display: grid;
    place-items: center;
    min-height: 42px;
    margin-top: 12px;
    color: var(--portal-accent);
    text-decoration: none;
    font-weight: 700;
}

.portal-link--muted {
    min-height: 34px;
    margin-top: 2px;
    color: var(--portal-muted);
    font-size: 0.9rem;
}

.portal-inline-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    color: var(--portal-muted);
    font-weight: 800;
}

.portal-inline-links a {
    color: var(--portal-accent);
    text-decoration: none;
}

.portal-inline-links span {
    color: rgba(102, 112, 133, 0.45);
    font-weight: 700;
}

.portal-alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
    border-radius: 8px;
    font-weight: 700;
}

.portal-notice {
    margin-bottom: 14px;
    padding: 10px 12px;
    color: #0b4f4a;
    background: #d8f3dc;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.6;
}

.portal-notice--danger {
    color: #b42318;
    background: #fef3f2;
    border-color: #fecdca;
}

.verification-boxes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 8px 0;
}

.verification-digit {
    width: 58px;
    height: 58px;
    text-align: center;
    font-size: 1.45rem;
    font-weight: 700;
}

.verification-timer {
    margin: 0;
    color: var(--portal-muted);
    text-align: center;
    font-weight: 700;
}

.mobile-portrait-guard {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(238, 244, 248, 0.96);
}

.mobile-portrait-guard__panel {
    width: min(380px, 100%);
    display: grid;
    place-items: center;
    gap: 18px;
    padding: 28px 22px;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    box-shadow: 0 22px 65px rgba(16, 42, 67, 0.18);
}

.mobile-portrait-guard__icon {
    display: inline-grid;
    place-items: center;
    width: 76px;
    height: 76px;
    color: var(--portal-accent);
    font-size: 3rem;
}

.mobile-portrait-guard__text {
    font-size: 1.35rem;
    line-height: 1.6;
}

@media (min-width: 520px) {
    .portal-shell {
        padding: 24px;
    }

    .mobile-frame {
        min-height: min(820px, calc(100dvh - 48px));
        border: 1px solid rgba(255, 255, 255, 0.8);
        border-radius: 8px;
        overflow: hidden;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .mobile-portrait-guard {
        display: none;
    }

    .portal-shell {
        visibility: visible;
    }
}

@media (min-width: 901px), (orientation: landscape) and (min-width: 760px) {
    body.portal-body {
        --portal-accent: #b18f66;
        --portal-accent-text: #ffffff;
        --portal-muted: #6f7f90;
        min-height: 100dvh;
        background:
            linear-gradient(155deg, rgba(177, 143, 102, 0.20), transparent 34%),
            linear-gradient(25deg, rgba(218, 223, 229, 0.16), transparent 44%),
            linear-gradient(90deg, rgba(11, 31, 51, 0.98), rgba(27, 47, 65, 0.90) 45%, rgba(65, 78, 91, 0.68)),
            url("../uploads/system/engineering-login-hero.png") center center / cover no-repeat fixed;
    }

    body.portal-body::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 0;
        background:
            linear-gradient(105deg, rgba(6, 19, 33, 0.42) 0%, rgba(218, 223, 229, 0.14) 44%, rgba(177, 143, 102, 0.24) 68%, rgba(6, 19, 33, 0.22) 100%),
            radial-gradient(circle at 18% 12%, rgba(238, 246, 255, 0.16), transparent 30%);
        background-size: 180% 180%, 100% 100%;
        animation: portalAmbientSweep 9s ease-in-out infinite alternate;
        pointer-events: none;
    }

    body.portal-body::after {
        display: none;
    }

    .portal-shell {
        position: relative;
        isolation: isolate;
        z-index: 1;
        min-height: 100dvh;
        grid-template-columns: minmax(320px, 1fr) minmax(390px, 454px);
        align-items: center;
        justify-content: center;
        gap: clamp(28px, 5vw, 78px);
        padding: clamp(28px, 5vw, 72px) clamp(18px, 3vw, 48px) clamp(28px, 5vw, 72px) clamp(56px, 8vw, 128px);
    }

    .portal-shell::before {
        content: "";
        position: fixed;
        inset: -45% 0 auto 0;
        z-index: 0;
        height: 150vh;
        background:
            linear-gradient(176deg, transparent 0 35%, rgba(255, 255, 255, 0.00) 42%, rgba(255, 255, 255, 0.50) 49%, rgba(200, 163, 111, 0.30) 52%, transparent 64% 100%) 8% 0 / 2px 280px no-repeat,
            linear-gradient(176deg, transparent 0 33%, rgba(255, 255, 255, 0.00) 42%, rgba(255, 255, 255, 0.20) 49%, rgba(200, 163, 111, 0.12) 52%, transparent 65% 100%) 16% 140px / 1px 145px no-repeat,
            linear-gradient(176deg, transparent 0 34%, rgba(255, 255, 255, 0.00) 42%, rgba(255, 255, 255, 0.30) 49%, rgba(200, 163, 111, 0.18) 52%, transparent 63% 100%) 25% 90px / 2px 205px no-repeat,
            linear-gradient(176deg, transparent 0 38%, rgba(255, 255, 255, 0.00) 43%, rgba(255, 255, 255, 0.10) 50%, rgba(200, 163, 111, 0.08) 53%, transparent 64% 100%) 33% 18px / 1px 118px no-repeat,
            linear-gradient(176deg, transparent 0 37%, rgba(255, 255, 255, 0.00) 43%, rgba(255, 255, 255, 0.50) 50%, rgba(200, 163, 111, 0.32) 53%, transparent 64% 100%) 41% 25px / 3px 330px no-repeat,
            linear-gradient(176deg, transparent 0 34%, rgba(255, 255, 255, 0.00) 42%, rgba(255, 255, 255, 0.20) 49%, rgba(200, 163, 111, 0.14) 52%, transparent 63% 100%) 53% 160px / 1px 175px no-repeat,
            linear-gradient(176deg, transparent 0 35%, rgba(255, 255, 255, 0.00) 43%, rgba(255, 255, 255, 0.30) 50%, rgba(200, 163, 111, 0.20) 53%, transparent 65% 100%) 64% 15px / 2px 250px no-repeat,
            linear-gradient(176deg, transparent 0 33%, rgba(255, 255, 255, 0.00) 42%, rgba(255, 255, 255, 0.10) 49%, rgba(200, 163, 111, 0.08) 52%, transparent 63% 100%) 72% 84px / 1px 132px no-repeat,
            linear-gradient(176deg, transparent 0 33%, rgba(255, 255, 255, 0.00) 42%, rgba(255, 255, 255, 0.20) 49%, rgba(200, 163, 111, 0.14) 52%, transparent 63% 100%) 81% 105px / 2px 195px no-repeat,
            linear-gradient(176deg, transparent 0 37%, rgba(255, 255, 255, 0.00) 43%, rgba(255, 255, 255, 0.30) 50%, rgba(200, 163, 111, 0.18) 53%, transparent 65% 100%) 92% 40px / 2px 235px no-repeat;
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.50));
        mix-blend-mode: screen;
        opacity: 0.92;
        pointer-events: none;
        animation: portalSoftRainTrace 6.4s linear infinite;
    }

    .portal-shell::after {
        content: "";
        position: fixed;
        inset: -55% 0 auto 0;
        z-index: 0;
        height: 150vh;
        background:
            linear-gradient(177deg, transparent 0 38%, rgba(255, 255, 255, 0.00) 45%, rgba(255, 255, 255, 0.10) 50%, rgba(200, 163, 111, 0.08) 54%, transparent 66% 100%) 5% 55px / 1px 100px no-repeat,
            linear-gradient(177deg, transparent 0 36%, rgba(255, 255, 255, 0.00) 44%, rgba(255, 255, 255, 0.30) 50%, rgba(200, 163, 111, 0.18) 54%, transparent 66% 100%) 14% 20px / 2px 170px no-repeat,
            linear-gradient(177deg, transparent 0 34%, rgba(255, 255, 255, 0.00) 43%, rgba(255, 255, 255, 0.50) 50%, rgba(200, 163, 111, 0.30) 54%, transparent 66% 100%) 30% 115px / 3px 230px no-repeat,
            linear-gradient(177deg, transparent 0 36%, rgba(255, 255, 255, 0.00) 44%, rgba(255, 255, 255, 0.20) 50%, rgba(200, 163, 111, 0.12) 54%, transparent 66% 100%) 46% 64px / 1px 150px no-repeat,
            linear-gradient(177deg, transparent 0 38%, rgba(255, 255, 255, 0.00) 45%, rgba(255, 255, 255, 0.10) 50%, rgba(200, 163, 111, 0.08) 54%, transparent 66% 100%) 59% 12px / 1px 120px no-repeat,
            linear-gradient(177deg, transparent 0 35%, rgba(255, 255, 255, 0.00) 43%, rgba(255, 255, 255, 0.30) 50%, rgba(200, 163, 111, 0.18) 54%, transparent 66% 100%) 70% 132px / 2px 190px no-repeat,
            linear-gradient(177deg, transparent 0 34%, rgba(255, 255, 255, 0.00) 43%, rgba(255, 255, 255, 0.50) 50%, rgba(200, 163, 111, 0.28) 54%, transparent 66% 100%) 86% 78px / 3px 260px no-repeat,
            linear-gradient(177deg, transparent 0 36%, rgba(255, 255, 255, 0.00) 44%, rgba(255, 255, 255, 0.20) 50%, rgba(200, 163, 111, 0.12) 54%, transparent 66% 100%) 96% 24px / 1px 145px no-repeat;
        filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.38));
        mix-blend-mode: screen;
        opacity: 0.84;
        pointer-events: none;
        animation: portalSoftRainTraceAlt 9.2s linear infinite;
    }

    .portal-desktop-hero,
    .mobile-frame {
        position: relative;
        z-index: 1;
    }

    .portal-desktop-hero {
        display: flex;
        min-height: min(660px, calc(100dvh - 96px));
        width: 100%;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        justify-self: stretch;
        gap: 24px;
        padding-bottom: clamp(46px, 8vh, 92px);
        color: #f7f8fa;
        text-align: center;
    }

    .portal-desktop-hero__content {
        width: min(520px, 100%);
        margin-top: 0;
    }

    .portal-desktop-hero h2 {
        margin: 0;
        color: #ffffff;
        font-size: clamp(1.55rem, 2.7vw, 2.55rem);
        line-height: 1.35;
        white-space: nowrap;
    }

    .portal-desktop-hero h2 span {
        display: inline;
        color: #c8a36f;
        font-weight: 700;
    }

    .portal-desktop-hero p {
        margin: 16px auto 0;
        max-width: 480px;
        color: rgba(255, 255, 255, 0.68);
        font-size: 1rem;
        line-height: 1.9;
    }

    .portal-desktop-hero__line {
        display: block;
        width: 44px;
        height: 2px;
        margin: 22px auto 0;
        background: #c8a36f;
    }

    .portal-desktop-hero__features {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px 18px;
        width: min(560px, 100%);
        color: rgba(255, 255, 255, 0.78);
        font-size: 0.86rem;
        font-weight: 700;
    }

    .portal-desktop-hero__features span {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 18px;
    }

    .portal-desktop-hero__features span:not(:last-child)::after {
        content: "*";
        color: rgba(241, 214, 166, 0.92);
        font-size: 0.92rem;
        font-weight: 700;
    }

    .mobile-frame {
        width: min(454px, 100%);
        min-height: auto;
        grid-template-rows: auto auto auto;
        align-self: center;
        justify-self: end;
        margin-right: clamp(28px, 4vw, 64px);
        padding: 36px 44px 34px;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 251, 0.92)),
            rgba(255, 255, 255, 0.95);
        border: 1px solid rgba(224, 226, 229, 0.78);
        border-radius: 8px;
        box-shadow: 0 30px 80px rgba(3, 15, 27, 0.34);
        backdrop-filter: blur(12px);
    }

    .portal-header {
        min-height: auto;
        padding: 0 0 22px;
    }

    .portal-logo {
        width: 104px;
        height: 126px;
        flex-basis: 126px;
        margin-bottom: 8px;
    }

    .portal-tabs {
        margin: 0 0 22px;
        background:
            linear-gradient(145deg, rgba(11, 31, 51, 0.08), rgba(177, 143, 102, 0.06)),
            #eef1f5;
        border: 1px solid rgba(11, 31, 51, 0.08);
    }

    .portal-content {
        padding: 0;
    }

    .portal-card {
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .portal-card__intro {
        display: none;
    }

    .stack-form {
        gap: 15px;
    }

    .stack-form label {
        gap: 7px;
        text-align: right;
    }

    .stack-form input {
        min-height: 42px;
        background: rgba(255, 255, 255, 0.82);
        border-color: rgba(11, 31, 51, 0.16);
        box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04);
    }

    .primary-btn {
        margin-top: 4px;
        min-height: 46px;
        background: linear-gradient(135deg, #8e704e, #b18f66);
        box-shadow: 0 12px 24px rgba(177, 143, 102, 0.22);
    }
}

@keyframes portalAmbientSweep {
    0% {
        background-position: 0% 50%, center;
    }

    100% {
        background-position: 100% 50%, center;
    }
}

@keyframes portalSoftRainTrace {
    0% {
        transform: translateY(-16%);
        opacity: 0.72;
    }

    18%,
    74% {
        opacity: 0.96;
    }

    100% {
        transform: translateY(42%);
        opacity: 0.58;
    }
}

@keyframes portalSoftRainTraceAlt {
    0% {
        transform: translateY(-10%);
        opacity: 0.42;
    }

    34% {
        opacity: 0.88;
    }

    100% {
        transform: translateY(48%);
        opacity: 0.28;
    }
}

@media (min-width: 901px) and (max-width: 1100px), (orientation: landscape) and (max-width: 900px) {
    .portal-shell {
        grid-template-columns: minmax(260px, 1fr) minmax(340px, 410px);
        gap: 28px;
        padding: 22px 20px 22px 32px;
    }

    .mobile-frame {
        margin-right: clamp(8px, 2vw, 20px);
        padding: 26px 28px 24px;
    }

    .portal-desktop-hero {
        min-height: min(520px, calc(100dvh - 48px));
        padding-bottom: 34px;
    }

    .portal-desktop-hero__content {
        width: min(430px, 100%);
    }
}
