/* =============================================================================
   CommunityHub — account.css
   Compose dropdown, login/register/account pages
   ============================================================================= */

/* ---- Compose dropdown in header ---- */
.ch-compose-wrap {
  position: relative;
  display: inline-block;
}

.ch-compose-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.ch-compose-btn .ch-compose-icon {
  width: 15px;
  height: 15px;
  line-height: 1;
}
.ch-compose-btn .ch-dropdown-arrow {
  width: 14px;
  height: 14px;
  opacity: .85;
  transition: transform 0.15s ease;
}
.ch-compose-wrap.is-open .ch-compose-btn .ch-dropdown-arrow {
  transform: rotate(180deg);
}

.ch-compose-menu {
  position: absolute;
  top: 100%;          /* no gap so the menu touches the button */
  right: 0;
  margin-top: 4px;    /* visual breathing room without breaking hover-bridge */
  min-width: 260px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  z-index: var(--z-dropdown, 60);
}

/* Invisible bridge so the cursor can travel from button → menu without
   crossing a "no-element" zone that would close it on hover-based interaction. */
.ch-compose-menu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
  background: transparent;
}

.ch-compose-wrap.is-open .ch-compose-menu {
  display: block;
}

.ch-compose-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-text-primary);
  transition: background 0.15s ease;
}

.ch-compose-item:hover { background: var(--color-border-light); }

.ch-compose-item-icon {
  width: 22px;
  height: 22px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.ch-compose-item span > strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.ch-compose-item span > small {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 1px;
}

@media (max-width: 720px) {
  .ch-compose-btn .ch-compose-text { display: none; }
}

/* ---- Auth pages (login / register / lost-password) ---- */
.ch-auth-page {
  min-height: 60vh;
  padding: var(--spacing-2xl) 0 var(--spacing-3xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ch-auth-wrap { width: 100%; }

.ch-auth-card {
  max-width: 440px;
  margin: 0 auto;
  padding: var(--spacing-2xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

.ch-auth-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.ch-auth-title {
  font-size: 24px;
  margin: 0 0 6px;
  color: var(--color-text-primary);
}

.ch-auth-sub {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.ch-auth-form .ch-submit-row { margin-bottom: var(--spacing-md); }

.ch-auth-social {
  margin: 0 0 var(--spacing-lg);
}

.ch-auth-social-title {
  margin-bottom: 10px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.ch-auth-social .nsl-container {
  margin: 0 !important;
}

.ch-auth-social .nsl-container-buttons {
  width: 100%;
}

.ch-auth-social .nsl-container-buttons a {
  width: 100%;
}

.ch-auth-social .nsl-button {
  min-height: 46px;
  border: 1px solid #d6dce3 !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06) !important;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.ch-auth-social .nsl-button:hover {
  border-color: #b9c2cc !important;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1) !important;
  transform: translateY(-1px);
}

.ch-auth-social .nsl-button-label-container {
  font-weight: 700;
}

html[data-theme="dark"] .ch-auth-social .nsl-button {
  background: #050505 !important;
  background-color: #050505 !important;
  border-color: #2f3338 !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .ch-auth-social .nsl-button:hover {
  background: #0d0f12 !important;
  background-color: #0d0f12 !important;
  border-color: #4b5563 !important;
}

html[data-theme="dark"] .ch-auth-social .nsl-button-label-container {
  color: #f8fafc !important;
}

.ch-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: var(--spacing-md) 0 var(--spacing-lg);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.ch-auth-divider::before,
.ch-auth-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--color-border-light);
}

.ch-auth-row-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: var(--spacing-md) 0 var(--spacing-lg);
  font-size: 13px;
  flex-wrap: wrap;
  gap: 8px;
}

.ch-auth-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.ch-auth-link-sm {
  font-size: 13px;
  color: var(--color-primary);
  text-decoration: none;
}

.ch-auth-link-sm:hover { text-decoration: underline; }

.ch-auth-submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
}

.ch-auth-footer {
  margin-top: var(--spacing-lg);
  text-align: center;
  font-size: 14px;
  color: var(--color-text-secondary);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border-light);
}

.ch-auth-footer a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}

.ch-auth-footer a:hover { text-decoration: underline; }

.ch-auth-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border: 1px solid rgba(255, 69, 0, 0.18);
  border-radius: var(--radius-md);
  background: rgba(255, 69, 0, 0.045);
  text-align: left;
}

.ch-auth-switch strong,
.ch-auth-switch span {
  display: block;
}

.ch-auth-switch strong {
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.25;
}

.ch-auth-switch span {
  margin-top: 3px;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.ch-auth-footer .ch-auth-switch-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  flex: 0 0 auto;
  margin-left: 0;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 18px rgba(255, 69, 0, 0.18);
}

.ch-auth-footer .ch-auth-switch-link:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.ch-auth-footer .ch-auth-switch-link .ch-icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 520px) {
  .ch-auth-switch {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .ch-auth-footer .ch-auth-switch-link {
    width: 100%;
  }
}

/* ---- Account dashboard ---- */
.ch-account-page {
  padding: var(--spacing-2xl) 0 var(--spacing-3xl);
}

.ch-account-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-xl);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.ch-account-identity {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.ch-account-identity .ch-avatar { flex-shrink: 0; }

.ch-account-identity-meta { min-width: 0; }

.ch-account-name {
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--color-text-primary);
}

.ch-account-handle {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.ch-avatar-edit-control {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--reddit-vote-bg, var(--color-bg));
}

.ch-avatar-edit-control .ch-avatar {
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--color-card);
}

.ch-avatar-edit-control > div {
  flex: 1 1 auto;
  min-width: 0;
}

.ch-avatar-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.ch-avatar-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ch-avatar-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.ch-avatar-upload-button:hover {
  background: var(--reddit-hover, var(--color-border-light));
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.ch-avatar-upload-input:focus-visible + .ch-avatar-upload-button {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

.ch-avatar-upload-icon {
  width: 16px;
  height: 16px;
}

.ch-avatar-upload-name {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--color-text-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-account-stats {
  display: flex;
  gap: var(--spacing-xl);
}

.ch-account-stat {
  text-align: center;
}

.ch-account-stat-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.ch-account-stat-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* layout */
.ch-account-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--spacing-lg);
  align-items: start;
}

@media (max-width: 880px) {
  .ch-account-layout { grid-template-columns: 1fr; }
  .ch-avatar-edit-control { align-items: flex-start; flex-direction: column; }
  .ch-account-social-summary { grid-template-columns: 1fr; }
  .ch-account-message-layout,
  .ch-author-profile-grid { grid-template-columns: 1fr; }
  .ch-author-profile-hero { align-items: flex-start; flex-direction: column; }
  .ch-author-profile-actions,
  .ch-author-profile-stats { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .ch-account-social-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .ch-account-social-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* sidebar nav */
.ch-account-nav {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ch-account-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.ch-account-nav-item:hover { background: var(--color-border-light); }

.ch-account-nav-item.is-active {
  background: var(--color-primary);
  color: #fff;
}

.ch-account-nav-icon {
  width: 16px;
  height: 16px;
}

.ch-account-nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.ch-account-nav-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 6px 0;
}

.ch-account-nav-danger { color: #b42318; }
.ch-account-nav-danger:hover { background: #fef3f2; color: #7a271a; }

/* main panel */
.ch-account-main { min-width: 0; }

.ch-account-section {
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
}

.ch-account-section-title {
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--color-text-primary);
}

.ch-account-section-sub {
  margin: 0 0 var(--spacing-lg);
  color: var(--color-text-secondary);
  font-size: 14px;
}

.ch-account-section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.ch-account-section-toolbar .ch-account-section-title { margin: 0; }

/* quick links grid */
.ch-account-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.ch-account-quick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  text-decoration: none;
  color: var(--color-text-primary);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ch-account-quick:hover {
  background: var(--reddit-hover, var(--color-bg));
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.ch-account-quick-icon {
  font-size: 24px;
  line-height: 1;
  margin-bottom: 4px;
}

.ch-account-quick strong {
  font-size: 14px;
  font-weight: 600;
}

.ch-account-quick small {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* social dashboard */
.ch-account-social-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.ch-account-social-summary div {
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.ch-account-social-summary strong {
  display: block;
  color: var(--color-primary);
  font-size: 22px;
  line-height: 1;
}

.ch-account-social-summary span {
  display: block;
  margin-top: 6px;
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ch-account-social-group {
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border-light);
}

.ch-account-social-group + .ch-account-social-group {
  margin-top: var(--spacing-lg);
}

.ch-account-social-group h3 {
  margin: 0 0 var(--spacing-md);
  font-size: 15px;
  color: var(--color-text-primary);
}

.ch-account-social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--spacing-md);
}

.ch-account-social-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  min-width: 0;
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.ch-account-social-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--color-text-primary);
  text-decoration: none;
}

.ch-account-social-person span {
  min-width: 0;
}

.ch-account-social-person strong,
.ch-account-social-person small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-account-social-person strong {
  font-size: 14px;
  font-weight: 700;
}

.ch-account-social-person small {
  color: var(--color-text-muted);
  font-size: 12px;
}

.ch-account-social-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ch-account-social-empty {
  padding: var(--spacing-md);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 13px;
}

/* messages */
.ch-reddit-message-shell {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) 260px;
  gap: var(--spacing-lg);
  align-items: start;
}

.ch-message-filter-rail,
.ch-message-compose-card {
  position: sticky;
  top: 84px;
}

.ch-message-filter-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ch-message-filter-btn {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ch-message-filter-btn:hover,
.ch-message-filter-btn.is-active {
  border-color: var(--color-border);
  background: #f6f7f8;
  color: var(--color-text-primary);
}

.ch-message-filter-btn .ch-icon {
  width: 18px;
  height: 18px;
}

.ch-message-filter-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-message-filter-btn em {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--color-border-light);
  color: var(--color-text-muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
  text-align: center;
}

.ch-message-filter-btn.is-active em {
  background: var(--color-text-primary);
  color: #fff;
}

.ch-message-feed-panel {
  min-width: 0;
}

.ch-message-feed {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.ch-message-thread {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-card);
}

.ch-message-thread:last-child {
  border-bottom: 0;
}

.ch-message-thread.is-unread {
  background: #f8fbff;
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.ch-message-thread-marker {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: #fff;
  color: var(--color-text-muted);
}

.ch-message-thread.is-unread .ch-message-thread-marker {
  border-color: rgba(0, 102, 204, 0.32);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.ch-message-thread-main {
  min-width: 0;
}

.ch-message-thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-bottom: 8px;
}

.ch-message-thread-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--color-text-primary);
  text-decoration: none;
}

.ch-message-thread-person span {
  min-width: 0;
}

.ch-message-thread-person strong,
.ch-message-quick-person strong {
  display: block;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-message-thread-person small,
.ch-message-quick-person small {
  display: block;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-message-thread-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.ch-message-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.ch-message-pill.is-inbox {
  color: var(--color-primary-dark);
}

.ch-message-pill.is-sent {
  color: #0f766e;
}

.ch-message-pill.is-type {
  color: var(--color-text-muted);
}

.ch-message-thread p {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ch-message-thread-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ch-account-message-action {
  min-height: 28px;
  padding-inline: 8px;
  font-size: 12px;
  white-space: nowrap;
}

.ch-message-filter-empty {
  margin-top: var(--spacing-sm);
}

.ch-message-compose-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.ch-message-compose-card h3 {
  margin: 0;
  font-size: 15px;
}

.ch-message-quick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ch-message-quick-person {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ch-message-quick-person:hover {
  border-color: var(--color-border);
  background: #f6f7f8;
}

.ch-message-quick-person .ch-icon:last-child {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .ch-message-filter-btn:hover,
html[data-theme="dark"] .ch-message-filter-btn.is-active,
html[data-theme="dark"] .ch-message-quick-person:hover {
  background: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .ch-message-filter-btn.is-active em {
  background: var(--color-primary);
}

html[data-theme="dark"] .ch-message-thread.is-unread {
  background: rgba(59, 130, 246, 0.08);
}

html[data-theme="dark"] .ch-message-thread-marker,
html[data-theme="dark"] .ch-message-pill {
  background: var(--color-card);
}

@media (max-width: 1100px) {
  .ch-reddit-message-shell {
    grid-template-columns: 148px minmax(0, 1fr);
  }

  .ch-message-compose-card {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {
  .ch-reddit-message-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .ch-message-filter-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(4, minmax(96px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .ch-message-thread {
    grid-template-columns: minmax(0, 1fr);
    padding: 13px;
  }

  .ch-message-thread-marker {
    display: none;
  }

  .ch-message-thread-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ch-message-thread-meta {
    justify-content: flex-start;
    white-space: normal;
  }
}

.ch-private-message-modal {
  max-width: 520px;
  outline: none;
}

.ch-message-recipient {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: 0 0 var(--spacing-sm);
  color: var(--color-text-primary);
  font-weight: 700;
}

.ch-message-recipient-label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.ch-message-recipient-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-private-message-modal #ch-private-message-body {
  min-height: 112px;
  line-height: 1.5;
  resize: vertical;
}

.ch-private-message-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  flex-wrap: wrap;
}

.ch-private-message-actions .ch-btn { flex: 1 1 160px; }

/* author profile */
body.author {
  background-color: var(--color-card);
}

html[data-theme="dark"] body.author {
  background-color: var(--color-bg);
}

.ch-author-profile-page {
  padding: var(--spacing-2xl) 0 var(--spacing-3xl);
}

.ch-author-profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-xl);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
}

.ch-author-profile-main {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  min-width: 0;
}

.ch-author-profile-avatar-link {
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 999px;
  text-decoration: none;
}

.ch-author-profile-name-link {
  color: inherit;
  text-decoration: none;
}

.ch-author-profile-avatar-link:focus-visible,
.ch-author-profile-name-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.ch-author-profile-name-link:hover {
  color: var(--color-primary);
}

.ch-author-profile-main h1 {
  margin: 0 0 4px;
  font-size: 26px;
}

.ch-author-profile-main p {
  margin: 0;
  color: var(--color-text-muted);
}

.ch-author-profile-bio {
  margin-top: 8px;
  color: var(--color-text-secondary);
  max-width: 620px;
}

.ch-author-profile-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.ch-author-profile-stats {
  width: 100%;
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
  flex-wrap: wrap;
  background: #fff;
}

.ch-author-profile-stats span {
  min-width: 72px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #fff;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 12px;
}

.ch-author-profile-stats strong {
  display: block;
  color: var(--color-text-primary);
  font-size: 18px;
}

.ch-author-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--spacing-lg);
  align-items: start;
}

.ch-author-mini-section { padding: var(--spacing-lg); }

.ch-author-topic-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ch-author-topic-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-primary);
  font-weight: 700;
}

.ch-author-topic-list span {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
}

/* my posts list */
.ch-account-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ch-account-post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  flex-wrap: wrap;
}

.ch-account-post-item:last-child { border-bottom: 0; }

.ch-account-post-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  text-decoration: none;
}

.ch-account-post-title:hover { color: var(--color-primary); }

.ch-account-post-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}
