/* ============================================================
   GymKu Admin — Premium Design System (Light Mode)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Brand - Deep-dark blue/cyan gradient aesthetic (Dark Mode by default) */
  --brand-1: #0066ff;
  --brand-2: #00d4ff;
  --brand-3: #7c3aed;

  /* Surface - Sleek IoT dark mode */
  --bg:        #050810;  /* deep-dark background */
  --surface:   #080d1a;  /* container surface */
  --surface-2: #0d1527;  /* table hover surface */
  --surface-3: #1a2333;  /* input backgrounds / borders */
  --border:    rgba(255, 255, 255, 0.08);
  --border-2:  rgba(255, 255, 255, 0.15);

  /* Text - Light on dark */
  --text-1: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;

  /* Theme-specific Component Mappings */
  --sidebar-bg:     rgba(8, 13, 26, 0.85);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-glow:   radial-gradient(circle, rgba(0, 102, 255, 0.08) 0%, transparent 70%);
  --topbar-bg:      rgba(8, 13, 26, 0.8);
  
  --card-bg:        rgba(255, 255, 255, 0.03);
  --shadow-card:    0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  
  --input-bg:       rgba(255, 255, 255, 0.02);
  --input-border:   rgba(255, 255, 255, 0.12);
  --input-focus-bg: rgba(255, 255, 255, 0.04);
  
  --thead-bg:       rgba(13, 21, 39, 0.7);

  /* Semantic - Vibrant */
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #f43f5e;
  --info:    #0ea5e9;

  /* Radius - Softer corners */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-2xl: 32px;
  --r-full:9999px;

  /* Shadows - Soft & elevated */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.2);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.3);
  --shadow-brand: 0 8px 32px rgba(0,102,255,0.25);

  /* Glow - Soft colored glows */
  --glow-brand: 0 0 24px rgba(0,102,255,0.3);
  --glow-success: 0 0 20px rgba(16,185,129,0.25);
  --glow-danger:  0 0 20px rgba(244,63,94,0.25);

  /* Sidebar width */
  --sidebar-w: 260px;

  /* Transitions */
  --t: 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-slow: 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-theme="light"] {
  /* Brand - Vibrant blue/cyan accent */
  --brand-1: #0056d6;
  --brand-2: #00a3cc;
  --brand-3: #6d28d9;

  /* Surface - Clean light aesthetic */
  --bg:        #f1f5f9;  /* soft slate background */
  --surface:   #ffffff;  /* pure white surface */
  --surface-2: #f8fafc;  /* off-white surface */
  --surface-3: #e2e8f0;  /* light gray highlight */
  --border:    rgba(15, 23, 42, 0.07);
  --border-2:  rgba(15, 23, 42, 0.13);

  /* Text - Dark on light */
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  /* Theme-specific Component Mappings */
  --sidebar-bg:     rgba(255, 255, 255, 0.92);
  --sidebar-border: rgba(15, 23, 42, 0.08);
  --sidebar-glow:   radial-gradient(circle, rgba(0, 102, 255, 0.05) 0%, transparent 70%);
  --topbar-bg:      rgba(255, 255, 255, 0.85);
  
  --card-bg:        rgba(255, 255, 255, 0.90);
  --shadow-card:    0 4px 20px rgba(15, 23, 42, 0.06), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  
  --input-bg:       #ffffff;
  --input-border:   rgba(15, 23, 42, 0.12);
  --input-focus-bg: #ffffff;
  
  --thead-bg:       rgba(241, 245, 249, 0.8);

  /* Shadows - Soft & elevated */
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.06);
  --shadow-md: 0 8px 24px rgba(15,23,42,0.08);
  --shadow-lg: 0 16px 40px rgba(15,23,42,0.12);
  --shadow-brand: 0 8px 32px rgba(0,86,214,0.2);

  /* Glow - Soft colored glows */
  --glow-brand: 0 0 24px rgba(0,86,214,0.15);
}

/* Light mode stat color variants for high contrast readability */
html[data-theme="light"] .stat-indigo  { --stat-color: rgba(0, 102, 255, 0.12);  --stat-text-color: #0066ff; }
html[data-theme="light"] .stat-violet  { --stat-color: rgba(124, 58, 237, 0.12); --stat-text-color: #7c3aed; }
html[data-theme="light"] .stat-cyan    { --stat-color: rgba(6, 182, 212, 0.12);    --stat-text-color: #0891b2; }
html[data-theme="light"] .stat-emerald { --stat-color: rgba(16, 185, 129, 0.12);   --stat-text-color: #059669; }
html[data-theme="light"] .stat-amber   { --stat-color: rgba(245, 158, 11, 0.12);   --stat-text-color: #d97706; }
html[data-theme="light"] .stat-rose    { --stat-color: rgba(239, 68, 68, 0.12);    --stat-text-color: #e11d48; }

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.04) 0%, transparent 40%),
              var(--bg);
  background-attachment: fixed;
  color: var(--text-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
svg { display: block; flex-shrink: 0; }
img { display: block; max-width: 100%; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--brand-1); }

/* ── Layout Shell ──────────────────────────────────────────── */
.dashboard-page {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0; top: 0;
  z-index: 200;
  transition: transform var(--t-slow);
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: -60px; left: -60px;
  width: 200px; height: 200px;
  background: var(--sidebar-glow);
  pointer-events: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
}

.brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}

.brand-logo svg { width: 20px; height: 20px; color: white; }

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.3px;
}

.brand-tag {
  font-size: .65rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: .67rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-weight: 500;
  font-size: .9rem;
  transition: all var(--t);
  position: relative;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-1);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(139,92,246,.1));
  color: var(--brand-1);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(to bottom, var(--brand-1), var(--brand-2));
  border-radius: var(--r-full);
}

.nav-item .nav-icon {
  transition: transform var(--t), color var(--t);
}
.nav-item:hover .nav-icon {
  transform: scale(1.1);
}
.nav-item.active .nav-icon {
  color: var(--brand-1);
}

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: 8px;
}

.sidebar-user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .875rem; font-weight: 600; color: var(--text-1); truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.sidebar-user-role { font-size: .7rem; color: var(--text-3); }

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: rgba(244,63,94,.07);
  border: 1px solid rgba(244,63,94,.15);
  color: #e11d48;
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--t);
}

.btn-logout:hover {
  background: rgba(244,63,94,.12);
  border-color: rgba(244,63,94,.25);
}

.btn-logout svg { width: 16px; height: 16px; }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: transparent;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: var(--topbar-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.menu-toggle {
  display: none;
  padding: 6px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: all var(--t);
}
.menu-toggle:hover { background: var(--surface-2); color: var(--text-1); }
.menu-toggle svg { width: 20px; height: 20px; }

.topbar-page-title { font-size: 1rem; font-weight: 600; color: var(--text-1); }

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

.topbar-theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-2);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  transition: all var(--t);
}

.topbar-theme-toggle:hover {
  background: var(--surface-3);
  color: var(--text-1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.topbar-theme-toggle svg {
  width: 18px;
  height: 18px;
}

.topbar-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.topbar-badge-dot {
  width: 7px; height: 7px;
  border-radius: var(--r-full);
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { opacity: .5; box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

.topbar-badge-text { font-size: .78rem; font-weight: 500; color: var(--text-2); }

.topbar-admin {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t);
}

.topbar-admin:hover { border-color: var(--border-2); }

.topbar-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: white;
}

.topbar-admin-name { font-size: .85rem; font-weight: 600; color: var(--text-1); }
.topbar-admin-role { font-size: .7rem; color: var(--text-3); }

/* ── Page Content ──────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 28px 28px 40px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header-left {
  position: relative;
}

.page-header-left h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -.5px;
  line-height: 1.2;
}

.page-header-left h1::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2em;
  background: linear-gradient(to bottom, var(--brand-1), var(--brand-2));
  border-radius: var(--r-full);
  margin-right: 10px;
  vertical-align: middle;
}

.page-header-left p {
  font-size: .875rem;
  color: var(--text-2);
  margin-top: 4px;
  margin-left: 14px;
}

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

/* ── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all var(--t-slow);
  box-shadow: var(--shadow-card);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 102, 255, 0.12), transparent);
  pointer-events: none;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--stat-color, rgba(0, 102, 255, 0.04));
  filter: blur(20px);
  transform: translate(30px, -30px);
  pointer-events: none;
  opacity: 0.7;
  transition: opacity var(--t-slow);
}

.stat-card:hover {
  border-color: rgba(0, 102, 255, 0.18);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.stat-card:hover::after { opacity: 1; }

.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--stat-color, rgba(0, 102, 255, 0.15));
  color: var(--stat-text-color, var(--brand-1));
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  display: flex; align-items: center; gap: 3px;
}

.stat-badge.down { background: rgba(239,68,68,.12); color: var(--danger); }
.stat-badge.neutral { background: rgba(99,102,241,.12); color: var(--brand-1); }
.stat-badge svg { width: 10px; height: 10px; }

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}

.stat-value .counter-prefix {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-2);
  margin-right: 2px;
}

.stat-label { font-size: .825rem; color: var(--text-2); font-weight: 500; }
.stat-sub   { font-size: .75rem; color: var(--text-3); }

/* stat color variants */
.stat-indigo  { --stat-color: rgba(99,102,241,.15);  --stat-text-color: #818cf8; }
.stat-violet  { --stat-color: rgba(139,92,246,.15);   --stat-text-color: #a78bfa; }
.stat-cyan    { --stat-color: rgba(6,182,212,.15);    --stat-text-color: #22d3ee; }
.stat-emerald { --stat-color: rgba(16,185,129,.15);   --stat-text-color: #34d399; }
.stat-amber   { --stat-color: rgba(245,158,11,.15);   --stat-text-color: #fbbf24; }
.stat-rose    { --stat-color: rgba(239,68,68,.15);    --stat-text-color: #f87171; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  border-radius: var(--r-xl);
  padding: 24px;
  position: relative;
  transition: transform var(--t-slow), box-shadow var(--t-slow), border-color var(--t-slow);
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 102, 255, 0.1), transparent);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  pointer-events: none;
}

.card:hover {
  border-color: rgba(0, 102, 255, 0.15);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
}

.card-sub {
  font-size: .8rem;
  color: var(--text-2);
  margin-top: 2px;
}

/* ── Charts ────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }

.chart-wrap {
  position: relative;
  height: 280px;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table thead th {
  background: var(--thead-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-3);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.data-table thead th:first-child { border-radius: var(--r-md) 0 0 0; }
.data-table thead th:last-child  { border-radius: 0 var(--r-md) 0 0; }

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t), transform var(--t);
}

.data-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody td {
  padding: 12px 14px;
  color: var(--text-1);
  vertical-align: middle;
}

.text-muted { color: var(--text-2); font-size: .85rem; }
.text-center { text-align: center; }
.text-dim { color: var(--text-3); }

.table-empty {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--text-3);
  font-size: .9rem;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-success { background: rgba(16,185,129,.12);  color: #059669; }
.badge-warning { background: rgba(245,158,11,.12);   color: #d97706; }
.badge-danger  { background: rgba(244,63,94,.12);    color: #e11d48; }
.badge-primary { background: rgba(99,102,241,.12);   color: #4f46e5; }
.badge-info    { background: rgba(14,165,233,.12);   color: #0284c7; }
.badge-muted   { background: rgba(100,116,139,.1);   color: var(--text-2); }

/* No dot variant */
.badge.no-dot::before { display: none; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 600;
  transition: all var(--t);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,.3), inset 0 1px 1px rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-primary:hover { 
  box-shadow: 0 8px 24px rgba(99,102,241,.5), inset 0 1px 1px rgba(255,255,255,0.3); 
  transform: translateY(-2px) scale(1.02); 
  background: linear-gradient(135deg, #7174f8, #976bf8);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border-2);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-2); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }

.btn-danger {
  background: rgba(239,68,68,.12);
  color: #f87171;
  border-color: rgba(239,68,68,.2);
}
.btn-danger:hover { background: rgba(239,68,68,.2); }

.btn-success {
  background: rgba(34,197,94,.12);
  color: #4ade80;
  border-color: rgba(34,197,94,.2);
}
.btn-success:hover { background: rgba(34,197,94,.2); }

.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-lg { padding: 11px 22px; font-size: .95rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all var(--t);
  display: inline-flex; align-items: center; justify-content: center;
}

.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { background: var(--surface-3); color: var(--text-1); border-color: var(--border-2); }
.btn-icon.btn-icon-danger:hover { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.2); }
.btn-icon.btn-icon-primary:hover { background: rgba(99,102,241,.12); color: #818cf8; border-color: rgba(99,102,241,.2); }

/* ── Alerts / Notice Banners ───────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}
.alert-info {
  background: rgba(14,165,233,.1);
  border-color: rgba(14,165,233,.2);
  color: var(--info);
}
.alert-success {
  background: rgba(16,185,129,.1);
  border-color: rgba(16,185,129,.2);
  color: var(--success);
}
.alert-warning {
  background: rgba(245,158,11,.1);
  border-color: rgba(245,158,11,.2);
  color: var(--warning);
}
.alert-danger {
  background: rgba(244,63,94,.1);
  border-color: rgba(244,63,94,.2);
  color: var(--danger);
}
.alert-title {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

/* ── Breadcrumbs ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--text-3);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-2);
  transition: color var(--t);
}
.breadcrumb a:hover {
  color: var(--brand-1);
}
.breadcrumb-sep {
  color: var(--text-3);
  font-size: .7rem;
}
.breadcrumb-current {
  color: var(--text-1);
  font-weight: 600;
}

/* ── Loading spinner ────────────────────────────────────────── */
.btn-loader {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .2px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: .9rem;
  transition: all var(--t);
  outline: none;
}

.form-control:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(0,102,255,.15), inset 0 1px 2px rgba(15, 23, 42, 0.04);
  background: var(--input-focus-bg);
}

.form-control::placeholder { color: var(--text-3); }
.form-control:disabled { opacity: .5; cursor: not-allowed; }

.form-control.is-invalid,
.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(244,63,94,.12), inset 0 1px 2px rgba(15,23,42,0.04);
}
.form-control.is-valid {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16,185,129,.1), inset 0 1px 2px rgba(15,23,42,0.04);
}

.form-error {
  font-size: .75rem;
  color: var(--danger);
  font-weight: 500;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-error svg {
  width: 12px; height: 12px;
  flex-shrink: 0;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 10L12 15L17 10H7Z' fill='%238892aa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 34px;
  appearance: none;
}

select.form-control option { background: var(--surface-2); }

/* Input with icon */
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 38px; }
.input-icon-wrap .form-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

/* Grid form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ── Toolbar / Filters ─────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

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

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

.search-box .form-control { padding-left: 34px; }

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

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-info { font-size: .825rem; color: var(--text-2); }

.pagination-buttons { display: flex; gap: 6px; }

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all var(--t);
}

.pagination-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text-1); }
.pagination-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination-btn svg { width: 14px; height: 14px; }

/* ── Modals ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(6px);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--surface);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 520px;
  animation: modal-in .25s cubic-bezier(.34,1.56,.64,1);
  max-height: 90vh;
  overflow-y: auto;
}

html[data-theme="light"] .modal-box {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 1);
}

.modal-box.modal-lg { max-width: 680px; }
.modal-box.modal-sm { max-width: 380px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
  border: 1px solid var(--border);
}

.modal-close:hover { background: var(--surface-3); color: var(--text-1); }
.modal-close svg { width: 15px; height: 15px; }

.modal-body { padding: 18px 22px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 22px 20px;
}

/* ── Activity Feed ─────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; gap: 0; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.activity-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg { width: 16px; height: 16px; }
.activity-icon-checkin { background: rgba(6,182,212,.12); color: #22d3ee; }
.activity-icon-transaction { background: rgba(99,102,241,.12); color: #818cf8; }
.activity-icon-member { background: rgba(34,197,94,.12); color: #4ade80; }

.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: .875rem; color: var(--text-1); }
.activity-title strong { color: var(--text-1); }
.activity-time  { font-size: .75rem; color: var(--text-3); margin-top: 1px; }
.activity-amount { font-size: .8rem; font-weight: 600; color: #4ade80; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  width: fit-content;
}

.tab-btn {
  padding: 7px 16px;
  border-radius: var(--r-md);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--t);
  background: none;
}

.tab-btn.active {
  background: var(--surface-3);
  color: var(--text-1);
  box-shadow: var(--shadow-sm);
}

.tab-btn:hover:not(.active) { color: var(--text-1); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── NFC Scanner ───────────────────────────────────────────── */
.scanner-section {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
}

html[data-theme="light"] .scanner-section {
  background: linear-gradient(135deg, rgba(238,242,255,0.8) 0%, rgba(255,255,255,0.9) 100%);
  border: 1px solid rgba(99,102,241,0.12);
}

.scanner-visual {
  position: relative;
  width: 140px; height: 140px;
}

.scanner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--brand-1);
  opacity: .3;
  animation: ring-expand 2s ease-out infinite;
}

.scanner-ring:nth-child(2) { animation-delay: .7s; }
.scanner-ring:nth-child(3) { animation-delay: 1.4s; }

@keyframes ring-expand {
  0%    { transform: scale(.7); opacity: .5; }
  100%  { transform: scale(1.1); opacity: 0; }
}

.scanner-core {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.06));
  border: 2px solid rgba(99,102,241,.3);
  display: flex; align-items: center; justify-content: center;
}

.scanner-core svg { width: 44px; height: 44px; color: var(--brand-1); }

.scanner-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.status-dot.status-scanning { background: var(--brand-1); box-shadow: 0 0 8px var(--brand-1); animation: pulse-dot 1s ease-in-out infinite; }
.status-dot.status-success { background: var(--success); box-shadow: var(--glow-success); }
.status-dot.status-danger  { background: var(--danger);  box-shadow: var(--glow-danger); }
.status-dot.status-waiting { background: var(--text-3); }

.status-text { font-size: .875rem; color: var(--text-2); font-weight: 500; }

/* Member info card (check-in) */
.member-info-card {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 20px;
  display: none;
}

.member-info-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.member-avatar-lg {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; color: white;
  flex-shrink: 0;
}

.member-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.info-row { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: .7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.info-value { font-size: .875rem; color: var(--text-1); font-weight: 500; }

/* ── Report Summary Boxes ──────────────────────────────────── */
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.summary-box-label { font-size: .75rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.summary-box-value { font-size: 1.5rem; font-weight: 800; color: var(--text-1); margin-top: 4px; line-height: 1; }
.summary-box-value.success { color: #059669; }
.summary-box-value.warning { color: #d97706; }
.summary-box-value.danger  { color: #e11d48; }
.summary-box-value.brand   { color: var(--brand-1); }

/* activity amounts on light bg */
.activity-amount { font-size: .8rem; font-weight: 600; color: #059669; }

/* ── Detail Grid (modal) ───────────────────────────────────── */
.detail-list { display: flex; flex-direction: column; gap: 0; }

.detail-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-item:last-child { border-bottom: none; }
.detail-key { font-size: .8rem; color: var(--text-2); font-weight: 500; min-width: 120px; }
.detail-val { font-size: .875rem; color: var(--text-1); font-weight: 600; text-align: right; }

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--bg);
}

.login-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.login-right {
  width: 460px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--sidebar-border);
  box-shadow: -8px 0 40px rgba(0, 102, 255, 0.05);
}

@media (max-width: 768px) {
  .login-left { display: none; }
  .login-right { width: 100%; border: none; background: var(--bg); }
}

.login-deco {
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-deco-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .2;
  pointer-events: none;
}

.login-deco-orb-1 {
  width: 400px; height: 400px;
  background: var(--brand-1);
  top: -100px; left: -100px;
}

.login-deco-orb-2 {
  width: 300px; height: 300px;
  background: var(--brand-2);
  bottom: -80px; right: -80px;
  animation-delay: 5s;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
}

.login-brand-icon svg { width: 30px; height: 30px; color: white; }

.login-brand-text {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-tagline {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.35;
  margin-bottom: 12px;
}

.login-tagline span {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-desc { font-size: .9rem; color: var(--text-2); line-height: 1.7; max-width: 380px; margin: 0 auto; }

.login-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
  text-align: left;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  color: var(--text-2);
}

.login-feature-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: rgba(0, 102, 255, 0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-1);
  flex-shrink: 0;
}

.login-feature-icon svg { width: 14px; height: 14px; }

/* Login Form */
.login-form-wrap { width: 100%; max-width: 360px; }

.login-form-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 4px;
}

.login-form-sub { font-size: .875rem; color: var(--text-2); margin-bottom: 28px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.password-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  transition: color var(--t);
  display: flex;
}

.password-toggle:hover { color: var(--text-1); }
.password-toggle svg { width: 16px; height: 16px; }

.login-error {
  padding: 10px 14px;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--r-md);
  color: #f87171;
  font-size: .85rem;
  display: none;
}

.login-error.show { display: block; }

.login-footer-note {
  margin-top: 20px;
  text-align: center;
  font-size: .75rem;
  color: var(--text-3);
}

/* ── Skeleton Loading ──────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

/* ── Page transition ────────────────────────────────────────── */
.content-area {
  animation: page-in .4s cubic-bezier(.2,.8,.2,1);
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}

.skeleton-row td > div, .skeleton-text {
  height: 14px;
  width: 80%;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ── Success Modal / Overlay ───────────────────────────────── */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}

.success-overlay.active { display: flex; }

.success-box {
  background: #ffffff;
  border: 1px solid rgba(34,197,94,.25);
  border-radius: var(--r-2xl);
  padding: 40px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--glow-success), var(--shadow-lg);
  animation: modal-in .3s cubic-bezier(.34,1.56,.64,1);
}

.success-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(34,197,94,.12);
  border: 2px solid rgba(34,197,94,.3);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--success);
}

.success-icon svg { width: 36px; height: 36px; }
.success-title { font-size: 1.25rem; font-weight: 700; color: var(--text-1); margin-bottom: 8px; }
.success-msg { font-size: .9rem; color: var(--text-2); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

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

  .sidebar.active {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* Overlay backdrop when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active { display: block; }

  .menu-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .content-area { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 12px; height: 56px; }

  /* Sembunyikan badge & nama admin di mobile agar topbar tidak overflow */
  .topbar-badge { display: none; }
  .topbar-admin-name,
  .topbar-admin-role { display: none; }
  .topbar-admin { padding: 4px; }

  /* Sembunyikan topbar-badge-text, cukup tampilkan dot */
  .topbar-badge-text { display: none; }

  /* Charts stacking */
  .charts-row { grid-template-columns: 1fr; }

  /* Page header stack */
  .page-header { flex-direction: column; gap: 10px; }
  .page-header-right { width: 100%; }

  /* Toolbar wrap */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .search-box { min-width: 0; width: 100%; }

  /* Modal full width on mobile */
  .modal-box, .modal-box.modal-lg { max-width: calc(100vw - 32px); }

  /* Form rows single column */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }

  /* Table horizontal scroll */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* Tabs scrollable */
  .tabs { width: 100%; overflow-x: auto; }

  /* Login page */
  .login-left { display: none; }
  .login-right { width: 100%; border: none; background: var(--bg); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content-area { padding: 12px; }
  .card { padding: 16px; }
  .topbar-page-title { font-size: .9rem; }

  /* Stat card compact */
  .stat-value { font-size: 1.5rem; }

  /* Scanner section */
  .scanner-section { padding: 16px; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn { padding: 7px 12px; font-size: .8rem; }
  .topbar { padding: 0 8px; }
}

/* ── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  pointer-events: auto;
  animation: toast-in .35s cubic-bezier(.34,1.56,.64,1);
  max-width: 400px;
  min-width: 280px;
}

.toast.toast-exit {
  animation: toast-out .25s ease-in forwards;
}

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

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-message {
  flex: 1;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.4;
}

.toast-close {
  width: 20px; height: 20px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--t);
}
.toast-close:hover { color: var(--text-1); background: var(--surface-3); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px) scale(.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(.95); }
}

html[data-theme="light"] .toast {
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 16px 40px rgba(15,23,42,0.12);
}

/* ── Tooltip ────────────────────────────────────────────────── */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(.9);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-1);
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--t);
}
.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ── Copy button ────────────────────────────────────────────── */
.copy-btn {
  cursor: pointer;
  transition: all var(--t);
}
.copy-btn:active { transform: scale(.9); }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}

.empty-state-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  color: var(--text-3);
}

.empty-state-icon svg { width: 26px; height: 26px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; color: var(--text-3); }

/* ── Misc Utilities ────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ── NFC Bridge Status Indicator ──────────────────────────── */
.dot-online {
  background: var(--success) !important;
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
.dot-offline {
  background: var(--danger) !important;
  box-shadow: none;
}