/* User Manager panel — RTL + responsive */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.15);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: "Vazirmatn", system-ui, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(56, 189, 248, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(52, 211, 153, 0.06), transparent);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--accent);
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.9rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.header-title {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.stats-grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

.stats-grid-7 {
  grid-template-columns: repeat(7, 1fr);
}

.stats-grid-8 {
  grid-template-columns: repeat(8, 1fr);
}

@media (max-width: 1100px) {
  .stats-grid-8 {
    grid-template-columns: repeat(4, 1fr);
  }
  .stats-grid-7 {
    grid-template-columns: repeat(4, 1fr);
  }
  .stats-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 700px) {
  .stats-grid-8,
  .stats-grid-7,
  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card-teal {
  border-color: rgba(20, 184, 166, 0.32);
  background: linear-gradient(145deg, var(--surface), rgba(20, 184, 166, 0.09));
}

.stat-card-teal .stat-card-value {
  color: #2dd4bf;
}

.stat-card-wan-pulse {
  animation: wan-pulse 0.4s ease-out;
}

@keyframes wan-pulse {
  0%   { opacity: 0.5; transform: scale(0.97); }
  100% { opacity: 1;   transform: scale(1); }
}

.stat-card-danger {
  border-color: rgba(248, 113, 113, 0.35);
  background: linear-gradient(145deg, var(--surface), rgba(248, 113, 113, 0.1));
}

.stat-card-danger .stat-card-value {
  color: var(--danger);
}

.stat-card {
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card-accent {
  border-color: rgba(56, 189, 248, 0.3);
  background: linear-gradient(145deg, var(--surface), rgba(56, 189, 248, 0.08));
}

.stat-card-success {
  border-color: rgba(52, 211, 153, 0.28);
  background: linear-gradient(145deg, var(--surface), rgba(52, 211, 153, 0.07));
}

.stat-card-warn {
  border-color: rgba(248, 113, 113, 0.22);
  background: linear-gradient(145deg, var(--surface), rgba(248, 113, 113, 0.06));
}

.stat-card-purple {
  border-color: rgba(167, 139, 250, 0.28);
  background: linear-gradient(145deg, var(--surface), rgba(167, 139, 250, 0.07));
}

.stat-card-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.3rem;
  white-space: nowrap;
}

.stat-card-value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

/* --- دکمه باز کردن آمار پروفایل (کنار فیلترها) --- */
.btn-prof-stats-open {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.1), rgba(56, 189, 248, 0.04));
  color: #7dd3fc;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-prof-stats-open:hover {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.18), rgba(56, 189, 248, 0.08));
  border-color: rgba(56, 189, 248, 0.42);
  color: #bae6fd;
}

.btn-prof-stats-open svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.btn-prof-stats-open-text {
  white-space: nowrap;
}

/* خروجی پشتیبان دیتابیس User Manager (.umb) */
.btn-um-backup {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.12), rgba(251, 191, 36, 0.04));
  color: #fcd34d;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-um-backup:hover {
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.22), rgba(251, 191, 36, 0.08));
  border-color: rgba(251, 191, 36, 0.5);
  color: #fde68a;
}

.btn-um-backup svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.btn-um-backup-text {
  white-space: nowrap;
}

/* موبایل: ترتیب DOM = جستجو → فیلترها → آمار|بروز|خروج → کاربر جدید (بدون order) */
@media (max-width: 640px) {
  .app {
    padding: 0.65rem 1rem 2.5rem;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.22rem;
    padding: 0.35rem 0.75rem 0.4rem;
    margin-bottom: 0.85rem;
  }

  .header-title {
    white-space: normal;
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: 1.1;
    font-size: 1.05rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    min-height: 0;
    gap: 0.22rem;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
  }

  .toolbar-row {
    width: 100%;
    display: grid;
    gap: 0.22rem;
    min-width: 0;
    min-height: 0;
    align-content: start;
    flex: 0 0 auto;
  }

  /*
   * در دسکتاپ .toolbar-row--search برای ردیف افقی flex:1 دارد.
   * در ستون موبایل همان flex-grow باعث می‌شود ردیف جستجو کل ارتفاع باقیمانده را ببلعد → فاصلهٔ غول‌پیکر.
   */
  .toolbar-row--search {
    flex: 0 0 auto;
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: auto;
    min-height: 0;
    max-width: none;
    grid-template-columns: 1fr;
  }

  .toolbar-row--search .search-wrap {
    flex: none;
    flex-grow: 0;
    flex-shrink: 0;
    min-height: 0;
    max-width: none;
    width: 100%;
  }

  .toolbar-row--filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar-row--filters .filter-btns {
    display: contents;
  }

  /* جداکننده در موبایل از گرید خارج است */
  .toolbar-sep {
    display: none;
  }

  .toolbar-row--create {
    grid-template-columns: 1fr;
  }

  .toolbar-row--create .btn {
    width: 100%;
    justify-content: center;
  }

  .toolbar-row--search .search-wrap input {
    padding: 0.42rem 2.5rem 0.42rem 0.85rem;
    font-size: 0.9rem;
    line-height: 1.35;
  }

  .toolbar-row--filters .btn-sm,
  .toolbar-row--filters .btn {
    width: 100%;
    min-height: 2.45rem;
    padding: 0.42rem 0.4rem;
    justify-content: center;
    align-items: center;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    white-space: normal;
    box-sizing: border-box;
  }

  .toolbar-row--filters .btn-filter {
    gap: 0.3rem;
  }

  .btn-prof-stats-open,
  .btn-sales-24h-open,
  .btn-um-backup {
    gap: 0.32rem;
  }

  .btn-prof-stats-open-text,
  .btn-sales-24h-open-text,
  .btn-um-backup-text {
    white-space: normal;
  }
}

@media (max-width: 360px) {
  .toolbar-row--filters .btn-sm,
  .toolbar-row--filters .btn {
    font-size: 0.78rem;
    padding: 0.38rem 0.3rem;
    min-height: 2.35rem;
  }

  .toolbar {
    gap: 0.18rem;
  }

  .header {
    gap: 0.16rem;
    padding: 0.3rem 0.65rem 0.35rem;
  }

  .header-title {
    font-size: 1rem;
  }
}

/* --- مودال آمار پروفایل (لیست یکدست) --- */
.modal-prof-stats {
  position: relative;
  max-width: 380px;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.prof-stats-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.prof-stats-topbar-text {
  min-width: 0;
}

.prof-stats-sub {
  margin: 0.3rem 0 0;
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.45;
}

.prof-stats-close-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -0.1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.prof-stats-close-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

.prof-stats-list-wrap {
  background: var(--surface2);
  padding: 0.15rem 0;
}

.prof-stats-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.prof-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.58rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.prof-stats-row:last-child {
  border-bottom: none;
}

.prof-stats-row--other {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.prof-stats-label-muted {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.35;
  text-align: right;
  max-width: 58%;
}

.prof-stats-row-val {
  display: inline-flex;
  align-items: baseline;
  gap: 0.32rem;
  flex-shrink: 0;
  direction: ltr;
  unicode-bidi: embed;
}

.prof-stats-row-val strong {
  font-size: 1.18rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.02em;
}

.prof-stats-row-val small {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 500;
}

.prof-stats-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: ui-monospace, "Vazirmatn", monospace;
  padding: 0.28rem 0.52rem;
  border-radius: 8px;
  letter-spacing: 0.06em;
}

.prof-stats-tag--1 {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.prof-stats-tag--2 {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.22);
}

.prof-stats-tag--3 {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.22);
}

.prof-stats-tag--4 {
  background: rgba(167, 139, 250, 0.12);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.22);
}

.prof-stats-tag--5 {
  background: rgba(251, 113, 133, 0.12);
  color: #fb7185;
  border: 1px solid rgba(251, 113, 133, 0.22);
}

.prof-stats-foot {
  padding: 0.72rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.btn-sales-24h-open {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(45, 212, 191, 0.35);
  background: rgba(45, 212, 191, 0.08);
  color: #5eead4;
}

.btn-sales-24h-open:hover {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(45, 212, 191, 0.5);
}

.btn-sales-24h-open-text {
  max-width: 6.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal.modal-sales-24h {
  max-width: min(36rem, 96vw);
  padding: 0;
  overflow: hidden;
}

.sales-24h-table-wrap {
  max-height: min(55vh, 22rem);
  overflow: auto;
  padding: 0 0.5rem 0.5rem;
}

.sales-24h-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.sales-24h-table th,
.sales-24h-table td {
  padding: 0.45rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.sales-24h-table th {
  position: sticky;
  top: 0;
  background: var(--surface-elevated, var(--surface));
  font-weight: 600;
  color: var(--muted);
  z-index: 1;
}

.sales-24h-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.sales-24h-pw {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

.sales-24h-table td:first-child {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}

.sales-24h-badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.sales-24h-type-created {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.sales-24h-type-renewed {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}

.sales-24h-type-deleted {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.sales-24h-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.25rem 0.5rem !important;
}

.sales-log-toolbar {
  padding: 0.35rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.btn-refresh-service {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2, #1e2a3a);
  color: var(--accent, #60a5fa);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-refresh-service:hover:not(:disabled) {
  background: var(--surface3, #2a3550);
  color: var(--text);
}
.btn-refresh-service:disabled,
.btn-refresh-service.loading {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-refresh-service.loading svg {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.refresh-service-countdown {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: var(--surface2, #1e2a3a);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--accent, #60a5fa);
  direction: rtl;
}
.refresh-service-countdown:not([hidden]) {
  display: flex;
}
.refresh-service-countdown svg {
  animation: spin 1.2s linear infinite;
  flex-shrink: 0;
}
.refresh-countdown-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  min-width: 60px;
}
.refresh-countdown-bar {
  display: block;
  height: 100%;
  background: var(--accent, #60a5fa);
  border-radius: 99px;
  transition: width 0.9s linear;
}

.sales-log-date-nav {
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sales-log-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8125rem;
}

.sales-log-page-info {
  min-width: 6.5rem;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sales-log-page-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/*
 * نوار ابزار: قوانین «کشیده شدن» دسکتاپ فقط داخل min-width (موبایل جدا).
 * دسکتاپ = همان رفتار قبلی: flex افقی، gap 0.5 بین بلوک‌ها، جستجو با flex:1 در ردیف.
 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
}

@media (min-width: 641px) {
  .toolbar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
  }

  .toolbar-row {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }

  .toolbar-row--create {
    flex-shrink: 0;
    order: 0;
  }

  .toolbar-row--search {
    order: 1;
    flex: 0 1 180px;
    min-width: 120px;
    max-width: 200px;
  }

  .toolbar-row--search .search-wrap {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .toolbar-row--filters {
    order: 2;
  }

  .toolbar-row--filters .filter-btns {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  /* جداکننده عمودی بین فیلترها و دکمه‌های عملیاتی */
  .toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 1.25rem;
    background: var(--border);
    align-self: center;
    flex-shrink: 0;
    margin: 0 0.1rem;
    visibility: visible;
  }
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: min(100%, 200px);
  max-width: 260px;
}

.btn-ghost-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.25);
}

.btn-ghost-danger:hover {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.45);
}

.search-wrap svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 0.65rem 2.75rem 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.btn:hover {
  background: #2d3d52;
  border-color: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

a.btn:visited {
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border-color: transparent;
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
}

.btn-danger {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.22);
}

.btn-warn {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--warning);
}

.btn-warn:hover {
  background: rgba(251, 191, 36, 0.18);
}

.btn-success {
  background: var(--success-bg);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--success);
}

.btn-success:hover {
  background: rgba(52, 211, 153, 0.2);
}

.btn-info {
  background: var(--accent-dim);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--accent);
}

.btn-info:hover {
  background: rgba(56, 189, 248, 0.22);
}

.panel {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.um-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.um-table--ltr-cols {
  direction: ltr;
}

.um-table--ltr-cols thead th {
  text-align: right;
}

.um-table--ltr-cols tbody td {
  text-align: right;
}

.um-table--ltr-cols .cell-bulk-th {
  width: 1%;
  min-width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}

.um-table--ltr-cols .cell-actions-th {
  width: 1%;
  min-width: 10rem;
}

.um-table thead th {
  text-align: right;
  padding: 0.85rem 1rem;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.um-table tbody tr {
  border-top: 1px solid var(--border);
  transition: background 0.12s;
}

.um-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.um-table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

.um-table .cell-bulk {
  text-align: center;
  vertical-align: middle;
  width: 1%;
}

.um-table .bulk-select-all-cb,
.um-table .bulk-row-cb {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--accent);
}

.um-table .cell-actions {
  white-space: nowrap;
  min-width: fit-content;
}

.um-table .cell-actions .btn-wrap {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  justify-content: flex-end;
  align-items: center;
}

.um-table .cell-actions .btn-wrap .btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-online {
  background: var(--success-bg);
  color: var(--success);
}

.badge-offline {
  background: rgba(139, 156, 179, 0.15);
  color: var(--muted);
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
}

.badge-inactive {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-expired {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.pw-text {
  font-family: ui-monospace, "Vazirmatn", monospace;
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--text);
}

.profile-tag {
  font-family: ui-monospace, "Vazirmatn", monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.usage-cell {
  font-family: ui-monospace, "Vazirmatn", monospace;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

/* ── ستون انقضا — badge‌های رنگی ── */
.expiry-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* منقضی شده — قرمز */
.expiry-expired {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}

/* امروز یا فردا — نارنجی/قرمز */
.expiry-critical {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.35);
}

/* ۲ تا ۷ روز — زرد */
.expiry-warn {
  background: rgba(251, 191, 36, 0.13);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.3);
}

/* ۸ تا ۳۰ روز — آبی روشن */
.expiry-soon {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.25);
}

/* بیش از ۳۰ روز — سبز */
.expiry-ok {
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.25);
}

/* ردیف کاربر منقضی‌شده */
.um-table tbody tr.row-expired {
  background: rgba(248, 113, 113, 0.04);
}

.um-table tbody tr.row-expired:hover {
  background: rgba(248, 113, 113, 0.08);
}

/* ترتیب ستون‌ها در موبایل */
.um-col-expiry { order: 4; }

/* حجم مصرفی: عدد و واحد KB/MB/GB چپ‌به‌راست؛ واحد سمت راست عدد */
.usage-ltr {
  direction: ltr;
  display: inline-block;
  unicode-bidi: embed;
  text-align: left;
}

.usage-cell .usage-num {
  font-variant-numeric: tabular-nums;
}

.usage-cell .usage-unit {
  margin-inline-start: 0.35em;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.92em;
}

.um-table .cell-online-led {
  white-space: nowrap;
}

.online-led-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.online-led {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(139, 156, 179, 0.5);
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

.online-led--on {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.65);
  animation: online-led-blink 1.1s ease-in-out infinite;
}

@keyframes online-led-blink {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.65);
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 14px 6px rgba(52, 211, 153, 0.4);
  }
}

.online-led-text {
  font-size: 0.78rem;
  min-width: 2.75rem;
}

.traffic-cell {
  cursor: help;
  font-size: 0.88rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.loading {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  max-width: min(90vw, 420px);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 450;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.err {
  border-color: rgba(248, 113, 113, 0.4);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: scale(0.96);
  transition: transform 0.2s;
}

.modal--create {
  max-width: 500px;
  padding: 0;
  overflow: hidden;
}

.modal-backdrop.open .modal {
  transform: scale(1);
}

.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.modal.modal-prof-stats .prof-stats-topbar h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.modal label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* راهنمای کنار لیبل */
.field-hint {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
}

/* نکته رمز خودکار دسته‌ای */
.bulk-pw-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.bulk-pw-note svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* ── Create modal tabs ── */
.create-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.create-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.create-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.create-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

.create-pane-title {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

#create-pane-single,
#create-pane-bulk {
  padding: 1.4rem 1.5rem 1.5rem;
}

/* رمز عبور + دکمه تصادفی */
.pw-field-wrap {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pw-field-input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, "Vazirmatn", monospace;
  font-size: 0.92rem;
}

.pw-field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ردیف فیلدهای bulk */
.bulk-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.6rem;
  margin-bottom: 0.1rem;
}

.bulk-field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.bulk-field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

.bulk-field-sm input {
  width: 70px;
}

/* Progress bar */
.bulk-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.bulk-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 99px;
  transition: width 0.25s ease;
  width: 0%;
}

.bulk-progress-text {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.85rem;
  text-align: center;
}

/* ── Bulk result modal ── */
.modal--bulk-result {
  max-width: 500px;
}

.bulk-result-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 1.1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.bulk-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.85rem;
  direction: ltr;
}

.bulk-result-item:last-child {
  border-bottom: none;
}

.bulk-result-user {
  font-weight: 700;
  color: var(--accent);
  font-family: ui-monospace, "Vazirmatn", monospace;
  min-width: 0;
}

.bulk-result-sep {
  color: var(--border);
  flex-shrink: 0;
}

.bulk-result-pass {
  color: var(--muted);
  font-family: ui-monospace, "Vazirmatn", monospace;
}

.bulk-result-failed {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--danger);
  text-align: center;
}

.modal input[type="password"],
.modal input[type="text"],
.modal select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.modal select {
  cursor: pointer;
}


.modal .modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.modal-backdrop--success {
  z-index: 400;
}

.modal-backdrop--info {
  z-index: 400;
}

.modal--info-sheet {
  max-width: 460px;
  padding: 1.65rem 1.5rem;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(160deg, var(--surface) 0%, rgba(56, 189, 248, 0.05) 100%);
}

.info-sheet-icon {
  color: var(--accent) !important;
}

.modal--success-sheet {
  max-width: 460px;
  padding: 1.65rem 1.5rem;
  border: 1px solid rgba(52, 211, 153, 0.22);
  background: linear-gradient(160deg, var(--surface) 0%, rgba(52, 211, 153, 0.06) 100%);
}

.success-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.success-sheet-icon {
  flex-shrink: 0;
  color: var(--success);
  line-height: 0;
}

.success-sheet-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.success-sheet-sub {
  margin: 0.3rem 0 0;
  line-height: 1.45;
}

.success-sheet-body {
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 1.1rem;
}

.cred-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.success-sheet-body > .cred-row:nth-child(3) {
  border-bottom: none;
  padding-bottom: 0;
}

.cred-row:first-child {
  padding-top: 0;
}

.cred-label {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.cred-value {
  margin: 0;
  font-size: 0.92rem;
  text-align: left;
  direction: ltr;
  unicode-bidi: embed;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.cred-plain.cred-value {
  background: transparent;
  padding: 0.35rem 0;
}

.cred-link-block {
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.cred-link-block .cred-label {
  display: block;
  margin-bottom: 0.4rem;
}

.cred-link {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 600;
  word-break: break-all;
  line-height: 1.5;
}

.cred-link:hover {
  text-decoration: underline;
}

.success-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
}

.btn-copy-share {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-copy-share.btn-copy-done {
  background: var(--success-bg);
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--success);
}

.meta-muted {
  font-size: 0.8rem;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile cards */
@media (max-width: 768px) {
  .um-table thead {
    display: none;
  }

  .um-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    margin: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface2);
  }

  .um-table tbody td {
    display: grid;
    grid-template-columns: minmax(100px, 38%) 1fr;
    gap: 0.5rem;
    padding: 0.45rem 0;
    border: none;
    align-items: center;
  }

  .um-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
  }

  .um-col-bulk    { order: 0; }
  .um-col-user    { order: 1; }
  .um-col-pw      { order: 2; }
  .um-col-profile { order: 3; }
  .um-col-expiry  { order: 4; }
  .um-col-usage   { order: 5; }
  .um-col-status  { order: 6; }
  .um-col-online  { order: 7; }
  .um-col-actions { order: 8; }

  .um-table .cell-actions {
    grid-template-columns: 1fr;
    padding-top: 0.75rem;
  }

  .um-table .cell-actions::before {
    display: none;
  }

  .um-table .cell-actions .btn-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-start;
  }

  .um-table .cell-actions .btn-wrap .btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
  }
}

@media (min-width: 769px) {
  .um-table .cell-actions .btn-wrap {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    justify-content: flex-end;
  }
}

/* ── Profile Sales Card ────────────────────────────────────── */
.profile-sales-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.profile-sales-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 100% 0%, rgba(52, 211, 153, 0.05), transparent);
  pointer-events: none;
}

.profile-sales-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.profile-sales-head-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent);
}

.profile-sales-head-title svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.profile-sales-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.profile-sales-sub {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.profile-sales-total {
  text-align: right;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.profile-sales-total-label {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
  text-align: right;
}

.profile-sales-total-value {
  display: block;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--success);
  direction: ltr;
  letter-spacing: -0.02em;
}

.profile-sales-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
}

@media (max-width: 960px) {
  .profile-sales-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .profile-sales-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.psi {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, transform 0.15s;
}

.psi:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

.psi-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: ui-monospace, "Vazirmatn", monospace;
  padding: 0.28rem 0.7rem;
  border-radius: 6px;
  width: fit-content;
  letter-spacing: 0.05em;
}

.psi-badge-1 {
  background: rgba(56, 189, 248, 0.13);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.psi-badge-2 {
  background: rgba(52, 211, 153, 0.13);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.28);
}

.psi-badge-3 {
  background: rgba(251, 191, 36, 0.13);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.28);
}

.psi-badge-4 {
  background: rgba(167, 139, 250, 0.13);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.28);
}

.psi-badge-5 {
  background: rgba(251, 113, 133, 0.13);
  color: #fb7185;
  border: 1px solid rgba(251, 113, 133, 0.28);
}

.psi-price-hint {
  font-size: 0.7rem;
  color: var(--muted);
  direction: rtl;
  line-height: 1.4;
}

.psi-count-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.32rem;
  margin-top: 0.15rem;
}

.psi-count {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.psi-unit {
  font-size: 0.72rem;
  color: var(--muted);
}

.psi-breakdown {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  direction: rtl;
  min-height: 1.1em;
  flex-wrap: wrap;
}
.psi-bd-created {
  color: var(--success);
  font-weight: 600;
}
.psi-bd-renewed {
  color: var(--accent);
  font-weight: 600;
}
.psi-bd-sep {
  color: var(--muted);
  font-size: 0.62rem;
}

.psi-amount {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success);
  direction: ltr;
  font-family: ui-monospace, "Vazirmatn", monospace;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.1rem;
}

.bulk-actions-bar {
  position: fixed;
  bottom: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  max-width: min(96vw, 520px);
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  transform: translateX(-50%) translateY(10px);
}

.bulk-actions-bar.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.bulk-actions-count {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.bulk-actions-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
}

.bulk-actions-btns .btn-sm {
  padding: 0.28rem 0.5rem;
  font-size: 0.76rem;
}

@media (max-width: 520px) {
  .bulk-actions-bar {
    flex-direction: column;
    align-items: stretch;
    max-width: calc(100vw - 1.5rem);
    padding: 0.55rem 0.65rem;
  }

  .bulk-actions-count {
    text-align: center;
  }

  .bulk-actions-btns {
    justify-content: stretch;
  }

  .bulk-actions-btns .btn-sm {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* --- Pagination ----------------------------------------------------------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.pagination-info strong {
  color: var(--text);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.pg-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1;
}

.pg-btn:hover:not(:disabled) {
  background: var(--surface3, #2a3550);
  color: var(--text);
  border-color: var(--border2, rgba(255,255,255,0.15));
}

.pg-btn.pg-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: default;
}

.pg-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pg-ellipsis {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0 0.2rem;
  user-select: none;
}

/* --- Filter Buttons ------------------------------------------------------- */
.filter-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-filter:hover {
  background: var(--surface3, #2a3550);
  color: var(--text);
}

.btn-filter--active {
  border-color: currentColor;
}

.btn-filter--active.btn-filter:has(.filter-dot-online) {
  color: var(--success);
  background: rgba(52,211,153,0.1);
  border-color: rgba(52,211,153,0.4);
}

.btn-filter--active.btn-filter:has(.filter-dot-expired) {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(248,113,113,0.4);
}

.btn-filter--active.btn-filter:has(.filter-icon-disabled) {
  color: #94a3b8;
  background: rgba(148,163,184,0.12);
  border-color: rgba(148,163,184,0.45);
}

.filter-icon-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #94a3b8;
}

.btn-filter--active .filter-icon-disabled {
  color: #cbd5e1;
}

.btn-filter--active.btn-filter:has(.filter-icon-unused) {
  color: #a78bfa;
  background: rgba(167,139,250,0.12);
  border-color: rgba(167,139,250,0.45);
}

.filter-icon-unused {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #7c6fcd;
}

.btn-filter--active .filter-icon-unused {
  color: #a78bfa;
}

.filter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-dot-online  { background: var(--success); }
.filter-dot-expired { background: var(--danger); }

/* --- Sales Date Navigation ------------------------------------------------ */
.sales-date-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.25rem 0.4rem;
}

.sales-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 0.4rem;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sales-nav-btn:hover:not(:disabled) {
  background: var(--surface3, #2a3550);
  color: var(--text);
}
.sales-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.sales-today-btn {
  padding: 0 0.65rem;
  font-size: 0.75rem;
  color: var(--accent);
}
.sales-today-btn:hover:not(:disabled) { color: var(--text); }

.sales-date-input {
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0.2rem;
  outline: none;
  direction: ltr;
  min-width: 0;
  width: 120px;
}
.sales-date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}
