/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card .label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .value.accent { color: var(--accent); }
.stat-card .value.success { color: var(--success); }

.stat-card .icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.stat-card .icon.purple { background: var(--accent-soft); }
.stat-card .icon.green { background: var(--success-soft); }
.stat-card .icon.red { background: var(--danger-soft); }

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.chart-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-icon.edit:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.search-input {
  max-width: 400px;
  margin-bottom: 1.25rem;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-row span {
  font-weight: 500;
  color: var(--text);
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle.on { background: var(--success); }

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle.on::after { transform: translateX(22px); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  padding-right: 2rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.modal-wide {
  max-width: 720px;
}

.swap-media-wrap {
  margin: 0 0 1rem;
  background: var(--bg-input, #0f1117);
  border-radius: var(--radius-sm, 8px);
  padding: 0.5rem;
  text-align: center;
}

.swap-media-wrap--compact {
  max-height: 280px;
  overflow: hidden;
}

.swap-media-video,
.swap-media-img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}

.swap-media-wrap--compact .swap-media-video,
.swap-media-wrap--compact .swap-media-img {
  max-height: 240px;
}

.swap-media-cell {
  white-space: nowrap;
}

.swap-tg-block {
  text-align: center;
  padding: 1.25rem 1rem;
  background: var(--bg-hover);
  border: 1px dashed var(--border);
}

.swap-tg-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: var(--text);
}

.swap-tg-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.swap-tg-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.swap-media-loading {
  margin: 1rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.swaps-toolbar {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.swaps-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
}

.swaps-tabs .swaps-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}

.swaps-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.swap-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.swap-badge-ok {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.swap-badge-no {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.swaps-table {
  table-layout: fixed;
  width: 100%;
}

.swaps-table th,
.swaps-table td {
  vertical-align: top;
  overflow: hidden;
}

.swaps-table th:nth-child(1),
.swaps-table td:nth-child(1) { width: 3.2rem; }

.swaps-table .swap-problem {
  max-width: 100%;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.35;
}

.swaps-table .swap-resolver {
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.35;
}

.swaps-table td code {
  word-break: normal;
  overflow-wrap: anywhere;
}

.swaps-table .swap-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 7.5rem;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  color: var(--text);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* Live feed */
.live-feed {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.live-item {
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
}

.live-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Catalog tree */
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.catalog-tree {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tree-node {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
}

.tree-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.tree-header:hover { background: var(--bg); }

.tree-header .chevron {
  transition: transform var(--transition);
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 16px;
  flex-shrink: 0;
}

.tree-node.open > .tree-header .chevron { transform: rotate(90deg); }

.tree-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.tree-badge.category { background: var(--success-soft); color: var(--success); }
.tree-badge.undercategory { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.tree-badge.position { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.stock-ok { color: var(--success); font-weight: 600; }
.stock-empty { color: var(--danger); font-weight: 600; }

.tree-title {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.tree-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.tree-children {
  display: none;
  padding: 0.5rem 0.5rem 0.5rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.tree-node.open > .tree-children { display: block; }

.tree-children .tree-node {
  margin-bottom: 0.35rem;
}

.tree-children .tree-children {
  padding-left: 1rem;
}

.positions-sortable .tree-node.position-draggable {
  transition: box-shadow var(--transition), transform var(--transition);
}

.positions-sortable .tree-node.position-draggable.is-dragging {
  opacity: 0.55;
  box-shadow: var(--shadow-md);
}

.positions-sortable .tree-node.position-draggable.drag-over-top {
  box-shadow: inset 0 3px 0 var(--accent);
}

.positions-sortable .tree-node.position-draggable.drag-over-bottom {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  flex-shrink: 0;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.tree-node.position-draggable > .tree-header {
  cursor: default;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.items-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Auth page */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, #1a1f35 50%, var(--accent) 150%);
  padding: 1rem;
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0.5rem 0 0;
  color: var(--text);
}

.auth-logo p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-card .btn-primary {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 1rem;
}

/* Profile card */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: start;
}

.profile-data-row {
  padding: 0.5rem 0;
  color: var(--text);
  font-size: 0.95rem;
}

.profile-data-row strong {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.5rem;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tab-btns {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.tab-btn:hover, .tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.hidden { display: none !important; }

/* Users */
.users-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.users-toolbar .search-wrap {
  flex: 1;
  min-width: 220px;
}

.per-page-select {
  width: auto;
  min-width: 150px;
}

.users-card {
  padding: 0;
  overflow: visible;
}

.users-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
}

.users-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.users-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.users-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition), background var(--transition);
  position: relative;
  z-index: 1;
}

.users-table th.sortable:hover,
.users-table th.sort-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.sort-icon {
  display: inline-block;
  margin-left: 0.25rem;
  opacity: 0.55;
  font-size: 0.75rem;
}

.users-table th.sort-active .sort-icon {
  opacity: 1;
  color: var(--accent);
}

.users-row-banned {
  opacity: 0.72;
}

.users-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* Mobile list primary block — hidden on desktop */
.mlc-primary {
  display: none !important;
}

.users-row {
  cursor: pointer;
  transition: background var(--transition);
}

.users-row:hover {
  background: var(--bg-hover);
}

.users-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

.user-id {
  font-size: 0.82rem;
  background: var(--bg-hover);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.user-name {
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.user-referrer {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.72rem;
  margin-left: 0.35rem;
}

.pagination {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.page-btn {
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-dots {
  display: flex;
  align-items: center;
  padding: 0 0.25rem;
  color: var(--text-muted);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

/* User detail */
.user-detail-header {
  margin-bottom: 1rem;
}

.user-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.user-hero-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-hero-name {
  margin: 0;
  font-size: 1.35rem;
}

.user-tg-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.user-tg-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.user-hero-meta .user-tg-link {
  color: var(--accent);
}

.user-hero-meta .user-tg-id {
  color: var(--text-muted);
}

.user-hero-meta .user-tg-id:hover {
  color: var(--accent);
}

.user-hero-meta {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.user-hero-date {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.user-hero-banned {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(135deg, var(--bg-card), rgba(239, 68, 68, 0.05));
}

.user-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.loyalty-card .value {
  font-size: 1.35rem;
}

.user-stats-grid {
  margin-bottom: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.user-ref-card {
  margin-bottom: 1.25rem;
}

.user-ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.user-ref-block {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.user-ref-block-title {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-ref-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.92rem;
}

.user-ref-label {
  color: var(--text-muted);
  min-width: 7rem;
  flex-shrink: 0;
}

.user-ref-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.user-ref-list-title {
  margin: 1.25rem 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .user-ref-grid {
    grid-template-columns: 1fr;
  }
}

.stat-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card-header-row h2 {
  margin: 0;
  font-size: 1.1rem;
}

.purchases-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.purchase-item {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
}

.purchase-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.purchase-position {
  font-weight: 600;
}

.purchase-price {
  color: var(--accent);
  font-weight: 600;
}

.purchase-meta {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.purchase-data {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.purchase-data summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}

.purchase-data pre {
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }

  .users-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .users-toolbar .search-wrap,
  .users-toolbar .search-input,
  .users-toolbar .per-page-select {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .search-input {
    margin-bottom: 0;
  }
}

/* Spam progress */
.spam-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.spam-progress-card {
  margin-top: 1.25rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.spam-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.spam-progress-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.spam-status-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}

.spam-status-badge.running {
  animation: pulse 1.5s ease infinite;
}

.spam-status-badge.done {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.spam-status-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.spam-status-badge.cancelled {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.spam-stop-wrap {
  margin-top: 0.75rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.spam-progress-bar-wrap {
  height: 12px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.spam-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 2%;
}

.spam-progress-percent {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.spam-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 700px) {
  .spam-stats-row { grid-template-columns: repeat(2, 1fr); }
}

.spam-stat {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  text-align: center;
}

.spam-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.spam-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.spam-stat-sent .spam-stat-value { color: #22c55e; }
.spam-stat-failed .spam-stat-value { color: #ef4444; }

.spam-hint {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.crypto-bal-line {
  display: block;
  font-size: 1.1rem;
  line-height: 1.4;
}

.purchase-user-link {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.purchase-user-link:hover {
  color: var(--accent);
}

.purchase-user-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Referrals page */
.ref-levels {
  margin-bottom: 1.5rem;
}

.ref-levels-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.ref-level-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.ref-level-item strong {
  font-size: 1.35rem;
  color: var(--accent);
}

.ref-level-item small {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.ref-level-highlight {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ref-panels {
  margin-top: 0;
}

.table-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.table-link:hover {
  text-decoration: underline;
}

.text-success {
  color: var(--success);
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.badge-purple {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

@media (max-width: 900px) {
  .ref-levels-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .ref-levels-grid {
    grid-template-columns: 1fr;
  }
}

/* KotikFree emoji picker (web admin catalog) */
.emoji-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.emoji-picker-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-secondary, #121c26);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.emoji-picker-preview-icon {
  font-size: 1.35rem;
  line-height: 1;
  width: 1.6rem;
  text-align: center;
}

.emoji-picker-preview-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.45rem;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.25rem;
}

.emoji-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg, var(--bg-secondary));
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.emoji-picker-item:hover {
  border-color: var(--accent);
}

.emoji-picker-item.selected {
  border-color: var(--accent);
  background: rgba(106, 178, 242, 0.12);
}

.emoji-picker-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  line-height: 1;
}

.emoji-picker-thumb {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
  display: block;
}

.emoji-picker-preview-icon .emoji-picker-thumb {
  width: 1.75rem;
  height: 1.75rem;
}

.tree-emoji-thumb {
  width: 1.15rem;
  height: 1.15rem;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

.emoji-picker-name {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: lowercase;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  vertical-align: middle;
  margin-right: 0.35rem;
  min-width: 1.25rem;
}

.tree-title {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.tree-title-text {
  display: inline;
}
