/* ============================================================
   BARBEARIA PREMIUM – Main Stylesheet
   Theme: Dark mode · Gold accents
   Inspired by Stripe Dashboard & Linear
   ============================================================ */

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

/* ============================================================
   1. CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  /* Backgrounds */
  --bg-primary:   #0A0A0F;
  --bg-secondary: #101018;
  --bg-card:      #13131E;
  --bg-hover:     #1A1A2A;

  /* Borders */
  --border-color: #1E1E30;
  --border-hover: #2A2A40;

  /* Text */
  --text-primary:   #F0F0F5;
  --text-secondary: #9090B0;
  --text-muted:     #55556A;

  /* Gold palette */
  --gold-primary: #C9A84C;
  --gold-light:   #E8C870;
  --gold-dark:    #A68930;
  --gold-glow:    rgba(201, 168, 76, 0.15);
  --gold-bg:      rgba(201, 168, 76, 0.08);

  /* Semantic colours */
  --success:     #10B981;
  --success-bg:  rgba(16, 185, 129, 0.10);
  --danger:      #EF4444;
  --danger-bg:   rgba(239, 68, 68, 0.10);
  --warning:     #F59E0B;
  --warning-bg:  rgba(245, 158, 11, 0.10);
  --info:        #3B82F6;
  --info-bg:     rgba(59, 130, 246, 0.10);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;

  /* Radii */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow:    0 4px 24px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.60);

  /* Motion */
  --transition: 0.2s ease;
}

/* ============================================================
   2. CSS RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover { color: var(--gold-light); }

img, video, svg { max-width: 100%; display: block; }

ul, ol { list-style: none; }

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

p { color: var(--text-secondary); }

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.5rem 0;
}

/* ============================================================
   3. CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb        { background: var(--gold-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: var(--gold-primary); }
*                                { scrollbar-width: thin; scrollbar-color: var(--gold-dark) var(--bg-secondary); }

/* ============================================================
   4. LAYOUT – SIDEBAR + MAIN
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar logo area */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 12px var(--gold-glow);
}

.sidebar-logo-icon svg,
.sidebar-logo-icon i { color: #0A0A0F; font-size: 18px; }

.sidebar-logo-text { display: flex; flex-direction: column; min-width: 0; }

.sidebar-logo-text .brand-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gold-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

.sidebar-logo-text .brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 16px 8px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-link i,
.sidebar-link svg {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--transition);
}

.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link:hover i,
.sidebar-link:hover svg { color: var(--gold-primary); }

.sidebar-link.active { background: var(--gold-bg); color: var(--gold-primary); }
.sidebar-link.active i,
.sidebar-link.active svg { color: var(--gold-primary); }

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: linear-gradient(to bottom, var(--gold-primary), var(--gold-light));
  border-radius: 0 3px 3px 0;
}

/* Sidebar badge */
.sidebar-badge {
  margin-left: auto;
  background: var(--gold-bg);
  color: var(--gold-primary);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--gold-glow);
}

/* Sidebar user footer */
.sidebar-user {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-user-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  cursor: default;
}

.sidebar-user-inner:hover { background: var(--bg-hover); }

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0A0A0F;
  flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; flex: 1; }

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role { font-size: 0.7rem; color: var(--text-muted); }

.sidebar-logout {
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.sidebar-logout:hover { color: var(--danger); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }

/* ---- Main content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ---- Top header bar ---- */
.topbar {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 90;
}

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

.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 6px 8px;
  cursor: pointer;
  transition: all var(--transition);
  align-items: center;
  justify-content: center;
}

.hamburger-btn:hover { border-color: var(--gold-primary); color: var(--gold-primary); }

/* Page content wrapper */
.page-content {
  padding: 28px 24px;
  flex: 1;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--gold-primary); }
.breadcrumb-sep { color: var(--text-muted); }

/* ============================================================
   5. STAT / METRIC CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  animation: cardEntrance 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.card-stat::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition);
  background: linear-gradient(135deg, var(--gold-glow), transparent 60%);
  pointer-events: none;
}

.card-stat:hover {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 1px var(--gold-primary), var(--shadow);
  transform: translateY(-2px);
}

.card-stat:hover::after { opacity: 1; }

.card-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--gold-bg);
  border: 1px solid var(--gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  color: var(--gold-primary);
}

.card-stat-icon.icon-success { background: var(--success-bg); border-color: rgba(16,185,129,0.2); color: var(--success); }
.card-stat-icon.icon-danger  { background: var(--danger-bg);  border-color: rgba(239,68,68,0.2);  color: var(--danger); }
.card-stat-icon.icon-info    { background: var(--info-bg);    border-color: rgba(59,130,246,0.2);  color: var(--info); }
.card-stat-icon.icon-warning { background: var(--warning-bg); border-color: rgba(245,158,11,0.2); color: var(--warning); }

.card-stat-body { flex: 1; min-width: 0; }

.card-stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.card-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.card-stat-value.value-white { color: var(--text-primary); }

.card-stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 6px;
}

.card-stat-delta.up   { color: var(--success); }
.card-stat-delta.down { color: var(--danger); }

/* General card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

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

.card-header-title i { color: var(--gold-primary); }

.card-body { padding: 20px; }

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(0,0,0,0.2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================
   6. FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-label .required { color: var(--danger); margin-left: 3px; }

.form-control,
.form-select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 10px 14px;
  transition: all var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:hover,
.form-select:hover { border-color: var(--border-hover); }

.form-control:focus,
.form-select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-glow);
  background: var(--bg-card);
}

.form-control:disabled,
.form-select:disabled { opacity: 0.5; cursor: not-allowed; }

.form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.form-control.is-valid   { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }

.invalid-feedback {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.valid-feedback { font-size: 0.78rem; color: var(--success); margin-top: 5px; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239090B0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option { background: var(--bg-card); color: var(--text-primary); }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }

.char-counter { font-size: 0.75rem; color: var(--text-muted); text-align: right; margin-top: 4px; }
.char-counter.near-limit { color: var(--warning); }
.char-counter.at-limit   { color: var(--danger); }

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}

.form-check-input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.form-check-input[type="radio"] { border-radius: 50%; }

.form-check-input:checked {
  background: var(--gold-primary);
  border-color: var(--gold-primary);
}

.form-check-input:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 6px;
  border-left: 2px solid #0A0A0F;
  border-bottom: 2px solid #0A0A0F;
  transform: translate(-50%, -60%) rotate(-45deg);
}

.form-check-input[type="radio"]:checked::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: #0A0A0F;
  transform: translate(-50%, -50%);
}

.form-check-label { font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }

/* Input group */
.input-group { display: flex; align-items: stretch; }

.input-group .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  flex: 1;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: translateY(1px); }

.btn-sm { padding: 7px 14px; font-size: 0.8125rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }

/* Gold primary */
.btn-gold {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  color: #0A0A0F;
  border-color: transparent;
  box-shadow: 0 2px 12px var(--gold-glow);
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  box-shadow: 0 4px 24px rgba(201,168,76,0.35);
  color: #0A0A0F;
  transform: translateY(-1px);
}

/* Gold outline */
.btn-outline-gold {
  background: transparent;
  color: var(--gold-primary);
  border-color: var(--gold-primary);
}

.btn-outline-gold:hover {
  background: var(--gold-bg);
  color: var(--gold-light);
  border-color: var(--gold-light);
}

/* Dark secondary */
.btn-secondary-dark {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

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

/* Danger dark */
.btn-danger-dark {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239,68,68,0.25);
}

.btn-danger-dark:hover {
  background: rgba(239,68,68,0.2);
  border-color: var(--danger);
  color: #ff6b6b;
}

/* Success dark */
.btn-success-dark {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16,185,129,0.25);
}

.btn-success-dark:hover {
  background: rgba(16,185,129,0.2);
  border-color: var(--success);
}

/* WhatsApp */
.btn-whatsapp {
  background: #25D366;
  color: #fff;
  border-color: #25D366;
}

.btn-whatsapp:hover {
  background: #1ebe5d;
  border-color: #1ebe5d;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(37,211,102,0.3);
}

/* Icon-only button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-icon:hover { border-color: var(--gold-primary); color: var(--gold-primary); }

/* Loading state */
.btn.loading { pointer-events: none; opacity: 0.7; }
.btn.loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
}

/* ============================================================
   8. TABLES
   ============================================================ */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.table thead { background: rgba(0,0,0,0.3); }

.table thead th {
  padding: 13px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table thead th:first-child { padding-left: 20px; }
.table thead th:last-child  { padding-right: 20px; text-align: right; }

.table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition);
}

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

.table tbody td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody td:first-child { padding-left: 20px; color: var(--text-primary); font-weight: 500; }
.table tbody td:last-child  { padding-right: 20px; text-align: right; }

.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* ============================================================
   9. BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-gold    { background: var(--gold-bg);    color: var(--gold-primary); border: 1px solid var(--gold-glow); }
.badge-success { background: var(--success-bg); color: var(--success);      border: 1px solid rgba(16,185,129,0.2); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);       border: 1px solid rgba(239,68,68,0.2); }
.badge-warning { background: var(--warning-bg); color: var(--warning);      border: 1px solid rgba(245,158,11,0.2); }
.badge-info    { background: var(--info-bg);    color: var(--info);         border: 1px solid rgba(59,130,246,0.2); }
.badge-muted   { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border-color); }

.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================================
   10. LOYALTY CARD
   ============================================================ */
.loyalty-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, #0F0F1C 100%);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px var(--gold-glow), var(--shadow-lg);
}

.loyalty-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

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

.loyalty-card-client { display: flex; align-items: center; gap: 12px; }

.loyalty-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0A0A0F;
  box-shadow: 0 0 16px var(--gold-glow);
}

.loyalty-card-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.loyalty-card-phone { font-size: 0.8rem; color: var(--text-muted); }

.loyalty-card-stars-count { text-align: right; }

.loyalty-card-stars-count .count-value {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gold-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.loyalty-card-stars-count .count-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Stars grid */
.stars-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}

.star-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 22px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.star-item.star-filled {
  color: var(--gold-primary);
  filter: drop-shadow(0 0 6px var(--gold-primary));
  animation: star-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.star-item.star-empty { color: var(--text-muted); opacity: 0.35; }
.star-item.star-new   { animation: star-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* Progress bar */
.progress-wrap { margin-top: 16px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-label-text { font-size: 0.78rem; color: var(--text-muted); }
.progress-label-pct  { font-size: 0.78rem; font-weight: 600; color: var(--gold-primary); }

.progress-bar-track {
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary), var(--gold-light));
  border-radius: 4px;
  width: 0%;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 0;
  height: 100%;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: shimmer 1.5s ease infinite;
}

/* Prize badge */
.prize-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold-bg), rgba(201,168,76,0.15));
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  animation: pulse-gold 2s ease infinite;
  margin-top: 12px;
}

/* Mini loyalty stars (in tables) */
.loyalty-mini { display: flex; align-items: center; gap: 4px; }
.loyalty-mini .star-mini       { font-size: 12px; color: var(--gold-primary); }
.loyalty-mini .star-mini.empty { color: var(--border-hover); }

/* ============================================================
   11. SEARCH BAR / AUTOCOMPLETE
   ============================================================ */
.search-bar { position: relative; width: 100%; max-width: 440px; }

.search-bar-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}

.search-bar .form-control { padding-left: 38px; }

.search-bar .clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: none;
}

.search-bar .clear-btn.visible { display: block; }

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-color);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.focused { background: var(--bg-hover); }

.autocomplete-item-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0A0A0F;
  flex-shrink: 0;
}

.autocomplete-item-info { flex: 1; min-width: 0; }

.autocomplete-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-item-meta { font-size: 0.75rem; color: var(--text-muted); }

.autocomplete-item-stars {
  font-size: 0.75rem;
  color: var(--gold-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

.autocomplete-no-results { padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

.autocomplete-loading {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ============================================================
   12. TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  pointer-events: all;
  position: relative;
  overflow: hidden;
  min-width: 280px;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.toast.toast-success::before { background: var(--success); }
.toast.toast-error::before   { background: var(--danger); }
.toast.toast-warning::before { background: var(--warning); }
.toast.toast-info::before    { background: var(--info); }

.toast.toast-hiding { animation: toastSlideOut 0.25s ease forwards; }

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

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

.toast-body { flex: 1; min-width: 0; }

.toast-title   { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.toast-message { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  line-height: 1;
  transition: color var(--transition);
  flex-shrink: 0;
}

.toast-close:hover { color: var(--text-primary); }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  animation: toastProgress linear forwards;
  border-radius: 0 2px 0 0;
}

.toast-success .toast-progress { background: var(--success); }
.toast-error   .toast-progress { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info    .toast-progress { background: var(--info); }

/* ============================================================
   13. MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.modal-hiding { animation: fadeOut 0.2s ease forwards; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 20px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(0,0,0,0.2);
}

/* Celebration modal */
.modal-celebration .modal-box {
  border-color: var(--gold-primary);
  box-shadow: 0 0 60px var(--gold-glow), var(--shadow-lg);
}

.celebration-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: pulse-gold 1.5s ease infinite;
}

/* ============================================================
   14. LOGIN / AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  padding: 20px;
  overflow: hidden;
}

.auth-bg-glow {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(201,168,76,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.auth-bg-glow-2 {
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,0.04) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  text-align: center;
}

.auth-logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #0A0A0F;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px var(--gold-glow);
}

.auth-logo-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold-primary);
  letter-spacing: -0.02em;
}

.auth-logo-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.auth-title { font-size: 1.125rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.auth-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.8rem; color: var(--text-muted); }

/* ============================================================
   15. ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 0.875rem;
  border: 1px solid;
  animation: fadeIn 0.3s ease;
  position: relative;
}

.alert-icon  { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-body  { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; }

.alert-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  opacity: 0.6;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.alert-close:hover { opacity: 1; }

.alert-success { background: var(--success-bg); border-color: rgba(16,185,129,0.25);  color: var(--success); }
.alert-error,
.alert-danger  { background: var(--danger-bg);  border-color: rgba(239,68,68,0.25);   color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: rgba(245,158,11,0.25);  color: var(--warning); }
.alert-info    { background: var(--info-bg);    border-color: rgba(59,130,246,0.25);  color: var(--info); }

/* ============================================================
   16. AVATAR INITIALS
   ============================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: #0A0A0F;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.65rem; }
.avatar-md { width: 38px; height: 38px; font-size: 0.85rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }

.avatar-success { background: linear-gradient(135deg, #065f46, var(--success)); color: #fff; }
.avatar-info    { background: linear-gradient(135deg, #1e40af, var(--info)); color: #fff; }
.avatar-danger  { background: linear-gradient(135deg, #7f1d1d, var(--danger)); color: #fff; }
.avatar-muted   { background: linear-gradient(135deg, #1e1e2e, #2a2a40); color: var(--text-secondary); }

/* ============================================================
   17. DATATABLES DARK THEME OVERRIDES
   ============================================================ */
div.dataTables_wrapper {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--transition);
}

div.dataTables_wrapper div.dataTables_filter input:focus,
div.dataTables_wrapper div.dataTables_length select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

div.dataTables_wrapper div.dataTables_info { color: var(--text-muted); font-size: 0.8rem; }

div.dataTables_wrapper div.dataTables_paginate { display: flex; gap: 4px; align-items: center; }

div.dataTables_wrapper div.dataTables_paginate .paginate_button {
  background: var(--bg-hover);
  border: 1px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  transition: all var(--transition);
  cursor: pointer;
  font-size: 0.8rem;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button:hover {
  background: var(--bg-card) !important;
  border-color: var(--gold-primary) !important;
  color: var(--gold-primary) !important;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current:hover {
  background: var(--gold-bg) !important;
  border-color: var(--gold-primary) !important;
  color: var(--gold-primary) !important;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.disabled { opacity: 0.35; cursor: not-allowed; }

div.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody { background: var(--bg-card); }

/* DT header & footer bar */
div.dataTables_wrapper > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 10px;
}

div.dataTables_wrapper > div:last-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================================================
   18. PWA INSTALL BANNER
   ============================================================ */
#pwa-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--bg-card);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 0 30px var(--gold-glow), var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  z-index: 8000;
  max-width: 340px;
  animation: slideInLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#pwa-banner.hidden { display: none; }

.pwa-banner-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #0A0A0F;
  flex-shrink: 0;
}

.pwa-banner-text { flex: 1; }
.pwa-banner-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.pwa-banner-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.pwa-banner-actions { display: flex; gap: 8px; margin-top: 10px; }

.pwa-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: color var(--transition);
}

.pwa-close:hover { color: var(--text-primary); }

/* ============================================================
   19. CONFETTI
   ============================================================ */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  opacity: 0;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

/* ============================================================
   20. QR CODE DISPLAY
   ============================================================ */
.qr-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.qr-img {
  border: 3px solid var(--gold-primary);
  border-radius: var(--radius);
  padding: 8px;
  background: #fff;
  box-shadow: 0 0 20px var(--gold-glow);
}

.qr-label { font-size: 0.8rem; color: var(--text-muted); text-align: center; }

/* ============================================================
   21. CLIENT PORTAL STYLES
   ============================================================ */
.client-portal { min-height: 100vh; background: var(--bg-primary); display: flex; flex-direction: column; }

.client-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.client-content { flex: 1; padding: 24px 20px; max-width: 600px; margin: 0 auto; width: 100%; }

/* Reward items */
.reward-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: all var(--transition);
}

.reward-item:hover { border-color: var(--gold-primary); background: var(--bg-hover); }
.reward-item.redeemed { opacity: 0.55; }

.reward-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--gold-bg);
  border: 1px solid var(--gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ============================================================
   22. UTILITY CLASSES
   ============================================================ */
.d-flex          { display: flex !important; }
.d-none          { display: none !important; }
.d-block         { display: block !important; }
.d-grid          { display: grid !important; }
.flex-1          { flex: 1; }
.align-center    { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-end     { justify-content: flex-end !important; }
.justify-center  { justify-content: center !important; }
.gap-2           { gap: 8px; }
.gap-3           { gap: 12px; }
.gap-4           { gap: 16px; }
.text-center     { text-align: center; }
.text-right      { text-align: right; }
.text-gold       { color: var(--gold-primary) !important; }
.text-muted      { color: var(--text-muted) !important; }
.text-secondary  { color: var(--text-secondary) !important; }
.text-success    { color: var(--success) !important; }
.text-danger     { color: var(--danger) !important; }
.text-warning    { color: var(--warning) !important; }
.text-sm         { font-size: 0.8125rem; }
.text-xs         { font-size: 0.75rem; }
.font-bold       { font-weight: 700; }
.font-semibold   { font-weight: 600; }
.font-medium     { font-weight: 500; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mr-2 { margin-right: 8px; }
.p-4  { padding: 16px; }
.p-5  { padding: 20px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded { border-radius: var(--radius); }
.rounded-full { border-radius: 9999px; }
.opacity-50 { opacity: 0.5; }
.overflow-hidden { overflow: hidden; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Separator with text */
.separator {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 20px 0;
}

.separator::before,
.separator::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon  { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-text  { font-size: 0.875rem; color: var(--text-muted); max-width: 320px; margin-bottom: 20px; }

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-hover) 25%,
    var(--border-color) 50%,
    var(--bg-hover) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

/* Dark mode toggle */
.theme-toggle {
  width: 44px;
  height: 24px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  padding: 2px;
}

.theme-toggle::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition);
  transform: translateX(0);
}

.theme-toggle.light { background: var(--gold-bg); border-color: var(--gold-primary); }
.theme-toggle.light::before { background: var(--gold-primary); transform: translateX(20px); }

/* ============================================================
   23. ANIMATIONS / KEYFRAMES
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(40px) scale(0.95); }
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 var(--gold-glow); }
  50%       { box-shadow: 0 0 0 10px transparent; }
}

@keyframes star-appear {
  0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
  60%  { opacity: 1; transform: scale(1.2) rotate(5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); opacity: 0; }
  50%  { opacity: 1; }
  100% { transform: translateX(200%); opacity: 0; }
}

@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

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

@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.5); }
}

/* Stagger card entrance delays */
.card-stat:nth-child(1) { animation-delay: 0.05s; }
.card-stat:nth-child(2) { animation-delay: 0.10s; }
.card-stat:nth-child(3) { animation-delay: 0.15s; }
.card-stat:nth-child(4) { animation-delay: 0.20s; }
.card-stat:nth-child(5) { animation-delay: 0.25s; }

/* ============================================================
   24. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Sidebar becomes slide-over on mobile */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

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

  .main-content { margin-left: 0; }
  .hamburger-btn { display: flex; }

  .page-content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }

  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .page-header { flex-direction: column; align-items: flex-start; }

  .auth-card { padding: 28px 24px; }
  .card-body { padding: 16px; }

  #pwa-banner { left: 16px; right: 16px; max-width: none; bottom: 16px; }
  #toast-container { right: 16px; bottom: 16px; left: 16px; max-width: none; }

  .modal-box { margin: 16px; }

  .loyalty-card { padding: 18px; }
  .star-item { width: 34px; height: 34px; font-size: 18px; }

  .table thead { display: none; }

  .table tbody tr {
    display: block;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 12px 16px;
  }

  .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    text-align: left;
  }

  .table tbody td:first-child { padding-left: 0; }
  .table tbody td:last-child  { padding-right: 0; text-align: left; }

  .table tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 12px;
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .card-stat-value { font-size: 1.75rem; }
  .auth-card { padding: 24px 18px; }
  .stars-grid { gap: 6px; }
  .star-item { width: 30px; height: 30px; font-size: 16px; }
}

/* ============================================================
   25. PRINT STYLES
   ============================================================ */
@media print {
  .sidebar,
  .topbar,
  .hamburger-btn,
  #pwa-banner,
  #toast-container,
  .btn-gold,
  .btn-outline-gold,
  .table-actions,
  .no-print { display: none !important; }

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

  body { background: #fff; color: #000; }

  .card,
  .table-container {
    border-color: #ccc;
    background: #fff;
    box-shadow: none;
  }

  .loyalty-card {
    border: 2px solid #C9A84C;
    background: #fff;
    box-shadow: none;
  }

  .loyalty-card::before { display: none; }

  .table tbody tr:nth-child(even) { background: #f9f9f9; }

  .progress-bar-fill {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
