.cm-toast-stack {
    position: fixed;
    top: max(18px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
    z-index: 2147483000;
    display: grid;
    gap: 10px;
    width: min(420px, calc(100vw - 28px));
    pointer-events: none;
}

.cm-toast {
    position: relative;
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 54px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(24, 26, 39, 0.96);
    color: #f7f9ff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(18px);
    pointer-events: auto;
    transform-origin: top right;
    animation: cm-toast-in 180ms ease-out;
}

.cm-toast.is-leaving {
    animation: cm-toast-out 180ms ease-in forwards;
}

.cm-toast__bar {
    width: 4px;
    height: 100%;
    background: #2687ff;
}

.cm-toast__body {
    padding: 12px 0;
    color: #f7f9ff;
    font-weight: 850;
    line-height: 1.35;
}

.cm-toast__close {
    width: 34px;
    height: 34px;
    margin-right: 8px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: #d8e0ee;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.cm-toast__close:hover,
.cm-toast__close:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

.cm-toast-success .cm-toast__bar {
    background: #22c55e;
}

.cm-toast-error .cm-toast__bar,
.cm-toast-danger .cm-toast__bar {
    background: #ff4f6d;
}

.cm-toast-warning .cm-toast__bar {
    background: #f59e0b;
}

.cm-toast-info .cm-toast__bar,
.cm-toast-debug .cm-toast__bar {
    background: #38bdf8;
}

body.public-mode.color-mode-light .cm-toast,
.dashboard-shell.dashboard-light .cm-toast {
    background: rgba(255, 255, 255, 0.96);
    color: #172033;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

body.public-mode.color-mode-light .cm-toast__body,
.dashboard-shell.dashboard-light .cm-toast__body {
    color: #172033;
}

body.public-mode.color-mode-light .cm-toast__close,
.dashboard-shell.dashboard-light .cm-toast__close {
    color: #475569;
    background: rgba(15, 23, 42, 0.06);
}

@keyframes cm-toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cm-toast-out {
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
}

@media (max-width: 640px) {
    .cm-toast-stack {
        top: max(12px, env(safe-area-inset-top));
        right: 12px;
        left: 12px;
        width: auto;
    }
}

.cm-chip-select {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 42px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    background: #303142;
}

.cm-chip-select > div {
    display: contents;
}

.cm-chip-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    cursor: pointer;
    user-select: none;
}

.cm-chip-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cm-chip-option span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 4px;
    color: #dbe7f7;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1;
}

.cm-chip-option input:checked + span {
    color: #08224a;
    background: #eaf2ff;
    border-color: #8bbcff;
    box-shadow: 0 0 0 1px rgba(47, 130, 255, 0.18);
}

.cm-chip-option input:focus-visible + span {
    outline: 2px solid rgba(47, 130, 255, 0.75);
    outline-offset: 2px;
}

body.public-mode.color-mode-light .cm-chip-select,
.dashboard-shell.dashboard-light .cm-chip-select {
    background: #f3f6fb;
    border-color: rgba(17, 24, 39, 0.12);
}

body.public-mode.color-mode-light .cm-chip-option span,
.dashboard-shell.dashboard-light .cm-chip-option span {
    color: #243044;
    background: #ffffff;
    border-color: rgba(17, 24, 39, 0.12);
}

body.public-mode.color-mode-light .cm-chip-option input:checked + span,
.dashboard-shell.dashboard-light .cm-chip-option input:checked + span {
    color: #0c3d7c;
    background: #dcecff;
    border-color: #7bb6ff;
}

/* CMVIEWS public surface standard
   This layer owns shared spacing, mobile gutters and public surface density.
   Feature CSS can add local behavior, but should inherit these primitives. */
:root {
    --cm-public-max: 1240px;
    --cm-public-gutter: 24px;
    --cm-public-mobile-gutter: 12px;
    --cm-public-surface: #232433;
    --cm-public-surface-soft: #262736;
    --cm-public-line: rgba(255, 255, 255, 0.08);
    --cm-public-line-soft: rgba(255, 255, 255, 0.055);
    --cm-public-radius: 8px;
}

body.public-mode {
    overflow-x: hidden;
}

body.public-mode .public-shell {
    width: min(100%, var(--cm-public-max));
    max-width: var(--cm-public-max);
    margin-inline: auto;
    padding-inline: var(--cm-public-gutter);
}

body.public-mode .content-card {
    color: #f2f6fb;
    background: var(--cm-public-surface);
    border-color: var(--cm-public-line);
    box-shadow: none;
    transition: opacity 150ms ease, filter 150ms ease;
}

body.public-mode .content-card.is-cmview-loading {
    opacity: 0.62;
    filter: saturate(0.88);
    pointer-events: none;
}

body.public-mode .community-avatar,
body.public-mode .post-avatar,
body.public-mode .content-seo-avatar,
body.public-mode .public-avatar,
body.public-mode .public-dropdown-avatar,
body.public-mode .messages-contact-avatar,
body.public-mode .match-avatar,
body.public-mode .group-member-avatar,
body.public-mode .group-detail-avatar {
    position: relative;
    overflow: hidden;
}

body.public-mode .community-avatar > img,
body.public-mode .post-avatar > img,
body.public-mode .content-seo-avatar > img,
body.public-mode .public-avatar > img,
body.public-mode .public-dropdown-avatar > img,
body.public-mode .messages-contact-avatar > img,
body.public-mode .match-avatar > img,
body.public-mode .group-member-avatar > img,
body.public-mode .group-detail-avatar > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
    display: block;
}

body.public-mode.home-page .content-card,
body.public-mode.encounters-page .content-card,
body.public-mode.posts-page .content-card,
body.public-mode.auth-page .content-card,
body.public-mode.discover-page .content-card,
body.public-mode.profile-page.profile-surface-flat .content-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
    backdrop-filter: none;
}

body.public-mode .frontend-stack,
body.public-mode .encounter-layout,
body.public-mode .encounter-card,
body.public-mode .posts-shell,
body.public-mode .post-detail-shell,
body.public-mode .post-form-shell,
body.public-mode .groups-page,
body.public-mode .group-detail,
body.public-mode .browse-shell,
body.public-mode .two-column,
body.public-mode .frontend-toolbar,
body.public-mode .groups-heading,
body.public-mode .groups-actions {
    min-width: 0;
}

body.public-mode.encounters-page .frontend-stack {
    gap: 12px;
}

body.public-mode.encounters-page .home-spotlight-card {
    padding-inline: 0;
}

body.public-mode.encounters-page .home-encounters-card {
    padding: 0;
}

body.public-mode .encounter-photo .fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #f7f9ff;
    font-size: clamp(3.4rem, 18vw, 7rem);
    font-weight: 900;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(244, 63, 94, 0.34));
}

body.public-mode .community-panel,
body.public-mode .community-composer,
body.public-mode .post-card,
body.public-mode .group-card,
body.public-mode .group-detail-card,
body.public-mode .messages-shell,
body.public-mode .browse-card,
body.public-mode .swing-card {
    border-color: var(--cm-public-line);
}

@media (max-width: 860px) {
    body.public-mode .public-shell {
        width: 100%;
        max-width: 100%;
        padding-inline: var(--cm-public-mobile-gutter);
        padding-bottom: calc(var(--cm-mobile-nav-height, 64px) + 16px + env(safe-area-inset-bottom));
    }

    body.public-mode.auth-page .public-shell,
    body.public-mode.profile-page.profile-mobile-social_full_bleed .public-shell,
    body.public-mode.messages-page .public-shell {
        padding-inline: 0;
    }

    body.public-mode .content-card {
        width: 100%;
        min-width: 0;
    }

    body.public-mode .community-layout,
    body.public-mode .groups-grid,
    body.public-mode .browse-filtergrid,
    body.public-mode .swing-profile-layout,
    body.public-mode .two-column,
    body.public-mode .frontend-toolbar,
    body.public-mode .groups-heading,
    body.public-mode .groups-actions {
        min-width: 0;
    }

    body.public-mode .frontend-toolbar,
    body.public-mode .groups-heading {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
        gap: 16px;
    }

    body.public-mode .frontend-actions,
    body.public-mode .groups-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        min-width: 0;
    }

    body.public-mode .frontend-actions .btn,
    body.public-mode .groups-actions .btn,
    body.public-mode .groups-search,
    body.public-mode .groups-search input {
        width: 100%;
        min-width: 0;
    }

    body.public-mode .frontend-toolbar,
    body.public-mode .profile-panel,
    body.public-mode .connection-panel,
    body.public-mode .groups-page,
    body.public-mode .groups-heading,
    body.public-mode .group-card {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    body.public-mode:not(.auth-page):not(.profile-page):not(.messages-page) .content-card {
        padding: 0;
    }

    body.public-mode .groups-page,
    body.public-mode .frontend-stack {
        gap: 0;
    }

    body.public-mode .groups-heading,
    body.public-mode.encounters-page .home-spotlight-card,
    body.public-mode .posts-head,
    body.public-mode .browse-filterbar,
    body.public-mode .frontend-toolbar,
    body.public-mode .community-composer {
        padding-inline: 24px;
    }

    body.public-mode .groups-grid,
    body.public-mode .posts-list,
    body.public-mode .community-feed,
    body.public-mode .community-layout,
    body.public-mode .two-column {
        gap: 0;
    }

    body.public-mode .group-card,
    body.public-mode .post-card,
    body.public-mode .profile-panel,
    body.public-mode .connection-panel,
    body.public-mode.encounters-page .encounter-card,
    body.public-mode .community-panel,
    body.public-mode .community-composer {
        width: 100%;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    body.public-mode .group-card {
        display: block;
        overflow: visible;
        background: transparent;
    }

    body.public-mode .group-card-photo {
        position: relative;
        display: block;
        width: 100%;
        min-height: 0;
        aspect-ratio: 1 / 1.18;
        overflow: hidden;
    }

    body.public-mode .group-card-photo img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    body.public-mode .group-card-copy {
        position: relative;
        z-index: 1;
        display: grid;
        padding: 22px 24px 24px;
        background: transparent;
    }

    body.public-mode .community-panel,
    body.public-mode .community-composer,
    body.public-mode .post-card,
    body.public-mode .group-card,
    body.public-mode.encounters-page .encounter-card,
    body.public-mode .group-detail-card,
    body.public-mode .browse-card,
    body.public-mode .swing-card {
        border-color: var(--cm-public-line-soft);
    }

    body.public-mode:not(.profile-page) .content-card {
        border-radius: 0;
    }

    body.public-mode.encounters-page .home-encounters-card {
        padding: 0;
    }

    body.public-mode.encounters-page .encounter-layout {
        gap: 0;
    }

    body.public-mode.encounters-page .encounter-photo {
        min-height: 0;
        aspect-ratio: 0.82;
    }

    body.public-mode.encounters-page .encounter-panel,
    body.public-mode.encounters-page .encounter-cell,
    body.public-mode.encounters-page .match-row,
    body.public-mode.encounters-page .message-entry {
        border-left: 0;
        border-right: 0;
    }

    body.public-mode .content-seo-block--profiles .content-seo-item {
        align-items: center;
        gap: 14px;
        min-height: 72px;
        padding: 12px 16px;
    }

    body.public-mode .content-seo-block--profiles .content-seo-avatar {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
        border-radius: 14px;
        font-size: 1.1rem;
    }
}
.cm-error-page .content-card {
  overflow: hidden;
}

.cm-error-state {
  --cm-error-accent: var(--accent, #ef4770);
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: clamp(28px, 6vw, 76px);
  min-height: min(620px, calc(100dvh - 220px));
  padding: clamp(30px, 6vw, 78px);
  isolation: isolate;
}

.cm-error-state__visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
}

.cm-error-state__visual::before {
  content: "";
  position: absolute;
  width: min(86%, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--cm-error-accent) 20%, transparent), transparent 68%);
  filter: blur(4px);
  z-index: -1;
}

.cm-error-state__code {
  position: absolute;
  inset: 2px auto auto 50%;
  translate: -50% 0;
  color: color-mix(in srgb, currentColor 8%, transparent);
  font: 800 clamp(6.5rem, 15vw, 11rem)/1 var(--body-font, sans-serif);
  letter-spacing: -.09em;
  user-select: none;
}

.cm-error-state__illustration {
  width: min(100%, 390px);
  margin-top: 52px;
  overflow: visible;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cm-error-state__orbit { stroke: color-mix(in srgb, currentColor 14%, transparent); stroke-width: 2; stroke-dasharray: 7 10; }
.cm-error-state__route { stroke: var(--cm-error-accent); stroke-width: 4; stroke-dasharray: 5 10; }
.cm-error-state__pin-ring { fill: color-mix(in srgb, var(--cm-error-accent) 15%, transparent); stroke: var(--cm-error-accent); stroke-width: 3; }
.cm-error-state__pin-core { fill: var(--cm-error-accent); }
.cm-error-state__search-ring,
.cm-error-state__search-handle { stroke: currentColor; stroke-width: 5; }
.cm-error-state__search-ring { fill: color-mix(in srgb, currentColor 4%, transparent); }
.cm-error-state__spark { stroke: var(--glow, #f6b366); stroke-width: 3; }
.cm-error-state__dash { stroke: color-mix(in srgb, currentColor 28%, transparent); stroke-width: 3; }

.cm-error-state__content { max-width: 580px; }
.cm-error-state__eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--cm-error-accent);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.cm-error-state h1 {
  margin: 0;
  font: 800 clamp(2.2rem, 5vw, 4.5rem)/1.02 var(--display-font, serif);
  letter-spacing: -.045em;
}
.cm-error-state p {
  max-width: 54ch;
  margin: 22px 0 0;
  color: color-mix(in srgb, currentColor 68%, transparent);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.7;
}
.cm-error-state__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.cm-error-state__actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 148px; }
.cm-error-state__actions svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 760px) {
  .cm-error-page .content-card { padding: 0; }
  .cm-error-state { grid-template-columns: 1fr; gap: 4px; min-height: calc(100dvh - 180px); padding: 28px 22px 46px; text-align: center; }
  .cm-error-state__visual { min-height: 230px; }
  .cm-error-state__illustration { width: min(84vw, 320px); margin-top: 30px; }
  .cm-error-state__code { font-size: clamp(6rem, 30vw, 9rem); }
  .cm-error-state__content { margin-inline: auto; }
  .cm-error-state p { margin-inline: auto; }
  .cm-error-state__actions { justify-content: center; }
}
