/* Layout stays LTR for every site. Reading direction is set on text only. */
html:is([dir="ltr"], [data-layout-direction="ltr"]) {
  direction: ltr;
}

html[data-text-direction="rtl"] #app :is(
  .label, .subtitle, .error-msg, .field-error, .page-title, .team-desc,
  .team-list-total, .about-block-title, .about-block-body, .content-html :is(p, li),
  .content-section :is(p, li), .finance-label, .menu-label, .invite-line,
  .rules-block-title, .withdraw-section-title, .withdraw-hint-label,
  .product-rating-hint, .ref-screen-hero-title, .ref-screen-hero-sub, .ref-screen-hero-cta
) {
  unicode-bidi: plaintext;
}

html[data-text-direction="rtl"] #app :is(
  input:not([type="checkbox"], [type="radio"], [type="file"]), textarea
) {
  direction: rtl;
  unicode-bidi: plaintext;
}

#app :is(
  input[type="tel"], input[type="number"], input[type="password"],
  input[inputmode="numeric"], input[inputmode="decimal"], input[autocomplete="username"],
  .auth-view input[autocomplete="off"], .register-card input[autocomplete="off"],
  .withdraw-input--amount, .replenish-input, [translate="no"]:not(.credit-card-brand-text), .ref-screen-brand,
  .ref-scroll-amount, .ref-scroll-id, .ref-screen-performer-id, .withdraw-balance-value,
  .replenish-balance-value, .withdraw-currency, .withdraw-hint-value, .rules-metric-value,
  .finance-value, .vip-phone, .vip-level
) {
  direction: ltr;
  unicode-bidi: isolate;
}

html[dir="ltr"] #app :is(
  input[type="tel"], input[type="number"], input[type="password"],
  input[inputmode="numeric"], input[inputmode="decimal"], input[autocomplete="username"],
  .auth-view input[autocomplete="off"], .register-card input[autocomplete="off"],
  input[dir="ltr"], .withdraw-input--account, .withdraw-input--amount, .replenish-input
) {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

#app :is(.rules-list, .rules-list-item, .withdraw-hint) {
  direction: ltr;
}

#app .withdraw-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: .45rem;
}
#app .withdraw-hint-value { white-space: nowrap; }

.profile-view .avatar--fig1 { background:#e8e8e8 !important; box-shadow:0 2px 10px #0000000d !important; }
.profile-view .avatar--fig1 .avatar-default-icon { color:#6b7280 !important; }
.withdraw-brand-logo { background:#e5e7eb !important; color:#6b7280 !important; box-shadow:0 2px 10px #0000000d !important; }
.withdraw-brand-logo .withdraw-brand-icon { color:#6b7280 !important; }


/* Anchor form copy and explanatory text at the start of their LTR sections.
   Paragraph base direction still comes from the text itself. */
#app :is(
  .login-card .subtitle,
  :is(.login-card, .register-card, .security-view) :is(.label, .error-msg, .field-error, .hint-msg),
  :is(.login-card, .register-card, .security-view) .input,
  .withdraw-form-card .withdraw-input,
  .order-detail-view .page-title,
  .team-view :is(.team-desc, .team-list-total),
  .about-view :is(.page-title, .about-block-title, .about-block-body, .content-html),
  .about-view .content-html :is(h1, h2, h3, h4, h5, h6, p, blockquote, li),
  .order-modal-card .product-rating-hint
) {
  text-align: left;
}

#app .about-view .content-html :is(ol, ul, li) {
  direction: ltr;
}

#app .about-view .content-html li {
  unicode-bidi: normal;
}

#app .about-view .page-header {
  direction: ltr;
  justify-content: flex-start;
}

html[data-text-direction="rtl"] #app .about-view .content-html :is(h1, h2, h3, h4, h5, h6) {
  unicode-bidi: plaintext;
}
