:root {
  --ink: #17152b;
  --muted: #77758a;
  --line: #eeedf4;
  --paper: #fbfaff;
  --purple: #7357f5;
  --purple-dark: #5c40e0;
  --purple2: #927cff;
  --pink: #ff6e9d;
  --lime: #d9f56c;
  --cyan: #79e5dc;
  --card: #ffffff;
  --shadow: 0 12px 34px rgba(38, 26, 88, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  overflow-x: hidden;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  transition: 0.18s ease;
}

h1, h2, h3, h4, .brand {
  font-family: 'Space Grotesk', sans-serif;
}

.hidden {
  display: none !important;
}

.stack-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mt-10 {
  margin-top: 10px;
}

.clickable {
  cursor: pointer;
}

/* ================= ANIMATIONS ================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.anim-in {
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ================= LANDING & AUTH VIEWS ================= */
.screen-shell {
  min-height: 100vh;
  background: #f3f1fb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.phone-frame {
  width: 100%;
  max-width: 430px;
  min-height: 780px;
  background: #fff;
  border-radius: 36px;
  box-shadow: 0 24px 64px rgba(23, 21, 43, 0.11);
  border: 1px solid var(--line);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  pointer-events: none;
  z-index: 0;
}

.glow-1 {
  width: 240px;
  height: 240px;
  background: rgba(115, 87, 245, 0.16);
  top: -80px;
  right: -80px;
}

.glow-2 {
  width: 200px;
  height: 200px;
  background: rgba(255, 110, 157, 0.14);
  bottom: 120px;
  left: -80px;
}

.frame-z {
  position: relative;
  z-index: 1;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.brand {
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -1.6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.brand-sm {
  font-size: 23px;
}

.brand-mark {
  width: 31px;
  height: 31px;
  background: var(--purple);
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 18px;
  transform: rotate(-8deg);
}

.mark-sm {
  width: 26px;
  height: 26px;
  font-size: 15px;
}

.brand span:last-child {
  color: var(--purple);
}

.link-pill {
  background: #f5f3ff;
  color: var(--purple);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 99px;
}

.link-pill:hover {
  background: #ebe6ff;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: var(--purple);
  text-transform: uppercase;
  margin: 0 0 10px;
}

.hero-heading {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -1.6px;
  line-height: 1.06;
  margin: 0 0 14px;
}

.hero-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 16px;
}

.open-art-slot {
  width: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  animation: floatY 6s ease-in-out infinite;
}

.open-art-slot img {
  width: 100%;
  max-height: 235px;
  object-fit: cover;
  border-radius: 18px;
}

.btn-primary {
  width: 100%;
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 16px 22px;
  border-radius: 16px;
  box-shadow: 0 12px 26px rgba(115, 87, 245, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  width: 100%;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  padding: 15px 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: #f8f7fc;
}

/* How It Works */
.hiw-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.bar-title {
  font-size: 17px;
}

.spacer-38 {
  width: 38px;
}

.circle-back {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f6f4fb;
  color: var(--ink);
  font-size: 18px;
  display: grid;
  place-items: center;
}

.circle-back:hover {
  background: #ece8fa;
}

.section-heading {
  font-size: 26px;
  letter-spacing: -1px;
  margin: 0 0 16px;
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-item {
  background: #faf9fe;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-badge {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.badge-purple { background: #ede9fe; color: var(--purple); }
.badge-pink { background: #ffe4e6; color: #e11d48; }
.badge-lime { background: #ecfccb; color: #4d7c0f; }

.step-item h4 {
  margin: 0 0 3px;
  font-size: 15px;
}

.step-item p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* Auth Forms */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f5f3fb;
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 20px;
}

.auth-tab {
  padding: 10px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 13px;
  background: transparent;
  color: var(--muted);
}

.auth-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(23, 21, 43, 0.06);
}

.auth-title {
  font-size: 25px;
  letter-spacing: -1px;
  margin: 0 0 6px;
}

.auth-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 18px;
}

.field {
  margin-bottom: 13px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input, .modal-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #faf9fe;
  outline: none;
  font-size: 14px;
  color: var(--ink);
}

.field input:focus, .modal-select:focus {
  border-color: var(--purple);
  background: #fff;
}

.interest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.i-pill {
  padding: 8px 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.i-pill.selected {
  background: #211c43;
  color: #fff;
  border-color: #211c43;
}

/* ================= MAIN APPLICATION ================= */
.app {
  min-height: 100vh;
  display: none;
}

.app.active {
  display: block;
}

.topbar {
  height: 76px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(4vw, 24px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.search {
  width: min(390px, 35vw);
  position: relative;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8f7fc;
  border-radius: 14px;
  padding: 12px 16px 12px 42px;
  outline: none;
}

.search input:focus {
  border-color: #b8aaff;
  background: white;
}

.search .glass {
  position: absolute;
  left: 15px;
  top: 11px;
  color: #8c899e;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #f6f4fb;
  color: #615d75;
  font-size: 17px;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  background: #ede9ff;
  color: var(--purple);
}

.avatar-initials {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 26px;
  border: 3px solid var(--lime);
}

.layout {
  max-width: 1440px;
  margin: auto;
  padding: 30px 4vw;
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr) 285px;
  gap: 28px;
}

.sidebar {
  position: sticky;
  top: 100px;
  height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
}

.nav-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: #aaa6b8;
  margin: 10px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 13px;
  border-radius: 13px;
  color: #777489;
  font-weight: 600;
  font-size: 14px;
  margin: 2px 0;
  background: transparent;
  text-align: left;
  width: 100%;
}

.nav-link .ico {
  width: 22px;
  font-size: 18px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--pink);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
}

.badge-alt {
  background: var(--purple);
}

.nav-link.active, .nav-link:hover {
  background: #f0edff;
  color: var(--purple);
}

.side-card {
  margin-top: auto;
  border-radius: 20px;
  padding: 18px;
  background: #211c43;
  color: #fff;
  position: relative;
}

.side-card b {
  font: 700 16px 'Space Grotesk';
}

.side-card p {
  font-size: 12px;
  line-height: 1.5;
  color: #c4bfdc;
}

.side-card button {
  background: var(--lime);
  color: #25213f;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
}

.main {
  min-width: 0;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeUp 0.3s ease forwards;
}

.welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 2px 0 23px;
}

.welcome h1 {
  font: 700 clamp(27px, 3vw, 36px) 'Space Grotesk';
  letter-spacing: -1.5px;
  margin: 4px 0 0;
}

.welcome p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.date-pill {
  background: white;
  border: 1px solid var(--line);
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 12px;
  color: #77748a;
}

.btn-inline {
  background: var(--purple);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.btn-inline:hover {
  background: var(--purple-dark);
}

.chips {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 8px;
}

.chip {
  white-space: nowrap;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 30px;
  color: #777489;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chip.active {
  background: #211c43;
  color: white;
  border-color: #211c43;
}

.postbox-wrap {
  margin-top: 14px;
}

.postbox {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 14px;
  display: flex;
  gap: 11px;
  align-items: center;
  cursor: pointer;
}

.postbox input {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 13px;
  min-width: 0;
  background: transparent;
  cursor: pointer;
}

.postbox button {
  background: var(--purple);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 800;
}

.feed-stream {
  margin-top: 14px;
}

.empty-state {
  background: #fff;
  border: 1px dashed #d3cef0;
  border-radius: 18px;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state h4 {
  color: var(--ink);
  margin: 0 0 6px;
  font-size: 16px;
}

.empty-state p {
  font-size: 13px;
  margin: 0 0 16px;
}

/* Posts */
.post {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 17px;
  margin-top: 13px;
  transition: 0.2s;
}

.post:hover {
  box-shadow: var(--shadow);
}

.post-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-author {
  font-size: 13px;
  font-weight: 800;
}

.post-meta {
  font-size: 11px;
  color: #a09cad;
  margin-top: 2px;
}

.post-delete {
  margin-left: auto;
  background: none;
  color: #b4b0c2;
  font-size: 12px;
}

.post-delete:hover {
  color: #e11d48;
}

.post-copy {
  font-size: 14px;
  line-height: 1.6;
  color: #3e3b4e;
  margin: 13px 0;
  white-space: pre-wrap;
}

.post-image {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 13px;
  margin-bottom: 10px;
}

.post-video {
  display: block;
  width: 100%;
  max-height: 420px;
  border-radius: 13px;
  margin-bottom: 10px;
  background: #17102b;
}

.post-share {
  margin-left: auto;
}

.post-actions {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.post-actions button {
  background: none;
  color: #89869a;
  font-size: 12px;
  font-weight: 700;
}

.post-actions button.liked {
  color: #f05c91;
}

/* Comments */
.comments-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: none;
}

.comments-box.open {
  display: block;
}

.comment-item {
  background: #f7f6fc;
  padding: 9px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 12px;
}

.comment-item b {
  display: block;
  font-size: 11px;
  margin-bottom: 2px;
  color: var(--purple);
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.comment-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  outline: none;
}

.comment-form button {
  background: var(--purple);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
}

/* Communities */
.community-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.community {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.community-cover {
  height: 76px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: linear-gradient(135deg, #ede8ff, #d6ccff);
}

.community h4 {
  font: 700 15px 'Space Grotesk';
  margin: 12px 0 4px;
}

.community p {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.45;
}

.community-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.members {
  font-size: 11px;
  color: #9995a8;
}

.join {
  border-radius: 9px;
  padding: 7px 12px;
  background: #f0edff;
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
}

.join.joined {
  background: #eaf8e9;
  color: #43834b;
}

/* ================= FULL CHAT VIEW ================= */
.chat-shell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  display: grid;
  grid-template-columns: 270px 1fr;
  height: clamp(520px, calc(100dvh - 150px), 780px);
  min-height: 520px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-list-pane {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: #fcfbff;
}

.chat-list-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.chat-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chat-head-row h3 {
  margin: 0;
  font-size: 17px;
}

.btn-mini {
  background: var(--purple);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

.chat-search {
  width: 100%;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  outline: none;
}

.chat-threads {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.thread-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border-radius: 14px;
  cursor: pointer;
  margin-bottom: 4px;
}

.thread-item:hover {
  background: #f3f0ff;
}

.thread-item.active {
  background: #ede8ff;
}

.thread-meta {
  min-width: 0;
  flex: 1;
}

.thread-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.thread-top b {
  font-size: 13px;
}

.thread-top small {
  font-size: 10px;
  color: #9995a8;
}

.thread-preview {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-room-pane {
  display: flex;
  flex-direction: column;
  background: #fff;
  min-width: 0;
  min-height: 0;
}

.chat-room-head {
  min-height: 66px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-room-user {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.chat-room-user > div:last-child {
  min-width: 0;
}

.chat-room-user b,
.chat-room-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-room-user b {
  display: block;
  font-size: 14px;
}

.chat-room-user small {
  font-size: 11px;
  color: var(--muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fbfaff;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.msg-row.me {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.them {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.msg-row.me .msg-bubble {
  background: var(--purple);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-row.them .msg-bubble {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 10px;
  color: #a09cad;
  margin-top: 4px;
}

.msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.msg-actions button {
  padding: 2px 0;
  background: none;
  color: #89869a;
  font-size: 10px;
}

.chat-input-bar {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}

.chat-input-bar input {
  flex: 1;
  padding: 12px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f8f7fc;
  outline: none;
  font-size: 13px;
}

.chat-send-btn {
  background: var(--purple);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  padding: 12px 18px;
  border-radius: 13px;
}

.chat-send-btn:disabled {
  background: #ccc8e0;
  cursor: not-allowed;
}

/* Events */
.events-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.event-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.event-card-date {
  font-size: 11px;
  font-weight: 800;
  color: var(--purple);
  text-transform: uppercase;
}

.event-card h4 {
  margin: 8px 0 6px;
  font-size: 16px;
}

.event-card p {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.rsvp-btn {
  width: 100%;
  padding: 10px;
  border-radius: 11px;
  background: #f0edff;
  color: var(--purple);
  font-weight: 800;
  font-size: 12px;
}

.rsvp-btn.going {
  background: #211c43;
  color: #fff;
}

/* Profile */
.profile-banner {
  background: linear-gradient(120deg, #211c43, #3c317a);
  border-radius: 22px;
  padding: 26px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.profile-banner h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.profile-banner p {
  margin: 0 0 4px;
  color: #d7d3ed;
  font-size: 13px;
}

.profile-banner small {
  color: #a9a3c7;
  font-size: 12px;
}

.profile-edit-button {
  margin-left: auto;
  flex-shrink: 0;
}

.edit-profile-photo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0 18px;
}

.edit-profile-photo-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.edit-photo-btn,
.edit-photo-remove {
  font-size: 12px;
  font-weight: 800;
  border-radius: 9px;
  padding: 8px 11px;
  cursor: pointer;
}

.edit-photo-btn {
  background: #f0edff;
  color: var(--purple);
}

.edit-photo-remove {
  background: #fff;
  color: #c43d66;
  border: 1px solid #f1d9e2;
}

.edit-photo-remove[hidden] {
  display: none;
}

.edit-profile-photo-actions input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.call-video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.call-video-grid video {
  width: 100%;
  max-height: 360px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 13px;
  background: #17102b;
}

.call-video-grid video:only-child {
  grid-column: 1 / -1;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.stat-box b {
  font-size: 22px;
  font-family: 'Space Grotesk', sans-serif;
  display: block;
  color: var(--purple);
}

.stat-box span {
  font-size: 11px;
  color: var(--muted);
}

/* Profile Picture Upload */
.profile-pic-upload {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
}

.profile-pic-upload .avatar-lg {
  border: 3px solid var(--lime);
  position: relative;
}

.profile-pic-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(115, 87, 245, 0.35);
  transition: 0.2s ease;
  border: 3px solid var(--paper);
}

.profile-pic-btn:hover {
  background: var(--purple-dark);
  transform: scale(1.08);
}

.profile-pic-btn:active {
  transform: scale(0.96);
}

.profile-pic-remove {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: #e11d48;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: 0.2s ease;
  border: 2px solid var(--paper);
  opacity: 0;
  pointer-events: none;
}

.profile-pic-upload.has-pic .profile-pic-remove {
  opacity: 1;
  pointer-events: auto;
}

.profile-pic-remove:hover {
  background: #ffe4e6;
  transform: scale(1.1);
}

.profile-pic-upload input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border-radius: 50%;
}

.profile-pic-preview img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Right sidebar profile picture upload */
.rightbar .profile-pic-upload {
  width: 100%;
  justify-content: center;
}

.rightbar .profile-pic-btn {
  width: 32px;
  height: 32px;
}

.rightbar .avatar-lg {
  width: 68px;
  height: 68px;
}

/* Rightbar */
.rightbar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.profile-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0 20px;
  border-bottom: 1px solid var(--line);
}

.profile-mini b {
  font-size: 13px;
}

.profile-mini small {
  display: block;
  color: #9995a8;
  font-size: 11px;
  margin-top: 2px;
}

.right-section {
  margin-top: 22px;
}

.right-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 13px;
}

.right-title b {
  font: 700 15px 'Space Grotesk';
}

.link-sm {
  font-size: 11px;
  color: var(--purple);
  cursor: pointer;
  font-weight: 700;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.member-row button {
  background: #f0edff;
  color: var(--purple);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

/* Modals & Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #211c43;
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 80;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 19, 50, 0.45);
  display: none;
  place-items: center;
  z-index: 70;
  padding: 20px;
}

.modal-backdrop.show {
  display: grid;
}

.modal {
  background: white;
  width: min(450px, 100%);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 25px 70px #17102b33;
}

.modal h3 {
  font: 700 21px 'Space Grotesk';
  margin: 0 0 6px;
}

.modal p {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 14px;
}

.modal textarea {
  width: 100%;
  min-height: 95px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  resize: vertical;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions button {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}

.cancel {
  background: #f4f2f8;
  color: #777;
}

.publish {
  background: var(--purple);
  color: white;
}

.user-select-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}

.user-select-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 11px;
  background: #f8f7fc;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}

.user-select-btn:hover {
  background: #ede9ff;
  color: var(--purple);
}

.mobile-nav, .mobile-only {
  display: none;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 195px minmax(0, 1fr);
  }
  .rightbar {
    display: none;
  }
  .community-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chat-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .chat-shell {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100dvh - 150px);
    min-height: 420px;
  }
  .chat-list-pane {
    border-right: 0;
  }
  .chat-room-pane {
    min-height: 0;
  }
  .chat-list-pane.mobile-hide,
  .chat-room-pane.mobile-hide {
    display: none;
  }
  .mobile-only {
    display: inline-block;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 65px;
    padding: 0 12px;
  }
  .topbar .brand {
    font-size: 21px;
    gap: 5px;
  }
  .topbar .brand-mark {
    width: 28px;
    height: 28px;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions .icon-btn {
    width: 36px;
    height: 36px;
  }
  .top-actions .icon-btn[data-icon="plus"],
  .top-actions .icon-btn[data-icon="logout"] {
    display: none;
  }
  .search {
    width: auto;
    flex: 1;
    min-width: 0;
    margin: 0 7px;
  }
  .search input {
    min-width: 0;
    font-size: 12px;
    padding-right: 8px;
  }
  .layout {
    display: block;
    padding: 18px 12px 92px;
  }
  .sidebar {
    display: none;
  }
  .welcome {
    align-items: flex-start;
    gap: 12px;
  }
  .welcome h1 {
    font-size: 27px;
  }
  .date-pill {
    max-width: 110px;
    text-align: right;
  }
  .chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar {
    display: none;
  }
  .postbox-wrap {
    margin: 12px 0;
  }
  .postbox {
    gap: 8px;
  }
  .postbox input {
    min-width: 0;
  }
  .postbox button {
    white-space: nowrap;
  }
  .community-grid, .events-grid {
    grid-template-columns: 1fr;
  }
  .chat-shell {
    grid-template-columns: 1fr;
    height: calc(100dvh - 145px);
    min-height: 420px;
    border-radius: 16px;
  }
  .chat-room-head {
    padding: 11px 12px;
  }
  .chat-messages {
    padding: 12px;
  }
  .msg-row {
    max-width: 88%;
  }
  .chat-input-bar {
    padding: 9px 8px;
  }
  .composer-row {
    gap: 5px;
  }
  .composer-icon-btn {
    width: 36px;
    height: 36px;
  }
  .chat-send-btn {
    padding: 10px 12px;
  }
  .profile-banner {
    padding: 18px;
  }
  .profile-banner h2 {
    font-size: 19px;
  }
  .profile-edit-button {
    padding: 8px 9px;
  }
  .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .stat-box {
    padding: 12px 6px;
  }
  .find-friend-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .modal-backdrop {
    padding: 10px;
  }
  .modal {
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    border-radius: 18px;
    padding: 18px;
  }
  .modal-wide {
    width: 100%;
  }
  .call-video-grid {
    grid-template-columns: 1fr;
  }
  .call-video-grid video {
    max-height: 220px;
  }
  .chat-list-pane.mobile-hide, .chat-room-pane.mobile-hide {
    display: none;
  }
  .mobile-only {
    display: inline-block;
  }
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-around;
    padding: 10px 5px calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
  }
  .mobile-nav button {
    background: none;
    color: #9995a8;
    font-size: 10px;
    display: grid;
    gap: 3px;
    justify-items: center;
  }
  .mobile-nav button span {
    font-size: 19px;
  }
  .mobile-nav button.active {
    color: var(--purple);
  }
}

@media (max-width: 480px) {
  .topbar .brand > span:last-child {
    display: none;
  }
  .top-actions .icon-btn {
    display: none;
  }
  .search {
    margin-right: 8px;
  }
  .date-pill {
    display: none;
  }
  .postbox .avatar-sm {
    display: none;
  }
  .postbox button {
    font-size: 11px;
    padding: 9px;
  }
  .profile-banner {
    align-items: flex-start;
  }
  .profile-banner .avatar-lg {
    width: 58px;
    height: 58px;
  }
  .profile-banner {
    gap: 10px;
  }
  .profile-edit-button {
    margin-left: auto;
  }
  .edit-profile-photo {
    gap: 12px;
  }
  .modal-actions {
    flex-wrap: wrap;
  }
  .modal-actions button {
    flex: 1;
  }
  .composer-icon-btn {
    display: none;
  }
  .composer-row #chatInput {
    min-width: 0;
  }
}

/* ================= CHAT ATTACHMENTS & SNIPPETS ================= */
.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.composer-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
}

.chat-file-input {
  display: none;
}
.composer-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f6f4fb;
  color: #615d75;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.composer-icon-btn:hover {
  background: #ede9ff;
  color: var(--purple);
}

.composer-icon-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.composer-attachment {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #f7f5ff;
  border: 1px solid #e4ddff;
  border-radius: 12px;
  padding: 6px;
  max-width: 100%;
}

.composer-attachment img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.attachment-info {
  min-width: 0;
  font-size: 11px;
  line-height: 1.35;
}

.attachment-info b {
  display: block;
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.attachment-info span {
  color: var(--muted);
}

.attachment-remove {
  background: #fff;
  color: #9b96ad;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.attachment-remove:hover {
  background: #ffe4e6;
  color: #e11d48;
}
