/* ═══════════════════════════════════════════════════════════════════
   The member shell (PLATFORM-REDESIGN §5.3). Loaded after ghawy-tokens.css,
   ghawy-ui.css and ghawy-shell.css (the top bar / sidebar / nav / drawer the
   team dashboard uses too). This file adds only what members have and the
   team doesn't: the page title in the top bar, the member card at the foot of
   the sidebar, and the phone bottom bar. Tokens only; logical properties only.

   Reserved slots: #mTopbar has the top bar's height and #tSidebar its width
   before member-shell.js fills them, so nothing shifts (CLS).
═══════════════════════════════════════════════════════════════════ */
body.m-app { min-height: 100dvh; }
/* member-boot.js: English waits for i18n.js (see there); only on the shell pages. */
html.t-i18n-wait body.m-app { visibility: hidden; }
.m-app .t-body { min-height: calc(100dvh - var(--t-topbar-h)); }
.m-app .t-sidebar { height: calc(100dvh - var(--t-topbar-h)); }
.m-app #mTopbar:empty, .m-app .t-topbar { min-height: var(--t-topbar-h); }

/* A section heading inside a page (home, profile): title + one action at the end */
.m-sec-head { display: flex; align-items: center; justify-content: space-between; gap: var(--t-3); margin-block-end: var(--t-3); }
.m-sec-title { margin: 0; font-size: var(--t-fs-16); font-weight: var(--t-fw-bold); color: var(--t-text); }

/* ── Top bar ──────────────────────────────────────────────────────── */
.m-menu-btn { display: none; }
.m-title {
  margin: 0; min-width: 0; flex: 0 1 auto; max-width: 28ch;
  font-size: var(--t-fs-16); font-weight: var(--t-fw-bold); line-height: var(--t-lh-tight); color: var(--t-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-app .t-brand { flex: 0 0 auto; }
.m-app .t-brand + .m-title { padding-inline-start: var(--t-3); border-inline-start: 1px solid var(--t-border); }
.m-topbar-av { display: inline-flex; }
.m-app a.t-nav-item, .m-app a.t-brand, .m-bb-item, .m-sb-streak, .m-sb-avatar { text-decoration: none; }
.m-bell-list { max-height: min(70vh, 520px); overflow-y: auto; }

/* ── Sidebar foot: the member card ────────────────────────────────── */
.m-sb-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "av who" "streak streak";
  gap: var(--t-2) var(--t-3); margin: var(--t-2); padding: var(--t-3);
  border: 1px solid var(--t-border); border-radius: var(--t-r-lg); background: var(--t-surface-2);
}
.m-sb-avatar { grid-area: av; display: inline-flex; border-radius: 50%; }
.m-sb-avatar .t-avatar { width: 40px; height: 40px; font-size: var(--t-fs-14); }
.m-sb-who { grid-area: who; display: flex; flex-direction: column; min-width: 0; justify-content: center; }
.m-sb-name { font-weight: var(--t-fw-bold); color: var(--t-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sb-badge { font-size: var(--t-fs-12); color: var(--t-accent-ink); font-weight: var(--t-fw-medium); }
.m-sb-streak {
  grid-area: streak; display: flex; align-items: center; gap: var(--t-2); min-height: 32px; padding: 0 var(--t-2);
  border-radius: var(--t-r-md); background: var(--t-warning-bg); color: var(--t-warning);
  font-size: var(--t-fs-13); font-weight: var(--t-fw-bold); text-decoration: none;
}
.m-sb-streak:hover { filter: brightness(1.08); }
.t-nav-collapsed .m-sb-card { grid-template-columns: 1fr; grid-template-areas: "av"; justify-items: center; padding: var(--t-2); }
.t-nav-collapsed .m-sb-who, .t-nav-collapsed .m-sb-streak { display: none; }

/* ── ≤1024: drawer (ghawy-shell.css) — the menu button shows ─────── */
@media (max-width: 1024px) {
  .m-menu-btn { display: inline-flex; }
  .m-app .t-sidebar { height: 100dvh; }
}
@media (max-width: 640px) {
  .m-app .t-brand-name { display: none; }
  .m-title { max-width: none; flex: 1 1 auto; }
  .m-app .t-brand + .m-title { border-inline-start: 0; padding-inline-start: 0; }
}

/* ── ≤768: the phone bottom bar ───────────────────────────────────── */
.m-bottombar { display: none; }
@media (max-width: 768px) {
  .m-bottombar {
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: var(--t-z-topbar);
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--t-bottombar-h) + env(safe-area-inset-bottom, 0px));
    padding-block-end: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--t-surface-1) 92%, transparent);
    backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-block-start: 1px solid var(--t-border);
  }
  .m-app .t-main { padding-block-end: calc(var(--t-bottombar-h) + env(safe-area-inset-bottom, 0px) + var(--t-6)); }
  /* Inside a conversation, the player, onboarding and the auth pages it stays out of the way. */
  body[data-bottombar="off"] .m-bottombar { display: none; }
  body[data-bottombar="off"] .t-main { padding-block-end: var(--t-6); }
}
.m-bb-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; min-height: 44px; padding: var(--t-1) 2px; border: 0; background: transparent;
  color: var(--t-text-3); font: inherit; font-size: var(--t-fs-12); font-weight: var(--t-fw-medium); text-decoration: none; cursor: pointer;
}
.m-bb-item .t-ic { width: 22px; height: 22px; }
.m-bb-item[aria-current="page"] { color: var(--t-accent-ink); }
.m-bb-item[aria-current="page"]::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 30%; height: 3px;
  border-radius: 0 0 var(--t-r-pill) var(--t-r-pill); background: var(--t-accent);
}
.m-bb-text { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-bb-dot { position: absolute; inset-block-start: 4px; inset-inline-start: calc(50% + 4px); }

/* ── The member profile panel (member-profile.js, a t-drawer) ─────── */
.m-pp { display: flex; flex-direction: column; gap: var(--t-4); }
.m-pp-head { display: flex; align-items: center; gap: var(--t-4); }
.m-pp-av { position: relative; display: inline-flex; }
.m-pp-dot { position: absolute; inset-block-end: 2px; inset-inline-end: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--t-text-3); border: 2px solid var(--t-surface-1); }
.m-pp-dot.is-online { background: var(--t-success); }
.m-pp-who { display: flex; flex-direction: column; align-items: flex-start; gap: var(--t-1); min-width: 0; }
.m-pp-name { font-size: var(--t-fs-20); font-weight: var(--t-fw-black); color: var(--t-text); overflow-wrap: anywhere; }
.m-pp-bio { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--t-text-2); }
.m-pp-link { align-self: flex-start; max-width: 100%; }
.m-pp-joined { display: flex; align-items: center; gap: var(--t-1); margin: 0; font-size: var(--t-fs-13); }
.m-pp-note { display: flex; flex-direction: column; gap: var(--t-2); }
.m-pp-note-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--t-2); }

/* Achievements: one tile per achievement, locked ones dimmed (profile page + panel) */
.m-ach-grid { list-style: none; margin: var(--t-2) 0 0; padding: 0; display: grid; gap: var(--t-2); grid-template-columns: repeat(auto-fill, minmax(min(110px, 100%), 1fr)); }
.m-ach { display: flex; flex-direction: column; align-items: center; gap: var(--t-1); padding: var(--t-3) var(--t-2); text-align: center; min-height: 132px;
  border: 1px solid var(--t-border); border-radius: var(--t-r-md); background: var(--t-surface-2); }
.m-ach-ic { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; }
.m-ach--bronze .m-ach-ic { background: var(--t-warning-bg); color: var(--t-warning); }
.m-ach--silver .m-ach-ic { background: var(--t-neutral-bg); color: var(--t-neutral); }
.m-ach--gold .m-ach-ic { background: var(--t-accent-soft); color: var(--t-accent-ink); }
.m-ach--diamond .m-ach-ic { background: var(--t-info-bg); color: var(--t-info); }
.m-ach-name { font-size: var(--t-fs-12); font-weight: var(--t-fw-bold); color: var(--t-text); }
/* Locked: the icon is dimmed, the text keeps its contrast (opacity took it under 4.5:1). */
.m-ach.is-locked { border-style: dashed; }
.m-ach.is-locked .m-ach-ic { background: var(--t-surface-3); color: var(--t-text-3); }
