/* ==========================================================================
   EVOTO ECOIN WEB ADMIN - BLUE & WHITE SHARP MINIMALIST SAAS DESIGN SYSTEM
   Phong cách: Xanh - Trắng, Vuông góc, Rõ nét, Tương phản cao, Sang trọng & Gọn gàng
   Hỗ trợ: Canh lề 3cm 2 bên & Giao diện Ban Đêm (Dark Mode)
   ========================================================================== */

:root {
  /* Core Blue & White Palette (Light Mode Default) */
  --bg-app: #F4F7FB;
  --bg-sidebar: #FFFFFF;
  --bg-header: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-card-subtle: #F8FAFC;
  --bg-input: #FFFFFF;
  --bg-input-focus: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.98);

  /* Borders - Sharp & High Contrast */
  --border-color: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-subtle: #EDF2F7;
  --border-focus: #0052FF;

  /* Typography Colors - Deep Charcoal & Slate */
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;

  /* Signature Royal Blue Palette */
  --brand-primary: #0052FF;
  --brand-primary-hover: #0043D9;
  --brand-primary-active: #0038B8;
  --brand-primary-light: #EBF2FF;
  --brand-primary-border: #BCD6FF;
  --brand-primary-glow: rgba(0, 82, 255, 0.15);

  --brand-secondary: #0284C7;
  --brand-accent: #4F46E5;

  /* Status Colors - High Contrast, Sharp Tinted Badges */
  --status-success: #15803D;
  --status-success-bg: #DCFCE7;
  --status-success-border: #86EFAC;

  --status-warning: #B45309;
  --status-warning-bg: #FEF3C7;
  --status-warning-border: #FDE68A;

  --status-danger: #B91C1C;
  --status-danger-bg: #FEE2E2;
  --status-danger-border: #FCA5A5;

  --status-info: #0369A1;
  --status-info-bg: #E0F2FE;
  --status-info-border: #BAE6FD;

  --status-purple: #6D28D9;
  --status-purple-bg: #EDE9FE;
  --status-purple-border: #DDD6FE;

  /* Ecoin Gold Accent */
  --ecoin-gold: #B45309;
  --ecoin-gold-num: #D97706;
  --ecoin-gold-bg: #FEF3C7;
  --ecoin-gold-border: #FCD34D;

  /* Precision Crisp Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  /* Vuông góc / Sharp Precision Radiuses */
  --sidebar-width: 250px;
  --header-height: 64px;
  --radius-none: 0px;
  --radius-xs: 2px;
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --radius-xl: 6px;
  --radius-full: 4px;

  --transition-fast: 0.12s ease-in-out;
  --transition-normal: 0.2s ease-in-out;
}

/* ==========================================================================
   DARK MODE (UI BAN ĐÊM - SẮC NÉT, TƯƠNG PHẢN CAO, SANG TRỌNG)
   ========================================================================== */
[data-theme="dark"] {
  --bg-app: #0B1120;
  --bg-sidebar: #0F172A;
  --bg-header: #0F172A;
  --bg-card: #1E293B;
  --bg-card-hover: #253349;
  --bg-card-subtle: #162032;
  --bg-input: #0F172A;
  --bg-input-focus: #0F172A;
  --bg-glass: rgba(15, 23, 42, 0.95);

  --border-color: #334155;
  --border-strong: #475569;
  --border-subtle: #1E293B;
  --border-focus: #3B82F6;

  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --text-inverse: #0F172A;

  --brand-primary: #2563EB;
  --brand-primary-hover: #1D4ED8;
  --brand-primary-active: #1E40AF;
  --brand-primary-light: rgba(37, 99, 235, 0.2);
  --brand-primary-border: rgba(59, 130, 246, 0.4);
  --brand-primary-glow: rgba(37, 99, 235, 0.3);

  --status-success: #34D399;
  --status-success-bg: rgba(16, 185, 129, 0.15);
  --status-success-border: rgba(16, 185, 129, 0.35);

  --status-warning: #FBBF24;
  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-warning-border: rgba(245, 158, 11, 0.35);

  --status-danger: #F87171;
  --status-danger-bg: rgba(239, 68, 68, 0.15);
  --status-danger-border: rgba(239, 68, 68, 0.35);

  --status-info: #38BDF8;
  --status-info-bg: rgba(14, 165, 233, 0.15);
  --status-info-border: rgba(14, 165, 233, 0.35);

  --status-purple: #C084FC;
  --status-purple-bg: rgba(168, 85, 247, 0.15);
  --status-purple-border: rgba(168, 85, 247, 0.35);

  --ecoin-gold: #FBBF24;
  --ecoin-gold-num: #F59E0B;
  --ecoin-gold-bg: rgba(245, 158, 11, 0.15);
  --ecoin-gold-border: rgba(245, 158, 11, 0.35);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Crisp Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-card-subtle);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   APP LAYOUT (SIDEBAR + MAIN CONTENT)
   ========================================================================== */

#app-container {
  display: flex;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  position: relative;
  overflow-x: clip;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: width var(--transition-normal), transform var(--transition-normal), background-color var(--transition-normal);
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
}

.brand-logo {
  width: 34px;
  height: 34px;
  background-color: var(--brand-primary);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand-title {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--brand-primary);
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  border: 1px solid transparent;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-item:hover {
  color: var(--brand-primary);
  background-color: var(--brand-primary-light);
  border-color: var(--brand-primary-border);
}

.nav-item:hover svg {
  color: var(--brand-primary);
}

.nav-item.active {
  color: #FFFFFF;
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 82, 255, 0.2);
}

.nav-item.active svg {
  color: #FFFFFF;
}

.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.nav-item:not(.active) .nav-badge {
  background-color: var(--border-color);
  color: var(--text-secondary);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--bg-card-subtle);
}

.system-mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-success);
}

.status-dot.mock {
  background-color: var(--brand-primary);
}

.mode-text {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.mode-sub {
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN CONTENT AREA & HEADER (CANH LỀ 3 CM 2 BÊN)
   ========================================================================== */

.main-wrapper {
  flex: 1;
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  min-width: 0;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  overflow-x: clip;
}

.top-header {
  height: var(--header-height);
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 2.5vw, 36px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-headline {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.page-breadcrumb {
  font-size: 11.5px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-search {
  position: relative;
  width: 250px;
}

.quick-search input {
  width: 100%;
  height: 36px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 0 12px 0 34px;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.quick-search input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-glow);
}

.quick-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Header Actions */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 4px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background-color: var(--brand-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11.5px;
}

.user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Content Container */
.content-container {
  flex: 1;
  padding: 20px clamp(16px, 2.5vw, 36px) 40px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
}

.settings-grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
}

@media (max-width: 1100px) {
  .settings-grid-2col {
    grid-template-columns: 1fr !important;
  }
}

.page-view {
  display: none;
  animation: fadeIn 0.15s ease-out forwards;
}

.page-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   DASHBOARD LUXURY TOOLBAR & GLOBAL TIME RANGE FILTER
   ========================================================================== */

.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.live-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: liveDotPulse 1.8s infinite;
}

@keyframes liveDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 8px #10b981; }
  50% { transform: scale(1.3); opacity: 0.6; box-shadow: 0 0 14px #10b981; }
}

.dashboard-filter-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.dashboard-time-pills {
  display: inline-flex;
  align-items: center;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 3px;
  gap: 3px;
}

.dash-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.dash-pill-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.dash-pill-btn.active {
  color: #ffffff;
  background: var(--brand-primary);
  border-color: var(--brand-primary-border);
  box-shadow: 0 2px 8px rgba(0, 82, 255, 0.4);
}

/* Header pills on Bar Chart */
.chart-header-pills {
  display: inline-flex;
  align-items: center;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 2px;
  gap: 2px;
}

.chart-pill-btn {
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-pill-btn:hover {
  color: var(--text-primary);
}

.chart-pill-btn.active {
  color: #ffffff;
  background: var(--brand-primary);
  border-color: var(--brand-primary-border);
  box-shadow: 0 1px 6px rgba(0, 82, 255, 0.35);
}

/* Micro-animations for Bar Chart */
.chart-bar-col:hover .chart-bar-fill {
  transform: translateY(-4px) scaleX(1.05);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.75), 0 0 24px rgba(56, 189, 248, 0.4) !important;
  filter: brightness(1.2);
}

.chart-bar-col:hover .chart-bar-val {
  color: #38bdf8 !important;
  transform: translateY(-2px);
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.chart-bar-col.is-today:hover .chart-bar-fill {
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.9), 0 0 30px rgba(59, 130, 246, 0.6) !important;
}

.legend-card-luxury:hover {
  background: var(--bg-card) !important;
  border-color: var(--brand-primary-border) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   CARDS & KPI STATS GRID (VUÔNG GÓC, RÕ NÉT, TƯƠNG PHẢN CAO)
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  border-color: var(--brand-primary-border);
  box-shadow: var(--shadow-md);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper.indigo { background: var(--brand-primary-light); color: var(--brand-primary); border: 1px solid var(--brand-primary-border); }
.stat-icon-wrapper.emerald { background: var(--status-success-bg); color: var(--status-success); border: 1px solid var(--status-success-border); }
.stat-icon-wrapper.amber { background: var(--ecoin-gold-bg); color: var(--ecoin-gold); border: 1px solid var(--ecoin-gold-border); }
.stat-icon-wrapper.rose { background: var(--status-danger-bg); color: var(--status-danger); border: 1px solid var(--status-danger-border); }
.stat-icon-wrapper.cyan { background: var(--status-info-bg); color: var(--status-info); border: 1px solid var(--status-info-border); }
.stat-icon-wrapper.purple { background: var(--status-purple-bg); color: var(--status-purple); border: 1px solid var(--status-purple-border); }

.stat-value {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.stat-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-trend {
  display: flex;
  align-items: center;
  font-weight: 700;
}

.stat-trend.up { color: var(--status-success); }
.stat-trend.down { color: var(--status-danger); }
.stat-trend.neutral { color: var(--text-secondary); }

/* Accent Borders on Top */
.stat-card.accent-gold {
  border-top: 3px solid var(--ecoin-gold-num);
}

.stat-card.accent-primary {
  border-top: 3px solid var(--brand-primary);
}

/* ==========================================================================
   CHARTS & SPLIT LAYOUTS
   ========================================================================== */

.dashboard-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-container {
  width: 100%;
  height: 230px;
  position: relative;
}

/* ==========================================================================
   DATA TABLES & TOOLBARS (VUÔNG VẮN, RÕ NÉT, TƯƠNG PHẢN)
   ========================================================================== */

.table-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.table-toolbar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-card-subtle);
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-search {
  position: relative;
  min-width: 240px;
}

.table-search input {
  width: 100%;
  height: 34px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 0 10px 0 32px;
  font-size: 12.5px;
  color: var(--text-primary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.table-search input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-glow);
}

.table-search svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.select-filter {
  height: 34px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 0 24px 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 14px;
}

.select-filter:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}

.data-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.data-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:nth-child(odd) td {
  background-color: var(--bg-card);
}

.data-table tbody tr:nth-child(even) td {
  background-color: var(--bg-card-subtle);
}

.data-table tbody tr:hover td {
  background-color: var(--bg-card-hover) !important;
}

.data-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border-color);
}

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  border: 1px solid transparent;
}

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

.badge-expired,
.badge-die {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
  border-color: var(--status-danger-border);
}

.row-die {
  background-color: rgba(239, 68, 68, 0.04) !important;
}

.row-die:hover {
  background-color: rgba(239, 68, 68, 0.08) !important;
}

.badge-locked {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border-color: var(--status-warning-border);
}

.badge-topup {
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border-color: var(--status-success-border);
}

.badge-buy {
  background-color: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: var(--brand-primary-border);
}

.badge-adjust {
  background-color: var(--status-purple-bg);
  color: var(--status-purple);
  border-color: var(--status-purple-border);
}

.badge-refund {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border-color: var(--status-warning-border);
}

.badge-warranty {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
  border-color: var(--status-danger-border);
}

.badge-ecoin {
  background-color: var(--ecoin-gold-bg);
  color: var(--ecoin-gold);
  border-color: var(--ecoin-gold-border);
  font-weight: 800;
  font-family: monospace;
  font-size: 12px;
}

.badge-count {
  background-color: var(--bg-card-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 11.5px;
}

.badge-account-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-strong);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-family: monospace;
  font-size: 11.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.badge-account-copy:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

.badge-key-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 82, 255, 0.08);
  border: 1px solid rgba(0, 82, 255, 0.28);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-family: monospace;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--brand-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.badge-key-copy:hover {
  background: rgba(0, 82, 255, 0.18);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.badge-date-ok {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
  white-space: nowrap;
}

.badge-date-warn {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid var(--status-warning-border);
  white-space: nowrap;
}

.badge-date-expired {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid var(--status-danger-border);
  white-space: nowrap;
}

.badge-renew {
  background-color: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: var(--brand-primary-border);
}

/* Warranty Countdown Cell & 3-Color Progress Bar */
.warranty-cell {
  min-width: 145px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.warranty-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
}

.warranty-countdown-text {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-primary);
}

.warranty-total-badge {
  font-size: 9.5px;
  font-weight: 800;
  font-family: monospace;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-strong);
  padding: 0 4px;
  border-radius: 2px;
  color: var(--text-muted);
}

.warranty-progress-track {
  width: 100%;
  height: 5px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.warranty-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.warranty-progress-fill.bar-green {
  background-color: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.45);
}

.warranty-progress-fill.bar-yellow {
  background-color: #F59E0B;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.45);
}

.warranty-progress-fill.bar-red {
  background-color: #EF4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.45);
}

.warranty-progress-fill.bar-expired {
  background-color: #6B7280;
  opacity: 0.4;
}

/* Action Buttons inside Table */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.btn-table {
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.btn-table:hover {
  background-color: var(--brand-primary-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-table.reset-date {
  color: #0284C7;
  border-color: rgba(2, 132, 199, 0.3);
  background-color: rgba(2, 132, 199, 0.08);
}
.btn-table.reset-date:hover {
  background-color: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
}

.btn-table.topup {
  color: var(--status-success);
  border-color: var(--status-success-border);
  background-color: var(--status-success-bg);
}
.btn-table.topup:hover {
  border-color: var(--status-success);
}

.btn-table.adjust {
  color: var(--ecoin-gold);
  border-color: var(--ecoin-gold-border);
  background-color: var(--ecoin-gold-bg);
}
.btn-table.adjust:hover {
  border-color: var(--ecoin-gold);
}

.btn-table.log {
  color: var(--brand-primary);
  border-color: var(--brand-primary-border);
  background-color: var(--brand-primary-light);
}
.btn-table.log:hover {
  border-color: var(--brand-primary);
}

.btn-table.pay-paid {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 1px solid #10B981;
  background-color: rgba(16, 185, 129, 0.12);
  color: #10B981;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-table.pay-paid:hover {
  background-color: #10B981;
  color: #FFFFFF;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.btn-table.pay-unpaid {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 1px solid #EF4444;
  background-color: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.35);
}
.btn-table.pay-unpaid:hover {
  background-color: #EF4444;
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

/* Badge Nhóm Khách Hàng (Neon Đa Sắc theo từng nhóm) */
.badge-group-neon {
  font-size: 10px;
  font-weight: 800;
  font-family: monospace;
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  transition: all var(--transition-fast);
}

/* 1. Admin: Màu Đỏ Neon */
.badge-group-neon.group-admin {
  color: #FF5252;
  background: rgba(255, 82, 82, 0.16);
  border: 1px solid rgba(255, 82, 82, 0.5);
  text-shadow: 0 0 6px rgba(255, 82, 82, 0.85);
}
.badge-group-neon.group-admin:hover {
  box-shadow: 0 0 10px rgba(255, 82, 82, 0.6);
  border-color: #FF5252;
}

/* 2. VIP: Màu Vàng Neon */
.badge-group-neon.group-vip {
  color: #FDE047;
  background: rgba(234, 179, 8, 0.16);
  border: 1px solid rgba(253, 224, 71, 0.5);
  text-shadow: 0 0 6px rgba(253, 224, 71, 0.85);
}
.badge-group-neon.group-vip:hover {
  box-shadow: 0 0 10px rgba(253, 224, 71, 0.6);
  border-color: #FDE047;
}

/* 3. CTV: Màu Cam Neon */
.badge-group-neon.group-ctv {
  color: #FB923C;
  background: rgba(249, 115, 22, 0.16);
  border: 1px solid rgba(251, 146, 60, 0.5);
  text-shadow: 0 0 6px rgba(251, 146, 60, 0.85);
}
.badge-group-neon.group-ctv:hover {
  box-shadow: 0 0 10px rgba(251, 146, 60, 0.6);
  border-color: #FB923C;
}

/* 4. User: Màu Trắng Neon */
.badge-group-neon.group-user {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.45);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.85);
}
.badge-group-neon.group-user:hover {
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  border-color: #FFFFFF;
}

/* Mặc định / Nhóm khác: Màu Tím Neon */
.badge-group-neon.group-default,
.badge-group-neon:not(.group-admin):not(.group-vip):not(.group-ctv):not(.group-user) {
  color: #D8B4FE;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.45);
  text-shadow: 0 0 6px rgba(192, 132, 252, 0.7);
}
.badge-group-neon.group-default:hover,
.badge-group-neon:not(.group-admin):not(.group-vip):not(.group-ctv):not(.group-user):hover {
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.55);
  border-color: #C084FC;
}

/* Badge Đã Thanh Toán trong Lịch Sử Giao Dịch */
.badge.badge-payment {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 700;
  font-size: 11px;
}

/* Pagination */
.table-pagination {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  background-color: var(--bg-card-subtle);
}

/* ==========================================================================
   BUTTONS & FORM ELEMENTS
   ========================================================================== */

.btn {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: -0.1px;
}

/* Primary Button: Solid Royal Blue */
.btn-primary {
  background-color: var(--brand-primary);
  color: #FFFFFF;
  border-color: var(--brand-primary);
  box-shadow: 0 1px 2px rgba(0, 82, 255, 0.2);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

.btn-primary:active {
  background-color: var(--brand-primary-active);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

.btn-secondary.active {
  background-color: var(--brand-primary-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-success {
  background-color: #15803D;
  color: #FFFFFF;
  border-color: #15803D;
}
.btn-success:hover {
  background-color: #166534;
}

.btn-warning {
  background-color: #D97706;
  color: #FFFFFF;
  border-color: #D97706;
}
.btn-warning:hover {
  background-color: #B45309;
}

.btn-danger {
  background-color: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-label .required {
  color: var(--status-danger);
}

.form-control {
  width: 100%;
  height: 36px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-glow);
}

textarea.form-control {
  height: auto;
  min-height: 70px;
  padding: 8px 10px;
  resize: vertical;
}

/* Quick Preset Pills */
.preset-pills {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.preset-pill {
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-pill:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

.preset-pill.active {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #FFFFFF;
}

/* ==========================================================================
   MODALS (HEADER XANH ĐẬM / TRẮNG VUÔNG VẮN SANG TRỌNG)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  padding: 16px;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.98);
  transition: transform var(--transition-fast);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-card.modal-lg {
  max-width: min(1120px, 95vw);
}

.modal-card.modal-xl {
  max-width: min(1280px, 96vw);
}

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

.modal-header {
  padding: 12px 18px;
  background-color: var(--brand-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title svg {
  stroke: #FFFFFF !important;
}

.modal-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: #FFFFFF;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  background-color: var(--bg-card);
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background-color: var(--bg-card-subtle);
}

/* Balance Diff Preview Box */
.balance-preview-box {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.balance-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.balance-item-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.balance-item-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: monospace;
}

.balance-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(120%);
  transition: transform 0.2s ease-out;
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.success { border-left: 4px solid var(--status-success); }
.toast.success .toast-icon { color: var(--status-success); }

.toast.error { border-left: 4px solid var(--status-danger); }
.toast.error .toast-icon { color: var(--status-danger); }

.toast.warning { border-left: 4px solid var(--status-warning); }
.toast.warning .toast-icon { color: var(--status-warning); }

.toast.info { border-left: 4px solid var(--brand-primary); }
.toast.info .toast-icon { color: var(--brand-primary); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.toast-msg {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   EMPTY / LOADING STATES
   ========================================================================== */

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
}

td.empty-state {
  display: table-cell !important;
  text-align: center !important;
  vertical-align: middle !important;
  padding: 32px 16px !important;
  white-space: nowrap !important;
  width: 100% !important;
}

div.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.empty-icon {
  width: 40px;
  height: 40px;
  color: var(--border-strong);
}

.empty-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}

.empty-desc {
  font-size: 12px;
  max-width: 320px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 16px auto;
}

.spinner-inline {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* Row Action Visual States (Dấu hiệu nhận biết đang xóa / cập nhật) */
tr.row-deleting td {
  background: rgba(239, 68, 68, 0.16) !important;
  color: var(--text-muted) !important;
  transition: all 0.25s ease;
  pointer-events: none;
}

tr.row-deleting td:nth-child(3) {
  text-decoration: line-through;
  opacity: 0.55;
}

tr.row-updating td {
  background: rgba(59, 130, 246, 0.12) !important;
  transition: all 0.25s ease;
  pointer-events: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN (TỰ ĐỘNG THU GỌN KHI MÀN HÌNH NHỎ HƠN 3CM PADDING)
   ========================================================================== */

@media (max-width: 1200px) {
  .top-header, .content-container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 1024px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 250px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .top-header, .content-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

/* ==========================================================================
   ADVANCED PAGINATION & BULK ACTION STYLES (20 DÒNG/TRANG, NEXT/PREV, JUMP)
   ========================================================================== */

.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}

.page-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #FFFFFF !important;
  font-weight: 800;
}

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

.page-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-weight: 800;
  user-select: none;
}

.page-jump-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 8px;
}

.page-jump-input {
  width: 52px;
  height: 30px;
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.page-jump-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(0, 82, 255, 0.15);
}

/* Bulk Action Bar (Thanh thao tác hàng loạt) */
.bulk-actions-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--brand-primary-light);
  border: 1px solid var(--brand-primary);
  padding: 8px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-xs);
  animation: fadeIn 0.2s ease;
}

.bulk-actions-bar.show {
  display: flex;
}

.bulk-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-primary);
}

.bulk-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Checkbox styling (Giảm kích thước 20%) */
.custom-checkbox {
  width: 13px;
  height: 13px;
  cursor: pointer;
  accent-color: var(--brand-primary);
  vertical-align: middle;
}

tr.row-selected {
  background-color: rgba(0, 82, 255, 0.08) !important;
}

tr.row-deleting {
  background-color: rgba(239, 68, 68, 0.12) !important;
  opacity: 0.5;
  pointer-events: none;
}

/* Table action buttons */
.btn-table.delete {
  color: var(--status-danger);
  border-color: var(--status-danger-border);
  background: var(--status-danger-bg);
}

.btn-table.delete:hover {
  background: var(--status-danger);
  color: #FFFFFF;
}

.btn-table.toggle-status {
  color: var(--brand-primary);
  border-color: var(--border-strong);
}

.btn-table.toggle-status:hover {
  background: var(--brand-primary);
  color: #FFFFFF;
}

/* Badge Account Copy (1-Click Copy Mail|Pass) */
.badge-account-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-strong);
  color: var(--brand-primary);
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-account-copy:hover {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary-hover);
}

.badge-account-copy svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.badge-account-copy:hover svg {
  color: var(--brand-primary);
}

/* Wide Spacious Layout For Customer Event Log Modal (+25% Kích Thước & Chống Chồng Đè Cột) */
#modal-customer-log .modal-card {
  max-width: min(1480px, 98vw);
  width: 95vw;
}

#modal-customer-log .modal-body {
  padding: 18px 24px;
}

#modal-customer-log .table-responsive {
  max-height: 520px;
  overflow-y: auto;
  overflow-x: auto;
}

#modal-customer-log .data-table {
  min-width: 1220px;
  width: 100%;
}

#modal-customer-log .data-table th,
#modal-customer-log .data-table td {
  padding: 8px 12px;
  font-size: 12px;
  white-space: nowrap;
  vertical-align: middle;
}

#modal-customer-log .data-table th:nth-child(1),
#modal-customer-log .data-table td:nth-child(1) {
  width: 45px;
  text-align: center;
}

#modal-customer-log .data-table th:nth-child(2),
#modal-customer-log .data-table td:nth-child(2) {
  min-width: 155px;
  font-family: monospace;
}

#modal-customer-log .data-table th:nth-child(3),
#modal-customer-log .data-table td:nth-child(3) {
  min-width: 145px;
  font-family: monospace;
}

#modal-customer-log .data-table th:nth-child(4),
#modal-customer-log .data-table td:nth-child(4) {
  min-width: 95px;
  text-align: center;
}

#modal-customer-log .data-table th:nth-child(5),
#modal-customer-log .data-table td:nth-child(5) {
  min-width: 85px;
  text-align: center;
}

#modal-customer-log .data-table th:nth-child(6),
#modal-customer-log .data-table td:nth-child(6) {
  min-width: 70px;
  text-align: right;
}

#modal-customer-log .data-table th:nth-child(7),
#modal-customer-log .data-table td:nth-child(7) {
  min-width: 75px;
  text-align: right;
}

#modal-customer-log .data-table th:nth-child(8),
#modal-customer-log .data-table td:nth-child(8) {
  min-width: 270px;
  max-width: 380px;
  white-space: nowrap;
}

#modal-customer-log .data-table th:nth-child(9),
#modal-customer-log .data-table td:nth-child(9) {
  min-width: 200px;
  white-space: normal;
  word-break: break-word;
}

#modal-customer-log .data-table th:nth-child(10),
#modal-customer-log .data-table td:nth-child(10) {
  width: 80px;
  min-width: 80px;
  text-align: center;
  padding: 4px 6px;
  vertical-align: middle;
}

.btn-table-refund {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 20px;
  line-height: 1;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 2px;
  border: 1px solid rgba(234, 88, 12, 0.45);
  background: rgba(234, 88, 12, 0.12);
  color: #f97316;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-table-refund:hover {
  background: #ea580c;
  color: #ffffff;
  border-color: #ea580c;
}


/* Toggle Switch */
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 13px;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  width: 38px;
  height: 20px;
  background-color: var(--border-strong);
  border-radius: 20px;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #FFFFFF;
  border-radius: 50%;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch-input:checked + .switch-slider {
  background-color: var(--brand-primary);
}

.switch-input:checked + .switch-slider::before {
  transform: translateX(18px);
}

/* Variable Tag Pills */
.variable-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-pill {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--brand-primary);
  font-size: 11px;
  font-family: monospace;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag-pill:hover {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary);
}

/* Telegram Chat Simulation Widget */
.telegram-preview-widget {
  background: #0E1621;
  border: 1px solid #17212B;
  border-radius: var(--radius-xs);
  padding: 16px;
  color: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin-top: 10px;
  box-shadow: var(--shadow-md);
}

.tg-bot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1E2C3A;
}

.tg-bot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2AABEE, #229ED9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.tg-bot-name {
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
}

.tg-bot-status {
  font-size: 11px;
  color: #708499;
}

.tg-date-divider {
  text-align: center;
  margin: 10px 0;
}

.tg-date-badge {
  background: rgba(0, 0, 0, 0.3);
  color: #929FA8;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
}

.tg-msg-bubble {
  background: #182533;
  border-radius: 8px 8px 8px 0px;
  padding: 10px 14px;
  max-width: 90%;
  position: relative;
  font-size: 13px;
  line-height: 1.5;
  color: #F5F5F5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tg-msg-time {
  text-align: right;
  font-size: 10px;
  color: #708499;
  margin-top: 4px;
  user-select: none;
}

/* ==========================================================================
   MOBILE RESPONSIVE & TOUCH-FRIENDLY OPTIMIZATIONS
   ========================================================================== */

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 6px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--bg-card-subtle);
  color: var(--brand-primary);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-brand-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sidebar Overlay Backdrop for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 140;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0 !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    max-width: 100% !important;
  }

  .top-header {
    margin-left: -14px !important;
    margin-right: -14px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    display: none; /* Sử dụng Mobile Header */
  }

  .content-body {
    padding-top: 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .toolbar-left, .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .table-search {
    width: 100%;
    min-width: unset;
  }

  .select-filter {
    flex: 1;
    min-width: 130px;
  }

  .modal-card {
    max-width: 96vw !important;
    max-height: 94vh !important;
    margin: 8px;
  }

  .modal-card.modal-lg,
  .modal-card.modal-xl,
  #modal-customer-log .modal-card {
    max-width: 96vw !important;
  }

  .btn-table {
    padding: 5px 8px;
    font-size: 11.5px;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .stat-card {
    padding: 10px 12px;
  }

  .stat-value {
    font-size: 16px;
  }

  .page-title {
    font-size: 16px;
  }

  .balance-preview-box {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .balance-item {
    text-align: center !important;
  }

  .balance-arrow {
    transform: rotate(90deg);
    margin: 2px 0;
  }

  .modal-footer {
    flex-direction: column;
    gap: 8px;
  }

  .modal-footer button {
    width: 100%;
  }
}


/* ==========================================================================
   MOBILE & TABLET RESPONSIVE ENHANCEMENTS
   ========================================================================== */
.card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .view-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .search-box {
    max-width: 100% !important;
    width: 100%;
  }

  .modal-container {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto;
  }

  .action-buttons {
    flex-wrap: wrap;
  }

  .data-table th, .data-table td {
    padding: 8px 10px;
    font-size: 11.5px;
  }
}

.btn-table.edit {
  color: #3B82F6;
  border-color: rgba(59, 130, 246, 0.3);
  background-color: rgba(59, 130, 246, 0.08);
}
.btn-table.edit:hover {
  background-color: #3B82F6;
  color: #FFFFFF;
  border-color: #3B82F6;
}

/* ==========================================================================
   ADMIN SECURITY GATE (MÀN HÌNH KHÓA BẢO MẬT ADMIN & CHỐNG XEM TRỘM)
   ========================================================================== */
.security-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(10, 14, 23, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
}

.security-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-md);
  max-width: 420px;
  width: 100%;
  padding: 32px 28px;
  text-align: center;
  position: relative;
}

.security-gate-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.1);
  border: 2px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}

.security-gate-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.security-gate-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.security-pin-input {
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
  font-family: monospace;
  height: 48px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: #38bdf8;
  font-weight: 800;
}

.security-gate-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

/* Password Masking Styles */
.pass-masked-dots {
  letter-spacing: 2px;
  color: #38bdf8;
  font-weight: 800;
  font-size: 12.5px;
  user-select: none;
}


/* ==========================================================================
   ADVANCED ADAPTIVE & MOBILE RESPONSIVE ENGINE (ZERO-BREAK LAYOUT)
   ========================================================================== */

/* 1. Note input field trong Kho Tài Khoản */
.input-inv-note {
  background: var(--bg-card-subtle, #0f172a);
  border: 1px solid var(--border-color, #334155);
  color: var(--text-primary, #f8fafc);
  font-size: 11.5px;
  border-radius: var(--radius-xs, 4px);
  padding: 5px 8px;
  width: 100%;
  min-width: 110px;
  max-width: 180px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}
.input-inv-note:focus {
  outline: none;
  border-color: var(--brand-primary, #0ea5e9);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
  background: #1e293b;
}
.input-inv-note::placeholder {
  color: var(--text-muted, #64748b);
  font-size: 11px;
}

/* 2. Chống vỡ layout Top Header khi thu nhỏ cửa sổ trình duyệt (1024px - 1380px) */
.top-header {
  height: auto;
  min-height: var(--header-height, 60px);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.header-left {
  flex: 1 1 220px;
  min-width: 200px;
}

.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 1380px) {
  .top-header {
    padding: 8px 18px;
  }
  .quick-search {
    width: 180px !important;
  }
  .quick-search input {
    font-size: 11.5px !important;
  }
  .page-title {
    font-size: 17px !important;
  }
  .page-breadcrumb {
    font-size: 11px !important;
  }
}

@media (max-width: 1200px) {
  .top-header {
    padding: 8px 14px;
  }
  .page-breadcrumb {
    display: none !important; /* Ẩn breadcrumb để title không bị xuống dòng vụn */
  }
  .quick-search {
    width: 150px !important;
  }
  #btn-header-sync-sheet span,
  #btn-header-debug-log span:not(#debug-error-count) {
    display: none; /* Chỉ hiển thị icon khi màn hình vừa phải */
  }
  #btn-header-sync-sheet,
  #btn-header-debug-log {
    padding: 6px 10px;
  }
}

/* 3. Tối ưu bảng biểu - Không bao giờ bị ép méo cột trên màn hình hẹp */
.table-container, .table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-xs, 4px);
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.table-container table,
.table-responsive table {
  width: 100%;
  min-width: 980px; /* Bảo đảm các cột có đủ không gian hiển thị chuẩn xác */
  border-collapse: collapse;
}

/* 4. Giao diện Mobile & Tablet (< 900px) - Bố cục Thao Tác Nhanh */
@media (max-width: 900px) {
  .mobile-header {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 52px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px;
    align-items: center;
    justify-content: space-between;
  }

  .top-header {
    display: none !important; /* Sử dụng Mobile Header */
  }

  .main-wrapper {
    margin-left: 0 !important;
    padding: 10px !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  .content-container {
    padding: 0 !important;
  }

  /* Grid thống kê 2 cột nhỏ gọn dễ xem */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .stat-card {
    padding: 10px 12px !important;
  }

  .stat-card .stat-value {
    font-size: 16px !important;
  }

  .stat-card .stat-label {
    font-size: 10px !important;
  }

  /* Toolbar bộ lọc trên mobile: xếp dọc, full width */
  .table-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .toolbar-left, .toolbar-right {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .table-search, .select-filter {
    width: 100% !important;
    min-width: unset !important;
  }

  /* Phân trang mobile: nút to, bấm nhạy */
  .table-pagination, .pagination-container {
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 4px !important;
  }

  .pagination-info {
    font-size: 11px !important;
    text-align: center;
  }

  .pagination-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .page-btn {
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
  }

  /* Nút thao tác trên dòng: dễ chạm */
  .action-buttons {
    display: flex;
    gap: 4px;
  }

  .btn-table {
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-height: 28px;
  }
}

/* 5. Mobile màn hình nhỏ (< 480px) */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  .stat-card {
    padding: 8px 10px !important;
  }

  .stat-card .stat-value {
    font-size: 15px !important;
  }

  .page-title {
    font-size: 15px !important;
  }
}

/* =========================================================================
   NÂNG CẤP V2: DIE NEON, UI POPUP CONFIRM, GROUP MANAGER & BACKUP VIEW
   ========================================================================= */

/* 1. Trạng Thái Die Đỏ Neon */
.badge-die-neon {
  background: rgba(255, 30, 60, 0.16) !important;
  color: #ff3366 !important;
  border: 1px solid #ff3366 !important;
  box-shadow: 0 0 10px rgba(255, 51, 102, 0.6), inset 0 0 6px rgba(255, 51, 102, 0.25) !important;
  font-weight: 800 !important;
  text-shadow: 0 0 8px rgba(255, 51, 102, 0.85);
  letter-spacing: 0.5px;
  animation: pulse-die-neon 2s infinite ease-in-out;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@keyframes pulse-die-neon {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 51, 102, 0.5), inset 0 0 4px rgba(255, 51, 102, 0.25);
  }
  50% {
    box-shadow: 0 0 18px rgba(255, 51, 102, 0.95), inset 0 0 8px rgba(255, 51, 102, 0.45);
  }
}

/* Thẻ Thống Kê Lỗi / Die */
.stat-card.stat-die {
  border-left: 3px solid #ff3366;
}
.stat-card.stat-die .stat-value {
  color: #ff3366;
  text-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
}

/* 2. Custom UI Popup Xác Nhận (Dialog) */
#modal-confirm-dialog .modal-card {
  max-width: 460px;
  animation: modal-pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

@keyframes modal-pop {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

#confirm-dialog-message {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
}

/* 3. Quản Lý Nhóm Modal Styles */
.group-color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-color-presets {
  display: flex;
  gap: 6px;
  align-items: center;
}
.group-color-preset-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid rgba(255, 255, 255, 0.3);
}
.group-color-preset-dot:hover {
  transform: scale(1.2);
  box-shadow: 0 0 8px currentColor;
}

/* 4. Backup & Phục Hồi Dữ Liệu View */
.backup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.backup-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.backup-card:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.backup-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.backup-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.backup-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.backup-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.backup-file-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-card-subtle);
  transition: border-color 0.2s, background-color 0.2s;
  margin-bottom: 16px;
}
.backup-file-dropzone:hover {
  border-color: var(--brand-primary);
  background: rgba(0, 82, 255, 0.04);
}
