/* Group-owned surfaces only; the shared social widget keeps its own controls. */
body.obx-groups-page {
  margin: 0;
  background: #f5f7fb;
  color: #17212c;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.obx-groups-page:has(dialog.grp-dialog[open]) { overflow: hidden; }

:where(.grp-shell, .grp-dialog) {
  --grp-ink: #17212c;
  --grp-muted: #657184;
  --grp-line: #e0e6ef;
  --grp-soft: #f5f7fb;
  --grp-accent: #1767ef;
  --grp-accent-hover: #1056cd;
  --grp-focus: #8bb6ff;
  --grp-danger: #b33b47;
  color: var(--grp-ink);
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  color-scheme: light;
}

:where(.grp-shell, .grp-dialog),
:where(.grp-shell, .grp-dialog) *,
:where(.grp-shell, .grp-dialog) *::before,
:where(.grp-shell, .grp-dialog) *::after { box-sizing: border-box; }

.grp-shell[hidden], .grp-dialog[hidden],
.grp-shell [hidden], .grp-dialog [hidden] { display: none !important; }

main#obxGroups.grp-shell {
  width: min(1328px, calc(100% - 72px));
  max-width: 1328px;
  min-height: 60vh;
  margin: 0 auto;
  padding: 32px 0 72px;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

:where(.grp-shell, .grp-dialog) :is(h1, h2, h3, p) { margin: 0; letter-spacing: 0; }
:where(.grp-shell, .grp-dialog) :is(h1, h2, h3) { color: var(--grp-ink); }
:where(.grp-shell, .grp-dialog) h2 { font-size: 22px; font-weight: 700; line-height: 1.3; }
:where(.grp-shell, .grp-dialog) h3 { font-size: 17px; font-weight: 700; line-height: 1.4; }
:where(.grp-shell, .grp-dialog) a { text-underline-offset: 3px; }
:where(.grp-shell, .grp-dialog) :is(button, input, select, textarea) { font: inherit; letter-spacing: 0; }
:where(.grp-shell, .grp-dialog) :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--grp-focus);
  outline-offset: 3px;
}

:where(.grp-btn, .grp-iconbutton, .grp-tabs, .grp-search, .grp-categories,
  .grp-card-meta, .grp-upload, .grp-row-actions, .grp-status, .grp-empty, .grp-back) svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.grp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 28px;
}

.grp-head > div { min-width: 0; }
.grp-head h1 { font-size: 32px; font-weight: 900; line-height: 1.15; }
.grp-heading-identity { display: flex; align-items: center; gap: 14px; }
.grp-heading-identity > div { min-width: 0; }
.grp-heading-identity .obx-feature-icon { display: block; width: 54px; height: 54px; flex: 0 0 54px; }
.grp-heading-identity .obx-feature-icon svg { display: block; width: 100%; height: 100%; }
.grp-shell:has(#grpDetail) .grp-head { margin-bottom: 20px; }
.grp-head p:not(.grp-eyebrow) { max-width: 640px; margin-top: 8px; color: var(--grp-muted); }
.grp-eyebrow { display: block; margin-bottom: 5px; color: var(--grp-muted); font-size: 12px; font-weight: 600; }

.grp-btn, .grp-iconbutton {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--grp-line);
  border-radius: 999px;
  background: #fff;
  color: var(--grp-ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.grp-btn.grp-primary { border-color: var(--grp-accent); background: var(--grp-accent); color: #fff; }
.grp-btn.grp-danger { border-color: #f0d6db; background: #fff4f5; color: var(--grp-danger); }
.grp-btn.grp-quiet, .grp-iconbutton.grp-quiet { border-color: transparent; background: transparent; color: var(--grp-muted); }
.grp-iconbutton {
  width: 44px;
  min-width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border-radius: 50%;
}

:is(.grp-btn, .grp-iconbutton, .grp-tabs button, .grp-categories button):is(:disabled, [aria-disabled="true"]) {
  opacity: .5;
  cursor: not-allowed;
}

:is(.grp-btn, .grp-iconbutton)[aria-busy="true"] { cursor: progress; }
.grp-btn > span { min-width: 0; }

.grp-actions, .grp-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.grp-actions > *, .grp-row-actions > * { max-width: 100%; }
.grp-directory-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 480px); align-items: center; gap: 24px; margin-bottom: 24px; }
.grp-directory-tools .grp-tabs, .grp-directory-tools .grp-search { margin-bottom: 0; }

.grp-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 20px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: #eaf0f7;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.grp-tabs button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--grp-muted);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.grp-tabs button[aria-selected="true"] { background: #fff; color: var(--grp-accent); box-shadow: 0 1px 5px #17212c0d; }
.grp-tabs button:focus-visible { outline-offset: -3px; }
.grp-tabs button.grp-iconbutton { width: 40px; height: 40px; min-height: 40px; flex: 0 0 40px; margin-left: auto; padding: 0; border: 0; border-radius: 50%; align-self: center; }

.grp-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin-bottom: 12px;
  padding: 0 18px;
  border: 1px solid var(--grp-line);
  border-radius: 999px;
  background: #fff;
  color: var(--grp-muted);
  cursor: text;
}

.grp-search label { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.grp-search input {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--grp-ink);
  font-size: 14px;
}

.grp-search:focus-within { border-color: var(--grp-accent); outline: 3px solid var(--grp-focus); outline-offset: 3px; }
.grp-search input:focus-visible { outline: none; }
.grp-search input::placeholder { color: var(--grp-muted); opacity: 1; }
.grp-search:has(input:disabled) { background: var(--grp-soft); color: var(--grp-muted); cursor: not-allowed; }
.grp-search input:disabled { cursor: not-allowed; }

.grp-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.grp-categories button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #fff;
  color: var(--grp-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.grp-categories button[aria-pressed="true"] { border-color: #bfd4fb; background: #eaf2ff; color: var(--grp-accent); }

/* Directory motifs use the same server-rendered feature icons as the navigation. */
#grpCategories { flex-wrap: nowrap; gap: 16px; padding: 0 0 18px; margin-bottom: 24px; border-bottom: 1px solid var(--grp-line); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
#grpCategories button { flex: 0 0 104px; flex-direction: column; gap: 10px; justify-content: flex-start; min-width: 0; padding: 9px 4px 12px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; font-size: 12px; }
#grpCategories button[aria-pressed="true"] { color: var(--grp-accent); border-bottom-color: var(--grp-accent); background: transparent; }
#grpCategories .obx-feature-icon { display: block; width: 54px; height: 54px; flex: 0 0 54px; }
#grpCategories .obx-feature-icon svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 5px #17212c12); }
#grpCategories button > span:last-child { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }

.grp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; align-items: stretch; }
.grp-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* The content link is a real wrapper, never an overlay over the join action. */
.grp-card-link { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.grp-card-link:focus-visible { outline-offset: -3px; }
.grp-cover, .grp-preview-cover, .grp-detail-cover {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: 16 / 10;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--grp-cover-bg, #e8edf4);
  color: var(--grp-cover-ink, #5d708a);
}

:where(.grp-shell, .grp-dialog) .tone-0 { --grp-cover-bg: #e8edf8; --grp-cover-ink: #5d708a; }
:where(.grp-shell, .grp-dialog) .tone-1 { --grp-cover-bg: #e9eef7; --grp-cover-ink: #56718f; }
:where(.grp-shell, .grp-dialog) .tone-2 { --grp-cover-bg: #f5e8ef; --grp-cover-ink: #8e5874; }
:where(.grp-shell, .grp-dialog) .tone-3 { --grp-cover-bg: #eeebf8; --grp-cover-ink: #74648e; }
:where(.grp-shell, .grp-dialog) .tone-4 { --grp-cover-bg: #e8f1f6; --grp-cover-ink: #4e7182; }

:is(.grp-cover, .grp-preview-cover, .grp-detail-cover) img {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

img.grp-cover, img.grp-preview-cover, img.grp-detail-cover { object-fit: cover; }
.grp-monogram { display: grid; place-items: center; width: 100%; height: 100%; padding: 16px; font-size: 36px; font-weight: 750; line-height: 1.1; text-align: center; }
.grp-monogram[class*="tone-"] { background: var(--grp-cover-bg); color: var(--grp-cover-ink); }
.grp-card-body { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 16px 0 14px; }
.grp-card-title, .grp-card-title h2, .grp-card-body h2 { min-width: 0; font-size: 19px; font-weight: 750; line-height: 1.35; }
.grp-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-width: 0; color: var(--grp-muted); font-size: 12px; }
.grp-card-meta > span { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.grp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf1f7;
  color: var(--grp-muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.grp-badge.grp-member { background: #eaf2ff; color: #1767ef; }
.grp-badge.grp-pending { background: #faf3dd; color: #78611d; }
.grp-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--grp-muted); font-size: 14px; line-height: 1.55; }
.grp-card > .grp-btn { align-self: flex-start; margin: 0; }
.grp-card > .grp-actions { margin: 0; }
.grp-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 44px; padding: 0; margin-top: auto; }

.grp-status { color: var(--grp-muted); font-size: 13px; font-weight: 400; line-height: 1.5; }
#grpCount.grp-status { margin: 0 0 14px; }
.grp-disclosure { margin-block: 6px; color: var(--grp-muted); font-size: 11px; font-weight: 500; line-height: 1.45; }
.grp-error, .grp-notice, .grp-form-error {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-width: 0;
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 3px solid #a9b6c0;
  background: var(--grp-soft);
  color: #52616d;
  font-size: 14px;
}

.grp-error, .grp-form-error { border-color: #bd5552; background: #fff4f3; color: #953f3b; }
.grp-notice { border-color: #1767ef; background: #eaf2ff; color: #245391; }
:is(.grp-status, .grp-error, .grp-notice, .grp-form-error):empty { display: none; }
:is(.grp-error, .grp-notice) > :is(p, div) { flex: 1 1 220px; min-width: 0; }
.grp-form .grp-form-error { margin: 0; }
.grp-error > :is(button, .grp-btn) { margin-left: auto; }
.grp-error > button:not(.grp-btn) { min-height: 44px; max-width: 100%; padding: 8px 16px; border: 0; border-radius: 999px; background: #fff; color: inherit; font-weight: 650; cursor: pointer; }
.grp-empty { grid-column: 1 / -1; padding: 36px 0; color: var(--grp-muted); }
.grp-empty h2 { margin-bottom: 8px; font-size: 21px; }
.grp-empty .grp-actions, .grp-empty > .grp-btn { margin-top: 18px; }
.grp-grid > :is(.grp-status, .grp-error, .grp-notice) { grid-column: 1 / -1; }
.grp-skeleton { min-height: 292px; border: 0; border-radius: 8px; background: #e8edf4; animation: grp-skeleton-pulse 1.8s ease-in-out infinite; }
.grp-skeleton .grp-cover { background: #e5eaee; }
.grp-skeleton :is(.grp-card-title, .grp-description) { min-height: 18px; border-radius: 4px; background: #e5eaee; }
@keyframes grp-skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

#grpDetail { min-width: 0; }
.grp-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 12px; color: var(--grp-accent-hover); font-size: 13px; font-weight: 600; text-decoration: none; }
.grp-detail-cover { height: 210px; aspect-ratio: auto; border-radius: 8px 8px 0 0; }
.grp-detail-cover .grp-monogram { font-size: 48px; }
.grp-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 24px;
  border-bottom: 1px solid var(--grp-line);
  background: #fff;
}

.grp-detail-heading > div:not(.grp-actions) { flex: 1 1 320px; min-width: 0; }
.grp-detail-heading h2 { font-size: 28px; font-weight: 800; line-height: 1.25; }
.grp-detail-heading .grp-card-meta { margin-top: 10px; font-size: 13px; }
.grp-detail-heading .grp-status { margin-top: 8px; }
.grp-detail-heading .grp-actions { padding-top: 2px; }
#grpDetail > .grp-tabs { margin-top: 20px; }
.grp-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 32px; padding-top: 24px; }
.grp-detail-layout > * { min-width: 0; }
.grp-about { min-width: 0; padding: 0 0 22px; border-bottom: 1px solid var(--grp-line); background: transparent; }
.grp-about :is(h2, h3) { margin-bottom: 12px; font-size: 18px; }
.grp-about p { color: var(--grp-muted); white-space: pre-wrap; }
.grp-about p + p { margin-top: 12px; }
.grp-about :is(ul, dl) { margin: 16px 0 0; }
.grp-about ul { padding-left: 20px; }
.grp-about dt { margin-top: 12px; color: var(--grp-muted); font-size: 12px; }
.grp-about dd { margin: 3px 0 0; }
.grp-about a, .grp-post-body a { color: var(--grp-accent-hover); }
.grp-about > .grp-badge { margin-top: 14px; }
.grp-stream { display: grid; align-content: start; gap: 16px; min-width: 0; }
.grp-stream-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; min-width: 0; }
.grp-stream-head h3 { font-size: 17px; }
.grp-post { min-width: 0; padding: 22px; border: 0; border-radius: 8px; background: #fff; scroll-margin-top: 110px; }
.grp-post-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.grp-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border-radius: 50%;
  background: #edf1f7;
  color: var(--grp-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  object-fit: cover;
}

.grp-avatar img { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; }
.grp-avatar > span { display: grid; place-items: center; width: 100%; height: 100%; }
.grp-post-head > div:not(.grp-avatar) { min-width: 0; flex: 1; }
.grp-post-head :is(h3, strong) { display: block; font-size: 14px; line-height: 1.4; }
.grp-post-head :is(time, small) { display: block; color: var(--grp-muted); font-size: 12px; }
.grp-post-head > :is(.grp-iconbutton, .grp-actions) { margin-left: auto; flex: 0 0 auto; }
.grp-post-body { margin-top: 12px; padding: var(--grp-body-padding, 0); border-radius: 6px; background: var(--grp-body-bg, transparent); color: var(--grp-body-ink, inherit); white-space: pre-wrap; overflow-wrap: anywhere; }
.grp-post-body p + p { margin-top: 12px; }
.grp-post-body[data-background="midnight"] a, .grp-post[data-background="midnight"] .grp-post-body a { color: #a9e4eb; }
.grp-post > [data-social-post] { margin-top: 14px; }
.grp-post-media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; margin-top: 14px; }
.grp-post-media:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
.grp-post-media > * { min-width: 0; margin: 0; }
.grp-post-media > :is(a, figure) { display: grid; align-content: center; }
.grp-post-media :is(img, video) { display: block; width: 100%; max-width: 100%; height: auto; max-height: 480px; border-radius: 6px; background: var(--grp-soft); object-fit: contain; }

.grp-members { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.grp-member-row, .grp-review-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; padding: 14px 0; border-bottom: 1px solid var(--grp-line); }
.grp-member-row:last-child, .grp-review-row:last-child { border-bottom: 0; }
:is(.grp-member-row, .grp-review-row) > div:not(.grp-avatar):not(.grp-row-actions):not(.grp-actions) { flex: 1 1 140px; min-width: 0; }
:is(.grp-member-row, .grp-review-row) :is(strong, h3) { font-size: 14px; line-height: 1.4; }
:is(.grp-member-row, .grp-review-row) small { display: block; margin-top: 3px; color: var(--grp-muted); font-size: 12px; }
:is(.grp-member-row, .grp-review-row) .grp-status { display: block; margin-top: 3px; }
.grp-members > h3 { margin-bottom: 8px; }
.grp-members > h3 .grp-status { margin-left: 8px; }
:is(.grp-member-row, .grp-review-row) .grp-row-actions { margin-left: auto; }
.grp-review-row p { margin-top: 6px; color: var(--grp-muted); font-size: 14px; white-space: pre-wrap; }
.grp-management { display: grid; align-content: start; gap: 20px; min-width: 0; padding: 0; border: 0; }
#grpPanel:has(> .grp-management), #grpPanel:has(> .grp-members) { padding: 24px; background: #fff; }
.grp-management .grp-categories { padding-bottom: 16px; border-bottom: 1px solid var(--grp-line); }
.grp-management .grp-categories button { background: #f0f3f8; }
.grp-management .grp-categories button[aria-pressed="true"] { background: #eaf2ff; color: var(--grp-accent); }
.grp-review-post .grp-post { padding: 0; border-radius: 0; }
.grp-management h2 { font-size: 20px; }
.grp-management > .grp-categories { margin-bottom: 0; }
.grp-management > section + section { padding-top: 20px; border-top: 1px solid var(--grp-line); }
.grp-review-list { display: grid; gap: 0; min-width: 0; margin: 0; padding: 0; list-style: none; }
.grp-review-post { display: grid; gap: 12px; min-width: 0; padding-bottom: 22px; }
.grp-review-post + .grp-review-post { padding-top: 22px; border-top: 1px solid var(--grp-line); }
.grp-review-post > :is(.grp-actions, .grp-row-actions) { justify-content: flex-end; }
.grp-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 18px; min-width: 0; max-width: 760px; }
.grp-settings > :is(h2, h3, .grp-dialog-foot, .grp-actions, .grp-error, .grp-form-error, .grp-notice, .grp-choices, .grp-choicesfieldset, .grp-field:has(textarea)) { grid-column: 1 / -1; }
.grp-settings label:has(input[type="checkbox"]) { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 10px; min-height: 44px; padding: 10px 0; cursor: pointer; }
.grp-settings > label:has(input[type="checkbox"]) { grid-column: 1 / -1; }
.grp-settings input[type="checkbox"] { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--grp-accent); }
.grp-settings label:has(input[type="checkbox"]:disabled) { opacity: .5; cursor: not-allowed; }
.grp-toggle { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 10px; min-width: 0; min-height: 44px; padding: 10px 0; color: #34444f; font-size: 14px; cursor: pointer; }
.grp-toggle input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--grp-accent); }
.grp-toggle > span { min-width: 0; }
.grp-toggle:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.grp-toggle small { display: block; color: var(--grp-muted); font-size: 12px; }
.grp-danger-zone { display: grid; justify-items: start; gap: 12px; max-width: 760px; margin-top: 28px; padding-top: 22px; border-top: 1px solid #e5bfbd; }
.grp-danger-zone h3 { color: var(--grp-danger); }
.grp-danger-zone p { color: var(--grp-muted); font-size: 14px; }

/* Only the body scrolls; the native dialog retains focus and backdrop behavior. */
dialog.grp-dialog {
  position: fixed;
  inset: 0;
  width: 960px;
  max-width: calc(100% - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--grp-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 70px #17212c26;
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog.grp-dialog[open] { display: flex; flex-direction: column; }
dialog.grp-dialog:not([open]) { display: none; }
dialog.grp-dialog.grp-small { width: 560px; }
dialog.grp-dialog::backdrop { background: #17212c66; }
.grp-dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 18px 24px;
  border-bottom: 1px solid var(--grp-line);
  background: #fff;
}

.grp-dialog-head h2 { min-width: 0; font-size: 22px; font-weight: 800; }
#grpDialogBody.grp-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 112px);
  max-height: calc(100dvh - 112px);
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-block: 16px 88px;
}

.grp-wizard { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 28px; min-width: 0; }
.grp-wizard > * { min-width: 0; }
.grp-form { display: grid; gap: 18px; min-width: 0; margin: 0; }
.grp-form > h3 { margin-bottom: 2px; }
.grp-field { display: grid; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
label.grp-field, .grp-field > :is(label, legend, span) { color: #34444f; font-size: 13px; font-weight: 650; }
.grp-field > legend { margin-bottom: 7px; }
.grp-field :is(input:not(:where([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])), select, textarea),
.grp-composer textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f0f3f8;
  color: var(--grp-ink);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.grp-field select { padding-right: 28px; text-overflow: ellipsis; }
.grp-field textarea, .grp-composer textarea { min-height: 132px; resize: vertical; }
.grp-field :is(input, textarea)::placeholder, .grp-composer textarea::placeholder { color: var(--grp-muted); opacity: 1; }
.grp-field :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--grp-danger); }
.grp-field :is(input, select, textarea):disabled, .grp-composer textarea:disabled { background: var(--grp-soft); color: var(--grp-muted); cursor: not-allowed; }
.grp-field small { color: var(--grp-muted); font-size: 12px; font-weight: 400; }
.grp-field :is(.grp-error, .grp-form-error) { margin: 0; }
.grp-choices, .grp-choicesfieldset { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
:is(.grp-choices, .grp-choicesfieldset) legend { margin-bottom: 8px; color: #34444f; font-size: 13px; font-weight: 650; }
.grp-choice, .grp-choices label { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-content: start; align-items: start; gap: 10px; min-width: 0; min-height: 44px; padding: 14px 16px; border: 1px solid transparent; border-radius: 8px; background: #f5f7fb; color: var(--grp-ink); font-size: 14px; cursor: pointer; }
.grp-choice input, .grp-choices input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--grp-accent); }
:is(.grp-choice, .grp-choices label):has(input:checked) { border-color: #bfd4fb; background: #eaf2ff; }
:is(.grp-choice, .grp-choices label):has(input:focus-visible) { outline: 3px solid var(--grp-focus); outline-offset: 3px; }
:is(.grp-choice, .grp-choices label):has(input:disabled) { opacity: .5; cursor: not-allowed; }
.grp-choice small, .grp-choices small { display: block; grid-column: 2; color: var(--grp-muted); font-size: 12px; }
.grp-dialog-foot {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
  margin-top: 22px;
  padding: 16px 0 0;
  border-top: 1px solid var(--grp-line);
  background: #fff;
}

.grp-dialog > .grp-dialog-foot { margin: 0; padding: 16px 24px; }
.grp-wizard > .grp-dialog-foot { grid-column: 1 / -1; }
.grp-dialog-foot .grp-actions { margin-left: auto; }
.grp-dialog-foot > .grp-primary:last-child { margin-left: auto; }
.grp-step { color: var(--grp-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.grp-preview { position: sticky; top: 0; min-width: 0; }
.grp-preview > :is(h3, .grp-eyebrow) { margin-bottom: 10px; color: var(--grp-muted); font-size: 12px; font-weight: 650; }
.grp-preview-card { min-width: 0; border: 0; border-radius: 0; background: transparent; }
.grp-preview-cover { height: auto; }
:is(.grp-preview-card, .grp-preview .grp-card) :is(h2, h3) { font-size: 18px; line-height: 1.35; }
.grp-preview-card > :is(h2, h3, p, .grp-card-meta) { margin: 12px 16px; }

.grp-media-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.grp-media-list > * { position: relative; min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--grp-line); border-radius: 6px; background: var(--grp-soft); }
.grp-media-list :is(img, video) { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.grp-media-list .grp-iconbutton { position: absolute; top: 4px; right: 4px; z-index: 1; background: #fff; border-color: #d5dee4; color: #263641; }
.grp-media-list .grp-iconbutton:focus-visible { outline-offset: -3px; }
.grp-media-list figcaption { padding: 8px; color: var(--grp-muted); font-size: 12px; }
.grp-composer { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0 0 20px; border-bottom: 1px solid var(--grp-line); }
.grp-dialog .grp-composer { padding-bottom: 0; border-bottom: 0; }
.grp-composer .grp-actions { justify-content: flex-end; }
.grp-composer .grp-actions > .grp-upload { margin-right: auto; }
.grp-composer-body { min-width: 0; border: 1px solid transparent; border-radius: 12px; background: var(--grp-body-bg, #f0f3f8); color: var(--grp-body-ink, var(--grp-ink)); }
.grp-composer textarea.grp-composer-body, .grp-composer-body textarea { min-height: 168px; background: var(--grp-body-bg, #fff); color: var(--grp-body-ink, var(--grp-ink)); }
.grp-composer-body textarea { border: 0; }
.grp-composer textarea[data-background="none"] { background: #f0f3f8; }
.grp-composer-body textarea::placeholder, textarea.grp-composer-body::placeholder { color: inherit; opacity: .65; }
.grp-composer-body:has(textarea:focus-visible) { outline: 3px solid var(--grp-focus); outline-offset: 3px; }
.grp-composer-body textarea:focus-visible { outline: none; }
.grp-composer-body:has(textarea:disabled) { opacity: .65; cursor: not-allowed; }
.grp-composer textarea.grp-composer-body:disabled, .grp-composer-body textarea:disabled { background: var(--grp-body-bg, var(--grp-soft)); color: var(--grp-body-ink, var(--grp-muted)); cursor: not-allowed; }
.grp-composer-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; padding-block: 10px; border-block: 1px solid var(--grp-line); }
.grp-composer-tools > * { min-width: 0; max-width: 100%; }
.grp-composer-tools .grp-upload { margin-right: auto; }
.grp-attachment-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.grp-attachment { position: relative; min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--grp-line); border-radius: 6px; background: var(--grp-soft); }
.grp-attachment :is(img, video) { display: block; width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.grp-attachment video { object-fit: contain; }
.grp-attachment .grp-iconbutton { position: absolute; top: 4px; right: 4px; z-index: 1; background: #fff; color: #263641; }
.grp-attachment .grp-iconbutton:focus-visible { outline-offset: -3px; }
.grp-attachment figcaption { padding: 8px; color: var(--grp-muted); font-size: 12px; }
.grp-mention-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; max-height: 240px; min-width: 0; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; list-style: none; }
.grp-mention-list .grp-toggle { padding: 10px 8px; border-radius: 4px; }
.grp-mention-list .grp-toggle:has(input:checked) { background: #eaf2ff; }

/* Themes set tokens only: cards, headers, media, and social controls stay white. */
:where(.grp-post, .grp-post-body, .grp-composer, .grp-composer-body, .grp-swatch)[data-background="none"] { --grp-body-bg: #fff; --grp-body-ink: #17212c; --grp-body-padding: 0px; }
:where(.grp-post, .grp-post-body, .grp-composer, .grp-composer-body, .grp-swatch)[data-background="shoreline"] { --grp-body-bg: #e5f1f0; --grp-body-ink: #285653; --grp-body-padding: 18px; }
:where(.grp-post, .grp-post-body, .grp-composer, .grp-composer-body, .grp-swatch)[data-background="sunset"] { --grp-body-bg: #f9e5e2; --grp-body-ink: #773d3b; --grp-body-padding: 18px; }
:where(.grp-post, .grp-post-body, .grp-composer, .grp-composer-body, .grp-swatch)[data-background="dune"] { --grp-body-bg: #f3eedf; --grp-body-ink: #65572c; --grp-body-padding: 18px; }
:where(.grp-post, .grp-post-body, .grp-composer, .grp-composer-body, .grp-swatch)[data-background="tide"] { --grp-body-bg: #e6eef7; --grp-body-ink: #3b5678; --grp-body-padding: 18px; }
:where(.grp-post, .grp-post-body, .grp-composer, .grp-composer-body, .grp-swatch)[data-background="midnight"] { --grp-body-bg: #29333e; --grp-body-ink: #f5f7fa; --grp-body-padding: 18px; }
.grp-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; padding: 4px; }
.grp-swatch {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: #fff;
  color: var(--grp-ink);
  font-size: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.grp-swatch::before { content: ""; position: absolute; inset: 6px; border: 1px solid #b6c6cf; border-radius: 50%; background: var(--grp-body-bg, #fff); }
.grp-swatch[aria-pressed="true"] { border-color: var(--grp-ink); box-shadow: inset 0 0 0 1px var(--grp-ink); }
.grp-swatch:is(:disabled, [aria-disabled="true"]) { opacity: .5; cursor: not-allowed; }
.grp-upload { position: relative; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; max-width: 100%; color: var(--grp-accent-hover); font-size: 14px; font-weight: 650; }
label.grp-upload, .grp-upload label { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 10px 16px; border: 1px solid var(--grp-line); border-radius: 999px; background: #fff; cursor: pointer; }
.grp-upload input[type="file"], .grp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.grp-upload:focus-within { outline: 3px solid var(--grp-focus); outline-offset: 3px; }
.grp-upload:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.grp-upload:has(input:disabled) label { cursor: not-allowed; }

@media (hover: hover) {
  :is(.grp-btn, .grp-iconbutton):not(:disabled):not([aria-disabled="true"]):hover { background: #edf3ff; border-color: #c0d4f8; text-decoration: none; }
  .grp-btn.grp-primary:not(:disabled):not([aria-disabled="true"]):hover { background: var(--grp-accent-hover); border-color: var(--grp-accent-hover); }
  .grp-btn.grp-danger:not(:disabled):not([aria-disabled="true"]):hover { background: #fff1f0; border-color: #bd5552; }
  .grp-tabs button:not(:disabled):hover { color: var(--grp-accent-hover); }
  .grp-categories button:not(:disabled):hover { background: #eaf2ff; border-color: #bfd4fb; }
  #grpCategories button:not(:disabled):hover { background: transparent; color: var(--grp-accent); }
  .grp-card-link:hover { text-decoration: none; }
  .grp-card-link:hover :is(.grp-card-title, h2) { color: var(--grp-accent); }
  .grp-upload:not(:has(input:disabled)):hover { color: var(--grp-accent); }
  .grp-back:hover { text-decoration: underline; }
  .grp-swatch:not(:disabled):not([aria-disabled="true"]):hover { border-color: #7d929e; }
}

@media (max-width: 1000px) {
  .grp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grp-detail-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; }
  .grp-wizard { grid-template-columns: minmax(0, 1fr) 240px; gap: 22px; }
}

@media (max-width: 780px) {
  .grp-directory-tools { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grp-directory-tools .grp-tabs { width: 100%; }
  .grp-directory-tools .grp-tabs button { flex: 1; padding-inline: 10px; }
  .grp-detail-layout { grid-template-columns: minmax(0, 1fr); }
  .grp-detail-heading .grp-actions { width: 100%; }
  .grp-search input { font-size: 16px; }
}

@media (max-width: 720px) {
  .grp-wizard { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .grp-preview { position: static; order: -1; }
  .grp-preview-card, .grp-preview .grp-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; }
  .grp-preview-cover, .grp-preview .grp-cover { grid-column: 1; grid-row: 1 / span 10; align-self: stretch; width: 88px; height: 100%; min-height: 88px; }
  :is(.grp-preview-cover, .grp-preview .grp-cover) .grp-monogram { padding: 8px; font-size: 25px; }
  :is(.grp-preview-card, .grp-preview .grp-card) > :not(.grp-preview-cover):not(.grp-cover) { grid-column: 2; min-width: 0; }
  :is(.grp-preview-card, .grp-preview .grp-card) .grp-card-body { gap: 6px; padding: 12px; }
  :is(.grp-preview-card, .grp-preview .grp-card) :is(h2, h3) { font-size: 16px; }
  :is(.grp-preview-card, .grp-preview .grp-card) .grp-description { -webkit-line-clamp: 2; font-size: 12px; }
  .grp-preview-card > :is(h2, h3, p, .grp-card-meta) { margin: 8px 12px; }
}

@media (max-width: 600px) {
  main#obxGroups.grp-shell { width: calc(100% - 36px); padding-top: 24px; }
  .grp-head { gap: 12px; margin-bottom: 18px; }
  .grp-head h1 { font-size: 32px; }
  .grp-heading-identity { gap: 12px; }
  .grp-heading-identity .obx-feature-icon { width: 48px; height: 48px; flex-basis: 48px; }
  .grp-head > .grp-btn { width: 44px; flex: 0 0 44px; padding: 0; }
  .grp-head > .grp-btn span { display: none; }
  .grp-tabs { gap: 3px; margin-bottom: 16px; }
  .grp-tabs button { padding-inline: 13px; font-size: 13px; }
  .grp-categories { gap: 6px; margin-bottom: 18px; }
  .grp-categories button { padding-inline: 11px; }
  #grpCategories { gap: 8px; padding-bottom: 12px; margin-bottom: 20px; }
  #grpCategories button { flex-basis: 91px; font-size: 11px; }
  #grpCategories .obx-feature-icon { width: 48px; height: 48px; flex-basis: 48px; }
  .grp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .grp-cover { aspect-ratio: 4 / 3; }
  .grp-card-body { gap: 6px; padding-top: 12px; }
  .grp-card-body h2 { font-size: 15px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  .grp-card-meta { font-size: 11px; gap: 4px 8px; }
  .grp-description { font-size: 12px; }
  .grp-card-actions .grp-btn { padding: 9px 12px; font-size: 12px; }
  .grp-detail-cover { height: 160px; }
  .grp-detail-heading { gap: 14px; padding: 18px 16px; }
  .grp-detail-heading h2 { font-size: 24px; }
  .grp-detail-layout { padding-top: 20px; }
  .grp-post { padding: 14px; }
  .grp-post-media { gap: 6px; }
  .grp-settings { grid-template-columns: minmax(0, 1fr); }
  #grpPanel:has(> .grp-management), #grpPanel:has(> .grp-members) { padding: 18px 14px; }
  dialog.grp-dialog { max-width: calc(100% - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .grp-dialog-head { gap: 12px; padding: 12px 16px; }
  .grp-dialog-head h2 { font-size: 20px; }
  #grpDialogBody.grp-dialog-body { max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); padding: 16px; }
  .grp-dialog > .grp-dialog-foot { padding: 12px 16px; }
  .grp-dialog-foot { gap: 10px; }
  .grp-dialog-foot .grp-btn { padding-inline: 12px; }
  .grp-choices { grid-template-columns: minmax(0, 1fr); }
  .grp-media-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grp-attachment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grp-mention-list { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .grp-skeleton { animation: none; }
  .grp-btn, .grp-iconbutton { transition: none; }
  .grp-tabs, #grpDialogBody.grp-dialog-body { scroll-behavior: auto; }
}
