/* ================================================================
   beyondEmberPAY – Main Stylesheet
   Dark premium design | Mobile-first | No framework dependencies
   ================================================================ */

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

/* ── Design Tokens ────────────────────────────────────────────── */
:root {
  --bg-base:       #0d0d1a;
  --bg-surface:    #13131f;
  --bg-elevated:   #191928;
  --glass-bg:      rgba(255,255,255,0.04);
  --glass-border:  rgba(255,255,255,0.09);
  --glass-shadow:  0 8px 32px rgba(0,0,0,0.45);

  --accent:        #6c63ff;
  --accent-glow:   rgba(108,99,255,0.3);
  --accent-hover:  #5a52e0;
  --income:        #43b89c;
  --income-bg:     rgba(67,184,156,0.13);
  --expense:       #ff6584;
  --expense-bg:    rgba(255,101,132,0.13);

  --text-primary:  #f0f0ff;
  --text-secondary:#9ca3af;
  --text-muted:    #6b7280;

  --border-radius: 14px;
  --border-radius-sm: 8px;
  --transition:    0.22s ease;
  --sidebar-w:     220px;
  --topnav-h:      60px;
  --font:          'Inter', system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Background noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(108,99,255,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(255,101,132,0.12) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

/* ── Glassmorphism ────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--glass-shadow);
}

/* ── Layout ───────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topnav-h);
  position: relative;
  z-index: 1;
}

.main-content {
  flex: 1;
  padding: 28px 24px 48px;
  margin-left: var(--sidebar-w);
  max-width: 1400px;
  width: 100%;
}

/* ── Top Navigation ───────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topnav-h);
  z-index: 100;
  border-bottom: 1px solid var(--glass-border);
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}
.brand-text strong { color: var(--accent); }
.brand:hover { opacity: 1; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.topnav-right { display: flex; align-items: center; gap: 12px; }

.nav-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  transition: background var(--transition);
}
.nav-user:hover { background: rgba(255,255,255,0.07); }
.nav-user:hover .nav-dropdown { display: flex; }

.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}
.avatar-lg {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
}

.nav-user-info {
  display: flex; flex-direction: column;
  line-height: 1.2;
}
.nav-username { font-weight: 600; font-size: 13px; }
.nav-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.nav-dropdown {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
}
.dropdown-item {
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 13px;
  display: block;
  transition: background var(--transition);
}
.dropdown-item:hover { background: rgba(255,255,255,0.08); opacity: 1; }
.dropdown-item.text-danger { color: var(--expense); }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topnav-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topnav-h));
  border-right: 1px solid var(--glass-border);
  background: rgba(13,13,26,0.9);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  z-index: 90;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sidebar-footer { border-top: 1px solid var(--glass-border); padding-top: 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  opacity: 1;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(108,99,255,0.28), rgba(108,99,255,0.12));
  color: var(--text-primary);
  border: 1px solid rgba(108,99,255,0.35);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; height: 60%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item-danger { color: var(--expense); }
.nav-item-danger:hover { color: #ff8fa3; }

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.page-sub { color: var(--text-secondary); margin-top: 4px; font-size: 13.5px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  border-radius: var(--border-radius);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.stat-icon { font-size: 28px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub   { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.stat-positive { border-color: rgba(67,184,156,0.35); }
.stat-income   { border-color: rgba(67,184,156,0.35); }
.stat-expense  { border-color: rgba(255,101,132,0.35); }
.stat-negative { border-color: rgba(255,101,132,0.35); }

/* ── Charts ──────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-card { border-radius: var(--border-radius); }
.chart-wrap { height: 220px; position: relative; }

/* ── Bottom Row ──────────────────────────────────────────────── */
.bottom-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}

/* ── Transaction List ────────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: 2px; }
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-radius: var(--border-radius-sm);
  transition: background var(--transition);
}
.tx-item:hover { background: rgba(255,255,255,0.04); }
.tx-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-desc { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 11.5px; color: var(--text-muted); }
.tx-amount { font-weight: 700; font-size: 14px; white-space: nowrap; }

/* ── Recurring List ──────────────────────────────────────────── */
.recurring-list { display: flex; flex-direction: column; gap: 2px; }
.rec-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-radius: var(--border-radius-sm);
  transition: background var(--transition);
}
.rec-item:hover { background: rgba(255,255,255,0.04); }
.rec-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.rec-income  { background: var(--income-bg);  color: var(--income);  }
.rec-expense { background: var(--expense-bg); color: var(--expense); }
.rec-info { flex: 1; min-width: 0; }
.rec-desc { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { font-size: 11.5px; color: var(--text-muted); }
.rec-amount { font-weight: 700; font-size: 13.5px; white-space: nowrap; }

/* ── Filter Bar ───────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  align-items: center;
}
.filter-search { flex: 1; min-width: 160px; }
.filter-select { width: auto; }
.filter-month  { width: auto; }

/* ── Data Table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--glass-border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.row-income  td:first-child { border-left: 3px solid var(--income); }
.row-expense td:first-child { border-left: 3px solid var(--expense); }
.row-inactive { opacity: 0.5; }

/* ── Avatar chip ─────────────────────────────────────────────── */
.avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.avatar-chip::before {
  content: attr(data-init, '?');
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ac, #6c63ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: #fff;
}
/* Use first child text as initial */
.avatar-chip { position: relative; }

/* Reset: use the text content of first element directly */
/* The PHP outputs the initial directly before display_name */

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  padding: 14px 14px 6px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--border-radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.page-btn:hover  { background: rgba(255,255,255,0.1); color: var(--text-primary); opacity: 1; }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9b59b6);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(108,99,255,0.45);
  opacity: 1;
}
.btn-ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); opacity: 1; }
.btn-danger { background: var(--expense-bg); border: 1px solid rgba(255,101,132,0.4); color: var(--expense); }
.btn-danger:hover { background: rgba(255,101,132,0.25); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 5px; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; text-decoration: none; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.form-group-wide { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.required { color: var(--expense); }

.form-control {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control option { background: var(--bg-elevated); color: var(--text-primary); }
.form-control-sm { padding: 6px 10px; font-size: 12.5px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* Password input wrapper */
.input-password-wrap { position: relative; }
.input-password-wrap .form-control { padding-right: 44px; }
.eye-btn {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; font-size: 16px;
  opacity: 0.5; transition: opacity var(--transition);
  color: var(--text-primary);
}
.eye-btn:hover { opacity: 1; }

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
}
.checkbox-label input[type=checkbox] { display: none; }
.checkbox-custom {
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 2px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.form-card { border-radius: var(--border-radius); }

/* Type switcher */
.type-switch {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  width: fit-content;
}
.type-btn {
  padding: 10px 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.type-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }
.type-btn.active-expense { background: var(--expense-bg); color: var(--expense); }
.type-btn.active-income  { background: var(--income-bg);  color: var(--income);  }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
}
.badge-income  { background: var(--income-bg);  color: var(--income);  }
.badge-expense { background: var(--expense-bg); color: var(--expense); }
.badge-active  { background: rgba(67,184,156,0.2); color: var(--income); }
.badge-inactive{ background: rgba(255,255,255,0.07); color: var(--text-muted); }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 13.5px;
  border-left: 3px solid;
}
.alert-success { background: rgba(67,184,156,0.12);  border-color: var(--income);  color: var(--income); }
.alert-danger  { background: rgba(255,101,132,0.12); border-color: var(--expense); color: var(--expense); }
.alert-warning { background: rgba(247,147,30,0.12);  border-color: #f7931e;        color: #f7931e; }
.mb-4 { margin-bottom: 16px; }

/* ── Calendar ────────────────────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-bottom: 16px;
  padding: 16px;
}
.cal-header {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 0;
}
.cal-cell {
  min-height: 90px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  position: relative;
  transition: background var(--transition);
}
.cal-cell:hover { background: rgba(255,255,255,0.04); }
.cal-empty { opacity: 0; pointer-events: none; }
.cal-today {
  background: rgba(108,99,255,0.12);
  border-color: rgba(108,99,255,0.3);
}
.cal-has-events .cal-day-num { color: var(--text-primary); }
.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.cal-today .cal-day-num {
  background: var(--accent);
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px;
}
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event.ev-income  { background: var(--income-bg);  color: var(--income);  }
.cal-event.ev-expense { background: var(--expense-bg); color: var(--expense); }

.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-month-label { font-weight: 700; font-size: 16px; }

.cal-legend {
  display: flex;
  gap: 20px;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.leg-item { display: flex; align-items: center; gap: 6px; }
.leg-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.leg-dot.ev-income  { background: var(--income); }
.leg-dot.ev-expense { background: var(--expense); }
.leg-dot.cal-today-dot { background: var(--accent); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  width: 100%;
  max-width: 560px;
  border-radius: var(--border-radius);
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: rgba(255,255,255,0.07);
  border: none;
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--expense-bg); color: var(--expense); }

/* ── AUTH page ───────────────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orbFloat 8s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; background: var(--accent); top: -150px; left: -100px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: var(--expense); bottom: -120px; right: -80px; animation-delay: -3s; }
.orb-3 { width: 300px; height: 300px; background: var(--income); top: 50%; left: 60%; animation-delay: -6s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.05); }
  66%       { transform: translate(-20px, 15px) scale(0.97); }
}

.auth-wrapper { position: relative; z-index: 1; width: 100%; max-width: 420px; }
.auth-card {
  border-radius: 20px;
  padding: 36px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  justify-content: center;
}
.auth-logo-text { font-size: 22px; font-weight: 500; color: var(--text-primary); }
.auth-logo-text strong { color: var(--accent); }

.auth-tabs {
  display: flex;
  background: rgba(255,255,255,0.04);
  border-radius: var(--border-radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.auth-tab.active {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.hidden { display: none; }

/* ── Utilities ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-income  { color: var(--income); }
.text-expense { color: var(--expense); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.fw-600       { font-weight: 600; }
.inline-form  { display: inline; }
.empty-state  { padding: 32px; text-align: center; color: var(--text-muted); font-size: 14px; }
.btn-link     { color: var(--accent); }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .charts-row { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-100%);
    width: 240px;
    z-index: 999;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    padding: 16px 14px 40px;
  }

  .nav-toggle { display: flex; }
  .nav-user-info { display: none; }

  .form-grid { grid-template-columns: 1fr; }
  .form-group-wide { grid-column: 1; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .calendar-grid {
    gap: 0;
    padding: 8px;
  }
  .cal-cell { min-height: 60px; padding: 4px; }
  .cal-event { font-size: 9px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card  { padding: 24px 20px; }
  .filter-bar { flex-direction: column; }
  .filter-search, .filter-select, .filter-month { width: 100%; }
  .type-switch { width: 100%; }
  .type-btn { flex: 1; }
}

/* ── Micro animations ────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-card  { animation: fadeInUp 0.4s ease both; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.10s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }

.card { animation: fadeInUp 0.4s ease 0.1s both; }

/* Sidebar active indicator glow */
.nav-item.active { box-shadow: inset 0 0 16px rgba(108,99,255,0.12); }

/* ── Permissions Page ────────────────────────────────────────── */
.role-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 24px;
}
.role-legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }

.user-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.user-card {
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeInUp 0.35s ease both;
}
.user-card:hover { transform: translateY(-2px); box-shadow: 0 10px 36px rgba(0,0,0,0.45); }
.user-card-inactive { opacity: 0.55; }

.ucard-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ucard-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.ucard-info { flex: 1; min-width: 0; }
.ucard-name     { font-weight: 700; font-size: 15px; }
.ucard-username { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.ucard-badges   { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.role-admin    { background: rgba(108,99,255,0.2); color: #a39bff; border: 1px solid rgba(108,99,255,0.4); }
.role-member   { background: rgba(67,184,156,0.15); color: var(--income); border: 1px solid rgba(67,184,156,0.3); }
.role-inactive { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--glass-border); }
.role-self     { background: rgba(247,147,30,0.15); color: #f7931e; border: 1px solid rgba(247,147,30,0.3); }

.ucard-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--glass-border);
}
.ucard-stat { text-align: center; }
.ucard-stat-val   { font-weight: 700; font-size: 14px; }
.ucard-stat-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.ucard-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ucard-form { display: inline; }
.btn-role-up   { color: #a39bff; border-color: rgba(108,99,255,0.3); }
.btn-role-down { color: var(--income); border-color: rgba(67,184,156,0.3); }
.btn-activate  { color: var(--income); }

.pw-reset-form { border-top: 1px solid var(--glass-border); padding-top: 12px; }
.pw-reset-inner {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pw-reset-inner .form-control { flex: 1; }

.ucard-self-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--glass-border);
  padding-top: 10px;
}

@media (max-width: 600px) {
  .user-cards-grid { grid-template-columns: 1fr; }
  .ucard-stats { grid-template-columns: 1fr 1fr; }
  .pw-reset-inner { flex-direction: column; align-items: stretch; }
}

