/* ═══════════════════════════════════════════════════════════════════════════
   app.css — Premium SaaS Design System
   Events Platform
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Colors — Light mode */
  --color-bg:              #f8fafc;
  --color-surface:         #ffffff;
  --color-surface-alt:     #f1f5f9;
  --color-border:          #e2e8f0;
  --color-border-subtle:   #f1f5f9;
  --color-text:            #0f172a;
  --color-text-secondary:  #475569;
  --color-text-muted:      #94a3b8;
  --color-text-on-primary: #ffffff;

  /* Brand */
  --color-brand:           #6366f1;
  --color-brand-hover:     #4f46e5;
  --color-brand-light:     #eef2ff;
  --color-brand-dark:      #3730a3;

  /* Status */
  --color-success:         #10b981;
  --color-success-light:   #d1fae5;
  --color-warning:         #f59e0b;
  --color-warning-light:   #fef3c7;
  --color-danger:          #ef4444;
  --color-danger-light:    #fee2e2;
  --color-info:            #3b82f6;
  --color-info-light:      #dbeafe;

  /* Badge colors */
  --color-purple:          #8b5cf6;
  --color-green:           #10b981;
  --color-yellow:          #f59e0b;
  --color-blue:            #3b82f6;
  --color-gray:            #6b7280;

  /* Layout */
  --sidebar-width:         240px;
  --navbar-height:         60px;
  --content-max:           1200px;

  /* Spacing */
  --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;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Typography */
  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-display:'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;

  /* Radius */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:      0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md:   0 10px 25px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --shadow-lg:   0 20px 40px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-xl:   0 32px 64px rgba(0,0,0,0.12);

  /* Transitions */
  --transition-fast:   0.1s ease;
  --transition:        0.2s ease;
  --transition-slow:   0.3s ease;
}

/* Dark mode */
[data-theme="dark"] {
  --color-bg:              #0f172a;
  --color-surface:         #1e293b;
  --color-surface-alt:     #0f172a;
  --color-border:          #334155;
  --color-border-subtle:   #1e293b;
  --color-text:            #f1f5f9;
  --color-text-secondary:  #94a3b8;
  --color-text-muted:      #64748b;
  --color-brand-light:     #1e1b4b;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-brand); text-decoration: none; }
a:hover { color: var(--color-brand-hover); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ─── Utility ────────────────────────────────────────────────────────────── */
.text-sm      { font-size: 0.8125rem; }
.text-muted   { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.p-0          { padding: 0 !important; }

/* ─── Layout: Main App (navbar + content) ─────────────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  height: var(--navbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--color-text);
  text-decoration: none;
}
.navbar-brand:hover { color: var(--color-text); }
.brand-icon { color: var(--color-brand); }
.brand-icon-lg {
  font-size: 2.5rem;
  color: var(--color-brand);
  display: block;
  margin-bottom: var(--space-3);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: var(--space-4);
}
.navbar-nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: var(--color-brand-light);
  color: var(--color-brand);
}

.navbar-spacer { flex: 1; }

.navbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--color-brand-light); color: var(--color-brand); }

/* Avatar dropdown */
.avatar-dropdown { position: relative; }
.avatar-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity var(--transition);
}
.avatar-btn:hover { opacity: 0.85; }
.dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  min-width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  z-index: 200;
}
.dropdown-menu.open { display: block; animation: fadeIn 0.15s ease; }
.dropdown-header {
  padding: var(--space-3) var(--space-4);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.dropdown-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  font-size: 0.875rem;
  transition: background var(--transition-fast);
}
.dropdown-item:hover { background: var(--color-surface-alt); color: var(--color-text); }
.dropdown-item.danger:hover { background: var(--color-danger-light); color: var(--color-danger); }

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

/* ─── Flash Messages ─────────────────────────────────────────────────────── */
.flash-container { position: fixed; top: 72px; right: var(--space-6); z-index: 300; display: flex; flex-direction: column; gap: var(--space-2); max-width: 380px; }
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.25s ease;
}
.flash-success { background: var(--color-success-light); color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: var(--color-danger-light);  color: #991b1b; border: 1px solid #fca5a5; }
.flash-warning { background: var(--color-warning-light); color: #92400e; border: 1px solid #fcd34d; }
.flash-info    { background: var(--color-info-light);    color: #1e40af; border: 1px solid #93c5fd; }
.flash button  { background: none; border: none; cursor: pointer; opacity: 0.6; font-size: 1.1rem; color: inherit; line-height: 1; }
.flash button:hover { opacity: 1; }

/* Inline alert */
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius); margin-bottom: var(--space-4); font-size: 0.875rem; }
.alert-success { background: var(--color-success-light); color: #065f46; }
.alert-error   { background: var(--color-danger-light);  color: #991b1b; }
.alert-warning { background: var(--color-warning-light); color: #92400e; }
.alert-info    { background: var(--color-info-light);    color: #1e40af; }

/* ─── Page Header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-subtitle { color: var(--color-text-muted); font-size: 0.9rem; margin-top: var(--space-1); }

.header-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}
.card-action {
  font-size: 0.8rem;
  color: var(--color-brand);
  font-weight: 500;
}
.card-action:hover { color: var(--color-brand-hover); }
.card-header-actions { display: flex; gap: var(--space-2); }
.card-body { padding: var(--space-5); }
.card-section-heading {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}
.btn-primary:hover { background: var(--color-brand-hover); border-color: var(--color-brand-hover); color: #fff; }
.btn-secondary {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-border); }
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); }
.btn-danger  { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover  { background: #dc2626; border-color: #dc2626; color: #fff; }

.btn-sm  { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-xs  { padding: 0.25rem 0.5rem;   font-size: 0.75rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-4); }
.form-group > label,
.form-group > .label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.form-control {
  width: 100%;
  padding: 0.5625rem var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-control::placeholder { color: var(--color-text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 2rem; }

.form-hint     { font-size: 0.8rem; color: var(--color-text-muted); margin-top: var(--space-1); }
.field-error   { font-size: 0.8rem; color: var(--color-danger); margin-top: var(--space-1); display: block; }
.has-error .form-control { border-color: var(--color-danger); }

.form-row-2    { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-actions  { display: flex; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--color-border); margin-top: var(--space-4); }
.form-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.form-section  { }
.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-brand);
  color: var(--color-text);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: 0.875rem;
}
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-brand); cursor: pointer; }

.input-with-action { position: relative; display: flex; }
.input-with-action .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-action {
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-left: none;
  background: var(--color-surface-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.input-action-btn { border-radius: 0 var(--radius) var(--radius) 0 !important; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--color-surface-alt); }
.table-link { font-weight: 600; color: var(--color-text); }
.table-link:hover { color: var(--color-brand); }
.actions-cell { display: flex; gap: var(--space-1); align-items: center; }
.table-sm th, .table-sm td { padding: var(--space-2) var(--space-3); }

.table-filter-bar {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}
.search-input { max-width: 280px; }
.form-control-sm { width: auto; max-width: 180px; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.6em;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
/* Event status */
.badge-published  { background: var(--color-success-light); color: #065f46; }
.badge-draft      { background: var(--color-surface-alt); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.badge-cancelled  { background: var(--color-danger-light);  color: #991b1b; }
.badge-completed  { background: var(--color-info-light);    color: #1e40af; }

/* RSVP */
.badge-accepted   { background: var(--color-success-light); color: #065f46; }
.badge-declined   { background: var(--color-danger-light);  color: #991b1b; }
.badge-maybe      { background: var(--color-warning-light); color: #92400e; }
.badge-pending    { background: var(--color-surface-alt); color: var(--color-text-muted); }

/* Invite status */
.badge-invite-sent     { background: var(--color-info-light); color: #1e40af; }
.badge-invite-draft    { background: var(--color-surface-alt); color: var(--color-text-muted); }
.badge-invite-opened   { background: var(--color-warning-light); color: #92400e; }

/* Role */
.badge-role-super_admin { background: #f3e8ff; color: #6d28d9; }
.badge-role-admin       { background: var(--color-info-light); color: #1e40af; }

/* ─── Stats Cards ────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stats-grid-4  { grid-template-columns: repeat(4, 1fr); }
.stats-grid-5  { grid-template-columns: repeat(5, 1fr); }

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  gap: var(--space-3);
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card--green { border-left: 3px solid var(--color-success); }
.stat-card--yellow { border-left: 3px solid var(--color-warning); }
.stat-card--red    { border-left: 3px solid var(--color-danger); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  font-weight: 500;
}

/* ─── Dashboard Grids ────────────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.event-show-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-5); margin-top: var(--space-5); }

/* ─── Event Row (in dashboard) ───────────────────────────────────────────── */
.event-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  text-decoration: none;
  color: var(--color-text);
  transition: background var(--transition-fast);
}
.event-row:last-child { border-bottom: none; }
.event-row:hover { background: var(--color-surface-alt); }
.event-row-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  background: var(--color-brand-light);
  color: var(--color-brand);
  border-radius: var(--radius);
  padding: var(--space-2);
}
.event-month { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.event-day   { font-size: 1.25rem; font-weight: 800; line-height: 1; }
.event-row-info { flex: 1; }
.event-row-info strong { display: block; font-size: 0.875rem; }
.event-row-info small  { color: var(--color-text-muted); font-size: 0.8rem; }

.rsvp-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}
.rsvp-row:last-child { border-bottom: none; }
.rsvp-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rsvp-info { flex: 1; }
.rsvp-info strong { display: block; font-size: 0.875rem; }
.rsvp-info small  { color: var(--color-text-muted); font-size: 0.8rem; }

/* ─── Events Grid ────────────────────────────────────────────────────────── */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}
.event-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.event-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.event-card-header {
  height: 90px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-3);
  position: relative;
}
/* Template header colors */
.tpl-header-luxury      { background: linear-gradient(135deg,#1a1a2e,#0f3460); }
.tpl-header-wedding     { background: linear-gradient(135deg,#3d2314,#6b3a1f); }
.tpl-header-birthday    { background: linear-gradient(135deg,#ff6b9d,#ffd93d); }
.tpl-header-concert     { background: linear-gradient(135deg,#0d0d0d,#330066); }
.tpl-header-corporate   { background: linear-gradient(135deg,#0f172a,#1e3a5f); }
.tpl-header-holiday     { background: linear-gradient(135deg,#1b5e20,#003300); }
.tpl-header-minimalist  { background: #f1f5f9; }
.event-card-template-label { font-size: 0.7rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.08em; align-self: flex-end; }
.tpl-header-minimalist .event-card-template-label { color: var(--color-text-muted); }
.event-card-body { padding: var(--space-4); }
.event-card-title { font-size: 1rem; font-weight: 700; margin-bottom: var(--space-2); }
.event-card-title a { color: var(--color-text); }
.event-card-title a:hover { color: var(--color-brand); }
.event-card-date, .event-card-location {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 0.8rem; color: var(--color-text-secondary); margin-bottom: var(--space-1);
}
.event-card-stats {
  display: flex; gap: var(--space-4); margin-top: var(--space-3);
  font-size: 0.8rem; color: var(--color-text-muted);
}
.event-card-footer {
  display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

/* Template Preview Tiles */
.template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.template-card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.template-card:hover { border-color: var(--color-brand); box-shadow: var(--shadow); }
.template-card.selected { border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
.template-card input[type="radio"] { display: none; }
.template-card-preview {
  height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.template-card-icon { font-size: 1.75rem; }
.template-card-name { padding: var(--space-2) var(--space-3); font-size: 0.8rem; font-weight: 700; }
.template-card-desc { padding: 0 var(--space-3) var(--space-3); font-size: 0.7rem; color: var(--color-text-muted); }

.tpl-preview-luxury     { background: linear-gradient(135deg,#1a1a2e,#0f3460); }
.tpl-preview-wedding    { background: linear-gradient(135deg,#3d2314,#6b3a1f); }
.tpl-preview-birthday   { background: linear-gradient(135deg,#ff6b9d,#ffd93d); }
.tpl-preview-concert    { background: linear-gradient(135deg,#0d0d0d,#330066); }
.tpl-preview-corporate  { background: linear-gradient(135deg,#0f172a,#1e3a5f); }
.tpl-preview-holiday    { background: linear-gradient(135deg,#1b5e20,#003300); }
.tpl-preview-minimalist { background: #f1f5f9; border-bottom: 1px solid #e2e8f0; }

/* ─── Admin Sidebar Layout ───────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
}
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.sidebar-brand a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-text);
  text-decoration: none;
}
.sidebar-nav {
  padding: var(--space-3) var(--space-2);
  flex: 1;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
}
.sidebar-link:hover, .sidebar-link.active {
  background: var(--color-brand-light);
  color: var(--color-brand);
}
.sidebar-divider { height: 1px; background: var(--color-border); margin: var(--space-3) 0; }
.sidebar-user {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.sidebar-user a { color: var(--color-danger); font-size: 0.8rem; font-weight: 600; }
.admin-main {
  flex: 1;
  padding: var(--space-8);
  max-width: calc(var(--content-max) - var(--sidebar-width));
  overflow-x: hidden;
}

/* ─── Auth Layout ────────────────────────────────────────────────────────── */
.auth-layout {
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-surface-alt) 100%);
  min-height: 100vh;
}
.auth-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-xl);
}
.auth-brand {
  text-align: center;
  margin-bottom: var(--space-8);
}
.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.auth-brand p { color: var(--color-text-muted); font-size: 0.9rem; }
.auth-form { margin-top: var(--space-6); }
.auth-footer-note {
  margin-top: var(--space-4);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
}
.auth-footer-note code {
  background: var(--color-surface-alt);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: var(--space-1); justify-content: center; }
.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all var(--transition-fast);
}
.page-btn:hover { background: var(--color-brand-light); color: var(--color-brand); border-color: var(--color-brand); }
.page-btn.active { background: var(--color-brand); color: white; border-color: var(--color-brand); }

/* ─── Empty States ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-8);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state h3   { font-size: 1.25rem; font-weight: 700; margin-bottom: var(--space-2); }
.empty-state p    { color: var(--color-text-muted); margin-bottom: var(--space-5); }
.empty-state-sm   { padding: var(--space-6); text-align: center; color: var(--color-text-muted); font-size: 0.9rem; }

/* ─── Error Pages ────────────────────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: var(--space-12) var(--space-8);
}
.error-code {
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-brand), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-4);
}
.error-title   { font-size: 1.75rem; font-weight: 700; margin-bottom: var(--space-2); }
.error-message { color: var(--color-text-muted); margin-bottom: var(--space-6); }

/* ─── Builder Layout ─────────────────────────────────────────────────────── */
.builder-layout {
  display: flex;
  height: calc(100vh - var(--navbar-height));
  overflow: hidden;
}
.builder-panel {
  width: 320px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.builder-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-2);
}
.builder-title { font-size: 0.875rem; font-weight: 700; }
.builder-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.builder-tab {
  padding: var(--space-2) var(--space-3);
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}
.builder-tab:hover { color: var(--color-text); }
.builder-tab.active { color: var(--color-brand); border-bottom-color: var(--color-brand); }
.builder-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}
.builder-tab-content.active { display: block; }
.builder-hint  { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: var(--space-3); }
.builder-field { margin-bottom: var(--space-4); }
.builder-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}
.builder-select, .builder-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--color-surface);
  color: var(--color-text);
}
.builder-file-input { display: none; }
.bg-preview-thumb {
  margin-top: var(--space-2);
  height: 80px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--color-border);
}

/* Colors */
.color-picker-row { display: flex; align-items: center; gap: var(--space-3); }
.color-input {
  width: 44px; height: 44px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 2px;
  background: none;
}
.color-value { font-size: 0.8rem; font-family: var(--font-mono); color: var(--color-text-muted); }
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-2); }
.swatch {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--transition);
}
.swatch:hover { transform: scale(1.15); border-color: var(--color-border); }

/* Gradient swatches */
.gradient-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.gradient-swatch {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--transition);
}
.gradient-swatch:hover { transform: scale(1.1); }
.gradient-swatch.selected { border-color: var(--color-brand); }

/* Radio group */
.radio-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.radio-option {
  display: flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.radio-option.selected { border-color: var(--color-brand); background: var(--color-brand-light); color: var(--color-brand); }
.radio-option input[type="radio"] { display: none; }

/* Toggle switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
.toggle-switch input[type="checkbox"] { display: none; }
.toggle-slider {
  position: relative;
  width: 36px; height: 20px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: var(--radius-full);
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked ~ .toggle-slider { background: var(--color-brand); }
.toggle-switch input:checked ~ .toggle-slider::after { transform: translateX(16px); }
.toggle-text { font-size: 0.8rem; color: var(--color-text); }
.toggle-switch-sm .toggle-slider { width: 28px; height: 16px; }
.toggle-switch-sm .toggle-slider::after { width: 12px; height: 12px; }
.toggle-switch-sm input:checked ~ .toggle-slider::after { transform: translateX(12px); }

/* Sections list */
.sections-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sections-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-alt);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  cursor: grab;
  font-size: 0.85rem;
}
.drag-handle { opacity: 0.4; font-size: 1rem; cursor: grab; }
.section-name { flex: 1; }

/* Template mini grid */
.template-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.template-mini-card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.template-mini-card:hover { border-color: var(--color-brand); }
.template-mini-card.selected { border-color: var(--color-brand); box-shadow: 0 0 0 2px rgba(99,102,241,0.2); }
.tpl-mini-preview {
  height: 50px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.tpl-mini-name { font-size: 0.7rem; font-weight: 700; padding: 4px; }
.builder-font-preview {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-top: var(--space-3);
}

/* Builder preview area */
.builder-preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  overflow: hidden;
}
.builder-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  gap: var(--space-4);
}
.preview-device-btns { display: flex; gap: var(--space-1); }
.preview-device-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.preview-device-btn.active { border-color: var(--color-brand); background: var(--color-brand-light); color: var(--color-brand); }
.preview-label { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); flex: 1; text-align: center; }
.builder-preview-frame-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-4);
  transition: max-width var(--transition-slow);
}
.builder-preview-frame {
  width: 100%;
  height: calc(100vh - var(--navbar-height) - 60px);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: white;
  transition: max-width var(--transition-slow);
}

/* ─── Questions Builder ───────────────────────────────────────────────────── */
.question-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
.question-block-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}
.question-drag-handle { opacity: 0.5; cursor: grab; font-size: 1rem; }
.question-label-preview { flex: 1; font-size: 0.8rem; font-weight: 600; }
.question-remove-btn {
  width: 24px; height: 24px;
  border: none;
  background: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.question-fields { padding: var(--space-3); }

/* ─── Check-In ───────────────────────────────────────────────────────────── */
.checkin-grid { display: grid; grid-template-columns: 400px 1fr; gap: var(--space-5); }
.checkin-result {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
}
.ci-ok   { background: var(--color-success-light); color: #065f46; }
.ci-fail { background: var(--color-danger-light);  color: #991b1b; }
.checkin-result-icon { font-size: 1.75rem; }
.checkin-result-name { font-size: 1.1rem; }
.checkin-result-sub  { font-size: 0.85rem; font-weight: 400; }
.checkin-list { max-height: 500px; overflow-y: auto; }
.checkin-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--transition-fast);
}
.checkin-row:hover { background: var(--color-surface-alt); }
.checkin-row.checked-in { background: var(--color-success-light); }
.checkin-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-brand-light);
  color: var(--color-brand);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ci-done { background: var(--color-success); color: white; }
.checkin-info { flex: 1; }
.checkin-info strong { display: block; font-size: 0.875rem; }
.checkin-info small  { color: var(--color-text-muted); font-size: 0.8rem; }
.checkin-time { flex-shrink: 0; }

/* ─── Bulk Actions Bar ───────────────────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-brand-light);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 0.875rem;
  color: var(--color-brand);
  font-weight: 600;
}

/* ─── Settings Form ──────────────────────────────────────────────────────── */
.settings-section { margin-bottom: var(--space-5); }
.settings-section-title {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.settings-form .form-actions { justify-content: flex-end; }

/* ─── Admin Logs ─────────────────────────────────────────────────────────── */
.action-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15em 0.5em;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ─── Quick Actions List ─────────────────────────────────────────────────── */
.quick-actions-list { display: flex; flex-direction: column; gap: var(--space-2); }
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  background: var(--color-surface);
}
.quick-action-btn:hover {
  border-color: var(--color-brand);
  background: var(--color-brand-light);
  color: var(--color-brand);
}
.quick-action-btn svg { color: var(--color-brand); flex-shrink: 0; }

/* ─── Capacity Bar ───────────────────────────────────────────────────────── */
.capacity-bar-wrap { display: flex; flex-direction: column; gap: var(--space-2); font-size: 0.875rem; }
.capacity-bar { background: var(--color-surface-alt); border-radius: var(--radius-full); height: 8px; overflow: hidden; border: 1px solid var(--color-border); }
.capacity-fill { height: 100%; background: var(--color-brand); border-radius: var(--radius-full); transition: width 0.4s ease; }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn       { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp     { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .form-grid-2col  { grid-template-columns: 1fr; }
  .event-show-grid { grid-template-columns: 1fr; }
  .dashboard-grid  { grid-template-columns: 1fr; }
  .checkin-grid    { grid-template-columns: 1fr; }
  .stats-grid-5    { grid-template-columns: repeat(3, 1fr); }
  .stats-grid-4    { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .main-content  { padding: var(--space-5) var(--space-4); }
  .admin-main    { padding: var(--space-5) var(--space-4); }
  .admin-sidebar { display: none; }
  .navbar-nav    { display: none; }
  .events-grid   { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-2    { grid-template-columns: 1fr; }
  .stats-grid-5  { grid-template-columns: repeat(2, 1fr); }
  .stats-grid-4  { grid-template-columns: repeat(2, 1fr); }
  .builder-layout { flex-direction: column; height: auto; }
  .builder-panel  { width: 100%; height: 350px; }
}
@media (max-width: 480px) {
  .auth-card { padding: var(--space-6); }
  .page-header { flex-direction: column; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .events-grid { grid-template-columns: 1fr; }
}
