*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal: #0D9488;
  --teal-dark: #0F766E;
  --teal-light: #CCFBF1;
  --teal-pale: #F0FDFA;
  --slate: #1E293B;
  --slate-mid: #475569;
  --slate-light: #94A3B8;
  --border: #E2E8F0;
  --white: #ffffff;
  --red: #EF4444;
  --amber: #F59E0B;
  --green: #10B981;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: #F8FAFC;
  color: var(--slate);
  min-height: 100vh;
}

.hidden { display: none !important; }
.page { min-height: 100vh; }

/* LOGIN */
#loginPage {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--teal-pale) 0%, #E0F2FE 100%);
  min-height: 100vh;
}
.login-box {
  background: var(--white); border-radius: 20px;
  padding: 48px 40px; width: 100%; max-width: 400px;
  box-shadow: 0 8px 40px rgba(13,148,136,0.12);
  text-align: center;
}
.logo-mark {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--teal); color: var(--white);
  font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.logo-mark.small {
  width: 36px; height: 36px; border-radius: 8px;
  font-size: 13px; margin: 0;
}
.login-box h1 { font-size: 24px; font-weight: 700; color: var(--slate); margin-bottom: 6px; }
.login-sub { color: var(--slate-light); font-size: 14px; margin-bottom: 28px; }
.error-msg {
  background: #FEF2F2; color: var(--red); border: 1px solid #FECACA;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}

/* LAYOUT */
#mainApp { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; min-height: 100vh; background: var(--slate);
  display: flex; flex-direction: column; padding: 24px 16px;
  position: fixed; top: 0; left: 0; height: 100vh;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--white); font-size: 17px; font-weight: 700;
  margin-bottom: 36px; padding: 0 8px;
}
nav { flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  color: var(--slate-light); text-decoration: none;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  margin-bottom: 4px; transition: all 0.15s;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.08); color: var(--white);
}
.nav-item.active { color: var(--teal-light); }
.nav-icon { font-size: 16px; }
.btn-logout {
  background: none; border: 1px solid rgba(255,255,255,0.15);
  color: var(--slate-light); padding: 9px 16px; border-radius: 8px;
  font-size: 13px; cursor: pointer; width: 100%; transition: all 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.06); color: var(--white); }

.content { margin-left: 220px; padding: 32px; flex: 1; }
.section { max-width: 1200px; }

/* PAGE HEADER */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--slate-light); font-size: 14px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-card.teal { background: var(--teal); border-color: var(--teal); }
.stat-card.teal .stat-value, .stat-card.teal .stat-label { color: var(--white); }
.stat-card.amber { background: #FFFBEB; border-color: #FDE68A; }
.stat-card.amber .stat-value { color: var(--amber); }
.stat-card.slate { background: var(--slate); border-color: var(--slate); }
.stat-card.slate .stat-value, .stat-card.slate .stat-label { color: var(--white); }
.stat-value { font-size: 36px; font-weight: 700; font-family: 'DM Mono', monospace; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 13px; color: var(--slate-light); font-weight: 500; }

/* TOOLBAR */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.search-wrap { flex: 1; min-width: 200px; }
.search-wrap input {
  width: 100%; padding: 9px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: var(--white); color: var(--slate);
}
.filter-wrap { display: flex; gap: 8px; }
.filter-wrap select {
  padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13px; font-family: inherit;
  background: var(--white); color: var(--slate); cursor: pointer;
}

/* CARDS */
.card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px; font-weight: 600; font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.mt24 { margin-top: 24px; }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: #F8FAFC; padding: 11px 16px; text-align: left;
  font-weight: 600; color: var(--slate-mid); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  color: var(--slate); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--teal-pale); }

/* BADGES */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
}
.badge-paid { background: #D1FAE5; color: #065F46; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-refunded { background: #FEE2E2; color: #991B1B; }
.badge-registered { background: #E0F2FE; color: #0369A1; }
.badge-attended { background: #D1FAE5; color: #065F46; }
.badge-noshow { background: #FEE2E2; color: #991B1B; }
.badge-eventover { background: #F1F5F9; color: #475569; }
.badge-male { background: #EFF6FF; color: #1D4ED8; }
.badge-female { background: #FDF4FF; color: #7E22CE; }

.cue-id {
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 700;
  color: var(--teal); background: var(--teal-light);
  padding: 3px 9px; border-radius: 6px;
}

/* ACTION BUTTONS */
.action-btns { display: flex; gap: 6px; }
.btn-edit {
  background: var(--teal-light); color: var(--teal-dark);
  border: none; padding: 5px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-edit:hover { background: var(--teal); color: var(--white); }
.btn-del {
  background: #FEE2E2; color: var(--red);
  border: none; padding: 5px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-del:hover { background: var(--red); color: var(--white); }

/* FORMS */
.form-group { margin-bottom: 16px; flex: 1; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--slate-mid); margin-bottom: 6px; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input, .form-group select {
  width: 100%; padding: 9px 13px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  color: var(--slate); background: var(--white); transition: border 0.15s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}
.form-row { display: flex; gap: 16px; }
.hint { color: var(--slate-light); font-size: 11px; font-weight: 400; text-transform: none; }

/* BUTTONS */
.btn-primary {
  background: var(--teal); color: var(--white);
  border: none; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.15s; white-space: nowrap;
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary.full-width { width: 100%; padding: 12px; font-size: 15px; }
.btn-secondary {
  background: var(--white); color: var(--slate);
  border: 1.5px solid var(--border); padding: 10px 20px;
  border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-secondary:hover { background: #F8FAFC; }
.btn-danger {
  background: var(--red); color: var(--white);
  border: none; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-danger:hover { background: #DC2626; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal {
  background: var(--white); border-radius: 16px;
  width: 100%; max-width: 620px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal.small { max-width: 400px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--slate-light);
  font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 6px;
}
.modal-close:hover { color: var(--slate); }
.modal-body { padding: 24px; }
.modal-body p { font-size: 14px; color: var(--slate-mid); line-height: 1.6; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--slate); color: var(--white);
  padding: 12px 20px; border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2); z-index: 9999;
  animation: slideIn 0.3s ease;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes slideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
}