@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700;800&display=swap') screen and (min-width: 761px);
/* Load one consistent Arabic typeface across desktop and mobile. */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700;800&display=swap');
/* Arabic presentation only: layout changes never affect server-side values. */
html[lang="ar"]{direction:rtl} html[lang="ar"] body{font-family:"Noto Sans Arabic","Segoe UI",Tahoma,"Geeza Pro",Arial,sans-serif;line-height:1.75}
html[lang="ar"] :is(h1,h2,h3,h4,h5,h6,button,label,select,summary){font-family:"Noto Sans Arabic","Segoe UI",Tahoma,Arial,sans-serif;line-height:1.5}
html[lang="ar"] :is(main,article,.card,.form-card,.container,.legal-page){text-align:start}
html[lang="ar"] :is(input,textarea,select){text-align:start}
html[lang="ar"] :is(input[type="email"],input[type="tel"],input[type="url"],input[type="number"],input[type="password"],input[name*="code" i],input[id*="code" i],input[name*="token" i],input[id*="token" i],input[name*="otp" i],input[name*="mfa" i],input[autocomplete="one-time-code"],input[inputmode="numeric"],input[pattern="[0-9]{6}"],input[name*="stripe" i]){direction:ltr!important;text-align:left!important;unicode-bidi:isolate;font-family:Arial,system-ui,sans-serif;letter-spacing:normal}
html[lang="ar"] :is(code,pre,kbd,samp,[data-ltr],.amanah-time,time){direction:ltr;unicode-bidi:isolate}
html[lang="ar"] .amanah-compact-links{right:auto;left:0;text-align:start}
.amanah-compact-language,.lang-switch{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.amanah-compact-language{padding:8px;justify-content:center;border-bottom:1px solid #ddd}
.amanah-compact-language button,.lang-switch button{border:1px solid #ddd;border-radius:7px;background:transparent;padding:5px 9px;cursor:pointer}
html[lang="ar"] :is(.legal-page,p,li){overflow-wrap:break-word}
@media(max-width:760px){html[lang="ar"] :is(input,textarea,select){max-width:100%;min-width:0}html[lang="ar"] .amanah-compact-links{max-width:calc(100vw - 24px)}}

/* Language-switch hotfix: override obsolete English-only display:none!important rules in style.css and css-fixes.css. */
html body header .container.nav .nav-actions .lang-switch { display:inline-flex !important; align-items:center; gap:6px; visibility:visible !important; }
html body header .container.nav .nav-actions .lang-switch button.lang-button[data-lang="en"],
html body header .container.nav .nav-actions .lang-switch button.lang-button[data-lang="ar"] { display:inline-flex !important; align-items:center; justify-content:center; visibility:visible !important; opacity:1 !important; }
html body header .container.nav .amanah-compact-menu .amanah-compact-language { display:flex !important; gap:6px; align-items:center; }
html body header .container.nav .amanah-compact-menu .amanah-compact-language button.lang-button[data-lang="en"],
html body header .container.nav .amanah-compact-menu .amanah-compact-language button.lang-button[data-lang="ar"] { display:inline-flex !important; align-items:center; justify-content:center; visibility:visible !important; opacity:1 !important; }
@media(min-width:1101px){html body header .container.nav .nav-actions .lang-switch {display:inline-flex !important;}}

/* Screenshot follow-up: bilingual and mixed-direction layout. */
html[lang="ar"] :is(.amanah-chat-bubble,.amanah-chat-meta,.amanah-chat-message,.amanah-chat-thread){text-align:start}
html[lang="ar"] :is(.amanah-chat-meta,.amanah-time,time){unicode-bidi:plaintext}
html[lang="ar"] :is(.form-card,.card,fieldset,label,.page-header,.hero-content){min-width:0}
html[lang="ar"] :is(input,textarea,select){font-family:Tahoma,"Segoe UI",Arial,sans-serif}
html[lang="ar"] :is(input[type="email"],input[type="password"],input[type="tel"],input[type="url"],input[inputmode="numeric"],input[autocomplete="one-time-code"]){direction:ltr!important;text-align:left!important;unicode-bidi:isolate}
html[lang="ar"] :is(.amanah-room-actions,.amenah-actions-panel,.amanah-actions-panel){text-align:start}
html[lang="ar"] .nav-actions .lang-switch{direction:ltr}
html[lang="ar"] .amanah-compact-language{direction:ltr}
@media(max-width:760px){html[lang="ar"] :is(.container,.card,.form-card){max-width:100%}html[lang="ar"] :is(h1,h2,h3,p,label,button){overflow-wrap:anywhere}}

/* Bilingual correction 8: isolated direction for code, e-mail, telephone and OTP */
html[dir="rtl"] input[type="email"],html[dir="rtl"] input[type="tel"],html[dir="rtl"] input[inputmode="numeric"],html[dir="rtl"] input[autocomplete="one-time-code"],html[dir="rtl"] .profile-small,html[dir="rtl"] time { direction:ltr; unicode-bidi:isolate; }
html[dir="rtl"] [data-no-translate] {unicode-bidi:isolate;}

/* Modern Arabic typography, with device-native fallbacks; no externally loaded font. */
html[lang="ar"] :is(p,li,span,a,button,label,h1,h2,h3,h4,summary,select){font-family:"Noto Sans Arabic","Segoe UI",Tahoma,"Geeza Pro",Arial,sans-serif}
html[lang="ar"] :is(.member-name,.profile-name,[data-no-translate],.amanah-chat-message){unicode-bidi:plaintext}
html[lang="ar"] :is(.hero-content,.card,.form-card){overflow-wrap:break-word}
html[lang="ar"] .amanah-compact-menu{max-width:min(100vw - 16px,360px)}
@media(max-width:700px){html[lang="ar"] :is(h1,h2,h3){line-height:1.42}html[lang="ar"] :is(.card,.form-card){overflow-wrap:break-word}}


/* Mobile Arabic menu: anchor the popup to the physical right edge of its
   trigger. A previous left:0 RTL override opened it beyond the viewport. */
@media (max-width: 1100px) {
  html[lang="ar"] body > header .container.nav > .amanah-compact-menu,
  html[dir="rtl"] body > header .container.nav > .amanah-compact-menu {
    position: relative;
    min-width: 0;
  }
  html[lang="ar"] body > header .container.nav .amanah-compact-menu > .amanah-compact-links,
  html[dir="rtl"] body > header .container.nav .amanah-compact-menu > .amanah-compact-links {
    position: absolute;
    inset-inline: auto !important;
    left: auto !important;
    right: 0 !important;
    box-sizing: border-box;
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: min(70dvh, 540px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    direction: rtl;
    text-align: right;
    background: #fff;
    color: #173e39;
    visibility: visible;
  }
  html[lang="ar"] body > header .container.nav .amanah-compact-menu[open] > .amanah-compact-links > a,
  html[dir="rtl"] body > header .container.nav .amanah-compact-menu[open] > .amanah-compact-links > a {
    display: block !important;
    color: #173e39;
    visibility: visible;
    opacity: 1;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: right;
  }
  html[lang="ar"] body > header .container.nav .amanah-compact-menu > .amanah-compact-links .amanah-compact-language,
  html[dir="rtl"] body > header .container.nav .amanah-compact-menu > .amanah-compact-links .amanah-compact-language {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Center the site-wide footer in Arabic mode, overriding generic RTL container alignment. */
html[lang="ar"] body:not(.amanah-admin-page) > footer,
html[lang="ar"] body:not(.amanah-admin-page) > footer .container,
html[lang="ar"] body:not(.amanah-admin-page) > footer :is(p,.footer-copyright) {
  text-align: center !important;
}
html[lang="ar"] body:not(.amanah-admin-page) > footer .footer-links {
  display: flex;
  justify-content: center !important;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem 1rem;
}
html[lang="ar"] body:not(.amanah-admin-page) > footer .container > * {
  margin-inline: auto;
}

/* Arabic home hero: match the English composition, with Arabic copy on the
   clear left portion of the photograph. No overlay, glow or text background. */
html[lang="ar"] main .hero .hero-image > .container {
  direction: ltr;
  justify-content: flex-start;
}
html[lang="ar"] main .hero .hero-image > .container > div {
  width: min(520px, 62%);
  max-width: min(520px, 62%) !important;
  margin: 0;
  direction: rtl;
  text-align: right;
}
html[lang="ar"] main .hero .hero-image h1 {
  display: block;
  font-size: clamp(1.75rem, 3.3vw, 3.35rem);
  line-height: 1.4;
  margin: 0 0 14px;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
html[lang="ar"] main .hero .hero-image p[data-i18n="heroText"] {
  display: block;
  font-size: clamp(.875rem, 1.2vw, 1.1rem);
  line-height: 1.75;
  margin: 0 0 20px;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
html[lang="ar"] main .hero .hero-image .badge[data-i18n="heroBadge"] {
  display: inline-flex;
  padding: 6px 12px;
  margin-bottom: 12px;
  background: #edf7f4;
  text-shadow: none;
  box-shadow: none;
}
html[lang="ar"] main .hero .hero-image .hero-actions {
  direction: rtl;
  justify-content: flex-start;
  align-items: center;
}
@media (max-width: 760px) {
  html[lang="ar"] main .hero .hero-image > .container > div {
    width: 61%;
    max-width: 61% !important;
  }
  html[lang="ar"] main .hero .hero-image h1 {
    font-size: clamp(1.65rem, 5vw, 2.1rem);
  }
  html[lang="ar"] main .hero .hero-image p[data-i18n="heroText"] {
    font-size: clamp(.79rem, 2.7vw, .94rem);
    line-height: 1.6;
  }
  html[lang="ar"] main .hero .hero-image .hero-actions {
    gap: 8px;
  }
}

/* Room Actions label: translate the interface only; keep menu behavior intact. */
.amanah-room-label-ar { display: none; }
html[lang="ar"] .amanah-actions-menu > summary .amanah-room-label-en { display: none; }
html[lang="ar"] .amanah-actions-menu > summary .amanah-room-label-ar { display: inline; }

/* Wali/ended introduction: exact bilingual UI strings; member content unchanged. */
.amanah-ui-ar { display:none; }
html[lang="ar"] .amanah-ui-en { display:none !important; }
html[lang="ar"] .amanah-ui-ar { display:inline !important; }

/* Ended-reopen and validation messages use explicit bilingual fragments. */
.amanah-ui-ar{display:none}
html[lang="ar"] .amanah-ui-en{display:none!important}
html[lang="ar"] .amanah-ui-ar{display:inline!important}

/* Keep footer at viewport bottom on short Arabic pages without fixed positioning. */
html[lang="ar"] body:not(.amanah-admin-page){min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;}
html[lang="ar"] body:not(.amanah-admin-page) > footer{margin-top:auto;flex-shrink:0;text-align:center!important;}
html[lang="ar"] body:not(.amanah-admin-page) > footer .container{text-align:center!important;}
html[lang="ar"] body:not(.amanah-admin-page) > footer .footer-links{justify-content:center!important;}

/* Unified Arabic typography; keep the previously approved layout and colors. */
html[lang="ar"] body,
html[lang="ar"] :is(h1,h2,h3,h4,h5,h6,p,li,span,a,button,label,summary,select,textarea),
html[lang="ar"] input:not([type="email"]):not([type="url"]):not([type="tel"]):not([type="number"]):not([type="password"]):not([inputmode="numeric"]):not([autocomplete="one-time-code"]) {
  font-family: "Noto Sans Arabic", Tahoma, "Segoe UI", Arial, sans-serif;
}
/* English-only values retain left-to-right display. */
html[lang="ar"] :is(input[type="email"],input[type="url"],input[type="tel"],input[type="number"],input[type="password"],input[inputmode="numeric"],input[autocomplete="one-time-code"],code,pre,kbd,samp) {
  font-family: Arial, system-ui, sans-serif;
}


/* Amanah desktop Arabic Tajawal font trial — no changes at 760px or below.
   Preserve Latin/numeric-entry fields, verification codes, and code samples. */
@media screen and (min-width: 761px) {
  html[lang="ar"] body,
  html[lang="ar"] :is(h1,h2,h3,h4,h5,h6,p,li,span,a,button,label,summary,select,textarea),
  html[lang="ar"] input:not([type="email"]):not([type="url"]):not([type="tel"]):not([type="number"]):not([type="password"]):not([inputmode="numeric"]):not([autocomplete="one-time-code"]) {
    font-family: "Tajawal", "Noto Sans Arabic", Tahoma, "Segoe UI", Arial, sans-serif !important;
  }
  html[lang="ar"] :is(input[type="email"],input[type="url"],input[type="tel"],input[type="number"],input[type="password"],input[inputmode="numeric"],input[autocomplete="one-time-code"],code,pre,kbd,samp) {
    font-family: Arial, system-ui, sans-serif !important;
  }
}
