/* ============================================
   FINTRAK — WORLD-CLASS FINTECH DASHBOARD CSS
   ============================================ */

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

/* ─── CSS VARIABLES ─────────────────────────── */
:root {
  /* Dark theme (default) */
  --bg-primary: #080b14;
  --bg-secondary: #0d1220;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-glass: rgba(255,255,255,0.05);
  --bg-modal: rgba(8,11,20,0.95);

  --border: rgba(255,255,255,0.08);
  --border-glow: rgba(139,92,246,0.4);

  --text-primary: #f0f4ff;
  --text-secondary: #8892a4;
  --text-muted: #4a5568;

  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-orange: #f97316;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-pink: #ec4899;

  --grad-purple: linear-gradient(135deg, #8b5cf6, #6d28d9);
  --grad-blue: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --grad-orange: linear-gradient(135deg, #f97316, #ea580c);
  --grad-green: linear-gradient(135deg, #10b981, #059669);
  --grad-red: linear-gradient(135deg, #ef4444, #dc2626);
  --grad-cyan: linear-gradient(135deg, #06b6d4, #0891b2);
  --grad-hero: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 50%, #06b6d4 100%);

  --shadow-sm: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(139,92,246,0.2);

  --sidebar-w: 260px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --transition-fast: all 0.15s ease;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f0f2f8;
  --bg-secondary: #e8eaf2;
  --bg-card: rgba(255,255,255,0.85);
  --bg-card-hover: rgba(255,255,255,0.95);
  --bg-glass: rgba(255,255,255,0.7);
  --bg-modal: rgba(240,242,248,0.97);
  --border: rgba(0,0,0,0.08);
  --border-glow: rgba(139,92,246,0.3);
  --text-primary: #1a1f36;
  --text-secondary: #4a5568;
  --text-muted: #a0aec0;
  --shadow-sm: 0 4px 16px rgba(139,92,246,0.1);
  --shadow-md: 0 8px 32px rgba(139,92,246,0.15);
  --shadow-lg: 0 20px 60px rgba(139,92,246,0.2);
}

/* ─── RESET & BASE ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(139,92,246,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(59,130,246,0.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; border: none; }

/* ─── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.4); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

/* ─── LAYOUT ─────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 100;
  transition: var(--transition);
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.sidebar.collapsed { width: 72px; }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 38px; height: 38px;
  background: var(--grad-hero);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 16px; color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(139,92,246,0.4);
}

.sidebar-brand {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 20px;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar-toggle {
  margin-left: auto;
  width: 28px; height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--accent-purple); color: white; border-color: transparent; }

/* Profile section */
.sidebar-profile {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--grad-hero);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: white;
  flex-shrink: 0;
  position: relative;
  border: 2px solid var(--accent-purple);
}
.avatar-online {
  position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: var(--accent-green);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.profile-info { overflow: hidden; flex: 1; min-width: 0; }
.profile-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { font-size: 11px; color: var(--text-muted); }

/* Nav */
.sidebar-nav { flex: 1; padding: 12px 12px; overflow-y: auto; overflow-x: hidden; }

.nav-section-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
  transition: var(--transition);
  white-space: nowrap;
  color: var(--text-secondary);
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); transform: translateX(2px); }
.nav-item.active { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--accent-purple);
  border-radius: 0 3px 3px 0;
}

.nav-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-label { font-size: 13.5px; font-weight: 500; transition: var(--transition); }
.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: white; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 99px; flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.upgrade-card {
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(59,130,246,0.2));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.upgrade-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.upgrade-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.upgrade-sub { font-size: 11px; color: var(--text-secondary); margin-bottom: 10px; }
.upgrade-btn {
  display: block; width: 100%;
  background: var(--grad-purple);
  color: white; font-size: 12px; font-weight: 600;
  padding: 8px; border-radius: 8px;
  text-align: center;
  transition: var(--transition);
}
.upgrade-btn:hover { opacity: 0.9; box-shadow: 0 4px 12px rgba(139,92,246,0.4); }

/* Collapsed sidebar hide text */
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .profile-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .upgrade-card { display: none; }
.sidebar.collapsed .sidebar-profile { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-footer { padding: 16px 0; display: flex; justify-content: center; }

/* ─── MAIN CONTENT ───────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
}
.main-content.expanded { margin-left: 72px; }

/* ─── TOPBAR ─────────────────────────────────── */
.topbar {
  height: 68px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(20px);
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--text-primary);
}

.topbar-search {
  flex: 1; max-width: 340px; margin: 0 auto;
  position: relative;
}
.topbar-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 9px 16px 9px 40px;
  font-size: 13.5px; color: var(--text-primary);
  transition: var(--transition);
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }
.topbar-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.topbar-btn {
  width: 38px; height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  position: relative; transition: var(--transition);
}
.topbar-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--accent-purple); }
.topbar-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--accent-red); border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* Notification Dropdown */
.notif-dropdown {
  position: absolute; top: calc(100% + 12px); right: 0;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  transform: translateY(-8px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.notif-dropdown.open { opacity: 1; transform: none; pointer-events: all; }
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-header h4 { font-size: 14px; font-weight: 700; }
.notif-header span { font-size: 12px; color: var(--accent-purple); cursor: pointer; }
.notif-item { padding: 13px 16px; display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--border); transition: var(--transition); cursor: pointer; }
.notif-item:hover { background: var(--bg-card); }
.notif-item:last-child { border-bottom: none; }
.notif-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.notif-text { font-size: 13px; line-height: 1.5; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ─── PAGE SECTIONS ──────────────────────────── */
.page-section {
  padding: 28px;
  display: none;
  animation: fadeInUp 0.4s ease;
}
.page-section.active { display: block; }

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

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.section-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 700;
}
.section-meta { font-size: 13px; color: var(--text-secondary); }

/* ─── SUMMARY CARDS ──────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  position: relative; overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(12px);
}
.summary-card:hover { background: var(--bg-card-hover); transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(255,255,255,0.12); }

.summary-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
}

.summary-card .card-glow {
  position: absolute; top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.4;
  transition: var(--transition);
}
.summary-card:hover .card-glow { opacity: 0.7; transform: scale(1.3); }

.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-icon-wrap {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.card-change { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 99px; }
.card-change.up { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.card-change.down { background: rgba(239,68,68,0.15); color: var(--accent-red); }

.card-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 6px; }
.card-value { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; }
.card-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ─── CHARTS SECTION ─────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
.charts-grid .chart-full { grid-column: 1 / -1; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  backdrop-filter: blur(12px);
  transition: var(--transition);
}
.chart-card:hover { box-shadow: var(--shadow-md); border-color: rgba(255,255,255,0.1); }

.chart-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.chart-card-title { font-size: 15px; font-weight: 700; }
.chart-card-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

canvas { max-height: 280px; }

/* ─── TRANSACTIONS ───────────────────────────── */
.transactions-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.panel-title { font-size: 15px; font-weight: 700; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-card); color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: var(--transition); cursor: pointer;
}
.filter-btn.active, .filter-btn:hover {
  background: rgba(139,92,246,0.15);
  color: var(--accent-purple);
  border-color: rgba(139,92,246,0.3);
}

.transaction-list { padding: 8px 0; }

.tx-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 22px;
  transition: var(--transition); cursor: pointer;
}
.tx-item:hover { background: var(--bg-card-hover); }

.tx-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.tx-info { flex: 1; min-width: 0; }
.tx-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.tx-cat-badge { padding: 2px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 600; }

.tx-right { text-align: right; flex-shrink: 0; }
.tx-amount { font-size: 15px; font-weight: 700; font-family: 'Syne', sans-serif; }
.tx-amount.income { color: var(--accent-green); }
.tx-amount.expense { color: var(--accent-red); }
.tx-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.tx-actions { display: flex; gap: 6px; opacity: 0; transition: var(--transition); }
.tx-item:hover .tx-actions { opacity: 1; }
.tx-action-btn {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: var(--transition);
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
}
.tx-action-btn:hover { background: var(--accent-red); color: white; border-color: transparent; }
.tx-action-btn.edit:hover { background: var(--accent-purple); color: white; border-color: transparent; }

.empty-state {
  text-align: center;
  padding: 56px 24px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-secondary); }

/* ─── INSIGHTS ───────────────────────────────── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: var(--transition); cursor: default;
  animation: fadeInUp 0.5s ease both;
}
.insight-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.insight-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.insight-text .insight-title { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.insight-text .insight-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }

/* ─── CREDIT CARD ────────────────────────────── */
.credit-card-wrap { perspective: 1000px; width: 340px; height: 200px; }
.credit-card {
  width: 100%; height: 100%;
  border-radius: 20px;
  background: linear-gradient(135deg, #1a0533, #0d1f4e, #002a4a);
  position: relative; overflow: hidden;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
  cursor: pointer;
}
.credit-card:hover { transform: rotateY(-8deg) rotateX(5deg); }

.credit-card::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(139,92,246,0.4), transparent 70%);
  border-radius: 50%;
}
.credit-card::after {
  content: '';
  position: absolute; bottom: -50px; left: -30px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(59,130,246,0.3), transparent 70%);
  border-radius: 50%;
}

.card-chip {
  width: 42px; height: 32px;
  background: linear-gradient(135deg, #d4a017, #f7c948);
  border-radius: 6px; margin-bottom: 20px;
  position: relative; z-index: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.card-number { font-size: 17px; font-weight: 500; letter-spacing: 3px; color: rgba(255,255,255,0.9); margin-bottom: 16px; position: relative; z-index: 1; font-family: 'Syne', sans-serif; }
.card-bottom { display: flex; justify-content: space-between; align-items: flex-end; position: relative; z-index: 1; }
.card-holder-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.5); }
.card-holder-name { font-size: 14px; font-weight: 600; color: white; margin-top: 2px; }
.card-network { font-size: 22px; opacity: 0.8; }

/* ─── GROUP EXPENSES ─────────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition); cursor: pointer;
}
.group-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.group-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.group-avatar { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.group-name { font-size: 15px; font-weight: 700; }
.group-members-count { font-size: 12px; color: var(--text-secondary); }

.group-members { display: flex; margin-bottom: 14px; }
.member-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
  margin-left: -8px;
}
.member-avatar-sm:first-child { margin-left: 0; }
.member-more { background: var(--bg-card); color: var(--text-secondary); font-size: 10px; }

.group-balance { padding-top: 14px; border-top: 1px solid var(--border); }
.balance-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 5px 0; }
.balance-row .owe { color: var(--accent-red); font-weight: 600; }
.balance-row .owed { color: var(--accent-green); font-weight: 600; }

.group-total { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.group-total span:last-child { font-weight: 700; color: var(--text-primary); }

/* ─── BUTTONS ────────────────────────────────── */
.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  transition: var(--transition); cursor: pointer;
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
}
.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--grad-purple); color: white; box-shadow: 0 4px 14px rgba(139,92,246,0.35); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(139,92,246,0.5); transform: translateY(-1px); }

.btn-ghost { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card-hover); border-color: var(--accent-purple); }

.btn-danger { background: var(--grad-red); color: white; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 9px; border-radius: 10px; }

/* Ripple */
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.3); transform: scale(0); animation: rippleAnim 0.6s linear; pointer-events: none; }
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ─── MODAL ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: none; }

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; transition: var(--transition);
}
.modal-close:hover { background: var(--accent-red); color: white; border-color: transparent; }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── FORM FIELDS ────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.05em; }

.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px; color: var(--text-primary);
  transition: var(--transition);
}
.form-input:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }
.form-input::placeholder { color: var(--text-muted); }

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

.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-option {
  padding: 10px 6px;
  border-radius: 10px; text-align: center;
  cursor: pointer; font-size: 12px; font-weight: 500;
  background: var(--bg-card); border: 2px solid transparent;
  transition: var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.cat-option:hover { border-color: var(--accent-purple); background: rgba(139,92,246,0.1); }
.cat-option.selected { border-color: var(--accent-purple); background: rgba(139,92,246,0.2); color: var(--accent-purple); }
.cat-option .cat-emoji { font-size: 20px; }

.type-toggle { display: flex; gap: 0; background: var(--bg-card); border-radius: 10px; padding: 4px; border: 1px solid var(--border); }
.type-option { flex: 1; padding: 8px; text-align: center; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); color: var(--text-secondary); }
.type-option.active-income { background: rgba(16,185,129,0.2); color: var(--accent-green); }
.type-option.active-expense { background: rgba(239,68,68,0.2); color: var(--accent-red); }

/* ─── AUTH PAGES ─────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-page::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 70% at 10% 20%, rgba(139,92,246,0.15), transparent),
    radial-gradient(ellipse 60% 60% at 90% 80%, rgba(59,130,246,0.12), transparent);
  z-index: -1;
}

.auth-container {
  width: 100%; max-width: 440px;
  animation: fadeInUp 0.5s ease;
}

.auth-logo-area {
  text-align: center; margin-bottom: 36px;
}
.auth-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--grad-hero);
  border-radius: 16px;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 22px; color: white;
  box-shadow: 0 8px 24px rgba(139,92,246,0.4);
  margin-bottom: 16px;
}
.auth-title { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); }

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.auth-form .form-group { margin-bottom: 20px; }

.floating-input-wrap {
  position: relative;
}
.floating-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.auth-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14.5px; color: var(--text-primary);
  transition: var(--transition);
}
.auth-input:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 4px rgba(139,92,246,0.12); }
.auth-input::placeholder { color: var(--text-muted); }
.auth-input.password-input { padding-right: 48px; }

.password-toggle {
  position: absolute; right: 14px; bottom: 14px;
  background: none; color: var(--text-muted); font-size: 16px;
  cursor: pointer; transition: var(--transition); padding: 0;
}
.password-toggle:hover { color: var(--accent-purple); }

.auth-submit {
  width: 100%;
  background: var(--grad-purple);
  color: white; font-size: 15px; font-weight: 700;
  padding: 14px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(139,92,246,0.4);
  transition: var(--transition);
  position: relative; overflow: hidden;
  margin-top: 4px;
}
.auth-submit:hover { box-shadow: 0 8px 28px rgba(139,92,246,0.55); transform: translateY(-2px); }
.auth-submit:active { transform: scale(0.98); }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { font-size: 12px; color: var(--text-muted); }

.auth-footer { text-align: center; margin-top: 24px; font-size: 13.5px; color: var(--text-secondary); }
.auth-footer a { color: var(--accent-purple); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

.input-error { border-color: var(--accent-red) !important; box-shadow: 0 0 0 3px rgba(239,68,68,0.15) !important; }
.error-msg { font-size: 11.5px; color: var(--accent-red); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.form-success {
  background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3);
  border-radius: 10px; padding: 12px 16px; font-size: 13px; color: var(--accent-green);
  display: flex; align-items: center; gap: 8px; margin-bottom: 18px;
  animation: fadeInUp 0.3s ease;
}

/* ─── LOADING SKELETON ───────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeletonWave 1.5s infinite;
  border-radius: 8px;
}
@keyframes skeletonWave { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-row { height: 60px; margin-bottom: 8px; border-radius: 12px; }
.skeleton-card { height: 110px; border-radius: 16px; }

/* ─── THEME TOGGLE ───────────────────────────── */
.theme-toggle {
  width: 48px; height: 26px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px; cursor: pointer;
  position: relative; transition: var(--transition);
  flex-shrink: 0;
}
.theme-toggle.light-mode { background: var(--accent-purple); border-color: transparent; }
.theme-toggle-ball {
  width: 18px; height: 18px; border-radius: 50%;
  background: white;
  position: absolute; top: 3px; left: 3px;
  transition: var(--transition); box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.theme-toggle.light-mode .theme-toggle-ball { left: 27px; }
.toggle-icons { display: flex; justify-content: space-between; padding: 0 5px; align-items: center; height: 100%; font-size: 11px; }

/* ─── PROGRESS BAR ───────────────────────────── */
.progress-bar { height: 6px; background: var(--bg-card); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 1s cubic-bezier(0.4,0,0.2,1); }

/* ─── SEARCH RESULTS ─────────────────────────── */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  max-height: 260px; overflow-y: auto; z-index: 200;
  transform: translateY(-4px); opacity: 0; pointer-events: none; transition: var(--transition);
}
.search-results.open { opacity: 1; transform: none; pointer-events: all; }
.search-result-item { padding: 11px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: var(--transition); font-size: 13.5px; }
.search-result-item:hover { background: var(--bg-card); }
.search-result-item .sr-icon { font-size: 18px; }

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: none; }
  .main-content { margin-left: 0 !important; }
  .mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; display: none; }
  .mobile-overlay.open { display: block; }
  .groups-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .page-section { padding: 16px; }
  .topbar { padding: 0 16px; }
  .auth-card { padding: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .credit-card-wrap { width: 100%; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ─── LOADING SPINNER ────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── TOAST NOTIFICATION ─────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: 12px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500;
  min-width: 260px; max-width: 360px;
  animation: slideInRight 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}
.toast.removing { animation: slideOutRight 0.3s ease forwards; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(32px); } }
@keyframes slideOutRight { to { opacity: 0; transform: translateX(32px); } }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.success { border-color: rgba(16,185,129,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }
.toast.info { border-color: rgba(59,130,246,0.3); }

/* ─── TAB BAR (mobile nav) ───────────────────── */
@media (max-width: 900px) {
  .mobile-fab {
    position: fixed; bottom: 24px; right: 24px;
    width: 52px; height: 52px;
    background: var(--grad-purple);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(139,92,246,0.5);
    z-index: 80; cursor: pointer; font-size: 22px; color: white;
    transition: var(--transition);
  }
  .mobile-fab:hover { transform: scale(1.1); }
}

/* Stagger animation delays for cards */
.summary-card:nth-child(1) { animation-delay: 0.05s; }
.summary-card:nth-child(2) { animation-delay: 0.1s; }
.summary-card:nth-child(3) { animation-delay: 0.15s; }
.summary-card:nth-child(4) { animation-delay: 0.2s; }

/* Index page (landing) */
.landing-hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 24px;
  position: relative; z-index: 1;
}
.landing-logo { font-size: 72px; margin-bottom: 8px; }
.landing-title { font-family: 'Syne', sans-serif; font-size: clamp(40px,8vw,80px); font-weight: 800; line-height: 1.1; margin-bottom: 20px; }
.landing-grad { background: var(--grad-hero); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.landing-sub { font-size: 18px; color: var(--text-secondary); max-width: 500px; line-height: 1.6; margin-bottom: 40px; }
.landing-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-xl { padding: 14px 32px; font-size: 15px; border-radius: 14px; }

/* ─── GROUP FEATURE ENHANCED ─────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.group-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: rgba(139,92,246,0.25); }

.group-card-banner {
  height: 6px;
  background: var(--grad-hero);
}

.group-card-body { padding: 20px; }

.group-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.group-avatar {
  width: 50px; height: 50px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(59,130,246,0.2));
  border: 1px solid rgba(139,92,246,0.2);
}
.group-name { font-size: 16px; font-weight: 700; }
.group-members-count { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.group-actions { display: flex; gap: 6px; margin-left: auto; }

.group-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 10px; margin-bottom: 18px;
}
.gstat {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; text-align: center;
}
.gstat-val { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 800; }
.gstat-label { font-size: 10px; color: var(--text-muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.05em; }

.group-members-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.member-avatars { display: flex; }
.member-avatar-sm {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
  margin-left: -9px; transition: var(--transition);
}
.member-avatar-sm:first-child { margin-left: 0; }
.member-avatar-sm:hover { transform: translateY(-3px) scale(1.1); z-index: 2; }
.member-more { background: var(--bg-card); color: var(--text-secondary); font-size: 10px; border: 2px solid var(--border); }

.group-balance-section { border-top: 1px solid var(--border); padding-top: 14px; }
.gbal-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.balance-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 5px;
  background: var(--bg-glass); font-size: 13px;
  transition: var(--transition);
}
.balance-row:hover { background: var(--bg-card-hover); }
.balance-row .owe-badge {
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
  background: rgba(239,68,68,0.15); color: var(--accent-red);
}
.balance-row .owed-badge {
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
  background: rgba(16,185,129,0.15); color: var(--accent-green);
}
.balance-settled { text-align: center; padding: 10px; font-size: 13px; color: var(--accent-green); font-weight: 600; }

.group-expense-list { margin-top: 12px; max-height: 200px; overflow-y: auto; }
.gexp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; transition: var(--transition);
  border-bottom: 1px solid var(--border);
}
.gexp-item:last-child { border-bottom: none; }
.gexp-item:hover { background: var(--bg-card-hover); }
.gexp-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.gexp-title { font-weight: 600; flex: 1; }
.gexp-meta { font-size: 11px; color: var(--text-muted); }
.gexp-amount { font-weight: 700; font-family: 'Syne', sans-serif; }

/* Group detail panel */
.group-detail-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.group-detail-overlay.open { opacity: 1; pointer-events: all; }

.group-detail-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 680px;
  max-height: 88vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.group-detail-overlay.open .group-detail-panel { transform: none; }

.gdp-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.gdp-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.gdp-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.gdp-tabs { display: flex; gap: 4px; background: var(--bg-card); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.gdp-tab {
  flex: 1; padding: 8px; text-align: center; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-secondary); transition: var(--transition);
}
.gdp-tab.active { background: var(--grad-purple); color: white; box-shadow: 0 2px 8px rgba(139,92,246,0.3); }

.gdp-tab-content { display: none; }
.gdp-tab-content.active { display: block; animation: fadeInUp 0.25s ease; }

/* Member balance cards in detail */
.member-balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.mbal-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 12px;
}
.mbal-avatar { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; font-size: 14px; flex-shrink: 0; }
.mbal-name { font-size: 13px; font-weight: 700; }
.mbal-amount { font-size: 12px; margin-top: 2px; font-weight: 600; }

/* Settle button */
.settle-btn {
  padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 700;
  background: rgba(16,185,129,0.15); color: var(--accent-green);
  border: 1px solid rgba(16,185,129,0.3); cursor: pointer; transition: var(--transition);
}
.settle-btn:hover { background: var(--accent-green); color: white; border-color: transparent; }

/* Quick add expense in modal */
.member-checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.member-checkbox {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 8px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: var(--transition); user-select: none;
}
.member-checkbox input { accent-color: var(--accent-purple); }
.member-checkbox:has(input:checked) { background: rgba(139,92,246,0.15); border-color: var(--accent-purple); color: var(--accent-purple); }

/* Groups section header with stats */
.group-summary-bar {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;
}
.gsb-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
}
.gsb-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.gsb-val { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; }
.gsb-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

@media (max-width: 640px) {
  .group-summary-bar { grid-template-columns: 1fr; }
  .member-balance-grid { grid-template-columns: 1fr; }
  .groups-grid { grid-template-columns: 1fr; }
  .group-detail-panel { max-height: 95vh; border-radius: var(--radius-lg); }
}

/* Emoji picker */
.emoji-opt {
  width:38px;height:38px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  font-size:20px;cursor:pointer;
  background:var(--bg-card);border:2px solid transparent;
  transition:var(--transition);
}
.emoji-opt:hover { border-color:var(--accent-purple); transform:scale(1.15); }
.emoji-opt.selected { border-color:var(--accent-purple); background:rgba(139,92,246,0.15); }

/* Member tag */
.member-tag {
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 10px;border-radius:99px;
  background:rgba(139,92,246,0.15);border:1px solid rgba(139,92,246,0.3);
  font-size:13px;font-weight:600;color:var(--accent-purple);
}
.member-tag-remove {
  cursor:pointer;opacity:0.6;font-size:15px;line-height:1;
  transition:var(--transition);padding:0 2px;
}
.member-tag-remove:hover { opacity:1;color:var(--accent-red); }

/* ─── DATE RANGE FILTER ──────────────────────── */
.date-range-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 22px;
  transition: var(--transition);
  backdrop-filter: blur(12px);
}

.date-range-card.active {
  border-color: rgba(139,92,246,0.4);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.08), var(--shadow-sm);
}

.date-range-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.date-range-active-badge {
  display: flex;
  align-items: center;
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-purple);
  animation: fadeInUp 0.3s ease;
}

.date-range-inputs {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.date-input-wrap {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
}

.date-input {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
  cursor: pointer;
}
.date-input:focus {
  border-color: var(--accent-purple) !important;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15) !important;
}

.date-range-arrow {
  color: var(--text-muted);
  padding-bottom: 10px;
  flex-shrink: 0;
}

.date-quick-btns {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding-bottom: 2px;
  flex: 2;
}

.date-quick-btn {
  padding: 7px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.date-quick-btn:hover {
  background: rgba(139,92,246,0.12);
  color: var(--accent-purple);
  border-color: rgba(139,92,246,0.4);
  transform: translateY(-1px);
}
.date-quick-btn.active {
  background: rgba(139,92,246,0.18);
  color: var(--accent-purple);
  border-color: var(--accent-purple);
}

/* Summary strip */
.date-range-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 0;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  animation: fadeInUp 0.35s ease;
}

.drs-item {
  text-align: center;
  padding: 8px 12px;
}

.drs-divider {
  width: 1px;
  background: var(--border);
  margin: 4px 0;
}

.drs-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.drs-val {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.drs-item.income .drs-val  { color: var(--accent-green); }
.drs-item.expense .drs-val { color: var(--accent-red); }
.drs-item.balance .drs-val { color: var(--accent-purple); }
.drs-item.count .drs-val   { color: var(--accent-blue); }

@media (max-width: 640px) {
  .date-range-inputs { flex-direction: column; align-items: stretch; }
  .date-input-wrap   { max-width: 100%; }
  .date-range-arrow  { display: none; }
  .date-range-summary {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .drs-divider { display: none; }
  .drs-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
  }
}
