/* ==========================================
   TRUEVNT — Design System
   White & Brand Purple (#481158) Theme
   ========================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Brand Purple */
  --brand-purple: #3B124D;
  --brand-purple-dark: #2B0C39;
  --brand-purple-light: #541B6C;
  --brand-purple-tint: rgba(59, 18, 77, 0.05);

  /* Surfaces & Backgrounds — Crisp White */
  --bg-primary: #ffffff;
  --bg-secondary: #fbf9fc;
  --bg-tertiary: #f4edf7;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.94);

  /* Accents & Gradients */
  --accent-start: #3B124D;
  --accent-mid: #541B6C;
  --accent-end: #742794;
  --gradient-primary: linear-gradient(135deg, #3B124D, #541B6C);
  --gradient-warm: linear-gradient(135deg, #3B124D, #541B6C);
  --gradient-cool: linear-gradient(135deg, #3B124D, #742794);
  --gradient-subtle: linear-gradient(135deg, rgba(59, 18, 77, 0.04), rgba(84, 27, 108, 0.08));

  /* Text */
  --text-primary: #181124;
  --text-secondary: #4f495b;
  --text-muted: #7f788e;
  --text-accent: #3B124D;

  /* Borders */
  --border-default: rgba(59, 18, 77, 0.1);
  --border-hover: rgba(59, 18, 77, 0.25);
  --border-accent: rgba(59, 18, 77, 0.45);
  --border: var(--border-default);
  --bg: var(--bg-secondary);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(72, 17, 88, 0.05);
  --shadow-md: 0 4px 16px rgba(72, 17, 88, 0.08);
  --shadow-lg: 0 12px 36px rgba(72, 17, 88, 0.12);
  --shadow-glow: 0 0 30px rgba(72, 17, 88, 0.15);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Status colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #6366f1;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

code, kbd, samp, pre {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { color: var(--text-secondary); }
a {
  color: var(--brand-purple);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--brand-purple-dark); }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding-top: 0;
  padding-bottom: 3rem;
}

#flash-container:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* --- Navigation --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-default);
  padding: 0.85rem 0;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: 'Inter', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-logo-img {
  height: 32px;
  width: auto;
  display: block;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.navbar-links a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.navbar-links a:hover {
  color: var(--brand-purple);
  background: var(--bg-tertiary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-full);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-purple);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(72, 17, 88, 0.22);
}
.btn-primary:hover {
  background: var(--brand-purple-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(72, 17, 88, 0.32);
  color: #ffffff !important;
}

.btn-secondary {
  background: #ffffff;
  color: var(--brand-purple) !important;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--brand-purple);
  color: var(--brand-purple-dark) !important;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--brand-purple);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-wallet {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-apple-wallet {
  background: #000;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-apple-wallet:hover {
  background: #1a1a1a;
  color: #fff !important;
}

.btn-google-wallet {
  background: #fff;
  color: #1a1a2e !important;
  border: 1px solid #ddd;
}
.btn-google-wallet:hover {
  background: #f5f5f5;
  color: #1a1a2e !important;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-static,
.card-static:hover {
  transform: none;
}

.card-body {
  padding: 1.5rem;
}

.card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-tertiary);
}

.card-image-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--gradient-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

/* Event Detail Cover */
.event-detail-cover {
  width: 100%;
  max-height: 520px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-tertiary);
  overflow: hidden;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.event-detail-cover-image {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 520px;
  object-fit: contain;
  background: var(--bg-tertiary);
  display: block;
  margin: 0 auto;
}

/* Event Card */
.event-card {
  cursor: pointer;
}
.event-card .event-card-date {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-purple);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.event-card .event-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0.25rem 0 0.5rem;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-card .event-card-venue {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.event-card .event-card-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.75rem;
}

/* Ticket Select Card */
.ticket-select-card {
  display: block;
  text-decoration: none;
  cursor: pointer;
  background: var(--bg-card);
}

.ticket-select-card:hover {
  border-color: var(--brand-purple) !important;
  box-shadow: 0 4px 16px rgba(59, 18, 77, 0.12);
  transform: translateY(-2px);
}

.ticket-select-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.ticket-select-card:hover .ticket-select-btn {
  background: var(--brand-purple) !important;
  color: #ffffff !important;
  border-color: var(--brand-purple) !important;
}

.ticket-type-option:has(input:checked) {
  border-color: var(--brand-purple) !important;
  background: rgba(59, 18, 77, 0.04) !important;
}

/* Grid Layouts */
.grid-events {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  transition: all var(--transition-fast);
  outline: none;
}

input[type="date"].form-input,
input[type="time"].form-input {
  cursor: pointer;
}

.image-upload-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  background: var(--bg-card);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.image-upload-zone:hover,
.image-upload-zone.dragover {
  border-color: var(--brand-purple);
  background: var(--brand-purple-tint);
}

.image-preview-box {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 0.75rem;
  border: 1px solid var(--border-default);
  background: #0f172a;
}

.image-preview-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
  background: #0f172a;
  min-height: 180px;
}

.image-preview-box img {
  max-width: 100%;
  max-height: 380px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
}

.banner-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-default);
}

.banner-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.banner-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.banner-badge.success {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.3);
}

.banner-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.banner-error-alert {
  margin-top: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px rgba(72, 17, 88, 0.12);
}

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

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--brand-purple);
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-published { background: rgba(16, 185, 129, 0.12); color: #059669; }
.status-draft { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.status-cancelled { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.status-completed { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
.status-valid { background: rgba(16, 185, 129, 0.12); color: #059669; }
.status-used { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }

/* Agent Task Status Badges */
.status-pending { background: #f59e0b; color: #fff; }
.status-dispatched { background: #3b82f6; color: #fff; }
.status-running { background: #8b5cf6; color: #fff; }
.status-needs-input { background: #ef4444; color: #fff; }
.status-in-dev { background: #eab308; color: #fff; }
.status-deploying { background: #3b82f6; color: #fff; }
.status-task-completed { background: #22c55e; color: #fff; }
.status-changes-requested { background: #f97316; color: #fff; }
.status-discarded { background: #6b7280; color: #fff; }
.status-failed { background: #dc2626; color: #fff; }

/* --- Hero Section --- */
.hero {
  padding: 1.5rem 0 3.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 10%, rgba(72, 17, 88, 0.05) 0%, transparent 60%), #ffffff;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--brand-purple);
  letter-spacing: -0.03em;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-search {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.hero-search .form-input {
  padding: 1rem 1.25rem 1rem 3rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-xl);
  background: #ffffff;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.hero-search .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* --- Section --- */
.section {
  padding: 3.5rem 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand-purple);
}

/* --- Category Chips --- */
.category-chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
}
.category-chips::-webkit-scrollbar { display: none; }

.chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.chip:hover, .chip.active {
  background: var(--brand-purple);
  color: white !important;
  border-color: transparent;
}

/* --- Tables --- */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}
.table-responsive table {
  min-width: 750px;
  width: 100%;
}

.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
}

td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-secondary); }

/* --- Stats Cards --- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  color: var(--brand-purple);
}

.stat-card .stat-value.text-success {
  color: #059669;
}

.stat-card .stat-value.text-accent {
  color: var(--brand-purple);
}

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

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.stat-card.sa-stat-highlight {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(59, 18, 77, 0.04));
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.08);
}

/* --- Flash Messages / Toast --- */
.flash-message {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: flash-in 0.3s ease-out;
}

.flash-success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.flash-error {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.flash-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

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

/* --- Check-in Result --- */
.check-in-result {
  text-align: center;
  padding: 2rem;
  border-radius: var(--radius-lg);
  animation: scale-in 0.3s ease-out;
}

.check-in-success {
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid var(--color-success);
}

.check-in-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 2px solid #f59e0b;
}

.check-in-fail {
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid var(--color-error);
}

.check-in-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

#qr-reader {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--brand-purple);
  box-shadow: var(--shadow-md);
  background: #000000;
}

#qr-reader__scan_region {
  background: #000000;
}

#qr-reader__dashboard_section_csr button {
  background: var(--brand-purple);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  margin: 0.5rem 0.25rem;
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Ticket Display --- */
.ticket-card {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
}

.ticket-card-header {
  padding: 1.5rem;
  background: var(--gradient-subtle);
  border-bottom: 1px dashed var(--border-hover);
  text-align: center;
}

.ticket-card-body {
  padding: 1.5rem;
  text-align: center;
}

.ticket-card-qr {
  width: 210px;
  height: 210px;
  margin: 1rem auto;
  background: white;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.ticket-qr-img {
  width: 180px;
  height: 180px;
  display: block;
  image-rendering: pixelated;
}

.ticket-card-actions {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px dashed var(--border-hover);
}

/* --- Dashboard Layout --- */
.dashboard-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 57px);
  max-width: 100vw;
}

.dashboard-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border-default);
  padding: 1.5rem 0;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--brand-purple);
  background: var(--bg-tertiary);
  border-left-color: var(--brand-purple);
  font-weight: 600;
}

/* Dashboard Mobile Navigation Dropdown */
.dashboard-mobile-nav {
  display: none;
  background: #ffffff;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-default);
}

.mobile-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.mobile-select-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 1;
}

.mobile-nav-select {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brand-purple);
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233B124D'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.mobile-nav-select:focus {
  border-color: var(--brand-purple);
  outline: none;
  box-shadow: 0 0 0 3px rgba(72, 17, 88, 0.12);
}

.dashboard-content {
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-secondary);
  min-width: 0;
  max-width: 100%;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* --- HTMX Indicator --- */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-hover);
  border-top-color: var(--brand-purple);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Footer --- */
.footer {
  background: #ffffff;
  border-top: 1px solid var(--border-default);
  padding: 2.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--brand-purple); }
.text-success { color: #059669; }
.text-error { color: var(--color-error); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* --- Landing Page Components --- */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--brand-purple);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero-cta-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.trust-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 3rem;
  flex-wrap: wrap;
  padding: 1.25rem 2rem;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.trust-badge-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.trust-badge-item strong {
  color: var(--brand-purple);
}

/* Feature Boxes */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-box {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.feature-box:hover {
  border-color: var(--brand-purple);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
  color: var(--brand-purple);
}

.feature-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.feature-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Testimonials */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.testimonial-card {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.testimonial-stars {
  color: #f59e0b;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.testimonial-quote {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.testimonial-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--brand-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}

.testimonial-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

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

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2.5rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.pricing-card {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

.pricing-card.popular {
  border: 2px solid var(--brand-purple);
  box-shadow: 0 8px 32px rgba(72, 17, 88, 0.12);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-purple);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.875rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pricing-header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-default);
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  color: var(--brand-purple);
  margin: 0.5rem 0;
}

.pricing-features {
  list-style: none;
  margin-bottom: 2rem;
  flex: 1;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.pricing-features li span.check {
  color: #059669;
  font-weight: bold;
}

/* Calculator Box */
.calc-container {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  margin-top: 3rem;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  /* Prevent iOS Safari auto-zoom on input/textarea focus */
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
  select,
  textarea,
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important;
  }

  .hero-title { font-size: 2.25rem; }
  .grid-events { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .dashboard-layout { display: block; }
  .dashboard-sidebar { display: none !important; }
  .dashboard-mobile-nav { display: block; }
  .dashboard-content { padding: 1.25rem 1rem; min-width: 0; max-width: 100%; overflow-x: hidden; }
  .navbar-inner { padding: 0.75rem 1rem; }
  .navbar-links { display: flex; align-items: center; gap: 0.35rem; }
  .navbar-links .btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
  .container { padding: 0 1rem; }
  .trust-badges { gap: 1rem; padding: 1rem; }
  .features-grid, .testimonials-grid, .pricing-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .hero { padding: 2.5rem 0; }
  .hero-title { font-size: 1.75rem; }
  .btn-lg { padding: 0.75rem 1.5rem; font-size: 0.9375rem; }
  .navbar-brand { font-size: 1.15rem; gap: 0.4rem; }
  .brand-logo-img { height: 26px; }
  .navbar-links { gap: 0.25rem; }
  .navbar-links .btn-sm { padding: 0.35rem 0.6rem; font-size: 0.78rem; }
  .bug-report-card {
    padding: 1.25rem 1rem !important;
    border-radius: 12px !important;
  }
}

/* --- Bug Report & Modals --- */
.bug-report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bug-report-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  position: relative;
  box-sizing: border-box;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  margin: auto;
}

/* ============================================================
   Super Admin Portal
   ============================================================ */

.superadmin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

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

.sa-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tabs */
.sa-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-default);
  padding-bottom: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sa-tabs::-webkit-scrollbar {
  display: none;
}

.sa-tab {
  padding: 0.65rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -2px;
  flex-shrink: 0;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.sa-tab:hover {
  color: var(--text-primary);
  background: var(--brand-purple-tint, rgba(59, 18, 77, 0.05));
}

.sa-tab.active {
  color: var(--accent-start);
  border-bottom-color: var(--accent-start);
}

/* Stats Grid */
.sa-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sa-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.sa-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.sa-stat-primary {
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  border: none;
  color: #fff;
}

.sa-stat-primary .sa-stat-label {
  color: rgba(255, 255, 255, 0.8);
}

.sa-stat-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.sa-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}

.sa-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Tables */
.sa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.sa-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.sa-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.sa-table tbody tr:hover {
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.03);
}

.sa-table .text-right {
  text-align: right;
}

/* Clients Pivot Table */
.sa-pivot-event {
  border-top: 2px solid var(--border);
}

.sa-pivot-event:first-child {
  border-top: none;
}

.sa-pivot-event-header {
  padding: 1rem 1.5rem;
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sa-event-link {
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease;
}

.sa-event-link:hover {
  color: var(--brand-purple-light);
  text-decoration: underline;
}

.sa-event-link .sa-link-icon {
  font-size: 0.75em;
  opacity: 0.6;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.sa-event-link:hover .sa-link-icon {
  opacity: 1;
  transform: translate(1px, -1px);
}

.sa-pivot-table {
  font-size: 0.8rem;
}

.sa-pivot-group-row td {
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.02);
}

.sa-pivot-buyers-row td {
  padding: 0 !important;
  border-bottom: 2px solid var(--border);
}

.sa-buyers-details {
  width: 100%;
}

.sa-buyers-summary {
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-secondary);
  user-select: none;
  transition: background 0.15s;
}

.sa-buyers-summary:hover {
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.06);
  color: var(--text-primary);
}

.sa-buyers-table {
  background: var(--bg);
  font-size: 0.75rem;
}

.sa-buyers-table th {
  font-size: 0.65rem;
  padding: 0.5rem 1rem;
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.03);
}

.sa-buyers-table td {
  padding: 0.4rem 1rem;
}

/* Client Accordion Pivot Table */
.sa-client-accordion {
  border-top: 1px solid var(--border);
}

.sa-client-accordion:first-of-type {
  border-top: none;
}

.sa-client-accordion[open] > .sa-client-summary {
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.06);
  border-bottom: 1px solid var(--border);
}

.sa-client-accordion[open] > .sa-client-summary .sa-client-toggle {
  transform: rotate(90deg);
}

.sa-client-summary {
  padding: 1rem 1.5rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}

.sa-client-summary::-webkit-details-marker {
  display: none;
}

.sa-client-summary:hover {
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.04);
}

.sa-client-summary-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sa-client-summary-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 200px;
}

.sa-client-toggle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sa-client-summary-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sa-client-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  min-width: 70px;
}

.sa-client-events-wrapper {
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.02);
  border-bottom: 2px solid var(--border);
}

.sa-client-events-wrapper .sa-pivot-event {
  margin-left: 1.5rem;
  border-left: 2px solid var(--border);
}

.sa-client-no-events {
  padding: 1rem 2rem;
}

@media (max-width: 768px) {
  .sa-client-summary-main {
    flex-direction: column;
    align-items: flex-start;
  }
  .sa-client-summary-right {
    width: 100%;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-top: 0.5rem;
  }
  .sa-client-stat {
    align-items: flex-start;
  }
}

/* Health Checks */
.sa-health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.sa-health-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sa-health-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: 8px;
}

.sa-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sa-health-ok { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }
.sa-health-warning { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.sa-health-error { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }

.sa-health-name {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
}

.sa-health-detail {
  flex: 1;
}

/* Database Stats */
.sa-db-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sa-db-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.sa-db-row:nth-child(odd) {
  background: var(--bg);
}

/* Costs */
.sa-costs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.sa-alert {
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

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

.sa-info-box {
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1024px) {
  .sa-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sa-health-grid,
  .sa-costs-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .superadmin-container {
    padding: 1rem 0.5rem;
    min-width: 0;
  }
  .sa-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .sa-stat-card {
    padding: 0.75rem;
  }
  .sa-stat-value {
    font-size: 1.1rem;
  }
  .sa-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .sa-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================
   AGENT ACTIVITY FEED & STEPS TIMELINE
   ========================================== */
.agent-activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-top-bar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-default);
}

.activity-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.activity-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.activity-stat-pill.total {
  background: rgba(59, 18, 77, 0.08);
  color: var(--brand-purple);
  font-weight: 600;
}

.activity-stat-pill.cmd {
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
}

.activity-stat-pill.view {
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
}

.activity-stat-pill.edit {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

.activity-stat-pill.search {
  background: rgba(139, 92, 246, 0.1);
  color: #6d28d9;
}

.activity-stat-pill.thinking {
  background: rgba(236, 72, 153, 0.1);
  color: #be185d;
}

.activity-stat-pill.live-pulse {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
  font-weight: 600;
  animation: pulse 2s infinite;
}

.activity-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.activity-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  padding: 3px 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background: rgba(59, 18, 77, 0.04);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--brand-purple);
  color: #ffffff;
  border-color: var(--brand-purple);
  font-weight: 600;
}

.btn-toggle-all {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  padding: 3px 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-toggle-all:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

.activity-steps-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 500px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  scroll-behavior: auto !important;
}

.step-card {
  border: 1px solid var(--border-default);
  border-radius: 1rem 1rem 1rem 0;
  background: #ffffff;
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  max-width: 90%;
  align-self: flex-start;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

.step-card.tool-response {
  border-radius: 1rem 1rem 0 1rem;
  align-self: flex-end;
  background: #fdfaef;
}

.step-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.step-details summary {
  list-style: none;
}

.step-details summary::-webkit-details-marker {
  display: none;
}

.step-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  cursor: pointer;
  gap: 0.75rem;
  user-select: none;
  flex-wrap: wrap;
}

.step-summary-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.step-index {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 24px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.step-badge.tool-cmd {
  background: #1e1b4b;
  color: #c7d2fe;
}

.step-badge.tool-view {
  background: #e0f2fe;
  color: #0369a1;
}

.step-badge.tool-edit {
  background: #fef3c7;
  color: #b45309;
}

.step-badge.tool-create {
  background: #dcfce7;
  color: #15803d;
}

.step-badge.tool-search {
  background: #ede9fe;
  color: #6d28d9;
}

.step-badge.tool-web {
  background: #ccfbf1;
  color: #0f766e;
}

.step-badge.tool-thinking {
  background: #fae8ff;
  color: #86198f;
}

.step-badge.tool-response {
  background: #f3e8ff;
  color: #6b21a8;
}

.step-badge.tool-other {
  background: #f1f5f9;
  color: #475569;
}

.step-action-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.step-target-code {
  font-size: 0.75rem;
  background: rgba(59, 18, 77, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--brand-purple);
  word-break: break-all;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.step-summary-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.step-timestamp {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.step-status-check {
  color: #16a34a;
  font-weight: 700;
  font-size: 0.85rem;
}

.step-status-running {
  color: #2563eb;
  animation: pulse 1.5s infinite;
}

.step-status-err {
  color: #dc2626;
  font-weight: 700;
}

.step-chevron {
  font-size: 0.8rem;
  transition: transform var(--transition-fast);
}

.step-details[open] .step-chevron {
  transform: rotate(180deg);
}

.step-body-content {
  padding: 0.6rem 0.75rem;
  border-top: 1px solid rgba(59, 18, 77, 0.06);
  background: #fdfcfe;
  font-size: 0.85rem;
}

.step-subheading {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.step-thinking-block {
  background: #faf5ff;
  border-left: 3px solid #c084fc;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.step-thinking-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #581c87;
  white-space: pre-wrap;
  font-style: italic;
}

.step-args-block {
  margin-bottom: 0.5rem;
}

.step-args-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px;
  font-size: 0.75rem;
}

.step-arg-item {
  background: rgba(0, 0, 0, 0.02);
  padding: 3px 6px;
  border-radius: 4px;
  word-break: break-all;
}

.step-arg-key {
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

.step-arg-val code {
  color: var(--brand-purple);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.step-output-block {
  margin-top: 0.4rem;
}

.step-output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.btn-copy-output {
  font-size: 0.65rem;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-copy-output:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.step-output-pre {
  background: #18181b;
  color: #f4f4f5;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.75rem;
  line-height: 1.45;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  scroll-behavior: auto;
}

.step-card.tool-response .step-output-pre {
  max-height: 550px;
  background: #1e1b2e;
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: #f8fafc;
}

.step-card-active-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-sm);
  margin-top: 0.4rem;
}

.running-spinner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6366f1;
  animation: pulse 1s infinite;
}

.running-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.running-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-purple);
}

.running-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.activity-empty-state {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--text-muted);
}
