/* ---------- Groups tab ---------- */

.topbar.groups { background: none; }

.view-groups {
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(var(--tabbar-h) + var(--tabbar-gap) + 40px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}
.view-groups::-webkit-scrollbar { display: none; }
.view-groups > * { max-width: var(--col); margin-left: auto; margin-right: auto; }

/* Toasts show above sheets (a group's sheet copies codes, reports, etc.). */
.toast { z-index: 60; }
/* Destructive items stay red in option menus too. */
.menu-pop.rich button.danger { color: var(--error); }

/* Unread dot on the Groups tab */
.tab-dot {
  position: absolute;
  top: 10px;
  left: calc(50% + 9px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--imessage-blue);
  box-shadow: 0 0 0 2px #e8e8ed;
}

/* Cover tiles: a soft gradient with a highlight, a clay illustration on top. --c3 is the deep tone
   for text on cards tinted with the cover (the "Next in" card, "This week"). */
[data-cover] { --c1: #e6f0ff; --c2: #b9d4ff; --c3: #2d6fd6; }
[data-cover="dove"] { --c1: #e6f7ff; --c2: #aee0fa; --c3: #1d7fb6; }
[data-cover="cross"] { --c1: #f1ebff; --c2: #cdbbff; --c3: #6a3fd6; }
[data-cover="praying"] { --c1: #fff4d9; --c2: #ffd88c; --c3: #a4650a; }
[data-cover="flame"] { --c1: #ffece0; --c2: #ffbf96; --c3: #c2410c; }
[data-cover="coffee"] { --c1: #faeee4; --c2: #e7c4a6; --c3: #8a5a30; }
[data-cover="family"] { --c1: #e4f7e8; --c2: #a8e0b5; --c3: #17803f; }
[data-cover="youth"] { --c1: #ffe8f1; --c2: #ffb9d3; --c3: #bd1f60; }
/* Sporty covers */
[data-cover="run"] { --c1: #eefbdb; --c2: #bfe58a; --c3: #3f7a12; }
[data-cover="bike"] { --c1: #e2f3ff; --c2: #a3d3fb; --c3: #0b6aa0; }
[data-cover="hike"] { --c1: #ddf6f1; --c2: #9adcd0; --c3: #0d7a70; }
[data-cover="tennis"] { --c1: #f7fbd4; --c2: #d9ec74; --c3: #5f7010; }
[data-cover="pickleball"] { --c1: #fff8d6; --c2: #ffe27a; --c3: #9a6b05; }
[data-cover="basketball"] { --c1: #ffeddc; --c2: #ffbd82; --c3: #b8531a; }
[data-cover="soccer"] { --c1: #e6f5e6; --c2: #a8dcae; --c3: #1f7a34; }
[data-cover="volleyball"] { --c1: #fff3dc; --c2: #ffd88a; --c3: #a3640b; }
[data-cover="golf"] { --c1: #e3f4df; --c2: #a6d897; --c3: #2f7a2a; }
[data-cover="fitness"] { --c1: #ebe8ff; --c2: #c3bbf5; --c3: #5c44c8; }
[data-cover="baseball"] { --c1: #ffe9e6; --c2: #ffb8ad; --c3: #b52f27; }
[data-cover="football"] { --c1: #f6ebe2; --c2: #dcb896; --c3: #7a4424; }
[data-cover="trophy"] { --c1: #fff3d4; --c2: #f5d27a; --c3: #9a6b05; }
[data-cover="medal"] { --c1: #fff1d6; --c2: #f7c96e; --c3: #a05f09; }
[data-cover="serve"] { --c1: #ffeee4; --c2: #ffc6a8; --c3: #b8531a; }
[data-cover="flower"] { --c1: #ffe9f0; --c2: #ffbdd2; --c3: #bd1f60; }
.gcover {
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(90% 80% at 28% 18%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 60%),
    linear-gradient(150deg, var(--c1), var(--c2));
}
.gcover img { width: 68%; height: 68%; filter: drop-shadow(0 4px 5px rgba(16, 17, 19, 0.16)); }

/* Initials avatars, colored per person */
.gav {
  --bg: #e0ecff; --fg: #1f5fd1;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}
.gav-1 { --bg: #dcf5e4; --fg: #17803f; }
.gav-2 { --bg: #fff0cc; --fg: #a55a06; }
.gav-3 { --bg: #ffe2ee; --fg: #bd1f60; }
.gav-4 { --bg: #ece6ff; --fg: #6a3fd6; }
.gav-5 { --bg: #d5f4f1; --fg: #0d7a70; }
.gav-6 { --bg: #ffe6d6; --fg: #c2410c; }
.gav-7 { --bg: #dff0fb; --fg: #0b6aa0; }

/* Buttons */
.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  min-width: 210px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--imessage-blue);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.gbtn.wide { width: 100%; }
.gbtn:active { transform: scale(0.98); }
.gbtn:disabled { opacity: 0.5; cursor: default; }
.gbtn svg { width: 20px; height: 20px; stroke-width: 2; }
.gbtn-plain {
  height: 44px;
  padding: 0 18px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.gbtn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.gbtn-soft.small { height: 38px; padding: 0 16px; font-size: 0.875rem; }
.gbtn-soft svg { width: 20px; height: 20px; }
.gpill {
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--imessage-blue);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.gpill:disabled { opacity: 0.35; cursor: default; }

/* Progress bar (Up next card, Study) */
.gbar { display: block; height: 6px; border-radius: 3px; background: rgba(10, 132, 255, 0.14); overflow: hidden; }
.gbar i { display: block; height: 100%; width: calc(var(--p, 0) * 1%); min-width: 6px; border-radius: inherit; background: var(--imessage-blue); transition: width 0.5s cubic-bezier(0.3, 0.8, 0.25, 1); }

.gs-loading { justify-content: center; margin: 36px auto; }

@keyframes grp-in { from { opacity: 0; transform: translateY(6px); } }
/* Only things new on screen animate in (JS adds .fresh), so live redraws don't flash. */
.gnext.fresh, .grow.fresh, .gd-card.fresh, .gpr.fresh, .gm-row.fresh { animation: grp-in 0.35s ease both; animation-delay: calc(var(--i, 0) * 30ms); }
.gc-msg.fresh, .gc-ai.fresh, .gc-prayer.fresh { animation: grp-in 0.25s ease both; }

/* ---------- Home: Up next ---------- */

.gnext-rail {
  display: flex;
  gap: 12px;
  margin: 4px -16px 14px;
  padding: 4px 16px 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scrollbar-width: none;
}
.gnext-rail::-webkit-scrollbar { display: none; }
.gnext {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 55%),
    linear-gradient(155deg, #eef5ff 0%, #e1edff 60%, #d5e6ff 100%);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.08);
  cursor: pointer;
  transition: transform 0.15s;
  outline: none;
}
.gnext:active { transform: scale(0.985); }
.gnext:focus-visible { box-shadow: inset 0 0 0 2px var(--imessage-blue); }
.gnext-rail.multi .gnext { flex-basis: calc(100% - 30px); }
.gnext-label, .gnext-ref, .gnext-meta, .gnext .gbar { position: relative; z-index: 1; max-width: calc(100% - 96px); }
.gnext-label { font-size: 0.8125rem; font-weight: 600; color: #2d6fd6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gnext-ref { margin-top: 6px; font-size: 2.125rem; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
.gnext-ref.small { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; }
.gnext-meta { margin-top: 6px; font-size: 0.875rem; color: #53607a; }
.gnext .gbar { margin-top: 14px; width: 62%; }
.gnext-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; margin-top: 16px; min-width: 0; }
.gnext-read {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--imessage-blue);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(10, 132, 255, 0.28);
}
.gnext-read.done { background: #fff; color: var(--imessage-blue); box-shadow: 0 2px 8px rgba(16, 17, 19, 0.06); padding: 0 18px 0 14px; }
.gnext-read svg { width: 18px; height: 18px; stroke-width: 2.4; }
.gnext-meets { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 0.8125rem; font-weight: 500; color: #53607a; }
.gnext-meets svg { flex: none; width: 16px; height: 16px; }
.gnext-art {
  position: absolute;
  right: 14px;
  top: 18px;
  width: 92px;
  height: 92px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: radial-gradient(90% 80% at 28% 18%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 60%), linear-gradient(150deg, var(--c1), var(--c2));
  box-shadow: 0 12px 24px rgba(30, 64, 140, 0.14);
  transform: rotate(7deg);
}
.gnext-art img { width: 66px; height: 66px; filter: drop-shadow(0 6px 8px rgba(16, 17, 19, 0.18)); }
/* "Next in <group>": tinted with the group's cover */
.gnext.act {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 55%),
    linear-gradient(155deg, #fff 0%, var(--c1) 55%, var(--c2) 140%);
  box-shadow: inset 0 0 0 1px rgba(16, 17, 19, 0.06);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c3) 14%, transparent);
}
.gnext.act .gnext-label { color: var(--c3); }
.gnext.act .gnext-ref { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
/* "Tomorrow · 7:00 AM · Bayshore Blvd at Bay to Bay" wraps to a second line instead of clipping the place. */
.gnext.act .gnext-meta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; line-height: 1.35; }
.gnext-going { position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; margin-top: 4px; max-width: calc(100% - 96px); font-size: 0.8125rem; font-weight: 600; color: var(--c3); }
.gnext-going svg { width: 15px; height: 15px; flex: none; }
.gnext.act .gnext-read { background: var(--c3); box-shadow: 0 6px 16px rgba(16, 17, 19, 0.18); box-shadow: 0 6px 16px color-mix(in srgb, var(--c3) 30%, transparent); }
.gnext.act .gnext-read.done { background: #fff; color: var(--c3); box-shadow: 0 2px 8px rgba(16, 17, 19, 0.06); }
.gnext.act .gnext-art { box-shadow: 0 12px 24px rgba(16, 17, 19, 0.14); box-shadow: 0 12px 24px color-mix(in srgb, var(--c3) 22%, transparent); }

/* ---------- Home: sections and rows ---------- */

.gsec { padding: 4px 0 12px; }
.gsec + .gsec { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.gsec-head { display: flex; align-items: center; gap: 10px; height: 36px; font-size: 0.9375rem; font-weight: 600; letter-spacing: 0; color: var(--imessage-blue); }
.gsec-head i { width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: currentColor; }
.gsec.discover .gsec-head { color: #7c4ddb; }
.gsec-sub { margin: -6px 0 8px 22px; font-size: 0.875rem; color: var(--text-2); }

.grow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  color: inherit;
  text-decoration: none;
  border-radius: 18px;
  transition: opacity 0.15s;
}
.grow:active { opacity: 0.6; }
.grow-cover { width: 52px; height: 52px; border-radius: 16px; }
.grow-text { flex: 1; min-width: 0; }
.grow-name { display: flex; align-items: center; gap: 6px; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.grow-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow-name svg { flex: none; width: 15px; height: 15px; color: var(--text-3); }
.grow-sub { display: block; margin-top: 2px; font-size: 0.9375rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow.unread .grow-sub { color: var(--text); }
.grow-end { flex: none; align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; min-width: 32px; }
.grow-end small { font-size: 0.8125rem; color: var(--text-3); }
.grow.unread .grow-end small { color: var(--imessage-blue); font-weight: 600; }
.grow.muted .grow-end small { color: var(--text-3); font-weight: 400; }
.grow-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--imessage-blue);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.grow-badge-space { height: 22px; }
.grow.muted .grow-badge { background: #c7c7cc; }

.gadd {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.gadd:active { opacity: 0.6; }
.gadd-icon { flex: none; width: 52px; height: 44px; display: grid; place-items: center; color: var(--text-2); }
.gadd-icon svg { width: 22px; height: 22px; stroke-width: 2; }

/* ---------- Home: Discover ---------- */

.gd-rail {
  display: flex;
  gap: 12px;
  margin: 0 -16px;
  padding: 4px 16px 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scrollbar-width: none;
}
.gd-rail::-webkit-scrollbar { display: none; }
.gd-card {
  flex: 0 0 232px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(16, 17, 19, 0.05);
  cursor: pointer;
  transition: transform 0.15s;
}
.gd-card:active { transform: scale(0.98); }
.gd-cover {
  position: relative;
  height: 124px;
  display: grid;
  place-items: center;
  background: radial-gradient(90% 90% at 25% 15%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 60%), linear-gradient(150deg, var(--c1), var(--c2));
}
.gd-cover img { width: 82px; height: 82px; filter: drop-shadow(0 10px 12px rgba(16, 17, 19, 0.2)); transform: rotate(-4deg); }
.gd-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 0.75rem;
  font-weight: 600;
}
.gd-tag svg { width: 14px; height: 14px; }
.gd-body { flex: 1; display: flex; flex-direction: column; padding: 12px 14px 14px; }
.gd-name { font-size: 1rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-cat { margin-top: 1px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em; color: #7c4ddb; }
/* Category chips over the Discover rail */
.gd-chips {
  display: flex;
  gap: 8px;
  margin: 0 -16px 2px;
  padding: 2px 16px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.gd-chips::-webkit-scrollbar { display: none; }
.gd-chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.gd-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.gd-desc {
  margin-top: 3px;
  min-height: 2.8em;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gd-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.gd-foot > span { font-size: 0.8125rem; color: var(--text-3); }
.gd-join {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 16px;
  border: 1.5px solid var(--imessage-blue);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--imessage-blue);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, padding 0.2s;
}
.gd-join.on { background: var(--imessage-blue); color: #fff; padding: 0 14px 0 10px; }
.gd-join svg { width: 16px; height: 16px; stroke-width: 2.6; }
.gd-join.just svg { animation: pray-pop 0.35s cubic-bezier(0.3, 1.5, 0.5, 1); }

/* ---------- Home: empty state ---------- */

.gempty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 8px 26px; animation: grp-in 0.4s ease both; }
.gempty-art {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #eaf2ff 0%, #f3f7ff 48%, rgba(255, 255, 255, 0) 70%);
}
.gempty-art img { width: 158px; height: 158px; filter: drop-shadow(0 18px 24px rgba(16, 17, 19, 0.14)); animation: grp-float 6s ease-in-out infinite; }
@keyframes grp-float { 50% { transform: translateY(-6px) rotate(-1.5deg); } }
.gempty h2 { margin-top: 6px; font-size: 1.625rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.gempty p { margin-top: 10px; max-width: 330px; font-size: 1rem; line-height: 1.5; color: var(--text-2); }
.gempty-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 22px; }
.gempty:not(.compact) { min-height: calc(100vh - 250px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); justify-content: center; padding-bottom: 48px; }
.gempty.compact { padding-top: 4px; }
.gempty.compact .gempty-art { width: 150px; height: 150px; }
.gempty.compact .gempty-art img { width: 112px; height: 112px; }
.gempty.compact h2 { font-size: 1.375rem; }


/* ---------- Group sheet ---------- */

.group-sheet { background: #fff; }
.gs-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.gs-scroll::-webkit-scrollbar { display: none; }

/* Top row: stays put; turns white and shows the group's name once the hero scrolls away. */
.gs-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 72px;
  padding: 0 16px;
  pointer-events: none;
  transition: background 0.2s;
}
.gs-bar > * { pointer-events: auto; }
.gs-bar .round-btn { flex: none; width: 44px; height: 44px; }
.gs-bar .round-btn svg { pointer-events: none; }
.group-sheet.scrolled .gs-bar {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
}
.gs-mini {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 0.8, 0.25, 1);
  pointer-events: none;
}
.gs-mini > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-mini-cover { width: 28px; height: 28px; border-radius: 9px; }
.group-sheet.stuck .gs-mini { opacity: 1; transform: none; }
.gs-actions { display: flex; gap: 8px; margin-left: auto; }

.gs-hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: -54px; padding: 0 24px 6px; }
.gs-cover { width: 88px; height: 88px; border-radius: 26px; box-shadow: 0 12px 28px rgba(16, 17, 19, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.5); }
.gs-cover img { width: 62px; height: 62px; }
.gs-name { margin-top: 14px; max-width: 100%; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; overflow-wrap: anywhere; }
.gs-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; margin-top: 4px; font-size: 0.9375rem; color: var(--text-2); }
.gs-meta svg { width: 15px; height: 15px; flex: none; }
.gs-desc {
  margin-top: 8px;
  max-width: 420px;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.gs-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.gs-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; border-radius: 999px; background: var(--pill); font-size: 0.8125rem; font-weight: 500; }
.gs-chip svg { width: 15px; height: 15px; color: var(--text-2); }
.gs-faces { display: flex; align-items: center; margin-top: 14px; padding: 0 0 0 5px; border: 0; background: none; cursor: pointer; }
.gs-faces .gav { width: 32px; height: 32px; margin-left: -5px; font-size: 0.6875rem; box-shadow: 0 0 0 2.5px #fff; }
.gs-faces-more { --bg: var(--pill); --fg: var(--text-2); }

.gs-tabs-wrap { position: sticky; top: 72px; z-index: 3; padding: 12px 16px 8px; background: #fff; transition: box-shadow 0.2s; }
.group-sheet.stuck .gs-tabs-wrap { box-shadow: 0 1px 0 var(--border); }
/* Five tabs for a study group, four for a club (--n is set from JS). */
.gs-tabs { --n: 5; margin: 0; grid-template-columns: repeat(var(--n), 1fr); }
.native .gs-tabs { grid-template-columns: repeat(var(--n), 1fr); }
.gs-tabs .gs-ind, .native .gs-tabs .gs-ind { width: calc((100% - 10px) / var(--n)); }
.gs-tabs button { position: relative; }
.gs-tab-dot { position: absolute; top: 8px; left: calc(50% + 9px); width: 8px; height: 8px; border-radius: 50%; background: var(--imessage-blue); }

/* Tall enough that switching tabs can keep the tabs pinned under the top row. */
.gs-body { min-height: calc(100vh - 44px - env(safe-area-inset-top) - 72px - 64px); }
.gs-body[data-tab="chat"] { min-height: 0; }
.group-sheet.preview .gs-body { min-height: 0; }

.gs-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 24px 40px; animation: grp-in 0.3s ease both; }
.gs-empty img { width: 104px; height: 104px; filter: drop-shadow(0 12px 18px rgba(16, 17, 19, 0.14)); }
.gs-empty h3 { margin-top: 12px; font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.02em; }
.gs-empty p { margin-top: 6px; max-width: 320px; font-size: 0.9375rem; line-height: 1.5; color: var(--text-2); }
.gs-empty .gbtn, .gs-empty .gbtn-soft { margin-top: 18px; }
.gs-empty .gs-empty-note { margin-top: 14px; font-weight: 600; color: var(--text); }
.gs-empty.small { padding-top: 18px; }
.gs-empty.small img { width: 84px; height: 84px; }

.gs-joinbox { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 20px 40px; text-align: center; }
.gs-joinbox p { max-width: 330px; font-size: 0.875rem; line-height: 1.5; color: var(--text-2); }

/* Composer pinned to the bottom of the sheet (Chat tab) */
.gs-composer-wrap {
  flex: none;
  position: relative;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(255, 255, 255, 0), #fff 14px);
  margin-top: -14px;
  z-index: 2;
}
.gs-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 50px;
  padding: 5px 5px 5px 18px;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(16, 17, 19, 0.07);
  transition: border-color 0.15s;
}
.gs-composer:focus-within { border-color: #cfcfd4; }
.gs-composer textarea {
  flex: 1;
  align-self: center;
  min-height: 24px;
  max-height: 118px;
  padding: 7px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
}
.gs-composer textarea::placeholder { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* a long group name stays on one line */
.gs-send { width: 38px; height: 38px; background: var(--imessage-blue); color: #fff; transition: opacity 0.15s, transform 0.15s; }
.gs-send:disabled { background: var(--imessage-blue); opacity: 0.3; cursor: default; }
.gs-send:not(:disabled):active { transform: scale(0.92); }
.gs-send svg { width: 19px; height: 19px; stroke-width: 2.4; }
.kb-open .gs-composer-wrap { padding-bottom: 8px; }

/* ---------- Chat ---------- */

.gc { display: flex; flex-direction: column; padding: 6px 16px 14px; } /* same 16px gutter as the main chat */
.gc-day { align-self: center; margin: 18px 0 8px; font-size: 0.75rem; color: var(--text-3); }
.gc-day strong { font-weight: 600; color: var(--text-2); }
.gc-sys {
  align-self: center;
  max-width: 86%;
  margin: 6px 0;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--pill);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-2);
  text-align: center;
}
.gc-hello { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 14px auto 6px; text-align: center; }
.gc-hello img { width: 72px; height: 72px; margin-bottom: 6px; filter: drop-shadow(0 10px 14px rgba(16, 17, 19, 0.14)); }
.gc-hello strong { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }
.gc-hello span { font-size: 0.875rem; color: var(--text-2); }

.gc-run { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.gc-name { margin: 0 0 2px 50px; font-size: 0.75rem; font-weight: 600; color: var(--text-2); }
.gc-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.gc-msg .gav { width: 28px; height: 28px; font-size: 0.625rem; visibility: hidden; }
.gc-msg.last .gav { visibility: visible; }
.gc-bubble {
  min-width: 0;
  max-width: min(76%, 520px);
  padding: 9px 14px;
  border-radius: 20px;
  background: var(--bubble);
  font-size: 1rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.gc-run:not(.mine) .gc-msg:not(.last) .gc-bubble { border-bottom-left-radius: 6px; }
.gc-run:not(.mine) .gc-msg:not(.first) .gc-bubble { border-top-left-radius: 6px; }
.gc-run.mine .gc-msg { flex-direction: row-reverse; }
.gc-run.mine .gc-bubble { background: var(--imessage-blue); color: #fff; }
.gc-run.mine .gc-msg:not(.last) .gc-bubble { border-bottom-right-radius: 6px; }
.gc-run.mine .gc-msg:not(.first) .gc-bubble { border-top-right-radius: 6px; }
.gc-msg.pending .gc-bubble { opacity: 0.55; }
.gc-more { width: 30px; height: 34px; margin: 0 -4px; opacity: 0; transition: opacity 0.15s; }
.gc-msg:hover .gc-more, .gc-more:focus-visible { opacity: 1; }
.gc-more svg { width: 17px; height: 17px; }
@media (hover: none) {
  .gc-more { display: none; }
  .gc-bubble, .gc-ai-body, .gc-prayer, .gpr-body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

/* Christian's posts in a group */
.gc-ai { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; }
.gc-ai-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.gc-ai-avatar img { width: 20px; height: auto; }
.gc-ai-body {
  min-width: 0;
  max-width: min(84%, 560px);
  padding: 11px 14px 12px;
  border-radius: 6px 20px 20px 20px;
  background: linear-gradient(140deg, #f1f7ff, #f6f2ff);
  border: 1px solid #e3ebfa;
}
.gc-ai-body strong { display: block; margin-bottom: 3px; font-size: 0.75rem; font-weight: 700; color: #2d6fd6; }
.gc-ai-body p { font-size: 1rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

/* A prayer request, as it appears in the chat */
.gc-prayer {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(80%, 420px);
  margin: 12px 0 2px 36px;
  padding: 12px 14px;
  border: 1px solid #f0e4c8;
  border-radius: 20px;
  background: linear-gradient(160deg, #fff8e8, #fffdf7 70%);
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.gc-prayer.mine { align-self: flex-end; margin-left: 0; }
.gc-prayer-head { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 700; color: #a4650a; }
.gc-prayer-head svg { width: 16px; height: 16px; }
.gc-prayer-body {
  font-size: 0.9375rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.gc-prayer-foot { font-size: 0.8125rem; font-weight: 600; color: var(--imessage-blue); }

/* ---------- Study ---------- */

.gst { padding: 6px 16px 40px; }
.gst-nav { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px 0 14px; }
.gst-day { min-width: 108px; text-align: center; font-size: 0.9375rem; font-weight: 600; }
.gst-arrow {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity 0.15s;
}
.gst-arrow:disabled { opacity: 0.3; cursor: default; }
.gst-arrow svg { width: 18px; height: 18px; stroke-width: 2.2; }
.gst-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 20px;
  border-radius: 26px;
  overflow: hidden;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 55%), linear-gradient(155deg, #eef5ff, #dde9ff);
}
.gst-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #2d6fd6; }
.gst-ref { margin-top: 6px; font-size: 2rem; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
.gst-meta { margin-top: 6px; font-size: 0.875rem; color: #53607a; }
.gst-card .gbar { margin-top: 14px; width: 58%; }
.gst-art { position: absolute; right: 14px; top: 16px; width: 84px; height: 84px; transform: rotate(8deg); filter: drop-shadow(0 12px 16px rgba(30, 64, 140, 0.22)); }

.gp-wrap { margin-top: 22px; }
.gp {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.7;
  color: #1f2023;
  overflow-wrap: anywhere;
}
.gp sup { margin-right: 3px; font-family: "Inter", sans-serif; font-size: 0.625rem; font-weight: 600; color: #6f8fc4; vertical-align: 0.55em; line-height: 0; }
.gp.clipped { position: relative; }
.gp.clipped::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 96px; background: linear-gradient(rgba(255, 255, 255, 0), #fff 88%); pointer-events: none; }
.gp-more {
  display: block;
  height: 38px;
  margin: 4px auto 0;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(16, 17, 19, 0.05);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.gp-src { margin-top: 10px; font-size: 0.75rem; color: var(--text-3); }
.gp-error { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 0; text-align: center; font-size: 0.9375rem; color: var(--text-2); }
.gp-loading { margin: 28px auto; }

.gread { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 22px; }
.gread-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--imessage-blue);
  color: #fff;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(10, 132, 255, 0.22);
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.gread-btn.done { background: #e6f6ec; color: #16833f; box-shadow: none; }
.gread-btn svg { width: 20px; height: 20px; stroke-width: 2.6; }
.gread-btn.just svg { animation: pray-pop 0.4s cubic-bezier(0.3, 1.5, 0.5, 1); }
.gread-who { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text-2); }
.gread-faces { display: flex; padding-left: 4px; }
.gread-faces .gav { width: 26px; height: 26px; margin-left: -4px; font-size: 0.5625rem; box-shadow: 0 0 0 2px #fff; }

.gq { margin-top: 26px; padding: 16px 16px 6px; border: 1px solid var(--border); border-radius: 24px; background: #fff; box-shadow: 0 4px 18px rgba(16, 17, 19, 0.04); }
.gq-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; }
.gq-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; overflow: hidden; }
.gq-avatar img { width: 26px; height: auto; }
.gq-head strong { display: block; font-size: 1rem; font-weight: 600; }
.gq-head small { display: block; margin-top: 1px; font-size: 0.8125rem; color: var(--text-2); }
.gq-item { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.gq-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #eef4ff; color: #2d6fd6; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; }
.gq-item p { font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.gq-discuss {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin-top: 10px;
  padding: 0 13px 0 10px;
  border: 0;
  border-radius: 999px;
  background: #eef4ff;
  color: #1f6fe0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.gq-discuss svg { width: 16px; height: 16px; stroke-width: 2; }
.gq-error { padding: 4px 0 10px; font-size: 0.9375rem; color: var(--text-2); }
.gq .gbtn-soft { margin-bottom: 12px; }
.gq-loading { margin: 10px 0 20px 46px; }

/* ---------- Prayer ---------- */

.gpr-new {
  margin: 6px 16px 4px;
  padding: 14px 12px 10px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 22px rgba(16, 17, 19, 0.06);
  transition: border-color 0.15s;
}
.gpr-new:focus-within { border-color: #cfcfd4; }
.gpr-input {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
}
.gpr-input::placeholder { color: var(--text-3); }
.gpr-new-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.gpr-new-foot > span { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--text-3); }
.gpr-new-foot svg { width: 16px; height: 16px; }

.gpr-list { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 40px; }
.gpr {
  padding: 14px 14px 14px 16px;
  border: 1px solid #f0e6cf;
  border-radius: 22px;
  background: linear-gradient(165deg, #fff9ec, #fffdf8 55%, #fff);
}
.gpr header { display: flex; align-items: center; gap: 10px; }
.gpr-who { flex: 1; min-width: 0; }
.gpr-who strong { display: block; font-size: 0.9375rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpr-who small { display: block; font-size: 0.8125rem; color: var(--text-3); }
.gpr .kebab { width: 32px; height: 36px; margin-right: -6px; }
.gpr .kebab svg { width: 18px; height: 18px; }
.gpr-body { margin: 10px 0 12px; font-size: 1rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.gpr-foot { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gpray {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 11px;
  border: 1px solid #e6dcc6;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.gpray:active { transform: scale(0.95); }
.gpray svg { width: 18px; height: 18px; }
.gpray.on { background: var(--imessage-blue); border-color: var(--imessage-blue); color: #fff; }
.gpray.pop svg { animation: pray-pop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
.gpray-n { font-weight: 500; opacity: 0.85; }
.gpr-count { min-width: 0; font-size: 0.8125rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pray-pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- Members & invite ---------- */

.gm { padding: 4px 16px 40px; }
.gm-invite { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.gm-invite:active { opacity: 0.6; }
.gm-invite-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #e8f1ff; color: var(--imessage-blue); display: grid; place-items: center; }
.gm-invite-icon svg { width: 22px; height: 22px; stroke-width: 2; }
.gm-invite strong { display: block; font-size: 1rem; font-weight: 600; color: var(--imessage-blue); }
.gm-invite small { display: block; margin-top: 1px; font-size: 0.8125rem; color: var(--text-2); }
.gs-h { margin: 16px 2px 2px; font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.gm-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.gm-row .gav { width: 44px; height: 44px; font-size: 0.9375rem; }
.gm-text { flex: 1; min-width: 0; }
.gm-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gm-name strong { font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-you { font-size: 0.8125rem; color: var(--text-3); }
.gm-badge { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: #e8f1ff; color: #1f6fe0; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.01em; }
.gm-badge.grey { background: var(--pill); color: var(--text-2); }
.gm-text small { display: block; margin-top: 1px; font-size: 0.8125rem; color: var(--text-3); }
.gm-row .kebab { margin-right: -8px; }

.gi { display: flex; flex-direction: column; padding: 2px 16px 40px; }
.gs-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 14px 0 6px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.gs-back svg { width: 18px; height: 18px; stroke-width: 2.2; }
.gi-hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 10px 0 20px; animation: grp-in 0.3s ease both; }
.gi-hero img { width: 108px; height: 108px; filter: drop-shadow(0 14px 20px rgba(16, 17, 19, 0.14)); }
.gi-hero h3 { margin-top: 10px; max-width: 320px; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; }
.gi-hero p { margin-top: 6px; max-width: 320px; font-size: 0.9375rem; line-height: 1.5; color: var(--text-2); }
.gi-code {
  position: relative;
  width: 100%;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  display: grid;
  place-items: center;
  font: 700 1.625rem/1 "Inter", sans-serif;
  letter-spacing: 0.1em;
  color: var(--text);
  cursor: pointer;
}
.gi-copy { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--text-2); }
.gi-copy svg { width: 22px; height: 22px; }
.gi-actions { display: grid; gap: 10px; margin-top: 14px; }
.gi-reset {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  margin-top: 12px;
  padding: 0 14px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--error);
  cursor: pointer;
}
.gi-reset svg { width: 17px; height: 17px; stroke-width: 2; }
.gi-note { text-align: center; font-size: 0.8125rem; line-height: 1.45; color: var(--text-3); }

/* ---------- Create / edit sheet ---------- */

.gf-panel { gap: 16px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
/* The New group form is long, so it's a full slide-up sheet (edge to edge, rounded top) rather
   than the floating panel the smaller group sheets use. */
#group-form-sheet, #group-join-sheet, #group-activity-sheet, #group-log-sheet { padding: 0; }
#group-form-sheet .goal-panel, #group-join-sheet .goal-panel, #group-activity-sheet .goal-panel, #group-log-sheet .goal-panel {
  width: min(560px, 100%);
  max-height: calc(100% - 44px - env(safe-area-inset-top));
  border: 0;
  border-radius: 28px 28px 0 0;
  background: #fff;
  box-shadow: none;
  padding-top: 12px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
/* New group and New activity are long: full height. Join and Log fit their content. */
#group-form-sheet .goal-panel, #group-activity-sheet .goal-panel { height: calc(100% - 44px - env(safe-area-inset-top)); }
@media (min-width: 700px) {
  #group-form-sheet, #group-join-sheet, #group-activity-sheet, #group-log-sheet { align-items: center; }
  #group-form-sheet .goal-panel, #group-join-sheet .goal-panel, #group-activity-sheet .goal-panel, #group-log-sheet .goal-panel { border-radius: 28px; }
  #group-form-sheet .goal-panel, #group-activity-sheet .goal-panel { height: min(820px, calc(100% - 64px)); }
}
.gf-panel > *, .gj-panel > * { flex-shrink: 0; } /* the panel scrolls; its rows keep their size */
.gf-preview { display: grid; place-items: center; margin: 2px 0 -4px; }
.gf-big { width: 88px; height: 88px; border-radius: 27px; box-shadow: 0 12px 26px rgba(16, 17, 19, 0.13); animation: cover-pop 0.4s cubic-bezier(0.3, 1.4, 0.5, 1); }
.gf-big img { width: 62px; height: 62px; }
@keyframes cover-pop { from { transform: scale(0.8) rotate(-6deg); opacity: 0.4; } }
.gf-covers { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; padding: 4px 2px; }
.gf-cover { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 14px; background: none; cursor: pointer; transition: transform 0.15s; }
.gf-cover:active { transform: scale(0.92); }
.gf-cover .gcover { width: 100%; height: 100%; border-radius: 14px; }
.gf-cover .gcover img { width: 72%; height: 72%; }
.gf-cover[aria-checked="true"]::after { content: ""; position: absolute; inset: -3.5px; border-radius: 17px; border: 2px solid var(--imessage-blue); }
.gf-desc { min-height: 76px; }
.gf-sec { display: flex; flex-direction: column; gap: 10px; }
.gf-label { margin: 4px 6px -2px; font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.gf-label span { font-weight: 400; color: var(--text-3); }
.gf-select { position: relative; display: block; min-width: 0; }
.gf-select select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 52px;
  padding: 0 44px 0 18px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: var(--pill);
  font: inherit;
  font-size: 1.0625rem;
  color: var(--text);
  outline: 0;
  cursor: pointer;
}
.gf-select select:focus { background: #fff; border-color: var(--border); }
.gf-select::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.gf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gf-time { padding: 0 12px; text-align: center; }
.gf-time:disabled { opacity: 0.4; }
.gf-help { margin: -2px 8px 0; font-size: 0.8125rem; line-height: 1.45; color: var(--text-2); }
.gseg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--pill); transition: opacity 0.2s; }
.gseg button {
  position: relative;
  z-index: 1;
  height: 42px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s;
}
.gseg button[aria-checked="true"] { color: var(--text); font-weight: 600; }
.gseg-ind {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(16, 17, 19, 0.1);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 0.28s cubic-bezier(0.3, 0.8, 0.25, 1);
}
.gseg.off { opacity: 0.4; pointer-events: none; }
.gseg.n3 { grid-template-columns: repeat(3, 1fr); }
.gseg.n3 .gseg-ind { width: calc((100% - 8px) / 3); }

/* Step one: what kind of group. A grid of tiles, four to a row, that fits the sheet. */
.gf-kind { margin-top: -4px; }
.gf-types {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 2px 0 4px;
}
.gf-types::-webkit-scrollbar { display: none; }
.gf-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px 9px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.gf-type:active { transform: scale(0.96); }
.gf-type[aria-checked="true"] { border-color: var(--imessage-blue); background: #f2f7ff; box-shadow: inset 0 0 0 1px var(--imessage-blue); }
.gf-type-art {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: radial-gradient(90% 80% at 28% 18%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 60%), linear-gradient(150deg, var(--c1), var(--c2));
}
.gf-type-art img { width: 30px; height: 30px; filter: drop-shadow(0 3px 4px rgba(16, 17, 19, 0.16)); }
.gf-type-label {
  display: flex;
  align-items: center;
  min-height: 2.3em;
  max-width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  color: var(--text-2);
}
.gf-type-label::before { content: ""; } /* keeps one-line labels centered in the two-line box */
.gf-type-label > span, .gf-type-label { overflow: hidden; }
.gf-type { justify-content: flex-start; }
.gf-type[aria-checked="true"] .gf-type-label { color: var(--imessage-blue); }
.gf-submit {
  flex: none;
  height: 54px;
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--imessage-blue);
  color: #fff;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.gf-submit:disabled { opacity: 0.35; cursor: default; }
.gf-submit:not(:disabled):active { transform: scale(0.98); }
.gf-fine { margin-top: -4px; text-align: center; font-size: 0.8125rem; color: var(--text-3); }
.gf-fine a { color: var(--text-2); }

/* ---------- Join with a code ---------- */

.gj-panel { gap: 14px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.gj-art { align-self: center; width: 96px; height: 96px; margin-top: 2px; filter: drop-shadow(0 12px 18px rgba(16, 17, 19, 0.14)); }
.gj-note { margin: -2px 16px 4px; text-align: center; font-size: 0.9375rem; line-height: 1.5; color: var(--text-2); }
.gj-code {
  width: 100%;
  height: 62px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--pill);
  text-align: center;
  font: 700 1.5rem/1 "Inter", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  outline: 0;
  transition: background 0.15s, border-color 0.15s;
}
.gj-code::placeholder { color: #c9c9ce; }
.gj-code:focus { background: #fff; border-color: var(--imessage-blue); }
.gj-error { margin-top: -4px; text-align: center; font-size: 0.875rem; font-weight: 500; color: var(--error); }

/* ---------- Activities ---------- */

.gact { padding: 6px 16px 40px; }
.gact-h { margin: 22px 2px 8px; }

/* "This week": tinted with the group's cover */
.gwk {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 16px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 55%),
    linear-gradient(155deg, #fff 0%, var(--c1) 55%, var(--c2) 150%);
  box-shadow: inset 0 0 0 1px rgba(16, 17, 19, 0.06);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c3) 14%, transparent);
}
.gwk-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c3); }
.gwk-big { margin-top: 4px; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.gwk-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 26px; }
.gwk-faces { display: flex; padding-left: 4px; }
.gwk-faces .gav { width: 26px; height: 26px; margin-left: -4px; font-size: 0.5625rem; box-shadow: 0 0 0 2px #fff; }
.gwk-streak { display: inline-flex; align-items: center; gap: 4px; font-size: 0.875rem; font-weight: 600; color: var(--c3); }
.gwk-streak svg { width: 16px; height: 16px; stroke-width: 2.2; }
.gwk-streak.quiet { font-weight: 500; color: #53607a; }
.gwk-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.gwk-log {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 17, 19, 0.08);
  transition: transform 0.15s;
}
.gwk-log:active { transform: scale(0.97); }
.gwk-log svg { width: 18px; height: 18px; stroke-width: 2.2; color: var(--c3); }
.gwk-me { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8125rem; font-weight: 600; color: var(--c3); }
.gwk-me svg { width: 15px; height: 15px; stroke-width: 2.6; }

/* An activity card */
.gact-card {
  padding: 14px 14px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(16, 17, 19, 0.04);
}
.gact-card + .gact-card { margin-top: 10px; }
.gact-card.live { border-color: #cfe4c7; background: linear-gradient(165deg, #f3fbef, #fff 60%); }
.gact-card.fresh { animation: grp-in 0.35s ease both; animation-delay: calc(var(--i, 0) * 30ms); }
.gact-top { display: flex; align-items: flex-start; gap: 12px; }
.gact-date {
  flex: none;
  width: 48px;
  height: 52px;
  border-radius: 14px;
  background: var(--pill);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.gact-date small { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.gact-date b { margin-top: 3px; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.gact-card.live .gact-date { background: #e2f3da; }
.gact-card.live .gact-date small, .gact-card.live .gact-date b { color: #2c7a2a; }
.gact-text { flex: 1; min-width: 0; }
.gact-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.gact-title strong { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: anywhere; }
.gact-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px 0 6px; border-radius: 999px; background: var(--pill); font-size: 0.6875rem; font-weight: 700; color: var(--text-2); }
.gact-tag svg { width: 12px; height: 12px; stroke-width: 2.2; }
.gact-when { display: block; margin-top: 3px; font-size: 0.9375rem; font-weight: 500; color: var(--text); }
.gact-card.live .gact-when { color: #2c7a2a; }
.gact-loc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  margin: 4px 0 0 -4px;
  padding: 2px 6px 2px 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--imessage-blue);
  cursor: pointer;
  text-align: left;
}
.gact-loc:active { background: #eef4ff; }
.gact-loc svg { flex: none; width: 16px; height: 16px; }
.gact-loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gact-notes { margin-top: 5px; font-size: 0.875rem; line-height: 1.4; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.gact-more { flex: none; width: 32px; height: 36px; margin: -6px -8px 0 0; }
.gact-more svg { width: 18px; height: 18px; }
.gact-who { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.8125rem; color: var(--text-2); }
.gact-faces { display: flex; padding-left: 4px; }
.gact-faces .gav { width: 24px; height: 24px; margin-left: -4px; font-size: 0.5rem; box-shadow: 0 0 0 2px #fff; }
.grsvp { margin-top: 10px; }
.grsvp button { height: 38px; font-size: 0.875rem; }
.grsvp.none .gseg-ind { opacity: 0; }
.grsvp.is-going .gseg-ind { background: var(--imessage-blue); }
.grsvp.is-going button[aria-checked="true"] { color: #fff; }
.grsvp.is-maybe .gseg-ind { background: #ffe9b8; }
.grsvp.is-maybe button[aria-checked="true"] { color: #8a5a06; }
.grsvp.is-no button[aria-checked="true"] { color: var(--text-2); }
.gact-there { height: 46px; margin-top: 12px; font-size: 1rem; }
.gact-there.done { background: #e6f6ec; color: #16833f; opacity: 1; }
.gact-there:disabled { cursor: default; }

.gact-empty { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 16px 10px; text-align: center; }
.gact-empty img { width: 72px; height: 72px; margin-bottom: 8px; filter: drop-shadow(0 10px 14px rgba(16, 17, 19, 0.14)); }
.gact-empty strong { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }
.gact-empty span { font-size: 0.875rem; color: var(--text-2); }
.gact-add { min-height: 56px; margin-top: 2px; }
.gact-add .gadd-icon { width: 48px; height: 44px; border-radius: 14px; background: #eef4ff; color: var(--imessage-blue); }

.gact-pastbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: 18px;
  padding: 0 2px;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.gact-pastbtn small { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--pill); font-size: 0.75rem; font-weight: 700; }
.gact-pastbtn svg { width: 18px; height: 18px; margin-left: auto; stroke-width: 2.2; }
.gact-past { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.gact-past .gact-date { width: 44px; height: 46px; opacity: 0.75; }
.gact-past-text { flex: 1; min-width: 0; }
.gact-past-text strong { display: block; font-size: 0.9375rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gact-past-text small { display: block; margin-top: 1px; font-size: 0.8125rem; color: var(--text-3); }
.gact-went { flex: none; color: #16833f; }
.gact-went svg { width: 20px; height: 20px; stroke-width: 2; }

/* ---------- Add an activity / Log an activity sheets ---------- */

.ga-notes { min-height: 72px; }
.gl-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gl-kind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 9px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.gl-kind:active { transform: scale(0.96); }
.gl-kind img { width: 36px; height: 36px; filter: drop-shadow(0 4px 5px rgba(16, 17, 19, 0.16)); }
.gl-kind[aria-checked="true"] { border-color: var(--imessage-blue); background: #f2f7ff; color: var(--imessage-blue); box-shadow: inset 0 0 0 1px var(--imessage-blue); }
.gl-row { grid-template-columns: 1fr 1.4fr; align-items: center; }
.gl-amount { -moz-appearance: textfield; }
.gl-amount::-webkit-inner-spin-button, .gl-amount::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.gl-help { min-height: 1.45em; }

@media (min-width: 700px) {
  .gnext-rail { flex-wrap: wrap; overflow: visible; margin: 4px 0 14px; padding: 4px 0 8px; }
  .gnext-rail.multi .gnext { flex-basis: calc(50% - 6px); }
}
@media (prefers-reduced-motion: reduce) {
  .fresh, .gempty, .gempty-art img, .gi-hero, .gs-empty, .gf-big, .gd-join.just svg, .gread-btn.just svg, .gpray.pop svg { animation: none !important; }
  .gbar i, .gseg-ind, .gs-mini { transition: none; }
}
