/*
 * Korosh Smart Admin - Frontend Foundation / Theme Isolation
 * Scope is intentionally limited to KSA-owned surfaces. Do not add naked
 * selectors such as button/input/form/table here.
 */
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-wishlist-toggle,.ksa-recovery-card){
  --ksa-fe-font:var(--ksa-customer-font,"Vazirmatn",Tahoma,Arial,sans-serif);
  --ksa-fe-text:#111827;
  --ksa-fe-muted:#667085;
  --ksa-fe-line:#dfe5ec;
  --ksa-fe-bg:#f6f8fb;
  --ksa-fe-surface:#fff;
  --ksa-fe-primary:var(--ksa-primary,#4f46e5);
  --ksa-fe-primary-hover:var(--ksa-primary-hover,#4338ca);
  --ksa-fe-danger:#dc2626;
  --ksa-fe-radius-card:16px;
  --ksa-fe-radius-control:10px;
  font-family:var(--ksa-fe-font)!important;
  font-style:normal;
  letter-spacing:normal;
  text-transform:none;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

/* Box model must not depend on the theme's reset. */
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-recovery-card),
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-recovery-card) *,
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-recovery-card) *::before,
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-recovery-card) *::after{box-sizing:border-box}

/* Standalone portal owns the viewport. Theme body constraints must not leak in. */
html:has(body.ksa-portal-standalone){margin:0!important;padding:0!important;width:100%!important;max-width:none!important;background:#f6f8fb!important}
body.ksa-portal-standalone{
  margin:0!important;
  padding:0!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  min-height:100vh!important;
  overflow-x:hidden!important;
  background:#f6f8fb!important;
  color:#111827!important;
  font-family:var(--ksa-customer-font,"Vazirmatn",Tahoma,Arial,sans-serif)!important;
  font-size:14px!important;
  line-height:1.7!important;
}
body.ksa-portal-standalone>.ksa-portal-app,
body.ksa-portal-standalone>.ksa-login-shell{
  position:relative!important;
  inset:auto!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
  float:none!important;
  clear:both!important;
  transform:none!important;
  filter:none!important;
  text-align:initial;
}
body.ksa-portal-standalone .ksa-portal-app{isolation:isolate;min-height:100vh!important;background:#f6f8fb!important;color:#111827!important}
body.ksa-portal-standalone .ksa-portal-layout{width:100%!important;max-width:none!important;margin:0!important;float:none!important}
body.ksa-portal-standalone .ksa-portal-content{width:auto!important;max-width:none!important;min-width:0!important;margin:0!important;float:none!important}
body.ksa-portal-standalone .ksa-portal-sidebar{width:auto!important;max-width:none!important;float:none!important}
body.ksa-portal-standalone .ksa-portal-content>.woocommerce,
body.ksa-portal-standalone .ksa-portal-content>.woocommerce-MyAccount-content,
body.ksa-portal-standalone .woocommerce-MyAccount-content{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
  padding:0!important;
  float:none!important;
  clear:both!important;
}

/* Typography isolation. Themes frequently alter headings, labels and links. */
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-recovery-card) :where(h1,h2,h3,h4,h5,h6,p,span,strong,b,small,label,legend,a,button,input,select,textarea,table,th,td,address,code){
  font-family:inherit!important;
  letter-spacing:normal!important;
  text-transform:none!important;
}
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-shared-public) :where(h1,h2,h3,h4,h5,h6){font-style:normal!important;text-decoration:none!important}
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public) a{-webkit-tap-highlight-color:transparent}

/* Controls: normalize geometry, not business styling. */
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-recovery-card) :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea,button){
  box-sizing:border-box!important;
  font-family:inherit!important;
  line-height:1.35!important;
  text-indent:0!important;
  text-shadow:none!important;
  outline-offset:2px;
}
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-recovery-card) :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  max-width:100%!important;
  color:#111827!important;
  background-color:#fff!important;
}
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-recovery-card) button{
  appearance:none;
  -webkit-appearance:none;
  font-family:inherit!important;
}
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-recovery-card) :where(button,a)::before,
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public,.ksa-recovery-card) :where(button,a)::after{
  text-transform:none!important;
}

/* Images/logos must not inherit theme widths or aspect rules. */
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public) img{height:auto;max-width:100%;border:0;box-shadow:none}
.ksa-portal-logo-img{display:block!important;width:auto!important;max-width:180px!important;height:auto!important;max-height:42px!important;object-fit:contain!important;margin:0!important}
.ksa-otp-logo{display:flex!important;align-items:center!important;justify-content:center!important;min-height:38px!important;margin:0 auto 4px!important}
.ksa-otp-logo :where(img,svg){display:block!important;width:auto!important;max-width:150px!important;height:auto!important;max-height:42px!important;object-fit:contain!important;margin:0 auto!important}

/* OTP modal owns its own visual tree, regardless of where shortcode was rendered. */
.ksa-otp-modal[hidden]{display:none!important}
.ksa-otp-modal{
  position:fixed!important;
  inset:0!important;
  z-index:2147483000!important;
  display:grid!important;
  place-items:center!important;
  width:100vw!important;
  max-width:none!important;
  height:100dvh!important;
  min-height:100vh!important;
  margin:0!important;
  padding:20px!important;
  overflow:auto!important;
  direction:rtl!important;
  font-family:var(--ksa-fe-font)!important;
  line-height:1.55!important;
  transform:none!important;
  filter:none!important;
  isolation:isolate;
}
.ksa-otp-backdrop{position:absolute!important;inset:0!important;width:auto!important;height:auto!important;margin:0!important;background:rgba(10,16,28,.58)!important;backdrop-filter:blur(3px)}
.ksa-otp-dialog{
  position:relative!important;
  z-index:1!important;
  display:block!important;
  width:min(420px,calc(100vw - 28px))!important;
  max-width:420px!important;
  min-width:0!important;
  height:auto!important;
  min-height:0!important;
  margin:auto!important;
  padding:26px!important;
  border:0!important;
  border-radius:22px!important;
  background:#fff!important;
  color:#171923!important;
  box-shadow:0 28px 80px rgba(0,0,0,.26)!important;
  text-align:right!important;
  overflow:visible!important;
  float:none!important;
  transform:none;
}
.ksa-otp-close{
  position:absolute!important;top:13px!important;left:13px!important;right:auto!important;
  display:grid!important;place-items:center!important;width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;
  margin:0!important;padding:0!important;border:0!important;border-radius:50%!important;background:#f2f4f7!important;color:#525866!important;
  font-size:23px!important;font-weight:400!important;line-height:1!important;box-shadow:none!important;cursor:pointer!important
}
.ksa-otp-brand{display:grid!important;justify-items:center!important;gap:4px!important;width:100%!important;margin:4px 0 22px!important;padding:0!important;text-align:center!important}
.ksa-otp-brand strong{display:block!important;margin:0!important;color:#171923!important;font-size:22px!important;font-weight:900!important;line-height:1.45!important}
.ksa-otp-brand span{display:block!important;margin:0!important;color:#7a8190!important;font-size:13px!important;font-weight:500!important;line-height:1.6!important}
.ksa-otp{display:block!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important;color:#171923!important}
.ksa-otp-step{width:100%!important;margin:0!important;padding:0!important}
.ksa-otp label{display:block!important;width:auto!important;margin:0!important;padding:0!important;color:#2f3747!important;font-size:13px!important;font-weight:800!important;line-height:1.7!important;float:none!important;text-align:right!important}
.ksa-otp input:not([type="radio"]):not([type="checkbox"]){
  display:block!important;width:100%!important;max-width:none!important;height:50px!important;min-height:50px!important;margin:0!important;padding:0 13px!important;
  border:1px solid #ccd5df!important;border-radius:11px!important;background:#fff!important;color:#171923!important;box-shadow:none!important;
  font-size:18px!important;font-weight:500!important;line-height:50px!important;text-align:center!important;float:none!important;outline:0!important
}
.ksa-otp input::placeholder{color:#8b93a1!important;opacity:1!important;font-weight:400!important}
.ksa-otp input:focus{border-color:#4f46e5!important;box-shadow:0 0 0 3px rgba(79,70,229,.12)!important}
.ksa-otp-primary{
  display:flex!important;align-items:center!important;justify-content:center!important;width:100%!important;max-width:none!important;height:48px!important;min-height:48px!important;
  margin:0!important;padding:0 18px!important;border:0!important;border-radius:11px!important;background:#242430!important;color:#fff!important;
  font-size:14px!important;font-weight:800!important;line-height:1!important;text-decoration:none!important;box-shadow:0 8px 22px rgba(24,31,45,.13)!important;cursor:pointer!important
}
.ksa-otp-primary:hover,.ksa-otp-primary:focus,.ksa-otp-primary:active{background:#191922!important;color:#fff!important;filter:none!important}
.ksa-otp-channel-picker{width:100%!important;margin:0!important;padding:0!important}
.ksa-otp-channel-option{width:100%!important;float:none!important}
.ksa-otp-channel-option input[type="radio"]{width:18px!important;height:18px!important;min-width:18px!important;margin:0!important;padding:0!important}
.ksa-otp-status{width:100%!important}

/* Account dropdown / header component isolation. */
.ksa-account-menu{position:relative!important;display:inline-block!important;width:auto!important;max-width:100%!important;margin:0!important;padding:0!important;direction:rtl!important;float:none!important}
.ksa-account-trigger{display:flex!important;align-items:center!important;gap:10px!important;width:auto!important;min-height:42px!important;margin:0!important;padding:0 14px!important;border:1px solid #d8dee7!important;border-radius:12px!important;background:#fff!important;color:#171923!important;box-shadow:none!important}
.ksa-account-dropdown{right:0!important;left:auto!important;width:auto!important;min-width:210px!important;max-width:min(320px,calc(100vw - 24px))!important;margin:0!important;padding:7px!important;background:#fff!important;color:#171923!important;border:1px solid #d8dee7!important}
.ksa-account-dropdown a{display:flex!important;align-items:center!important;gap:8px!important;width:100%!important;margin:0!important;padding:10px 11px!important;color:#171923!important;background:transparent!important;text-decoration:none!important;white-space:nowrap!important}

/* Public shared invoice sits inside the site's header/footer but owns its content width. */
.ksa-shared-public{position:relative!important;display:block!important;width:100%!important;max-width:none!important;min-width:0!important;margin:0!important;padding:32px 0!important;background:#f6f8fb!important;color:#111827!important;direction:rtl!important;clear:both!important;float:none!important}
.ksa-shared-public .ksa-shared-public-main{display:block!important;width:min(1120px,calc(100% - 32px))!important;max-width:1120px!important;min-width:0!important;margin:0 auto!important;padding:0!important;float:none!important;clear:both!important}
.ksa-shared-public :where(form,table,section,article,div){max-width:100%}
.ksa-shared-public :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){font-size:14px!important}

/* Product-loop controls must not become theme-sized giant buttons. */
.ksa-wishlist-toggle{appearance:none!important;-webkit-appearance:none!important;box-sizing:border-box!important;font-family:var(--ksa-fe-font)!important;text-transform:none!important;letter-spacing:normal!important}

/* Accessibility / hidden semantics should survive aggressive theme CSS. */
:where(.ksa-portal-app,.ksa-otp-modal,.ksa-account-menu,.ksa-shared-public) [hidden]{display:none!important}

@media(max-width:782px){
  body.ksa-portal-standalone{font-size:14px!important}
  .ksa-otp-modal{padding:14px!important}
  .ksa-otp-dialog{width:min(420px,calc(100vw - 20px))!important;padding:22px 18px!important;border-radius:18px!important}
}
@media(max-width:420px){
  .ksa-otp-modal{padding:8px!important}
  .ksa-otp-dialog{width:calc(100vw - 16px)!important;padding:22px 16px!important}
}

/* beta.23 - one typography source for every KSA frontend surface */
:where(.ksa-portal-app,.ksa-center-page,.ksa-customer-portal,.ksa-shared-public,.ksa-otp-dialog,.ksa-account-trigger,.ksa-account-dropdown,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-blocks-card,.ksa-invoice-portal,.ksa-affiliate-page,.ksa-loyalty-page,.ksa-finance-page){
  --ksa-fe-font:"Vazirmatn",Tahoma,Arial,sans-serif!important;
  font-family:var(--ksa-fe-font)!important;
}
:where(.ksa-portal-app,.ksa-center-page,.ksa-customer-portal,.ksa-shared-public,.ksa-otp-dialog,.ksa-account-dropdown,.ksa-checkout-otp,.ksa-wallet-checkout,.ksa-blocks-card,.ksa-invoice-portal,.ksa-affiliate-page,.ksa-loyalty-page,.ksa-finance-page) :where(button,input,select,textarea,optgroup,option,table,th,td,label,a,p,small,strong,b,h1,h2,h3,h4,h5,h6){font-family:var(--ksa-fe-font)!important}
