/* ---------- "3 new messages ⌄" pill above the composer ---------- */

.jump-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  height: 32px;
  margin: 0 auto 10px;
  padding: 0 10px 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.28);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  animation: jump-in 0.18s ease;
}
.jump-pill svg { width: 15px; height: 15px; stroke-width: 2.4; }
@keyframes jump-in { from { opacity: 0; transform: translateY(6px); } }

/* Custom avatar photos fill the circle. */
.agent-avatar.custom img, .ap-avatar.custom img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ap-avatar { overflow: visible; }
.ap-hero { position: relative; }
.ap-menu {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-72%);
  z-index: 3;
  min-width: 220px;
  padding: 6px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(16, 17, 19, 0.16);
  animation: ap-menu-in 0.16s ease;
  transform-origin: 72% 0;
}
@keyframes ap-menu-in { from { opacity: 0; transform: translateX(-72%) scale(0.94); } }
.ap-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 16px;
  background: none;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.ap-menu button:hover { background: rgba(16, 17, 19, 0.05); }
.ap-menu svg { width: 22px; height: 22px; flex: none; }
.ap-name-input {
  margin-top: 14px;
  width: min(260px, 80%);
  border: 0;
  border-bottom: 2px solid var(--imessage-blue);
  background: none;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text);
  outline: none;
}

/* ---------- Feed: "Why I created this post" (the ⓘ button) ---------- */

.post-why {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  animation: why-in 0.2s ease;
}
@keyframes why-in { from { opacity: 0; transform: translateY(-4px); } }
.why-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.why-head h3 { font-size: 1rem; font-weight: 600; color: var(--text-2); }
.why-head .why-more { width: 32px; height: 32px; border: 0; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.why-head .why-more svg { width: 20px; height: 20px; }
.post-why p { margin-top: 6px; font-size: 0.9375rem; line-height: 1.5; color: var(--text-2); }
.post-why small { display: block; margin-top: 10px; font-size: 0.875rem; color: var(--text-3); }

/* ---------- Invite friends (white) ---------- */

.invite-sheet { background: #fff; }
.sheet-grabber { position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: #d9d9de; }
.invite-bar { position: relative; display: flex; align-items: center; justify-content: center; padding: 22px 16px 6px; }
.invite-title { font-size: 1.0625rem; font-weight: 600; }
.invite-bar .round-btn { position: absolute; right: 16px; top: 14px; width: 40px; height: 40px; }
.invite-scroll { flex: 1; overflow-y: auto; padding: 8px 16px 24px; scrollbar-width: none; }
.invite-scroll::-webkit-scrollbar { display: none; }
.invite-gift { display: grid; place-items: center; margin: 10px 0 18px; }
.invite-gift img { width: 116px; height: 116px; filter: drop-shadow(0 10px 18px rgba(16, 17, 19, 0.12)); }
.invite-code {
  position: relative;
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  display: grid;
  place-items: center;
  font: 700 1.5rem/1 "Inter", sans-serif;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--text);
  cursor: pointer;
}
.invite-copy { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--text-2); }
.invite-copy svg { width: 24px; height: 24px; }
.invite-note { margin: 16px 6px 0; text-align: center; font-size: 0.9375rem; line-height: 1.5; color: var(--text-2); }
.invite-earned {
  display: flex; align-items: center; gap: 14px;
  margin-top: 20px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 20px;
}
.invite-earned img { width: 44px; height: 44px; flex: none; }
.invite-earned strong { display: block; font-size: 0.9375rem; font-weight: 600; }
.invite-earned span { display: block; margin-top: 2px; font-size: 0.875rem; color: var(--text-2); }
.invite-friends { margin-top: 12px; }
.invite-friend { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.invite-friend:last-child { border-bottom: 0; }
.invite-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--pill); display: grid; place-items: center; font-weight: 600; }
.invite-friend .name { flex: 1; font-size: 0.9375rem; }
.invite-friend small { font-size: 0.8125rem; color: var(--text-3); }
.invite-share {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  scrollbar-width: none;
}
.invite-share::-webkit-scrollbar { display: none; }
.share-opt {
  flex: none;
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
}
.share-circle { width: 56px; height: 56px; border-radius: 50%; background: var(--pill); display: grid; place-items: center; }
.share-circle svg { width: 24px; height: 24px; }
.share-opt.whatsapp .share-circle { color: #25d366; }
.share-opt.messenger .share-circle { color: #0a7cff; }
.share-opt.email .share-circle { color: #e5484d; }

/* ---------- Attach sheet (composer +), ---------- */

.attach-backdrop { background: rgba(16, 17, 19, 0.18); padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
.attach-panel {
  width: min(560px, 100%);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: 0 -8px 40px rgba(16, 17, 19, 0.12);
  padding: 18px 0 16px;
  animation: sheet-up 0.3s cubic-bezier(0.3, 0.8, 0.25, 1);
}
.attach-backdrop.closing .attach-panel { animation: sheet-down 0.24s ease forwards; }
.attach-head { display: flex; align-items: center; justify-content: space-between; padding: 0 22px 12px; }
.attach-head span { font-size: 1.0625rem; font-weight: 600; color: var(--text-2); }
.attach-all { border: 0; background: none; font: inherit; font-size: 1rem; font-weight: 500; color: var(--imessage-blue); cursor: pointer; }
.attach-strip { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
.attach-strip::-webkit-scrollbar { display: none; }
.attach-camera, .attach-thumb {
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 16px;
  border: 0;
  padding: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.attach-camera { background: var(--pill); color: var(--text); display: grid; place-items: center; }
.attach-camera svg { width: 30px; height: 30px; }
.attach-thumb img, .attach-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(16, 17, 19, 0.15);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
}
.attach-thumb.on .attach-check { background: var(--imessage-blue); }
.attach-dur {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fff;
  background: rgba(16, 17, 19, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  line-height: 1.4;
}
/* Camera-roll tiles that aren't photos: "Allow photos", "Select more…", "open Settings". */
.attach-tile {
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 16px;
  border: 0;
  padding: 8px;
  background: var(--pill);
  color: var(--imessage-blue);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.attach-tile-loading { animation: attach-pulse 1.1s ease-in-out infinite; }
@keyframes attach-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.attach-send:disabled { opacity: 0.6; cursor: default; }
.attach-check svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2.6; }
.attach-group { margin: 16px 16px 0; background: var(--pill); border-radius: 22px; overflow: hidden; }
.attach-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  position: relative;
}
.attach-row + .attach-row::before { content: ""; position: absolute; top: 0; left: 54px; right: 0; height: 1px; background: var(--border); }
.attach-row svg { width: 22px; height: 22px; flex: none; }
.attach-send {
  display: block;
  width: calc(100% - 32px);
  height: 46px;
  margin: 12px 16px 0;
  border: 0;
  border-radius: 999px;
  background: var(--imessage-blue);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.sheet-backdrop.attach-backdrop { align-items: flex-end; }

/* ---------- Attachments: composer tray and photos in the thread ---------- */

.attach-tray {
  max-width: var(--col);
  margin: 0 auto 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.attach-tray::-webkit-scrollbar { display: none; }
.tray-item { position: relative; flex: none; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--pill); box-shadow: 0 2px 10px rgba(16, 17, 19, 0.1); }
.tray-item img, .tray-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tray-pdf { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700; font-size: 0.8125rem; color: #e5484d; }
.tray-remove {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(16, 17, 19, 0.6); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.tray-remove svg { width: 12px; height: 12px; stroke-width: 2.6; }

.bubble-media { display: flex; flex-wrap: wrap; gap: 6px; max-width: min(78%, 320px); margin-bottom: 4px; }
.bubble-media.in { margin-left: auto; justify-content: flex-end; }
.bubble-media img, .bubble-media video {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 18px;
  object-fit: cover;
  cursor: zoom-in;
  background: var(--pill);
}
.bubble-media video { cursor: default; }
.bubble-file {
  display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 88px;
  border-radius: 14px; background: var(--pill); color: #e5484d; font-weight: 700; text-decoration: none;
}
.media-grid video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--pill); }
.media-grid .media-pdf { display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; background: var(--pill); color: #e5484d; font-weight: 700; text-decoration: none; }

/* ---------- SOUL.md / MEMORY.md ---------- */

.doc-sheet { background: #fff; }
.doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 8px; }
.doc-bar .round-btn { width: 44px; height: 44px; flex: none; }
.doc-title { flex: 1; text-align: center; font-size: 1.0625rem; font-weight: 600; }
.doc-actions { display: flex; align-items: center; height: 44px; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; background: #fff; box-shadow: 0 2px 10px rgba(16, 17, 19, 0.06); }
.doc-actions button { width: 38px; height: 38px; border: 0; background: none; display: grid; place-items: center; color: var(--text); cursor: pointer; }
.doc-actions svg { width: 21px; height: 21px; }
.doc-scroll { flex: 1; overflow-y: auto; padding: 6px 20px calc(48px + env(safe-area-inset-bottom)); scrollbar-width: none; }
.doc-scroll::-webkit-scrollbar { display: none; }
.doc-about { margin: 6px 0 22px; font-style: italic; font-size: 0.9375rem; line-height: 1.55; color: var(--text-3); }
.doc-about strong { color: var(--text-2); font-weight: 700; }
.doc-textarea {
  width: 100%; min-height: 55vh; padding: 14px; border: 1px solid var(--border); border-radius: 16px;
  font: 0.9375rem/1.55 ui-monospace, "SF Mono", Menlo, monospace; color: var(--text); background: #fafafb; resize: vertical;
}
.doc-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.doc-editor-actions button {
  height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.doc-editor-actions button.ghost { background: var(--pill); color: var(--text); }
.doc-facts { display: flex; flex-direction: column; }
.doc-fact { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc-fact span { flex: 1; font-size: 0.9375rem; line-height: 1.45; }
.doc-fact small { display: block; font-size: 0.75rem; color: var(--text-3); }
.doc-fact button { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--pill); display: grid; place-items: center; cursor: pointer; }
.doc-fact button svg { width: 13px; height: 13px; stroke-width: 2.4; }
.doc-add { width: 100%; height: 44px; margin-top: 12px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; font: inherit; background: #fff; }
