:root {
    --auth-brand: #047568;
    --auth-brand-2: #0c8a7c;
    --auth-blue: #1e6091;
    --auth-accent: #f4b740;
    --auth-ink: #0f172a;
    --auth-muted: #64748b;
    --auth-line: #dbe3ea;
    --auth-soft: #f8fafc;
    --auth-danger: #ef4444;
    --auth-shadow: 0 24px 60px -34px rgba(0, 0, 0, .58);
}

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

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    color: var(--auth-ink);
    font-family: 'Cairo', system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    background: #f1f5f9;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select {
    font: inherit;
}

svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

html.ui-ltr,
html.ui-ltr body {
    direction: ltr;
    text-align: left;
}

/* =====================================================================
   Two-pane shell:  [ branded story panel ]  [ focused form panel ]
   ===================================================================== */
.auth-shell {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(440px, 0.88fr);
}

/* ----------------------------------------------------------- brand panel */
.auth-brand {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    padding: 46px 56px;
    color: #fff;
    overflow: hidden;
    background-image:
        linear-gradient(155deg, rgba(4, 34, 37, .96) 0%, rgba(4, 92, 83, .92) 46%, rgba(30, 96, 145, .86) 100%),
        url('../img/bg1.jpg');
    background-size: cover;
    background-position: center;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: auto -120px -160px auto;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 183, 64, .22), transparent 62%);
    pointer-events: none;
    z-index: -1;
}

.auth-brand-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 78px;
    min-width: 78px;
    min-height: 50px;
    display: grid;
    place-items: center;
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 34px -22px rgba(0, 0, 0, .6);
}

.brand-logo img {
    display: block;
    max-width: 100%;
    height: auto;
}

.brand-name {
    display: grid;
    gap: 2px;
    line-height: 1.3;
}

.brand-name strong {
    font-size: 21px;
    font-weight: 900;
    letter-spacing: .2px;
}

.brand-name span {
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
    font-weight: 800;
}

.auth-brand-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 600px;
    padding-block: 28px;
}

.brand-kicker {
    margin: 0 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .92);
    font-size: 12px;
    font-weight: 800;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.brand-kicker::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--auth-accent);
    box-shadow: 0 0 0 4px rgba(244, 183, 64, .25);
}

.brand-title {
    margin: 0;
    font-size: clamp(30px, 3vw, 46px);
    line-height: 1.12;
    font-weight: 900;
}

.brand-title span {
    color: var(--auth-accent);
}

.brand-lead {
    margin: 16px 0 0;
    max-width: 540px;
    color: rgba(255, 255, 255, .9);
    font-size: 15px;
    line-height: 1.75;
    font-weight: 600;
}

.brand-features {
    list-style: none;
    margin: 30px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
    max-width: 600px;
}

.brand-features li {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 13px;
    align-items: start;
}

.brand-features .ic {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--auth-accent);
    background: rgba(244, 183, 64, .14);
    border: 1px solid rgba(244, 183, 64, .22);
}

.brand-features .ic svg {
    width: 20px;
    height: 20px;
}

.brand-features strong {
    display: block;
    font-size: 13.5px;
    font-weight: 900;
    line-height: 1.35;
}

.brand-features span {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, .66);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
}

.auth-brand-foot {
    color: rgba(255, 255, 255, .58);
    font-size: 12px;
    font-weight: 700;
}

/* ------------------------------------------------------------ form panel */
.auth-form-pane {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 34px 52px;
    background: #fff;
    overflow-y: auto;
}

.auth-lang {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    border: 1px solid var(--auth-line);
    border-radius: 999px;
    background: var(--auth-soft);
}

.auth-lang > span {
    padding-inline: 10px 4px;
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 900;
}

.auth-lang a {
    min-width: 64px;
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--auth-muted);
    font-size: 12.5px;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
    transition: color .15s ease, background-color .15s ease;
}

.auth-lang a.active,
.auth-lang a:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-blue) 100%);
}

.auth-form-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: 28px;
}

.auth-form-foot {
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

/* --------------------------------------------------------------- the card */
.auth-card,
.auth-card--compact {
    width: 100%;
    max-width: 432px;
    margin: 0 auto;
}

.auth-card-header {
    margin-bottom: 20px;
}

.form-kicker {
    margin: 0 0 6px;
    color: var(--auth-brand);
    font-size: 12.5px;
    font-weight: 900;
}

.auth-card h2 {
    margin: 0;
    color: var(--auth-ink);
    font-size: 26px;
    line-height: 1.2;
    font-weight: 900;
}

.auth-card-header p:last-child {
    margin: 8px 0 0;
    color: var(--auth-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
}

.field-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.field {
    margin-bottom: 13px;
}

.field label,
.label-row label {
    display: block;
    margin: 0 0 6px;
    color: #334155;
    font-size: 12.5px;
    font-weight: 900;
}

.label-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.label-row a {
    margin-bottom: 6px;
    color: var(--auth-brand);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.45;
    text-decoration: none;
}

.label-row a:hover {
    text-decoration: underline;
}

.control {
    position: relative;
}

.control-icon,
.select-arrow,
.password-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.control-icon {
    inset-inline-start: 13px;
    color: #94a3b8;
    pointer-events: none;
}

.control-icon svg {
    width: 18px;
    height: 18px;
}

.control input,
.control select {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    padding-inline-start: 42px;
    border: 1.5px solid var(--auth-line);
    border-radius: 10px;
    outline: none;
    color: var(--auth-ink);
    background: #fbfcfe;
    font-size: 14px;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.control select {
    padding-inline-end: 40px;
    cursor: pointer;
    appearance: none;
}

.control.has-toggle input {
    padding-inline-end: 48px;
}

.control input::placeholder {
    color: #a7b3c2;
}

.control input:focus,
.control select:focus {
    border-color: var(--auth-brand);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(4, 117, 104, .12);
}

.control input.is-invalid,
.control select.is-invalid {
    border-color: var(--auth-danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .12);
}

.control:focus-within .control-icon {
    color: var(--auth-brand);
}

.select-arrow {
    inset-inline-end: 13px;
    color: #94a3b8;
    pointer-events: none;
}

.select-arrow svg {
    width: 17px;
    height: 17px;
}

.password-toggle {
    inset-inline-end: 7px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #64748b;
    background: transparent;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus {
    color: var(--auth-brand);
    background: rgba(4, 117, 104, .08);
    outline: none;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.password-toggle .eye-closed {
    display: none;
}

.password-toggle.is-visible .eye-open {
    display: none;
}

.password-toggle.is-visible .eye-closed {
    display: block;
}

.submit-btn {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
    padding: 11px 18px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-blue) 100%);
    box-shadow: 0 18px 30px -20px rgba(4, 117, 104, .9);
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.submit-btn svg {
    width: 18px;
    height: 18px;
}

.submit-btn:hover,
.submit-btn:focus {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 22px 34px -20px rgba(4, 117, 104, .95);
    outline: none;
}

.submit-btn:active {
    transform: translateY(0);
}

html.ui-rtl .submit-btn svg {
    transform: scaleX(-1);
}

.field-error {
    margin-top: 7px;
}

/* =====================================================================
   Shared auth components — sign in / forgot / reset / change password.
   ===================================================================== */
.auth-note {
    margin: 0 0 16px;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.6;
}

.auth-note.is-info {
    color: var(--auth-blue);
    background: rgba(30, 96, 145, .08);
    border-color: rgba(30, 96, 145, .2);
}

.auth-note.is-success {
    color: #047857;
    background: rgba(16, 185, 129, .1);
    border-color: rgba(16, 185, 129, .28);
}

.auth-note.is-error {
    color: #b91c1c;
    background: rgba(239, 68, 68, .08);
    border-color: rgba(239, 68, 68, .28);
}

.auth-banner {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 0 16px;
    padding: 11px 14px;
    border: 1px solid rgba(245, 158, 11, .26);
    border-radius: 10px;
    color: #b45309;
    background: rgba(245, 158, 11, .1);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.6;
}

.auth-banner svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    color: #d97706;
}

/* password strength meter */
.pw-meter {
    margin-top: 9px;
}

.pw-meter[hidden] {
    display: none;
}

.pw-meter-track {
    height: 6px;
    border-radius: 999px;
    background: #e6ecf2;
    overflow: hidden;
}

.pw-meter-fill {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: #ef4444;
    transition: width .22s ease, background-color .22s ease;
}

.pw-meter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
}

.pw-meter-cap {
    color: var(--auth-muted);
    font-size: 11px;
    font-weight: 800;
}

.pw-meter-label {
    color: var(--auth-muted);
    font-size: 11.5px;
    font-weight: 900;
}

.pw-meter.is-weak .pw-meter-fill { width: 25%; background: #ef4444; }
.pw-meter.is-fair .pw-meter-fill { width: 50%; background: #f59e0b; }
.pw-meter.is-good .pw-meter-fill { width: 75%; background: #3b82f6; }
.pw-meter.is-strong .pw-meter-fill { width: 100%; background: #10b981; }
.pw-meter.is-weak .pw-meter-label { color: #dc2626; }
.pw-meter.is-fair .pw-meter-label { color: #d97706; }
.pw-meter.is-good .pw-meter-label { color: #2563eb; }
.pw-meter.is-strong .pw-meter-label { color: #059669; }

/* requirements checklist */
.pw-reqs-title {
    margin: 14px 0 7px;
    color: #334155;
    font-size: 11.5px;
    font-weight: 900;
}

.pw-reqs {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pw-reqs li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--auth-muted);
    font-size: 11.5px;
    font-weight: 800;
    transition: color .15s ease;
}

.pw-reqs li .tick {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 50%;
    color: transparent;
    background: #fff;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.pw-reqs li .tick svg {
    width: 10px;
    height: 10px;
    stroke-width: 3;
}

.pw-reqs li.is-met {
    color: #047857;
}

.pw-reqs li.is-met .tick {
    color: #fff;
    border-color: #10b981;
    background: #10b981;
}

/* confirm-password match hint */
.pw-match {
    display: none;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    font-size: 11.5px;
    font-weight: 800;
}

.pw-match.is-ok,
.pw-match.is-bad {
    display: flex;
}

.pw-match.is-ok { color: #047857; }
.pw-match.is-bad { color: #dc2626; }
.pw-match svg { width: 14px; height: 14px; }

/* caps-lock warning */
.caps-warn {
    display: none;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    color: #b45309;
    font-size: 11.5px;
    font-weight: 800;
}

.caps-warn.is-on {
    display: flex;
}

.caps-warn svg { width: 14px; height: 14px; }

/* footer links + secondary / split actions */
.auth-foot {
    margin-top: 18px;
    text-align: center;
}

.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--auth-muted);
    font-size: 12.5px;
    font-weight: 800;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--auth-brand);
}

.auth-link svg {
    width: 15px;
    height: 15px;
}

html.ui-rtl .auth-link svg {
    transform: scaleX(-1);
}

.btn-ghost {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1.5px solid var(--auth-line);
    border-radius: 10px;
    color: #475569;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.btn-ghost:hover {
    color: var(--auth-ink);
    border-color: #cbd5e1;
    background: #f8fafc;
}

.pw-actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.pw-actions .submit-btn {
    flex: 1;
    margin-top: 0;
}

.pw-actions .btn-ghost {
    flex: 0 0 auto;
    width: auto;
}

/* ----------------------------------------------------------------- toasts */
.app-toast-stack {
    position: fixed;
    top: 24px;
    inset-inline-end: 24px;
    z-index: 10500;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.app-toast {
    --toast-grad: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-blue) 100%);
    --toast-strong: var(--auth-brand);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 14px 12px;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 10px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 24px 44px -24px rgba(15, 23, 42, .45);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    transition: transform .24s ease, opacity .2s ease;
    pointer-events: auto;
}

.app-toast.is-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.app-toast.is-out {
    opacity: 0;
    transform: translateY(-8px) scale(.98);
}

.app-toast::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--toast-grad);
}

.app-toast-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--toast-grad);
}

.app-toast-icon svg {
    width: 21px;
    height: 21px;
}

.app-toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

.app-toast-title {
    margin: 0 0 2px;
    color: var(--toast-strong);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;
}

.app-toast-msg {
    color: #334155;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}

.app-toast-close {
    width: 28px;
    height: 28px;
    min-width: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #64748b;
    background: rgba(15, 23, 42, .04);
    cursor: pointer;
}

.app-toast-close:hover {
    color: #1f2937;
    background: rgba(15, 23, 42, .1);
}

.app-toast-close svg {
    width: 14px;
    height: 14px;
}

.app-toast-progress {
    position: absolute;
    inset-inline: 4px 0;
    bottom: 0;
    height: 3px;
    background: var(--toast-grad);
    transform-origin: right;
    animation-name: appToastShrink;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

html.ui-ltr .app-toast-progress {
    transform-origin: left;
}

@keyframes appToastShrink {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.app-toast-success {
    --toast-grad: linear-gradient(135deg, #10b981 0%, #047857 100%);
    --toast-strong: #047857;
}

.app-toast-error {
    --toast-grad: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    --toast-strong: #b91c1c;
}

.app-toast-warning {
    --toast-grad: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    --toast-strong: #b45309;
}

.app-toast-info {
    --toast-grad: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-blue) 100%);
    --toast-strong: var(--auth-brand);
}

/* =============================================================== responsive */
@media (max-width: 1180px) {
    .auth-brand { padding: 40px 40px; }
    .auth-form-pane { padding: 30px 40px; }
    .brand-features { grid-template-columns: 1fr; gap: 13px; }
}

@media (max-width: 920px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        padding: 26px 26px 30px;
    }

    .auth-brand::after { display: none; }

    .auth-brand-body {
        padding-block: 18px 0;
    }

    .brand-lead,
    .brand-features,
    .auth-brand-foot {
        display: none;
    }

    .brand-title {
        font-size: 26px;
    }

    .auth-form-pane {
        padding: 24px 26px 34px;
    }
}

@media (max-width: 520px) {
    .auth-brand { padding: 22px 20px 26px; }
    .auth-brand-top { gap: 11px; }
    .brand-logo { width: 64px; min-width: 64px; min-height: 42px; }
    .brand-name strong { font-size: 18px; }
    .brand-title { font-size: 22px; }

    .auth-form-pane { padding: 22px 20px 30px; }

    .auth-card h2 { font-size: 23px; }

    .field-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .control input,
    .control select {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
    }
}
