/* ============================================================
   dashboard.css — داشبورد کاربران (بازنویسی کامل 2026-10-17)
   دسکتاپ: فیلتر کناری + تب‌های متن‌دار
   موبایل: فقط آیکون تب‌ها + چیدمان ستونی
   ============================================================ */

.udash {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 10px 32px;
  color: var(--color-text, #0f172a);
  box-sizing: border-box;
  overflow-x: hidden;
}

.udash *,
.udash *::before,
.udash *::after {
  box-sizing: border-box;
}

/* ---- Header ---- */
.udash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.udash-header__right { min-width: 0; }
.udash-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text, #0f172a);
}
.udash-title i { color: var(--color-primary, #f97316); }
.udash-welcome {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--color-text-muted, #64748b);
}
.udash-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Stats ---- */
.udash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.udash-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.udash-stat__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  background: #fff7ed;
  color: #f97316;
}
.udash-stat__n {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text, #0f172a);
}
.udash-stat__l {
  font-size: 0.78rem;
  color: var(--color-text-muted, #64748b);
}

/* ---- Layout ---- */
.udash-layout {
  display: grid;
  grid-template-columns: minmax(230px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
}

/* ---- Filters sidebar ---- */
.udash-filters,
.udash-sidebar {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 16px;
  padding: 14px;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.udash-filters .filter-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 800;
}
.udash-filters .filter-group { margin-bottom: 12px; }
.udash-filters .filter-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}
.udash-filters .tree-container {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 10px;
  padding: 6px;
  background: #f8fafc;
}
.udash-filters .filters-more-btn { display: none; }

/* ---- Main ---- */
.udash-main {
  min-width: 0;
  width: 100%;
}

/* ---- Tabs (desktop: icon + label) ---- */
.udash-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  margin: 0 0 12px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 14px;
  scrollbar-width: thin;
  width: 100%;
}
.udash-tabs::-webkit-scrollbar { height: 4px; }
.udash-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: 0.15s ease;
}
.udash-tab:hover {
  background: #fff7ed;
  color: #f97316;
}
.udash-tab.is-active,
.udash-tab.active {
  background: #f97316;
  color: #fff;
  border-color: #f97316;
}
.udash-tab-label { display: inline; }
.udash-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
  font-size: 0.68rem;
  font-weight: 700;
}
.udash-tab.is-active .udash-tab-badge,
.udash-tab.active .udash-tab-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.udash-result-count {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: #64748b;
}

/* ---- Panels / grid / table ---- */
.udash-panel {
  min-height: 120px;
}
.udash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  width: 100%;
}
.udash-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.udash-table-wrap table {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.udash-loading,
.udash-empty-page {
  text-align: center;
  padding: 48px 16px;
  color: #64748b;
}
.udash-empty-page i {
  font-size: 2.5rem;
  margin-bottom: 10px;
  display: block;
  opacity: 0.7;
}

/* Quick actions / embeds / profile */
.udash-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.udash-quick__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.udash-quick__btn:hover {
  border-color: #f97316;
  color: #f97316;
  background: #fff7ed;
}
.udash-embed-host { min-height: 180px; }
.udash-profile-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
}
.udash-profile-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.udash-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff7ed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.udash-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.udash-chat-item {
  display: block;
  width: 100%;
  text-align: right;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
}
.udash-chat-item.is-active { background: #fff7ed; border-color: #fdba74; }

/* ============================================================
   موبایل / تبلت
   ============================================================ */
@media (max-width: 991.98px) {
  .udash-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  .udash-main {
    order: 1;
    width: 100% !important;
    min-width: 0 !important;
  }
  .udash-filters,
  .udash-sidebar {
    order: 2;
    width: 100% !important;
    max-width: 100% !important;
    position: static !important;
    max-height: none;
  }
  .udash-filters .filters-more-btn {
    display: flex !important;
    width: 100%;
    margin-bottom: 10px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-weight: 600;
    cursor: pointer;
  }
  .udash-filters .filters-body { display: none; }
  .udash-filters.is-open .filters-body { display: block; }

  .udash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .udash-header {
    flex-direction: column;
    align-items: stretch;
  }
  .udash-header__actions .btn {
    flex: 1 1 auto;
    min-width: 110px;
  }
}

/* موبایل: فقط آیکون منوها */
@media (max-width: 768px) {
  .udash {
    padding: 0 6px 24px;
  }
  .udash-tabs {
    gap: 4px;
    padding: 6px;
    border-radius: 12px;
  }
  .udash-tab {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    justify-content: center;
  }
  .udash-tab .udash-tab-label {
    /* فقط آیکون — متن مخفی */
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
  .udash-tab > i.fas,
  .udash-tab > i {
    margin: 0 !important;
    font-size: 1.1rem !important;
  }
  .udash-tab-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    min-width: 15px;
    height: 15px;
    font-size: 0.62rem;
    z-index: 1;
  }
  .udash-grid {
    grid-template-columns: 1fr;
  }
  .udash-title { font-size: 1.15rem; }
}

@media (max-width: 480px) {
  .udash-stats {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .udash-stat { padding: 10px; }
  .udash-stat__n { font-size: 1.05rem; }
}

@media (min-width: 992px) {
  .udash-filters .filters-more-btn { display: none !important; }
  .udash-filters .filters-body { display: block !important; }
}


/* ---- کارت‌های داشبورد (تقویت‌شده) ---- */
.udash-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  min-height: 140px;
}
.udash-card:hover {
  border-color: #fdba74;
  box-shadow: 0 8px 22px rgba(249, 115, 22, 0.12);
  transform: translateY(-1px);
}
.udash-card__top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.udash-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--color-text, #0f172a);
}
.udash-card__price {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ea580c;
}
.udash-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: #64748b;
}
.udash-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
}
.udash-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
}
.udash-badge--ok { background: #d1fae5; color: #065f46; }
.udash-badge--warn { background: #fef3c7; color: #92400e; }
.udash-badge--err { background: #fee2e2; color: #b91c1c; }
.udash-badge--muted { background: #fff7ed; color: #9a3412; }
.udash-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
  gap: 12px !important;
  width: 100%;
}
.udash-chat-item {
  border-radius: 14px !important;
  padding: 14px !important;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
#dashListingsGrid, #dashAdsGrid, #dashTicketsGrid, #dashShopGrid, #dashBannersGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
@media (max-width: 576px) {
  .udash-grid,
  #dashListingsGrid, #dashAdsGrid, #dashTicketsGrid, #dashShopGrid, #dashBannersGrid {
    grid-template-columns: 1fr !important;
  }
}


/* ===== فاز ۱: خانهٔ من + گروه‌بندی ===== */
.udash-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 14px;
}
.udash-group-btn {
  border: 1px solid transparent;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.udash-group-btn:hover { background: #fff7ed; color: #c2410c; }
.udash-group-btn.is-active {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}
.udash-tabs--grouped {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.udash-tab-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 12px;
  background: #fff;
}
.udash-tab-group.is-dimmed { opacity: 0.92; }
.udash-tab-group__label {
  width: 100%;
  font-size: 0.75rem;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 2px;
}
.udash-home {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #fed7aa;
  background: linear-gradient(135deg, #fff7ed 0%, #f8fafc 55%, #eff6ff 100%);
}
.udash-home__welcome h2 { margin: 0 0 4px; font-size: 1.15rem; font-weight: 800; }
.udash-home__welcome p { margin: 0 0 12px; color: #64748b; font-size: 0.9rem; }
.udash-home__next h3, .udash-home__shortcuts h3 {
  margin: 0 0 8px; font-size: 0.88rem; font-weight: 800; color: #0f172a;
}
.udash-home__next-grid, .udash-home__shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.udash-next-card, .udash-shortcut {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.udash-next-card:hover, .udash-shortcut:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  border-color: #fdba74;
  color: #c2410c;
}
.udash-next-card i, .udash-shortcut i { font-size: 1.15rem; color: #f97316; }
@media (max-width: 768px) {
  .udash-groups { gap: 6px; padding: 6px; }
  .udash-group-btn { padding: 7px 10px; font-size: 0.78rem; }
  .udash-home__next-grid, .udash-home__shortcuts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* فاز ۳: تب‌های موازی از نوار اصلی پنهان — فقط از پنل من */
.tabs .tab.tab-dashboard-alias,
.main-tabs .tab.tab-dashboard-alias,
[data-dashboard-alias="1"] {
  display: none !important;
}

.udash-orders-list { display: flex; flex-direction: column; gap: 10px; }
.udash-order-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--color-border,#e2e8f0); border-radius: 12px; background: #fff;
}
.udash-onboard {
  margin-bottom: 12px;
}
.udash-onboard__card {
  padding: 14px 16px; border-radius: 14px; border: 1px solid #fdba74; background: #fff7ed;
}
.udash-onboard__card h3 { margin: 0 0 6px; font-size: 1rem; }
.udash-onboard__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.udash-embed-host { min-height: 120px; }

/* خلوت‌سازی پنل من */
.udash-tab-group[hidden] { display: none !important; }
.udash-tabs--grouped { margin-top: 0; }
.udash-tab-group {
  border: none;
  padding: 0;
  background: transparent;
  gap: 8px;
}
.udash-tab-group__label { display: none; }
.udash-home {
  margin-top: 4px;
}
.udash-home__welcome h2 { font-size: 1.05rem; }
.udash-home__hint { margin: 4px 0 10px; font-size: 0.85rem; color: #64748b; }
.udash-home__shortcuts-grid {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.udash-groups {
  position: sticky;
  top: 0;
  z-index: 5;
}
.udash-stats { margin-bottom: 10px; }

/* خانهٔ من — ارتقا UX */
.udash-home__block { margin-bottom: 16px; }
.udash-home__block h3 {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #475569;
}
.udash-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.udash-action-card {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.udash-action-card:hover {
  transform: translateY(-2px);
  border-color: var(--ac, #f97316);
  box-shadow: 0 8px 20px rgba(15,23,42,.08);
}
.udash-action-card__icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ac, #f97316) 14%, #fff);
  color: var(--ac, #f97316);
  flex-shrink: 0;
  font-size: 1.1rem;
}
.udash-action-card__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.udash-action-card__text strong { font-size: 0.9rem; color: #0f172a; }
.udash-action-card__text small { font-size: 0.75rem; color: #64748b; }
.udash-action-card__go { color: #cbd5e1; font-size: 0.75rem; }
.udash-sec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.udash-sec-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.udash-sec-card__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: #f8fafc;
  padding: 10px 12px;
  font-weight: 800;
  font-size: 0.88rem;
  color: #0f172a;
  cursor: pointer;
  text-align: right;
}
.udash-sec-card__head:hover { background: #fff7ed; color: #c2410c; }
.udash-sec-card__head i { color: #f97316; }
.udash-sec-card__links { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.udash-sec-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #334155;
  text-align: right;
}
.udash-sec-link:hover { background: #f1f5f9; }
.udash-sec-badge {
  background: #f97316;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 1.25rem;
  text-align: center;
}
.udash-groups {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.udash-group-btn {
  justify-content: center;
  width: 100%;
}
@media (max-width: 640px) {
  .udash-action-grid { grid-template-columns: 1fr 1fr; }
  .udash-sec-grid { grid-template-columns: 1fr; }
  .udash-groups { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .udash-group-btn { padding: 8px 4px; font-size: 0.72rem; flex-direction: column; gap: 2px; }
  .udash-group-btn i { font-size: 1rem; }
}

/* نوار گروه زیر منوی اصلی */
.udash-groups {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 12px;
  padding: 8px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15,23,42,.04);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

/* مالی — fallback */
.udash-money-fallback {
  padding: 24px;
  text-align: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
}
.udash-money-balance { margin-bottom: 16px; }
.udash-money-balance strong { display: block; font-size: 1.4rem; margin-top: 4px; }
.udash-money-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* چت شبیه تلگرام */
.tg-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 0;
  min-height: 520px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.tg-sidebar {
  border-left: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  min-height: 520px;
}
.tg-sidebar__head { padding: 12px; border-bottom: 1px solid #e2e8f0; background: #fff; }
.tg-sidebar__title { font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.tg-search {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #f1f5f9;
  font-size: 0.85rem;
}
.tg-sidebar__filters { margin-top: 8px; }
.tg-filter-select { width: 100%; border-radius: 8px; border: 1px solid #e2e8f0; padding: 6px 8px; font-size: 0.8rem; }
.tg-conv-list { flex: 1; overflow-y: auto; }
.tg-main {
  display: flex;
  flex-direction: column;
  background: #eef2ff;
  background-image: radial-gradient(rgba(148,163,184,.15) 1px, transparent 1px);
  background-size: 16px 16px;
  min-height: 520px;
}
.tg-empty {
  margin: auto;
  text-align: center;
  color: #64748b;
  padding: 24px;
}
.tg-empty__icon {
  width: 64px; height: 64px; margin: 0 auto 12px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #6366f1;
  box-shadow: 0 4px 14px rgba(99,102,241,.2);
}
/* آیتم‌های لیست گفتگو */
.tg-conv-list .udash-chat-item,
.tg-conv-list .chat-conv-item,
.tg-conv-list [data-conv-id] {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  background: transparent;
  transition: background .15s;
}
.tg-conv-list .udash-chat-item:hover,
.tg-conv-list .chat-conv-item:hover,
.tg-conv-list [data-conv-id]:hover { background: #fff; }
.tg-conv-list .is-active,
.tg-conv-list .active { background: #e0e7ff !important; }
@media (max-width: 768px) {
  .tg-layout { grid-template-columns: 1fr; min-height: 420px; }
  .tg-sidebar { min-height: 220px; max-height: 40vh; border-left: none; border-bottom: 1px solid #e2e8f0; }
  .udash-groups { gap: 4px; padding: 6px; }
  .udash-group-btn { font-size: 0.7rem; padding: 8px 2px; flex-direction: column; }
}

/* کیف پول — خلاصه و گزارش */
.wallet-page { padding: 4px 0 24px; }
.wallet-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.wallet-summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}
.wallet-summary-card.is-balance {
  background: linear-gradient(135deg, #ecfdf5, #fff);
  border-color: #a7f3d0;
}
.wallet-summary-card__label { font-size: 0.75rem; color: #64748b; margin-bottom: 4px; }
.wallet-summary-card__value { font-size: 0.95rem; font-weight: 800; color: #0f172a; }
.wallet-tabs { position: sticky; top: 0; z-index: 3; background: #fff; padding-top: 4px; }
#dashMoneyHost .wallet-page { min-height: 320px; }
#dashMoneyHost { min-height: 360px; }

.udash-modal-overlay{position:fixed;inset:0;z-index:10050;background:rgba(15,23,42,.45);display:flex;align-items:center;justify-content:center;padding:16px}
.udash-modal{width:min(520px,100%);background:#fff;border-radius:16px;box-shadow:0 20px 50px rgba(0,0,0,.2);overflow:hidden}
.udash-modal__head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #e2e8f0}
.udash-modal__head h3{margin:0;font-size:1rem}
.udash-modal__close{border:none;background:transparent;font-size:1.4rem;cursor:pointer;color:#64748b}
.udash-modal__body{padding:16px}
.udash-modal__foot{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid #e2e8f0;background:#f8fafc}
.udash-check-row{display:flex;align-items:center;gap:8px;padding:8px;border-radius:8px;cursor:pointer}
.udash-check-row:hover{background:#f1f5f9}
#dashMoneyHost{min-height:400px;background:#fff;border-radius:12px;padding:8px}

/* ===== مالی کاربر — بازطراحی ===== */
.udash-money { padding: 4px 0 20px; }
.udash-money__hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 20px; border-radius: 16px;
  background: linear-gradient(135deg, #ecfdf5 0%, #fff 55%, #f0f9ff 100%);
  border: 1px solid #a7f3d0; margin-bottom: 14px;
}
.udash-money__label { display: block; font-size: 0.8rem; color: #64748b; margin-bottom: 4px; }
.udash-money__bal { font-size: 1.55rem; font-weight: 800; color: #065f46; }
.udash-money__hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.udash-money__stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px;
}
.udash-money__stat {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px;
}
.udash-money__stat span { display: block; font-size: 0.75rem; color: #64748b; margin-bottom: 4px; }
.udash-money__stat b { font-size: 0.95rem; color: #0f172a; }
.udash-money__tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0; padding-bottom: 8px;
}
.udash-money__tab {
  border: 1px solid transparent; background: transparent; border-radius: 999px;
  padding: 8px 14px; font-size: 0.85rem; cursor: pointer; color: #475569; font-weight: 600;
}
.udash-money__tab:hover { background: #f1f5f9; }
.udash-money__tab.is-active {
  background: #0f172a; color: #fff; border-color: #0f172a;
}
.udash-money__body {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; min-height: 220px;
}
.udash-money__loading { text-align: center; padding: 28px; color: #64748b; }
.udash-money__table-wrap { overflow-x: auto; }
.udash-money__table { width: 100%; font-size: 0.88rem; }
#dashPanel-money:not([hidden]) { display: block !important; }
#dashMoneyHost { min-height: 280px; }
@media (max-width: 640px) {
  .udash-money__hero { flex-direction: column; align-items: stretch; }
  .udash-money__bal { font-size: 1.3rem; }
}

/* پیام‌رسان — حباب چپ/راست */
.msg-thread { display: flex; flex-direction: column; height: min(70vh, 640px); background: #e8eef5; border-radius: 0 0 12px 0; }
.msg-thread__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; background: #fff; border-bottom: 1px solid #e2e8f0; font-weight: 700;
}
.msg-thread__list {
  flex: 1; overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  background-image: radial-gradient(rgba(148,163,184,.12) 1px, transparent 1px);
  background-size: 14px 14px;
}
.msg-row { display: flex; width: 100%; }
.msg-row.is-mine { justify-content: flex-start; }
.msg-row.is-other { justify-content: flex-end; }
.msg-bubble {
  max-width: min(78%, 420px); padding: 10px 12px; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.06); position: relative;
}
.msg-row.is-mine .msg-bubble {
  background: #dcf8c6; border-bottom-right-radius: 4px; color: #0f172a;
}
.msg-row.is-other .msg-bubble {
  background: #fff; border-bottom-left-radius: 4px; color: #0f172a;
}
.msg-name { font-size: 0.72rem; font-weight: 700; color: #0369a1; margin-bottom: 4px; }
.msg-text { font-size: 0.9rem; line-height: 1.55; word-break: break-word; }
.msg-time { font-size: 0.68rem; color: #64748b; margin-top: 6px; text-align: left; }
.msg-file-link { color: #0369a1; font-weight: 600; text-decoration: none; }
.msg-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; background: #f8fafc; border-top: 1px solid #e2e8f0;
}
.msg-composer-main { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.msg-input {
  width: 100%; border: 1px solid #e2e8f0; border-radius: 18px;
  padding: 10px 14px; resize: none; min-height: 42px; max-height: 120px;
  font-family: inherit; font-size: 0.9rem; background: #fff;
}
.msg-attach-btn, .msg-send-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.msg-attach-btn { background: #e2e8f0; color: #334155; }
.msg-send-btn { background: #0ea5e9; color: #fff; }
.msg-file-chip {
  font-size: 0.75rem; background: #e0f2fe; color: #0369a1;
  border-radius: 8px; padding: 4px 8px; width: fit-content;
}
.tg-list-item {
  display: block; width: 100%; text-align: right; border: none; background: transparent;
  padding: 12px; border-bottom: 1px solid #e2e8f0; cursor: pointer;
}
.tg-list-item:hover, .tg-list-item.is-active { background: #e0e7ff; }
.tg-list-item__top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.tg-list-item__preview { font-size: 0.8rem; color: #64748b; }
.tg-main { min-height: 520px; padding: 0 !important; background: #e8eef5; }

.udash-panels { width: 100%; min-height: 200px; }
#dashPanel-money:not([hidden]) {
  display: block !important;
  visibility: visible !important;
  min-height: 320px;
}
#dashMoneyHost, .udash-money {
  display: block !important;
  width: 100%;
  min-height: 280px;
}
.udash-money__hero {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 16px; margin-bottom: 12px; border-radius: 16px;
  background: linear-gradient(135deg, #ecfdf5, #fff);
  border: 1px solid #a7f3d0;
}
.udash-money__bal { font-size: 1.4rem; font-weight: 800; color: #065f46; }
.udash-money__stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px;
}
.udash-money__stat {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px;
}
.udash-money__stat span { display: block; font-size: 0.75rem; color: #64748b; }
.udash-money__tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.udash-money__tab {
  border: 1px solid #e2e8f0; background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-weight: 600;
}
.udash-money__tab.is-active { background: #0f172a; color: #fff; border-color: #0f172a; }
.udash-money__body {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; min-height: 180px;
}

/* HIDE-FEATURE-PAID-BADGE */
.feature-lock-badge, .tab .feature-lock-badge, [data-feature-paid-lock] .feature-lock-badge {
  display: none !important;
}
[data-feature-paid-lock].feature-locked {
  opacity: 0.72;
  cursor: pointer;
}

/* Ticket thread bubbles */
.tg-thread { display:flex; flex-direction:column; height:min(70vh, 560px); background:#fff; border:1px solid #e2e8f0; border-radius:14px; overflow:hidden; }
.tg-thread__head { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:12px 14px; border-bottom:1px solid #e2e8f0; background:#f8fafc; }
.tg-thread__msgs { flex:1; overflow:auto; padding:12px; display:flex; flex-direction:column; gap:8px; background:#f1f5f9; }
.tg-bubble { max-width:85%; padding:10px 12px; border-radius:14px; line-height:1.5; font-size:.9rem; }
.tg-bubble--out { align-self:flex-start; background:#fff; border:1px solid #e2e8f0; border-bottom-right-radius:4px; }
.tg-bubble--in { align-self:flex-end; background:#dbeafe; border-bottom-left-radius:4px; color:#0f172a; }
.tg-bubble__time { font-size:.7rem; color:#64748b; margin-top:4px; }
.tg-composer { display:flex; gap:8px; padding:10px; border-top:1px solid #e2e8f0; background:#fff; }
.tg-composer__input { flex:1; border:1px solid #e2e8f0; border-radius:10px; padding:8px 10px; resize:none; }
.tg-list-item.is-active { background:#e0f2fe; border-color:#7dd3fc; }

/* MESSENGER-LAYOUT-STABLE-2026-11 */
.tg-layout,
.tg-layout--tickets,
.tg-layout--support,
#dashTgLayout {
  display: grid !important;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr) !important;
  gap: 0 !important;
  min-height: 520px;
  height: min(72vh, 640px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}
.tg-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid #e2e8f0;
  background: #f8fafc;
  overflow: hidden;
}
.tg-sidebar__head {
  flex: 0 0 auto;
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tg-sidebar__title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tg-search, .tg-filter-select {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  box-sizing: border-box;
}
.tg-conv-list {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  min-height: 0;
}
.tg-list-item {
  display: block;
  width: 100%;
  text-align: right;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  box-sizing: border-box;
}
.tg-list-item:hover { border-color: #cbd5e1; background: #f1f5f9; }
.tg-list-item.is-active {
  border-color: #38bdf8;
  background: #e0f2fe;
}
.tg-list-item__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}
.tg-list-item__preview {
  display: block;
  color: #64748b;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tg-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #eef2f7;
  position: relative;
}
.tg-empty {
  margin: auto;
  text-align: center;
  color: #64748b;
  padding: 24px;
}
.tg-empty__icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.7;
}
.tg-thread {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: hidden;
}
.tg-thread__head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}
.tg-thread__msgs {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  background: #eef2f7;
}
.tg-bubble {
  max-width: min(85%, 420px);
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.55;
  font-size: 0.9rem;
  word-break: break-word;
}
.tg-bubble--out {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-bottom-right-radius: 4px;
}
.tg-bubble--in {
  align-self: flex-end;
  background: #dbeafe;
  border-bottom-left-radius: 4px;
  color: #0f172a;
}
.tg-bubble__time {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 4px;
}
.tg-composer {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  align-items: flex-end;
}
.tg-composer__input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .tg-layout,
  .tg-layout--tickets,
  .tg-layout--support,
  #dashTgLayout {
    grid-template-columns: 1fr !important;
    height: auto;
    min-height: 60vh;
  }
  .tg-sidebar {
    max-height: 40vh;
    border-left: none;
    border-bottom: 1px solid #e2e8f0;
  }
  .tg-main { min-height: 50vh; }
  .tg-layout.is-thread-open .tg-sidebar { display: none; }
  .tg-layout.is-thread-open .tg-main { display: flex; }
}

/* MSG-MESSENGER-UNIFIED-2026-11-04 — ساختار پایدار پیام‌رسان */
.tg-layout,
.tg-layout--tickets,
.tg-layout--support,
#dashTgLayout {
  display: grid !important;
  grid-template-columns: 300px minmax(0, 1fr) !important;
  height: min(70vh, 620px) !important;
  min-height: 480px !important;
  max-height: 720px;
  width: 100% !important;
  overflow: hidden !important;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-sizing: border-box;
  direction: rtl;
}
.tg-sidebar {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow: hidden !important;
  border-left: 1px solid #e2e8f0;
  background: #f8fafc;
}
.tg-conv-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
}
.tg-main,
#dashChatThread,
#dashTicketDetailHost,
#dashSupportHost {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
  background: #edf2f7 !important;
  position: relative;
}
.tg-list-item__time {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 4px;
}
/* حباب‌های msg-* */
.msg-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.msg-thread__head {
  flex: 0 0 auto;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.msg-thread__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-row {
  display: flex;
  width: 100%;
}
.msg-row.is-mine { justify-content: flex-start; }
.msg-row.is-other { justify-content: flex-end; }
.msg-bubble {
  max-width: min(80%, 420px);
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.msg-row.is-mine .msg-bubble {
  background: #fff;
  border-bottom-right-radius: 4px;
}
.msg-row.is-other .msg-bubble {
  background: #dbeafe;
  border-color: #bfdbfe;
  border-bottom-left-radius: 4px;
}
.msg-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0369a1;
  margin-bottom: 4px;
}
.msg-text { font-size: 0.92rem; line-height: 1.55; word-break: break-word; }
.msg-time { font-size: 0.7rem; color: #64748b; margin-top: 6px; text-align: left; }
.msg-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
.msg-composer-main { flex: 1; min-width: 0; }
.msg-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  box-sizing: border-box;
  font-family: inherit;
}
.msg-send-btn, .msg-attach-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.msg-send-btn {
  background: #0ea5e9;
  color: #fff;
  border-color: #0284c7;
}
.msg-file-chip {
  font-size: 0.8rem;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px 8px;
  margin-bottom: 4px;
}
@media (max-width: 768px) {
  .tg-layout, .tg-layout--tickets, .tg-layout--support, #dashTgLayout {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 70vh !important;
  }
  .tg-sidebar { max-height: 36vh; border-left: 0; border-bottom: 1px solid #e2e8f0; }
  .tg-layout.is-thread-open .tg-sidebar { display: none !important; }
  .tg-layout.is-thread-open .tg-main { min-height: 60vh; }
}

/* SC-SUPPORT-STABLE-2026-11-04B — چت پشتیبانی پایدار */
.sc-layout {
  display: grid !important;
  grid-template-columns: 280px minmax(0, 1fr) !important;
  height: min(70vh, 640px) !important;
  min-height: 480px !important;
  width: 100% !important;
  overflow: hidden !important;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  direction: rtl;
  box-sizing: border-box;
}
.sc-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid #e2e8f0;
  background: #f8fafc;
}
.sc-sidebar__head {
  flex: 0 0 auto;
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-sidebar__title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sc-select {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  box-sizing: border-box;
}
.sc-new-btn { width: 100%; }
.sc-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
}
.sc-list-empty, .sc-loading, .sc-error, .sc-msgs-empty {
  text-align: center;
  color: #64748b;
  padding: 16px 10px;
  font-size: 0.9rem;
}
.sc-item {
  display: block;
  width: 100%;
  text-align: right;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  box-sizing: border-box;
}
.sc-item:hover { border-color: #cbd5e1; background: #f1f5f9; }
.sc-item.is-active { border-color: #38bdf8; background: #e0f2fe; }
.sc-item__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}
.sc-item__status {
  font-size: 0.72rem;
  background: #e2e8f0;
  color: #334155;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.sc-item__preview {
  display: block;
  color: #64748b;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-item__time {
  display: block;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 4px;
}
.sc-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #eef2f7;
  position: relative;
}
.sc-empty, .sc-loading--main {
  margin: auto;
  text-align: center;
  color: #64748b;
  padding: 24px;
}
.sc-empty__icon, .sc-start__icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
  opacity: 0.75;
  color: #0ea5e9;
}
.sc-start {
  margin: auto;
  max-width: 420px;
  width: 100%;
  padding: 24px;
  text-align: center;
}
.sc-start__input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0;
  box-sizing: border-box;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}
.sc-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.sc-thread__head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.sc-thread__title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sc-thread__status {
  display: inline-block;
  margin-right: 8px;
  font-size: 0.75rem;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 999px;
  padding: 2px 8px;
}
.sc-back-btn {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: none;
}
.sc-thread__msgs {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #eef2f7;
}
.sc-bubble-row { display: flex; width: 100%; }
.sc-bubble-row.is-mine { justify-content: flex-start; }
.sc-bubble-row.is-agent { justify-content: flex-end; }
.sc-bubble {
  max-width: min(80%, 420px);
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  word-break: break-word;
}
.sc-bubble-row.is-mine .sc-bubble { border-bottom-right-radius: 4px; }
.sc-bubble-row.is-agent .sc-bubble {
  background: #dbeafe;
  border-color: #bfdbfe;
  border-bottom-left-radius: 4px;
}
.sc-bubble__name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0369a1;
  margin-bottom: 4px;
}
.sc-bubble__text { font-size: 0.92rem; line-height: 1.55; }
.sc-bubble__time { font-size: 0.7rem; color: #64748b; margin-top: 6px; }
.sc-composer {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  align-items: flex-end;
}
.sc-composer__input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  box-sizing: border-box;
  font-family: inherit;
}
.sc-composer__send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: #0ea5e9;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sc-composer__send:disabled { opacity: 0.6; cursor: not-allowed; }
.sc-closed-note {
  flex: 0 0 auto;
  padding: 12px;
  text-align: center;
  color: #64748b;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  font-size: 0.9rem;
}
@media (max-width: 768px) {
  .sc-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 70vh !important;
  }
  .sc-sidebar {
    max-height: 40vh;
    border-left: none;
    border-bottom: 1px solid #e2e8f0;
  }
  .sc-layout.is-thread-open .sc-sidebar { display: none !important; }
  .sc-layout.is-thread-open .sc-main { min-height: 60vh; }
  .sc-back-btn { display: inline-flex !important; align-items: center; justify-content: center; }
}
