/* ==========================================================
   ระบบชนหวยชุด (Lottery Matching System) - Modern Premium Dark UI
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300&family=JetBrains+Mono:wght@500;700;800&display=swap');

:root,
html[data-theme="royal-gold"] {
  --bg-main: #07090e;
  --bg-card: rgba(17, 22, 37, 0.78);
  --bg-card-hover: rgba(26, 34, 56, 0.88);
  --bg-glass: rgba(14, 19, 32, 0.75);
  --border-glass: rgba(245, 158, 11, 0.14);
  --border-glow: rgba(245, 158, 11, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.35);
  --accent-gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);

  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);
  --accent-indigo: #6366f1;
  --accent-indigo-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;

  --body-gradient-1: rgba(245, 158, 11, 0.12);
  --body-gradient-2: rgba(99, 102, 241, 0.1);
  --body-gradient-3: rgba(16, 185, 129, 0.08);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.25);
  --shadow-gold: 0 0 25px rgba(245, 158, 11, 0.3);

  --font-thai: 'Prompt', -apple-system, sans-serif;
  --font-en: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* 2. Cyber Emerald & Neon Mint */
html[data-theme="cyber-emerald"] {
  --bg-main: #040e0a;
  --bg-card: rgba(10, 30, 22, 0.82);
  --bg-card-hover: rgba(16, 48, 35, 0.9);
  --bg-glass: rgba(7, 22, 16, 0.78);
  --border-glass: rgba(16, 185, 129, 0.18);
  --border-glow: rgba(16, 185, 129, 0.45);

  --text-primary: #f0fdf4;
  --text-secondary: #a7f3d0;
  --text-muted: #6ee7b7;

  --accent-gold: #34d399;
  --accent-gold-glow: rgba(52, 211, 153, 0.4);
  --accent-gold-gradient: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);

  --accent-emerald: #00f5a0;
  --accent-emerald-glow: rgba(0, 245, 160, 0.35);
  --accent-indigo: #10b981;
  --accent-indigo-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --accent-rose: #f43f5e;
  --accent-cyan: #34d399;

  --body-gradient-1: rgba(16, 185, 129, 0.16);
  --body-gradient-2: rgba(52, 211, 153, 0.12);
  --body-gradient-3: rgba(6, 182, 212, 0.08);

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.3);
  --shadow-gold: 0 0 25px rgba(52, 211, 153, 0.3);
}

/* 3. Deep Sapphire & Ice Cyan */
html[data-theme="deep-sapphire"] {
  --bg-main: #060c18;
  --bg-card: rgba(14, 24, 46, 0.82);
  --bg-card-hover: rgba(22, 38, 72, 0.9);
  --bg-glass: rgba(11, 19, 36, 0.78);
  --border-glass: rgba(56, 189, 248, 0.16);
  --border-glow: rgba(6, 182, 212, 0.45);

  --text-primary: #f0f9ff;
  --text-secondary: #bae6fd;
  --text-muted: #7dd3fc;

  --accent-gold: #38bdf8;
  --accent-gold-glow: rgba(56, 189, 248, 0.4);
  --accent-gold-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 50%, #0369a1 100%);

  --accent-emerald: #06b6d4;
  --accent-emerald-glow: rgba(6, 182, 212, 0.35);
  --accent-indigo: #2563eb;
  --accent-indigo-gradient: linear-gradient(135deg, #38bdf8 0%, #1d4ed8 100%);
  --accent-rose: #f43f5e;
  --accent-cyan: #38bdf8;

  --body-gradient-1: rgba(56, 189, 248, 0.16);
  --body-gradient-2: rgba(37, 99, 235, 0.14);
  --body-gradient-3: rgba(14, 165, 233, 0.08);

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.3);
  --shadow-gold: 0 0 25px rgba(56, 189, 248, 0.3);
}

/* 4. Imperial Ruby & Amber */
html[data-theme="imperial-ruby"] {
  --bg-main: #0f060a;
  --bg-card: rgba(30, 14, 22, 0.84);
  --bg-card-hover: rgba(46, 20, 34, 0.92);
  --bg-glass: rgba(22, 10, 16, 0.8);
  --border-glass: rgba(244, 63, 94, 0.18);
  --border-glow: rgba(244, 63, 94, 0.45);

  --text-primary: #fff1f2;
  --text-secondary: #fecdd3;
  --text-muted: #fda4af;

  --accent-gold: #fb7185;
  --accent-gold-glow: rgba(244, 63, 94, 0.4);
  --accent-gold-gradient: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #be123c 100%);

  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.35);
  --accent-indigo: #e11d48;
  --accent-indigo-gradient: linear-gradient(135deg, #fb7185 0%, #be123c 100%);
  --accent-rose: #f43f5e;
  --accent-cyan: #fbbf24;

  --body-gradient-1: rgba(244, 63, 94, 0.16);
  --body-gradient-2: rgba(251, 191, 36, 0.12);
  --body-gradient-3: rgba(225, 29, 72, 0.08);

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 25px rgba(244, 63, 94, 0.3);
  --shadow-gold: 0 0 25px rgba(244, 63, 94, 0.3);
}

/* 5. Luxury Clean Light */
html[data-theme="luxury-light"] {
  --bg-main: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --border-glass: rgba(148, 163, 184, 0.3);
  --border-glow: rgba(37, 99, 235, 0.35);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --accent-gold: #d97706;
  --accent-gold-glow: rgba(217, 119, 6, 0.25);
  --accent-gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

  --accent-emerald: #059669;
  --accent-emerald-glow: rgba(5, 150, 105, 0.25);
  --accent-indigo: #2563eb;
  --accent-indigo-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --accent-rose: #e11d48;
  --accent-cyan: #0284c7;

  --body-gradient-1: rgba(217, 119, 6, 0.08);
  --body-gradient-2: rgba(37, 99, 235, 0.08);
  --body-gradient-3: rgba(16, 185, 129, 0.06);

  --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
  --shadow-gold: 0 0 20px rgba(217, 119, 6, 0.2);
}

html[data-theme="luxury-light"] .app-header {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

html[data-theme="luxury-light"] .glass-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

html[data-theme="luxury-light"] .custom-switcher-btn,
html[data-theme="luxury-light"] .custom-switcher-menu,
html[data-theme="luxury-light"] .form-input,
html[data-theme="luxury-light"] .form-control {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="luxury-light"] .period-badge,
html[data-theme="luxury-light"] .system-status-pill {
  background: rgba(241, 245, 249, 0.95);
  color: #0f172a;
  border-color: #cbd5e1;
}

html[data-theme="luxury-light"] .data-table thead tr {
  background: #f8fafc !important;
  color: #1e293b !important;
}

html[data-theme="luxury-light"] .data-table tbody tr:hover {
  background: rgba(241, 245, 249, 0.8) !important;
}

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

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, var(--body-gradient-1, rgba(99, 102, 241, 0.12)) 0px, transparent 50%),
    radial-gradient(at 100% 0%, var(--body-gradient-2, rgba(245, 158, 11, 0.1)) 0px, transparent 50%),
    radial-gradient(at 50% 100%, var(--body-gradient-3, rgba(16, 185, 129, 0.08)) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-thai);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.4s ease, color 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #252f44;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4865;
}

/* -------------------------------------------------------------
   HEADER & NAVBAR
   ------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.85rem 1.75rem;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: nowrap;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-gold-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-gold);
}

.brand-title {
  font-family: var(--font-thai);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-en);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* System Status Pill */
.system-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  transition: all 0.3s ease;
}

.system-status-pill.status-closed {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* Status & Period Wrapper */
.header-status-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Period Display in Header */
.period-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 0.32rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* User Profile & Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.8rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 9999px;
  font-size: 0.84rem;
  color: #c7d2fe;
  flex-shrink: 0;
  white-space: nowrap;
}

.role-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: var(--accent-indigo);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
}

.role-tag.admin {
  background: var(--accent-gold);
  color: #000;
}

/* -------------------------------------------------------------
   NAVIGATION TABS (Wrap-friendly Multi-row Layout)
   ------------------------------------------------------------- */
.nav-tabs-wrapper {
  max-width: 1440px;
  margin: 1.25rem auto 0;
  padding: 0.6rem 1.25rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--border-glass);
  overflow: visible;
}

.nav-tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 10px);
  color: var(--text-secondary);
  font-family: var(--font-thai);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  white-space: nowrap !important;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: 0.2px;
  backdrop-filter: blur(8px);
}

.nav-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateY(-1px);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.14) 100%);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.18), inset 0 0 10px rgba(245, 158, 11, 0.05);
}

.nav-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

/* ปุ่ม Super Admin โดดเด่นเป็นพิเศษ */
.nav-tab-btn.superadmin-only {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.28);
  color: #d8b4fe;
}

.nav-tab-btn.superadmin-only:hover {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.45);
  color: #fff;
}

.nav-tab-btn.superadmin-only.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28) 0%, rgba(245, 158, 11, 0.16) 100%);
  border-color: rgba(168, 85, 247, 0.55);
  color: #fff;
  box-shadow: 0 2px 12px rgba(168, 85, 247, 0.25), inset 0 0 10px rgba(168, 85, 247, 0.1);
}

.nav-tab-btn.superadmin-only.active::after {
  background: linear-gradient(90deg, #a855f7, #f59e0b);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.8);
}

.badge-counter {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-weight: 700;
}

/* -------------------------------------------------------------
   MAIN CONTAINER & SECTIONS
   ------------------------------------------------------------- */
.app-main {
  max-width: 1440px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.75rem;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.tab-pane.active {
  display: block;
}

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

/* -------------------------------------------------------------
   LOCKED / CLOSED SYSTEM BANNER
   ------------------------------------------------------------- */
.lock-banner {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.15) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.lock-banner::before {
  content: '🔒';
  font-size: 8rem;
  position: absolute;
  top: -20px;
  right: -20px;
  opacity: 0.05;
  pointer-events: none;
}

.lock-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fda4af;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.lock-subtitle {
  color: #cbd5e1;
  font-size: 0.95rem;
  max-width: 650px;
  margin: 0 auto 1.5rem;
}

.countdown-box {
  display: inline-flex;
  gap: 1.25rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.time-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-num {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.time-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* -------------------------------------------------------------
   SCANNER SECTION (หน้าร้านค้าสแกนสลาก)
   ------------------------------------------------------------- */
.scanner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
}

@media (max-width: 960px) {
  .scanner-grid {
    grid-template-columns: 1fr;
  }
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* แท็บเลือกโหมดสแกนสลาก VS สแกนเล่ม */
.scan-mode-tabs-container {
  display: flex;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-lg, 12px);
  padding: 5px;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.scan-mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md, 8px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.scan-mode-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.scan-mode-tab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.28) 100%);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fbbf24;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18);
}

.scan-mode-tab.active .mode-icon {
  transform: scale(1.18);
}

.scan-mode-badge {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-weight: 700;
  margin-left: 2px;
}

.scan-viewport {
  position: relative;
  background: rgba(0, 0, 0, 0.55);
  border: 2px dashed rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  overflow: hidden;
  transition: all 0.3s ease;
}

.scan-viewport.focused {
  border-color: var(--accent-gold);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.25);
  background: rgba(0, 0, 0, 0.65);
}

.scan-viewport.success-pulse {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.4);
}

.scan-viewport.dup-pulse {
  border-color: #ef4444 !important;
  box-shadow: 0 0 45px rgba(239, 68, 68, 0.7), inset 0 0 25px rgba(239, 68, 68, 0.25) !important;
  animation: scanErrorShake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes scanErrorShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* Laser animation */
.scan-laser {
  position: absolute;
  top: 0;
  left: 5%;
  width: 90%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #fbbf24, #f59e0b, transparent);
  box-shadow: 0 0 12px #f59e0b;
  animation: laserSweep 2.2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes laserSweep {
  0% { top: 5%; opacity: 0.3; }
  50% { top: 92%; opacity: 1; }
  100% { top: 5%; opacity: 0.3; }
}

.scan-input-primary {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-thai);
  font-size: 1.15rem;
  font-weight: 400;
  text-align: center;
  letter-spacing: normal;
  outline: none;
  caret-color: var(--accent-gold);
  line-height: 1.2;
}

/* ข้อความตัวอย่าง (Placeholder) ด้านหลัง คงขนาดปกติ คมชัด ไม่ขยายใหญ่ */
.scan-input-primary::placeholder {
  color: rgba(255, 255, 255, 0.32);
  font-size: 1.05rem;
  letter-spacing: normal;
  font-family: var(--font-thai);
  font-weight: 400;
  text-shadow: none;
}

/* เมื่อพิมพ์หรือยิงตัวเลขเข้ามา: ขยายเฉพาะตัวเลขให้ใหญ่ หนา เด่นชัดเจน */
.scan-input-primary:not(:placeholder-shown),
.scan-input-primary.has-value {
  font-family: var(--font-mono) !important;
  font-size: clamp(2.8rem, 5.2vw, 4.2rem) !important;
  font-weight: 900 !important;
  letter-spacing: 0.22em !important;
  color: #ffffff !important;
  text-shadow: 0 0 22px rgba(245, 158, 11, 0.45), 0 2px 6px rgba(0, 0, 0, 0.8) !important;
}

.scan-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* Simulation / Demo Action Toolbar */
.demo-toolbar {
  margin-top: 1.25rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.demo-toolbar-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.demo-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-demo-chip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  color: #e2e8f0;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-thai);
  transition: all 0.2s;
}

.btn-demo-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* Recent Scans Filter Bar */
.recent-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
  margin-bottom: 0.95rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-glass, rgba(255, 255, 255, 0.08));
  overflow-x: auto;
  scrollbar-width: thin;
}

.recent-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.85rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.12));
  color: var(--text-secondary, #94a3b8);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.recent-filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.recent-filter-chip.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.28) 100%);
  border-color: rgba(245, 158, 11, 0.65);
  color: #fbbf24;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.18);
}

.recent-filter-chip.active#recentFilterBookBtn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(79, 70, 229, 0.28) 100%);
  border-color: rgba(99, 102, 241, 0.65);
  color: #c7d2fe;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.18);
}

.recent-filter-chip.active#recentFilterAllBtn {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.22) 0%, rgba(100, 116, 139, 0.28) 100%);
  border-color: rgba(148, 163, 184, 0.65);
  color: #f1f5f9;
  box-shadow: 0 2px 10px rgba(148, 163, 184, 0.18);
}

.recent-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 5px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.recent-filter-chip.active .recent-filter-count {
  background: rgba(245, 158, 11, 0.35);
  color: #fff;
}

.recent-filter-chip.active#recentFilterBookBtn .recent-filter-count {
  background: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.recent-filter-chip.active#recentFilterAllBtn .recent-filter-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Recent Scans Table */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.recent-item:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(3px);
}

.ticket-digits-badge {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.08em;
}

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

.match-status-badge.matched {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
}

.match-status-badge.waiting {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

/* ป้ายบอกประเภทการสแกน: QR สลาก VS สแกนเล่ม */
.recent-item-ticket {
  border-left: 3px solid #10b981 !important;
}

.recent-item-book {
  border-left: 3px solid #6366f1 !important;
  background: rgba(99, 102, 241, 0.05) !important;
}

.badge-scan-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.3;
}

.badge-tag-ticket {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.badge-tag-book {
  background: rgba(99, 102, 241, 0.22);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
}

.ticket-digits-badge.book-badge {
  color: #c7d2fe;
  letter-spacing: 3px;
}

/* -------------------------------------------------------------
   ADMIN DASHBOARD SECTION (สรุปผลเลขชน)
   ------------------------------------------------------------- */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 1024px) {
  .stats-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stats-cards-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.stat-card.gold-highlight {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(18, 24, 38, 0.8) 100%);
}

.stat-card.emerald-highlight {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(18, 24, 38, 0.8) 100%);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.stat-card.gold-highlight .stat-value {
  color: #fbbf24;
}

.stat-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Filter & Search Bar */
.filter-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.filter-group-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.btn-filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-thai);
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-filter-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-filter-pill.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #000;
  font-weight: 700;
}

.search-input-box {
  position: relative;
  min-width: 260px;
}

.search-input-field {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  color: #fff;
  font-family: var(--font-thai);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input-field:focus {
  border-color: var(--accent-gold);
}

.search-icon-adornment {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
}

/* Shop Type Switcher (แยก สแกนสลาก 6 หลัก กับ สแกนเล่ม 4 ตัวท้าย) */
.shop-type-nav-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-wrap: wrap;
}

.shop-type-tab-btn {
  flex: 1;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.shop-type-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.shop-type-tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.12) 100%);
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.18);
}

.shop-type-tab-btn#shopTypeTabBook.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22) 0%, rgba(109, 40, 217, 0.14) 100%);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.shop-type-tab-btn#shopTypeTabAll.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.12) 100%);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.18);
}

.shop-type-tab-btn .type-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.shop-type-tab-btn .type-badge.book-badge {
  background: rgba(139, 92, 246, 0.22);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
}

.shop-type-tab-btn .type-badge.all-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Card Header Types */
.match-type-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.match-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.badge-ticket-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-book-pill {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.match-status-tag {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
}

.match-status-tag.matched {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.match-status-tag.matched-book {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.match-status-tag.solo {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.match-card.card-book-type {
  border-color: rgba(139, 92, 246, 0.28);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.04) 0%, rgba(18, 24, 38, 0.9) 100%);
}

.match-card.card-book-type:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 92, 246, 0.18);
}

.match-card.tier-10plus-book {
  border-color: rgba(139, 92, 246, 0.55);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(18, 24, 38, 0.9) 100%);
}

.book-display-num {
  color: #c4b5fd !important;
}

.book-prefix-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-main);
  letter-spacing: normal;
  vertical-align: middle;
  margin-right: 0.2rem;
}

/* Matching Cards Grid */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.match-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(245, 158, 11, 0.15);
}

.match-card.tier-10plus {
  border-color: rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(18, 24, 38, 0.85) 100%);
}

.match-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.ticket-number-display {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.06em;
  line-height: 1;
}

.set-size-badge {
  background: var(--accent-gold-gradient);
  color: #000;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.shops-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.shop-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.shop-chip-qty {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.15);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

/* -------------------------------------------------------------
   BUTTONS & COMMON COMPONENTS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  font-family: var(--font-thai);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gold-gradient);
  color: #000;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.35);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 0.45rem;
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: var(--font-thai);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--accent-gold);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: #121826;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #fff;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.9rem;
  color: #e2e8f0;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Shop Filter Chips */
.btn-filter-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  border-radius: 9999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.84rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.btn-filter-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-filter-chip.active {
  background: rgba(59, 130, 246, 0.2) !important;
  border-color: #3b82f6 !important;
  color: #93c5fd !important;
  font-weight: 700 !important;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.3);
}

.btn-filter-chip.warning.active {
  background: rgba(245, 158, 11, 0.22) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

.btn-filter-chip.success.active {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: #1e293b;
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideInRight 0.3s ease;
}

.toast.success { border-left-color: var(--accent-emerald); }
.toast.error { border-left-color: var(--accent-rose); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.badge-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.badge-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-status.suspended {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.table-actions-cell {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.badge-role {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.badge-role.admin {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-role.user {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* -------------------------------------------------------------
   LOGIN SCREEN (FORCED AUTHENTICATION - FULL SCREEN BLOCKER)
   ------------------------------------------------------------- */
.login-screen-wrapper {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #09090b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(24, 24, 27, 0.9);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg, 16px);
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 50px rgba(99, 102, 241, 0.18);
  animation: loginFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* -------------------------------------------------------------
   PRINT STYLES: PICK LIST & MATCHED SETS (ใบจัดสลาก & เลขชนชุด)
   ------------------------------------------------------------- */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm 12mm 12mm;
  }

  html, body {
    background: #fff !important;
    color: #111827 !important;
    font-size: 12pt !important;
    line-height: 1.4 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide UI elements not meant for print */
  .app-header, 
  .nav-tabs-wrapper, 
  .app-main, 
  .login-screen-wrapper, 
  .modal-close-btn, 
  .toast-container, 
  .shop-chat-widget, 
  .shop-chat-drawer,
  .no-print, 
  button, 
  select,
  .doc-modal-actions {
    display: none !important;
  }

  /* Reset modal containers to standard flowing document */
  .modal-overlay {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
    opacity: 1 !important;
  }

  .modal-container,
  .picklist-modal-container,
  .matched-sets-modal-container {
    background: #fff !important;
    color: #111827 !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Force page-break per shop */
  .print-shop-page {
    page-break-after: always !important;
    break-after: page !important;
    display: block !important;
    padding-top: 5mm !important;
    padding-bottom: 10mm !important;
    margin-bottom: 0 !important;
    border: none !important;
    background: #fff !important;
  }

  .print-shop-page:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  /* Official Print Header */
  .doc-print-header {
    border-bottom: 2px solid #111827 !important;
    padding-bottom: 8px !important;
    margin-bottom: 14px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
  }

  .doc-print-title {
    font-size: 16pt !important;
    font-weight: 800 !important;
    color: #000 !important;
    margin: 0 0 4px 0 !important;
  }

  .doc-print-subtitle {
    font-size: 10pt !important;
    color: #4b5563 !important;
    margin: 0 !important;
  }

  /* Shop Info Banner in Print */
  .doc-shop-banner {
    background: #f3f4f6 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 10px 14px !important;
    margin-bottom: 14px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .doc-shop-banner-info {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px 24px !important;
    font-size: 10.5pt !important;
    width: 100% !important;
  }

  .doc-shop-banner-info strong {
    color: #000 !important;
  }

  /* Tables in Print */
  .doc-print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 16px !important;
    page-break-inside: auto !important;
  }

  .doc-print-table tr {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }

  .doc-print-table th, 
  .doc-print-table td {
    border: 1px solid #9ca3af !important;
    padding: 7px 10px !important;
    font-size: 10.5pt !important;
    color: #111827 !important;
  }

  .doc-print-table th {
    background: #e5e7eb !important;
    font-weight: 700 !important;
    text-align: center !important;
  }

  .doc-print-table td.ticket-num-cell {
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 13pt !important;
    font-weight: 800 !important;
    letter-spacing: 2px !important;
    color: #000 !important;
    text-align: center !important;
  }

  .doc-print-table td.qty-cell {
    font-weight: 700 !important;
    text-align: center !important;
  }

  /* Signatures section */
  .doc-print-signatures {
    display: flex !important;
    justify-content: space-between !important;
    margin-top: 30px !important;
    padding-top: 15px !important;
    page-break-inside: avoid !important;
  }

  .doc-signature-block {
    width: 45% !important;
    text-align: center !important;
    font-size: 10pt !important;
    color: #374151 !important;
  }

  .doc-signature-line {
    border-bottom: 1px dashed #6b7280 !important;
    margin: 35px auto 8px auto !important;
    width: 80% !important;
  }
  /* Matched Sets Report in Print */
  .matched-sets-report-wrapper {
    color: #111827 !important;
  }
  .matched-sets-report-wrapper .doc-print-header {
    border-bottom: 2px solid #111827 !important;
  }
  .matched-sets-report-wrapper .matched-report-title {
    color: #000 !important;
    font-size: 16pt !important;
  }
  .matched-sets-report-wrapper .matched-report-meta {
    color: #1f2937 !important;
  }
  .matched-sets-report-wrapper .matched-report-meta strong {
    color: #000 !important;
  }
  .matched-sets-table th,
  .matched-sets-table td {
    border: 1px solid #9ca3af !important;
    color: #111827 !important;
    font-size: 10.5pt !important;
  }
  .matched-sets-table th {
    background: #e5e7eb !important;
    color: #000 !important;
    font-weight: 700 !important;
  }
  .matched-sets-table .col-idx,
  .matched-sets-table .col-shops {
    color: #374151 !important;
  }
  .matched-sets-table .ticket-num-cell {
    color: #000 !important;
    font-size: 13pt !important;
    letter-spacing: 4px !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
  }
  .matched-sets-table .qty-cell {
    color: #000 !important;
  }
  .matched-sets-table .col-shops-detail {
    color: #111827 !important;
  }
  .matched-sets-table .col-shops-detail strong {
    color: #000 !important;
  }
  .matched-sets-table .shop-qty {
    color: #047857 !important;
  }
  .matched-sets-table .col-status,
  .matched-sets-table .checkbox-box,
  .matched-sets-table .checkbox-label {
    color: #374151 !important;
  }
  .matched-sets-table tfoot tr {
    background: #f3f4f6 !important;
    border-top: 2px solid #111827 !important;
  }
  .matched-sets-table .footer-label,
  .matched-sets-table .footer-qty,
  .matched-sets-table .footer-note {
    color: #000 !important;
  }
}

/* -------------------------------------------------------------
   ON-SCREEN MODAL STYLING FOR REPORTS & PICK LIST
   ------------------------------------------------------------- */
.doc-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
}

/* On-Screen Screen Styling for Matched Sets Report - Pure White Text */
.matched-sets-report-wrapper {
  color: #ffffff;
  padding: 0.25rem 0;
}

.matched-sets-report-wrapper .doc-print-header {
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  padding-bottom: 8px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.matched-sets-report-wrapper .matched-report-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.matched-sets-report-wrapper .matched-report-meta {
  text-align: right;
  font-size: 0.9rem;
  color: #ffffff;
  line-height: 1.4;
}

.matched-sets-report-wrapper .matched-report-meta strong {
  color: #ffffff;
}

.matched-sets-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  color: #ffffff;
}

.matched-sets-table th,
.matched-sets-table td {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 12px;
  color: #ffffff;
}

.matched-sets-table th {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
}

.matched-sets-table .col-center {
  text-align: center;
}

.matched-sets-table .col-idx {
  font-weight: 700;
  color: #ffffff;
  font-size: 1rem;
}

.matched-sets-table .ticket-num-cell {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
  letter-spacing: 4px;
  white-space: nowrap !important;
  word-break: keep-all !important;
}

.matched-sets-table .qty-cell {
  font-weight: 700;
  text-align: center;
  font-size: 1.05rem;
  color: #ffffff;
}

.matched-sets-table .col-shops {
  font-weight: 700;
  color: #ffffff;
}

.matched-sets-table .col-shops-detail {
  font-size: 0.95rem;
  color: #ffffff;
  line-height: 1.5;
}

.matched-sets-table .col-shops-detail strong {
  color: #ffffff;
}

.matched-sets-table .shop-item-line {
  margin-bottom: 4px;
}

.matched-sets-table .shop-qty {
  color: #34d399; /* emerald green for ticket count so it pops cleanly against white text */
  font-weight: 800;
}

.matched-sets-table .col-status {
  vertical-align: middle;
  color: #ffffff;
}

.matched-sets-table .checkbox-box {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffffff;
}

.matched-sets-table .checkbox-label {
  margin-top: 3px;
  font-size: 0.85rem;
  color: #ffffff;
}

.matched-sets-table tfoot tr {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
  border-top: 2px solid rgba(255, 255, 255, 0.35);
}

.matched-sets-table .footer-label {
  text-align: right;
  padding-right: 15px;
  color: #ffffff;
  font-size: 1rem;
}

.matched-sets-table .footer-qty {
  color: #ffffff;
  font-size: 1.15rem;
}

.matched-sets-table .footer-note {
  text-align: left;
  padding-left: 15px;
  font-size: 0.95rem;
  color: #ffffff;
}

.doc-shop-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 12px);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s ease;
}

.doc-shop-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.doc-shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.doc-shop-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.doc-shop-badge {
  font-size: 0.88rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 700;
}

.doc-meta-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 1rem;
}

.doc-meta-item strong {
  color: var(--text-primary, #f1f5f9);
}

.doc-print-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

.doc-signature-block {
  width: 45%;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
}

.doc-signature-line {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
  margin: 2.2rem auto 0.5rem auto;
  width: 80%;
}


/* -------------------------------------------------------------
   THEME CONSISTENT SELECT & DROPDOWN STYLING
   ------------------------------------------------------------- */
select,
select.form-control,
.user-switcher-select {
  background-color: #18181b !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: var(--radius-sm, 8px);
  padding: 0.45rem 0.75rem;
  font-family: var(--font-primary, inherit);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

select:focus,
select.form-control:focus,
.user-switcher-select:focus {
  border-color: var(--accent-gold, #f59e0b) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25) !important;
}

select option,
select.form-control option,
.user-switcher-select option {
  background-color: #18181b !important;
  color: #f8fafc !important;
  padding: 10px 14px !important;
}

.user-switcher-select {
  background: rgba(24, 24, 27, 0.95) !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  color: #fbbf24 !important;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.user-switcher-select:hover {
  border-color: #fbbf24 !important;
  background: rgba(30, 27, 75, 0.9) !important;
}

/* Custom User Switcher Dropdown (Scrollable, Max 10 Items, Unified User Pill) */
.custom-user-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.custom-switcher-btn {
  background: rgba(20, 24, 38, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 0.32rem 0.85rem;
  border-radius: 9999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: space-between;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  white-space: nowrap;
  font-family: inherit;
}

.custom-switcher-btn:hover,
.custom-user-switcher.open .custom-switcher-btn {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.95) 0%, rgba(20, 24, 38, 0.98) 100%);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.28);
}

.custom-switcher-chevron {
  font-size: 0.65rem;
  color: #fbbf24;
  opacity: 0.8;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 0.2rem;
}

.custom-user-switcher.open .custom-switcher-chevron {
  transform: rotate(180deg);
}

.custom-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  min-width: 240px;
  width: max-content;
  max-width: 380px;
  max-height: 380px; /* จำกัดความสูงไว้ประมาณ 10 แถวพอดี เกินกว่านี้เลื่อนเมาส์ scroll ได้ */
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #15161b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8);
  z-index: 10005;
  padding: 6px;
  box-sizing: border-box;
}

/* Scrollbar สำหรับ Dropdown */
.custom-switcher-menu::-webkit-scrollbar {
  width: 6px;
}
.custom-switcher-menu::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
}
.custom-switcher-menu::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.4);
  border-radius: 4px;
}
.custom-switcher-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(251, 191, 36, 0.75);
}

.custom-switcher-item {
  padding: 0.52rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: #f1f5f9;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.custom-switcher-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.custom-switcher-item.active {
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
}

.custom-switcher-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Shop Dashboard Specific Styling */
.btn-shop-filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-shop-filter-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-shop-filter-pill.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.3) 100%);
  border-color: #f59e0b;
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.impersonate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

/* =============================================================
   MOBILE & TABLET RESPONSIVE DESIGN (SMARTPHONES, IPAD, TABLET)
   ============================================================= */

/* Universal Touch & Performance Optimizations */
button, 
.btn, 
.nav-tab-btn, 
.btn-filter-pill, 
.btn-shop-filter-pill,
select,
input {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:active, 
.btn:active, 
.nav-tab-btn:active, 
.btn-filter-pill:active, 
.btn-shop-filter-pill:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Ensure inputs on mobile don't trigger iOS Safari auto-zoom */
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  font-size: 16px !important;
}

/* Table Responsive Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.action-bar-responsive {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.action-buttons-group {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .action-bar-responsive {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }
  .action-buttons-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    width: 100%;
  }
  .action-buttons-group .btn {
    width: 100%;
    justify-content: center;
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .action-buttons-group {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------
   1. TABLET & IPAD (Landscape & Portrait <= 1024px)
   ------------------------------------------------------------- */
@media (max-width: 1024px) {
  .app-header {
    padding: 0.85rem 1.25rem;
  }

  .app-main {
    padding: 1.25rem 1.25rem;
  }

  .nav-tabs-wrapper {
    padding: 0.5rem 1.25rem 0.75rem;
    flex-wrap: wrap;
    overflow: visible;
    gap: 0.45rem 0.5rem;
  }

  .nav-tabs-wrapper::-webkit-scrollbar {
    display: none;
  }

  .nav-tab-btn {
    padding: 0.55rem 0.85rem;
    font-size: 0.86rem;
    min-height: 38px;
  }

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

  .matches-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }

  .scanner-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* -------------------------------------------------------------
   2. SMALL TABLET & PHABLET (<= 768px)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .app-header {
    padding: 0.65rem 0.75rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .header-container {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.65rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .brand-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    gap: 0.75rem;
    margin: 0 auto;
  }

  .brand-text-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .brand-title {
    font-size: 1.18rem;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
  }

  .brand-subtitle {
    font-size: 0.72rem;
    text-align: center;
    white-space: normal;
    line-height: 1.35;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .header-status-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    width: 100%;
    max-width: 100%;
  }

  .period-badge {
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    white-space: nowrap;
    max-width: 100%;
    justify-content: center;
  }

  .system-status-pill {
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
  }

  .user-switcher-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    gap: 0.5rem;
  }

  .user-switcher-select,
  .custom-user-switcher {
    max-width: 100%;
  }

  .custom-switcher-btn {
    font-size: 0.82rem;
    padding: 0.32rem 0.75rem;
    max-width: 100%;
    justify-content: center;
  }

  #customUserSwitcherSelectedText {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .custom-switcher-menu {
    width: 100%;
    max-width: min(340px, 92vw);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  #returnAdminBtn {
    flex-shrink: 0;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8rem !important;
    min-height: 34px;
  }

  .user-badge {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    max-width: calc(100% - 65px);
    justify-content: center;
  }

  .user-badge span:first-child {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Filter toolbar on small tablet */
  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
  }

  .filter-group-left {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.35rem;
  }

  .filter-group-left::-webkit-scrollbar {
    display: none;
  }

  .btn-filter-pill,
  .btn-shop-filter-pill {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .search-input-box {
    width: 100%;
    min-width: 100%;
  }

  .modal-container {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 1.25rem !important;
    border-radius: var(--radius-lg) !important;
  }

  .countdown-box {
    padding: 0.75rem 1.25rem;
    gap: 0.85rem;
  }

  .time-num {
    font-size: 1.5rem;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    width: 100%;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
  }
}

/* -------------------------------------------------------------
   3. SMARTPHONES (<= 540px)
   ------------------------------------------------------------- */
@media (max-width: 540px) {
  .app-main {
    padding: 0.75rem 0.5rem 5.5rem;
    margin: 0.35rem auto 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .nav-tabs-wrapper {
    padding: 0.35rem 0.4rem 0.55rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
    gap: 0.35rem 0.4rem;
    width: 100%;
    max-width: 100%;
  }

  .nav-tab-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 8px;
    min-height: 34px;
    gap: 0.35rem;
  }

  /* 2x2 Grid for Metric Cards on Phone so they look like sleek app widgets */
  .stats-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    margin-bottom: 1.25rem;
  }

  .stat-card {
    padding: 0.9rem 0.85rem;
    border-radius: var(--radius-md);
    gap: 0.35rem;
  }

  .stat-label {
    font-size: 0.74rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .stat-desc {
    font-size: 0.68rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Shop Type Switcher on Mobile */
  .shop-type-nav-wrapper {
    gap: 0.35rem;
    padding: 0.3rem;
    margin-bottom: 0.85rem;
  }

  .shop-type-tab-btn {
    min-width: unset;
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
    gap: 0.35rem;
  }

  .shop-type-tab-btn .type-badge {
    font-size: 0.68rem;
    padding: 0.12rem 0.4rem;
  }

  /* Single Column Matches Grid on Phone */
  .matches-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .match-card {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }

  .ticket-number-display {
    font-size: 1.45rem;
  }

  .book-display-num {
    font-size: 1.55rem !important;
  }

  /* Scanner Box on Phone */
  .glass-card {
    padding: 1rem 0.75rem;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .card-title-row {
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .card-title {
    font-size: 1.02rem;
  }

  .scan-mode-tabs-container {
    padding: 4px;
    gap: 6px;
    margin-bottom: 0.85rem;
    width: 100%;
  }

  .scan-mode-tab {
    padding: 0.5rem 0.4rem;
    font-size: 0.78rem;
    gap: 0.35rem;
  }

  .scan-viewport {
    padding: 1.25rem 0.75rem;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 100%;
  }

  .scan-input-field,
  .scan-input-primary {
    font-size: 1.1rem !important;
    padding: 0.65rem 0.6rem;
    width: 100%;
    max-width: 100%;
  }

  .demo-toolbar {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .demo-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
  }

  .btn-demo-chip {
    font-size: 0.74rem;
    padding: 0.3rem 0.55rem;
  }

  .shop-chat-widget {
    bottom: 16px;
    right: 16px;
    z-index: 9999;
  }

  .shop-chat-floating-btn {
    padding: 0.55rem 0.95rem;
    font-size: 0.82rem;
  }

  .lock-banner {
    padding: 1.5rem 1rem;
  }

  .lock-title {
    font-size: 1.2rem;
  }

  .lock-subtitle {
    font-size: 0.85rem;
  }

  .time-num {
    font-size: 1.3rem;
  }

  .time-label {
    font-size: 0.68rem;
  }

  /* Login Card on Phone */
  .login-card {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-lg);
  }

  .login-card h1 {
    font-size: 1.35rem !important;
  }

  /* Button Tap targets */
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    min-height: 42px;
  }

  .btn-sm {
    min-height: 36px;
    padding: 0.35rem 0.65rem;
  }
}

/* -------------------------------------------------------------
   4. ULTRA-SMALL PHONES (<= 375px e.g. iPhone SE)
   ------------------------------------------------------------- */
@media (max-width: 375px) {
  .brand-title {
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .stats-cards-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
}

/* =============================================================
   5. CUSTOM DIALOG MODALS (Bootstrap / SweetAlert Modern Luxury)
   ============================================================= */
.custom-dialog-overlay {
  z-index: 10000 !important;
  background: rgba(8, 12, 22, 0.82) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1.25rem !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.custom-dialog-overlay.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.custom-dialog-card {
  background: linear-gradient(160deg, #1a2336 0%, #0d1424 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  max-width: 440px;
  width: 100%;
  padding: 2.25rem 1.85rem 1.85rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 40px rgba(245, 158, 11, 0.1);
  position: relative;
  text-align: center;
  transform: scale(0.88) translateY(16px);
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-dialog-overlay.active .custom-dialog-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.custom-dialog-icon-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.custom-dialog-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  animation: pulseDialogIcon 2.2s infinite ease-in-out;
}

@keyframes pulseDialogIcon {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 24px 6px rgba(245, 158, 11, 0.25);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

.custom-dialog-icon.warning {
  background: rgba(245, 158, 11, 0.15);
  border: 2px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.custom-dialog-icon.danger {
  background: rgba(239, 68, 68, 0.16);
  border: 2px solid rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.custom-dialog-icon.success {
  background: rgba(16, 185, 129, 0.16);
  border: 2px solid rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.custom-dialog-icon.info {
  background: rgba(59, 130, 246, 0.16);
  border: 2px solid rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.custom-dialog-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.01em;
}

.custom-dialog-body {
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.65;
  margin-bottom: 1.5rem;
  word-break: break-word;
}

.custom-dialog-body .highlight {
  color: #fbbf24;
  font-weight: 700;
}

.custom-dialog-body .text-danger {
  color: #f87171;
}

.custom-dialog-body .sub-note {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  line-height: 1.5;
}

.custom-dialog-prompt-container {
  margin-bottom: 1.5rem;
}

.custom-dialog-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
  text-align: center;
}

.custom-dialog-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.custom-dialog-actions {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
}

.custom-dialog-btn {
  flex: 1;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-dialog-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-dialog-danger:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.55);
}

.btn-dialog-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #000000 !important;
  font-weight: 700;
  border: none !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-dialog-warning:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.55);
}

@media (max-width: 480px) {
  .custom-dialog-card {
    padding: 1.75rem 1.25rem 1.5rem;
    border-radius: 20px;
  }
  .custom-dialog-icon {
    width: 64px;
    height: 64px;
    font-size: 1.9rem;
  }
  .custom-dialog-title {
    font-size: 1.2rem;
  }
  .custom-dialog-body {
    font-size: 0.88rem;
  }
  .custom-dialog-btn {
    min-height: 42px;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }
}

/* =============================================================
   6. DATETIME PICKER & QUICK PRESETS (Admin Schedule Controls)
   ============================================================= */
.datetime-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.datetime-input {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.datetime-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s, transform 0.2s;
  padding: 4px;
}

.datetime-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.15);
}

.btn-picker {
  white-space: nowrap;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-gold);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-picker:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.quick-date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.btn-preset-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset-pill:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fff;
  transform: translateY(-1px);
}

/* =============================================================
   7. AUTH TABS (Login & Register Switcher)
   ============================================================= */
.auth-tabs-wrapper {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.3rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.5rem;
  gap: 0.3rem;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-thai);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.auth-tab-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.08) 100%);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-tab-btn:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* =============================================================
   8. SHOP PROFILE MANAGEMENT STYLES
   ============================================================= */
.shop-profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.profile-info-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-info-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-info-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.badge-status.pending {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  animation: pulsePending 2s infinite ease-in-out;
}

@keyframes pulsePending {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 10px 2px rgba(245, 158, 11, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* =============================================================
   9. REAL-TIME NEW SHOP NOTIFICATION FOR ADMIN
   ============================================================= */
.new-shop-notification-card {
  background: linear-gradient(135deg, rgba(20, 24, 38, 0.98) 0%, rgba(30, 27, 46, 0.98) 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-left: 5px solid #f59e0b;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: #fff;
  min-width: 320px;
  max-width: 420px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.2);
  backdrop-filter: blur(12px);
  animation: bounceInRight 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.new-shop-notification-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #f59e0b);
}

@keyframes bounceInRight {
  0% { transform: translateX(120%); opacity: 0; }
  60% { transform: translateX(-8px); opacity: 1; }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

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

.notif-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notif-card-bell {
  display: inline-block;
  animation: bellRing 1.5s infinite;
}

@keyframes bellRing {
  0%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(-15deg); }
  20%, 40% { transform: rotate(15deg); }
  50% { transform: rotate(0); }
}

.notif-card-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.notif-card-close:hover {
  color: #fff;
}

.notif-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.notif-card-body {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.notif-card-body strong {
  color: #fbbf24;
}

.notif-card-actions {
  margin-top: 0.35rem;
  display: flex;
  justify-content: flex-end;
}

.notif-action-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000 !important;
  font-weight: 700 !important;
  border: none !important;
  padding: 0.4rem 0.9rem !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35) !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notif-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45) !important;
}

/* Badge Pulse on Navigation */
.badge-counter.pulse-alert {
  animation: pulseBadgeAlert 1.2s infinite ease-in-out !important;
}

@keyframes pulseBadgeAlert {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  50% { transform: scale(1.15); box-shadow: 0 0 14px 4px rgba(245, 158, 11, 0.5); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Highlight newly added table row */
tr.row-new-arrival {
  animation: highlightRow 4s ease forwards !important;
}

@keyframes highlightRow {
  0% { background: rgba(245, 158, 11, 0.4); }
  100% { background: rgba(245, 158, 11, 0.04); }
}

/* Switch Slider for Toggle Settings */
.switch-toggle input:checked + .switch-slider {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
}

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

.switch-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Bootstrap-Style Animated Progress Bar */
.progress {
  display: flex;
  height: 18px;
  overflow: hidden;
  font-size: 0.75rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.progress-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  background-color: #f59e0b;
  transition: width 0.6s ease;
}

.progress-bar-striped {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.22) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0.22) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1.5rem 1.5rem;
}

.progress-bar-animated {
  animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
  0% { background-position-x: 1.5rem; }
  100% { background-position-x: 0; }
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.08); opacity: 1; }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

#registrationStatusModal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000000 !important;
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1.5rem !important;
}

#registrationStatusModal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

#registrationStatusModal:not(.active) {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* =============================================================
   REAL-TIME BOTTOM ACTIVITY POPUPS (เข้า-ออกจากระบบ)
   ============================================================= */
.activity-popup-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 3rem);
}

.activity-popup {
  pointer-events: auto;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.75rem 1.1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: #fff;
  font-size: 0.88rem;
  animation: activitySlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

.activity-popup.login {
  border-left: 4.5px solid #10b981;
}

.activity-popup.logout {
  border-left: 4.5px solid #f43f5e;
}

.activity-popup-icon {
  font-size: 1.35rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-popup-content {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.activity-popup-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-popup-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.28rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 96px;
  box-sizing: border-box;
}

.activity-badge.login {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.activity-badge.logout {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

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

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

/* =============================================================
   ACTIVITY LOGS & DAILY SUMMARY LUXURY STYLES
   ============================================================= */

.stat-card.rose-highlight {
  border-color: rgba(244, 63, 94, 0.35);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.12) 0%, rgba(18, 24, 38, 0.88) 100%);
}

.live-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
  flex-shrink: 0;
}

/* Activity Luxury Toolbar */
.activity-luxury-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.1rem;
  background: linear-gradient(145deg, rgba(22, 28, 44, 0.95), rgba(13, 17, 28, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 1rem 1.35rem;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(16px);
}

.activity-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

/* Date Selector Group */
.activity-date-picker-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.65rem;
  border-radius: 12px;
}

.activity-date-label {
  font-size: 0.83rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.activity-date-input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
  transition: all 0.25s;
  color-scheme: dark;
}

.activity-date-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.btn-date-quick {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-family: var(--font-thai);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-date-quick:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.btn-date-quick.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

/* Ultra Luxury Segmented Filter Control */
.activity-segmented-control {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 5px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55);
  gap: 5px;
}

.activity-seg-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-thai);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.45rem 1.05rem;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  white-space: nowrap;
}

.activity-seg-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.activity-seg-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.activity-seg-btn.login-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.activity-seg-btn.logout-btn.active {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.seg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.seg-dot.green {
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.seg-dot.red {
  background: #f87171;
  box-shadow: 0 0 8px #f87171;
}

.seg-badge {
  background: rgba(255, 255, 255, 0.16);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  color: inherit;
  line-height: 1;
}

/* Glass Search Input */
.activity-search-box-wrapper {
  position: relative;
  min-width: 260px;
  max-width: 340px;
  width: 100%;
}

.search-icon-glass {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  pointer-events: none;
  opacity: 0.6;
}

.activity-search-glass-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.55rem 2.2rem 0.55rem 2.35rem;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.25s;
}

.activity-search-glass-input:focus {
  border-color: #3b82f6;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.35);
}

.activity-clear-btn {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  display: none;
  transition: all 0.2s;
}

.activity-clear-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ========================================================== */
/* ADMIN ONLINE / OFFLINE STAT CARDS ON MAIN SCREEN (TAB 1)    */
/* ========================================================== */
.scanner-admin-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.scanner-live-stat-card {
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  user-select: none;
  cursor: default;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.scanner-live-stat-card.card-online {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.09) 0%, rgba(6, 78, 59, 0.16) 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.08);
}

.scanner-live-stat-card.card-offline {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(127, 29, 29, 0.15) 100%);
  border: 1px solid rgba(239, 68, 68, 0.32);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.06);
}

.scanner-live-stat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
}

.scanner-live-stat-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.scanner-live-stat-value {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
}

.scanner-live-stat-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  opacity: 0.85;
}

/* =============================================================
   VIP OVERTIME ACCESS STYLES (สิทธิ์เปิดใช้งานนอกเวลา)
   ============================================================= */

/* 1. สวิตช์เปิด-ปิดสิทธิ์ VIP นอกเวลา (Toggle Switch) */
.vip-switch-container {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.vip-toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  cursor: pointer;
  vertical-align: middle;
  margin: 0;
}

.vip-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.vip-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vip-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #94a3b8;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.vip-toggle-switch input:checked + .vip-toggle-slider {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
}

.vip-toggle-switch input:checked + .vip-toggle-slider:before {
  transform: translateX(22px);
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* 2. แท็กสถานะ VIP นอกเวลา (VIP Badge) */
.badge-vip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.3) 100%);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.55);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
  white-space: nowrap;
}

.badge-vip-off {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

/* 3. แบนเนอร์แจ้งเตือน VIP นอกเวลาในหน้าสแกน */
.vip-overtime-banner {
  display: none;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(180, 83, 9, 0.22) 100%);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
  animation: fadeInDown 0.4s ease-out;
}

.vip-overtime-banner .vip-banner-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.vip-overtime-banner .vip-banner-text {
  flex: 1;
}

.vip-overtime-banner .vip-banner-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.vip-overtime-banner .vip-banner-sub {
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.4;
}

/* 4. ชิปตัวกรอง VIP ในแถบ Filter */
.btn-filter-chip.vip {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
.btn-filter-chip.vip:hover,
.btn-filter-chip.vip.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.35) 100%);
  border-color: #f59e0b;
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

/* 5. Real-Time Auto-Refresh Badge */
.live-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 0.22rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #34d399;
  letter-spacing: 0.2px;
  user-select: none;
  transition: all 0.2s ease;
}
.live-sync-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}
/* ============================================================
   Login Takeover / Single-Device Enforcement Styles
   ============================================================ */
.takeover-icon-box {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 2rem;
  position: relative;
}

.takeover-icon-box.warning {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, rgba(245, 158, 11, 0.05) 70%);
  border: 2px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.3);
  animation: pulseTakeoverIcon 2s infinite ease-in-out;
}

.takeover-icon-box.info {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.05) 70%);
  border: 2px solid rgba(59, 130, 246, 0.5);
  color: #60a5fa;
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
}

.takeover-icon-box.danger {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.05) 70%);
  border: 2px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.3);
}

.takeover-icon-box.success {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.35) 0%, rgba(16, 185, 129, 0.08) 70%);
  border: 2px solid rgba(16, 185, 129, 0.7);
  color: #34d399;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.5);
  animation: pulseSuccessTakeover 1.5s infinite ease-in-out;
}

@keyframes pulseSuccessTakeover {
  0%, 100% { transform: scale(1); box-shadow: 0 0 25px rgba(16, 185, 129, 0.4); }
  50% { transform: scale(1.1); box-shadow: 0 0 42px rgba(16, 185, 129, 0.75); }
}

.takeover-approved-modal {
  border: 2px solid rgba(16, 185, 129, 0.8) !important;
  box-shadow: 0 0 45px rgba(16, 185, 129, 0.55), 0 20px 40px rgba(0, 0, 0, 0.7) !important;
  animation: popGreenModal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes popGreenModal {
  0% { transform: scale(0.92); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseTakeoverIcon {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(245, 158, 11, 0.3); }
  50% { transform: scale(1.06); box-shadow: 0 0 32px rgba(245, 158, 11, 0.6); }
}

.takeover-info-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  text-align: left;
}

.takeover-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.takeover-info-item:last-child {
  margin-bottom: 0;
}

.takeover-info-label {
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.takeover-info-val {
  font-weight: 600;
  color: #f1f5f9;
}

/* Takeover Progress Bar Component */
.takeover-progress-wrapper {
  margin: 1.5rem 0 1rem;
}

.takeover-progress-track {
  width: 100%;
  height: 12px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.takeover-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1, #a855f7);
  border-radius: 9999px;
  transition: width 1s linear;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
  position: relative;
}

.takeover-progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shineProgress 1.8s infinite;
}

@keyframes shineProgress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.takeover-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #38bdf8;
  margin-top: 0.6rem;
  font-variant-numeric: tabular-nums;
}

/* Kick user button styling */
.btn-kick {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-kick:hover {
  background: rgba(239, 68, 68, 0.28) !important;
  border-color: rgba(239, 68, 68, 0.85) !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}
.btn-kick:active {
  transform: scale(0.96);
}

/* =============================================================
   LIVE CHAT SYSTEM (REAL-TIME 2-WAY CHAT: SHOP <-> ADMIN)
   ============================================================= */

/* --- Floating Chat Widget for Shops --- */
.shop-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.shop-chat-floating-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.8rem 1.35rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4), 0 0 20px rgba(245, 158, 11, 0.2);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.shop-chat-floating-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 15px 35px rgba(245, 158, 11, 0.55), 0 0 30px rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.shop-chat-floating-btn:active {
  transform: scale(0.97);
}

.shop-chat-floating-btn .chat-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.chat-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #0f172a;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
  animation: pulseUnread 2s infinite ease-in-out;
}

@keyframes pulseUnread {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); box-shadow: 0 0 16px rgba(239, 68, 68, 0.9); }
}

/* --- Slide-up Chat Drawer (Shop Side) --- */
.shop-chat-drawer {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  height: 570px;
  max-height: calc(100vh - 110px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 18px;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.85), 0 0 35px rgba(245, 158, 11, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  animation: chatDrawerSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatDrawerSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-drawer-header {
  padding: 0.85rem 1.15rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-drawer-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.chat-drawer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.chat-drawer-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  line-height: 1.3;
}

.chat-drawer-status {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}

.chat-status-dot.online {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.chat-drawer-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Chat Messages Scroll Container */
.chat-drawer-body,
.admin-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0;
}

.chat-date-divider span {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Message Item & Bubbles */
.chat-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: fadeInMsg 0.2s ease-out;
}

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

.chat-msg-row.outgoing {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-row.incoming {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-sender-tag {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 0.2rem;
  padding: 0 0.4rem;
}

.chat-msg-bubble {
  padding: 0.65rem 0.95rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
}

.chat-msg-row.outgoing .chat-msg-bubble {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  font-weight: 500;
  border-bottom-right-radius: 3px;
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.25);
}

.chat-msg-row.incoming .chat-msg-bubble {
  background: rgba(30, 41, 59, 0.85);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 3px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.chat-msg-image {
  max-width: 220px;
  max-height: 200px;
  border-radius: 10px;
  margin-bottom: 0.35rem;
  display: block;
  cursor: pointer;
  transition: transform 0.2s;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-msg-image:hover {
  transform: scale(1.02);
}

.chat-msg-footer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: #94a3b8;
  padding: 0 0.3rem;
}

.chat-msg-row.outgoing .chat-msg-footer {
  justify-content: flex-end;
}

/* Quick Replies Chips */
.chat-quick-replies {
  display: flex;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 14, 23, 0.5);
}

.chat-quick-replies::-webkit-scrollbar {
  height: 4px;
}

.chat-chip {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-chip:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

/* Typing Indicator */
.chat-typing-indicator {
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  color: #fbbf24;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.06);
}

/* Chat Input Footer */
.chat-drawer-footer,
.admin-chat-footer {
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-image-preview-wrapper {
  position: relative;
  display: inline-block;
  max-width: 90px;
}

.chat-image-preview-wrapper img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #f59e0b;
}

.chat-remove-image-btn {
  position: absolute;
  top: -6px;
  right: 4px;
  background: #ef4444;
  color: #fff;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-attach-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: scale(1.04);
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #fff;
  padding: 0.65rem 0.95rem;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.chat-send-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  border: none;
  border-radius: 10px;
  width: 42px;
  height: 40px;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

/* =============================================================
   ADMIN CHAT CENTER (2-COLUMN FULL VIEW)
   ============================================================= */
.admin-chat-container {
  display: flex;
  background: rgba(18, 24, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  height: calc(100vh - 180px);
  min-height: 580px;
}

/* Sidebar */
.admin-chat-sidebar {
  width: 320px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.7);
}

.admin-chat-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-chat-conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-convo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  position: relative;
}

.chat-convo-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chat-convo-item.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.chat-convo-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  border: 1.5px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  position: relative;
  flex-shrink: 0;
}

.chat-convo-avatar .chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  border: 2px solid #0f172a;
}

.chat-convo-info {
  flex: 1;
  min-width: 0;
}

.chat-convo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.chat-convo-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-convo-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat-convo-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-convo-preview {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-convo-badge {
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

/* Admin Main Pane */
.admin-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 23, 0.6);
  position: relative;
}

.admin-chat-empty-state {
  margin: auto;
  text-align: center;
  padding: 3rem 1.5rem;
}

.admin-chat-active-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.admin-chat-header {
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-chat-target-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.admin-chat-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.admin-chat-subtitle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.shop-code-tag {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.chat-status-text {
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Lightbox Modal */
.chat-lightbox-overlay {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.chat-lightbox-content img {
  max-width: 100%;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-lightbox-close:hover {
  background: rgba(239, 68, 68, 0.8);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .shop-chat-drawer {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 80px;
    height: calc(100vh - 120px);
  }

  .admin-chat-container {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 140px);
  }

  .admin-chat-sidebar {
    width: 100%;
    max-height: 240px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* ======================================================= */
/* SUPER ADMIN: FEATURE MATRIX & DYNAMIC PERMISSIONS      */
/* ======================================================= */

.role-tag.superadmin {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.35) 100%);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
  font-weight: 800;
}

/* Toggle Switch Styling */
.feature-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  user-select: none;
}

.feature-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.feature-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.feature-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #94a3b8;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.feature-toggle-switch input:checked + .feature-toggle-slider {
  background-color: rgba(16, 185, 129, 0.28);
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.feature-toggle-switch input:checked + .feature-toggle-slider:before {
  transform: translateX(20px);
  background-color: #34d399;
}

/* Toggle Colors for Roles */
.feature-toggle-switch.switch-admin input:checked + .feature-toggle-slider {
  background-color: rgba(245, 158, 11, 0.28);
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.feature-toggle-switch.switch-admin input:checked + .feature-toggle-slider:before {
  background-color: #fbbf24;
}

.feature-toggle-switch.switch-user input:checked + .feature-toggle-slider {
  background-color: rgba(99, 102, 241, 0.28);
  border-color: #6366f1;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.feature-toggle-switch.switch-user input:checked + .feature-toggle-slider:before {
  background-color: #a5b4fc;
}

/* Feature Matrix Table */
.feature-matrix-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-glass, rgba(255, 255, 255, 0.07));
  vertical-align: middle;
}

.feature-matrix-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.feature-matrix-row.row-disabled {
  opacity: 0.5;
  filter: grayscale(0.5);
}

.feature-badge-category,
.badge-feature-category {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.category-custom {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.category-scanner {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.category-dashboard {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.category-admin {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.category-communication {
  background: rgba(14, 165, 233, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(14, 165, 233, 0.4);
}

.toggle-status-label {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
  transition: color 0.2s ease;
  user-select: none;
}

.superadmin-nav-glow {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.25) 100%) !important;
  border-color: rgba(245, 158, 11, 0.55) !important;
  color: #fbbf24 !important;
}

.superadmin-title-gradient {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fbbf24;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Real-Time 1-Hour Inactivity Live Countdown Box in Activity Logs */
.idle-live-box {
  width: 175px;
  max-width: 175px;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 5px;
  padding: 3px 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
  font-size: 0.67rem;
  line-height: 1.25;
}

.idle-live-box:hover {
  border-color: rgba(52, 211, 153, 0.4);
}

.idle-rem-clock,
.idle-dur-clock {
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* System Management Operations Cards in Permissions Control Panel */
.system-operations-panel .sys-op-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.system-operations-panel .sys-op-card:active {
  transform: translateY(0);
}

/* =============================================================
   SUPER ADMIN THEME SELECTOR STYLES
   ============================================================= */
.theme-selector-panel {
  margin-top: 1.25rem;
  padding: 1.35rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.88) 100%);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.5);
}

.theme-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1.1rem;
  margin-top: 1.1rem;
}

.theme-card {
  position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.theme-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-gold);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.theme-card.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 22px var(--accent-gold-glow);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, var(--bg-card) 100%);
}

.theme-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.theme-swatches {
  display: flex;
  gap: 6px;
  margin: 0.5rem 0;
  padding: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.theme-swatch {
  flex: 1;
  height: 22px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.theme-btn-activate {
  width: 100%;
  padding: 0.55rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.theme-btn-activate.is-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
  cursor: default;
}

/* ==========================================================
   CREDIT SYSTEM STYLES (Header Pill, Badges, Modals, Quick Chips)
   ========================================================== */
.header-credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.95rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(217, 119, 6, 0.28) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  border-radius: 9999px;
  font-size: 0.84rem;
  color: #fbbf24;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.22);
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-credit-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 158, 11, 0.8);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.header-credit-pill .credit-icon {
  font-size: 1.1rem;
}

.header-credit-pill .credit-label {
  font-weight: 600;
  color: #fef3c7;
  font-size: 0.78rem;
}

.header-credit-pill .credit-val {
  font-family: var(--font-mono);
  font-weight: 800;
  color: #fff;
  font-size: 0.98rem;
  letter-spacing: 0.4px;
}

.header-credit-pill.low-credit {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(185, 28, 28, 0.28) 100%);
  border-color: rgba(239, 68, 68, 0.6);
  color: #f87171;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.2);
}

.header-credit-pill.low-credit .credit-val {
  color: #fca5a5;
}

/* Shop Table Credit Badge */
.shop-table-credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.88rem;
  letter-spacing: 0.3px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.shop-table-credit-badge.low {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.shop-table-credit-badge.zero {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.45);
}

/* Quick Top-up Amount Chips */
.quick-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.quick-chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0.5rem 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.quick-chip-btn:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  transform: translateY(-1px);
}

.quick-chip-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #f59e0b;
  color: #000;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}









