/* ============================================================
   Gift Tracker — Modern Dark Glassmorphism Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --bg: #0a0e1a;
  --bg2: #0d1224;
  --surface: rgba(255, 255, 255, .05);
  --surface2: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .10);
  --border2: rgba(255, 255, 255, .16);

  --text: #e8eaf6;
  --text2: #9ca3b8;
  --text3: #5c6180;

  --primary: #6c63ff;
  --primary-h: #7c74ff;
  --primary-glow: rgba(108, 99, 255, .35);

  --accent: #00d4aa;
  --accent-glow: rgba(0, 212, 170, .25);

  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, .25);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, .25);
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, .25);
  --blue: #3b82f6;
  --blue-glow: rgba(59, 130, 246, .25);

  --sidebar-back: linear-gradient(180deg, #0d1224 0%, #080b18 100%);
  --topbar-back: rgba(10, 14, 26, .8);

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, .35);
  --transition: .2s cubic-bezier(.4, 0, .2, 1);
}

[data-theme="light"] {
  --bg: #f5f7fb;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --border: #e2e8f0;
  --border2: #cbd5e1;

  --text: #1e293b;
  --text2: #475569;
  --text3: #94a3b8;

  --primary: #4f46e5;
  --primary-h: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);

  --sidebar-back: #ffffff;
  --topbar-back: rgba(255, 255, 255, .8);
  --shadow: 0 4px 24px rgba(0, 0, 0, .06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .05);
}

/* ── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html {
  scroll-behavior: smooth
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none
}

img {
  max-width: 100%;
  display: block
}

ul {
  list-style: none
}

button {
  cursor: pointer;
  font-family: inherit
}

svg {
  flex-shrink: 0
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 99px
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text3)
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  min-height: 100vh
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition);
}

.page-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-back);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow: hidden;
}

/* Logo */
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.sidebar-logo .brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.sidebar-logo h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.sidebar-logo .tagline {
  font-size: 11px;
  color: var(--text3);
  padding-left: 48px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 12px 8px 6px;
  margin-top: 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .7;
  transition: opacity var(--transition);
}

.sidebar-nav a:hover {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-nav a:hover svg {
  opacity: 1
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(108, 99, 255, .2), rgba(0, 212, 170, .08));
  color: var(--text);
  border: 1px solid rgba(108, 99, 255, .3);
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 0 3px 3px 0;
}

.sidebar-nav a.active svg {
  opacity: 1;
  color: var(--primary)
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-details .user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.user-details .user-role {
  font-size: 11px;
  color: var(--text3);
  text-transform: capitalize;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.logout-btn svg {
  width: 16px;
  height: 16px
}

.logout-btn:hover {
  background: rgba(239, 68, 68, .1);
  border-color: rgba(239, 68, 68, .3);
  color: var(--red);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--topbar-back);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  padding: 6px;
}

.hamburger svg {
  width: 22px;
  height: 22px
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb span:not(.sep) {
  color: var(--text2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--border2)
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px
}

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(255, 255, 255, .02));
  pointer-events: none;
}

.stat-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 22px;
  height: 22px
}

.stat-icon.purple {
  background: rgba(108, 99, 255, .15);
  color: var(--primary)
}

.stat-icon.teal {
  background: rgba(0, 212, 170, .15);
  color: var(--accent)
}

.stat-icon.amber {
  background: rgba(245, 158, 11, .15);
  color: var(--amber)
}

.stat-icon.red {
  background: rgba(239, 68, 68, .15);
  color: var(--red)
}

.stat-icon.green {
  background: rgba(34, 197, 94, .15);
  color: var(--green)
}

.stat-icon.blue {
  background: rgba(59, 130, 246, .15);
  color: var(--blue)
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  overflow-x: auto
}

table {
  width: 100%;
  border-collapse: collapse
}

thead tr {
  border-bottom: 1px solid var(--border)
}

th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text3);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition)
}

tbody tr:hover {
  background: var(--surface2)
}

tbody tr:last-child td {
  border-bottom: none
}

.fw-600 {
  font-weight: 600
}

.text-muted {
  color: var(--text3)
}

.text-center {
  text-align: center
}

.text-right {
  text-align: right
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: capitalize;
}

.badge-purple {
  background: rgba(108, 99, 255, .15);
  color: #a78bfa;
  border: 1px solid rgba(108, 99, 255, .2)
}

.badge-teal {
  background: rgba(0, 212, 170, .15);
  color: #2dd4bf;
  border: 1px solid rgba(0, 212, 170, .2)
}

.badge-amber {
  background: rgba(245, 158, 11, .15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, .2)
}

.badge-red {
  background: rgba(239, 68, 68, .15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, .2)
}

.badge-green {
  background: rgba(34, 197, 94, .15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, .2)
}

.badge-blue {
  background: rgba(59, 130, 246, .15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, .2)
}

.badge-gray {
  background: rgba(100, 116, 139, .15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, .2)
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.btn svg {
  width: 15px;
  height: 15px
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5b52e5);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-h), #6c63ff);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-teal {
  background: linear-gradient(135deg, var(--accent), #00bcd4);
  color: #0a0e1a;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-teal:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow)
}

.btn-outline {
  background: transparent;
  border-color: var(--border2);
  color: var(--text2);
}

.btn-outline:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--primary)
}

.btn-danger {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .25);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, .2);
  border-color: var(--red)
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px
}

.btn-sm svg {
  width: 13px;
  height: 13px
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm)
}

.w-100 {
  width: 100%
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 18px
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: .2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--surface2);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text3)
}

select.form-control {
  cursor: pointer
}

select.form-control option {
  background: var(--bg2);
  color: var(--text)
}

textarea.form-control {
  resize: vertical;
  min-height: 90px
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

.form-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px
}

/* Autocomplete List */
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  display: none;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: all var(--transition);
  border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--surface2);
  color: var(--text);
}

/* Search bar */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text3);
  pointer-events: none;
}

.search-box input {
  padding-left: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  width: 240px;
  outline: none;
  transition: all var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(108, 99, 255, .12);
}

.search-box input::placeholder {
  color: var(--text3)
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  animation: slideDown .25s ease;
}

.alert svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 1px
}

.alert-success {
  background: rgba(34, 197, 94, .1);
  border: 1px solid rgba(34, 197, 94, .25);
  color: #4ade80
}

.alert-danger {
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .25);
  color: #f87171
}

.alert-info {
  background: rgba(59, 130, 246, .1);
  border: 1px solid rgba(59, 130, 246, .25);
  color: #60a5fa
}

.alert-warning {
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .25);
  color: #fbbf24
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: scale(.95) translateY(10px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0)
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--surface2);
  color: var(--text)
}

.modal-close svg {
  width: 18px;
  height: 18px
}

.modal-body {
  padding: 20px 24px 24px
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 24px;
}

/* ============================================================
   PAGE TOOLBAR
   ============================================================ */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-toolbar-left,
.page-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-bg {
  min-height: 100vh;
  background: radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, .15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 212, 170, .10) 0%, transparent 55%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: fadeUp .4s ease;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px
}

.auth-logo .logo-wrap {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.4px;
  margin-bottom: 4px
}

.auth-logo p {
  font-size: 13px;
  color: var(--text2)
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text2);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 600
}

.auth-footer a:hover {
  text-decoration: underline
}

.auth-divider {
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .5px;
  margin: 8px 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text3);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  opacity: .35;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px
}

.empty-state p {
  font-size: 13px
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.page-btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  background: none;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}

.page-btn:hover {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text)
}

.page-btn.active {
  background: rgba(108, 99, 255, .2);
  border-color: rgba(108, 99, 255, .4);
  color: var(--primary);
  font-weight: 700;
}

/* ============================================================
   EVENT CARDS (client grid)
   ============================================================ */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.event-card:hover {
  border-color: var(--border2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm)
}

.event-card-header {
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, rgba(108, 99, 255, .08), rgba(0, 212, 170, .04));
}

.event-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px
}

.event-card-body {
  padding: 12px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text2)
}

.event-meta svg {
  width: 14px;
  height: 14px;
  color: var(--text3)
}

.event-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================================
   IMPORT/EXPORT SECTION
   ============================================================ */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.file-input-wrap {
  position: relative;
  overflow: hidden;
  display: inline-flex;
}

.file-input-wrap input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-icon {
  width: 52px;
  height: 52px;
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.confirm-icon svg {
  width: 24px;
  height: 24px;
  color: var(--red)
}

/* ============================================================
   UTILITIES
   ============================================================ */
.gap-8 {
  gap: 8px
}

.gap-12 {
  gap: 12px
}

.flex {
  display: flex
}

.flex-wrap {
  flex-wrap: wrap
}

.items-center {
  align-items: center
}

.justify-between {
  justify-content: space-between
}

.mt-4 {
  margin-top: 4px
}

.mt-8 {
  margin-top: 8px
}

.mt-16 {
  margin-top: 16px
}

.mt-24 {
  margin-top: 24px
}

.mb-8 {
  margin-bottom: 8px
}

.mb-16 {
  margin-bottom: 16px
}

.mb-20 {
  margin-bottom: 20px
}

.p-20 {
  padding: 20px
}

.hidden {
  display: none !important
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

/* number highlight */
.num-khr {
  color: var(--amber);
  font-weight: 600
}

.num-usd {
  color: var(--green);
  font-weight: 600
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.animate-fade {
  animation: fadeUp .35s ease
}

/* ============================================================
   RESPONSIVE — Tablet 900px
   ============================================================ */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 0px
  }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    z-index: 300;
    box-shadow: 4px 0 32px rgba(0, 0, 0, .5);
  }

  .sidebar.open {
    transform: translateX(0)
  }

  /* Overlay when sidebar open */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 299;
  }

  .sidebar.open~.sidebar-backdrop {
    display: block
  }

  .main-content {
    margin-left: 0
  }

  .hamburger {
    display: flex
  }

  .page-content {
    padding: 16px 12px
  }

  .topbar {
    padding: 0 14px
  }

  .topbar-title {
    font-size: 15px
  }

  /* Stack toolbar vertically */
  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .page-toolbar-left,
  .page-toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-toolbar-right {
    justify-content: flex-start;
  }

  /* Search fills full width */
  .search-box {
    width: 100%
  }

  .search-box input {
    width: 100% !important;
    flex: 1
  }

  /* Form rows → single column */
  .form-row {
    grid-template-columns: 1fr
  }

  /* Stats 2-column */
  .stats-grid {
    grid-template-columns: 1fr 1fr
  }

  /* Events grid */
  .events-grid {
    grid-template-columns: 1fr 1fr
  }
}

/* ============================================================
   RESPONSIVE — Mobile 640px
   ============================================================ */
@media (max-width: 640px) {
  .page-content {
    padding: 12px 10px
  }

  /* Stats 2-column compact */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px 12px;
    gap: 10px
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px
  }

  .stat-icon svg {
    width: 18px;
    height: 18px
  }

  .stat-value {
    font-size: 17px
  }

  .stat-label {
    font-size: 11px
  }

  /* Events → single column */
  .events-grid {
    grid-template-columns: 1fr
  }

  /* Table: tighten padding */
  th {
    padding: 9px 10px;
    font-size: 10px
  }

  td {
    padding: 10px 10px;
    font-size: 13px
  }

  /* Buttons: tighten */
  .btn {
    padding: 8px 14px;
    font-size: 13px
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 11.5px
  }

  /* ── MODAL: bottom-sheet on mobile ── */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(30px);
  }

  .modal-overlay.open .modal {
    transform: translateY(0);
  }

  /* Modal drag handle visual */
  .modal-header::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--border2);
    border-radius: 2px;
  }

  .modal-header {
    position: relative;
    padding-top: 24px;
  }

  .modal-body {
    padding: 16px 18px 18px
  }

  .modal-footer {
    padding: 0 18px 24px;
    gap: 8px
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center
  }

  /* Larger touch targets for form controls */
  .form-control {
    padding: 12px 14px;
    font-size: 16px;
    /* prevents iOS zoom */
  }

  select.form-control {
    font-size: 16px
  }

  .form-label {
    font-size: 13px;
    margin-bottom: 7px
  }

  .form-group {
    margin-bottom: 14px
  }

  /* Auth card */
  .auth-card {
    padding: 28px 18px;
    border-radius: 20px
  }

  .auth-logo .logo-wrap {
    width: 56px;
    height: 56px;
    font-size: 24px
  }

  .auth-logo h1 {
    font-size: 19px
  }

  /* Table action buttons: stack */
  td>div[style*="display:flex"] {
    flex-wrap: wrap;
    gap: 4px;
  }
}

/* ============================================================
   RESPONSIVE — Small phones 480px
   ============================================================ */
@media (max-width: 480px) {

  /* Stats → single column */
  .stats-grid {
    grid-template-columns: 1fr
  }

  /* Topbar compact */
  .topbar {
    height: 56px
  }

  .topbar-title {
    font-size: 14px
  }

  .breadcrumb {
    display: none
  }

  /* Page toolbar: all items wrap */
  .page-toolbar-right>* {
    flex: 1 1 auto
  }

  .page-toolbar-right .btn,
  .page-toolbar-right .file-input-wrap {
    flex: 1 1 calc(50% - 5px)
  }

  .page-toolbar-right .btn-primary {
    flex: 1 1 100%
  }

  /* Tighter padding */
  .page-content {
    padding: 10px 8px
  }

  .card-header {
    padding: 14px 14px 0
  }

  /* Hide less important table cols on very small screens */
  .hide-xs {
    display: none
  }
}