/* ============================================================
   CHITIQUE — Design System
   Mobile-first, professional, accessible
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --c-green-50:  #f0fdf4;
  --c-green-100: #dcfce7;
  --c-green-200: #bbf7d0;
  --c-green-500: #22c55e;
  --c-green-600: #16a34a;
  --c-green-700: #15803d;
  --c-green-800: #166534;
  --c-green-900: #14532d;
  --c-blue-50:   #eff6ff;
  --c-blue-100:  #dbeafe;
  --c-blue-500:  #3b82f6;
  --c-blue-600:  #2563eb;
  --c-blue-700:  #1d4ed8;
  --c-yellow-50: #fffbeb;
  --c-yellow-400:#facc15;
  --c-yellow-700:#a16207;
  --c-red-50:    #fef2f2;
  --c-red-500:   #ef4444;
  --c-red-600:   #dc2626;
  --c-gray-50:   #f9fafb;
  --c-gray-100:  #f3f4f6;
  --c-gray-200:  #e5e7eb;
  --c-gray-300:  #d1d5db;
  --c-gray-400:  #9ca3af;
  --c-gray-500:  #6b7280;
  --c-gray-600:  #4b5563;
  --c-gray-700:  #374151;
  --c-gray-800:  #1f2937;
  --c-gray-900:  #111827;
  --radius-sm:   .375rem;
  --radius:      .625rem;
  --radius-lg:   .875rem;
  --radius-xl:   1.25rem;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.05);
  --nav-height:  3.75rem;
  --bottom-nav:  4rem;
  --font:        'Figtree', system-ui, -apple-system, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: #f8fafc;
  color: var(--c-gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Reserve space for bottom nav on mobile */
  padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
[x-cloak] { display: none !important; }

/* ---------- Typography ---------- */
.page-title    { font-size: 1.375rem; font-weight: 700; color: var(--c-gray-900); line-height: 1.3; }
.page-subtitle { font-size: .875rem; color: var(--c-gray-500); margin-top: .2rem; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--c-gray-800); }
.label         { font-size: .8125rem; font-weight: 500; color: var(--c-gray-700); margin-bottom: .375rem; display: block; }
.helper        { font-size: .75rem; color: var(--c-gray-400); margin-top: .25rem; }
.error-msg     { font-size: .75rem; color: var(--c-red-500); margin-top: .3rem; }

/* ---------- Top Navigation ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-green-700);
  height: var(--nav-height);
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 2px 8px rgba(0,0,0,.2);
}
.topnav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1rem;
  max-width: 80rem;
  margin: 0 auto;
}
.topnav__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: white;
  font-weight: 700;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.topnav__logo {
  width: 2rem;
  height: 2rem;
  background: white;
  color: var(--c-green-700);
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: .9rem;
}
.topnav__links {
  display: none;
  align-items: center;
  gap: .125rem;
  margin-left: 1.5rem;
}
.topnav__link {
  padding: .45rem .8rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.topnav__link:hover   { background: rgba(255,255,255,.12); color: white; }
.topnav__link--active { background: rgba(0,0,0,.2); color: white; }
.topnav__link--yellow { background: #fef08a; color: #713f12; font-weight: 600; }
.topnav__link--yellow:hover { background: #fde047; color: #713f12; }
.topnav__link--red    { background: var(--c-red-600); color: white; font-weight: 600; }
.topnav__link--red:hover { background: #b91c1c; }

.topnav__right { display: flex; align-items: center; gap: .5rem; }

.topnav__bell {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  transition: background .15s;
}
.topnav__bell:hover { background: rgba(255,255,255,.12); color: white; }
.topnav__bell svg   { width: 1.25rem; height: 1.25rem; }
.topnav__badge {
  position: absolute;
  top: 2px; right: 2px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  min-width: 1rem;
  height: 1rem;
  font-size: .6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--c-green-700);
  padding: 0 .2rem;
}

.topnav__avatar-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  color: white;
  transition: background .15s;
}
.topnav__avatar-btn:hover { background: rgba(255,255,255,.12); }
.topnav__avatar {
  width: 2rem;
  height: 2rem;
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.topnav__name { font-size: .875rem; font-weight: 500; }
.topnav__chevron { width: .875rem; height: .875rem; opacity: .6; }

.topnav__dropdown {
  position: absolute;
  top: calc(var(--nav-height) - .375rem);
  right: 1rem;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--c-gray-100);
  min-width: 11rem;
  overflow: hidden;
  z-index: 200;
}
.topnav__dropdown a,
.topnav__dropdown button {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .7rem 1rem;
  font-size: .875rem;
  color: var(--c-gray-700);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background .1s;
}
.topnav__dropdown a:hover,
.topnav__dropdown button:hover { background: var(--c-gray-50); color: var(--c-gray-900); }
.topnav__dropdown hr { border: none; border-top: 1px solid var(--c-gray-100); margin: .25rem 0; }

/* ---------- Bottom Navigation (mobile) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: white;
  border-top: 1px solid var(--c-gray-200);
  display: flex;
  height: var(--bottom-nav);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  text-decoration: none;
  color: var(--c-gray-400);
  font-size: .65rem;
  font-weight: 500;
  padding: .4rem 0;
  transition: color .15s;
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}
.bottom-nav__item svg { width: 1.375rem; height: 1.375rem; }
.bottom-nav__item--active { color: var(--c-green-700); }
.bottom-nav__item--active svg { stroke-width: 2.5; }
.bottom-nav__item--cta {
  color: white;
  background: var(--c-green-700);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  margin-top: -1rem;
  box-shadow: 0 4px 12px rgba(21,128,61,.4);
  flex: none;
  align-self: flex-start;
  margin-left: auto;
  margin-right: auto;
  font-size: 0;
}
.bottom-nav__item--cta svg { width: 1.5rem; height: 1.5rem; }
.bottom-nav__dot {
  position: absolute;
  top: .4rem;
  right: calc(50% - .8rem);
  width: .5rem;
  height: .5rem;
  background: var(--c-red-500);
  border-radius: 50%;
  border: 1.5px solid white;
}

/* ---------- Page Layout ---------- */
.page-wrap {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1rem;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-header__left  { flex: 1; min-width: 0; }
.page-header__right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card--flat { box-shadow: none; border-color: var(--c-gray-100); }
.card__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--c-gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card__body    { padding: 1.25rem; }
.card__body--p0 { padding: 0; }
.card__footer  { padding: .875rem 1.25rem; border-top: 1px solid var(--c-gray-100); background: var(--c-gray-50); }

/* ---------- Stat Cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-gray-200);
  padding: 1rem;
  text-align: center;
}
.stat-card__label { font-size: .7rem; color: var(--c-gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.stat-card__value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; margin: .25rem 0 .1rem; }
.stat-card__sub   { font-size: .7rem; color: var(--c-gray-400); }
.stat-card--green .stat-card__value { color: var(--c-green-700); }
.stat-card--yellow .stat-card__value { color: #d97706; }
.stat-card--red .stat-card__value    { color: var(--c-red-500); }
.stat-card--blue .stat-card__value   { color: var(--c-blue-600); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, box-shadow .15s, transform .1s;
  font-family: var(--font);
}
.btn:active { transform: scale(.97); }
.btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }

.btn--primary { background: var(--c-green-700); color: white; }
.btn--primary:hover { background: var(--c-green-800); }

.btn--secondary { background: var(--c-gray-100); color: var(--c-gray-700); }
.btn--secondary:hover { background: var(--c-gray-200); }

.btn--danger { background: var(--c-red-600); color: white; }
.btn--danger:hover { background: #b91c1c; }

.btn--outline { background: transparent; color: var(--c-green-700); border: 1.5px solid var(--c-green-700); }
.btn--outline:hover { background: var(--c-green-50); }

.btn--ghost { background: transparent; color: var(--c-gray-600); padding: .5rem .75rem; }
.btn--ghost:hover { background: var(--c-gray-100); color: var(--c-gray-900); }

.btn--whatsapp { background: #25d366; color: white; }
.btn--whatsapp:hover { background: #1da851; }

.btn--sm { padding: .4rem .875rem; font-size: .8rem; }
.btn--lg { padding: .875rem 1.75rem; font-size: 1rem; border-radius: var(--radius); }
.btn--full { width: 100%; }
.btn--pill { border-radius: 2rem; }
.btn--icon { padding: .5rem; border-radius: 50%; }

.btn--loading { opacity: .7; pointer-events: none; }

/* ---------- Badges / Tags ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 2rem;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge--green  { background: var(--c-green-100); color: var(--c-green-800); }
.badge--blue   { background: var(--c-blue-100);  color: var(--c-blue-700); }
.badge--yellow { background: #fef9c3; color: #a16207; }
.badge--red    { background: #fee2e2; color: #b91c1c; }
.badge--gray   { background: var(--c-gray-100); color: var(--c-gray-600); }
.badge--orange { background: #ffedd5; color: #9a3412; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.125rem; }
.input, .select, .textarea {
  display: block;
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--c-gray-300);
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  color: var(--c-gray-800);
  background: white;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
  font-family: var(--font);
  -webkit-appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-green-600);
  box-shadow: 0 0 0 3px rgba(21,128,61,.12);
}
.input::placeholder { color: var(--c-gray-400); }
.input--error { border-color: var(--c-red-500); }
.input--error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.5rem; cursor: pointer; }
.textarea { resize: vertical; min-height: 5rem; }
.input-row { display: grid; gap: .75rem; }

/* Choice cards (radio / checkbox) */
.choice-grid { display: grid; gap: .5rem; grid-template-columns: repeat(2, 1fr); }
.choice-grid--3 { grid-template-columns: repeat(3, 1fr); }
.choice-grid--5 { grid-template-columns: repeat(5, 1fr); }
.choice-card {
  position: relative;
  cursor: pointer;
}
.choice-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice-card__inner {
  border: 2px solid var(--c-gray-200);
  border-radius: var(--radius-sm);
  padding: .625rem .5rem;
  text-align: center;
  font-size: .8rem;
  font-weight: 500;
  color: var(--c-gray-700);
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}
.choice-card input:checked + .choice-card__inner {
  border-color: var(--c-green-600);
  background: var(--c-green-50);
  color: var(--c-green-800);
}
.choice-card:hover .choice-card__inner { border-color: var(--c-gray-300); }
.choice-card__icon { font-size: 1.125rem; }

/* Verde mais carregado para choice-cards dentro de containers coloridos */
.choice-cards--strong .choice-card input:checked + .choice-card__inner {
  border-color: var(--c-green-700);
  background: var(--c-green-100);
  color: var(--c-green-900);
  box-shadow: 0 0 0 2px rgba(21,128,61,.2);
}

/* ---------- List items ---------- */
.list-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1rem;
}
.list-item + .list-item { border-top: 1px solid var(--c-gray-100); }
.list-item__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8125rem;
  flex-shrink: 0;
}
.list-item__avatar--green  { background: var(--c-green-100); color: var(--c-green-800); }
.list-item__avatar--blue   { background: var(--c-blue-100);  color: var(--c-blue-700); }
.list-item__avatar--gray   { background: var(--c-gray-100);  color: var(--c-gray-600); }
.list-item__avatar--yellow { background: #fef9c3; color: #a16207; }
.list-item__body   { flex: 1; min-width: 0; }
.list-item__title  { font-size: .9rem; font-weight: 500; color: var(--c-gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item__sub    { font-size: .75rem; color: var(--c-gray-400); margin-top: .1rem; }
.list-item__right  { flex-shrink: 0; text-align: right; }
.list-item__amount { font-size: .9rem; font-weight: 700; color: var(--c-gray-800); }

/* ---------- Tabs ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: .375rem;
  margin-bottom: 1.25rem;
  background: var(--c-gray-100);
  border-radius: .875rem;
  padding: .3rem;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .5rem .25rem;
  font-size: .6875rem;
  font-weight: 500;
  color: var(--c-gray-500);
  border: none;
  border-radius: .625rem;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
  font-family: var(--font);
  line-height: 1.2;
}
.tab__icon {
  font-size: 1.125rem;
  line-height: 1;
}
.tab:hover { color: var(--c-gray-700); background: rgba(0,0,0,.04); }
.tab--active {
  background: white;
  color: var(--c-green-700);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.1), 0 0 0 1px rgba(21,128,61,.08);
}

@media (min-width: 640px) {
  .tabs {
    display: flex;
    gap: 0;
    background: none;
    border-radius: 0;
    padding: 0;
    border-bottom: 2px solid var(--c-gray-200);
  }
  .tab {
    flex-direction: row;
    gap: .375rem;
    padding: .75rem 1.125rem;
    font-size: .875rem;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
  }
  .tab__icon { font-size: 1rem; }
  .tab--active {
    background: none;
    box-shadow: none;
    border-bottom-color: var(--c-green-700);
  }
}

/* ---------- Alerts / Banners ---------- */
.alert {
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  font-size: .875rem;
}
.alert__icon { font-size: 1.25rem; flex-shrink: 0; line-height: 1; }
.alert__title { font-weight: 600; margin-bottom: .2rem; }
.alert--green  { background: var(--c-green-50);  border: 1px solid var(--c-green-200); color: var(--c-green-800); }
.alert--yellow { background: var(--c-yellow-50); border: 1.5px solid #f59e0b; color: #92400e; }
.alert--red    { background: var(--c-red-50);    border: 1px solid #fca5a5;   color: #991b1b; }
.alert--blue   { background: var(--c-blue-50);   border: 1px solid var(--c-blue-100); color: var(--c-blue-700); }
.alert--gray   { background: var(--c-gray-50);   border: 1px solid var(--c-gray-200); color: var(--c-gray-700); }

/* ---------- Progress Bar ---------- */
.progress { background: var(--c-gray-100); border-radius: 2rem; height: .5rem; overflow: hidden; }
.progress__bar { height: 100%; border-radius: 2rem; background: var(--c-green-500); transition: width .4s ease; }
.progress__bar--blue   { background: var(--c-blue-500); }
.progress__bar--yellow { background: #f59e0b; }
.progress__bar--red    { background: var(--c-red-500); }

/* ---------- Invite code block ---------- */
.invite-code-bar {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.invite-code {
  font-family: monospace;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: .15em;
  color: white;
  flex: 1;
  min-width: 0;
}

/* ---------- Group card (index page) ---------- */
.group-card {
  display: block;
  background: white;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--c-gray-200);
  padding: 1.125rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.group-card:hover { border-color: var(--c-green-400); box-shadow: var(--shadow); }
.group-card:active { transform: scale(.98); }
.group-card__top { display: flex; align-items: center; gap: .875rem; margin-bottom: .875rem; }
.group-card__icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}
.group-card__name  { font-weight: 600; font-size: .9375rem; color: var(--c-gray-900); }
.group-card__rows  { display: flex; flex-direction: column; gap: .35rem; }
.group-card__row   { display: flex; justify-content: space-between; font-size: .8125rem; }
.group-card__key   { color: var(--c-gray-500); }
.group-card__val   { font-weight: 600; color: var(--c-gray-800); }
.group-card__foot  { display: flex; align-items: center; justify-content: space-between; margin-top: .875rem; padding-top: .875rem; border-top: 1px solid var(--c-gray-100); }

/* ---------- Toasts ---------- */
.toast {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-xl);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.12);
  width: calc(100vw - 2rem);
  max-width: 28rem;
  white-space: normal;
  word-break: break-word;
  border-left: 4px solid rgba(255,255,255,.4);
  letter-spacing: .01em;
}
.toast--success {
  background: linear-gradient(135deg, #065f46, #15803d);
  color: white;
}
.toast--error {
  background: linear-gradient(135deg, #7f1d1d, #b91c1c);
  color: white;
}
.toast svg { width: 1.375rem; height: 1.375rem; flex-shrink: 0; }

/* ---------- Empty state ---------- */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--c-gray-400);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 1rem; opacity: .5; }
.empty-state__title { font-size: 1rem; font-weight: 600; color: var(--c-gray-600); margin-bottom: .375rem; }
.empty-state__sub   { font-size: .875rem; }

/* ---------- Header slot ---------- */
.page-bar {
  background: white;
  border-bottom: 1px solid var(--c-gray-200);
  padding: .875rem 1rem;
}
.page-bar__inner {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .625rem;
  flex-wrap: wrap;
  min-width: 0;
}
.page-bar__back {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--c-gray-600);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  flex-shrink: 0;
}
.page-bar__back:hover { color: var(--c-gray-900); }

/* ---------- Group header banner ---------- */
.group-banner {
  background: linear-gradient(135deg, var(--c-green-700), var(--c-green-800));
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-bottom: 1rem;
  color: white;
}
.group-banner--blue { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }
.group-banner__top  { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.group-banner__name { font-size: 1.25rem; font-weight: 700; }
.group-banner__meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .375rem; }
.group-banner__actions { display: flex; gap: .5rem; flex-wrap: wrap; flex-shrink: 0; }

/* ---------- Pending approval card ---------- */
.pending-card {
  background: var(--c-yellow-50);
  border: 2px solid #f59e0b;
  border-radius: var(--radius-lg);
  padding: 1.125rem;
  margin-bottom: 1rem;
}
.pending-card__title { font-weight: 700; color: #92400e; margin-bottom: .875rem; display: flex; align-items: center; gap: .625rem; }
.pending-card__count { background: #f59e0b; color: white; border-radius: 50%; width: 1.5rem; height: 1.5rem; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; }
.pending-row { background: white; border: 1px solid #fde68a; border-radius: var(--radius-sm); padding: .875rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.pending-row + .pending-row { margin-top: .5rem; }
.pending-row__info { flex: 1; min-width: 0; }
.pending-row__name { font-weight: 600; color: var(--c-gray-800); font-size: .9rem; }
.pending-row__sub  { font-size: .75rem; color: var(--c-gray-500); margin-top: .1rem; }
.pending-row__btns { display: flex; gap: .375rem; flex-shrink: 0; }

/* ---------- Join code card ---------- */
.join-card {
  background: linear-gradient(135deg, var(--c-green-700), var(--c-green-800));
  border-radius: var(--radius-xl);
  padding: 1.375rem;
  color: white;
}
.join-card__header { display: flex; align-items: center; gap: .875rem; margin-bottom: 1.125rem; }
.join-card__icon   { width: 3rem; height: 3rem; background: rgba(255,255,255,.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.375rem; flex-shrink: 0; }
.join-card__title  { font-weight: 700; font-size: 1rem; }
.join-card__sub    { font-size: .8rem; color: rgba(255,255,255,.75); margin-top: .15rem; }
.join-card__row    { display: flex; gap: .5rem; }
.join-code-input {
  flex: 1;
  padding: .8125rem 1rem;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: monospace;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: rgba(255,255,255,.12);
  color: white;
  outline: none;
  transition: border-color .15s, background .15s;
}
.join-code-input::placeholder { color: rgba(255,255,255,.5); font-weight: 400; letter-spacing: normal; font-family: var(--font); }
.join-code-input:focus { border-color: white; background: rgba(255,255,255,.2); }
.join-submit {
  padding: .8125rem 1.25rem;
  background: white;
  color: var(--c-green-700);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background .15s;
}
.join-submit:hover { background: var(--c-green-50); }
.join-error { color: #fde047; font-size: .8rem; margin-top: .5rem; }

/* ---------- Invite code display ---------- */
.code-display {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: white;
  border: 1px solid var(--c-gray-200);
  border-radius: var(--radius-sm);
  padding: .5rem .875rem;
}
.code-display__code { font-family: monospace; font-weight: 800; font-size: 1.1rem; letter-spacing: .12em; color: var(--c-green-700); }

/* ---------- Dashboard grid ---------- */
.dash-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (min-width: 640px) {
  .dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
  }
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .page-wrap { padding: 1.5rem; }
  .topnav__links { display: flex; }
  .topnav__name  { display: block; }
  .bottom-nav    { display: none; }
  body { padding-bottom: env(safe-area-inset-bottom); }
  .stat-grid { gap: 1rem; }
  .input-row--2 { grid-template-columns: 1fr 1fr; }
  .input-row--3 { grid-template-columns: 1fr 1fr 1fr; }
  .choice-grid--5 { grid-template-columns: repeat(5, 1fr); }
  .hide-desktop  { display: none !important; }
}

@media (max-width: 639px) {
  .topnav__name   { display: none; }
  .hide-mobile    { display: none !important; }
  .hide-desktop   { display: inline; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .stat-card { padding: .75rem .5rem; }
  .stat-card__value { font-size: 1.375rem; }
  .choice-grid--5 { grid-template-columns: repeat(3, 1fr); }
  .page-bar { padding: .75rem 1rem; }
}

/* ---------- Utility helpers ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.space-y > * + * { margin-top: 1rem; }
.divide > * + * { border-top: 1px solid var(--c-gray-100); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-mono { font-family: monospace; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }

@media (min-width: 640px) {
  .grid-md-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .grid-md-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
}
@media (min-width: 1024px) {
  .grid-lg-3 { grid-template-columns: repeat(3, 1fr); }
}
