:root {
    --bg: #f6f7f1;
    --surface: #ffffff;
    --surface-soft: #f4f7ee;
    --card-bg: rgba(255, 255, 255, 0.91);
    --primary: #6f8064;
    --primary-dark: #4f5d47;
    --primary-soft: #e5f0dc;
    --accent: #afc49a;
    --warning: #d89a3d;
    --text: #111827;
    --muted: #66705f;
    --border: #dde3d3;
    --border-soft: #edf1e7;
    --shadow: 0 24px 70px rgba(63, 76, 54, 0.11);
    --shadow-soft: 0 12px 32px rgba(63, 76, 54, 0.075);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Inter, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(221, 236, 207, 0.95), transparent 360px),
        radial-gradient(circle at bottom right, rgba(175, 196, 154, 0.28), transparent 420px),
        linear-gradient(135deg, #f8faf3 0%, #f6f7f1 50%, #eef3e6 100%);
}

a { color: inherit; }

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(380px, 0.86fr) minmax(440px, 1fr);
    gap: clamp(28px, 6vw, 72px);
    align-items: center;
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 34px 0;
}

html[dir="rtl"] .auth-page { direction: rtl; }
html[dir="ltr"] .auth-page { direction: ltr; }
html[dir="rtl"] .auth-panel,
html[dir="rtl"] .auth-preview { direction: rtl; text-align: right; }
html[dir="ltr"] .auth-panel,
html[dir="ltr"] .auth-preview { direction: ltr; text-align: left; }

.auth-panel {
    width: min(520px, 100%);
    justify-self: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    padding: 26px;
}

.signup-panel { width: min(540px, 100%); }

.auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 34px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.035em;
}

.brand-mark {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 7px rgba(111, 128, 100, 0.12);
    flex: 0 0 auto;
}

.language-toggle {
    min-width: 38px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--primary-dark);
    padding: 8px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.eyebrow {
    display: inline-flex;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border: 1px solid #c8d9b8;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 14px;
}

.auth-copy h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.15;
    letter-spacing: -0.045em;
}

.auth-copy p {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

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

.auth-form label {
    display: grid;
    gap: 7px;
}

.auth-form label > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.auth-form input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    font: inherit;
    padding: 0 13px;
    outline: none;
    transition: 160ms ease;
}

.auth-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(111, 128, 100, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 11px 16px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 900;
    cursor: pointer;
    text-decoration: none;
    transition: 170ms ease;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(79, 93, 71, 0.16);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.auth-message {
    min-height: 20px;
    margin-top: 10px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.6;
}

.auth-message.failed { color: #b42318; }

.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.auth-links a {
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 900;
}

.auth-links a:hover { text-decoration: underline; }

.auth-preview {
    justify-self: center;
    width: min(560px, 100%);
}

.preview-window {
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(221, 227, 211, 0.95);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    padding: 22px;
    display: grid;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.compact-preview-window { min-height: 440px; align-content: center; }
.signup-preview-window { min-height: 500px; align-content: center; }

.preview-window::before {
    content: "";
    position: absolute;
    inset: auto -110px -140px auto;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(111, 128, 100, 0.08);
    pointer-events: none;
}

.preview-topbar {
    display: flex;
    gap: 7px;
    position: relative;
    z-index: 1;
}

.preview-topbar span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #b9c9aa;
}

.preview-status,
.preview-grid > div,
.preview-line,
.signup-flow-step {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    box-shadow: none;
}

.preview-status { padding: 17px; }
.preview-grid > div { padding: 15px; }

.preview-status small,
.preview-grid small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 7px;
}

.preview-status strong {
    display: block;
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 4px;
}

.preview-status span { color: var(--primary-dark); font-size: 13px; font-weight: 850; }

.preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.preview-grid strong {
    display: block;
    font-size: 33px;
    letter-spacing: -0.04em;
    color: var(--text);
}

.preview-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    min-height: 48px;
    font-size: 13px;
    color: var(--text);
}

.preview-line > span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 5px rgba(111, 128, 100, 0.10);
    flex: 0 0 auto;
}

.preview-line.neutral > span {
    background: #9aa98d;
    box-shadow: 0 0 0 5px rgba(111, 128, 100, 0.08);
}

.preview-line strong {
    font-size: 13px;
    line-height: 1.45;
    font-weight: 850;
    color: #293122;
}

html[dir="rtl"] .preview-line { flex-direction: row-reverse; }
html[dir="ltr"] .preview-line { flex-direction: row; }

.signup-flow-preview {
    display: grid;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.signup-flow-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px;
    min-height: 54px;
}

html[dir="rtl"] .signup-flow-step {
    grid-template-columns: minmax(0, 1fr) auto;
}

.signup-flow-step > span {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 900;
    grid-column: 1;
    grid-row: 1;
}

.signup-flow-step strong {
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
    line-height: 1.45;
    grid-column: 2;
    grid-row: 1;
}

html[dir="rtl"] .signup-flow-step > span { grid-column: 2; }
html[dir="rtl"] .signup-flow-step strong { grid-column: 1; }

.signup-flow-step.active {
    background: rgba(229, 240, 220, 0.9);
    border-color: #c8d9b8;
}

.signup-flow-step.active > span {
    background: var(--primary);
    color: #fff;
}

.signup-limits-grid strong {
    font-size: 28px;
}

.lang-ar { display: none; }
html[dir="rtl"] .lang-en { display: none !important; }
html[dir="rtl"] .lang-ar { display: inline !important; }
html[dir="ltr"] .lang-en { display: inline !important; }
html[dir="ltr"] .lang-ar { display: none !important; }

/* =========================================================
   Compact desktop login layout
   Preserve the two-column presentation on short desktop viewports.
   ========================================================= */
@media (min-width: 961px) and (max-height: 700px) {
    .auth-page {
        gap: clamp(20px, 3vw, 42px);
        padding: 14px 0;
    }

    .auth-panel {
        padding: 20px;
    }

    .auth-header {
        margin-bottom: 18px;
    }

    .auth-copy .eyebrow {
        margin-bottom: 10px;
        padding: 6px 11px;
    }

    .auth-copy h1 {
        margin-bottom: 8px;
        font-size: clamp(28px, 3vw, 34px);
        line-height: 1.1;
    }

    .auth-copy p {
        margin-bottom: 14px;
        font-size: 13px;
        line-height: 1.55;
    }

    .auth-form {
        gap: 10px;
    }

    .auth-form label {
        gap: 5px;
    }

    .auth-form input {
        height: 42px;
    }

    .btn {
        min-height: 44px;
        padding-block: 9px;
    }

    .auth-message {
        min-height: 16px;
        margin-top: 6px;
    }

    .auth-links {
        margin-top: 10px;
    }

    .preview-window {
        padding: 18px;
        gap: 9px;
    }

    .compact-preview-window {
        min-height: 360px;
    }

    .preview-status {
        padding: 13px;
    }

    .preview-grid > div {
        padding: 12px;
    }

    .preview-status strong {
        font-size: 21px;
    }

    .preview-grid strong {
        font-size: 28px;
    }

    .preview-line {
        min-height: 42px;
        padding: 10px 13px;
    }

    .signup-page .signup-panel {
        padding: 12px 16px;
    }

    .signup-page .signup-panel .auth-header {
        margin-bottom: 8px;
    }

    .signup-page .signup-panel .auth-brand {
        font-size: 16px;
    }

    .signup-page .signup-panel .language-toggle {
        min-height: 30px;
        padding: 6px 10px;
    }

    .signup-page .signup-panel .auth-copy .eyebrow {
        margin-bottom: 5px;
        padding: 5px 10px;
        font-size: 11px;
    }

    .signup-page .signup-panel .auth-copy h1 {
        margin-bottom: 4px;
        font-size: clamp(23px, 2.35vw, 29px);
        line-height: 1.05;
    }

    .signup-page .signup-panel .auth-copy p {
        margin-bottom: 7px;
        font-size: 11.5px;
        line-height: 1.35;
    }

    .signup-page .signup-panel .auth-form {
        gap: 5px;
    }

    .signup-page .signup-panel .auth-form label {
        gap: 2px;
    }

    .signup-page .signup-panel .auth-form label > span {
        font-size: 11px;
    }

    .signup-page .signup-panel .auth-form input {
        height: 34px;
        border-radius: 11px;
        padding-inline: 11px;
    }

    .signup-page .signup-panel .btn {
        min-height: 36px;
        padding-block: 6px;
        border-radius: 11px;
        font-size: 12.5px;
    }

    .signup-page .signup-panel .auth-message {
        min-height: 0;
        margin-top: 3px;
        font-size: 11.5px;
        line-height: 1.3;
    }

    .signup-page .signup-panel .auth-message:empty {
        display: none;
    }

    .signup-page .signup-panel .auth-links {
        margin-top: 5px;
        font-size: 11px;
    }

    .signup-page .signup-panel .auth-links a {
        font-size: 11px;
    }

    .signup-preview-window {
        min-height: 340px;
        padding: 13px;
        gap: 6px;
    }

    .signup-preview-window .preview-status {
        padding: 10px 12px;
    }

    .signup-preview-window .preview-status small {
        margin-bottom: 4px;
    }

    .signup-preview-window .preview-status strong {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .signup-preview-window .preview-status span {
        font-size: 11.5px;
    }

    .signup-flow-preview {
        gap: 5px;
    }

    .signup-flow-step {
        min-height: 38px;
        padding: 7px 9px;
        gap: 8px;
        border-radius: 14px;
    }

    .signup-flow-step > span {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .signup-flow-step strong {
        font-size: 12px;
        line-height: 1.3;
    }

    .signup-limits-grid {
        gap: 7px;
    }

    .signup-limits-grid > div {
        padding: 9px 11px;
    }

    .signup-limits-grid small {
        margin-bottom: 3px;
    }

    .signup-limits-grid strong {
        font-size: 20px;
    }

    .signup-preview-window .preview-line {
        min-height: 36px;
        padding: 7px 10px;
        font-size: 11.5px;
        border-radius: 14px;
    }

    .signup-preview-window .preview-line strong {
        font-size: 11.5px;
        line-height: 1.25;
    }
}

@media (max-width: 960px) {
    .auth-page {
        grid-template-columns: 1fr;
        width: min(100% - 28px, 560px);
        padding: 18px 0;
    }

    .auth-preview { display: none; }
    .auth-panel { padding: 22px; }
}

@media (max-width: 520px) {
    .auth-links {
        align-items: stretch;
        flex-direction: column;
    }

    .language-toggle { min-width: 100%; }
    .auth-header { align-items: flex-start; flex-direction: column-reverse; }
}

/* Auth password visibility controls */
.password-input-wrap {
    position: relative;
    width: 100%;
}

.password-input-wrap > input {
    width: 100%;
    padding-inline-end: 48px;
}

.password-toggle {
    position: absolute;
    inset-inline-end: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--primary-dark);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: var(--primary-soft);
}

.password-toggle-icon {
    width: 20px;
    height: 20px;
    display: block;
    overflow: visible;
}

.password-toggle-icon .password-eye-outline,
.password-toggle-icon .password-eye-pupil,
.password-toggle-icon .password-eye-slash {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-toggle-icon .password-eye-slash {
    opacity: 0;
}

.password-toggle.is-visible .password-eye-slash {
    opacity: 1;
}

.remember-login-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    width: fit-content;
    cursor: pointer;
}

.remember-login-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
}

/* Login verification resend action */
.auth-inline-action {
    width: fit-content;
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.auth-inline-action:hover {
    opacity: 0.8;
}

.auth-inline-action:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
    border-radius: 4px;
}

.auth-inline-action:disabled {
    opacity: 0.55;
    cursor: wait;
}

.auth-inline-action[hidden] {
    display: none !important;
}
