/* ============================================================
   CoinNest — style.css  |  CN-P4.1 UX Enhancements
   ============================================================ */

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

/* ─── TOKENS ──────────────────────────────────────────────── */
:root {
  --orange:     #f97316;
  --amber:      #f59e0b;
  --pink:       #ec4899;
  --purple:     #8b5cf6;
  --bg:         #fff7ed;
  --card:       #ffffff;
  --text:       #1c1917;
  --text-sec:   #78716c;
  --text-muted: #a8a29e;
  --success:    #22c55e;
  --warning:    #fbbf24;
  --nav-h:      68px;
  --header-h:   220px;
  --radius-sm:  12px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.07);
  --shadow-md:  0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.13);
  --grad-main:  linear-gradient(135deg, var(--orange) 0%, var(--amber) 40%, var(--pink) 100%);
  --grad-soft:  linear-gradient(135deg, #fff7ed 0%, #fce7f3 100%);
}

/* ─── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  /* scroll is owned exclusively by .screen — do not add overflow here */
  -webkit-font-smoothing: antialiased;
}

/* ─── APP WRAPPER ─────────────────────────────────────────── */
#app {
  position: relative;     /* FAB + modal-root use position:absolute relative to this */
  inset: 0;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

/* When a modal is open, allow #app to show overlay beyond its bounds */
#app.modal-open {
  overflow: visible;
}

/* ─── SCREENS ─────────────────────────────────────────────── */
#screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .28s ease, transform .28s ease;
  padding-bottom: calc(var(--nav-h) + 24px);
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* ─── HEADER BANNER ───────────────────────────────────────── */
.header-banner {
  background: var(--grad-main);
  padding: 52px 20px 28px;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.header-banner::before {
  content: '';
  position: absolute;
  top: -60px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
}

.header-banner::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -30px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}

.banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  position: relative; z-index: 1;
}

.banner-greeting h1 {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.banner-greeting p {
  font-size: 13px;
  color: rgba(255,255,255,.8);
  margin-top: 2px;
}

.avatar-wrap {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  border: 2.5px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  cursor: pointer;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

/* install btn */
#install-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.22);
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 20px;
  padding: 6px 14px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  margin-top: 10px;
  position: relative; z-index: 1;
}

/* ─── STAT CARDS ROW ──────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px;
  margin-top: -22px;
  position: relative; z-index: 2;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(16px);
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
}

.stat-card:hover { box-shadow: var(--shadow-lg); }

.stat-card.card-in {
  animation: cardRise .45s ease forwards;
}

@keyframes cardRise {
  to { opacity: 1; transform: translateY(0); }
}

.stat-card:active { transform: scale(.97); }

.stat-icon {
  font-size: 24px;
  margin-bottom: 4px;
  display: block;
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ─── SECTION HEADERS ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 10px;
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.section-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

/* ─── GENERIC CARD ────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin: 0 16px 12px;
  transition: box-shadow .2s, transform .15s;
}

.card:active { transform: scale(.98); box-shadow: var(--shadow-md); }

/* ─── QUICK ACTION CARDS ──────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
  margin-bottom: 4px;
}

.qa-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}

.qa-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-main);
  opacity: 0;
  transition: opacity .2s;
  border-radius: var(--radius-md);
}

.qa-card:active { transform: scale(.97); }
.qa-card:active::before { opacity: .07; }

.qa-icon { font-size: 28px; margin-bottom: 8px; display: block; }
.qa-title { font-size: 14px; font-weight: 800; color: var(--text); }
.qa-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 600; }

/* ─── ACTIVITY / LIST ITEM ────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--card);
  border-radius: var(--radius-md);
  margin: 0 16px 8px;
  box-shadow: var(--shadow-sm);
}

.list-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.li-orange  { background: #fff3e8; }
.li-pink    { background: #fce7f3; }
.li-purple  { background: #ede9fe; }
.li-green   { background: #dcfce7; }
.li-amber   { background: #fef3c7; }
.li-blue    { background: #eff6ff; }

.list-info { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 700; color: var(--text); }
.list-sub   { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 1px; }

.badge {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-orange { background: #fff3e8; color: var(--orange); }
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-purple { background: #ede9fe; color: var(--purple); }
.badge-pink   { background: #fce7f3; color: var(--pink); }

/* ─── TASKS SCREEN ────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 16px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  background: var(--card);
  color: var(--text-sec);
  box-shadow: var(--shadow-sm);
  transition: background .2s, color .2s;
}

.filter-tab.active {
  background: var(--grad-main);
  color: #fff;
}

/* task card */
.task-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 0 16px 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: transform .15s;
}
.task-card:active { transform: scale(.98); }

.task-check {
  width: 24px; height: 24px;
  border-radius: 8px;
  border: 2.5px solid #e5e7eb;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.task-body { flex: 1; min-width: 0; }
.task-name  { font-size: 15px; font-weight: 700; color: var(--text); }
.task-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 600; }

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.coin-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff3e8;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--orange);
}

.type-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  background: #ede9fe;
  color: var(--purple);
}

/* ─── REWARDS SCREEN ──────────────────────────────────────── */
.rewards-header-card {
  margin: 0 16px 4px;
  background: var(--grad-main);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.coin-big {
  font-size: 52px;
  line-height: 1;
}

.rewards-balance h2 {
  font-size: 32px;
  font-weight: 900;
  color: #fff;
}

.rewards-balance p {
  font-size: 13px;
  color: rgba(255,255,255,.8);
  font-weight: 600;
}

.reward-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
  margin-bottom: 12px;
}

.reward-item {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.reward-item:active { transform: scale(.96); box-shadow: var(--shadow-md); }
.reward-emoji { font-size: 36px; margin-bottom: 8px; display: block; }
.reward-name  { font-size: 13px; font-weight: 800; color: var(--text); }
.reward-cost  {
  font-size: 12px; font-weight: 700; color: var(--orange);
  margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 3px;
}

/* ─── PROFILE SCREEN ──────────────────────────────────────── */
.profile-hero {
  background: var(--grad-main);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 52px 20px 32px;
  text-align: center;
}

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  border: 3px solid rgba(255,255,255,.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  margin: 0 auto 12px;
  backdrop-filter: blur(8px);
}

.profile-name {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
}

.profile-role {
  font-size: 13px;
  color: rgba(255,255,255,.8);
  font-weight: 600;
  margin-top: 4px;
}

.profile-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.p-badge {
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

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

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px;
  cursor: pointer;
  transition: background .15s;
  border-radius: var(--radius-sm);
  margin: 2px 8px;
}

.menu-item:active { background: #f5f5f4; }

.menu-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.menu-label { flex: 1; font-size: 15px; font-weight: 700; color: var(--text); }
.menu-arrow { font-size: 18px; color: var(--text-muted); }

.menu-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 16px 4px;
}

.version-tag {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px;
  margin-bottom: 8px;
}

/* ─── BOTTOM NAV ──────────────────────────────────────────── */
#bottom-nav {
  height: var(--nav-h);
  background: var(--card);
  border-top: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px env(safe-area-inset-bottom);
  position: relative;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
  flex-shrink: 0;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  transition: background .15s;
  flex: 1;
}

.nav-tab:active { background: #f5f5f4; }

.nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform .2s;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .2px;
  transition: color .2s;
}

.nav-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: transparent;
  transition: background .2s;
  margin-top: -1px;
}

.nav-tab.active .nav-icon  { transform: translateY(-2px); }
.nav-tab.active .nav-label { color: var(--orange); }
.nav-tab.active .nav-dot   { background: var(--orange); }

/* ─── FAB ─────────────────────────────────────────────────── */
#fab {
  position: absolute;
  bottom: calc(var(--nav-h) + 14px);
  right: 18px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--grad-main);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 24px rgba(249,115,22,.45);
  z-index: 200;
  transition: transform .15s, box-shadow .15s;
}

#fab:active { transform: scale(.93); }

#fab.fab-pop {
  animation: fabPop .3s ease;
}

@keyframes fabPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ─── TOAST ───────────────────────────────────────────────── */
/* ─── TOAST STACK ─────────────────────────────────────────── */
/* Legacy single toast — kept so nothing breaks if referenced */
#toast { display: none !important; }

#toast-container {
  position: absolute;          /* inside #app frame */
  bottom: calc(var(--nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 32px));
  display: flex;
  flex-direction: column-reverse;   /* newest toast on top */
  gap: 8px;
  align-items: center;
  z-index: 2000;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(30,30,30,.92), rgba(50,50,50,.96));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  pointer-events: auto;
  cursor: pointer;
  width: 100%;
  max-width: 340px;
  box-sizing: border-box;

  /* Enter: starts below, transparent */
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .22s ease, transform .22s ease;
}

.toast-item.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-item.toast-hide {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.toast-msg {
  flex: 1;
  line-height: 1.35;
  word-break: break-word;
}

/* Desktop frame — keep inside the 480px column */
@media (min-width: 480px) {
  #toast-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: min(340px, 440px);
  }
}

/* ─── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 24px;
}
.empty-icon  { font-size: 52px; margin-bottom: 12px; }
.empty-title { font-size: 17px; font-weight: 800; color: var(--text); }
.empty-sub   { font-size: 13px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }

.theme-badge-soon {
  background: #f3f4f6;
  color: var(--text-muted);
}

.theme-btn-coming-soon {
  opacity: .55;
  cursor: default;
}

.theme-btn-coming-soon:hover { border-color: #e5e7eb; background: var(--bg); }
.theme-btn-coming-soon.active { border-color: #e5e7eb; background: var(--bg); }

.task-unassigned {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: #f3f4f6;
  padding: 3px 9px;
  border-radius: 10px;
}

.task-assign-list.assign-error {
  outline: 2px solid #f87171;
  border-radius: var(--radius-sm);
}

.modal-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

/* ─── ASSIGN ERROR ────────────────────────────────────────── */
.assign-hint {
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  margin-top: 4px;
  display: none;
}

/* ─── MEMBER TASKS SECTION (inside edit member modal) ────────── */
#member-tasks-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}

.member-tasks-header {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 10px;
}

.member-tasks-empty {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0 4px;
}

.member-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px solid #f3f4f6;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.member-task-row:hover  { background: #fff3e8; border-color: #fed7aa; }
.member-task-row:active { transform: scale(.98); }

.member-task-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.member-task-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-task-done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.member-task-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.member-task-coins {
  font-size: 12px;
  font-weight: 800;
  color: var(--orange);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── CURRENCY SETTINGS ───────────────────────────────────── */
.cs-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.cs-preview {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background: #f8f9fa;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
}

/* ─── PIGGY BANK ──────────────────────────────────────────── */
.piggy-bank-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fdf4ff, #ede9fe);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  gap: 12px;
}

.piggy-bank-stat { display: flex; align-items: center; gap: 12px; }
.piggy-icon      { font-size: 28px; line-height: 1; }
.piggy-label     { font-size: 11px; font-weight: 700; color: #7c3aed; text-transform: uppercase; letter-spacing: .4px; }
.piggy-amount    { font-size: 18px; font-weight: 900; color: #5b21b6; margin-top: 2px; }

.piggy-btn {
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 8px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.piggy-btn:hover { background: #6d28d9; }

/* ─── REWARDS MEMBER STRIP ────────────────────────────────── */
.rms-list { display:flex; gap:8px; overflow-x:auto; padding:12px 0 4px; scrollbar-width:none; }
.rms-list::-webkit-scrollbar { display:none; }
.rms-chip { display:flex; flex-direction:column; align-items:center; gap:3px; min-width:68px; padding:10px 8px; background:var(--card); border-radius:var(--radius-md); cursor:pointer; flex-shrink:0; transition:background .15s; }
.rms-chip:hover  { background:#fff3e8; }
.rms-avatar { font-size:22px; line-height:1; }
.rms-name   { font-size:11px; font-weight:800; color:var(--text); text-align:center; max-width:60px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rms-coins  { font-size:11px; font-weight:700; color:var(--orange); }

/* ─── ADD REWARD TEMPLATE GRID ────────────────────────────── */
.ar-template-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; padding-bottom:8px; }
.ar-template-card { display:flex; flex-direction:column; align-items:center; gap:4px; padding:14px 8px 10px; background:var(--bg); border:2px solid #f3f4f6; border-radius:var(--radius-md); cursor:pointer; transition:border-color .15s, background .15s; font-family:'Nunito',sans-serif; }
.ar-template-card:hover { border-color:var(--orange); background:#fff3e8; }
.ar-emoji { font-size:28px; line-height:1; }
.ar-name  { font-size:11px; font-weight:800; color:var(--text); text-align:center; }
.ar-coins { font-size:10px; font-weight:700; color:var(--orange); }

/* ─── EMOJI PICKER ────────────────────────────────────────── */
.cr-emoji-grid { display:flex; flex-wrap:wrap; gap:6px; max-height:120px; overflow-y:auto; padding:4px 0; }
.cr-emoji-btn  { width:38px; height:38px; font-size:20px; border:2px solid #f3f4f6; border-radius:10px; background:var(--bg); cursor:pointer; transition:border-color .12s; line-height:1; }
.cr-emoji-btn.active { border-color:var(--orange); background:#fff3e8; }
.cr-emoji-btn:hover  { border-color:#fed7aa; }

/* ─── TAG BUTTONS ─────────────────────────────────────────── */
.cr-tag-row { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:4px; }
.cr-tag-btn { font-size:11px; font-weight:700; padding:4px 10px; border:2px solid transparent; border-radius:20px; cursor:pointer; transition:border-color .12s, transform .1s; font-family:'Nunito',sans-serif; }
.cr-tag-btn.active-tag { border-color:currentColor; transform:scale(1.05); }

/* ─── REWARD HISTORY ──────────────────────────────────────── */
#reward-history-list { padding: 0 0 16px; }

.rh-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.rh-info  { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.rh-avatar { font-size: 20px; flex-shrink: 0; }
.rh-details { min-width: 0; }
.rh-title { font-size: 14px; font-weight: 700; color: var(--text); }
.rh-kid   { font-size: 11px; font-weight: 600; color: var(--text-muted); }

.rh-right  { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rh-coins  { font-size: 13px; font-weight: 800; color: var(--orange); }
.rh-status {
  font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 10px;
  white-space: nowrap;
}

.rh-actions { width: 100%; display: flex; gap: 8px; margin-top: 2px; }
.rh-approve-btn, .rh-reject-btn {
  flex: 1; padding: 7px; border: none; border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: background .15s;
}
.rh-approve-btn { background: #dcfce7; color: #166534; }
.rh-approve-btn:hover { background: #bbf7d0; }
.rh-reject-btn  { background: #fee2e2; color: #991b1b; }
.rh-reject-btn:hover  { background: #fecaca; }

/* Locked (unaffordable) reward items */
.reward-item-locked { opacity: .45; filter: grayscale(.5); }

/* ─── LEADERBOARD ─────────────────────────────────────────── */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 4px 0 16px;
}

/* Podium slots */
.lb-podium-slot {
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 12px 8px 10px;
  cursor: pointer;
  position: relative;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.lb-podium-slot:active { transform: scale(.97); }

/* 1st place taller */
.lb-rank-1 {
  padding-top: 20px;
  background: linear-gradient(145deg, #fff8ed, #fff3d6);
  box-shadow: 0 4px 16px rgba(249,115,22,.18);
}
.lb-rank-2 { background: linear-gradient(145deg, #f8faff, #eef2ff); }
.lb-rank-3 { background: linear-gradient(145deg, #fff8f5, #fef0e8); }

.lb-crown {
  position: absolute;
  top: -14px;
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
}

.lb-medal   { font-size: 18px; margin-bottom: 4px; }
.lb-avatar  { font-size: 32px; line-height: 1; margin-bottom: 4px; }
.lb-name    { font-size: 12px; font-weight: 800; color: var(--text); text-align: center;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.lb-coins   { display: flex; align-items: center; gap: 3px; margin-top: 4px; }
.lb-coin-icon { font-size: 12px; }
.lb-coin-val  { font-size: 13px; font-weight: 900; color: var(--orange); }

/* Solo member (only 1 kid) */
.lb-solo {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius-md);
  gap: 4px;
  cursor: pointer;
}

/* 4th+ rows */
.lb-rest { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.lb-row:hover { background: #fff3e8; }

.lb-rank-num  { font-size: 13px; font-weight: 900; color: var(--text-muted); width: 20px; text-align: center; }
.lb-row-avatar{ font-size: 20px; }
.lb-row-name  { flex: 1; font-size: 14px; font-weight: 700; color: var(--text); }
.lb-row-coins { font-size: 13px; font-weight: 800; color: var(--orange); }

/* Active kid highlight */
.lb-active-kid {
  outline: 2.5px solid var(--orange);
  outline-offset: 2px;
}

/* ─── KID MODE BANNER ─────────────────────────────────────── */
#kid-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--grad-main);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 800;
  flex-shrink: 0;
}

.kid-mode-label { flex: 1; }

.kid-mode-exit {
  background: rgba(255,255,255,.22);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  cursor: pointer;
  transition: background .15s;
}
.kid-mode-exit:hover { background: rgba(255,255,255,.35); }

/* Hide parent-only UI elements in kid mode */
#app.kid-mode #fab                { display: none; }
#app.kid-mode #task-filter-tabs  { pointer-events: none; opacity: .5; }

/* ─── CONFIRM MODAL ───────────────────────────────────────── */
.confirm-sheet {
  text-align: center;
  padding: 12px 24px 0;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.confirm-icon {
  font-size: 44px;
  margin: 8px 0 12px;
  line-height: 1;
}

.confirm-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
  margin: 0 0 8px;
}

.confirm-msg {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sec);
  line-height: 1.5;
  margin: 0 0 24px;
}

.confirm-btns {
  display: flex;
  gap: 10px;
}

.confirm-btn-cancel,
.confirm-btn-ok {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.confirm-btn-cancel {
  background: #f1f5f9;
  color: var(--text);
}
.confirm-btn-cancel:hover  { background: #e2e8f0; }
.confirm-btn-cancel:active { transform: scale(.97); }

.confirm-btn-ok {
  background: #dc2626;
  color: #fff;
}
.confirm-btn-ok:hover  { background: #b91c1c; }
.confirm-btn-ok:active { transform: scale(.97); }

/* ─── MODAL DELETE BUTTON ─────────────────────────────────── */
.modal-delete-btn {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  background: #fee2e2;
  border: none;
  border-radius: var(--radius-md);
  color: #991b1b;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.modal-delete-btn:hover  { background: #fecaca; }
.modal-delete-btn:active { transform: scale(.98); }

/* ─── TASK EDIT BUTTON ────────────────────────────────────── */
.task-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.task-edit-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: .5;
  flex-shrink: 0;
  transition: opacity .15s, background .15s;
  line-height: 1;
}

.task-edit-btn:hover  { opacity: 1; background: #f5f5f4; }

/* ─── TAB BADGE ───────────────────────────────────────────── */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 20px;
  line-height: 1;
  vertical-align: middle;
}

.filter-tab[data-filter="approval"] .tab-badge {
  background: #ec4899;
}

/* ─── KID STAT PILLS ──────────────────────────────────────── */
.kid-stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 6px;
}

.kid-stat-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.pill-done     { background: #dcfce7; color: #166534; }
.pill-approval { background: #fff3e8; color: #f97316; }
.pill-pending  { background: #f3f4f6; color: #6b7280; }
.pill-winner   { background: #fef9c3; color: #854d0e; }
.pill-streak   { background: #fff3e8; color: #c2410c; font-weight: 800; }

/* ─── AUTH UI ─────────────────────────────────────────────── */
#btn-google-signin:hover { background: #fff3e8; cursor: pointer; }
#btn-logout:hover        { background: #fee2e2; cursor: pointer; }

/* ─── PILL GROUPS ─────────────────────────────────────────── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 6px;
}

.pill-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid #e5e7eb;
  background: var(--bg);
  color: var(--text-sec);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}

.pill-btn:active { transform: scale(.95); }

.pill-btn.active {
  background: var(--grad-main);
  border-color: transparent;
  color: #fff;
}

/* ─── ACTIVITY LIST ───────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  animation: fadeIn .2s ease;
}

.activity-item:last-child { border-bottom: none; }

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

.activity-dot {
  font-size: 8px;
  color: var(--orange);
  margin-top: 5px;
  flex-shrink: 0;
  line-height: 1;
}

.activity-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sec);
  line-height: 1.4;
}

/* ─── SCROLLBAR ───────────────────────────────────────────── */
.screen::-webkit-scrollbar { width: 0; }

/* ─── KID CARDS ───────────────────────────────────────────── */
.kid-card {
  background: var(--card);
  border-radius: var(--radius-md);
  margin: 0 16px 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  overflow: hidden;
}

.kid-card:active { transform: scale(.98); box-shadow: var(--shadow-md); }

.kid-card-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.kid-avatar {
  font-size: 38px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: #fff3e8;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.kid-info { flex: 1; min-width: 0; }

.kid-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kid-age {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: #f5f5f4;
  padding: 2px 7px;
  border-radius: 10px;
}

.kid-coins {
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
  margin-top: 3px;
}

.kid-progress-wrap { margin-top: 7px; }

.kid-progress-bar {
  height: 6px;
  background: #f3f4f6;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}

.kid-progress-fill {
  height: 100%;
  background: var(--grad-main);
  border-radius: 99px;
  transition: width .4s ease;
  min-width: 0%;
}

.kid-progress-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ─── ADD KID BUTTON ──────────────────────────────────────── */
.add-kid-btn {
  width: 100%;
  padding: 13px;
  border: 2px dashed #e5e7eb;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--orange);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-align: center;
}

.add-kid-btn:hover  { background: #fff3e8; border-color: var(--orange); }
.add-kid-btn:active { background: #ffe8cc; }

/* ─── MODAL ───────────────────────────────────────────────── */
/* ─── MODAL ROOT ──────────────────────────────────────────── */
/* Inside #app — scales and positions with the app frame */
#modal-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 900;
}

/* ─── BOTTOM SHEET MODAL ──────────────────────────────────── */

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background .28s ease;
  z-index: 900;
}

.modal-overlay.open {
  background: rgba(0, 0, 0, .48);
  pointer-events: all;
}

/* Sheet — pinned to bottom of #app frame */
.modal-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;

  background: var(--card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .18);

  max-height: 90%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  padding: 12px 20px 0;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));

  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.32, .72, 0, 1);
  will-change: transform;
  z-index: 901;
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

/* Drag handle */
.modal-handle {
  width: 40px; height: 4px;
  background: #e2e8f0;
  border-radius: 99px;
  margin: 0 auto 18px;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  background: var(--card);
  padding: 4px 0 10px;
  z-index: 2;
}

.modal-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sec);
  font-weight: 700;
  transition: background .15s;
}

.modal-close:active { background: #e5e7eb; }

.modal-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 8px;
  margin-top: 16px;
}

.modal-required { color: var(--orange); }

.modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s;
}

.modal-input:focus { border-color: var(--orange); }
.modal-input::placeholder { color: var(--text-muted); }

/* Relation select */
.modal-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2378716c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

/* Avatar picker */
.avatar-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.avatar-opt {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2.5px solid #e5e7eb;
  background: #f5f5f4;
  font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s, transform .15s;
}

.avatar-opt:active      { transform: scale(.9); }
.avatar-opt.active      { border-color: var(--orange); background: #fff3e8; }

/* Plan hint */
.modal-plan-hint {
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 14px;
}

.modal-plan-hint.info    { background: #eff6ff; color: #2563eb; }
.modal-plan-hint.warn    { background: #fff3e8; color: var(--orange); }
.modal-plan-hint.success { background: #dcfce7; color: #16a34a; }

/* Submit button */
.modal-submit {
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  background: var(--grad-main);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(249,115,22,.35);
  transition: transform .15s, box-shadow .15s;
}

.modal-submit:active {
  transform: scale(.98);
  box-shadow: 0 2px 8px rgba(249,115,22,.25);
}

/* ─── THEME SELECTOR ──────────────────────────────────────── */
.theme-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: var(--radius-md);
  border: 2px solid #e5e7eb;
  background: var(--bg);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  font-family: 'Nunito', sans-serif;
}

.theme-btn:active        { transform: scale(.96); }
.theme-btn.active        { border-color: var(--orange); background: #fff3e8; }

.theme-btn-icon  { font-size: 24px; line-height: 1; }
.theme-btn-name  { font-size: 12px; font-weight: 800; color: var(--text); }

.theme-btn-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f3f4f6;
  color: var(--text-muted);
}

.theme-badge-premium {
  background: #ede9fe;
  color: var(--purple);
}

/* ─── THEME ACCENTS ───────────────────────────────────────── */

/* School theme — blue-green accent on header banner */
#app[data-theme="school"] .header-banner {
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 45%, #10b981 100%);
}
#app[data-theme="school"] .nav-tab.active .nav-label,
#app[data-theme="school"] .nav-tab.active .nav-dot,
#app[data-theme="school"] .section-link,
#app[data-theme="school"] .kid-coins {
  color: #0ea5e9;
}
#app[data-theme="school"] .nav-tab.active .nav-dot {
  background: #0ea5e9;
}
#app[data-theme="school"] .theme-btn.active {
  border-color: #0ea5e9;
  background: #f0f9ff;
}
#app[data-theme="school"] .modal-submit,
#app[data-theme="school"] .kid-progress-fill {
  background: linear-gradient(135deg, #0ea5e9, #10b981);
}
#app[data-theme="school"] #fab {
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  box-shadow: 0 6px 24px rgba(14,165,233,.4);
}

/* Game theme — purple-violet accent */
#app[data-theme="game"] .header-banner {
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 45%, #ec4899 100%);
}
#app[data-theme="game"] .nav-tab.active .nav-label,
#app[data-theme="game"] .section-link,
#app[data-theme="game"] .kid-coins {
  color: #7c3aed;
}
#app[data-theme="game"] .nav-tab.active .nav-dot {
  background: #7c3aed;
}
#app[data-theme="game"] .theme-btn.active {
  border-color: #7c3aed;
  background: #f5f3ff;
}
#app[data-theme="game"] .modal-submit,
#app[data-theme="game"] .kid-progress-fill {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}
#app[data-theme="game"] #fab {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  box-shadow: 0 6px 24px rgba(124,58,237,.4);
}

/* ─── PENDING APPROVAL TASK STATE ─────────────────────────── */
.task-card.task-pending-approval {
  border-left: 3px solid #ec4899;
}

.task-pill-pending {
  background: #fce7f3;
  color: #be185d;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.task-pill-approved {
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.task-pending-line {
  font-size: 12px;
  font-weight: 700;
  color: #be185d;
  background: #fdf2f8;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 8px;
}

.task-approval-btns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-approve-btn,
.task-reject-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}

.task-approve-btn {
  background: #dcfce7;
  color: #166534;
}

.task-reject-btn {
  background: #fee2e2;
  color: #991b1b;
}

.task-approve-btn:active,
.task-reject-btn:active { transform: scale(.95); opacity: .85; }

/* ─── PREMIUM ACTIVE CARD ─────────────────────────────────── */
.premium-active-card {
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border: 2px solid #fbbf24;
}

.premium-active-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.premium-active-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.premium-active-title {
  font-size: 16px;
  font-weight: 900;
  color: #92400e;
}

.premium-active-sub {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  margin-top: 2px;
}

/* ─── TASK ENGINE ─────────────────────────────────────────── */

/* Completed task card */
.task-card.task-done {
  opacity: .72;
}
.task-card.task-done .task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Assigned avatars row */
.task-avatars {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.task-avatar-chip {
  font-size: 18px;
  line-height: 1;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #f5f5f4;
  display: flex; align-items: center; justify-content: center;
}

/* Winner line */
.task-winner-pending {
  background: #fff3e8;
  color: #c2410c;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-weight: 700;
}

.task-winner {
  font-size: 13px;
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  margin-top: 8px;
  display: inline-block;
}

/* Member complete buttons */
.task-member-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.task-member-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 20px;
  border: 2px solid #e5e7eb;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}

.task-member-btn:active     { transform: scale(.95); }
.task-member-btn:hover      { border-color: var(--orange); background: #fff3e8; }
.task-member-btn.done       { background: #dcfce7; border-color: #86efac; color: #166534; cursor: default; }

.task-member-btn.task-btn-loser {
  opacity: .4;
  cursor: not-allowed;
  background: #f3f4f6;
  border-color: #e5e7eb;
}

/* ─── TASK MODAL — ASSIGN SECTION ─────────────────────────── */
.task-assign-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
}

.task-assign-empty {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 0;
}

.assign-chip {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: 20px;
  border: 2px solid #e5e7eb;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.assign-chip.selected {
  background: #fff3e8;
  border-color: var(--orange);
  color: var(--orange);
}

/* ─── QUICK TASK MODAL ────────────────────────────────────── */
/* Single modal: assign chips + category tabs + template grid + custom tile */

/* Category filter tabs inside modal */
.template-filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 6px 0 10px;
}
.template-filter-tabs::-webkit-scrollbar { display: none; }

.template-filter-tab {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  background: var(--card);
  color: var(--text-sec);
  box-shadow: var(--shadow-sm);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.template-filter-tab.active {
  background: var(--grad-main);
  color: #fff;
}

/* Category label on each template card */
.template-category {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-top: -2px;
}

.template-card.template-custom {
  border-style: dashed;
  border-color: #d1d5db;
  background: #fafafa;
}

.template-card.template-custom:hover {
  border-color: var(--orange);
  background: #fff3e8;
}

/* ─── TEMPLATE GRID ───────────────────────────────────────── */
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px 0 8px;
}

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px;
  background: var(--bg);
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  text-align: center;
  position: relative;
  transition: border-color .15s, background .15s, transform .12s;
}

.template-card:active        { transform: scale(.96); }
.template-card:hover         { border-color: var(--orange); background: #fff3e8; }
.template-card.template-locked { opacity: .6; cursor: default; }
.template-card.template-locked:hover { border-color: #e5e7eb; background: var(--bg); }

.template-icon   { font-size: 36px; line-height: 1; }
.template-title  { font-size: 13px; font-weight: 800; color: var(--text); }
.template-coins  { font-size: 12px; font-weight: 700; color: var(--orange);
                   background: #fff3e8; padding: 3px 10px; border-radius: 20px; }

.template-lock {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 14px;
  line-height: 1;
}

.template-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 20px 0;
}

/* ─── DEV MODE CARD ───────────────────────────────────────── */
/* ⚠️ Dev Mode Only — remove before production */
.dev-mode-card {
  border: 2px dashed #fbbf24;
  background: #fffbeb;
}

.dev-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dev-mode-label {
  font-size: 13px;
  font-weight: 900;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.dev-mode-warning {
  font-size: 10px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid #fbbf24;
}

.dev-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dev-toggle-info { flex: 1; }

.dev-toggle-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.dev-toggle-sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.dev-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.dev-toggle-track {
  display: flex;
  align-items: center;
  width: 52px;
  height: 28px;
  border-radius: 99px;
  background: #e5e7eb;
  padding: 3px;
  transition: background .25s;
  position: relative;
}

.dev-toggle-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  position: absolute;
  left: 3px;
}

.dev-toggle-on .dev-toggle-track  { background: var(--success); }
.dev-toggle-on .dev-toggle-thumb  { transform: translateX(24px); }

/* Hint pills */
.dev-hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.dev-hint {
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  background: #fef9c3;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  opacity: .55;
  transition: opacity .25s, background .25s, color .25s;
}

.dev-hint-active {
  opacity: 1;
  background: #dcfce7;
  color: #166534;
}

/* ─── DESKTOP FRAME ───────────────────────────────────────── */
@media (min-width: 480px) {
  body { background: #e7e5e4; display: flex; align-items: center; justify-content: center; }
  #app {
    border-radius: 36px;
    box-shadow: 0 24px 80px rgba(0,0,0,.22);
    height: 860px;
    max-height: 95vh;
  }
}

/* ─── NOTIFICATION PANEL (Profile → Notifications) ───────── */
/* Floating bell removed — notifications live in Profile screen */
.notif-bell  { display: none !important; }
.notif-badge { display: none !important; }

/* Unread badge on the Profile menu item */
.notif-profile-badge {
  margin-left: auto;
  margin-right: 8px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  font-family: 'Nunito', sans-serif;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Panel renders inline inside the profile card */
#notif-panel {
  width: 100%;
  background: var(--bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .28s ease, opacity .22s ease;
  pointer-events: none;
}
#notif-panel.notif-panel-open {
  max-height: 480px;
  opacity: 1;
  pointer-events: auto;
  margin-top: 8px;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f3f4f6;
}
.notif-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
}
.notif-clear {
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background .12s;
}
.notif-clear:hover { background: #fee2e2; }

.notif-list {
  overflow-y: auto;
  max-height: 380px;
  padding: 6px 0 8px;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  transition: background .12s;
  border-bottom: 1px solid #f9fafb;
}
.notif-item:last-child { border-bottom: none; }

.notif-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1.4;
}
.notif-body { flex: 1; min-width: 0; }
.notif-msg  {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.notif-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.notif-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ─── PROFILE SUB-PAGES ───────────────────────────────────── */
#profile-subpages {
  display: none;
  position: absolute;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + 24px);
  z-index: 1;
}

.subpage-enter {
  animation: subpageIn .22s ease forwards;
}
.subpage-exit {
  animation: subpageOut .22s ease forwards;
  pointer-events: none;
}

@keyframes subpageIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes subpageOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(28px); }
}

.subpage-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 8px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid #f3f4f6;
}

.subpage-back {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #f3f4f6;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background .15s;
  flex-shrink: 0;
  line-height: 1;
}
.subpage-back:hover { background: #e5e7eb; }

.subpage-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
}

.subpage-body {
  padding: 12px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Inline icon buttons in family list */
.icon-btn {
  background: #f3f4f6;
  border: none;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.icon-btn:hover     { background: #e5e7eb; }
.icon-btn-red:hover { background: #fee2e2; }

/* Edit Profile avatar grid reuses .cr-emoji-grid */
.ep-emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

/* ─── KID MODE TASK BUTTON ────────────────────────────────── */
/* Other members' buttons in kid mode — visible but not tappable */
.task-btn-other {
  opacity: .35;
  filter: grayscale(.4);
  cursor: default;
}

/* ─── CELEBRATION PARTICLES ───────────────────────────────── */
.celeb-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3000;
  overflow: hidden;
}

.celeb-particle {
  position: absolute;
  bottom: 20%;
  line-height: 1;
  opacity: 0;
  animation: celebFloat 1.6s ease forwards;
  will-change: transform, opacity;
}

@keyframes celebFloat {
  0%   { opacity: 0;   transform: translateY(0)     scale(.6) rotate(-10deg); }
  20%  { opacity: 1;   transform: translateY(-30px)  scale(1)  rotate(5deg);  }
  60%  { opacity: 1;   transform: translateY(-120px) scale(1.1) rotate(-5deg);}
  100% { opacity: 0;   transform: translateY(-200px) scale(.8) rotate(8deg);  }
}

