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

:root {
  --purple: #6C3CE1;
  --purple-dark: #4A1FA8;
  --purple-light: #9B6FFF;
  --purple-glow: rgba(108, 60, 225, 0.25);
  --gold: #FFB800;
  --gold-light: #FFD055;
  --green: #22C55E;
  --red: #EF4444;
  --orange: #F97316;
  --bg: #0F0A1E;
  --bg2: #1A1332;
  --bg3: #241B45;
  --card: #1E1640;
  --card2: #2A1F55;
  --border: rgba(255,255,255,0.08);
  --text: #F0EDFF;
  --text2: #A89EC7;
  --text3: #6B5E8E;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%; overflow: hidden;
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, select { user-select: text; }

.hidden { display: none !important; }

/* ─── LOADING ──────────────────────────────────────────────── */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.loading-logo { text-align: center; }
.loading-icon { font-size: 64px; display: block; animation: bounce 1s infinite alternate; }
.loading-logo h1 { font-size: 32px; font-weight: 900; color: var(--gold); margin-top: 12px; }
.loading-logo p { color: var(--text2); margin-top: 4px; }
.loading-bar {
  width: 200px; height: 4px; background: var(--bg3);
  border-radius: 2px; margin: 24px auto 0; overflow: hidden;
}
.loading-progress {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  border-radius: 2px;
  animation: loadprogress 1.5s ease-in-out forwards;
}
@keyframes loadprogress { to { width: 100%; } }
@keyframes bounce { to { transform: translateY(-8px); } }

/* ─── AUTH ─────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; background: var(--bg);
  display: flex; flex-direction: column;
  padding-top: var(--safe-top);
}
.auth-hero {
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  padding: 48px 24px 40px; text-align: center;
  clip-path: ellipse(120% 100% at 50% 0%);
}
.auth-hero.small { padding: 32px 24px 28px; }
.auth-logo { font-size: 56px; display: block; margin-bottom: 8px; }
.auth-hero h1 { font-size: 28px; font-weight: 900; color: var(--gold); }
.auth-hero p { color: rgba(255,255,255,0.75); margin-top: 4px; }
.auth-card {
  flex: 1; padding: 28px 24px;
  background: var(--bg);
}
.auth-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 20px; }
.auth-switch { text-align: center; color: var(--text2); font-size: 14px; margin-top: 16px; }
.auth-switch a { color: var(--purple-light); font-weight: 700; text-decoration: none; }

/* ─── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--text2); margin-bottom: 6px; letter-spacing: 0.3px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--text);
  font-family: 'Nunito', sans-serif; font-size: 15px;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--purple-light); }
.form-group textarea { resize: none; }
.form-group select option { background: var(--bg2); }
.error-msg {
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px; padding: 10px 12px;
  color: #FCA5A5; font-size: 13px; margin-bottom: 12px;
}
.select-sm {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; color: var(--text);
  font-size: 13px; outline: none;
}

/* ─── BUTTONS ──────────────────────────────────────────────── */
button { cursor: pointer; border: none; font-family: 'Nunito', sans-serif; transition: all 0.15s; }
button:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white; font-size: 16px; font-weight: 800;
  padding: 14px 24px; border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--purple-glow);
}
.btn-primary:active { box-shadow: none; }
.btn-full { width: 100%; display: block; }
.btn-ghost {
  background: transparent; color: var(--text2); font-size: 15px;
  font-weight: 700; padding: 12px 24px; border-radius: var(--radius);
  border: 1.5px solid var(--border);
}
.btn-icon {
  background: var(--purple); color: white;
  font-size: 13px; font-weight: 800;
  padding: 7px 14px; border-radius: 20px;
}
.btn-link {
  background: transparent; color: var(--purple-light);
  font-size: 13px; font-weight: 700; padding: 4px 0;
}
.btn-danger {
  background: rgba(239,68,68,0.15); color: #FCA5A5;
  font-size: 15px; font-weight: 700; padding: 14px 24px;
  border-radius: var(--radius); border: 1px solid rgba(239,68,68,0.3);
}
.btn-sm {
  font-size: 12px; padding: 6px 14px; border-radius: 20px; font-weight: 700;
}
.btn-green { background: var(--green); color: white; }
.btn-red { background: var(--red); color: white; }

/* ─── TOP BAR ──────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--safe-top) + 60px);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg3); font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-info { display: flex; flex-direction: column; gap: 2px; }
.topbar-info span { font-size: 14px; font-weight: 800; color: var(--text); line-height: 1; }
.points-badge {
  background: var(--purple); color: white;
  font-size: 11px; font-weight: 800;
  padding: 2px 8px; border-radius: 10px; width: fit-content;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.streak-badge {
  background: rgba(255,184,0,0.15);
  border: 1px solid rgba(255,184,0,0.3);
  border-radius: 20px; padding: 4px 10px;
  font-size: 13px; font-weight: 800; color: var(--gold);
}
.notif-btn {
  position: relative; background: var(--bg3);
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.notif-dot {
  position: absolute; top: -2px; right: -2px;
  background: var(--red); color: white;
  font-size: 9px; font-weight: 900;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ─── PAGES ────────────────────────────────────────────────── */
.pages-container {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  bottom: calc(var(--safe-bot) + 58px);
  left: 0; right: 0;
  overflow: hidden;
}
.page { position: absolute; inset: 0; overflow: hidden; }
.page-scroll { height: 100%; overflow-y: auto; padding: 16px 16px 0; -webkit-overflow-scrolling: touch; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
}
.page-header h2 { font-size: 22px; font-weight: 900; }

/* ─── BOTTOM NAV ───────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-top: 1px solid var(--border);
  display: flex; align-items: center;
  height: calc(var(--safe-bot) + 58px);
  padding-bottom: var(--safe-bot);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; padding: 6px 4px; background: transparent;
  color: var(--text3); transition: color 0.2s;
}
.nav-item.active { color: var(--purple-light); }
.nav-item.active .nav-icon { transform: scale(1.2); }
.nav-icon { font-size: 22px; transition: transform 0.2s; }
.nav-label { font-size: 10px; font-weight: 700; }

/* ─── LEVEL CARD ───────────────────────────────────────────── */
.level-card {
  background: linear-gradient(135deg, var(--purple-dark), #1A0E38);
  border: 1px solid rgba(108,60,225,0.4);
  border-radius: 20px; padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(108,60,225,0.2);
}
.level-info { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.level-label { font-size: 12px; color: var(--purple-light); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.level-number { font-size: 42px; font-weight: 900; color: var(--gold); line-height: 1; }
.level-name { font-size: 16px; font-weight: 800; color: white; }
.xp-bar {
  height: 8px; background: rgba(255,255,255,0.1);
  border-radius: 4px; overflow: hidden; margin-bottom: 6px;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 4px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.xp-text { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 600; }
.level-stats { display: flex; gap: 24px; margin-top: 16px; }
.stat-item { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 18px; font-weight: 900; color: white; }
.stat-label { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 600; }

/* ─── QUICK TASKS ──────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-header h3 { font-size: 16px; font-weight: 800; }
.quick-tasks { display: flex; flex-direction: column; gap: 8px; }
.quick-task {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.quick-task:active { transform: scale(0.98); }
.quick-task.done { opacity: 0.5; }
.quick-task.negative { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.06); }
.task-icon { font-size: 28px; flex-shrink: 0; }
.task-info { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-cat { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.task-pts {
  font-size: 14px; font-weight: 900;
  padding: 4px 10px; border-radius: 20px;
  flex-shrink: 0;
}
.task-pts.positive { background: rgba(34,197,94,0.15); color: var(--green); }
.task-pts.negative { background: rgba(239,68,68,0.15); color: var(--red); }
.check-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.check-btn.todo { background: var(--bg3); color: var(--text3); }
.check-btn.done-state { background: var(--green); color: white; }

/* ─── TASKS LIST ───────────────────────────────────────────── */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; background: var(--card);
  border: 1px solid var(--border); color: var(--text2);
  font-size: 12px; font-weight: 700;
  padding: 6px 14px; border-radius: 20px;
}
.tab.active { background: var(--purple); border-color: var(--purple); color: white; }
.tasks-list { padding: 8px 16px; display: flex; flex-direction: column; gap: 8px; height: calc(100% - 100px); overflow-y: auto; }
.task-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.task-card.negative { border-left: 3px solid var(--red); }
.task-card-info { flex: 1; min-width: 0; }
.task-card-title { font-size: 15px; font-weight: 700; }
.task-card-desc { font-size: 12px; color: var(--text3); margin-top: 2px; }
.task-card-meta { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.cat-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 10px; background: var(--bg3); color: var(--text3);
}
.task-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── ACTIVITY FEED ────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; gap: 6px; }
.activity-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.activity-icon { font-size: 24px; flex-shrink: 0; }
.activity-info { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 700; }
.activity-meta { font-size: 11px; color: var(--text3); }
.activity-pts { font-size: 14px; font-weight: 900; flex-shrink: 0; }
.activity-pts.pos { color: var(--green); }
.activity-pts.neg { color: var(--red); }
.activity-photo {
  width: 48px; height: 48px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
}

/* ─── BADGES ───────────────────────────────────────────────── */
.badges-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.badges-strip::-webkit-scrollbar { display: none; }
.badge-chip {
  flex-shrink: 0; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 70px;
}
.badge-chip.earned { border-color: var(--gold); background: rgba(255,184,0,0.08); }
.badge-chip .badge-icon { font-size: 26px; }
.badge-chip .badge-name { font-size: 10px; font-weight: 700; color: var(--text3); text-align: center; }
.badge-chip.earned .badge-name { color: var(--gold); }
.badges-full { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px; }
.badge-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.badge-card.earned { border-color: var(--gold); background: rgba(255,184,0,0.06); }
.badge-card .badge-icon { font-size: 36px; }
.badge-card .badge-name { font-size: 12px; font-weight: 800; }
.badge-card .badge-desc { font-size: 10px; color: var(--text3); }
.badge-card.locked .badge-icon { filter: grayscale(1); opacity: 0.4; }
.badge-card.locked .badge-name, .badge-card.locked .badge-desc { opacity: 0.4; }

/* ─── RANKING ──────────────────────────────────────────────── */
.ranking-list { display: flex; flex-direction: column; gap: 8px; }
.ranking-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.ranking-item.me { border-color: var(--purple); background: rgba(108,60,225,0.08); }
.rank-pos { font-size: 20px; font-weight: 900; color: var(--text3); width: 28px; flex-shrink: 0; }
.rank-pos.gold { color: var(--gold); }
.rank-pos.silver { color: #C0C0C0; }
.rank-pos.bronze { color: #CD7F32; }
.rank-avatar { font-size: 26px; flex-shrink: 0; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 14px; font-weight: 800; }
.rank-sub { font-size: 11px; color: var(--text3); }
.rank-points { font-size: 16px; font-weight: 900; color: var(--gold); }

/* ─── REWARDS ──────────────────────────────────────────────── */
.my-points-banner {
  background: linear-gradient(135deg, var(--purple-dark), var(--bg3));
  border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
.my-points-banner span:first-child { font-size: 13px; color: var(--text2); font-weight: 700; }
.big-points { font-size: 28px; font-weight: 900; color: var(--gold); }
.rewards-grid { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; overflow-y: auto; max-height: calc(100% - 110px); }
.reward-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; gap: 14px;
}
.reward-icon { font-size: 36px; flex-shrink: 0; }
.reward-info { flex: 1; min-width: 0; }
.reward-title { font-size: 15px; font-weight: 800; }
.reward-desc { font-size: 12px; color: var(--text3); margin-top: 2px; }
.reward-cost {
  font-size: 14px; font-weight: 900; color: var(--gold);
  background: rgba(255,184,0,0.1); padding: 4px 10px; border-radius: 10px;
}
.reward-cost.locked { color: var(--text3); background: var(--bg3); }
.redeem-btn {
  background: var(--purple); color: white;
  font-size: 12px; font-weight: 800; padding: 8px 14px;
  border-radius: 20px; margin-top: 8px; width: 100%;
}
.redeem-btn:disabled { background: var(--bg3); color: var(--text3); cursor: not-allowed; }

/* ─── REPORTS ──────────────────────────────────────────────── */
#reports-content { padding: 0 16px; overflow-y: auto; height: calc(100% - 56px); }
.report-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.report-card h4 { font-size: 14px; font-weight: 800; color: var(--text2); margin-bottom: 12px; }
.member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-avatar-sm { font-size: 24px; flex-shrink: 0; }
.member-info { flex: 1; }
.member-name-sm { font-size: 14px; font-weight: 800; }
.member-stats-sm { font-size: 11px; color: var(--text3); }
.mini-bar-wrap { width: 60px; }
.mini-bar { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.mini-bar-fill { height: 100%; background: linear-gradient(90deg, var(--purple), var(--purple-light)); border-radius: 2px; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 80px; padding-top: 8px; }
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--purple-light), var(--purple));
  min-height: 4px; transition: height 0.5s;
}
.chart-label { font-size: 9px; color: var(--text3); font-weight: 700; }

/* ─── ADMIN ────────────────────────────────────────────────── */
.admin-sections { padding: 0 16px; overflow-y: auto; height: calc(100% - 56px); }
.admin-section { margin-bottom: 20px; }
.teen-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
}
.teen-avatar { font-size: 32px; flex-shrink: 0; }
.teen-info { flex: 1; }
.teen-name { font-size: 15px; font-weight: 800; }
.teen-sub { font-size: 12px; color: var(--text3); }
.teen-actions { display: flex; gap: 6px; }

/* ─── CHECKIN MODAL ────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
.modal-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-radius: 24px 24px 0 0;
  padding: 0 20px calc(var(--safe-bot) + 20px);
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 12px auto 16px;
}
.modal-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-icon { font-size: 40px; }
.modal-header h3 { font-size: 18px; font-weight: 800; }
.points-label { font-size: 13px; color: var(--text3); font-weight: 700; margin-top: 2px; }
.photo-area { margin-bottom: 16px; }
.photo-placeholder {
  background: var(--card); border: 2px dashed var(--border);
  border-radius: var(--radius); padding: 24px;
  text-align: center; cursor: pointer;
}
.photo-placeholder span { font-size: 32px; display: block; }
.photo-placeholder p { font-size: 13px; color: var(--text3); margin-top: 6px; }
.photo-preview { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--radius); cursor: pointer; }

/* ─── CELEBRATION ──────────────────────────────────────────── */
.celebration {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
.celebration-content {
  background: var(--card); border: 1px solid rgba(255,184,0,0.3);
  border-radius: 24px; padding: 32px 24px; text-align: center;
  max-width: 300px; margin: 24px;
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.celebration-icon { font-size: 72px; display: block; margin-bottom: 16px; animation: wiggle 0.5s ease infinite alternate; }
@keyframes wiggle { to { transform: rotate(8deg) scale(1.1); } }
.celebration-content h2 { font-size: 26px; font-weight: 900; color: var(--gold); margin-bottom: 10px; }
.celebration-content p { font-size: 15px; color: var(--text2); margin-bottom: 20px; }

/* ─── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--safe-bot) + 70px); left: 50%; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 700;
  padding: 12px 20px; border-radius: 100px;
  white-space: nowrap; z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(10px); } }

/* ─── PROFILE ──────────────────────────────────────────────── */
.profile-hero {
  background: linear-gradient(135deg, var(--purple-dark), var(--bg3));
  padding: 32px 24px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.profile-avatar {
  font-size: 64px; display: block;
  background: var(--card); width: 88px; height: 88px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  border: 3px solid var(--purple-light);
}
.profile-hero h2 { font-size: 22px; font-weight: 900; }
.role-tag {
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--purple-light);
  background: rgba(108,60,225,0.2); padding: 4px 14px; border-radius: 20px;
  display: inline-block; margin-top: 8px;
}
.avatar-picker { padding: 20px 16px 0; }
.avatar-picker p { font-size: 13px; color: var(--text2); font-weight: 700; margin-bottom: 10px; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-opt {
  width: 48px; height: 48px; background: var(--card);
  border: 2px solid var(--border); border-radius: 12px;
  font-size: 24px; display: flex; align-items: center; justify-content: center;
}
.avatar-opt.selected { border-color: var(--purple-light); background: rgba(108,60,225,0.15); }
.profile-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; padding: 20px 16px;
}
.pstat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 6px; text-align: center;
}
.pstat span { display: block; font-size: 18px; font-weight: 900; color: var(--gold); }
.pstat label { font-size: 10px; color: var(--text3); font-weight: 700; display: block; margin-top: 2px; }

/* ─── REDEMPTIONS ──────────────────────────────────────────── */
.redemption-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 8px;
}
.redemption-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.redemption-actions { display: flex; gap: 8px; }
.status-badge {
  font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 20px;
}
.status-pending { background: rgba(249,115,22,0.15); color: var(--orange); }
.status-approved { background: rgba(34,197,94,0.15); color: var(--green); }
.status-rejected { background: rgba(239,68,68,0.15); color: var(--red); }

/* ─── SCROLLBARS ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

.logout-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(239,68,68,0.12); color: #FCA5A5;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(239,68,68,0.25);
  transition: background 0.2s;
}
.logout-btn:active { background: rgba(239,68,68,0.3); }
#sa-panel {
  min-height: 100vh; background: #0a0a14; color: #e0e0ff;
  font-family: 'Nunito', sans-serif;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.sa-topbar {
  background: #12122a; border-bottom: 1px solid rgba(108,60,225,0.3);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.sa-logo { font-size: 18px; font-weight: 900; color: #fff; display: flex; align-items: center; gap: 10px; }
.sa-badge {
  font-size: 11px; background: linear-gradient(135deg,#6C3CE1,#9B6FFF);
  padding: 3px 10px; border-radius: 20px; font-weight: 800; letter-spacing: 0.5px;
}
.sa-body { max-width: 1100px; margin: 0 auto; padding: 24px 16px 80px; }
.sa-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 28px; }
.sa-stat-card {
  background: #1a1a2e; border: 1px solid rgba(108,60,225,0.25);
  border-radius: 14px; padding: 18px; text-align: center;
}
.sa-stat-card .sa-stat-val { font-size: 32px; font-weight: 900; color: #FFB800; display: block; }
.sa-stat-card .sa-stat-lbl { font-size: 12px; color: #8888aa; font-weight: 700; margin-top: 4px; display: block; }
.sa-section { background: #1a1a2e; border: 1px solid rgba(108,60,225,0.2); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.sa-section h3 { font-size: 16px; font-weight: 800; margin-bottom: 16px; color: #c0b8ff; }
.sa-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.sa-search {
  background: #0f0f1e; border: 1px solid rgba(108,60,225,0.3); color: #e0e0ff;
  border-radius: 8px; padding: 8px 14px; font-size: 13px; outline: none; min-width: 200px;
  font-family: 'Nunito', sans-serif;
}
.sa-family-row {
  background: #12122a; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.sa-family-row.suspended { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }
.sa-fam-info { flex: 1; min-width: 180px; }
.sa-fam-name { font-size: 15px; font-weight: 800; }
.sa-fam-sub { font-size: 12px; color: #8888aa; margin-top: 2px; }
.sa-fam-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sa-chip {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: rgba(108,60,225,0.2); color: #9B6FFF;
}
.sa-chip.red { background: rgba(239,68,68,0.15); color: #FCA5A5; }
.sa-chip.green { background: rgba(34,197,94,0.15); color: #86EFAC; }
.sa-fam-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sa-activity-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px;
}
.sa-activity-row:last-child { border-bottom: none; }

/* ─── LANGUAGE SWITCHER ────────────────────────────────────── */
.lang-switcher {
  display: flex; justify-content: center; gap: 8px; margin-top: 14px;
}
.lang-switcher.inline { flex-wrap: wrap; gap: 8px; }
.lang-btn {
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 20px;
  font-family: 'Nunito', sans-serif;
}
.lang-btn.active {
  background: rgba(255,255,255,0.25); color: white;
  border-color: rgba(255,255,255,0.5);
}
.lang-switcher.inline .lang-btn {
  background: var(--card); color: var(--text2);
  border-color: var(--border); font-size: 13px;
}
.lang-switcher.inline .lang-btn.active {
  background: var(--purple); color: white; border-color: var(--purple);
}

/* ─── TASK MENU ────────────────────────────────────────────── */
.action-menu-btn {
  background: var(--bg3); color: var(--text2);
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-weight: 900; letter-spacing: -1px;
}
.task-menu {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 180px;
}
.task-menu button {
  display: block; width: 100%; text-align: left;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 700;
  padding: 10px 14px; border-radius: 8px;
}
.task-menu button:hover, .task-menu button:active { background: var(--bg3); }
.task-menu button.danger { color: #FCA5A5; }
.task-menu-divider { height: 1px; background: var(--border); margin: 4px 8px; }
.task-inactive { opacity: 0.6; }
.tag-inactive {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  background: rgba(239,68,68,0.15); color: #FCA5A5;
  padding: 2px 6px; border-radius: 6px; margin-left: 6px;
}
.tag-assigned {
  font-size: 10px; font-weight: 700;
  background: rgba(108,60,225,0.2); color: var(--purple-light);
  padding: 2px 6px; border-radius: 6px; margin-left: 4px;
}

/* ─── PIN LOGIN ────────────────────────────────────────────── */
.pin-members-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 8px;
}
.pin-member-btn {
  background: var(--card); border: 2px solid var(--border);
  border-radius: 16px; padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: all 0.15s;
}
.pin-member-btn:active { transform: scale(0.95); }
.pin-member-btn.admin-member { border-color: rgba(108,60,225,0.4); }
.pin-member-btn .pm-avatar { font-size: 36px; }
.pin-member-btn .pm-name { font-size: 12px; font-weight: 800; color: var(--text); text-align: center; }
.pin-member-btn .pm-role { font-size: 10px; color: var(--text3); font-weight: 600; }
.pin-member-btn .pm-pin-status {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}
.pin-member-btn .pm-pin-status.has-pin { background: rgba(34,197,94,0.15); color: var(--green); }
.pin-member-btn .pm-pin-status.no-pin  { background: rgba(249,115,22,0.15); color: var(--orange); }

.pin-selected-user {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 20px; padding: 12px;
  background: var(--card); border-radius: 12px;
}
.pin-selected-user span:first-child { font-size: 32px; }
.pin-selected-user span:last-child  { font-size: 16px; font-weight: 800; }

.pin-dots {
  display: flex; gap: 16px; justify-content: center; margin-bottom: 20px;
}
.pin-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); background: transparent;
  transition: all 0.15s;
}
.pin-dot.filled { background: var(--purple); border-color: var(--purple); transform: scale(1.2); }

.pin-numpad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; max-width: 280px; margin: 0 auto;
}
.pin-numpad button {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px;
  font-size: 22px; font-weight: 800; color: var(--text);
  transition: all 0.1s;
}
.pin-numpad button:active { background: var(--purple); border-color: var(--purple); transform: scale(0.95); }
.pin-numpad button.pin-action { color: var(--text3); font-size: 18px; }

/* GDPR checkbox */
.checkbox-label {
  display: flex; align-items: flex-start; gap: 0;
  cursor: pointer; font-size: 13px; color: var(--text2);
  font-weight: 600; line-height: 1.4;
}
.checkbox-label input[type=checkbox] {
  width: 18px !important; height: 18px; flex-shrink: 0;
  margin-top: 1px; accent-color: var(--purple);
}

/* Family code display in admin */
.family-code-card {
  background: linear-gradient(135deg, var(--purple-dark), var(--bg3));
  border: 1px solid rgba(108,60,225,0.4);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.family-code-card h4 { font-size: 13px; color: var(--text2); font-weight: 700; margin-bottom: 8px; }
.family-code-display {
  font-size: 28px; font-weight: 900; letter-spacing: 6px;
  color: var(--gold); text-align: center; margin: 8px 0;
}
.family-url { font-size: 12px; color: var(--text3); text-align: center; word-break: break-all; }
