/*
 * Community surface — chat / forum / library / profile.
 * Pulls brand tokens from /_styles/brand.css (loaded before this file).
 * Visual language matches /dashboard so members move between surfaces
 * without a context switch.
 */

* { box-sizing: border-box; }
/* The HTML `hidden` attribute must always win — our component CSS sets
 * explicit `display: grid` on .boot and .modal, which would otherwise
 * override the user-agent's `[hidden] { display: none }` rule (same
 * specificity, our rule wins by source order). */
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  /* Defensive: stop the whole page from sliding sideways on mobile. The
     forum/library/chat panels have their own scroll containers; if any
     attachment, code block, or pasted URL ever overflows, we contain it
     here rather than letting the user discover a stray scrollbar. */
  overflow-x: hidden;
  max-width: 100%;
}
body {
  background: var(--bg-tint);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
/* Long words / URLs in posts, replies, chat bubbles, etc. wrap rather
   than push the layout sideways. */
.msg-body, .reply-body, .post-body, .post-title, .post-meta,
.rec-title, .upcoming-card .body, .empty p, .empty h3,
.profile-card, .field-row .text-input {
  word-break: break-word;
  overflow-wrap: anywhere;
}
img, video, iframe { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--purple); color: #fff; }

/* ─── Boot screen ─────────────────────────────────────── */
.boot {
  position: fixed; inset: 0;
  background: var(--bg-tint);
  display: grid; place-items: center;
  z-index: 1000;
}
.boot-card {
  background: #fff; padding: 32px 36px;
  border-radius: 18px; box-shadow: var(--shadow-md);
  text-align: center; min-width: 280px;
}
.brand-lockup {
  font-family: "Inter Tight", sans-serif; font-weight: 800;
  font-size: 22px; letter-spacing: -0.025em;
  margin-bottom: 8px;
}
.brand-name { color: var(--ink); }
.brand-grad {
  background: var(--grad-wordmark);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--ink-3); font-size: 14px; }

/* ─── Top bar ────────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px; align-items: center;
}
.brand {
  font-family: "Inter Tight", sans-serif; font-weight: 800;
  font-size: 18px; letter-spacing: -0.025em; color: var(--ink);
  white-space: nowrap;
}
.tabnav {
  display: flex; gap: 6px; justify-content: center;
}
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600; font-size: 14px;
  color: var(--ink-3);
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--bg-soft); color: var(--ink); }
.tab.is-active {
  background: var(--purple-tint); color: var(--purple-3);
}
.top-actions { display: flex; gap: 10px; align-items: center; }

/* Optional admin link in the topbar — matches the dashboard treatment so
   admins can jump back into /admin from anywhere in the member area. */
.top-link {
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #9a3bff 0%, #5e1ad8 100%);
  padding: 7px 12px; border-radius: 9px;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease;
}
.top-link:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(122,51,255,.30); }

/* User pill — dropdown trigger. Matches the dashboard topbar pill so the
   member sees the same component every time we render their identity. */
.user-menu { position: relative; }
.me-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.me-pill:hover,
.me-pill[aria-expanded="true"] {
  background: #fff;
  border-color: rgba(122,51,255,.30);
  box-shadow: 0 2px 8px rgba(10,10,10,.06);
}
.me-name {
  max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-caret {
  color: var(--ink-4);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.me-pill[aria-expanded="true"] .me-caret { transform: rotate(180deg); color: var(--purple-3); }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--grad-purple);
  color: #fff; font-weight: 700;
  display: inline-grid; place-items: center;
  font-size: 12px;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ─── Bell ───────────────────────────────────────────── */
.bell {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--ink-2);
}
.bell:hover { color: var(--purple-3); }
.bell-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--purple);
  color: #fff; font-weight: 700; font-size: 11px;
  border-radius: 999px;
  padding: 2px 6px;
  min-width: 18px; text-align: center;
}
.mentions-drop {
  position: fixed; top: 64px; right: 24px;
  width: 360px; max-height: 460px; overflow: auto;
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  z-index: 60;
}
.mentions-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 14px;
}
.mention-row {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 13.5px;
}
.mention-row:hover { background: var(--bg-soft); }
.mention-row .preview { color: var(--ink-3); }
.mention-row .when    { color: var(--ink-4); font-size: 12px; margin-top: 2px; }

/* ─── Main view shell ────────────────────────────────── */
.view {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 24px 60px;
  min-height: calc(100vh - 70px);
}
.loading {
  padding: 80px 24px; text-align: center; color: var(--ink-3);
}

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600; font-size: 14px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--purple-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost {
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--bg-soft); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 500; font-size: 13px;
}
.ghost:hover { background: var(--bg-soft); }
.ghost.small { padding: 5px 10px; font-size: 12.5px; }
.link-btn {
  background: transparent; border: none; color: var(--purple-3);
  font-weight: 600; cursor: pointer; font-size: 13px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.small { font-size: 12px; }

/* ─── Inputs ─────────────────────────────────────────── */
.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  outline: none;
}
.text-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(122,51,255,.12);
}
textarea.text-input { resize: vertical; min-height: 80px; }

/* ─── Pills ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.pill.pro {
  background: var(--amber-tint);
  border-color: rgba(185,106,0,.25);
  color: var(--amber);
}
.pill.plus {
  background: var(--purple-tint);
  border-color: rgba(122,51,255,.25);
  color: var(--purple-3);
}
.pill.lock::before {
  content: "🔒"; margin-right: 2px;
}

/* ─── CHAT ───────────────────────────────────────────── */
.chat {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  height: calc(100vh - 110px);
  min-height: 540px;
}
.chat.with-thread {
  grid-template-columns: 260px 1fr 360px;
}
.chat-rooms {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
  padding: 12px 8px;
}
.chat-rooms h4 {
  margin: 6px 10px 8px;
  font-family: "Inter Tight"; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-4);
}
.room {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px; font-weight: 500;
  color: var(--ink-2);
}
.room:hover { background: var(--bg-soft); }
.room.is-active { background: var(--purple-tint); color: var(--purple-3); }
.room-icon { width: 18px; text-align: center; }
.room-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread {
  background: var(--purple); color: #fff;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px; font-weight: 700;
  min-width: 18px; text-align: center;
}

.chat-main {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-head h2 {
  margin: 0;
  font-family: "Inter Tight"; font-size: 17px; font-weight: 700;
}
.chat-head .room-desc { color: var(--ink-3); font-size: 13px; margin-top: 2px; }

.chat-stream {
  flex: 1; overflow: auto;
  padding: 16px 18px;
  display: flex; flex-direction: column-reverse; /* newest at the bottom; we render reversed and let flex flip */
  gap: 2px;
}
.msg {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background .12s ease;
}
.msg:hover, .msg:focus-within { background: var(--bg-soft); }
.msg + .msg.same-author { /* visually grouped */ }
.msg .avatar { width: 36px; height: 36px; font-size: 14px; flex-shrink: 0; }
.msg-content { min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg-name { font-weight: 700; color: var(--ink); font-size: 14px; }
.msg-time { color: var(--ink-4); font-size: 11.5px; }
.msg-body { font-size: 14.5px; color: var(--ink-2); word-wrap: break-word; overflow-wrap: anywhere; }
.msg-body p { margin: 0 0 4px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body blockquote {
  margin: 4px 0;
  padding: 4px 0 4px 10px;
  border-left: 3px solid var(--purple);
  color: var(--ink-3);
  font-size: 13.5px;
  background: rgba(122,51,255,.04);
  border-radius: 0 6px 6px 0;
}
.msg-body blockquote p { margin: 0; }
.msg-body a { color: var(--purple-3); text-decoration: underline; }
.msg-body code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-family: "Geist Mono", monospace; font-size: 13px; }
.msg-thread-toggle {
  margin-top: 6px;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--purple-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s ease, border-color .15s ease;
}
.msg-thread-toggle:hover {
  background: var(--purple-tint);
  border-color: rgba(122,51,255,.18);
}

/* Inline attachment previews on a delivered message */
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.attach-link { position: relative; display: inline-block; line-height: 0; }
.attach-img, .attach-gif {
  max-width: 360px; max-height: 240px;
  border-radius: 10px; border: 1px solid var(--line);
  display: block;
}
.attach-link .attach-badge {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(0,0,0,.7); color: #fff;
  padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  line-height: 1.4;
}
.attach-video {
  max-width: 480px; max-height: 280px;
  border-radius: 10px; border: 1px solid var(--line);
  background: #000;
  display: block;
}
.attach-libref {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--purple-tint); color: var(--purple-3);
  padding: 6px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: 1px solid rgba(122,51,255,.2);
  text-decoration: none;
}
.attach-libref:hover { background: #ece1ff; }
.attach-libref-rich {
  padding: 6px;
  gap: 10px;
  align-items: center;
  max-width: 360px;
}
.attach-libref-thumb {
  width: 56px; height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(122,51,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.attach-libref-thumb-fallback { color: var(--purple-3); }
.attach-libref-meta {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.attach-libref-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .72;
}
.attach-libref-name {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-file {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--bg-soft); color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 10px;
  font-size: 13px;
  text-decoration: none;
  max-width: 320px;
}
.attach-file:hover { background: #fff; border-color: rgba(122,51,255,.25); color: var(--ink); }
.attach-file-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--purple-3);
  flex-shrink: 0;
}
.attach-file-meta { display: flex; flex-direction: column; min-width: 0; }
.attach-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-file-size { font-size: 11.5px; color: var(--ink-4); }

.mention {
  background: var(--purple-tint); color: var(--purple-3);
  padding: 1px 5px; border-radius: 4px;
  font-weight: 600; font-size: 13.5px;
}

/* Hover toolbar — Reply / Thread / More buttons in the top-right of the
   bubble. Visible on hover/focus + always when the menu is open. */
.msg-toolbar {
  position: absolute;
  right: 6px; top: -10px;
  display: flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  box-shadow: 0 4px 12px rgba(10,10,10,.08);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
  z-index: 4;
}
.msg:hover .msg-toolbar,
.msg:focus-within .msg-toolbar,
.msg.is-menu-open .msg-toolbar {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.msg-toolbar-btn {
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 5px 7px;
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.msg-toolbar-btn:hover { background: var(--bg-soft); color: var(--purple-3); }
.msg-toolbar-btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
}

/* Inline edit form */
.msg-edit textarea {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  resize: vertical;
  min-height: 56px;
  outline: none;
}
.msg-edit textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(122,51,255,.10);
}
.msg-edit-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.msg-edit-hint {
  font-size: 11.5px;
  color: var(--ink-4);
  margin-left: auto;
}

/* Right-click / 3-dots context menu (single global popover) */
.msg-menu {
  position: fixed;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10,10,10,.16), 0 2px 6px rgba(10,10,10,.06);
  padding: 5px;
  z-index: 200;
  animation: msgMenuIn .12s cubic-bezier(.2,.8,.2,1);
}
@keyframes msgMenuIn {
  from { opacity: 0; transform: scale(.96) translateY(-2px); }
  to   { opacity: 1; transform: none; }
}
.msg-menu-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: transparent; border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
}
.msg-menu-item:hover, .msg-menu-item:focus-visible {
  background: var(--bg-soft);
  color: var(--ink);
  outline: none;
}
.msg-menu-item.is-danger { color: var(--red, #c83e3e); }
.msg-menu-item.is-danger:hover { background: var(--red-tint, #fdf3f3); }
.msg-menu-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  color: var(--ink-3);
}
.msg-menu-item.is-danger .msg-menu-icon { color: var(--red, #c83e3e); }
.msg-menu-sep {
  height: 1px; background: var(--line); margin: 4px 4px;
}

/* Composer */
.composer {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.composer-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.composer-row textarea {
  width: 100%; border: 0; outline: none;
  font: inherit; resize: none; min-height: 36px; max-height: 200px;
  background: transparent;
}
.composer-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.composer-actions .spacer { flex: 1; }
.compose-icon {
  background: transparent; border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--ink-3); font-size: 13px; cursor: pointer;
}
.compose-icon:hover { color: var(--purple-3); border-color: var(--purple-tint); }
.compose-attachments {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px;
}
/* Real thumbnail preview of pending attachments — shows what you're
   actually about to send (not the literal text "gif"). */
.attach-preview {
  position: relative;
  width: 100px; min-height: 76px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.attach-preview img,
.attach-preview video {
  width: 100%; height: 76px;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}
.attach-preview .preview-icon {
  width: 100%; height: 76px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--purple-tint);
  color: var(--purple-3);
  font-size: 22px;
}
.attach-preview .preview-name {
  display: block;
  padding: 4px 8px 6px;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.attach-preview[data-type="image"],
.attach-preview[data-type="gif"],
.attach-preview[data-type="video"] {
  width: 88px;
}
.attach-preview .preview-badge {
  position: absolute;
  left: 6px; bottom: 6px;
  padding: 2px 7px;
  background: rgba(0,0,0,.7);
  color: #fff;
  border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  line-height: 1.4;
  display: inline-flex; align-items: center; gap: 4px;
  pointer-events: none;
}
.attach-preview .preview-badge-icon {
  padding: 4px;
  background: rgba(0,0,0,.55);
  border-radius: 999px;
  left: auto; right: 6px; bottom: 6px;
}
.attach-preview-x {
  position: absolute;
  right: 4px; top: 4px;
  width: 22px; height: 22px;
  border: 0;
  background: rgba(10,10,10,.8);
  color: #fff;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  transition: transform .12s ease, background .12s ease;
}
.attach-preview-x:hover { background: var(--red, #c83e3e); transform: scale(1.06); }

/* Reply chip — visible above the composer when the user hits Reply on a
   message. Cancel with × or Escape. */
#replyChipHost { margin-bottom: 8px; }
.reply-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--purple-tint);
  border: 1px solid rgba(122,51,255,.18);
  border-radius: 12px;
  padding: 8px 10px 8px 0;
  position: relative;
}
.reply-chip-bar {
  width: 4px; align-self: stretch;
  background: var(--purple);
  border-radius: 2px;
  margin: 2px 0 2px 8px;
}
.reply-chip-meta {
  display: flex; flex-direction: column;
  flex: 1;
  min-width: 0;
}
.reply-chip-label {
  font-size: 12px;
  color: var(--purple-3);
  font-weight: 600;
}
.reply-chip-snippet {
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-chip-close {
  background: transparent; border: 0;
  color: var(--purple-3);
  cursor: pointer;
  font-size: 18px; line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.reply-chip-close:hover { background: rgba(122,51,255,.12); }

/* Mention picker dropdown */
.mention-picker {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-height: 220px; overflow: auto;
  width: 280px;
  z-index: 70;
}
.mention-pick {
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.mention-pick:hover, .mention-pick.is-focus { background: var(--purple-tint); }
.mention-pick .avatar { width: 24px; height: 24px; font-size: 10.5px; }

/* Thread side panel */
.chat-thread {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-thread .head {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-thread .body {
  flex: 1; overflow: auto;
  padding: 14px 16px;
}

/* ─── FORUM ──────────────────────────────────────────── */
.forum {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
}
.forum-cats {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px;
  height: max-content;
}
.forum-cats h4 {
  margin: 6px 10px 8px;
  font-family: "Inter Tight"; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-4);
}
.cat {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.cat:hover { background: var(--bg-soft); }
.cat.is-active { background: var(--purple-tint); color: var(--purple-3); }
.cat-swatch { width: 8px; height: 8px; border-radius: 50%; }

.forum-main {
  display: flex; flex-direction: column; gap: 14px;
}
.forum-actions {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.forum-search { flex: 1; }
.post-list {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.post-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px; align-items: center;
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--bg-soft); }
.post-row .avatar { width: 36px; height: 36px; font-size: 14px; }
.post-meta { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.post-title { font-weight: 700; color: var(--ink); font-size: 15px; }
.post-stats {
  display: flex; gap: 14px;
  color: var(--ink-3); font-size: 12.5px;
  text-align: right;
}
.post-stats b { color: var(--ink); display: block; font-size: 14px; }
.post-pin { color: var(--amber); font-size: 12px; font-weight: 700; margin-right: 6px; }

/* Post detail */
.post-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.post-detail h1 {
  margin: 0 0 12px;
  font-family: "Inter Tight"; font-size: 24px; font-weight: 700;
}
.post-author {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-3); margin-bottom: 18px;
}
.post-body {
  font-size: 15.5px; color: var(--ink-2);
  line-height: 1.7;
}
.post-body p { margin: 0 0 14px; }
.post-body img { max-width: 100%; border-radius: 10px; }
.post-body code { background: var(--bg-soft); padding: 2px 6px; border-radius: 4px; font-family: "Geist Mono", monospace; }
.post-body pre { background: var(--ink); color: #fff; padding: 14px; border-radius: 10px; overflow: auto; }
.reaction-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
}
.react-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; cursor: pointer;
}
.react-chip.reacted {
  background: var(--purple-tint); border-color: rgba(122,51,255,.25); color: var(--purple-3);
}
.replies-h {
  font-family: "Inter Tight"; font-size: 17px; font-weight: 700;
  margin: 24px 0 12px;
}
.reply {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.reply.nested {
  margin-left: 46px;
  padding-left: 16px;
  border-left: 2px solid var(--purple-tint);
}
.reply-body { color: var(--ink-2); font-size: 14.5px; }

/* ─── LIBRARY ────────────────────────────────────────── */
.library {
  display: flex; flex-direction: column; gap: 18px;
}
.lib-tabs {
  display: flex; gap: 6px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px;
  width: max-content;
}
.lib-tab {
  padding: 8px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; color: var(--ink-3); cursor: pointer;
}
.lib-tab.is-active { background: var(--purple-tint); color: var(--purple-3); }

.upcoming-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.upcoming-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.upcoming-cover {
  height: 130px;
  background: var(--grad-card);
  position: relative;
  color: #fff;
  padding: 14px 16px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.upcoming-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; opacity: 0.6;
}
.upcoming-cover .when {
  position: relative; z-index: 2;
  font-size: 12px; opacity: 0.85;
}
.upcoming-card .body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.upcoming-card h3 {
  margin: 0; font-family: "Inter Tight"; font-size: 16px; font-weight: 700;
}
.upcoming-card .host { color: var(--ink-3); font-size: 13px; }
.upcoming-card .row { display: flex; align-items: center; gap: 8px; margin-top: auto; }

.recordings {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}
.rec-sidebar {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  height: max-content;
  max-height: 70vh; overflow: auto;
}
.rec-item {
  padding: 10px 8px; border-radius: 8px;
  cursor: pointer; display: flex; gap: 10px;
}
.rec-item:hover { background: var(--bg-soft); }
.rec-item.is-active { background: var(--purple-tint); }
.rec-thumb {
  width: 64px; height: 40px; border-radius: 6px;
  background: var(--ink); object-fit: cover;
}
.rec-title { font-weight: 600; font-size: 13.5px; }
.rec-when { color: var(--ink-4); font-size: 11.5px; margin-top: 2px; }
.rec-main {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 0;
  overflow: hidden;
}
.rec-player {
  aspect-ratio: 16/9; background: #000;
}
.rec-player iframe, .rec-player video {
  width: 100%; height: 100%; border: 0;
}
.rec-detail-body { padding: 20px 24px; }
.rec-detail-body h2 { margin: 0 0 8px; font-family: "Inter Tight"; font-size: 22px; }
.rec-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rec-downloads {
  margin-top: 18px;
  background: var(--bg-soft); border-radius: 12px;
  padding: 14px 16px;
}
.rec-downloads h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.rec-downloads a {
  display: block; padding: 6px 0; color: var(--purple-3); font-size: 14px;
}

/* ─── PROFILE ────────────────────────────────────────── */
.profile-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  max-width: 560px;
  display: flex; flex-direction: column; gap: 18px;
}
.profile-card h1 {
  margin: 0;
  font-family: "Inter Tight"; font-size: 22px; font-weight: 700;
}
.avatar-block {
  display: flex; align-items: center; gap: 16px;
}
.avatar-big {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--grad-purple); color: #fff;
  font-weight: 700; font-size: 28px;
  display: grid; place-items: center;
  overflow: hidden;
}
.avatar-big img { width: 100%; height: 100%; object-fit: cover; }
.field-row { display: flex; flex-direction: column; gap: 6px; }
.field-row label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.field-row .hint { color: var(--ink-3); font-size: 12px; }

/* ─── Modals ─────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(8, 2, 58, 0.55);
  display: grid; place-items: center;
  z-index: 200;
  padding: 24px;
}
.modal-card {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 600px;
  max-height: 80vh; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 0;
}
.modal-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-family: "Inter Tight"; font-size: 17px; }
.gif-modal { max-width: 680px; }
.gif-modal .text-input { margin: 12px 18px 0; width: calc(100% - 36px); }
.gif-grid {
  flex: 1; overflow: auto;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; padding: 12px 18px 18px;
}
.gif-grid img {
  width: 100%; height: 120px; object-fit: cover;
  border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line);
}
.gif-grid img:hover { border-color: var(--purple); }

.lib-modal .text-input { margin: 12px 18px 0; width: calc(100% - 36px); }
.lib-list { flex: 1; overflow: auto; padding: 12px 18px 18px; }
.lib-list .lib-row {
  padding: 10px; border-radius: 8px; display: flex; gap: 10px; cursor: pointer;
}
.lib-list .lib-row:hover { background: var(--bg-soft); }
.lib-list img.thumb { width: 80px; height: 50px; border-radius: 6px; background: var(--ink); object-fit: cover; }

/* ─── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ─── Empty / error states ───────────────────────────── */
.empty {
  text-align: center; padding: 50px 24px;
  color: var(--ink-3);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.empty h3 { margin: 0 0 8px; font-family: "Inter Tight"; color: var(--ink); font-size: 18px; }

/* ─── Responsive: tablet ─────────────────────────────── */
@media (max-width: 1100px) {
  .view { padding: 16px 18px 50px; }
  .chat { grid-template-columns: 220px 1fr; gap: 12px; }
  .chat.with-thread { grid-template-columns: 220px 1fr 320px; }
  .forum { grid-template-columns: 220px 1fr; gap: 14px; }
  .recordings { grid-template-columns: 240px 1fr; }
}

/* ─── Responsive: small tablet ───────────────────────── */
@media (max-width: 900px) {
  /* Topbar — collapse to two-row grid; tabnav full-width with scroll */
  .topbar-inner {
    grid-template-columns: 1fr auto;
    padding: 12px 16px;
    gap: 10px;
  }
  .tabnav {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .tabnav::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }
  .brand { font-size: 16px; }
  .me-pill {
    padding: 4px 10px 4px 4px;
    font-size: 12.5px;
  }
  .me-pill #meName {
    max-width: 80px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: inline-block;
  }
  .top-actions .ghost.small:not(.back-to-dash) { padding: 5px 9px; font-size: 12px; }
  .top-actions .ghost.small.back-to-dash {
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--purple-tint);
    border-color: rgba(122,51,255,.18);
    color: var(--purple-3);
    font-weight: 600;
    line-height: 1;
    font-size: 13px;
  }
  .top-actions .ghost.small.back-to-dash .back-to-dash-full { display: none; }
  .top-actions .ghost.small.back-to-dash .back-to-dash-mobile {
    display: inline-block;
    font-size: 17px;
    line-height: 1;
    color: var(--purple-3);
  }

  /* Main view — tighter padding */
  .view { padding: 14px 14px 80px; }

  /* CHAT — single-column on mobile. Rooms become a collapsible
     drawer triggered by the in-chat-head menu button (added by JS). */
  .chat {
    grid-template-columns: 1fr;
    gap: 12px;
    height: calc(100vh - 140px);
    height: calc(100dvh - 140px);
    min-height: 0;
  }
  .chat.with-thread { grid-template-columns: 1fr; }
  .chat-rooms {
    position: fixed;
    inset: 0 30% 0 0;
    z-index: 80;
    border-radius: 0 14px 14px 0;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .25s ease;
    max-width: 320px;
    padding: 14px 10px;
  }
  .chat-rooms.is-open { transform: translateX(0); }
  .chat-rooms-close {
    background: transparent; border: 0; color: var(--ink-3);
    font-size: 14px; padding: 4px 8px; margin-left: auto;
  }
  /* Show the mobile rooms-toggle button (rendered by JS on the chat head). */
  .chat-head-mobile-toggle {
    display: inline-flex !important;
  }

  .chat-main { min-height: 0; }
  .chat-head { padding: 12px 14px; }
  .chat-head h2 { font-size: 15.5px; }
  .chat-head .room-desc { display: none; }
  .chat-stream { padding: 12px 12px; }
  .msg { padding: 8px 4px; grid-template-columns: 32px 1fr; gap: 8px; }
  .msg .avatar { width: 32px; height: 32px; font-size: 12px; }
  .msg-body { font-size: 14px; }
  /* On mobile the toolbar is always visible (no hover state on touch) so
     the action affordances stay discoverable. We tighten the layout. */
  .msg-toolbar {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    right: 4px;
    top: -8px;
    padding: 1px;
  }
  .msg-toolbar-btn { padding: 4px 5px; }
  .msg-toolbar-btn svg { width: 14px; height: 14px; }

  /* Attachments — never blow the viewport */
  .attach-img, .attach-gif {
    max-width: 100%; max-height: 220px; height: auto;
  }
  .attach-video {
    max-width: 100%; max-height: 220px;
  }
  .attach-libref-rich, .attach-file { max-width: 100%; }
  .attach-preview { width: 84px; }
  .attach-preview[data-type="image"],
  .attach-preview[data-type="gif"],
  .attach-preview[data-type="video"] { width: 76px; }
  .attach-preview img, .attach-preview video, .attach-preview .preview-icon {
    height: 64px;
  }
  /* Right-click menu — fall back to centered modal-ish positioning if
     the page narrows. The JS already clamps to viewport, but tighten
     the min-width so it fits on small screens. */
  .msg-menu { min-width: 180px; }

  /* Composer — tighter; prevent iOS keyboard zoom on focus */
  .composer { padding: 10px 12px; }
  .composer-row { padding: 8px 10px; border-radius: 12px; }
  .composer-row textarea { font-size: 16px; min-height: 32px; }
  .composer-actions { gap: 4px; flex-wrap: wrap; }
  .composer-actions .btn.small { padding: 8px 14px; font-size: 13px; }
  .compose-icon { padding: 6px 8px; font-size: 13px; }

  /* Thread side panel — full-screen overlay on mobile */
  .chat-thread {
    position: fixed;
    inset: 0;
    z-index: 90;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
  .chat-thread .head { padding: 14px 16px; }
  .chat-thread .body { padding: 12px 14px; }

  /* FORUM — stack categories above the post list as a horizontal pill rail */
  .forum { grid-template-columns: 1fr; gap: 12px; }
  .forum-cats {
    padding: 8px 8px;
    height: auto;
  }
  .forum-cats h4 { display: none; }
  .forum-cats #catList {
    display: flex; gap: 6px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .forum-cats #catList::-webkit-scrollbar { display: none; }
  .cat {
    flex-shrink: 0;
    padding: 7px 12px;
    font-size: 13px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    white-space: nowrap;
  }
  .cat.is-active {
    background: var(--purple-tint);
    border-color: rgba(122,51,255,.25);
    color: var(--purple-3);
  }
  .forum-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  .forum-actions .btn { width: 100%; justify-content: center; }
  .post-row {
    grid-template-columns: 40px 1fr;
    gap: 10px 12px;
    padding: 12px 14px;
  }
  .post-row .post-stats {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 18px;
    text-align: left;
    border-top: 1px dashed var(--line);
    padding-top: 8px;
    margin-top: 4px;
  }
  .post-stats b { display: inline; margin-right: 4px; }
  .post-title { font-size: 14.5px; }
  .post-detail { padding: 18px 16px; border-radius: 14px; }
  .post-detail h1 { font-size: 20px; line-height: 1.2; }
  .post-body { font-size: 14.5px; line-height: 1.6; }
  .replies-h { font-size: 15px; margin: 18px 0 10px; }
  .reply { grid-template-columns: 32px 1fr; gap: 8px; }
  .reply.nested { margin-left: 18px; padding-left: 12px; }

  /* LIBRARY — tabs full-width, recordings stack, sidebar becomes a horizontal rail */
  .lib-tabs {
    width: 100%; justify-content: stretch;
    display: grid; grid-template-columns: 1fr 1fr;
  }
  .lib-tab { text-align: center; font-size: 13px; padding: 9px 12px; }
  .upcoming-list { grid-template-columns: 1fr; gap: 12px; }
  .upcoming-card .row { flex-wrap: wrap; gap: 6px; }
  .recordings { grid-template-columns: 1fr; gap: 12px; }
  .rec-sidebar {
    max-height: 200px;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 10px;
  }
  .rec-sidebar::-webkit-scrollbar { display: none; }
  .rec-item {
    flex: 0 0 220px;
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
  }
  .rec-item .rec-thumb { width: 100%; height: 110px; }
  .rec-player iframe, .rec-player video { aspect-ratio: 16/9; }
  .rec-detail-body { padding: 16px 16px 22px; }
  .rec-detail-body h2 { font-size: 18px; }

  /* PROFILE — full-width card */
  .profile-card { padding: 22px 18px; max-width: 100%; }
  .profile-card h1 { font-size: 19px; }
  .field-row .text-input { font-size: 16px; }

  /* Bell dropdown — anchor to right edge with safe gutters */
  .mentions-drop {
    right: 12px; left: 12px;
    width: auto;
    top: 110px;
    max-height: 65vh;
  }

  /* Modals — full-width, scrollable, bottom-sheet feel */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  .gif-modal .text-input,
  .lib-modal .text-input {
    margin: 12px 14px 0;
    width: calc(100% - 28px);
    font-size: 16px;
  }
  .gif-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px; padding: 10px 14px 14px;
  }
  .gif-grid img { height: 100px; }
  .lib-list { padding: 10px 14px 14px; }

  /* Mention picker — fit within viewport */
  .mention-picker { width: calc(100vw - 32px); max-width: 320px; }

  /* Toast */
  .toast { bottom: 16px; padding: 9px 16px; font-size: 13px; }
}

/* By default, the chat-head mobile toggle is rendered by the JS but
   hidden on desktop. Toggled on by the @media (max-width: 900px) block.
   Same posture for the rooms-drawer close button — only shown when the
   sidebar collapses into a slide-over on small viewports. */
.chat-head-mobile-toggle { display: none; }
.chat-rooms-close { display: none; }
/* Scrim is hidden + out-of-flow on every viewport. The mobile @media
   block re-styles `.chat-rooms` into a fixed drawer; otherwise the
   scrim never participates in the chat grid layout. */
.chat-rooms-scrim {
  position: fixed; inset: 0;
  background: rgba(10,10,10,.45);
  z-index: 79;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.chat-rooms-scrim.is-open { opacity: 1; pointer-events: auto; }
@media (max-width: 900px) {
  .chat-rooms-close { display: inline-flex; }
}

/* ─── Responsive: phone ──────────────────────────────── */
@media (max-width: 480px) {
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .view { padding: 12px 10px 80px; }
  .chat-rooms { inset: 0 22% 0 0; }
  .chat-head { padding: 10px 12px; }
  .chat-stream { padding: 10px 10px; }
  .post-detail { padding: 16px 12px; }
  .gif-grid { grid-template-columns: repeat(2, 1fr); }
  .upcoming-cover { height: 100px; padding: 10px 12px; }
  .upcoming-card .body { padding: 12px 14px; }
}

/* ════════════════════════════════════════════════════════════════════════
   MEMBER AREA — DASHBOARD / PRODUCTS / ACCOUNT / BILLING
   The community shell is now the canonical member area. The four sections
   below (dashboard, products, account, billing) live alongside chat / forum
   / library and ship their own visual language while reusing brand tokens.
   ════════════════════════════════════════════════════════════════════════ */

/* Lock chip on tabs that require Plus/Pro. */
.tab .lock-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  vertical-align: middle;
}

/* User dropdown — matches dashboard.html's component visually so the
   member experiences the same affordance when they cross between the
   community-as-member-area and any auth/legal page elsewhere on the
   product. */
.user-dropdown {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  animation: ddIn .18s cubic-bezier(.2,.8,.2,1);
  transform-origin: top right;
}
@keyframes ddIn {
  from { opacity: 0; transform: scale(.96) translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.user-dropdown-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.user-dropdown-name {
  font-family: "Inter Tight", sans-serif;
  font-weight: 700; font-size: 14.5px;
  color: var(--ink);
  line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-dropdown-email {
  font-size: 12px; color: var(--ink-4);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-dropdown-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: transparent; border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.user-dropdown-item:hover,
.user-dropdown-item:focus-visible {
  background: var(--bg-soft);
  color: var(--ink);
  outline: none;
}
.user-dropdown-item svg { color: var(--ink-3); flex-shrink: 0; }
.user-dropdown-item:hover svg { color: var(--purple-3); }
.user-dropdown-item.is-cta {
  background: linear-gradient(135deg, rgba(154,59,255,.08) 0%, rgba(94,26,216,.08) 100%);
  color: var(--purple-3);
  font-weight: 600;
}
.user-dropdown-item.is-cta svg { color: var(--purple-3); }
.user-dropdown-item.is-cta:hover {
  background: linear-gradient(135deg, #9a3bff 0%, #5e1ad8 100%);
  color: #fff;
}
.user-dropdown-item.is-cta:hover svg { color: #fff; }
.user-dropdown-item.is-danger { color: var(--red, #c83e3e); }
.user-dropdown-item.is-danger:hover {
  background: var(--red-tint, #fdf3f3);
  color: var(--red, #c83e3e);
}
.user-dropdown-item.is-danger:hover svg { color: var(--red, #c83e3e); }
.user-dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 4px;
}

/* ─── Greeting hero (used on Dashboard) ────────────────── */
.greeting {
  position: relative;
  margin-bottom: 24px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(60% 80% at 15% 20%, rgba(122,51,255,.45) 0%, rgba(122,51,255,0) 60%),
    radial-gradient(50% 70% at 85% 30%, rgba(230,64,255,.28) 0%, rgba(230,64,255,0) 70%),
    radial-gradient(50% 70% at 70% 90%, rgba(255,142,60,.18) 0%, rgba(255,142,60,0) 70%),
    linear-gradient(180deg, #0c0334 0%, #08023a 50%, #14092e 100%);
  color: #fff;
  box-shadow: 0 20px 60px -10px rgba(8,2,58,.45);
}
.greeting::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
  pointer-events: none;
}
.greeting-inner {
  position: relative;
  padding: 36px 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  z-index: 1;
}
.greeting-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 14px;
}
.greeting-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #36e185;
  box-shadow: 0 0 0 3px rgba(54,225,133,.25);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }
.greeting h1 {
  font-family: "Inter Tight", sans-serif; font-weight: 800;
  font-size: clamp(28px, 4.4vw, 40px);
  letter-spacing: -0.028em;
  line-height: 1.05;
  margin: 0 0 8px;
  color: #fff;
  text-wrap: balance;
}
.greeting h1 .serif {
  font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400;
  background: linear-gradient(90deg, #c14dff 0%, #ff8e3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.greeting p {
  color: rgba(255,255,255,.72); font-size: 15.5px; line-height: 1.55;
  margin: 0; max-width: 60ch;
}
.greeting .stats {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch;
}
.greeting .stat {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 12px 18px;
  text-align: left;
  min-width: 130px;
  backdrop-filter: blur(6px);
}
.greeting .stat-label { color: rgba(255,255,255,.55); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.greeting .stat-value { color: #fff; font-size: 19px; font-weight: 700; font-family: "Inter Tight", sans-serif; letter-spacing: -0.015em; }

/* ─── Dashboard sections ───────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.dash-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 22px 18px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}
.dash-card.span-6 { grid-column: span 6; }
.dash-card.span-12 { grid-column: span 12; }
.dash-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.dash-head h3 {
  margin: 0;
  font-family: "Inter Tight", sans-serif;
  font-size: 16px; font-weight: 700;
  letter-spacing: -0.012em;
}
.dash-head .dash-action {
  font-size: 12.5px; font-weight: 600;
  color: var(--purple-3);
}
.dash-head .dash-action:hover { text-decoration: underline; }
.dash-card .empty-mini {
  padding: 22px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  background: var(--bg-soft);
  border-radius: 10px;
}
.dash-card .empty-mini h4 {
  margin: 0 0 6px;
  font-family: "Inter Tight", sans-serif; font-size: 14.5px; color: var(--ink);
}

/* Locked card — shown in place of content for free customers. Centred
   gradient pitch + CTA. */
.dash-locked {
  display: grid; place-items: center;
  text-align: center;
  padding: 28px 18px;
  background: linear-gradient(180deg, var(--bg-soft) 0%, #fff 100%);
  border: 1px dashed rgba(122,51,255,.32);
  border-radius: 12px;
}
.dash-locked .lock-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--purple-tint);
  color: var(--purple-3);
  display: grid; place-items: center;
  margin-bottom: 8px;
  font-size: 18px;
}
.dash-locked p {
  color: var(--ink-2); font-size: 13.5px;
  margin: 0 0 12px; max-width: 40ch; line-height: 1.5;
}
.dash-locked .lock-tease {
  margin: 8px 0 12px;
  font-family: "Inter Tight", sans-serif;
  font-weight: 600; color: var(--ink); font-size: 14.5px;
}

/* Recent posts list inside the dashboard */
.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-list-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s ease;
  text-decoration: none; color: inherit;
}
.dash-list-row:hover { background: var(--bg-soft); }
.dash-list-row .avatar { width: 32px; height: 32px; font-size: 12.5px; flex-shrink: 0; }
.dash-list-row .row-main { min-width: 0; }
.dash-list-row .row-title {
  font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px;
}
.dash-list-row .row-meta {
  color: var(--ink-4); font-size: 11.5px;
  margin-top: 2px;
}
.dash-list-row .row-snippet {
  color: var(--ink-3); font-size: 13px;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-list-row .row-stat {
  font-size: 11px; color: var(--ink-4); white-space: nowrap;
  font-weight: 600;
}

/* Upcoming-call card on dashboard */
.dash-upcoming-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}
.dash-upcoming-card + .dash-upcoming-card { margin-top: 10px; }
.dash-upcoming-cover {
  width: 96px; height: 76px;
  border-radius: 9px;
  background: linear-gradient(135deg, #9a3bff 0%, #5e1ad8 100%);
  color: #fff;
  display: grid; place-items: center;
  font-size: 28px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.dash-upcoming-cover img { width: 100%; height: 100%; object-fit: cover; }
.dash-upcoming-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dash-upcoming-meta h4 {
  margin: 0;
  font-family: "Inter Tight", sans-serif;
  font-size: 14.5px; font-weight: 700;
  line-height: 1.2;
}
.dash-upcoming-when { color: var(--purple-3); font-size: 12px; font-weight: 600; }
.dash-upcoming-host { color: var(--ink-3); font-size: 12px; }

/* Recordings strip on dashboard */
.dash-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.dash-rec-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  text-decoration: none; color: inherit;
}
.dash-rec-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dash-rec-thumb {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #9a3bff 0%, #5e1ad8 100%);
  display: grid; place-items: center;
  color: rgba(255,255,255,.85);
  font-size: 22px;
}
.dash-rec-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dash-rec-card h5 {
  margin: 8px 10px 4px;
  font-size: 13px; font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}
.dash-rec-card .when {
  margin: 0 10px 10px;
  font-size: 11px; color: var(--ink-4);
}

/* ─── Section titles for dashboard / products / etc. ──── */
.section-title {
  font-family: "Inter Tight", sans-serif; font-weight: 800;
  font-size: 24px; letter-spacing: -0.022em;
  margin: 0 0 6px;
  line-height: 1.15;
}
.section-title .serif {
  font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400;
  color: var(--purple-3);
}
.section-sub {
  color: var(--ink-3); font-size: 14.5px;
  margin: 0 0 22px;
  max-width: 60ch;
  line-height: 1.55;
}

/* ─── Products view (member library) ──────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.product {
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, border-color .25s ease;
  position: relative;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  min-height: 220px;
}
.product:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -12px rgba(122,51,255,.20), var(--shadow-md);
  border-color: rgba(122,51,255,.35);
}
.product-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: var(--purple-tint);
  color: var(--purple-3);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.product.is-pro { background: var(--grad-card); border-color: rgba(193,77,255,.30); color: #fff; }
.product.is-pro .product-icon {
  background: linear-gradient(135deg, #c14dff 0%, #7a33ff 100%);
  color: #fff;
  box-shadow: 0 6px 20px -4px rgba(193,77,255,.45);
}
.product.is-pro h3 { color: #fff; }
.product.is-pro p { color: rgba(255,255,255,.7); }
.product.is-plus .product-icon {
  background: linear-gradient(135deg, #ff8e3c 0%, #ff5e3c 100%);
  color: #fff;
}
.product.is-templates .product-icon,
.product.is-automation-templates .product-icon {
  background: linear-gradient(135deg, #36e185 0%, #14a35d 100%);
  color: #fff;
}
.product h3 {
  font-family: "Inter Tight", sans-serif; font-weight: 700;
  font-size: 17px; letter-spacing: -0.012em;
  margin: 0 0 4px;
  line-height: 1.25;
}
.product p {
  color: var(--ink-3); font-size: 13.5px; margin: 0 0 14px;
  line-height: 1.5;
  flex: 1;
}
.product-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: auto;
  gap: 8px;
}
.product.is-pro .product-meta { border-color: rgba(255,255,255,.14); }
.product .meta-date { color: var(--ink-4); white-space: nowrap; }
.product.is-pro .meta-date { color: rgba(255,255,255,.55); }
.product .pill {
  padding: 3px 10px; border-radius: 999px;
  background: var(--green-tint, #e9f7ee); color: var(--green, #14a35d);
  font-weight: 600; font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  border: none;
}
.product .pill.recurring { background: var(--purple-tint); color: var(--purple-3); }
.product.is-pro .pill { background: rgba(54,225,133,.18); color: #6dffa7; }
.product.is-pro .pill.recurring { background: rgba(193,77,255,.20); color: #f0d3ff; }
.product-cta {
  margin-top: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "Inter Tight", sans-serif;
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-2);
}
.product.is-pro .product-cta { color: #fff; }

.empty-card {
  background: #fff;
  border: 1px dashed var(--line-2, #e0ddd6);
  border-radius: 18px;
  padding: 56px 32px;
  text-align: center;
  color: var(--ink-3);
}
.empty-card h3 {
  color: var(--ink); margin: 0 0 8px;
  font-family: "Inter Tight", sans-serif; font-size: 20px;
}

/* ─── Account view ─────────────────────────────────────── */
.acct-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.acct-card h2 {
  font-family: "Inter Tight", sans-serif; font-weight: 700;
  font-size: 17px; letter-spacing: -0.012em;
  margin: 0 0 4px;
}
.acct-card .desc {
  color: var(--ink-3); font-size: 13px;
  margin: 0 0 16px;
}
.acct-form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}
.acct-form-row.stack { grid-template-columns: 1fr; }
.acct-field { display: flex; flex-direction: column; gap: 6px; }
.acct-field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.acct-field input {
  appearance: none;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 10px;
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.acct-field input:focus {
  outline: none;
  border-color: var(--purple);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(122,51,255,.10);
}
.acct-hint {
  font-size: 12px; color: var(--ink-4); margin-top: 6px;
}

/* ─── Billing view — subscription hero, plan switcher, orders ── */
.sub-hero {
  background: var(--grad-card);
  color: #fff;
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.sub-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 80% 30%, #000 0%, transparent 60%);
  -webkit-mask-image: radial-gradient(ellipse at 80% 30%, #000 0%, transparent 60%);
  pointer-events: none;
}
.sub-hero-inner { position: relative; }
.sub-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff;
  margin-bottom: 14px;
}
.sub-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #36e185;
  box-shadow: 0 0 0 3px rgba(54,225,133,.25);
}
.sub-eyebrow.warn .dot { background: #ffae3c; box-shadow: 0 0 0 3px rgba(255,174,60,.25); }
.sub-eyebrow.bad .dot  { background: #ff5151; box-shadow: 0 0 0 3px rgba(255,81,81,.25); }
.sub-hero h2 {
  font-family: "Inter Tight", sans-serif; font-weight: 800;
  font-size: 26px; letter-spacing: -0.022em;
  margin: 0 0 6px;
}
.sub-hero h2 .serif {
  font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400;
  background: linear-gradient(90deg, #c14dff 0%, #ff8e3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub-hero p {
  color: rgba(255,255,255,.72); font-size: 14.5px;
  margin: 0 0 16px;
}
.sub-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.sub-meta-cell {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  padding: 11px 14px;
}
.sub-meta-label { color: rgba(255,255,255,.55); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.sub-meta-value { color: #fff; font-size: 14.5px; font-weight: 600; font-family: "Inter Tight", sans-serif; }
.sub-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sub-actions .btn {
  background: rgba(255,255,255,.10);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
}
.sub-actions .btn:hover { background: rgba(255,255,255,.16); }
.sub-actions .btn.btn-cta { background: #fff; color: var(--ink); border-color: transparent; }
.sub-actions .btn.btn-cta:hover { background: #f0f0f0; }
.sub-actions .btn.btn-warn {
  background: rgba(255,81,81,.12);
  color: #ffb1b1;
  border-color: rgba(255,81,81,.25);
}
.sub-actions .btn.btn-warn:hover { background: rgba(255,81,81,.18); color: #ffd1d1; }

/* Plan switcher (Plus ↔ Pro, monthly ↔ yearly) */
.plan-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.plan-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
  position: relative;
}
.plan-card.is-current { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(122,51,255,.10); }
.plan-card.featured {
  background: var(--grad-card);
  color: #fff;
  border-color: transparent;
}
.plan-card.featured .plan-name,
.plan-card.featured .plan-price-amount,
.plan-card.featured .plan-feature { color: #fff; }
.plan-card.featured .plan-price-unit,
.plan-card.featured .plan-feature::before { color: rgba(255,255,255,.6); }
.plan-card.featured .plan-tag { background: rgba(255,255,255,.14); color: #fff; }
.plan-tag {
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  background: var(--purple-tint); color: var(--purple-3);
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.plan-name {
  font-family: "Inter Tight", sans-serif; font-weight: 700;
  font-size: 19px; letter-spacing: -0.014em;
  margin: 0 0 4px;
}
.plan-price {
  display: flex; align-items: baseline; gap: 4px;
  margin: 6px 0 14px;
}
.plan-price-amount {
  font-family: "Inter Tight", sans-serif; font-weight: 800;
  font-size: 28px; letter-spacing: -0.025em;
  color: var(--ink);
}
.plan-price-unit { color: var(--ink-3); font-size: 13.5px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 7px; }
.plan-feature {
  color: var(--ink-2); font-size: 13.5px;
  display: flex; align-items: flex-start; gap: 8px;
}
.plan-feature::before { content: "✓"; color: var(--purple-3); font-weight: 800; }
.plan-card .btn { width: 100%; justify-content: center; }
.plan-card.featured .btn { background: #fff; color: var(--ink); }
.plan-card.featured .btn:hover { background: #f0f0f0; }

.interval-toggle {
  display: inline-grid; grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 11px;
  margin: 0 0 16px;
}
.interval-toggle button {
  background: transparent; border: 0;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  font-family: inherit;
}
.interval-toggle button.is-active {
  background: #fff; color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.interval-toggle button .savings {
  margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--green-tint, #e9f7ee); color: var(--green, #14a35d);
  font-size: 10.5px; font-weight: 700;
}

.order-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  font-size: 14px;
}
.order-row:last-child { border-bottom: 0; }
.order-row .num { color: var(--ink-4); font-family: "Geist Mono", monospace; font-size: 12px; }
.order-row .pill {
  padding: 3px 10px; border-radius: 999px;
  background: var(--green-tint, #e9f7ee); color: var(--green, #14a35d);
  font-weight: 600; font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  border: none;
}
.order-row .pill.refunded { background: var(--amber-tint, #fff5e6); color: var(--amber, #b96a00); }

/* ─── Confirm modal (used by billing/account flows) ──────────
   Reuses the existing .modal backdrop (position: fixed; inset: 0;
   z-index: 200; display: grid; place-items: center) — we only override
   the inner card sizing + body text styling here. */
.confirm-modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 440px;
  max-height: none;
  display: block;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.confirm-modal h3 {
  font-family: "Inter Tight", sans-serif; font-weight: 700;
  font-size: 18px; margin: 0 0 8px;
}
.confirm-modal p { color: var(--ink-3); margin: 0 0 18px; font-size: 14px; line-height: 1.55; }
.confirm-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
@media (max-width: 540px) {
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .btn { width: 100%; justify-content: center; }
}

/* ─── Responsive: dashboard / products / billing  ──────── */
@media (max-width: 1100px) {
  .dash-card.span-6 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .greeting-inner { padding: 28px 22px; grid-template-columns: 1fr; gap: 18px; align-items: start; }
  .greeting h1 { font-size: clamp(24px, 6vw, 32px); }
  .sub-hero { padding: 22px 20px; }
  .sub-hero h2 { font-size: 22px; }
  .plan-switcher { grid-template-columns: 1fr; }
  .acct-form-row { grid-template-columns: 1fr; }
  .acct-form-row .btn { width: 100%; justify-content: center; }
  .dash-rec-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .order-row { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 0; }
  .order-row > :nth-child(1) { grid-column: 1 / -1; }
  .order-row > :nth-child(4) { grid-column: 1 / -1; text-align: right; font-size: 15px; font-weight: 600; }
  .greeting .stats { width: 100%; }
  .greeting .stat { flex: 1 1 calc(50% - 6px); min-width: 0; padding: 10px 12px; }
  /* Force tabnav into a horizontal scroll strip on phones so 5 tabs fit */
  .tabnav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 100%;
  }
  .tabnav::-webkit-scrollbar { display: none; }
  .tabnav .tab { flex-shrink: 0; }
}
@media (max-width: 540px) {
  .dash-card { padding: 18px 16px; }
  .acct-card { padding: 20px; }
  .sub-actions .btn { width: 100%; justify-content: center; }
  .product { padding: 18px; min-height: 0; }
  .acct-field input { font-size: 16px; /* prevents iOS zoom on focus */ }
  .greeting .stat { flex-basis: 100%; }
  .me-name { max-width: 80px; }
  .me-caret { display: none; }
  .user-dropdown { min-width: 220px; max-width: calc(100vw - 24px); }
  .top-link { display: none; }
  .topbar-inner { grid-template-columns: auto auto; }
  .tabnav {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 0 4px;
  }
  .topbar-inner { grid-template-rows: auto auto; padding-bottom: 8px; }
}

/* ─── Presence indicators (status dot on avatars) ───────
   A 12px dot pinned to the bottom-right of an avatar, color-coded by
   effective presence. Renders inside `.avatar-wrap` which is a relative
   container we wrap around .avatar wherever we want the dot. */
.avatar-wrap { position: relative; display: inline-block; vertical-align: middle; line-height: 0; }
.presence-dot {
  position: absolute; right: -2px; bottom: -2px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--ink-4);
  border: 2px solid #fff;
  pointer-events: none;
}
.presence-dot[data-status="online"]  { background: #14a35d; }
.presence-dot[data-status="busy"]    { background: #d94656; }
.presence-dot[data-status="offline"] { background: var(--ink-4); }
.presence-dot.is-sm { width: 9px; height: 9px; right: -1px; bottom: -1px; border-width: 1.5px; }
.presence-dot.is-lg { width: 14px; height: 14px; right: 0; bottom: 0; border-width: 2px; }

/* ─── Status selector pill (in topbar) ──────────────────
   Tap the avatar pill to open the user dropdown; status sits inside the
   dropdown as a horizontal row of small dotted chips. */
.status-row {
  padding: 6px 6px 10px;
  display: flex; gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.status-chip {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.status-chip:hover { background: var(--bg-soft); }
.status-chip.is-active {
  background: var(--purple-tint);
  border-color: rgba(122,51,255,.25);
  color: var(--purple-3);
}
.status-chip .dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
}
.status-chip[data-status="online"]  .dot { background: #14a35d; }
.status-chip[data-status="busy"]    .dot { background: #d94656; }
.status-chip[data-status="offline"] .dot { background: var(--ink-4); }

/* ─── Members panel (sidebar inside chat / dm view) ─────
   The chat surface now has a 3-column layout on desktop:
     [ rooms | messages | members ]
   When a thread is open we drop the members panel and re-use that
   slot for the thread sidebar instead. */
.chat { grid-template-columns: 220px 1fr 240px; }
.chat.with-thread { grid-template-columns: 220px 1fr 360px; }
.chat.with-thread .chat-members { display: none; }

.chat-members {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
  padding: 12px 8px;
}
.chat-members-head {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.chat-members-head h4 {
  margin: 0; flex: 1;
  font-family: "Inter Tight"; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-4);
}
.chat-members-head .count {
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  background: var(--bg-soft); padding: 2px 6px; border-radius: 999px;
}
.member-filter {
  display: flex; gap: 4px; padding: 0 8px 8px;
}
.member-filter button {
  flex: 1;
  font-family: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-3);
  padding: 5px 6px;
  border-radius: 7px;
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
}
.member-filter button:hover { background: var(--bg-soft); }
.member-filter button.is-active {
  background: var(--purple-tint);
  border-color: rgba(122,51,255,.25);
  color: var(--purple-3);
}
.member-search {
  margin: 0 8px 8px;
  display: block; width: calc(100% - 16px);
  font-family: inherit;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 13px;
}
.member-search:focus { outline: none; border-color: rgba(122,51,255,.4); }
.member-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease;
}
.member-row:hover { background: var(--bg-soft); }
.member-row .avatar { width: 28px; height: 28px; font-size: 11px; }
.member-row .name {
  font-weight: 600; font-size: 13.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-row .you {
  display: inline-block;
  background: var(--purple-tint); color: var(--purple-3);
  padding: 1px 5px; border-radius: 4px;
  font-size: 10px; font-weight: 700; margin-left: 4px;
  text-transform: uppercase; letter-spacing: .04em;
}
.member-section-label {
  font-size: 10.5px; font-weight: 700; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 10px 12px 4px;
}

/* Make `.msg-name` interactive so it's discoverable that you can click
   a member's name to open their profile. */
.msg-name { cursor: pointer; }
.msg-name:hover { color: var(--purple-3); text-decoration: underline; }

/* ─── DM panel (alternative left sidebar when on chat?#dm) ──
   The DM list lives in the same column as `.chat-rooms`. It shows the
   "other participant" + a preview + an unread badge. */
.dm-pane-tabs {
  display: flex; gap: 4px; padding: 6px 8px 8px;
  border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.dm-pane-tabs button {
  flex: 1;
  font-family: inherit;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-3);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
}
.dm-pane-tabs button:hover { background: var(--bg-soft); }
.dm-pane-tabs button.is-active {
  background: var(--purple-tint);
  color: var(--purple-3);
}
.dm-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease;
}
.dm-row:hover { background: var(--bg-soft); }
.dm-row.is-active { background: var(--purple-tint); }
.dm-row .avatar { width: 32px; height: 32px; font-size: 12px; }
.dm-row .meta { min-width: 0; }
.dm-row .name {
  font-weight: 700; color: var(--ink); font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-row .preview {
  color: var(--ink-3); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-row .when { color: var(--ink-4); font-size: 11px; white-space: nowrap; }
.dm-row .unread {
  background: var(--purple); color: #fff;
  border-radius: 999px; padding: 1px 7px;
  font-size: 11px; font-weight: 700; min-width: 18px;
  text-align: center; margin-top: 4px;
}
.dm-empty {
  text-align: center;
  padding: 22px 14px;
  color: var(--ink-3);
}
.dm-empty .btn { margin-top: 10px; }

/* The active chat header gets a "DM with X" treatment when viewing a DM.
   Re-uses .chat-head padding/layout. */
.dm-head-meta {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex: 1;
}
.dm-head-meta .avatar { width: 32px; height: 32px; font-size: 12px; }
.dm-head-meta .name { font-weight: 800; font-family: "Inter Tight"; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-head-meta .status {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--ink-3); font-size: 12.5px;
}

/* ─── Profile modal (member detail popup) ───────────────
   A center-screen card showing the clicked member's bio + avatar + status
   + a "Send DM" CTA. Reuses .modal backdrop. */
.profile-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%; max-width: 460px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
}
.profile-modal-close {
  position: absolute; right: 12px; top: 12px;
  border: 0; background: transparent;
  color: var(--ink-3); font-size: 18px;
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.profile-modal-close:hover { background: var(--bg-soft); color: var(--ink); }
.profile-modal .avatar-big {
  width: 96px; height: 96px;
  font-size: 30px; font-weight: 700;
  margin: 0 auto 14px;
}
.profile-modal h2 {
  margin: 0 0 4px;
  font-family: "Inter Tight"; font-size: 22px; font-weight: 700;
  color: var(--ink);
}
.profile-modal .profile-status {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-3); font-size: 13px;
  margin-bottom: 12px;
}
.profile-modal .profile-bio {
  color: var(--ink-2); font-size: 14.5px; line-height: 1.55;
  text-align: left; padding: 0 6px;
  margin: 8px 0 18px;
  word-break: break-word;
}
.profile-modal .profile-bio.empty { color: var(--ink-4); font-style: italic; text-align: center; }
.profile-modal .profile-meta {
  display: flex; gap: 14px; justify-content: center; align-items: center;
  color: var(--ink-4); font-size: 12px;
  margin: 6px 0 14px;
  flex-wrap: wrap;
}
.profile-modal .profile-actions {
  display: flex; gap: 10px; justify-content: center;
  flex-wrap: wrap;
}
.profile-modal .profile-actions .btn {
  min-width: 132px;
  justify-content: center;
}

/* ─── Responsive: tablet — keep members panel visible ───
   Below 1100px we drop the members panel back into the rooms column as
   a stacked sub-section. Below 900px the whole chat becomes single-column. */
@media (max-width: 1240px) {
  .chat { grid-template-columns: 220px 1fr 220px; }
  .chat.with-thread { grid-template-columns: 200px 1fr 280px; }
  .chat.with-thread .chat-members { display: none; }
}
@media (max-width: 1100px) {
  /* Tablet — drop back to 2 columns. The members panel becomes a
     drawer (hidden by default, slides in from the right via the JS
     `Members` button in the chat-head). */
  .chat { grid-template-columns: 220px 1fr; }
  .chat.with-thread { grid-template-columns: 220px 1fr 320px; }
  .chat-members {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(320px, 86vw);
    z-index: 80;
    border-radius: 14px 0 0 14px;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform .25s ease;
    padding: 14px 10px;
    margin-top: 0;
    max-height: none;
    background: #fff;
  }
  .chat-members.is-open { transform: translateX(0); }
  .chat-members-close {
    background: transparent; border: 0; color: var(--ink-3);
    font-size: 14px; padding: 4px 8px;
    display: inline-flex !important;
  }
}
@media (max-width: 900px) {
  /* Mobile — the drawer is already styled above; only tweak the modal. */
  .profile-modal { max-width: 100%; border-radius: 18px 18px 0 0; }
}

/* Default-hide the close-X for the members drawer (only visible on mobile,
   where the panel is a slide-over). */
.chat-members-close { display: none; }

