/**
 * پنل ویزیتور — تایپوگرافی و چیدمان موبایل‌محور (همه صفحات)
 */
:root {
  --by-font: "primary-font", Tahoma, "Segoe UI", sans-serif;
  --by-fs-xs: 0.72rem;
  --by-fs-sm: 0.8125rem;
  --by-fs: 0.9375rem;
  --by-fs-md: 1rem;
  --by-fs-lg: 1.125rem;
  --by-lh: 1.7;
  --by-touch: 44px;
  --by-gutter: clamp(0.75rem, 4vw, 1.25rem);
  --by-fw: 400;
  --by-fw-bold: 700;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.buyer-portal,
body.by-login,
body.by-offline {
  font-family: var(--by-font);
  font-size: var(--by-fs);
  font-weight: var(--by-fw);
  line-height: var(--by-lh);
  letter-spacing: 0;
}

body.buyer-portal strong,
body.buyer-portal b,
body.buyer-portal h1,
body.buyer-portal h2,
body.buyer-portal h3,
body.buyer-portal h6,
body.buyer-portal .pv-topbar__title,
body.buyer-portal .by-page-head__title,
body.buyer-portal .by-section-title,
body.buyer-portal .by-stat strong,
body.buyer-portal .by-card--hero h2 {
  font-weight: var(--by-fw-bold);
}

body.buyer-portal input,
body.buyer-portal select,
body.buyer-portal textarea,
body.buyer-portal button,
body.buyer-portal .btn,
body.buyer-portal .form-control,
body.buyer-portal .form-select,
body.buyer-portal .by-search,
body.buyer-portal .by-input {
  font-family: inherit;
  font-size: 16px;
}

@media (min-width: 768px) {
  body.buyer-portal input,
  body.buyer-portal select,
  body.buyer-portal textarea,
  body.buyer-portal .form-control,
  body.buyer-portal .form-select,
  body.buyer-portal .by-search,
  body.buyer-portal .by-input {
    font-size: 0.92rem;
  }
}

body.buyer-portal .pv-topbar {
  position: sticky;
  top: 0;
  z-index: 210;
}

body.buyer-portal .by-subheader {
  position: relative;
  top: auto;
  z-index: 90;
  padding: 0.45rem var(--by-gutter) 0.55rem;
}

body.buyer-portal .pv-page {
  padding-inline: var(--by-gutter);
}

body.buyer-portal .by-btn-primary,
body.buyer-portal .by-btn,
body.buyer-portal .by-btn-outline,
body.buyer-portal .by-login__submit {
  min-height: var(--by-touch);
}

body.buyer-portal .by-bottom-nav {
  padding-top: 0.2rem;
}

body.buyer-portal .by-bottom-nav a {
  min-height: 52px;
  max-width: none;
  font-size: 0.65rem;
  gap: 0.1rem;
}

body.buyer-portal .by-fiscal__select {
  min-height: 38px;
}

@media (display-mode: standalone) {
  body.buyer-portal .pv-topbar {
    padding-top: env(safe-area-inset-top, 0px);
  }
}

@media (max-width: 767.98px) {
  body.buyer-portal .pv-topbar__subtitle {
    display: none;
  }

  body.buyer-portal .by-stat-grid,
  body.buyer-portal .by-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.buyer-portal .by-data-table thead {
    display: none;
  }

  body.buyer-portal .by-data-table,
  body.buyer-portal .by-data-table tbody,
  body.buyer-portal .by-data-table tr,
  body.buyer-portal .by-data-table td {
    display: block;
    width: 100%;
  }

  body.buyer-portal .by-data-table tr {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #ede9fe;
  }

  body.buyer-portal .by-data-table tr:last-child {
    border-bottom: 0;
  }

  body.buyer-portal .by-data-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    border: 0;
    padding: 0.2rem 0;
  }

  body.buyer-portal .by-data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #64748b;
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  body.buyer-portal .by-form-grid .col-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  body.buyer-portal .by-action-row .by-btn-sm,
  body.buyer-portal .by-action-row .by-btn-outline,
  body.buyer-portal .by-action-row .by-btn-primary {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 0;
    width: auto;
  }

  body.buyer-portal .by-pf-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
  }

  body.buyer-portal .by-pf-sticky {
    position: sticky;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }

  body.buyer-portal .pv-home__quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
  }

  body.buyer-portal .pv-home__quick {
    min-height: 76px;
    font-size: 0.72rem;
    padding: 0.7rem 0.3rem;
  }
}

@media (min-width: 992px) {
  body.buyer-portal .pv-layout--nav-drawer .pv-menu-toggle {
    display: none !important;
  }

  body.buyer-portal .by-subheader {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.5rem 0.75rem;
  }

  body.buyer-portal .pv-page {
    max-width: 1280px;
    margin-inline: auto;
    width: 100%;
  }
}

.by-pwa-install {
  position: fixed;
  right: 0.75rem;
  left: 0.75rem;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 1300;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #1e1b4b;
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(49, 46, 129, 0.35);
}

.by-pwa-install[hidden] {
  display: none !important;
}

.by-pwa-install img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.by-pwa-install__text {
  flex: 1;
  min-width: 0;
}

.by-pwa-install__text strong {
  display: block;
  font-size: 0.85rem;
}

.by-pwa-install__text span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.78;
}

.by-pwa-install__btn {
  border: 0;
  background: linear-gradient(90deg, #6d28d9, #0d9488);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 10px;
  min-height: 36px;
  padding: 0 0.85rem;
  cursor: pointer;
}

.by-pwa-install__close {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
}

@media (min-width: 992px) {
  .by-pwa-install {
    left: auto;
    right: 1.25rem;
    bottom: 1.25rem;
    width: min(420px, calc(100vw - 2.5rem));
  }
}

body.by-login .by-pwa-install {
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

@media (display-mode: standalone) {
  .by-pwa-install,
  .by-pwa-sheet {
    display: none !important;
  }
}

.by-pwa-sheet {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.by-pwa-sheet[hidden] {
  display: none !important;
}

.by-pwa-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.by-pwa-sheet__panel {
  position: relative;
  width: min(520px, 100%);
  background: #fff;
  color: #1e293b;
  border-radius: 20px 20px 0 0;
  padding: 0.5rem 1.1rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
}

.by-pwa-sheet__handle {
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
  margin: 0.45rem auto 0.75rem;
}

.by-pwa-sheet__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.by-pwa-sheet__head img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #0b0b0b;
}

.by-pwa-sheet__head h6 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.by-pwa-sheet__head p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.by-pwa-sheet__steps {
  margin: 0 0 1rem;
  padding: 0 1.1rem 0 0;
  color: #334155;
  font-size: 0.88rem;
  line-height: 1.75;
}

.by-pwa-sheet__steps li + li {
  margin-top: 0.45rem;
}

.by-offline {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: #f8f6ff;
}

.by-offline__card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #e9d5ff;
  border-radius: 18px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  box-shadow: 0 8px 28px rgba(76, 29, 149, 0.08);
}

.by-offline__card img {
  border-radius: 16px;
  margin-bottom: 0.75rem;
}

.by-offline__card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.by-offline__card p {
  margin: 0 0 1rem;
  color: #64748b;
  font-size: 0.88rem;
}

@media (prefers-reduced-motion: reduce) {
  body.buyer-portal *,
  body.by-login * {
    animation: none !important;
    transition: none !important;
  }
}

body.buyer-portal .pv-topbar__row {
  overflow: visible;
}

body.buyer-portal .by-card {
  overflow: hidden;
}
