/* ═══════════════════════════════════════════════
   DRAWERS - Profile, Thread, Notification panels
   ═══════════════════════════════════════════════ */

/* ────────────────────────────────────────────────
   POST ANALYTICS DRAWER
   ──────────────────────────────────────────────── */
.post-analytics-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 510;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.post-analytics-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.post-analytics-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 511;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.post-analytics-drawer.open {
  transform: translateX(0);
}

@media (max-width: 900px) {
  .post-analytics-drawer {
    width: 100%;
    border-left: none;
  }
}

.post-analytics-drawer-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Analytics user list ──────────────────────── */

.analytics-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
}

.analytics-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.analytics-user-list {
  display: flex;
  flex-direction: column;
}

.analytics-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
}

.analytics-user-row:hover {
  background: var(--surface2);
}

.analytics-user-avatar {
  border-radius: 50%;
  overflow: hidden;
  position: relative;
}

.analytics-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.analytics-user-avatar .following-badge {
  bottom: -1px;
  right: -1px;
}

.analytics-user-info {
  flex: 1;
  min-width: 0;
}

.analytics-user-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}

.analytics-user-name:hover {
  color: var(--accent2);
}

.analytics-user-acct {
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.analytics-follows-you {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent2);
  background: rgba(var(--accent2-rgb, 155, 127, 255), 0.12);
  border: 1px solid rgba(var(--accent2-rgb, 155, 127, 255), 0.25);
  padding: 1px 5px;
  border-radius: 4px;
}

.analytics-lock-icon {
  opacity: 0.5;
  flex-shrink: 0;
}

/* Follow button inside analytics drawer (reuses .profile-follow-btn styles) */
.analytics-follow-btn {
  flex-shrink: 0;
  font-size: 12px;
  padding: 5px 14px;
}

.analytics-follow-btn.requested {
  background: transparent;
  border-color: var(--border2);
  color: var(--text-muted);
  cursor: default;
}

/* ────────────────────────────────────────────────
   PROFILE DRAWER
   ──────────────────────────────────────────────── */
.profile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 520;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.profile-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 521;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-drawer.open {
  transform: translateX(0);
}

@media (max-width: 900px) {
  .profile-drawer {
    width: 100%;
    border-left: none;
  }
}

/* ────────────────────────────────────────────────
   MANAGE HASHTAGS DRAWER
   ──────────────────────────────────────────────── */
.manage-hashtag-backdrop,
.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.manage-hashtag-backdrop.open,
.settings-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.manage-hashtag-drawer,
.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.manage-hashtag-drawer.open,
.settings-drawer.open {
  transform: translateX(0);
}

@media (max-width: 900px) {

  .manage-hashtag-drawer,
  .settings-drawer {
    width: 100%;
    border-left: none;
  }
}

.manage-hashtag-drawer-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ────────────────────────────────────────────────
   SETTINGS TOGGLE SWITCH
   ──────────────────────────────────────────────── */
.settings-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.settings-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border2);
  transition: background 200ms ease;
  position: relative;
  flex-shrink: 0;
}

.settings-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-toggle input:checked+.settings-toggle-track {
  background: var(--accent);
}

.settings-toggle input:checked+.settings-toggle-track::after {
  transform: translateX(18px);
}

.settings-toggle input:disabled+.settings-toggle-track {
  opacity: 0.4;
  cursor: not-allowed;
}


.profile-drawer-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.profile-back-analytics-btn {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all var(--trans);
}

.profile-drawer[data-from-analytics] .profile-back-analytics-btn {
  display: flex;
}

.profile-back-analytics-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

.profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 100;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
}

.profile-close:hover {
  border-color: var(--border2);
  color: var(--text);
}

.profile-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}

/* Header */
.profile-header-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}

.profile-header-img.empty {
  background: linear-gradient(135deg, var(--surface2) 0%, var(--border) 100%);
}

/* Identity */
.profile-identity {
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Mobile: tighter padding while keeping readability */
@media (max-width: 600px) {
  .profile-identity {
    padding: 0 16px 12px;
  }
}

.profile-avatar-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

/* Mobile: better alignment for avatar and actions */
@media (max-width: 600px) {
  .profile-avatar-wrap {
    align-items: center;
    gap: 12px;
  }
}

.profile-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  background: var(--surface2);
  object-fit: cover;
  margin-top: -28px;
}

.profile-avatar-wrap .following-badge {
  width: 18px;
  height: 18px;
  bottom: 6px;
  right: 2px;
  border-width: 1.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.profile-avatar-wrap .following-badge svg {
  width: 10px;
  height: 10px;
}

/* Badges */
.profile-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 4px;
}

.profile-badge-bot {
  background: rgba(78, 205, 196, 0.15);
  color: var(--teal);
}

.profile-badge-locked {
  background: var(--surface2);
  color: var(--text-dim);
}

.profile-display-name {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.profile-acct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.profile-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Follow/Edit Buttons */
.profile-follow-btn {
  flex-shrink: 0;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: all var(--trans);
}

/* Mobile: adjust button sizing for better fit */
@media (max-width: 600px) {
  .profile-follow-btn {
    padding: 6px 12px;
    font-size: 11px;
  }
}

.profile-follow-btn:hover {
  background: var(--accent2);
  border-color: var(--accent2);
}

.profile-follow-btn.following {
  background: transparent;
  border-color: var(--border2);
  color: var(--text-muted);
}

.profile-follow-btn.following:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.4);
  color: #ff8080;
}

.profile-follow-btn.blocked {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
  color: var(--danger);
  cursor: not-allowed;
}

.profile-follow-btn.blocked:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
}

.profile-follow-btn.muted {
  background: rgba(107, 114, 128, 0.12);
  border-color: rgba(107, 114, 128, 0.6);
  color: var(--text-muted);
  cursor: not-allowed;
}

.profile-follow-btn.muted:hover {
  background: rgba(107, 114, 128, 0.2);
  border-color: rgba(107, 114, 128, 0.6);
}

.profile-follow-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-follow-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-notify-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
}

.profile-notify-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent2);
}

.profile-notify-btn.notifying {
  background: rgba(155, 127, 255, 0.12);
  border-color: var(--accent);
  color: var(--accent2);
}

.profile-notify-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-notify-btn.ringing svg {
  animation: bellRing 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.profile-more-menu-wrapper {
  position: relative;
}

.profile-more-menu-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
}

.profile-more-menu-btn:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
  color: var(--text);
}

.profile-more-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 200ms ease;
  z-index: 1000;
}

.profile-more-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.profile-block-btn,
.profile-mute-btn {
  width: 100%;
  display: block;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: all var(--trans);
}

.profile-block-btn:first-child {
  border-radius: 8px 8px 0 0;
}

.profile-mute-btn:last-child {
  border-radius: 0 0 8px 8px;
}

.profile-block-btn:hover,
.profile-mute-btn:hover {
  background: var(--surface2);
  color: var(--danger);
}

.profile-block-btn.blocked,
.profile-mute-btn.muted {
  color: var(--danger);
}

.profile-block-btn:disabled,
.profile-mute-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-top: 12px;
}

/* Mobile: allow buttons to wrap and flex properly */
@media (max-width: 600px) {
  .profile-action-group {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }
}

.profile-edit-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: all var(--trans);
  margin-top: 2px;
  text-decoration: none;
  display: inline-block;
}

.profile-edit-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent2);
}

/* Bio & Stats */
.profile-bio {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: 10px;
}

.profile-bio a {
  color: var(--accent2);
  text-decoration: none;
}

.profile-bio a:hover {
  text-decoration: underline;
}

.profile-stats {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.profile-stat-num {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.profile-stat-label {
  font-size: 11px;
  color: var(--text-dim);
}

/* Fields */
.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 14px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.profile-field {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  background: var(--surface);
  gap: 1px;
  position: relative;
}

/* Mobile: slightly more padding for better readability */
@media (max-width: 600px) {
  .profile-field {
    padding: 10px 12px;
  }
}

.profile-field.verified {
  background: rgba(78, 205, 196, 0.04);
}

.profile-field-name {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.profile-field-value {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-field-value a {
  color: var(--accent2);
  text-decoration: none;
}

/* Mobile: allow field values to wrap */
@media (max-width: 600px) {
  .profile-field-value {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
  }
}

.profile-field.verified .profile-field-name {
  color: var(--teal);
}

.profile-field.verified .verified-icon {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--teal);
}

/* Join date & external link */
.profile-joined {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.profile-joined svg {
  opacity: 0.6;
}

.profile-open-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 9px;
  transition: all var(--trans);
}

.profile-open-link:hover {
  border-color: var(--accent);
  color: var(--accent2);
}

/* Moved Banner */
.profile-moved-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255, 107, 107, 0.08);
  /* Using danger color faintly */
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.profile-moved-banner svg {
  color: var(--danger);
  flex-shrink: 0;
}

.moved-title {
  font-weight: 600;
  font-size: 14px;
}

.moved-text {
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.moved-text strong {
  color: var(--danger);
  font-weight: 500;
}

.moved-btn {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--trans);
  flex-shrink: 0;
}

.moved-btn:hover {
  opacity: 0.8;
}

/* Posts section tabs */
.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.profile-tabs::-webkit-scrollbar {
  display: none;
}

.profile-tab {
  flex: 1;
  flex-shrink: 0;
  padding: 12px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--trans), border-color var(--trans);
  white-space: nowrap;
}

.profile-tab:hover {
  color: var(--text);
}

.profile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.profile-tab-panel {
  min-height: 100vh;
}

.profile-tab-panel[hidden] {
  display: none;
}

/* Media grid */
.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}

.profile-media-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg2);
  cursor: pointer;
  width: 100%;
  display: block;
}

.profile-media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--trans);
}

.profile-media-item:hover img {
  opacity: 0.82;
}

.profile-media-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.28);
}

.profile-drawer-inner .post {
  padding: 14px 20px;
}

/* ─── Pinned Posts ─── */
.pinned-section {
  border-bottom: 1px solid var(--border);
}

.pinned-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 10px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border2);
}

.pinned-header-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pinned-header-label svg {
  opacity: 0.8;
  flex-shrink: 0;
}

.pinned-header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pinned-nav {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
}

.pinned-nav:hover {
  background: var(--surface2);
  color: var(--accent2);
  border-color: var(--accent);
}

.pinned-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 28px;
  text-align: center;
}

.pinned-single .post {
  padding: 14px 20px;
  border-bottom: none;
}

.pinned-carousel-outer {
  overflow: hidden;
  width: 100%;
  transition: height 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pinned-carousel-track {
  display: flex;
  align-items: flex-start;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pinned-slide {
  flex: 0 0 100%;
  width: 100%;
  display: block;
  opacity: 0.5;
  transition: opacity 0.6s ease;
}

.pinned-slide.active {
  opacity: 1;
}

.pinned-slide .post {
  padding: 14px 20px;
  border-bottom: none;
}

.pinned-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 8px 0 10px;
}

.pinned-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border2);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background var(--trans), transform var(--trans);
}

.pinned-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* ────────────────────────────────────────────────
   THREAD DRAWER
   ──────────────────────────────────────────────── */
.thread-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.thread-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.thread-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(700px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 301;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.thread-drawer.open {
  transform: translateX(0);
}

@media (max-width: 900px) {
  .thread-drawer {
    width: 100%;
    border-left: none;
  }
}

/* Desktop inline mode */
@media (min-width: 901px) {
  body.thread-inline-active .thread-drawer {
    display: none;
  }

  body.thread-inline-active .thread-backdrop {
    display: none;
  }

  body.thread-inline-active .thread-inline-panel {
    display: flex;
  }

  body.thread-inline-active .tab-bar {
    display: none;
  }

  body.thread-inline-active .feed-container>.tab-panel {
    display: none !important;
  }

  body.manage-inline-active .manage-inline-panel {
    display: flex;
  }

  body.manage-inline-active .tab-bar {
    display: none;
  }

  body.manage-inline-active .feed-container>.tab-panel {
    display: none !important;
  }
}

.thread-inline-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  background: var(--surface);
}

.thread-back-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 98;
}

.thread-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px 6px 6px;
  border-radius: 6px;
  transition: background var(--trans), color var(--trans);
}

.thread-back-btn:hover {
  background: rgba(155, 127, 255, 0.1);
  color: var(--accent2);
}

.thread-back-btn svg {
  flex-shrink: 0;
}

.thread-back-bar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.thread-inline-inner {
  flex: 1;
}

@media (min-width: 901px) {

  body.thread-inline-active .feed-container,
  body.manage-inline-active .feed-container {
    padding-bottom: 0;
  }

  body.thread-inline-active .thread-inline-panel,
  body.manage-inline-active .manage-inline-panel {
    flex: 1;
  }
  
  .thread-back-bar {
    top: 55px;
  }
}

.manage-inline-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  background: var(--surface);
}

.manage-inline-inner {
  flex: 1;
  padding: 20px;
}

body.manage-inline-active .manage-inline-panel {
  display: flex;
}

/* Header & Close */
.thread-drawer-header {
  position: relative;
  padding: 14px 50px 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
  min-height: 52px;
  display: flex;
  align-items: center;
}

.thread-drawer-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.thread-close-btn {
  position: absolute;
  top: 11px;
  right: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
  flex-shrink: 0;
  z-index: 10;
}

.thread-close-btn:hover {
  border-color: var(--border2);
  color: var(--text);
  background: var(--surface);
}

.thread-drawer-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Thread status / loading */
.thread-status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  flex-direction: column;
  gap: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Thread post variants */
.thread-post-ancestor,
.thread-post-focal,
.thread-post-reply {
  position: relative;
}


.thread-post-reply {
  border-bottom: 1px solid var(--border);
}

.thread-reply-to {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  padding: 8px 18px 0;
}

.thread-reply-to-acct {
  color: var(--accent2);
  font-weight: 500;
}

.thread-reply-children {
  border-left: 0px solid var(--border);
  margin-left: 10px;
}

/* Posts inside thread drawers - keep feed styling, just remove clickable cursor */
.thread-drawer-inner .post,
.thread-inline-inner .post {
  cursor: default;
}


/* Section & focal labels */
.thread-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 18px 6px;
  border-bottom: 1px solid var(--border);
}

.thread-section-label.context-jump-btn {
  cursor: pointer;
  transition: all var(--trans);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  background: rgba(155, 127, 255, 0.04);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.thread-section-label.context-jump-btn:hover {
  background: rgba(155, 127, 255, 0.08);
  color: var(--accent2);
}

.thread-section-label.context-jump-btn svg {
  opacity: 0.8;
  transition: transform var(--trans);
}

.thread-section-label.context-jump-btn:hover svg {
  transform: translate(2px, -2px);
  opacity: 1;
}

.thread-focal-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 10px 18px 6px;
  border-bottom: 1px solid var(--border);
}

.thread-focal-label::before,
.thread-focal-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.2;
}

.thread-show-more-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  padding: 8px 18px;
  transition: color var(--trans);
}

.thread-show-more-btn:hover {
  color: var(--accent2);
}

/* ────────────────────────────────────────────────
   NOTIFICATION DRAWER
   ──────────────────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
  display: inline-flex;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 180ms ease, transform 180ms ease;
}

.notif-badge.visible {
  opacity: 1;
  transform: scale(1);
}

.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.notif-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100%);
  background: var(--surface);
  box-shadow: inset 1px 0 0 var(--border);
  z-index: 251;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notif-drawer.open {
  transform: translateX(0);
}

@media (max-width: 900px) {
  .notif-drawer {
    width: 100%;
    border-left: none;
    box-shadow: none;
  }
}

.notif-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: inset 1px 0 0 var(--border);
  min-height: 52px;
}

.notif-drawer-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.notif-close-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
}

.notif-close-btn:hover {
  background: var(--surface);
  border-color: var(--border2);
  color: var(--text);
}

.notif-drawer-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

/* Filters */
.notif-filters {
  display: flex;
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 1px 0 0 var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

.notif-filter-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--trans);
}

.notif-filter-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

.notif-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Items */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px 14px 21px;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans), border-color 300ms ease, opacity 300ms ease;
  cursor: pointer;
  position: relative;
}

/* ── Unread state - prominent indicator ── */
.notif-item.unread {
  background: rgba(155, 127, 255, 0.04);
}

.notif-item.unread::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  z-index: 2;
}

.notif-item.unread .notif-icon {
  background: currentColor;
  box-shadow: 0 0 12px -2px currentColor;
}

.notif-item.unread .notif-icon svg {
  color: var(--surface);
}

.notif-item.unread .notif-who {
  color: var(--text);
  font-weight: 600;
}

/* ── Read state - slightly muted ── */
.notif-item:not(.unread) {
  opacity: 0.7;
}

.notif-item:not(.unread):hover {
  opacity: 1;
}

/* Smooth transition when marking as read */
.notif-icon {
  transition: background 300ms ease, box-shadow 300ms ease;
}

.notif-icon svg {
  transition: color 300ms ease;
}

.notif-item:hover {
  background: var(--surface2);
}

/* Mark All Read button in header */
.notif-clear-all-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--trans);
  margin-left: auto;
  margin-right: 10px;
}

.notif-clear-all-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(155, 127, 255, 0.06);
}

.notif-clear-all-btn.has-unread {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(155, 127, 255, 0.06);
}

.notif-clear-all-btn svg {
  flex-shrink: 0;
}

.notif-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-icon.type-mention {
  background: rgba(155, 127, 255, 0.15);
  color: var(--accent);
}

.notif-icon.type-reblog {
  background: rgba(78, 205, 196, 0.15);
  color: var(--boost);
}

.notif-icon.type-favourite {
  background: rgba(255, 217, 61, 0.15);
  color: var(--fav);
}

.notif-icon.type-follow {
  background: rgba(155, 127, 255, 0.15);
  color: var(--accent2);
}

.notif-icon.type-poll {
  background: rgba(136, 136, 160, 0.15);
  color: var(--text-muted);
}

.notif-icon.type-update {
  background: rgba(78, 205, 196, 0.15);
  color: var(--teal);
}

.notif-icon.type-status {
  background: rgba(155, 127, 255, 0.15);
  color: var(--accent);
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.notif-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
}

.notif-who {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.notif-who:hover {
  color: var(--accent);
}

.notif-action {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

.notif-preview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-top: 4px;
  cursor: pointer;
}

.notif-preview:hover {
  color: var(--text);
}

.notif-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 4px;
}

.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  text-align: center;
}

.notif-empty svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ── Follow Profile Snippet ── */
.notif-follow-panel {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg2); /* Subtle contrast against the surface */
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 200ms ease;
}

.notif-follow-panel:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.notif-follow-bio {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-follow-bio p {
  margin: 0;
}

.notif-follow-stats {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.notif-follow-stat strong {
  color: var(--text);
  font-weight: 500;
}

.notif-load-more {
  display: block;
  width: 100%;
  padding: 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--trans);
}

.notif-load-more:hover {
  background: var(--surface2);
}
/* Large Desktop Overrides */
@media (min-width: 1400px) {
  .post-analytics-drawer, .profile-drawer, .manage-hashtag-drawer, .settings-drawer, .notif-drawer {
    width: min(560px, 100%) !important;
  }
  .thread-drawer {
    width: min(840px, 100%) !important;
  }
}

