/* ========================================================
   MOTION TOKI - COMMERCIAL SAAS & AUTHENTICATION STYLES
   ======================================================== */

/* User Header Widget */
.user-header-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  margin-left: 6px;
}

.btn-auth-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.3);
  transition: all 150ms ease;
}

.btn-auth-open:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(244, 63, 94, 0.4);
}

.btn-upgrade-pro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #ffffff !important;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
  animation: pulseUpgrade 2.5s infinite;
  transition: all 150ms ease;
}

.btn-upgrade-pro:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}

@keyframes pulseUpgrade {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.6); }
  100% { transform: scale(1); }
}

.badge-pro {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  letter-spacing: 0.2px;
  cursor: pointer;
  white-space: nowrap;
}

[data-theme="dark"] .badge-pro {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.badge-free {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-tertiary, #f1f5f9);
  border: 1px solid var(--border, #cbd5e1);
  color: var(--text-muted, #64748b);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 9999px;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border, #e2e8f0);
  padding: 3px 10px 3px 4px;
  border-radius: 9999px;
  cursor: pointer;
  color: var(--text-primary, #0f172a);
  font-family: inherit;
  transition: all 150ms ease;
}

.user-profile-btn:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  border-color: var(--accent, #f43f5e);
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-profile-name {
  font-size: 12px;
  font-weight: 600;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User Dropdown Menu */
.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  z-index: 99999;
  padding: 8px;
  animation: modalFadeIn 0.15s ease-out;
}

.user-dropdown-menu.active {
  display: block;
}

.user-dropdown-header {
  padding: 10px;
  border-bottom: 1px solid var(--border, #f1f5f9);
  margin-bottom: 6px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text-primary, #1e293b);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: all 120ms ease;
}

.user-dropdown-item:hover {
  background: var(--bg-hover, #f8fafc);
  color: var(--accent, #f43f5e);
}

.user-dropdown-item.danger:hover {
  background: #fef2f2;
  color: #ef4444;
}

/* Auth Modal Styles */
#authModal.modal-overlay {
  z-index: 999999 !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(15, 23, 42, 0.65);
}

@keyframes authBoxShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.auth-box.auth-shake {
  animation: authBoxShake 0.35s ease-in-out;
}

.auth-box {
  max-width: 440px;
  width: 100%;
  background: var(--bg-card, #ffffff);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
}

.auth-header {
  text-align: center;
  padding: 24px 20px 14px;
}

.auth-logo-wrap {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.15);
}

.auth-tabs-nav {
  display: flex;
  margin: 0 20px 16px;
  background: var(--bg-tertiary, #f1f5f9);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  font-family: inherit;
  transition: all 150ms ease;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: var(--text-primary, #0f172a);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .auth-tab-btn.active {
  background: #1e293b;
  color: #f8fafc;
}

.auth-body {
  padding: 0 24px 24px;
}

.auth-form-group {
  margin-bottom: 14px;
  text-align: left;
}

.auth-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #475569);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  border: 1.5px solid var(--border, #cbd5e1);
  border-radius: 10px;
  background: var(--bg-input, #ffffff);
  color: var(--text-primary, #0f172a);
  box-sizing: border-box;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-input:focus {
  outline: none;
  border-color: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}

.auth-submit-btn {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
  transition: all 150ms ease;
  margin-top: 6px;
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(244, 63, 94, 0.45);
}

/* Subscription PRO Modal Styles */
.sub-modal-box {
  max-width: 520px;
  width: 95%;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #ffffff);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border, #e2e8f0);
}

.sub-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #701a75 100%);
  color: #ffffff;
  padding: 16px 18px 12px;
  text-align: center;
  position: relative;
  flex-shrink: 0;
}

.sub-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.16);
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fde047;
  border: 1px solid rgba(253, 224, 71, 0.25);
  margin-bottom: 4px;
}

.sub-price-tag {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  margin: 3px 0 2px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.sub-price-sub {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
}

.sub-hero-tagline {
  font-size: 11px;
  opacity: 0.85;
  margin: 0 0 8px;
}

.sub-perks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 0;
  text-align: left;
}

.sub-perk-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sub-body {
  padding: 12px 18px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.sub-qr-instruction {
  text-align: center;
  margin-bottom: 8px;
}
.sub-qr-instruction strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
}
.sub-qr-instruction p {
  font-size: 10.5px;
  color: var(--text-secondary);
  margin: 1px 0 0;
}

.sub-qr-layout {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg-tertiary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}

.sub-qr-image-wrap {
  width: 175px;
  height: 175px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sub-qr-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.sub-bank-info {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.sub-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border, #e2e8f0);
  font-size: 11.5px;
}

.sub-info-label {
  color: var(--text-muted, #64748b);
  font-size: 10.5px;
}

.sub-info-val {
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-copy-mini {
  background: var(--bg-secondary, #e2e8f0);
  border: 1px solid var(--border, #cbd5e1);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent, #f43f5e);
  transition: all 120ms ease;
}

.btn-copy-mini:hover {
  background: #f43f5e;
  color: #ffffff;
  border-color: #f43f5e;
}

.sub-activate-btn {
  width: 100%;
  padding: 11px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 150ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.sub-activate-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.sub-footer-note {
  text-align: center;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.sub-activate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

/* Banner nhắc PRO trên tab Motion khi là tài khoản FREE */
.pro-alert-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: #92400e;
}

[data-theme="dark"] .pro-alert-banner {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* ========================================================
   RESPONSIVE DESIGN FOR SMARTPHONES & MOBILE BROWSERS
   ======================================================== */
@media (max-width: 650px) {
  /* 1. TITLEBAR ON MOBILE (CHUẨN THEO MOTIONFLY) */
  .titlebar {
    padding: 0 14px !important;
    height: 56px !important;
  }
  
  /* Hiện thương hiệu 'Motion Toki' sắc nét, gradient màu đẹp như trên PC */
  .titlebar-name {
    display: inline-block !important;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
    background: linear-gradient(90deg, #e11d48 0%, #8b5cf6 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    margin-left: 2px !important;
  }
  
  .titlebar-brand {
    gap: 8px !important;
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 9px !important;
    background: var(--bg-card, #ffffff) !important;
    border: 1px solid var(--border-light, #e2e8f0) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    color: var(--text-primary, #0f172a) !important;
    margin-right: 8px !important;
    flex-shrink: 0 !important;
  }

  .titlebar-logo img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    object-fit: cover !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
  }
  
  .titlebar-controls {
    gap: 6px !important;
  }
  
  .user-header-widget {
    margin-left: 2px !important;
    gap: 4px !important;
  }

  /* Ẩn tên tài khoản dài dòng trong header button, chỉ giữ vòng tròn avatar */
  .user-profile-name {
    display: none !important;
  }

  .user-profile-btn {
    padding: 3px 6px 3px 3px !important;
    gap: 3px !important;
    border-radius: 9999px !important;
  }

  .user-profile-btn svg {
    width: 12px !important;
    height: 12px !important;
  }

  .user-avatar-circle {
    width: 26px !important;
    height: 26px !important;
    font-size: 11px !important;
  }

  /* Huy hiệu PRO / FREE nhỏ gọn hơn trên điện thoại */
  .badge-pro {
    font-size: 10px !important;
    padding: 3px 8px !important;
    gap: 3px !important;
    letter-spacing: 0px !important;
    white-space: nowrap !important;
    user-select: none;
  }

  .badge-free {
    font-size: 10px !important;
    padding: 3px 6px !important;
    gap: 3px !important;
  }

  .btn-auth-open {
    font-size: 11px !important;
    padding: 5px 10px !important;
    gap: 4px !important;
  }

  .btn-auth-open span {
    font-size: 11px !important;
  }

  .btn-upgrade-pro {
    font-size: 10.5px !important;
    padding: 4px 9px !important;
    gap: 4px !important;
  }

  /* Dropdown User Menu trên mobile */
  .user-dropdown-menu {
    right: -4px !important;
    width: calc(100vw - 24px) !important;
    max-width: 280px !important;
  }

  /* 2. TAB QUẢN TRỊ VIÊN & QUẢN LÝ THÀNH VIÊN (#page-admin) */
  #page-admin .page-title {
    font-size: 18px !important;
    line-height: 1.3 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  #page-admin .page-subtitle {
    font-size: 11.5px !important;
    margin-top: 4px !important;
    line-height: 1.4 !important;
  }

  /* 2 nút trên cùng xếp đều 50% - 50% */
  .admin-top-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 10px !important;
  }

  .admin-top-actions .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  /* 4 THẺ KPI CHUYỂN THÀNH DẠNG LƯỚI 2 CỘT (2x2 Grid) GỌN ĐẸP */
  .admin-kpis-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  .admin-kpi-card {
    padding: 10px 10px !important;
    border-radius: 12px !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  .admin-kpi-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    flex-shrink: 0 !important;
  }

  .admin-kpi-card > div:last-child {
    min-width: 0;
    overflow: hidden;
  }

  .admin-kpi-card > div:last-child > div:first-child {
    font-size: 9.5px !important;
    letter-spacing: 0.2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .admin-kpi-num {
    font-size: 16px !important;
    font-weight: 800 !important;
    margin-top: 1px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Thanh lọc & tìm kiếm trên mobile */
  .admin-filter-bar {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    align-items: stretch !important;
  }

  .admin-search-box {
    max-width: 100% !important;
    width: 100% !important;
    background: var(--bg-card, #ffffff) !important;
    padding: 7px 12px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border, #cbd5e1) !important;
  }

  .admin-search-box input {
    font-size: 12.5px !important;
  }

  .admin-filter-controls {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .admin-filter-controls select {
    flex: 1 !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
  }

  #adminUserCountText {
    font-size: 11.5px !important;
    flex-shrink: 0 !important;
  }

  /* Bảng thành viên trên mobile: Hỗ trợ cuộn ngang mượt mà có chỉ dẫn */
  #page-admin .card > div:last-child {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #page-admin table {
    min-width: 640px !important;
  }

  #page-admin th, #page-admin td {
    padding: 10px 12px !important;
  }

  /* 3. TAB GÓI CƯỚC & BẢN QUYỀN (#page-license) */
  #page-license .page-title {
    font-size: 19px !important;
  }

  #page-license .page-subtitle {
    font-size: 11.5px !important;
  }

  .license-top-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
    margin-top: 8px !important;
  }

  .license-top-actions .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
  }

  .license-hero-card {
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }

  .license-hero-head {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .license-hero-right {
    text-align: left !important;
    width: 100% !important;
    padding-top: 10px !important;
    border-top: 1px dashed var(--border, #e2e8f0) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
  }

  .license-hero-foot {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding-top: 12px !important;
  }

  .license-hero-foot .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px !important;
    font-size: 13.5px !important;
  }

  /* Bảng so sánh quyền lợi gói cước: hiển thị 100% không bị khuất chữ */
  #page-license table {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: fixed !important;
  }

  #page-license th, #page-license td {
    padding: 10px 5px !important;
    font-size: 11.5px !important;
    line-height: 1.35 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  #page-license th:nth-child(1), #page-license td:nth-child(1) {
    width: 38% !important;
    padding-left: 8px !important;
    text-align: left !important;
  }

  #page-license th:nth-child(2), #page-license td:nth-child(2) {
    width: 28% !important;
    text-align: center !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  #page-license th:nth-child(3), #page-license td:nth-child(3) {
    width: 34% !important;
    text-align: center !important;
    padding-left: 2px !important;
    padding-right: 6px !important;
  }

  .mobile-table-hint {
    display: none !important;
  }

  /* Modal Popup trên mobile */
  .auth-box {
    margin: 10px;
    border-radius: 16px;
  }

  .auth-body {
    padding: 0 16px 20px;
  }

  .sub-modal-box {
    margin: 6px auto !important;
    width: 95% !important;
    max-height: 94vh !important;
    border-radius: 16px !important;
  }

  .sub-hero {
    padding: 12px 14px 10px !important;
  }

  .sub-price-tag {
    font-size: 22px !important;
  }

  .sub-hero-tagline {
    font-size: 10px !important;
    margin-bottom: 6px !important;
  }

  .sub-perks-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 4px !important;
  }

  .sub-perk-item {
    font-size: 10px !important;
    padding: 3px 6px !important;
  }

  .sub-body {
    padding: 10px 12px 12px !important;
  }

  .sub-qr-layout {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 12px !important;
    align-items: center !important;
  }

  .sub-qr-image-wrap {
    width: 180px !important;
    height: 180px !important;
    min-width: 180px !important;
    margin: 0 auto !important;
    padding: 6px !important;
  }

  .sub-bank-info {
    width: 100% !important;
  }

  .sub-info-row {
    padding: 3px 0 !important;
    font-size: 11px !important;
  }

  .sub-info-label {
    font-size: 10px !important;
  }

  .btn-copy-mini {
    font-size: 9.5px !important;
    padding: 1px 4px !important;
  }

  .sub-activate-btn {
    font-size: 12px !important;
    padding: 9px !important;
    border-radius: 8px !important;
  }

  .sub-footer-note {
    font-size: 9.5px !important;
    margin-top: 5px !important;
  }

  .mobile-table-hint {
    display: block !important;
  }
}

/* Base style for mobile table hint (ẩn trên PC) */
.mobile-table-hint {
  display: none;
  font-size: 11px;
  color: var(--text-muted, #64748b);
  background: var(--bg-tertiary, #f8fafc);
  padding: 6px 12px;
  text-align: center;
  border-bottom: 1px dashed var(--border, #e2e8f0);
  user-select: none;
  font-weight: 500;
}

@media (max-width: 400px) {
  .admin-top-actions .btn {
    font-size: 11px !important;
    padding: 8px 4px !important;
    gap: 4px !important;
  }
  .admin-kpi-num {
    font-size: 14.5px !important;
  }
  .sub-price-tag {
    font-size: 24px !important;
  }
  .member-card-actions {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }
}

/* ========================================================
   RESPONSIVE MEMBER CARDS (MOBILE APP-STYLE VIEW)
   ======================================================== */
.desktop-only-table {
  display: block;
}

.mobile-only-cards {
  display: none;
}

@media (max-width: 768px) {
  /* Ẩn bảng table truyền thống trên điện thoại */
  .desktop-only-table {
    display: none !important;
  }

  /* Kích hoạt chế độ thẻ Card chuyên dụng cho mobile */
  .mobile-only-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 12px !important;
    background: transparent !important;
  }

  .admin-member-card {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: transform 150ms ease, box-shadow 150ms ease;
  }

  .admin-order-mob-card {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: transform 150ms ease, box-shadow 150ms ease;
  }

  .admin-member-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  }

  .member-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }

  .member-card-stats {
    display: grid;
    grid-template-columns: 1.1fr 0.8fr 1.1fr;
    gap: 6px;
    background: var(--bg-tertiary, #f1f5f9);
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light, #e2e8f0);
  }

  .member-stat-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
  }

  .stat-box-lbl {
    font-size: 10px;
    color: var(--text-muted, #64748b);
    font-weight: 600;
    white-space: nowrap;
  }

  .stat-box-val {
    font-size: 12px;
    color: var(--text-primary, #0f172a);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .member-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted, #64748b);
    margin-bottom: 12px;
    padding: 0 2px;
  }

  .member-card-meta b {
    color: var(--text-primary, #0f172a);
  }

  .member-card-actions {
    display: grid;
    grid-template-columns: 1.15fr 0.9fr 1fr 1.1fr 0.65fr;
    gap: 5px;
    width: 100%;
    padding-top: 10px;
    border-top: 1px dashed var(--border, #e2e8f0);
  }

  .btn-mob-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border, #cbd5e1);
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    text-decoration: none;
    transition: all 120ms ease;
    font-family: inherit;
    white-space: nowrap;
  }

  .btn-mob-act:active {
    transform: scale(0.96);
  }

  .btn-mob-pro {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    color: #b45309 !important;
    border-color: #f59e0b !important;
    font-weight: 700 !important;
  }

  .btn-mob-del {
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
    background: #fff5f5 !important;
  }
}

/* Dark mode adjustments */
[data-theme="dark"] .mobile-only-cards {
  background: transparent !important;
}

[data-theme="dark"] .admin-member-card,
[data-theme="dark"] .admin-order-mob-card {
  background: #0f172a !important;
  border-color: #1e293b !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

[data-theme="dark"] .card {
  background: #0a0a1a !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .member-card-stats {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .btn-mob-act {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

[data-theme="dark"] .btn-mob-pro {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}

[data-theme="dark"] .btn-mob-del {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
}

/* ========================================================
   ADMIN BAR CHART COMPONENT (BIỂU ĐỒ CỘT TĂNG TRƯỞNG)
   ======================================================== */
.chart-bars-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  height: 220px;
  padding: 24px 12px 12px 12px;
  background: var(--bg-tertiary);
  border-radius: 14px;
  margin-top: 16px;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
  transition: transform 0.18s ease;
  max-width: 85px;
}

.chart-bar-item:hover, .chart-bar-item.active {
  transform: translateY(-3px);
}

.chart-bar-value {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  white-space: nowrap;
  text-align: center;
}

.chart-bar-pill {
  width: 100%;
  border-radius: 10px 10px 4px 4px;
  transition: height 0.45s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, box-shadow 0.2s ease;
  min-height: 14px;
  position: relative;
}

.chart-bar-pill.revenue {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.chart-bar-pill.users {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.chart-bar-pill.pro {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.chart-bar-label {
  margin-top: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

.chart-bar-item.active .chart-bar-label {
  color: var(--accent);
}

.chart-bar-item.is-zero .chart-bar-pill {
  opacity: 0.35;
  background: var(--text-muted) !important;
  box-shadow: none !important;
  min-height: 4px;
}

.chart-bar-item.is-zero .chart-bar-value {
  color: var(--text-muted);
  opacity: 0.7;
}

.chart-bar-item.active .chart-bar-pill {
  filter: brightness(1.15);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
}

.chart-metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.chart-metric-tile {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-metric-tile:hover, .chart-metric-tile.active {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chart-mode-pill {
  font-size: 12px;
  padding: 6px 14px;
}

@media (max-width: 600px) {
  .chart-bars-wrap {
    gap: 5px;
    padding: 20px 4px 10px 4px;
    height: 195px;
  }
  .chart-bar-item {
    min-width: 32px;
    max-width: 55px;
  }
  .chart-bar-value {
    font-size: 9px;
    margin-bottom: 4px;
  }
  .chart-bar-label {
    font-size: 9.5px;
    margin-top: 6px;
  }
  .chart-metric-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================================
   ROLE SELECTOR CARDS (THAY THẾ SELECT CŨ, SIÊU ĐẸP)
   ======================================================== */
.role-opt-card {
  padding: 12px 10px;
  border-radius: 12px;
  background: var(--bg-card, #ffffff);
  border: 2px solid var(--border, #e2e8f0);
  cursor: pointer;
  text-align: center;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  position: relative;
}

.role-opt-card:active {
  transform: scale(0.97);
}

.role-opt-card.selected {
  border-color: var(--accent, #e11d48) !important;
  background: rgba(225, 29, 72, 0.05) !important;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.14) !important;
}

[data-theme="dark"] .role-opt-card {
  background: var(--bg-card, #131c31);
  border-color: var(--border, #334155);
}

[data-theme="dark"] .role-opt-card.selected {
  background: rgba(225, 29, 72, 0.12) !important;
  border-color: #fb7185 !important;
}

.role-opt-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary, #0f172a);
  margin-top: 2px;
}

.role-opt-desc {
  font-size: 10px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}

.role-opt-check {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent, #e11d48);
  background: rgba(225, 29, 72, 0.12);
  padding: 2px 8px;
  border-radius: 20px;
}

/* Custom Select Dropdown: Nền đỏ nhạt, Chữ đen đậm nét, Tích xanh */
.custom-select-item.is-selected {
  background: #fff1f2 !important;
  color: #000000 !important;
  font-weight: 700 !important;
}

.custom-select-item .check-svg {
  stroke: #16a34a !important;
}

[data-theme="dark"] .custom-select-item.is-selected {
  background: rgba(225, 29, 72, 0.22) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .custom-select-item .check-svg {
  stroke: #22c55e !important;
}

/* ═══ NÚT CHUYỂN ĐỔI CHẾ ĐỘ SÁNG / TỐI (THEME TOGGLE HÀI HÒA) ═══ */
.theme-toggle {
  width: 36px !important;
  height: 36px !important;
  border-radius: 9px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
  background: var(--bg-card, #ffffff) !important;
  border: 1px solid var(--border-light, #e2e8f0) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  color: var(--text-secondary, #64748b) !important;
}

.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: #cbd5e1 !important;
  color: var(--text-primary, #0f172a) !important;
}

.theme-toggle:active {
  transform: scale(0.92) !important;
}

/* Chế độ Sáng: Mặt Trời xám dịu nhẹ, tiệp màu hoàn toàn */
[data-theme="light"] .theme-toggle {
  background: var(--bg-card, #ffffff) !important;
  border: 1px solid var(--border-light, #e2e8f0) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  color: var(--text-secondary, #64748b) !important;
}
[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: #cbd5e1 !important;
  color: var(--text-primary, #0f172a) !important;
}
[data-theme="light"] .theme-toggle .icon-sun {
  display: block !important;
}
[data-theme="light"] .theme-toggle .icon-moon {
  display: none !important;
}

/* Chế độ Ban Đêm: Mặt Trăng bạc êm dịu, hài hòa chuẩn Dark Mode */
[data-theme="dark"] .theme-toggle {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
  color: #94a3b8 !important;
}
[data-theme="dark"] .theme-toggle:hover {
  background: #273549 !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .theme-toggle .icon-sun {
  display: none !important;
}
[data-theme="dark"] .theme-toggle .icon-moon {
  display: block !important;
}


