/* ==========================================================================
   STARNET HUB — PROFESSIONAL MOBILE-FIRST STYLESHEET
   Optimized for native app experience on 320px–1440px+ viewports
   Design System: Design Tokens + Glassmorphism + Micro-animations
   ========================================================================== */

/* ─────────────────────────────────────────────
   DESIGN TOKENS & CSS VARIABLES
   ───────────────────────────────────────────── */
:root {
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Safe Area (iOS notch / Dynamic Island / Android home bar) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Border radius */
  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.125rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 1.875rem;
  --radius-full: 9999px;

  /* Touch targets */
  --touch-target: 44px;

  /* Transition */
  --transition-fast: 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.35s cubic-bezier(0.16, 1, 0.3, 1);

  /* ── DARK MODE PALETTE (Default) ── */
  --color-bg:          #050d1a;
  --color-bg-nav:      rgba(8, 15, 30, 0.92);
  --color-bg-card:     rgba(12, 22, 42, 0.82);
  --color-bg-card-alt: #0d1a30;
  --color-bg-hover:    rgba(30, 45, 70, 0.7);
  --color-bg-input:    rgba(8, 18, 35, 0.9);
  --color-bg-elevated: #0f1e38;

  --color-border:      rgba(255, 255, 255, 0.07);
  --color-border-subtle: rgba(255, 255, 255, 0.12);
  --color-border-strong: rgba(255, 255, 255, 0.18);

  --color-text-primary:   #f0f4ff;
  --color-text-secondary: #8fa3c8;
  --color-text-muted:     #566a8a;
  --color-text-label:     #6b82a4;

  --color-primary:     #5b61f4;
  --color-primary-h:   #4a50e8;
  --color-primary-glow: rgba(91, 97, 244, 0.28);
  --color-primary-soft: rgba(91, 97, 244, 0.12);

  --color-success:     #10c784;
  --color-success-h:   #0ea872;
  --color-success-glow: rgba(16, 199, 132, 0.22);
  --color-success-soft: rgba(16, 199, 132, 0.1);

  --color-warning:     #f5a623;
  --color-warning-soft: rgba(245, 166, 35, 0.12);

  --color-danger:      #f04438;
  --color-danger-soft: rgba(240, 68, 56, 0.12);

  --color-cyan:        #06c7e8;
  --color-purple:      #a855f7;
  --color-amber:       #f59e0b;

  /* Shadows */
  --shadow-sm:  0 2px 8px -2px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 6px 20px -4px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 12px 36px -6px rgba(0, 0, 0, 0.5);
  --shadow-xl:  0 24px 60px -10px rgba(0, 0, 0, 0.6);
  --shadow-primary: 0 6px 24px -4px var(--color-primary-glow);
  --shadow-success: 0 6px 24px -4px var(--color-success-glow);
}

/* ── LIGHT MODE OVERRIDES ── */
html.light {
  --color-bg:           #f0f4fb;
  --color-bg-nav:       rgba(255, 255, 255, 0.96);
  --color-bg-card:      #ffffff;
  --color-bg-card-alt:  #f5f8ff;
  --color-bg-hover:     #eef2fb;
  --color-bg-input:     #ffffff;
  --color-bg-elevated:  #ffffff;

  --color-border:       rgba(0, 0, 0, 0.07);
  --color-border-subtle: rgba(0, 0, 0, 0.1);
  --color-border-strong: rgba(0, 0, 0, 0.15);

  --color-text-primary:   #0d1b33;
  --color-text-secondary: #3d5270;
  --color-text-muted:     #6b7fa0;
  --color-text-label:     #5a6e8e;

  --color-primary-soft: rgba(91, 97, 244, 0.1);
  --color-success-soft: rgba(16, 199, 132, 0.1);
  --color-warning-soft: rgba(245, 166, 35, 0.1);
  --color-danger-soft:  rgba(240, 68, 56, 0.1);

  --shadow-sm:  0 1px 4px rgba(0, 0, 0, 0.06), 0 2px 8px -2px rgba(0, 0, 0, 0.05);
  --shadow-md:  0 4px 16px -4px rgba(0, 0, 0, 0.1);
  --shadow-lg:  0 8px 28px -6px rgba(0, 0, 0, 0.12);
  --shadow-xl:  0 16px 48px -10px rgba(0, 0, 0, 0.14);
}

/* ─────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  touch-action: manipulation;
  height: 100%;
  scroll-behavior: smooth;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--color-text-primary);
}

p, span, div {
  line-height: 1.55;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

/* ─────────────────────────────────────────────
   FONT SCALING SYSTEM
   ───────────────────────────────────────────── */
html[data-font="normal"] { font-size: 15px; }
html[data-font="large"]  { font-size: 17px; }
html[data-font="xlarge"] { font-size: 19px; }

html[data-font="large"] .text-xs   { font-size: 0.82rem !important; }
html[data-font="large"] .text-sm   { font-size: 0.96rem !important; }
html[data-font="large"] .text-base { font-size: 1.12rem !important; }
html[data-font="large"] .text-lg   { font-size: 1.28rem !important; }
html[data-font="large"] .text-xl   { font-size: 1.46rem !important; }
html[data-font="large"] .text-2xl  { font-size: 1.7rem !important; }

html[data-font="xlarge"] .text-xs   { font-size: 0.92rem !important; }
html[data-font="xlarge"] .text-sm   { font-size: 1.06rem !important; }
html[data-font="xlarge"] .text-base { font-size: 1.22rem !important; }
html[data-font="xlarge"] .text-lg   { font-size: 1.4rem !important; }
html[data-font="xlarge"] .text-xl   { font-size: 1.62rem !important; }
html[data-font="xlarge"] .text-2xl  { font-size: 1.9rem !important; }

/* ─────────────────────────────────────────────
   SCROLLBAR
   ───────────────────────────────────────────── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ─────────────────────────────────────────────
   LIGHT MODE: GLOBAL OVERRIDES FOR TAILWIND
   These ensure correct contrast when .light is applied
   ───────────────────────────────────────────── */
html.light body { background-color: #f0f4fb !important; color: #0d1b33 !important; }

html.light [class*="bg-slate-950"],
html.light .bg-slate-950 { background-color: #eef2fa !important; }
html.light [class*="bg-slate-900"],
html.light .bg-slate-900 { background-color: #ffffff !important; }
html.light [class*="bg-slate-800"],
html.light .bg-slate-800 { background-color: #eff2f9 !important; border-color: #dce3f0 !important; }

html.light [class*="bg-indigo-950"],
html.light .bg-indigo-950 { background-color: #eef1ff !important; border-color: #c7d2fe !important; }
html.light [class*="bg-emerald-950"],
html.light .bg-emerald-950 { background-color: #ecfdf5 !important; border-color: #a7f3d0 !important; }
html.light [class*="bg-amber-950"],
html.light .bg-amber-950  { background-color: #fffbeb !important; border-color: #fde68a !important; }

html.light [class*="border-slate-800"],
html.light [class*="border-slate-700"],
html.light .border-slate-800,
html.light .border-slate-700 { border-color: #dce3f0 !important; }

html.light [class*="text-white"],  html.light .text-white  { color: #0d1b33 !important; }
html.light [class*="text-slate-100"], html.light [class*="text-slate-200"],
html.light .text-slate-100, html.light .text-slate-200 { color: #1a2e4a !important; }
html.light [class*="text-slate-300"], html.light [class*="text-slate-400"],
html.light .text-slate-300, html.light .text-slate-400 { color: #3d5270 !important; }
html.light [class*="text-slate-500"], html.light .text-slate-500 { color: #5a6e8e !important; }

html.light [class*="text-indigo-300"],
html.light [class*="text-indigo-400"] { color: #4338ca !important; }
html.light [class*="text-emerald-300"],
html.light [class*="text-emerald-400"] { color: #047857 !important; }
html.light [class*="text-amber-300"],
html.light [class*="text-amber-400"]  { color: #b45309 !important; }
html.light [class*="text-cyan-300"],
html.light [class*="text-cyan-400"]   { color: #0e7490 !important; }

/* ─────────────────────────────────────────────
   GLASSMORPHISM CARD
   ───────────────────────────────────────────── */
.glass-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

html.light .glass-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
  box-shadow: 0 2px 12px -2px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.03) !important;
}

/* ─────────────────────────────────────────────
   TOP NAVIGATION BAR
   ───────────────────────────────────────────── */
#top-nav {
  background: var(--color-bg-nav);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 var(--color-border), 0 4px 16px -4px rgba(0,0,0,0.2);
  transition: background var(--transition-slow);
  padding-top: max(0px, var(--sat));
}

html.light #top-nav {
  background: rgba(255, 255, 255, 0.97) !important;
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 4px 12px -4px rgba(0,0,0,0.06) !important;
}

/* ── Nav Tab Bar (Desktop/Tablet) ── */
#nav-tabs {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab-item {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  min-height: var(--touch-target);
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  background: transparent;
}

.nav-tab-item:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
  border-color: var(--color-border-subtle);
}

.nav-tab-item.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--color-primary) 0%, #3b4fd8 100%);
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}

html.light .nav-tab-item.active {
  color: #ffffff !important;
}

/* Burger dropdown */
#user-dropdown {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  min-width: 220px;
}

html.light #user-dropdown {
  background: #ffffff !important;
  border-color: rgba(0,0,0,0.1) !important;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.15) !important;
}

#user-dropdown button {
  min-height: var(--touch-target);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  width: 100%;
}

#user-dropdown button:hover {
  background: var(--color-bg-hover) !important;
}

html.light #user-dropdown button { color: #1a2e4a !important; }
html.light #user-dropdown button:hover { background-color: #f0f4fb !important; }

/* ─────────────────────────────────────────────
   MOBILE BOTTOM NAVIGATION BAR
   ───────────────────────────────────────────── */
#mobile-nav {
  background: var(--color-bg-nav);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border-top: 1px solid var(--color-border-subtle);
  box-shadow: 0 -4px 24px -4px rgba(0,0,0,0.3), 0 -1px 0 var(--color-border);
  padding-bottom: max(0.5rem, var(--sab));
  min-height: calc(60px + var(--sab));
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-left: max(0.5rem, var(--sal));
  padding-right: max(0.5rem, var(--sar));
}

html.light #mobile-nav {
  background: rgba(255, 255, 255, 0.97) !important;
  border-top-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 -2px 16px -4px rgba(0,0,0,0.08) !important;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0.3rem 0.6rem 0.2rem;
  border-radius: var(--radius-md);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
  touch-action: manipulation;
  min-width: 52px;
  min-height: var(--touch-target);
  position: relative;
  border: none;
  background: transparent;
  letter-spacing: 0.01em;
}

.mobile-nav-item i {
  font-size: 1.15rem;
  transition: transform var(--transition-base), color var(--transition-fast);
  line-height: 1;
}

.mobile-nav-item:active {
  transform: scale(0.9);
}

.mobile-nav-item.active {
  color: var(--color-primary);
}

html.light .mobile-nav-item.active { color: #4338ca; }

.mobile-nav-item.active i {
  transform: translateY(-3px) scale(1.08);
  color: var(--color-primary);
}

html.light .mobile-nav-item.active i { color: #4338ca; }

/* Active indicator dot */
.mobile-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
}

html.light .mobile-nav-item.active::after { background: #4338ca; }

/* FAB (Floating Action Button in Nav Bar) */
.mobile-nav-fab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: -20px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 50;
  touch-action: manipulation;
  gap: 3px;
}

.fab-icon-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--color-success) 0%, var(--color-success-h) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 6px 20px var(--color-success-glow), 0 2px 6px rgba(0,0,0,0.15);
  border: 2.5px solid var(--color-bg);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.mobile-nav-fab:active .fab-icon-wrapper {
  transform: scale(0.88);
  box-shadow: 0 3px 10px var(--color-success-glow);
}

.mobile-nav-fab span {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--color-success);
  line-height: 1;
  letter-spacing: 0.01em;
}

/* ─────────────────────────────────────────────
   MAIN CONTENT
   ───────────────────────────────────────────── */
#main-content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 0.875rem 6.5rem;
}

@media (min-width: 640px) {
  #main-content {
    padding: 1.5rem 1.5rem 2rem;
  }
}

@media (min-width: 1024px) {
  #main-content {
    padding: 2rem 2rem 2.5rem;
  }
}

/* ─────────────────────────────────────────────
   FORM CONTROLS
   ───────────────────────────────────────────── */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--color-bg-input);
  border: 1.5px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  color: var(--color-text-primary);
  font-size: 16px; /* Prevents iOS auto-zoom */
  min-height: var(--touch-target);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 640px) {
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 0.875rem;
    min-height: 42px;
    padding: 0.65rem 0.9rem;
  }
}

html.light .form-input,
html.light .form-select,
html.light .form-textarea {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0d1b33 !important;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-soft) !important;
  background: var(--color-bg-elevated);
}

html.light .form-input:focus,
html.light .form-select:focus,
html.light .form-textarea:focus {
  background: #fff !important;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.8;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b82a4' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.2rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Form label */
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-label);
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
}

/* Form group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Input with icon */
.input-icon-wrap {
  position: relative;
}
.input-icon-wrap .icon-left {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  pointer-events: none;
  line-height: 1;
}
.input-icon-wrap .form-input { padding-left: 2.4rem; }

/* ─────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1.2rem;
  min-height: var(--touch-target);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  border: 1.5px solid transparent;
  touch-action: manipulation;
  user-select: none;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.95); }
.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
}

.btn-sm {
  padding: 0.5rem 0.9rem;
  font-size: 0.78rem;
  min-height: 36px;
  border-radius: var(--radius-sm);
  gap: 0.35rem;
}

.btn-lg {
  padding: 0.9rem 1.6rem;
  font-size: 1rem;
  min-height: 52px;
  border-radius: var(--radius-lg);
}

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4248e0 100%);
  color: #fff !important;
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-h) 0%, #3940d4 100%);
  box-shadow: 0 8px 28px -4px var(--color-primary-glow);
}

/* Success */
.btn-success {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-h) 100%);
  color: #fff !important;
  border-color: transparent;
  box-shadow: var(--shadow-success);
}
.btn-success:hover {
  box-shadow: 0 8px 28px -4px var(--color-success-glow);
  filter: brightness(1.05);
}

/* Danger */
.btn-danger {
  background: linear-gradient(135deg, #e03c32 0%, var(--color-danger) 100%);
  color: #fff !important;
  border-color: transparent;
}
.btn-danger:hover { filter: brightness(1.08); }

/* Secondary */
.btn-secondary {
  background: var(--color-bg-card-alt);
  color: var(--color-text-secondary);
  border-color: var(--color-border-subtle);
}
html.light .btn-secondary {
  background: #eff2f9 !important;
  color: #1a2e4a !important;
  border-color: #d0d9ec !important;
}
.btn-secondary:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}
html.light .btn-secondary:hover {
  background: #e3e9f5 !important;
  color: #0d1b33 !important;
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* Warning */
.btn-warning {
  background: linear-gradient(135deg, #e8951c 0%, var(--color-warning) 100%);
  color: #fff !important;
  border-color: transparent;
}

/* Icon-only button */
.btn-icon {
  padding: 0;
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: var(--radius-md);
}
.btn-icon.btn-sm {
  width: 36px;
  height: 36px;
}

/* ─────────────────────────────────────────────
   STATUS BADGES
   ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-success {
  background: var(--color-success-soft);
  color: var(--color-success);
  border: 1px solid rgba(16, 199, 132, 0.25);
}
html.light .badge-success {
  color: #047857; background: #d1fae5; border-color: #a7f3d0;
}

.badge-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
html.light .badge-warning {
  color: #d97706; background: #fef3c7; border-color: #fde68a;
}

.badge-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid rgba(240, 68, 56, 0.25);
}
html.light .badge-danger {
  color: #dc2626; background: #fee2e2; border-color: #fecaca;
}

.badge-indigo {
  background: var(--color-primary-soft);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
html.light .badge-indigo {
  color: #4f46e5; background: #e0e7ff; border-color: #c7d2fe;
}

.badge-cyan {
  background: rgba(6, 199, 232, 0.1);
  color: var(--color-cyan);
  border: 1px solid rgba(6, 199, 232, 0.25);
}

.badge-neutral {
  background: var(--color-bg-card-alt);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-subtle);
}

/* ─────────────────────────────────────────────
   STAT CARDS
   ───────────────────────────────────────────── */
.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1rem;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

@media (min-width: 640px) {
  .stat-card { padding: 1.1rem 1.25rem; }
}

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

html.light .stat-card {
  background: #ffffff !important;
  border-color: rgba(0,0,0,0.07) !important;
  box-shadow: 0 2px 8px -2px rgba(0,0,0,0.06) !important;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 0.3rem;
}

/* Glow variants */
.glow-primary { box-shadow: 0 0 0 1px rgba(91,97,244,0.2), 0 8px 24px -4px var(--color-primary-glow); }
.glow-success  { box-shadow: 0 0 0 1px rgba(16,199,132,0.2), 0 8px 24px -4px var(--color-success-glow); }

/* ─────────────────────────────────────────────
   DATA TABLES — Mobile-responsive
   ───────────────────────────────────────────── */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 480px; /* Forces scroll on small screens */
}

.custom-table th {
  background: var(--color-bg-card-alt);
  color: var(--color-text-label);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
  text-align: left;
  white-space: nowrap;
}

html.light .custom-table th {
  background: #f5f8ff !important;
  color: #5a6e8e !important;
  border-color: #dce3f0 !important;
}

.custom-table td {
  padding: 0.82rem 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  vertical-align: middle;
}

html.light .custom-table td {
  border-color: #eef2fa !important;
  color: #1a2e4a !important;
}

.custom-table tbody tr {
  transition: background var(--transition-fast);
}
.custom-table tbody tr:hover td {
  background: var(--color-bg-hover);
}
html.light .custom-table tbody tr:hover td {
  background: #f5f8ff !important;
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

/* Mobile card view for tables */
@media (max-width: 639px) {
  .custom-table th,
  .custom-table td { padding: 0.65rem 0.8rem; font-size: 0.78rem; }
  .custom-table th  { font-size: 0.65rem; }
}

/* ─────────────────────────────────────────────
   MODAL & BOTTOM SHEET SYSTEM
   ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 8, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-handle { display: none; }

.modal-content-card {
  width: 100%;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: auto;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
}

/* Mobile: Bottom Sheet */
@media (max-width: 639px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    justify-content: stretch;
    background: rgba(3, 8, 20, 0.82);
  }

  .sheet-handle {
    display: block;
    width: 38px;
    height: 4px;
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
    margin: 0 auto 0.9rem;
    flex-shrink: 0;
  }

  .modal-content-card {
    max-height: calc(90dvh - var(--sat));
    padding: 1.1rem 0.9rem max(1.2rem, var(--sab)) !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: var(--radius-2xl) !important;
    border-top-right-radius: var(--radius-2xl) !important;
    border-bottom: none !important;
    margin: 0 !important;
    animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    box-shadow: 0 -12px 48px rgba(0,0,0,0.5) !important;
    width: 100%;
  }
}

/* ─────────────────────────────────────────────
   SECTION HEADERS
   ───────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

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

.section-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   LIST ITEM (replaces row tables on mobile)
   ───────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
  cursor: pointer;
  touch-action: manipulation;
}

.list-item:hover,
.list-item:active { background: var(--color-bg-hover); }

.list-item + .list-item {
  border-top: 1px solid var(--color-border);
  border-radius: 0;
}

.list-item:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.list-item:last-child  { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.list-item:only-child  { border-radius: var(--radius-lg); }

/* ─────────────────────────────────────────────
   AVATAR / ICON BADGE
   ───────────────────────────────────────────── */
.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.avatar-lg {
  width: 3rem;
  height: 3rem;
  font-size: 1.1rem;
}

.icon-badge {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   ANIMATIONS & TRANSITIONS
   ───────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInFast {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slideUpSheet {
  from { opacity: 0.7; transform: translateY(100%); }
  to   { opacity: 1;   transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 199, 132, 0); }
  50%       { box-shadow: 0 0 0 6px rgba(16, 199, 132, 0); }
}

.animate-fadeIn   { animation: fadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-slideUp  { animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-slideDown { animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-sheet    { animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ─────────────────────────────────────────────
   SKELETON LOADING STATES
   ───────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-card-alt) 25%,
    var(--color-bg-hover) 50%,
    var(--color-bg-card-alt) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}

html.light .skeleton {
  background: linear-gradient(
    90deg,
    #e8edf6 25%,
    #f0f4fd 50%,
    #e8edf6 75%
  ) !important;
  background-size: 200% 100% !important;
}

.skeleton-text   { height: 0.875rem; width: 100%; }
.skeleton-title  { height: 1.25rem; width: 65%; }
.skeleton-circle { border-radius: var(--radius-full); aspect-ratio: 1; }

/* ─────────────────────────────────────────────
   TOAST NOTIFICATIONS
   ───────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: max(1.25rem, calc(var(--sab) + 5rem));
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 340px;
  width: calc(100% - 2rem);
  pointer-events: none;
}

@media (min-width: 640px) {
  #toast-container {
    bottom: 1.5rem;
    max-width: 380px;
  }
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: opacity 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(8px);
  line-height: 1.4;
}

/* ─────────────────────────────────────────────
   PWA INSTALL BANNER
   ───────────────────────────────────────────── */
.pwa-install-banner {
  background: linear-gradient(135deg, rgba(15, 20, 50, 0.97) 0%, rgba(10, 18, 40, 0.97) 100%);
  border: 1px solid rgba(91, 97, 244, 0.35);
  border-radius: var(--radius-xl);
  padding: 0.875rem 1rem;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(91,97,244,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  backdrop-filter: blur(16px);
}

html.light .pwa-install-banner {
  background: linear-gradient(135deg, #eef1ff 0%, #fff 100%) !important;
  border-color: #c7d2fe !important;
}

/* ─────────────────────────────────────────────
   LOGO TRANSITION / LOADING INDICATOR
   ───────────────────────────────────────────── */
@keyframes rotateLoader {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes logoBreathe {
  0%   { transform: scale(0.9); opacity: 0.82; filter: drop-shadow(0 0 5px rgba(91,97,244,0.4)); }
  100% { transform: scale(1.06); opacity: 1;    filter: drop-shadow(0 0 16px rgba(6,199,232,0.7)); }
}

.logo-loader-ring {
  background: conic-gradient(from 0deg, var(--color-primary), var(--color-cyan), var(--color-success), var(--color-primary));
  animation: rotateLoader 1.5s linear infinite;
}

.logo-loader-pulse {
  animation: logoBreathe 1.7s ease-in-out infinite alternate;
}

/* ─────────────────────────────────────────────
   LOGO UPLOAD & PREVIEW
   ───────────────────────────────────────────── */
.logo-checkerboard {
  background-color: #1a2a44;
  background-image:
    linear-gradient(45deg, #0d1a30 25%, transparent 25%),
    linear-gradient(-45deg, #0d1a30 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0d1a30 75%),
    linear-gradient(-45deg, transparent 75%, #0d1a30 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

html.light .logo-checkerboard {
  background-color: #e8edf6;
  background-image:
    linear-gradient(45deg, #d0d9ec 25%, transparent 25%),
    linear-gradient(-45deg, #d0d9ec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d9ec 75%),
    linear-gradient(-45deg, transparent 75%, #d0d9ec 75%) !important;
}

.thermal-logo {
  max-height: 40px;
  max-width: 85%;
  margin: 0 auto 6px;
  display: block;
  object-fit: contain;
}

.a4-voucher-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   THERMAL RECEIPT SIMULATOR
   ───────────────────────────────────────────── */
.thermal-slip-preview {
  background: #fff;
  color: #000;
  width: 280px;
  margin: 0 auto;
  padding: 14px 12px;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border-radius: 4px;
}

/* ─────────────────────────────────────────────
   UTILITY CLASSES
   ───────────────────────────────────────────── */

/* Text utilities */
.text-primary-color { color: var(--color-text-primary); }
.text-secondary-color { color: var(--color-text-secondary); }
.text-muted-color { color: var(--color-text-muted); }

/* Truncate */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.75rem 0;
}

/* Clickable row */
.row-clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
  border-radius: var(--radius-md);
}
.row-clickable:hover { background: var(--color-bg-hover); }

/* Safe area spacer */
.safe-bottom { padding-bottom: max(1rem, var(--sab)); }

/* Cards with inner depth */
.card-inner {
  background: var(--color-bg-card-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.875rem;
}

html.light .card-inner {
  background: #f5f8ff !important;
  border-color: #dce3f0 !important;
}

/* Alert / info boxes */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.82rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  line-height: 1.5;
}

.alert-warning {
  background: var(--color-warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-warning);
}

.alert-success {
  background: var(--color-success-soft);
  border: 1px solid rgba(16, 199, 132, 0.3);
  color: var(--color-success);
}

.alert-danger {
  background: var(--color-danger-soft);
  border: 1px solid rgba(240, 68, 56, 0.3);
  color: var(--color-danger);
}

.alert-info {
  background: var(--color-primary-soft);
  border: 1px solid rgba(91, 97, 244, 0.25);
  color: #a5b4fc;
}

html.light .alert-warning { color: #b45309; }
html.light .alert-success  { color: #047857; }
html.light .alert-danger   { color: #dc2626; }
html.light .alert-info     { color: #4338ca; }

/* Search input */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-bg-input);
  border: 1.5px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  padding: 0.55rem 0.875rem;
  min-height: var(--touch-target);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-size: 0.875rem;
  width: 100%;
  font-family: var(--font-sans);
}

.search-bar input::placeholder { color: var(--color-text-muted); }

html.light .search-bar { background: #fff; border-color: #d0d9ec; }
html.light .search-bar input { color: #0d1b33; }

/* ─────────────────────────────────────────────
   THEME STATUS BADGE OVERRIDES
   ───────────────────────────────────────────── */
html.light #theme-status-badge {
  background-color: #e8edf6 !important;
  color: #334155 !important;
  border-color: #c5d0e4 !important;
}

/* ─────────────────────────────────────────────
   PRINT STYLESHEET
   ───────────────────────────────────────────── */
@media print {
  body, html {
    background: #fff !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #top-nav, #mobile-nav, #main-content, #modal-container,
  #toast-container, #topup-toast-container, #pwa-floating-install-banner {
    display: none !important;
  }

  #print-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .thermal-print-page {
    width: 58mm;
    margin: 0 auto;
    padding: 2mm 1mm;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: #000;
    line-height: 1.2;
    page-break-after: always;
    text-align: center;
  }

  .thermal-80mm { width: 76mm !important; font-size: 12px !important; }
}

/* ─────────────────────────────────────────────
   RESPONSIVE HELPERS
   ───────────────────────────────────────────── */
@media (max-width: 639px) {
  .glass-card, .stat-card, .card-inner { max-width: 100%; }
  .mobile-stack { flex-direction: column !important; }
  .mobile-full { width: 100% !important; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .tablet-2col { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .desktop-3col { grid-template-columns: repeat(3, 1fr); }
  .desktop-4col { grid-template-columns: repeat(4, 1fr); }
  .desktop-5col { grid-template-columns: repeat(5, 1fr); }
}

/* ══════════════════════════════════════════════════════
   ✨ MICRO-INTERACTIONS & ANIMATION SYSTEM UPGRADE
   ══════════════════════════════════════════════════════ */

/* ── Ripple Effect ── */
.ripple-host {
  position: relative;
  overflow: hidden;
}
.ripple-host::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  width: 0;
  height: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}
.ripple-host:active::after {
  width: 160%;
  height: 160%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
}

/* ── Card Hover Lift ── */
.card-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  cursor: pointer;
}
.card-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.4);
  border-color: var(--color-border-strong) !important;
}
.card-lift:active {
  transform: translateY(-1px) scale(0.985);
}

/* ── Stat Card Animated Counter ── */
.stat-val-animated {
  display: inline-block;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-val-animated.updating {
  transform: translateY(-8px);
  opacity: 0;
}

/* ── Tab Transition ── */
@keyframes tabSlideIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes tabSlideInLeft {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
.tab-enter {
  animation: tabSlideIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.tab-enter-left {
  animation: tabSlideInLeft 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Tab Active Indicator (sliding underline) ── */
.nav-tab-item {
  position: relative;
}
.nav-tab-item.active::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.5);
  display: none; /* shown only in underline mode */
}

/* ── Notification Bell ── */
.notif-bell-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-bg-nav);
  animation: notifPop 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  line-height: 1;
}
@keyframes notifPop {
  from { transform: scale(0) rotate(-12deg); }
  to   { transform: scale(1) rotate(0deg); }
}
.notif-bell-icon {
  display: inline-block;
  animation: bellRing 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes bellRing {
  0%, 100% { transform: rotate(0deg); }
  20%  { transform: rotate(12deg); }
  40%  { transform: rotate(-10deg); }
  60%  { transform: rotate(7deg); }
  80%  { transform: rotate(-4deg); }
}

/* ── Notification Dropdown Panel ── */
.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(340px, calc(100vw - 1rem));
  max-height: 420px;
  overflow-y: auto;
  border-radius: var(--radius-xl);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-xl);
  z-index: 60;
  animation: fadeIn 0.2s ease both;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
  cursor: pointer;
}
.notif-item:hover { background: var(--color-bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--color-primary-soft); }
.notif-item.unread:hover { background: rgba(91,97,244,0.18); }
.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  margin-top: 5px;
}

/* ── Voucher Card (Mobile-first replacing table rows) ── */
.voucher-card {
  background: var(--color-bg-card-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.voucher-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
}
.voucher-card.status-active  { border-left: 3px solid var(--color-success); }
.voucher-card.status-used    { border-left: 3px solid var(--color-warning); }
.voucher-card.status-sold    { border-left: 3px solid var(--color-primary); }
.voucher-card.status-expired { border-left: 3px solid var(--color-danger); }
.voucher-card.status-unused  { border-left: 3px solid var(--color-border-strong); }

/* Voucher code display */
.voucher-code-display {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--color-text-primary);
  line-height: 1;
  user-select: all;
  -webkit-user-select: all;
}

/* ── Copy Button with Tooltip ── */
.copy-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--color-bg-hover);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  touch-action: manipulation;
}
.copy-btn:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: #a5b4fc;
}
.copy-btn:active { transform: scale(0.93); }
.copy-btn .copy-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-success);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateX(-50%) translateY(4px);
}
.copy-btn.copied .copy-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.copy-btn.copied {
  background: var(--color-success-soft) !important;
  border-color: var(--color-success) !important;
  color: var(--color-success) !important;
}

/* ── Animated Counter Rollup ── */
@keyframes countRoll {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.count-animated {
  display: inline-block;
  animation: countRoll 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--color-bg-card-alt);
  border: 1.5px solid var(--color-border-subtle);
  cursor: pointer;
  transition: background var(--transition-base), border-color var(--transition-base);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-base);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track::before {
  transform: translateX(18px);
}

/* ── Inline Form Validation ── */
.form-input.valid,
.form-select.valid {
  border-color: var(--color-success) !important;
  box-shadow: 0 0 0 3px var(--color-success-soft) !important;
}
.form-input.invalid,
.form-select.invalid {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 3px var(--color-danger-soft) !important;
}
.field-error {
  color: var(--color-danger);
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  animation: fadeIn 0.2s ease both;
}
.field-error::before {
  content: '\f06a'; /* fa-circle-exclamation */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.7rem;
}
@keyframes shakeInput {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}
.shake { animation: shakeInput 0.4s ease both; }

/* ── Success State Animation ── */
@keyframes successBounce {
  0%   { transform: scale(0) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.25) rotate(4deg); opacity: 1; }
  80%  { transform: scale(0.9) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.success-icon {
  animation: successBounce 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Confetti pieces */
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(80px) rotate(360deg); opacity: 0; }
}
.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall 0.8s ease-out both;
  pointer-events: none;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  gap: 0.875rem;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: var(--color-bg-card-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.empty-state-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}
.empty-state-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  max-width: 240px;
  line-height: 1.5;
}

/* ── Custom Confirm Dialog ── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3,8,20,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.confirm-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  max-width: 320px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: confirmPop 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes confirmPop {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
.confirm-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 1rem;
}
html.light .confirm-card {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
}

/* ── Progress Stepper ── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
}
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--color-bg-card-alt);
  border: 2px solid var(--color-border-subtle);
  color: var(--color-text-muted);
  transition: all var(--transition-base);
  flex-shrink: 0;
}
.step-dot.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}
.step-dot.done {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}
.step-line {
  height: 2px;
  flex: 1;
  background: var(--color-border);
  transition: background var(--transition-slow);
}
.step-line.done { background: var(--color-success); }

/* ── Pull-to-Refresh indicator ── */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  z-index: 50;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 0.5rem 1.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.ptr-indicator.visible {
  transform: translateX(-50%) translateY(0);
}

/* ── Progress Topup Status Bar ── */
.topup-progress {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.topup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  z-index: 1;
}
.topup-step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: var(--color-bg-card-alt);
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
  transition: all var(--transition-base);
}
.topup-step.active .topup-step-circle {
  background: var(--color-warning);
  border-color: var(--color-warning);
  color: #fff;
  animation: pulse 2s ease-in-out infinite;
}
.topup-step.done .topup-step-circle {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}
.topup-step-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  white-space: nowrap;
}
.topup-step.active .topup-step-label { color: var(--color-warning); }
.topup-step.done  .topup-step-label  { color: var(--color-success); }
.topup-progress-line {
  height: 2px;
  flex: 1;
  background: var(--color-border);
  position: relative;
  top: -12px;
  z-index: 0;
}
.topup-progress-line.done { background: var(--color-success); }

/* ── Search Bar ── */
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-bg-input);
  border: 1.5px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.875rem;
  min-height: 40px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.search-input-wrap input {
  background: none;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-size: 0.85rem;
  width: 100%;
  font-family: var(--font-sans);
}
.search-input-wrap input::placeholder { color: var(--color-text-muted); }
html.light .search-input-wrap { background: #fff; border-color: #d0d9ec; }

/* ── View Toggle (Table ↔ Card) ── */
.view-toggle {
  display: flex;
  align-items: center;
  background: var(--color-bg-card-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}
.view-toggle-btn {
  width: 32px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.view-toggle-btn.active {
  background: var(--color-primary);
  color: #fff;
}

/* ── Highlight Pulse (for new items) ── */
@keyframes highlightPulse {
  0%   { box-shadow: 0 0 0 0 rgba(91,97,244,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(91,97,244,0); }
  100% { box-shadow: 0 0 0 0 rgba(91,97,244,0); }
}
.highlight-new { animation: highlightPulse 1.2s ease-out 2; }

/* ── Balance Change Animation ── */
@keyframes balanceUp {
  0%   { transform: translateY(0); color: var(--color-success); }
  50%  { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}
@keyframes balanceDown {
  0%   { transform: translateY(0); color: var(--color-danger); }
  50%  { transform: translateY(8px); }
  100% { transform: translateY(0); }
}
.balance-up   { animation: balanceUp 0.5s ease both; }
.balance-down { animation: balanceDown 0.5s ease both; }

/* ── Swipe Action Hint ── */
.swipe-hint {
  position: relative;
  overflow: hidden;
}
.swipe-action-bg {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--color-danger-soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 1rem;
  color: var(--color-danger);
  font-size: 0.8rem;
  border-radius: var(--radius-lg);
  transition: width 0.3s ease;
  pointer-events: none;
}

/* ── Settings Section Groups ── */
.settings-section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.settings-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  min-height: var(--touch-target);
  transition: background var(--transition-fast);
}
.settings-row + .settings-row {
  border-top: 1px solid var(--color-border);
}
.settings-row:hover { background: var(--color-bg-hover); }
html.light .settings-section {
  background: #fff;
  border-color: rgba(0,0,0,0.07);
}

/* ── Danger Zone Section ── */
.danger-zone {
  background: var(--color-danger-soft);
  border: 1px solid rgba(240,68,56,0.25);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.danger-zone .settings-section-header {
  color: var(--color-danger);
  border-bottom-color: rgba(240,68,56,0.2);
}

/* ── Live Preview Badge ── */
.live-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(16,199,132,0.12);
  color: var(--color-success);
  border: 1px solid rgba(16,199,132,0.25);
}
.live-preview-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  animation: ping 1.2s ease-in-out infinite;
}
@keyframes ping {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

/* ── Avatar color variants ── */
.avatar-blue    { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.avatar-green   { background: rgba(16,199,132,0.15); color: #34d399; border: 1px solid rgba(16,199,132,0.25); }
.avatar-purple  { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.25); }
.avatar-orange  { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.avatar-red     { background: rgba(240,68,56,0.15);  color: #f87171; border: 1px solid rgba(240,68,56,0.25); }
.avatar-indigo  { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.25); }
.avatar-cyan    { background: rgba(6,199,232,0.15);  color: #67e8f9; border: 1px solid rgba(6,199,232,0.25); }

/* ── Smooth Page Section Fade ── */
.section-fade {
  animation: fadeIn 0.3s ease both;
}
.section-fade:nth-child(1) { animation-delay: 0s; }
.section-fade:nth-child(2) { animation-delay: 0.06s; }
.section-fade:nth-child(3) { animation-delay: 0.12s; }
.section-fade:nth-child(4) { animation-delay: 0.18s; }
.section-fade:nth-child(5) { animation-delay: 0.22s; }

/* ── Voucher Status Progress Bar ── */
.voucher-progress-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--color-border);
  overflow: hidden;
  margin-top: 0.25rem;
}
.voucher-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-success));
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── WhatsApp Share Button ── */
.btn-wa {
  background: linear-gradient(135deg, #25d366 0%, #128c5e 100%);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 4px 16px -4px rgba(37,211,102,0.4);
}
.btn-wa:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px -4px rgba(37,211,102,0.5);
}
.btn-wa:active { transform: scale(0.94); }

/* ── Mobile Card View Layout ── */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* ── Action Sheet (Mobile Bottom Panel) ── */
.action-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(3,8,20,0.7);
  backdrop-filter: blur(8px);
}
.action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 71;
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: 0.5rem 0 max(1rem, var(--sab));
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
  animation: slideUpSheet 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.action-sheet-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
  min-height: var(--touch-target);
}
.action-sheet-item:hover { background: var(--color-bg-hover); }
.action-sheet-item .action-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ── Float Label ── */
.float-label-group {
  position: relative;
}
.float-label-group .form-input {
  padding-top: 1.35rem;
  padding-bottom: 0.5rem;
}
.float-label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  pointer-events: none;
  transition: all var(--transition-fast);
  transform-origin: left center;
  line-height: 1;
}
.float-label-group .form-input:focus ~ .float-label,
.float-label-group .form-input:not(:placeholder-shown) ~ .float-label {
  transform: translateY(-140%) scale(0.75);
  color: var(--color-primary);
}

/* ── Stat Sparkline Placeholder ── */
.sparkline {
  height: 32px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-top: 0.5rem;
}
.sparkline-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: var(--color-primary);
  opacity: 0.4;
  min-height: 4px;
  transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.sparkline-bar:last-child { opacity: 0.9; }
.sparkline-bar.success { background: var(--color-success); }
.sparkline-bar.warning { background: var(--color-warning); }

/* ── Tooltip ── */
.has-tooltip {
  position: relative;
}
.tooltip-text {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(15, 25, 45, 0.95);
  color: #f0f4ff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--color-border-subtle);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 20;
}
.has-tooltip:hover .tooltip-text { opacity: 1; }

/* ── Consistent border animations ── */
.btn, .form-input, .form-select, .form-textarea, .glass-card {
  will-change: transform;
}

/* Light mode overrides for new components */
html.light .voucher-card { background: #f5f8ff; border-color: rgba(0,0,0,0.07); }
html.light .voucher-code-display { color: #0d1b33; }
html.light .copy-btn { background: #eff2f9; border-color: #d0d9ec; color: #3d5270; }
html.light .notif-panel { background: #fff; border-color: rgba(0,0,0,0.1); }
html.light .settings-section { background: #fff; }
html.light .action-sheet { background: #fff; border-top-color: rgba(0,0,0,0.08); }
html.light .toggle-track { background: #e8edf6; border-color: #cbd5e1; }
html.light .confirm-card { background: #fff; border-color: rgba(0,0,0,0.1); }

@media (max-width: 639px) {
  .voucher-code-display { font-size: 1.15rem; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }
}
@media (min-width: 640px) {
  .show-mobile { display: none !important; }
}
