:root {
    --login-green: #173d78;
    --login-green-dark: #0b1f3a;
    --login-green-soft: #eaf1fb;
    --login-ink: #0b1f3a;
    --login-muted: #607089;
    --login-line: #d7e0ed;
    --login-canvas: #edf3fa;
    --login-white: #ffffff;
    --login-danger: #a53730;
    --login-shadow: 0 28px 70px rgba(11, 31, 58, 0.16);
}

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

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--login-canvas);
}

body {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    background: var(--login-canvas);
    color: var(--login-ink);
    font-family: var(--font-arabic, "Tajawal", Arial, sans-serif);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body[dir="ltr"] {
    font-family: var(--font-sans, "Inter", Arial, sans-serif);
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.login-shell {
    direction: ltr;
    display: grid !important;
    grid-template-columns: minmax(0, 0.88fr) minmax(520px, 1.12fr) !important;
    width: 100%;
    min-height: 100svh !important;
    gap: 0;
    padding: 22px !important;
    background:
        radial-gradient(circle at 12% 10%, rgba(37, 99, 235, 0.09), transparent 30%),
        var(--login-canvas);
}

.brand-panel,
.form-panel {
    min-width: 0;
    min-height: calc(100svh - 44px) !important;
}

.brand-panel {
    direction: rtl;
    position: relative;
    isolation: isolate;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    padding: clamp(38px, 5vw, 72px) !important;
    border-radius: 28px 0 0 28px !important;
    background:
        radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.16), transparent 25%),
        radial-gradient(circle at 86% 82%, rgba(92, 156, 255, 0.18), transparent 32%),
        linear-gradient(145deg, var(--login-green), var(--login-green-dark)) !important;
    color: #fff;
    box-shadow: var(--login-shadow);
}

body[dir="ltr"] .brand-panel {
    direction: ltr;
}

.brand-panel::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset-inline-start: -150px;
    bottom: -170px;
    width: 360px;
    height: 360px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    box-shadow:
        0 0 0 52px rgba(255, 255, 255, 0.035),
        0 0 0 104px rgba(255, 255, 255, 0.025);
}

.brand-grid {
    position: absolute;
    inset: 0;
    z-index: -2;
    opacity: 0.08;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom right, #000, transparent 78%);
}

.brand-orbit {
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 50%;
}

.brand-orbit-one {
    inset-inline-end: -135px;
    bottom: 8%;
    width: 310px;
    height: 310px;
}

.brand-orbit-two {
    inset-inline-end: 16%;
    top: 22%;
    width: 96px;
    height: 96px;
}

.brand-mark {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    color: #fff;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.brand-wordmark {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    line-height: 1;
}

.brand-wordmark strong {
    font-family: "Marcellus", Georgia, serif;
    font-size: 1.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-wordmark small {
    color: currentColor;
    font-family: var(--font-sans, "Inter", Arial, sans-serif);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    opacity: 0.72;
    text-transform: uppercase;
}

.brand-mark img {
    width: 46px;
    height: 46px;
    padding: 7px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    object-fit: contain;
    box-shadow: 0 12px 28px rgba(4, 20, 45, 0.24);
}

.brand-copy {
    position: relative;
    z-index: 2;
    max-width: 590px;
    margin: auto 0;
    padding: 56px 0;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: #dceaff;
    font-size: 0.82rem;
    font-weight: 800;
}

.brand-copy h1 {
    max-width: 560px;
    margin: 22px 0 17px;
    color: #fff;
    font-size: clamp(2.4rem, 4vw, 4.6rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.12;
}

body[dir="ltr"] .brand-copy h1 {
    letter-spacing: -0.045em;
}

.brand-copy p {
    max-width: 560px;
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(1rem, 1.35vw, 1.12rem);
    font-weight: 500;
    line-height: 1.9;
}

.brand-footer {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.86rem;
    font-weight: 700;
}

.status-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #71a7ff;
    box-shadow: 0 0 0 5px rgba(113, 167, 255, 0.14);
}

.form-panel {
    direction: rtl;
    position: relative !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 82px clamp(34px, 6vw, 92px) 42px !important;
    border-radius: 0 28px 28px 0 !important;
    background: var(--login-white) !important;
    box-shadow: var(--login-shadow);
}

body[dir="ltr"] .form-panel {
    direction: ltr;
}

.top-actions {
    position: absolute !important;
    z-index: 5;
    top: 26px !important;
    inset-inline-end: 28px !important;
    right: auto !important;
    left: auto !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: var(--login-muted);
    font-size: 0.8rem;
}

.language-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid var(--login-line);
    border-radius: 11px;
    background: #f6faf8;
    color: var(--login-green);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.language-toggle:hover,
.language-toggle:focus-visible {
    outline: none;
    border-color: #9bb7df;
    background: var(--login-green-soft);
    color: var(--login-green-dark);
}

.login-container {
    position: relative;
    width: min(100%, 460px) !important;
    max-width: 460px !important;
    margin: 0 auto;
}

.mobile-brand {
    display: none !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: fit-content;
    margin: 0 auto 28px;
    color: var(--login-ink);
    font-weight: 800;
}

.mobile-brand .brand-wordmark strong {
    font-size: 1.5rem;
}

.mobile-brand .brand-wordmark small {
    color: var(--login-green);
    opacity: 1;
}

.mobile-brand img {
    width: 43px;
    height: 43px;
    padding: 6px;
    border-radius: 13px;
    background: #fff;
    object-fit: contain;
    box-shadow: 0 8px 22px rgba(23, 61, 120, 0.14);
}

.login-header {
    margin-bottom: 28px;
    text-align: start;
}

.welcome-kicker {
    display: block;
    margin-bottom: 9px;
    color: var(--login-green);
    font-size: 0.82rem;
    font-weight: 800;
}

.login-header h2 {
    margin: 0 0 10px;
    color: var(--login-ink);
    font-size: clamp(1.85rem, 3vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

body[dir="ltr"] .login-header h2 {
    letter-spacing: -0.035em;
}

.login-header p {
    margin: 0;
    color: var(--login-muted);
    font-size: 0.96rem;
    font-weight: 500;
    line-height: 1.75;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 13px 14px;
    border: 1px solid #edcbc6;
    border-radius: 12px;
    background: #fff5f3;
    color: var(--login-danger);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.55;
}

.alert i {
    margin-top: 3px;
}

.login-form {
    width: 100%;
}

.form-group {
    margin: 0 0 18px;
}

.form-label {
    display: block;
    margin: 0 0 8px;
    color: #34463d;
    font-size: 0.9rem;
    font-weight: 800;
}

.input-wrap {
    position: relative;
    width: 100%;
}

.input-wrap > i {
    position: absolute;
    z-index: 2;
    top: 50%;
    inset-inline-start: 16px;
    transform: translateY(-50%);
    color: #778a80;
    pointer-events: none;
}

body[dir="rtl"] .input-wrap > i {
    right: 16px;
    left: auto;
}

body[dir="ltr"] .input-wrap > i {
    right: auto;
    left: 16px;
}

.form-control {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0 46px;
    border: 1px solid var(--login-line);
    border-radius: 13px;
    outline: none;
    background: #f8fbf9;
    color: var(--login-ink);
    font-size: 0.96rem;
    box-shadow: none;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control::placeholder {
    color: #96a49c;
    opacity: 1;
}

.form-control:hover {
    border-color: #b6cdc1;
}

.form-control:focus {
    border-color: #62a287;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.password-toggle {
    position: absolute !important;
    z-index: 3;
    top: 50% !important;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #71847a;
    cursor: pointer;
}

body[dir="rtl"] .password-toggle {
    right: auto !important;
    left: 9px !important;
}

body[dir="ltr"] .password-toggle {
    right: 9px !important;
    left: auto !important;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    outline: none;
    background: var(--login-green-soft);
    color: var(--login-green);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: fit-content;
    margin: 2px 0 21px;
    color: var(--login-muted);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.remember-row input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--login-green);
}

.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    width: 100%;
    min-height: 54px;
    padding: 11px 20px;
    border: 0;
    border-radius: 13px;
    background: var(--login-green);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(23, 61, 120, 0.24);
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.login-button:hover {
    transform: translateY(-1px);
    background: var(--login-green-dark);
    box-shadow: 0 16px 30px rgba(11, 31, 58, 0.28);
}

.login-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.2);
    outline-offset: 3px;
}

.login-button:active {
    transform: none;
}

.form-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9efeb;
    color: #89968f;
    font-size: 0.79rem;
    line-height: 1.6;
    text-align: center;
}

@media (max-width: 1040px) {
    .login-shell {
        grid-template-columns: minmax(0, 0.8fr) minmax(500px, 1.2fr) !important;
        padding: 16px !important;
    }

    .brand-panel,
    .form-panel {
        min-height: calc(100svh - 32px) !important;
    }

    .brand-panel {
        padding: 38px !important;
    }

    .brand-copy h1 {
        font-size: clamp(2.25rem, 4.2vw, 3.5rem);
    }

    .form-panel {
        padding-inline: 38px !important;
    }
}

@media (max-width: 860px) {
    .login-shell {
        display: block !important;
        min-height: 100svh !important;
        padding: 18px !important;
    }

    .brand-panel {
        display: none !important;
    }

    .form-panel {
        width: 100% !important;
        min-height: calc(100svh - 36px) !important;
        padding: 76px 24px 30px !important;
        border-radius: 24px !important;
    }

    .login-container {
        width: min(100%, 460px) !important;
        margin: 0 auto !important;
    }

    .mobile-brand {
        display: flex !important;
    }

    .login-header {
        text-align: center;
    }

    .top-actions {
        top: 20px !important;
        inset-inline-end: 20px !important;
    }

    .top-actions > span {
        display: none;
    }
}

@media (max-width: 520px) {
    html,
    body {
        background: #fff;
    }

    .login-shell {
        padding: 0 !important;
        background: #fff;
    }

    .form-panel {
        min-height: 100svh !important;
        padding: 70px 18px 24px !important;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .top-actions {
        top: 16px !important;
        inset-inline-end: 16px !important;
    }

    .mobile-brand {
        margin-bottom: 25px;
    }

    .login-header {
        margin-bottom: 24px;
    }

    .login-header h2 {
        font-size: 1.78rem;
    }
}

@media (max-height: 700px) and (min-width: 861px) {
    .brand-panel {
        padding-block: 34px !important;
    }

    .brand-copy {
        padding: 28px 0;
    }

    .brand-copy h1 {
        margin-block: 16px 12px;
        font-size: clamp(2.1rem, 3.5vw, 3.3rem);
    }

    .form-panel {
        align-items: flex-start;
        padding-block: 70px 28px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
